commit d7e382f2e755843650d3c250c0a7d709ee53d78d Author: lq Date: Fri Aug 14 21:50:48 2026 +0800 初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec37ac9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# Binaries +*.exe +*.exe~ +*.dll +*.so +*.dylib +tcm-agent + +# Test binaries +*.test +*.out + +# Dependency directories +vendor/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Config (contains secrets) +manifest/config/config.local.yaml + +# Logs +*.log + +# Build output +dist/ +build/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e30df9f --- /dev/null +++ b/Makefile @@ -0,0 +1,53 @@ +.PHONY: run build test clean docker-up docker-down + +# 运行开发模式 +run: + go run main.go + +# 编译 +build: + mkdir -p dist + CGO_ENABLED=0 GOOS=linux go build -o dist/tcm-agent main.go + +# 运行测试 +test: + go test -v -race -cover ./... + +# 测试特定包 +test-rule: + go test -v -run TestRule ./test/ + +test-agent: + go test -v -run TestAgent ./test/ + +# 代码格式化 +fmt: + go fmt ./... + +# 静态检查 +lint: + golangci-lint run ./... + +# 清理 +clean: + rm -rf dist/ + go clean + +# Docker 相关 +docker-up: + docker-compose -f manifest/docker/docker-compose.yml up -d + +docker-down: + docker-compose -f manifest/docker/docker-compose.yml down + +docker-logs: + docker-compose -f manifest/docker/docker-compose.yml logs -f + +# 运行模拟演示 +simulate: + go run examples/simulation.go + +# 安装依赖 +deps: + go mod tidy + go mod download diff --git a/README.md b/README.md new file mode 100644 index 0000000..9b68ff4 --- /dev/null +++ b/README.md @@ -0,0 +1,282 @@ +# 中医 AI Agent 系统 v2.0 + +基于 **Go + MaxKB + 多模型工厂** 的专业领域 AI Agent 脚手架。 + +## 🆕 v2.0 核心升级:模型工厂模式 + +**一个系统,多种模型,按场景自动路由,主挂了自动降级。** + +``` +┌─────────────────────────────────────────────────────────────┐ +│ HTTP API Layer (Gin) │ +│ /api/v1/emr /api/v1/prescription /api/v1/agent │ +├─────────────────────────────────────────────────────────────┤ +│ Handler Layer (业务编排) │ +│ 参数校验 → 调用Agent → 持久化 → 响应封装 │ +├─────────────────────────────────────────────────────────────┤ +│ Agent Engine (核心引擎) │ +│ ┌────────────────────────────────────────────────────────┐ │ +│ │ Runner → Planner → LLM → Tool Call → Reflect → Out │ │ +│ └────────────────────────────────────────────────────────┘ │ +├──────────────┬──────────────┬───────────────────────────────┤ +│ Tool Set │ Rule Engine │ Memory & Session │ +│ ├ MaxKB检索 │ 十八反十九畏 │ 短期:Session History │ +│ ├ HIS查询 │ 剂量校验 │ 长期:向量数据库 │ +│ ├ 药典查询 │ 孕妇禁忌 │ │ +│ └ 规则校验 │ 术语规范 │ │ +├──────────────┴──────────────┴───────────────────────────────┤ +│ LLM 模型工厂(v2.0 核心) │ +│ ┌───────────────────────────────────────────────────────┐ │ +│ │ Factory → Router → FallbackChain │ │ +│ │ ├ deepseek (病历生成主力) │ │ +│ │ ├ openai/gpt-4o (处方校验) │ │ +│ │ ├ qwen-max (中文知识问答) │ │ +│ │ ├ azure (企业合规部署) │ │ +│ │ └ ollama (本地离线兜底) │ │ +│ └───────────────────────────────────────────────────────┘ │ +├─────────────────────────────────────────────────────────────┤ +│ External Services │ +│ MaxKB (RAG) │ LLM APIs │ HIS │ MySQL │ +└─────────────────────────────────────────────────────────────┘ +``` + +## 🏗️ 架构亮点 + +### 模型工厂三件套 + +| 组件 | 职责 | 类比 | +|------|------|------| +| **ProviderFactory** | 注册/创建各供应商客户端 | 汽车工厂 | +| **ModelRouter** | 按场景名路由到对应模型 | GPS 导航 | +| **FallbackChain** | 主模型挂了自动切备用 | 备用轮胎 | + +### 场景 → 模型映射(config.yaml 配置) + +| 业务场景 | 路由到 | 为什么 | +|----------|--------|--------| +| 病历生成 (emr-generator) | DeepSeek V3 | 中文医学知识丰富,推理链清晰 | +| 处方校验 (prescription) | GPT-4o | 推理严谨,工具调用稳定 | +| 知识问答 (knowledge-qa) | 通义千问 Max | 中文检索效果好 | +| 向量化 (embedding) | text-embedding-3-small | 质量行业领先 | +| 降级兜底 (fallback) | Ollama 本地 | 离线可用,零成本 | + +**改模型只需改 config.yaml,不改一行代码。** + +## 快速开始 + +### 1. 启动 MaxKB 知识库 + +```bash +docker run -d --name maxkb -p 8080:8080 1panel/maxkb +``` + +访问 http://localhost:8080 上传中医典籍、药典、病历模板。 + +### 2. 配置(多模型) + +编辑 `manifest/config/config.yaml`: + +```yaml +llm: + default_provider: "deepseek" + models: + deepseek: + provider: "deepseek" + api_key: "sk-你的key" + base_url: "https://api.deepseek.com" + model: "deepseek-chat" + openai: + provider: "openai" + api_key: "sk-你的key" + base_url: "https://api.openai.com/v1" + model: "gpt-4o" + routes: + emr-generator: "deepseek" + prescription: "openai" +``` + +### 3. 运行 + +```bash +go mod tidy +go run main.go +``` + +### 4. 运行模拟演示 + +```bash +go run examples/simulation.go +``` + +将看到: +- 模型工厂创建各供应商客户端 +- 路由表展示场景→模型映射 +- 降级链工作原理 +- 两个完整业务场景的 Agent 生命周期 + +## API 接口 + +### 生成病历 + +```bash +curl -X POST http://localhost:8080/api/v1/emr/generate \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer " \ + -d '{ + "patient_id": "P001", + "chief_complaint": "反复头晕3个月,加重1周", + "history_notes": "患者3个月前无明显诱因出现头晕...", + "allergies": [], + "past_illness": ["慢性胃炎"] + }' +``` + +### 生成处方 + +```bash +curl -X POST http://localhost:8080/api/v1/prescription/generate \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer " \ + -d '{ + "patient_id": "P001", + "emr_text": "主诉:反复头晕3个月...舌暗红苔白腻 脉弦滑...", + "diagnosis": "痰湿中阻证", + "age": 45, + "is_pregnant": false, + "allergies": [] + }' +``` + +### 动态切换模型路由(热更新) + +```bash +curl -X POST http://localhost:8080/api/v1/models/route \ + -H "Content-Type: application/json" \ + -d '{"scene": "emr-generator", "provider": "gpt-4o"}' +``` + +### 查看当前路由表 + +```bash +curl http://localhost:8080/api/v1/models/routes +``` + +## 项目结构 + +``` +tcm-agent/ +├── main.go # 入口(初始化链:config→llm→agent→router) +├── go.mod +├── Makefile +├── README.md +│ +├── examples/ +│ └── simulation.go # 场景模拟演示(含模型工厂演示) +│ +├── docs/ +│ └── agent_lifecycle.md # Agent 生命周期详解 +│ +├── manifest/ +│ ├── config/config.yaml # 配置文件(多模型+路由+降级) +│ └── docker/ +│ ├── Dockerfile +│ └── docker-compose.yml +│ +├── test/ +│ └── agent_test.go # 单元测试(工厂/路由/降级/规则引擎) +│ +└── internal/ + ├── config/config.go # 配置加载(多模型支持) + │ + ├── llm/ # 🆕 模型工厂层(v2.0 核心) + │ ├── factory.go # 工厂+路由+降级(统一接口定义) + │ ├── deepseek.go # DeepSeek 客户端 + │ ├── openai.go # OpenAI 客户端 + │ └── other_providers.go # Azure/Ollama/Qwen/Mock + │ + ├── agent/ # Agent 引擎 + │ ├── runner.go # 核心调度器(使用 ModelRouter) + │ ├── emr_agent.go # 病历生成 Agent + │ └── prescription_agent.go # 处方生成 Agent + │ + ├── tool/ # Agent 工具集 + │ ├── maxkb.go # MaxKB 知识库客户端 + │ └── agent_tools.go # 工具注册(知识检索/HIS/药典/规则) + │ + ├── rule/ # 规则引擎 + │ └── rule_engine.go # 配伍禁忌/剂量/质控 + │ + ├── handler/ # HTTP 处理器 + │ ├── emr_handler.go + │ ├── prescription_handler.go + │ ├── knowledge_handler.go + │ └── agent_handler.go + │ + ├── router/router.go # 路由注册(含模型管理接口) + ├── middleware/middleware.go # 日志/CORS/鉴权 + ├── dao/dao.go # 数据访问层 + └── model/entity/entity.go # 数据模型 +``` + +## 安全设计 + +### 三层防护 + +1. **知识防线**:MaxKB 提供权威药典/典籍/指南 +2. **规则防线**:代码级硬校验(十八反、十九畏、剂量上限) +3. **人工防线**:医生最终审核(Human-in-the-Loop) + +### 审计日志 + +所有关键操作(生成、修改、审核)全链路记录,满足医疗合规要求。 + +## 扩展指南 + +### 接入新模型供应商 + +只需 3 步: + +1. **实现 LLMClient 接口**(`internal/llm/your_provider.go`): + ```go + type YourClient struct{ ... } + func (c *YourClient) Chat(ctx, messages, tools) (*Message, error) { ... } + func (c *YourClient) Embed(ctx, texts) ([][]float32, error) { ... } + // ... 实现其他接口方法 + ``` + +2. **注册到工厂**(`internal/llm/factory.go` 的 `NewProviderFactory` 中): + ```go + f.Register("your-provider", createYourClient) + ``` + +3. **在 config.yaml 中添加配置**: + ```yaml + llm: + models: + your-model: + provider: "your-provider" + api_key: "your-key" + base_url: "https://api.your-provider.com" + model: "your-model-name" + routes: + emr-generator: "your-model" # 切换病历生成到新模型 + ``` + +**无需修改任何业务代码。** + +## 测试 + +```bash +# 运行全部测试 +make test + +# 运行规则引擎测试 +make test-rule + +# 运行 Agent 测试 +make test-agent +``` + +## License + +MIT diff --git a/docs/agent_lifecycle.md b/docs/agent_lifecycle.md new file mode 100644 index 0000000..9e77e90 --- /dev/null +++ b/docs/agent_lifecycle.md @@ -0,0 +1,178 @@ +# AI Agent 生命周期详解 + +## 概述 + +本文档详细描述中医AI Agent的完整生命周期,以"患者主诉生成病历"和"病历生成处方"两个核心场景为例。 + +--- + +## 通用生命周期(6个阶段) + +``` +┌─────────┐ ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌─────────┐ ┌─────────┐ +│ ①感知 │───▶│ ②规划 │───▶│ ③检索 │───▶│ ④工具 │───▶│ ⑤反思 │───▶│ ⑥输出 │ +│ │ │ │ │ │ │ 调用 │ │ 校验 │ │ │ +└─────────┘ └─────────┘ └─────────┘ └──────────┘ └─────────┘ └─────────┘ + ▲ │ + │ │ + └────────────────────── 记忆沉淀(长期学习) ◀──────────────────────────────────┘ +``` + +--- + +## 场景A:患者主诉 → 生成病历 + +### 时序图 + +``` +患者/医生 Go服务(Controller) Agent Runner LLM MaxKB 规则引擎 + │ │ │ │ │ │ + │ POST /emr/gen │ │ │ │ │ + │──────────────────▶│ │ │ │ │ + │ │ CreateSession │ │ │ │ + │ │─────────────────────▶│ │ │ │ + │ │ │ 注入System Prompt │ │ │ + │ │ │─────────────────▶│ │ │ + │ │ │ │ │ │ + │ │ │ 思考:需要检索病历模板 │ │ + │ │ │ 调用工具:maxkb_retrieve │ │ + │ │ │───────────────────────────────────────────────▶│ + │ │ │ │ │ RAG检索 │ + │ │ │ │ │ 返回规范片段 │ + │ │ │◀────────────────────────────────────────────────│ + │ │ │ │ │ │ + │ │ │ 生成病历初稿 │ │ │ + │ │ │─────────────────▶│ │ │ + │ │ │ │ │ │ + │ │ │ 规则校验 │ │ │ + │ │ │──────────────────────────────────────────────────────────▶│ + │ │ │ │ │ │ + │ │ │ 有issues?─────Yes──▶ 反思修正循环 │ │ + │ │ │────No──▶ 输出最终结果 │ │ + │ │ │ │ │ │ + │◀─────────────────│ JSON Response │ │ │ │ + │ │ │ │ │ │ +``` + +### 详细步骤 + +| 阶段 | 动作 | 涉及组件 | 代码位置 | +|------|------|----------|----------| +| ①感知 | 接收HTTP请求,解析JSON,创建Agent会话 | handler.EMRHandler.Generate | internal/handler/emr_handler.go | +| ②规划 | LLM分析任务:需要哪些信息?检索什么? | agent.Runner.Run → LLM | internal/agent/runner.go | +| ③检索 | 调用MaxKB获取病历模板、术语规范 | tool.MaxKBRetrieveTool | internal/tool/maxkb.go | +| ④工具 | 可选:查HIS获取患者病史 | tool.HISTool | internal/tool/agent_tools.go | +| ⑤反思 | 规则引擎检查完整性,不通过则修正 | rule.EMRQualityChecker | internal/rule/rule_engine.go | +| ⑥输出 | 返回结构化病历JSON + 质控结果 | handler响应封装 | internal/handler/emr_handler.go | + +--- + +## 场景B:病历 → 生成处方 + +### 时序图 + +``` +医生 Go服务 Agent Runner LLM MaxKB 规则引擎 + │ │ │ │ │ │ + │ POST /rx/gen │ │ │ │ │ + │──────────────────▶│ │ │ │ │ + │ │ CreateSession │ │ │ │ + │ │───────────────────▶│ │ │ │ + │ │ │ System Prompt注入 │ │ │ + │ │ │─────────────────▶│ │ │ + │ │ │ │ │ │ + │ │ │ 辨证:太阳伤寒表实证 │ │ + │ │ │ 检索经典方剂 │ │ │ + │ │ │──────────────────────────────────▶│ │ + │ │ │ │ │ 返回麻黄汤 │ + │ │ │◀──────────────────────────────────│ │ + │ │ │ │ │ │ + │ │ │ 生成处方初稿 │ │ │ + │ │ │─────────────────▶│ │ │ + │ │ │ │ │ │ + │ │ │ 配伍禁忌校验 ◀──────────────────────────────────────────────│ + │ │ │ 剂量校验 ◀──────────────────────────────────────────────│ + │ │ │ 孕妇安全检查 ◀──────────────────────────────────────────────│ + │ │ │ │ │ │ + │ │ │ Blocked? ──Yes──▶ 重新组方(反思循环) │ + │ │ │────No──▶ 输出处方 │ │ + │ │ │ │ │ │ + │◀─────────────────│ JSON Response │ │ │ │ + │ │ │ │ │ │ + │ 医生审核确认 │ │ │ │ │ + │ POST /rx/:id/approve │ │ │ │ + │──────────────────▶│ 写入审计日志 │ │ │ │ + │ │──────────────────────────────────────────────────────────────────────▶│ + │ │ │ │ │ │ +``` + +### 详细步骤 + +| 阶段 | 动作 | 涉及组件 | 安全级别 | +|------|------|----------|----------| +| ①感知 | 接收病历+患者信息,创建会话 | handler.PrescriptionHandler | - | +| ②规划 | LLM辨证→确定治则治法→选方思路 | agent.PrescriptionGenerator | - | +| ③检索 | MaxKB检索对应证型的经典方剂 | tool.MaxKBRetrieveTool | 知识来源 | +| ④工具 | 药典查询验证剂量、HIS查过敏史 | tool.PharmacopoeiaTool | 数据支撑 | +| ⑤反思 | **十八反十九畏硬校验** | rule.PrescriptionValidator | 🔴 硬拦截 | +| ⑤反思 | 孕妇/儿童剂量调整 | rule.PrescriptionValidator | 🟡 警告 | +| ⑤反思 | 过敏史冲突检查 | rule.PrescriptionValidator | 🔴 硬拦截 | +| ⑥输出 | 结构化处方 + Human-in-the-Loop | handler响应 + 医生审核 | 🟢 人工兜底 | + +--- + +## 安全设计原则 + +### 三层防护体系 + +``` +┌─────────────────────────────────────────────────┐ +│ Layer 3: 人工审核(Human-in-the-Loop) │ ← 最后防线 +│ 医生审核确认每一张处方 │ +├─────────────────────────────────────────────────┤ +│ Layer 2: 规则引擎(硬约束,独立于LLM) │ ← 核心防线 +│ 十八反十九畏 / 剂量上限 / 孕妇禁忌 / 过敏冲突 │ +├─────────────────────────────────────────────────┤ +│ Layer 1: MaxKB知识库(事实基础) │ ← 知识防线 +│ 药典规范 / 经典方剂 / 临床指南 │ +└─────────────────────────────────────────────────┘ +``` + +### 关键原则 + +1. **LLM不做最终决策** —— 只负责语言理解和推理,不负责医疗判断 +2. **规则引擎独立运行** —— 不依赖LLM的自检,用确定性代码做硬校验 +3. **每次修正都有审计日志** —— 谁在什么时间做了什么修改,全链路可追溯 +4. **Human-in-the-Loop** —— 处方最终必须经过医生确认才能生效 + +--- + +## 配置 MaxKB 知识库 + +### 快速部署 + +```bash +# Docker一键启动MaxKB +docker run -d --name maxkb -p 8080:8080 1panel/maxkb + +# 访问 http://localhost:8080 +# 默认账号: admin / MaxKB@123.. +``` + +### 推荐上传的文档 + +| 分类 | 文档示例 | 用途 | +|------|----------|------| +| 药典 | 《中国药典》2020版(中药部分) | 剂量、性味归经、禁忌 | +| 方剂 | 《方剂学》教材 / 《伤寒论》原文 | 经典方剂组成与主治 | +| 规范 | 《中医病历书写规范》 | 病历模板与质控标准 | +| 指南 | 各病种中医诊疗指南 | 辨证分型与治法 | +| 内部分享 | 本院名老中医经验方 | 院内知识沉淀 | + +### 获取API Key + +1. 登录MaxKB控制台 +2. 进入「应用管理」→ 创建应用 +3. 选择知识库 → 配置模型 +4. 在「API Key管理」中生成 Key +5. 将 Key 和 AppID 填入 `manifest/config/config.yaml` diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 0000000..495accc --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,223 @@ +# TCM Agent 架构说明(现状版) + +> 更新时间:2026-08-11 +> 适用版本:加固 + 观测面板落地之后的代码(含 RunLog / 医疗守卫 / DB 配置热加载 / Function Calling 完整协议) + +本文档回答四个问题:**现在长什么样(架构)、一次请求怎么走(流程)、哪里还有坑(隐患)、为什么这样设计(优势)**。 + +--- + +## 一、架构总览 + +### 1.1 系统定位 + +Go Agent 是「PHP 主业务系统」的 **AI 增强侧车**:PHP 负责组装 prompt、落库、面向前端;Go 负责知识库检索、ReAct 多步推理、多模型调度与降级。PHP 挂了 Go 没意义,Go 挂了 PHP 可以降级为直连模型(`ai_agent_via_agent=0`)。 + +```mermaid +flowchart TB + subgraph php[PHP 主系统 xk-api] + assist[AiMedicalAssistService
组装 system/user messages] + factory[AiAgentFactory
按 ai_agent_via_agent 决定直连或走 Go] + stepTable[(xk_ai_generation_step
历史步骤审计表)] + end + + subgraph go[Go Agent nl-tcm-agent] + auth[middleware.Auth
JWT + SharedSecret 双轨] + sem[并发信号量 16
超限 503] + enhancer[EnhancerService.Enhance
包装层:统一埋点] + guard[medical_guard
医疗相关性守卫] + react[ReactLoop
Plan → Think-Act-Observe → Reflection] + resolve[resolveClient
DB 优先解析生效模型] + runlog[RunLog 环形缓冲
内存 200 条] + panel[/agent/view 观测面板/] + end + + subgraph db[MySQL z_xk] + syscfg[(xk_system_config
生效模型/开关)] + aikey[(xk_ai_model / xk_ai_api_key
模型池与密钥 AES 加密)] + kbtbl[(xk_kb_* 本地知识库)] + end + + subgraph llmv[模型供应商] + spark[讯飞 Spark] + dsk[DeepSeek] + oai[OpenAI 兼容] + end + + assist --> factory -->|POST /api/v1/agent/enhance| auth --> sem --> enhancer + enhancer --> guard --> react + enhancer --> resolve --> syscfg + resolve --> aikey + react --> spark & dsk & oai + react -->|kb_enabled| kbtbl + enhancer -->|每次运行埋点| runlog --> panel + enhancer -->|steps 随响应返回| assist --> stepTable +``` + +### 1.2 目录与模块职责 + +| 目录 | 职责 | 关键点 | +|---|---|---| +| `main.go` | 启动入口 | config → dao → llm.InitLLM → agent.InitRunner → router.Setup;`http.Server` 带四组超时;优雅停机 | +| `internal/config` | YAML/env 静态配置 | 只做启动期兜底;运行期以 DB 为准 | +| `internal/dao` | 数据库访问 | `LoadActiveLLMConfig`(60s TTL 缓存)从 `xk_system_config` 实时解析生效模型;AES 解密密钥 | +| `internal/agentcfg` | Agent 行为配置 | 从 `xk_system_config` 读 ReAct 开关、医疗守卫开关、debug 日志开关等 | +| `internal/llm` | 模型接入层 | `ProviderFactory` 创建客户端;`ModelRouter` 按场景路由 + `GetByConfig` 按配置指纹缓存/重建;`FallbackChain` 降级链 | +| `internal/service` | 业务核心 | `enhancer.go` 主流程、`reactloop.go` ReAct 循环、`medical_guard.go` 医疗守卫、`runlog.go` 运行轨迹缓冲 | +| `internal/agent` | 会话式 Runner | `/agent/chat` 用的多轮会话引擎 + TokenBudget(与 EnhancerService 相互独立) | +| `internal/kb` | 本地知识库 | V1 关键词检索(NoopEmbedder),读写 `xk_kb_*` 表;V2 预留向量化接口 | +| `internal/tool` | Function Calling 工具集 | MaxKB 检索等,注入 ReactLoop 供模型调用 | +| `internal/middleware` | 全局中间件 | 日志 / CORS / 双轨鉴权(JWT + SharedSecret) | +| `internal/router` | 路由注册 | 业务 API + 运维 API + 两个静态面板(`/kb/view`、`/agent/view`) | +| `internal/security/xkaes` | AES 加解密 | 与 PHP `EncryptorService` 同算法,解密 DB 里的 API Key | +| `view/` | 前端单页 | `index.html`(知识库后台)、`agent.html`(运行观测面板),Vue3 + Element Plus CDN | + +### 1.3 配置体系(三层,DB 为王) + +``` +优先级:xk_system_config(DB,运行期实时) > 环境变量 > manifest/config/config.yaml(启动期兜底) +``` + +- **生效模型**:`ai_active_provider` / `ai_active_model` / `ai_active_api_key_id` 三个键决定当前用哪个模型。Go 端 `dao.LoadActiveLLMConfig` 带 60s TTL 缓存,后台切换最多 1 分钟内全集群生效;PHP 后台保存后还可调 `POST /api/v1/models/invalidate-cache` 立即生效。 +- **走不走 Go Agent**:独立开关 `ai_agent_via_agent`(PHP `AiAgentFactory` 读取),与「用哪个模型」彻底解耦——这是踩过坑后的关键设计:早期把 `ai_active_provider=agent` 当路由标记,导致模型配置和链路选择互相污染。 +- **Agent 行为**:`ai_agent_medical_guard`(守卫开关)、`ai_agent_debug_log`(请求体日志开关,含 PHI 默认关)、ReAct 迭代数等,由 `agentcfg` 统一加载。 +- **客户端缓存与指纹**:`ModelRouter.GetByConfig` 对「model+url+key+provider」做指纹,配置变了自动重建 LLM 客户端,没变就复用连接池。 + +--- + +## 二、一次 enhance 请求的完整流程 + +以 PHP 发起「开方建议」为例: + +```mermaid +sequenceDiagram + participant PHP as PHP TcmAgentClient + participant MW as Auth + 信号量(16) + participant EN as EnhancerService.Enhance + participant GD as 医疗守卫 + participant RC as resolveClient + participant RL as ReactLoop + participant LLM as LLM 供应商 + participant LOG as RunLog 环形缓冲 + + PHP->>MW: POST /agent/enhance {scene, messages, kb_enabled} + MW->>MW: Bearer == SharedSecret?并发 <16? + MW->>EN: 通过(否则 401 / 503 快速失败) + EN->>GD: 白名单/黑名单关键词校验 + alt 非医疗内容 + GD-->>EN: 拦截 + EN->>LOG: 记录 status=3(守卫拦截) + EN-->>PHP: 500 + medical_guard step + end + EN->>RC: 解析生效模型(DB 60s 缓存 → yaml 兜底) + RC-->>EN: client + provider + api_key_id + EN->>RL: 进入 ReAct 循环 + RL->>LLM: [1] Planning(输出计划,计划跑题则丢弃) + loop Think-Act-Observe(预算内多轮) + RL->>LLM: [2] 带 tools 调用(Lite 自动降级纯文本) + alt 触发 Function Calling + RL->>RL: 执行工具,tool 结果带 tool_call_id 入栈 + end + end + RL->>LLM: [3] Reflection 低温自检 + RL->>LLM: [4] JSON 不合法时自动修复 + RL-->>EN: content + steps[](每步耗时/token/detail) + EN->>LOG: 记录 status=1/2 + 完整 steps + EN-->>PHP: {content, provider, model, steps, total_ms} + PHP->>PHP: steps 落 xk_ai_generation_step +``` + +关键细节: + +1. **守卫在最前面**:不花任何 token 就能拒掉「PHP 组装出错 / 接口被滥用」的非医疗请求,同时留下 `medical_guard` 步骤便于定位是谁的问题。 +2. **每次调用都实时解析模型**:不是启动时定死,后台切模型不用重启 Go。 +3. **消息序列保证以 user/tool 结尾**:Planning 注入后补 user 帧,兼容 Spark Lite 等严格遵循 OpenAI 协议的模型(曾因 assistant 结尾触发 10003)。 +4. **网络错误自动重试 1 次**(间隔 1s):只重试连接/超时类错误,「API 返回 xxx」业务错误不重试,避免双倍烧 token。 +5. **无论成败都写 RunLog**:包装层统一埋点,守卫拦截、配置解析失败这类「PHP 侧看不到」的失败也有记录。 + +### 观测面板(/agent/view) + +- **数据链路**:RunLog(内存 200 条)→ `GET /api/v1/agent/runs`(列表摘要)/ `runs/:id`(完整时间线)/ `stats`(成功率、平均耗时、token、按场景分布)。 +- **三个 Tab**:运行记录(点行弹时间线抽屉)、统计概览、生效配置(复用 `/models/active-config` + `/health`)。 +- **localStorage 记忆**:当前 Tab(`agent_view_tab`)、鉴权 token(`agent_view_token`)、自动刷新开关(`agent_view_refresh`,5s 轮询)、主题与 KB 页共用 `kb_theme`。 +- 页面本身放行不鉴权(纯静态无数据),数据 API 走全局 Auth。 + +--- + +## 三、隐患清单(按风险排序) + +### 高:模型能力短板不是代码能完全兜住的 + +- **Lite 模型「计划腔」污染输出**:即使内容是医疗的,输出仍可能带「执行阶段/步骤一」的项目管理腔调(守卫只拦非医疗关键词,拦不住文风跑偏)。实测已复现。 +- **Reflection 审核不通过时内容照样返回**:目前 reflection 结果只作为附注拼进输出,没有「不合格 → 重试或换模型」的闭环。临床场景下这是最值得补的一环。 +- 缓解方向:审核不通过时触发一次重生成或 fallback 到更强模型;或在 PHP 侧按 reflection 结果决定是否展示。 + +### 高:医疗守卫是关键词规则引擎 + +- 白名单/黑名单靠人工维护,存在**误杀**(新病种词不在白名单)与**漏放**(换个说法绕过黑名单)两种风险,且没有命中率统计来指导调词。 +- 缓解方向:面板已能看到拦截记录,可定期复盘;长期可换成小模型二分类。 + +### 中:观测数据是单实例内存态 + +- RunLog 重启即清空、多实例部署时各自为政(面板只能看到所连实例的数据)、只保留最近 200 条。当前单实例部署下可接受,**水平扩容前必须重新设计**(落 Redis/DB 或接 Prometheus)。 +- 同理,**并发限流的 16 是进程内信号量**:多实例时总并发 = 16 × N,且 16 写死在 `router.go`,不可配置。 + +### 中:鉴权与暴露面 + +- SharedSecret 是**明文字符串比对**且和 KB 管理口令一起写在 `config.yaml`(`qiqi991012`),中间件里还硬编码了开发默认 JWT 密钥。生产必须换强随机值并走环境变量。 +- `GET /models/active-config` **无鉴权**(key 已脱敏只留尾号,但 provider/model/URL 对外可见)。 +- CORS 是 `Allow-Origin: *`;panic recovery 会把 recovered 内容原样返回给客户端(可能泄露内部路径/变量名)。 + +### 中:超时与重试的边界情况 + +- `WriteTimeout=300s` 是兜底,但 ReactLoop 本身**没有整体 deadline**:多轮迭代 + 每轮重试 1 次 + fallback 链,极端情况下可能逼近甚至顶到 300s,届时连接被强制掐断、PHP 只收到断连而非结构化错误。 +- `isRetryableNetworkError` 靠**错误文案子串匹配**("timeout"、"connection reset"…),Go 版本升级或客户端封装改文案就可能失效——这是无类型错误链下的妥协,脆弱但可用。 + +### 低:其他已知瑕疵 + +- `tool_calls[].id` 缺失时用 `time.Now().UnixNano()` 生成,理论上高并发同纳秒会撞(概率极低)。 +- KB V1 是 NoopEmbedder 纯关键词检索,召回质量有限,`ai_kb_source=local` 下检索增强效果打折;V2 接 BGE-M3 前这是已知取舍。 +- 60s 配置缓存意味着**不调 invalidate-cache 时切换最多延迟 1 分钟**——依赖 PHP 后台保存后主动调那个接口。 +- 无 Prometheus/metrics 端点,告警只能靠日志和面板人工看。 + +--- + +## 四、优势(为什么这样设计) + +### 1. 配置热加载 + 指纹缓存:切模型不重启 + +后台改 `xk_system_config` → Go 下一次请求自动用新配置(60s 内,或调 invalidate 立即),客户端按指纹复用/重建。对比「启动时读一次配置」的方案,运维成本降了一个量级,这也是本项目踩坑(模型不一致)后重构出来的核心能力。 + +### 2. 多层防跑题:守卫 → 锚定 → 计划校验 → 反思 + +入口医疗守卫(0 token 拦非医疗)、Planning prompt 医疗锚定、计划输出不含医疗词即丢弃、Reflection 自检——四层针对「轻量模型易被通用指令带偏」的现实问题层层设防。单层都可能漏,叠加后 Lite 这类模型也能稳定输出医疗内容。 + +### 3. 故障半径控制:每一层都有降级路径 + +- 请求层:信号量满 → 503 快速失败 → PHP 走直连降级,不排队堆积; +- 网络层:瞬时抖动自动重试 1 次; +- 模型层:主模型挂 → FallbackChain 自动切备用; +- 配置层:DB 抖动 → 回落 yaml/env 兜底配置; +- 进程层:panic recovery + 优雅停机 + 四组 HTTP 超时防慢连接。 + +### 4. 全链路可观测,且观测不依赖被观测对象 + +每一步(守卫/检索/plan/llm_call/tool/reflection)都有独立的耗时、token、detail:实时看 Go 内存 RunLog + `/agent/view` 面板(DB 挂了面板照常工作),历史审计查 PHP `xk_ai_generation_step` 表。排障时能精确回答「哪一步、花了多久、模型说了什么」。 + +### 5. 协议完整性:换更强模型零改动 + +Function Calling 按 OpenAI 完整协议实现(`tool_calls[].id`、`tool_call_id` 回传、`arguments` JSON 字符串),消息序列符合严格校验;今天用 Lite(自动降级纯文本),明天切 Pro/Max/DeepSeek 直接享受工具调用,不用再动协议层。 + +### 6. 安全默认值 + +API Key AES 加密入库(与 PHP 同算法)、日志默认不打请求体(`ai_agent_debug_log` 显式开启才打,防 PHI 泄漏)、active-config 接口 key 脱敏只留尾号。 + +--- + +## 五、后续建议(按投入产出比排序) + +1. **Reflection 闭环**:审核不合格时自动重试一次或 fallback 到更强模型(隐患一的直接解法)。 +2. **ReactLoop 整体 deadline**:用 `context.WithTimeout`(如 240s)包住整个循环,保证永远先于 WriteTimeout 结构化返回。 +3. **限流阈值进配置**:把 16 挪到 `xk_system_config` 或 config.yaml。 +4. 生产部署前:换强随机 SharedSecret、收紧 CORS、active-config 加鉴权、panic 响应脱敏。 +5. 多实例化时:RunLog 与限流改集中式(Redis),或直接接 Prometheus + Grafana 替代自建面板。 diff --git a/docs/maxkb-ai/01_部署MaxKB.md b/docs/maxkb-ai/01_部署MaxKB.md new file mode 100644 index 0000000..8626f7b --- /dev/null +++ b/docs/maxkb-ai/01_部署MaxKB.md @@ -0,0 +1,137 @@ +# 第 1 步:部署 MaxKB 平台 + +> 目标:在服务器上跑起来一个 MaxKB,能在浏览器打开它的管理后台。 + +--- + +## 方式 A:用 1Panel 应用商店装(推荐,最简单) + +你的环境已经是 1Panel,这是最省事的。 + +### 步骤 + +1. **登录 1Panel 后台**:浏览器打开你的 1Panel(一般 `http://服务器IP:1Panel端口`) + +2. **进入应用商店**:左侧菜单 → **应用商店** + +3. **搜索 MaxKB**:在搜索框输入 `maxkb` + +4. **点击安装**: + - 名称:保持默认 `maxkb` + - 端口:**改成 `8081`**(重要!不要用默认 8080,会和 Go Agent 冲突) + - 数据库:选"外部数据库"或让 MaxKB 自带的(小白选自带即可) + - 点"确认"等 1-2 分钟 + +5. **等待状态变成"运行中"** + +--- + +## 方式 B:用项目里的 docker-compose 装 + +如果 1Panel 商店里没有 MaxKB,用项目自带的脚本。 + +### 步骤 + +1. **SSH 登录服务器** + +2. **进入项目目录**: + ```bash + cd "/path/to/nl-tcm-agent/manifest/docker" + ``` + +3. **⚠️ 先改端口**(项目默认配的是 8080,会和 Go Agent 冲突) + + 用 `vim docker-compose.yml` 或 `nano docker-compose.yml`,找到 maxkb 部分: + + ```yaml + maxkb: + image: 1panel/maxkb:latest + ports: + - "8080:8080" # ❌ 改这里 + ``` + + 改成: + ```yaml + maxkb: + image: 1panel/maxkb:latest + ports: + - "8081:8080" # ✅ 改成 8081 + ``` + +4. **启动 MaxKB**: + ```bash + docker-compose up -d maxkb + ``` + +5. **等 1-2 分钟,看启动日志**: + ```bash + docker logs -f maxkb + ``` + 看到类似 `Application started on port 8080` 就说明成功了,按 `Ctrl+C` 退出日志。 + +--- + +## 方式 C:直接 docker run(最朴素) + +如果上面都不方便,一条命令搞定: + +```bash +docker run -d \ + --name maxkb \ + -p 8081:8080 \ + -v maxkb_data:/app/data \ + --restart unless-stopped \ + 1panel/maxkb:latest +``` + +> `-p 8081:8080` 表示把容器内 8080 映射到服务器 8081。**记住你映射的端口,后面要用。** + +--- + +## 验证部署是否成功 + +### 1. 浏览器访问管理后台 + +打开:`http://你的服务器IP:8081` + +> 把 `你的服务器IP` 换成实际 IP。本地开发就是 `http://127.0.0.1:8081`。 + +### 2. 看到登录页 → 成功 + +第一次会让你设置管理员账号密码,或者用默认账号: +- 用户名:`admin` +- 密码:`MaxKB@123..` + +### 3. 登录成功,看到控制台 + +![MaxKB 登录后会看到欢迎页] + +到这里 MaxKB 部署完成。下一步去上传资料。 + +--- + +## 常见问题 + +### Q1:访问不了 8081 端口 + +**原因**:服务器防火墙没放端口。 + +**解决**: +- 云服务器:去云厂商控制台 → 安全组 → 入方向规则 → 加一条"TCP 8081 允许" +- 自建机:`sudo ufw allow 8081/tcp`(Ubuntu)或 `sudo firewall-cmd --add-port=8081/tcp --permanent && sudo firewall-cmd --reload`(CentOS) + +### Q2:MaxKB 启动后立刻挂掉 + +**原因**:内存不够(MaxKB 至少要 2G 空闲内存)。 + +**解决**: +- `free -h` 看内存 +- 不够就加内存,或者关掉其他占内存的容器 + +### Q3:1Panel 装的 MaxKB 在哪个端口? + +1Panel 应用商店装完后,在 1Panel → 容器 → 找到 maxkb → 看端口映射。也可以在 1Panel → 应用商店 → 已安装 → maxkb → 详情里看到。 + +--- + +下一步:[02_上传知识库.md](./02_上传知识库.md) diff --git a/docs/maxkb-ai/02_上传知识库.md b/docs/maxkb-ai/02_上传知识库.md new file mode 100644 index 0000000..a71f7e5 --- /dev/null +++ b/docs/maxkb-ai/02_上传知识库.md @@ -0,0 +1,143 @@ +# 第 2 步:上传知识库资料 + +> 目标:把项目里准备好的 7 个中医资料文件,上传到 MaxKB,让它能"翻书"。 + +--- + +## 资料文件在哪? + +项目里已经为你准备好了 7 个 Markdown 文件,路径: + +``` +xk-api/storage/maxkb_seed/ +├── 01_decoction_methods.md 煎法(先煎/后下/包煎…) +├── 02_entrusted_process.md 委托调剂规则 +├── 03_tcm_dict.md 中医证候 / 治法 / 疾病字典 +├── 04_icd_diagnosis.md ICD-10 诊断编码 +├── 05_drug_catalog.md 药品库 +├── 06_tcm_conflict.md 中医配伍禁忌(十八反十九畏) +└── 07_mr_field_spec.md 病历字段规范 +``` + +> 这些就是 AI 在生成病历/处方时需要"翻书"查的固定资料。 + +--- + +## 在 MaxKB 创建知识库 + +### 1. 登录 MaxKB 后台 + +浏览器打开 `http://你的服务器IP:8081`,登录。 + +### 2. 进入"知识库"菜单 + +- **新版(4.x)**:首页就有 **"创建知识库"** 大按钮,直接点 +- **老版(1.x/2.x)**:左侧菜单 → 点 **知识库**(或 **Knowledge Base**)→ 右上角"创建知识库" + +### 3. 点击"创建知识库" + +首页或知识库列表页有 **创建知识库** 按钮,点击。 + +### 4. 填写基本信息 + +| 字段 | 填什么 | +|---|---| +| 知识库名称 | `中医医疗知识库`(随便起,自己认得就行)| +| 知识库描述 | `中医诊疗参考资料:煎法、证候、ICD-10、药品库等` | +| 知识库类型 | 选 **通用型** / **文档型**(默认即可) | + +点 **下一步**。 + +### 5. 选择向量模型 + +MaxKB 会让你选"文本向量模型",用来把文字转成数字。 + +**推荐选择**: +- 如果 MaxKB 自带本地 embedding 模型(如 `m3e-base`):选它,免费 +- 如果没有:用 MaxKB 默认的,或后续配置 OpenAI embedding(要 API Key) + +> 小白先用默认,跑通再说。 + +点 **创建**。 + +--- + +## 上传资料文件 + +### 1. 进入新建好的知识库 + +列表里点开 **中医医疗知识库**。 + +### 2. 切到"文档"标签 + +知识库里有几个 Tab:文档 / 设置。点 **文档**。 + +### 3. 点击"上传文档" + +按钮一般叫 **添加文档** 或 **上传文档**。 + +### 4. 选择本地文件 + +把 `xk-api/storage/maxkb_seed/` 下的 **7 个 md 文件全部选中**,一次性传上去。 + +> 也支持 zip / pdf / docx / txt,但我们准备的 md 最准。 + +### 5. 等待向量化完成 + +上传后每条文档会有"状态"列: +- ⏳ **向量化中**:正在处理(每条 1-2 分钟) +- ✅ **已就绪 / 成功**:可以用了 +- ❌ **失败**:点开看错误原因 + +**全部变成 ✅ 才能进下一步**。 + +> 如果卡很久没动,可能是 embedding 模型没配好,去看 MaxKB 设置 → 模型管理。 + +--- + +## 验证知识库能搜 + +### 1. 在知识库页面找"命中测试"或"搜索测试" + +每个知识库都自带一个测试入口,能让你试搜。 + +### 2. 输入测试词 + +输入:`痰湿中阻 煎法` + +### 3. 看结果 + +应该返回 `01_decoction_methods.md` 或 `03_tcm_dict.md` 的相关片段。 + +> 如果搜不到任何东西,说明: +> - 文档还没向量化完成 → 等等再试 +> - 或者文件是空的 → 检查 md 文件是否有内容 + +--- + +## 常见问题 + +### Q1:上传报错"不支持的文件类型" + +.md 文件 MaxKB 是支持的。如果报错,把文件后缀改成 `.txt` 或 `.markdown` 再传。 + +### Q2:向量化一直失败 + +**原因**:embedding 模型没配好。 + +**解决**: +- MaxKB 后台 → 设置 → 模型管理 → 看是否有可用的 embedding 模型 +- 没有就加一个:本地 m3e-base(免费)或 OpenAI text-embedding-3-small(要 Key) + +### Q3:上传成功但搜不到内容 + +**原因**:可能文档没分段成功,或文字内容是图片(OCR 失败)。 + +**解决**: +- 进文档详情看"分段"列表 +- 我们准备的 md 都是纯文字,应该没问题 +- 如果还不行,单独上传一个文件试试 + +--- + +下一步:[03_创建应用拿密钥.md](./03_创建应用拿密钥.md) diff --git a/docs/maxkb-ai/03_创建应用拿密钥.md b/docs/maxkb-ai/03_创建应用拿密钥.md new file mode 100644 index 0000000..ed2475e --- /dev/null +++ b/docs/maxkb-ai/03_创建应用拿密钥.md @@ -0,0 +1,281 @@ +# 第 3 步:创建智能体并拿 API 密钥 + +> 目标:在 MaxKB 里建一个"智能体"(老版本叫"应用"),把它和一个知识库关联起来,再拿到 3 个连接用的钥匙。 +> +> Go Agent 不会直接调"知识库",而是调"智能体",由"智能体"去访问关联的知识库。 + +--- + +## ⚠️ 先看:MaxKB 老版 vs 新版术语对照 + +如果你看到的界面里没有"应用"两个字,但有"**智能体**",说明你装的是 **MaxKB 4.x 新版**。两者底层 API 完全一样,只是改了名字: + +| 老版(MaxKB 1.x / 2.x) | 新版(MaxKB 4.x) | 你的代码注释里写的 | +|---|---|---| +| **应用** | **智能体** | "应用"(代码先写的)| +| 创建应用 | 创建智能体 | — | +| 简单应用 / 工作流 | 空白创建 / 从模板创建 | — | +| 应用信息 | 智能体概览 | — | +| API 文档 | API 文档(位置变了,见下文)| — | + +**API 接口路径完全没变**:`/api/application//...` 在新旧版本都能用,Go Agent 代码不用动。 + +--- + +## 你看到的 4 个按钮都是干嘛的? + +你截图里的 4 个入口: + +| 按钮 | 是不是这一步要点的? | 解释 | +|---|---|---| +| **创建智能体** | ✅ **就是这个!** | 相当于老版的"创建应用" | +| **创建知识库** | ❌ 上一步已做 | 上传中医资料用的,已经做过了 | +| **添加工具** | ❌ 不需要 | MaxKB 自己的工具系统(脚本/工作流),我们用不上 | +| **添加模型** | ⚠️ 可能要先做 | 给 MaxKB 配大语言模型/向量模型。**如果创建智能体时报错"未配置模型",先回来做这个** | + +--- + +## 1. (前置)确认模型已配置 + +**新版 MaxKB 强制要求先配模型才能建智能体**。如果你之前没配过,先做这一步: + +### 操作 + +1. 首页 → **添加模型** (或左下角"模型管理") +2. 至少配 2 类: + - **大语言模型**:选 DeepSeek(你自己有 API Key 最便宜)/ 或 OpenAI GPT-4o + - **向量模型**:选 `m3e-base`(本地免费)或 `text-embedding-3-small`(OpenAI) + +3. 填写: + - 模型类型:选 DeepSeek / OpenAI 等 + - API Key:你的 Key + - Base URL:模型厂商地址 + +> 💡 **这个模型是 MaxKB 自己生成对话时用的**。我们 Go Agent 主要走"检索接口"(search),不太会真用它,但 MaxKB 要求智能体必须配模型。 + +> 💡 **如果跳过这步,下一步"创建智能体"会一直报错**。 + +--- + +## 2. 创建智能体 + +### 操作 + +1. 首页 → **创建智能体** +2. 选 **空白创建**(不要选"从模板",模板是人家做好的,不适合我们) +3. 填写信息: + +| 字段 | 填什么 | +|---|---| +| 名称 | `中医诊疗助手`(随便起)| +| 描述 | `给 Go Agent 用的知识检索入口` | +| 类型 | 保持默认(**简单工作流 / 基础问答**,不要选复杂工作流)| + +4. 进入智能体后,**关键一步:关联知识库** + - 在智能体的 **"知识库"** 或 **"资源"** 标签 + - 点击 **"添加知识库"** + - **勾选第 2 步创建的"中医医疗知识库"** + - 保存 + +5. (可选)在 **"模型"** 或 **"设置"** 标签: + - 选一个大模型(DeepSeek 即可) + +6. **点右上角"保存"或"发布"** + - 新版 MaxKB 智能体必须**手动发布**才能用 + - 状态显示"已发布"才算成功 + +--- + +## 3. 拿到三个钥匙 + +### 进入智能体"概览"页面 + +在智能体列表里点开你刚建的"中医诊疗助手",看到 **概览** Tab。 + +### 🔑 钥匙 1:Base URL + +在概览页面找 **"API 文档地址"** 或 **"API 访问"** 区域: + +``` +http://192.168.1.100:8081 +``` + +**这就是 Base URL**,注意: +- 端口要写你部署时映射的端口(比如 8081) +- 不要带末尾 `/` +- 要写 Go Agent 能访问到的地址(同机 `127.0.0.1`,跨机用 IP) + +### 🔑 钥匙 2:API Key + +在概览页面点 **"API Key"** 或 **"API 密钥"** 按钮: + +1. 点 **"创建 API Key"** +2. 给它一个名字(如 "go-agent") +3. 复制出来: + +``` +application-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +``` +或新版可能是: +``` +agent-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +``` + +> **格式可能以 `application-` 或 `agent-` 开头**,两种都对,**完整复制**即可。 +> +> ⚠️ **关闭窗口后可能再也看不到完整 Key**,所以**当场复制存好**! + +### 🔑 钥匙 3:App ID + +App ID 一般显示在: +- **概览页面的"API 文档地址"里**,形如:`http://.../api/application/<这串UUID>/chat/completions` +- 或 **API Key 列表的"应用 ID"列** +- 或 **浏览器地址栏** URL 里的 UUID + +格式: +``` +a1b2c3d4-e5f6-7890-abcd-ef1234567890 +``` +(UUID 格式:8-4-4-4-12) + +> 💡 **快捷找法**:在概览页面点"API 文档"或"Swagger",浏览器打开的 URL 里就包含 App ID。 + +--- + +## 4. 验证 API 能调通(强烈建议) + +打开命令行(PowerShell / Terminal / cmd 都行),用 curl 测试。 + +### 测试 1:对话接口(OpenAI 兼容格式) + +```bash +curl -X POST "http://你的服务器IP:8081/api/application/你的AppID/chat/completions" ^ + -H "Authorization: Bearer 你的APIKey" ^ + -H "Content-Type: application/json" ^ + -d "{\"model\":\"deepseek-chat\",\"messages\":[{\"role\":\"user\",\"content\":\"痰湿中阻的煎法\"}]}" +``` + +> Windows 用 `^` 换行,Linux/Mac 用 `\`。 +> +> 不熟悉 curl 可以直接写一行。 + +### 期望返回 + +```json +{ + "id": "xxx", + "choices": [ + { + "message": { + "role": "assistant", + "content": "痰湿中阻的方剂常用煎法..." + } + } + ] +} +``` + +### 测试 2:检索接口(Go Agent 用的就是这个) + +```bash +curl -X POST "http://你的服务器IP:8081/api/application/你的AppID/search" ^ + -H "Authorization: Bearer 你的APIKey" ^ + -H "Content-Type: application/json" ^ + -d "{\"query\":\"痰湿中阻 煎法\",\"top_k\":3}" +``` + +期望返回: +```json +{ + "code": 200, + "data": { + "documents": [ + {"content": "煎法说明……痰湿中阻宜……", "score": 0.85}, + {"content": "中医证候:痰湿中阻……", "score": 0.78} + ] + } +} +``` + +> ⚠️ **新版 MaxKB 的 search 接口可能改名了**。如果返回 404,去看"API 文档"(Swagger),找 `/hit-test` 或 `/search` 或 `/embedding/search` 路径。Go Agent 代码 [internal/tool/maxkb.go](../../../../internal/tool/maxkb.go) 第 125 行调的就是 `/api/application//search`,新版可能需要适配(见下文排错)。 + +--- + +## 5. 常见错误 + +### 返回 401 Unauthorized + +**原因**:API Key 错或没传 Authorization 头。 + +**解决**: +- 重新去智能体 → 概览 → API Key 复制 +- 确认 Header 是 `Authorization: Bearer application-xxx`(注意 `Bearer ` 后有个空格) + +### 返回 404 Not Found + +**原因**:URL 不对,特别是 App ID 拼错,或者新版接口路径变了。 + +**解决**: +- 打开智能体 → 概览 → **API 文档**(Swagger) +- 在 Swagger 里找"对话接口"或"检索接口" +- 复制完整 URL 替换 + +### 返回 500 / "应用未发布" + +**原因**:智能体没发布。 + +**解决**: +- 回到智能体详情 +- 右上角找 **"发布"** 按钮 +- 状态变成"已发布" + +### 返回空 documents 数组 + +**原因**:知识库里没相关内容,或文档没向量化完。 + +**解决**:回第 2 步检查知识库。 + +### 创建 API Key 按钮置灰 + +**原因**:智能体未发布。 + +**解决**:先发布智能体,再创建 API Key。 + +--- + +## 6. 钥匙清单(待会儿要填) + +把下面这张表填好,下一步要用: + +| 钥匙 | 你的值 | +|---|---| +| Base URL | `http://____________________:8081` | +| API Key | `application-____________________`(或 `agent-____________________`)| +| App ID | `________________________________` | + +--- + +## 7. ⚠️ 如果新版 search 接口路径不一样怎么办? + +**先做完上面所有步骤**,然后到 [06_修复检索词Bug.md](./06_修复检索词Bug.md) 改完后,**第 7 步验证时如果 kb_retrieval step 一直 status=2**,回来看这里: + +1. 打开智能体概览 → API 文档(Swagger) +2. 在 Swagger 里搜索 `/search` 或 `/hit` 或 `/embedding` +3. 找到对应的检索接口路径 +4. 改 Go Agent 代码:`nl-tcm-agent/internal/tool/maxkb.go` 第 125 行: + +```go +// 原代码: +url := fmt.Sprintf("%s/api/application/%s/search", c.BaseURL, c.AppID) + +// 改成新版路径(示例,根据 Swagger 实际路径): +url := fmt.Sprintf("%s/api/application/%s/hit-test", c.BaseURL, c.AppID) +``` + +5. 重启 Go Agent + +> 也可以告诉我你的 MaxKB 版本和 Swagger 里看到的检索接口路径,我帮你改。 + +--- + +下一步:[04_配置GoAgent.md](./04_配置GoAgent.md) diff --git a/docs/maxkb-ai/04_配置GoAgent.md b/docs/maxkb-ai/04_配置GoAgent.md new file mode 100644 index 0000000..9991e7d --- /dev/null +++ b/docs/maxkb-ai/04_配置GoAgent.md @@ -0,0 +1,146 @@ +# 第 4 步:配置 Go Agent 连接 MaxKB + +> 目标:改 Go Agent 的配置文件,让它知道 MaxKB 在哪、用什么钥匙访问。 + +--- + +## 1. 找到配置文件 + +文件位置: +``` +nl-tcm-agent/manifest/config/config.yaml +``` + +--- + +## 2. 改 maxkb 节点 + +打开 config.yaml,找到开头那一段(第 13-17 行附近): + +```yaml +# ========== MaxKB 知识库配置 ========== +maxkb: + base_url: "http://127.0.0.1:8080" # ❌ 这是占位符 + api_key: "application-xxxxxxxx" # ❌ 这是占位符 + app_id: "xxxxxxxx-xxxx-xxxx" # ❌ 这是占位符 +``` + +### 改成你在 [第 3 步](./03_创建应用拿密钥.md) 拿到的真实值 + +```yaml +# ========== MaxKB 知识库配置 ========== +maxkb: + base_url: "http://192.168.x.x:8081" # ✅ MaxKB 实际地址(注意端口!) + api_key: "application-真实APIKey" # ✅ 第 3 步拿到的 API Key + app_id: "真实AppID-UUID格式" # ✅ 第 3 步拿到的 App ID +``` + +--- + +## 3. 三个常见坑 + +### ⚠️ 坑 1:地址要写 Go Agent 能访问到的 + +| Go Agent 部署位置 | base_url 怎么写 | +|---|---| +| 同一台服务器(本机) | `http://127.0.0.1:8081` | +| Docker 容器内(同一 compose) | `http://maxkb:8080`(用服务名)| +| 另一台服务器 | `http://其他服务器IP:8081` | + +**不要写 `localhost`**,因为 Docker 容器里的 localhost 不是宿主机。 + +### ⚠️ 坑 2:端口别填错 + +- MaxKB 容器内一直是 8080 +- 但你宿主机映射的是 8081 +- 所以**外部访问写 8081,容器间互访写 8080** + +### ⚠️ 坑 3:YAML 格式 + +- key 后面必须有**一个空格**再写值 +- 字符串**必须用双引号**(单引号也行,但别一个单一个双) +- 缩进必须用空格,不能用 Tab + +```yaml +# ✅ 对 +maxkb: + base_url: "http://127.0.0.1:8081" + +# ❌ 错(冒号后没空格) +maxkb: + base_url:"http://127.0.0.1:8081" + +# ❌ 错(用了 Tab) +maxkb: + base_url: "http://127.0.0.1:8081" +``` + +--- + +## 4. 重启 Go Agent + +配置改完要重启服务才生效。 + +### 本地开发 + +```bash +cd "/path/to/nl-tcm-agent" +# 停掉旧的(Ctrl+C) +# 重新启动 +go run main.go +``` + +### Docker 部署 + +```bash +cd "/path/to/nl-tcm-agent/manifest/docker" +docker-compose restart agent +``` + +### 1Panel 部署 + +1Panel → 容器 → 找到 tcm-agent → 重启。 + +--- + +## 5. 看启动日志确认 + +启动后看日志,应该看到: + +``` +[启动] ✅ 中医 AI Agent 服务已启动,监听端口 :8080 +``` + +如果 MaxKB 配置错,启动时一般不会报错(MaxKB 是按需调用的,不启动就调)。所以这一步**不能完全验证配置对**,要进第 7 步验证。 + +--- + +## 6. 完整配置示例(参考) + +这是一个完整的 maxkb 节点示例(**值是假的,替换成你自己的**): + +```yaml +# ========== MaxKB 知识库配置 ========== +maxkb: + base_url: "http://192.168.1.100:8081" + api_key: "application-abcd1234efgh5678ijkl9012mnop3456" + app_id: "f4b8a2c1-3d5e-4f6a-9b7c-8d2e1f0a3b5c" +``` + +--- + +## 常见问题 + +### Q1:YAML 改完启动报错 `yaml: unmarshal errors` + +**原因**:YAML 格式错了(缩进/引号/冒号空格)。 + +**解决**:找个在线 YAML 校验器(如 yamllint.com)粘进去检查。 + +### Q2:怎么知道 Go Agent 真的连上了 MaxKB? + +启动时连不上也不会报错。要等真正发起请求时才知道。**先继续下一步配置开关,最后用第 7 步的 curl 测试**。 + +--- + +下一步:[05_打开PHP开关.md](./05_打开PHP开关.md) diff --git a/docs/maxkb-ai/05_打开PHP开关.md b/docs/maxkb-ai/05_打开PHP开关.md new file mode 100644 index 0000000..637a43b --- /dev/null +++ b/docs/maxkb-ai/05_打开PHP开关.md @@ -0,0 +1,135 @@ +# 第 5 步:打开 PHP 端的"启用知识库"开关 + +> 目标:在数据库里把"病历场景"和"处方场景"是否走 MaxKB 检索的开关打开。 +> +> PHP 端有 4 个开关,对应 4 个场景。默认都是关的(0),需要手动改成开(1)。 + +--- + +## 1. 这 4 个开关在哪 + +它们存在数据库 `z_xk.xk_system_config` 表里: + +| config_key | 控制 | +|---|---| +| `ai_agent_kb_enabled_medical_record` | 病历生成是否查 MaxKB | +| `ai_agent_kb_enabled_prescription` | 处方生成是否查 MaxKB | +| `ai_agent_kb_enabled_prescription_validate` | 处方校验是否查 MaxKB | +| `ai_agent_kb_enabled_knowledge_qa` | 知识问答是否查 MaxKB | + +> 这 4 个开关本来就应该在 [20260809/ai_generation_extend_for_agent.sql](../../../../../gs/sql/萧康云医/20260809/ai_generation_extend_for_agent.sql) 执行后就已经插入数据库了。 + +--- + +## 2. 检查开关是否已存在 + +用数据库工具(Navicat / DBeaver / 1Panel 自带的 phpMyAdmin)连 `z_xk` 库,执行: + +```sql +SELECT config_key, config_value +FROM xk_system_config +WHERE config_key LIKE 'ai_agent_kb_enabled_%'; +``` + +### 情况 A:能查到 4 条记录 + +太好了,直接进**第 3 步**改值。 + +### 情况 B:查不到 + +说明 [ai_generation_extend_for_agent.sql](../../../../../gs/sql/萧康云医/20260809/ai_generation_extend_for_agent.sql) 还没执行。先执行这个 SQL 文件,再回来查。 + +--- + +## 3. 打开开关(改成 1) + +执行 UPDATE 把对应场景的开关改成 `1`: + +```sql +-- 病历生成走 MaxKB +UPDATE xk_system_config +SET config_value = '1', updated_at = UNIX_TIMESTAMP() +WHERE config_key = 'ai_agent_kb_enabled_medical_record'; + +-- 处方生成走 MaxKB +UPDATE xk_system_config +SET config_value = '1', updated_at = UNIX_TIMESTAMP() +WHERE config_key = 'ai_agent_kb_enabled_prescription'; +``` + +> 如果你暂时只想测试一个场景,只改一条也行。 + +### 验证 + +再查一次: +```sql +SELECT config_key, config_value FROM xk_system_config WHERE config_key LIKE 'ai_agent_kb_enabled_%'; +``` + +应该看到: +``` +ai_agent_kb_enabled_medical_record 1 +ai_agent_kb_enabled_prescription 1 +``` + +--- + +## 4. ⚠️ 清缓存(重要) + +PHP 端 `SystemConfigService` 有 1 小时内存缓存。如果你直接改数据库不开,PHP 可能还读旧值。 + +### 方法 A:重启 PHP-FPM(最稳) + +1Panel → 网站 → 找到你的 PHP 站点 → 重启 PHP-FPM。 + +或者 SSH: +```bash +systemctl restart php-fpm +# 或 +service php8.1-fpm restart +``` + +### 方法 B:等 1 小时 + +如果你不急,等 1 小时缓存自动过期。 + +### 方法 C:从后台改(推荐) + +如果你已经在 [system-config 页面](../../../../../gs/xk-admin/apps/web-antd/src/views/system/system-config/index.vue) 加了这 4 个 key 的可视化(**注意:当前前端只加了 `ai_react_*` 等 13 个,没有这 4 个 `ai_agent_kb_*`**),可以从后台改并自动清缓存。 + +--- + +## 5. 开关与场景对应关系(理解记忆) + +| PHP 调用时的 `scene` | 对应的开关 key | 现在的值 | +|---|---|---| +| `medical_record`(病历)| `ai_agent_kb_enabled_medical_record` | 0 → 改成 1 | +| `prescription`(处方)| `ai_agent_kb_enabled_prescription` | 0 → 改成 1 | + +PHP 调用 Go Agent 时会带 `scene=medical_record`,Go Agent **不查开关**,开关完全在 PHP 端决定是否发请求时带 `kb_enabled=true`。 + +--- + +## 常见问题 + +### Q1:改完没生效 + +99% 是 PHP 缓存。重启 PHP-FPM。 + +### Q2:临时关掉怎么办 + +把 `config_value` 改回 `0`,再重启 PHP-FPM。 + +--- + +## 🚨 重要提醒:做完这一步还不够! + +到这里你以为开关闭了,**但实际还是不会触发检索**! + +为什么?因为 PHP 调用 Go Agent 时**没有传"检索关键词"字段**,Go Agent 看到关键词为空,会自动跳过检索。 + +下一步**必须**做:[06_修复检索词Bug.md](./06_修复检索词Bug.md) + +--- + +下一步:[06_修复检索词Bug.md](./06_修复检索词Bug.md) diff --git a/docs/maxkb-ai/06_修复检索词Bug.md b/docs/maxkb-ai/06_修复检索词Bug.md new file mode 100644 index 0000000..6177e68 --- /dev/null +++ b/docs/maxkb-ai/06_修复检索词Bug.md @@ -0,0 +1,282 @@ +# 第 6 步:⚠️ 必做 — 修复"PHP 不传检索词"的 Bug + +> **这一步是最重要的!不做前面 5 步全白做!** +> +> 现状:PHP 调用 Go Agent 时**没传"检索关键词"**(context 字段),Go Agent 看到关键词为空就跳过检索,所以 MaxKB 永远不会被查询。 + +--- + +## Bug 长什么样 + +### Go Agent 这边的判断 + +文件:`nl-tcm-agent/internal/service/enhancer.go` 第 150 行: + +```go +// 三个条件必须全部满足才会去 MaxKB 检索: +if req.KBEnabled && s.maxkb != nil && strings.TrimSpace(req.Context) != "" { + // 去检索 +} +``` + +| 条件 | 现状 | 状态 | +|---|---|---| +| `req.KBEnabled` | 第 5 步打开了开关 | ✅ | +| `s.maxkb != nil` | 第 4 步配了 MaxKB | ✅ | +| `req.Context != ""` | **PHP 没传,永远是空串** | ❌ | + +### PHP 这边的调用 + +文件:`xk-api/app/Service/common/ai/AiMedicalAssistService.php` 第 722 行(病历)和 906 行(处方): + +```php +$this->dispatchShadowIfNeeded([ + 'primary_generation_id' => (int) $row->id, + 'messages' => $messages, + 'agent_options' => ['scene' => self::SCENE_MR, 'kb_enabled' => null], + // ❌ 没有 'context' 字段 + ... +]); +``` + +**修复方案**:在 `agent_options` 里加 `context` 字段,把患者主诉、证候等关键字段拼成一句检索词。 + +--- + +## 怎么修(病历场景) + +### 1. 找到调用位置 + +文件:`xk-api/app/Service/common/ai/AiMedicalAssistService.php` +位置:**第 722 行附近**(`generateMedicalRecord` 方法内的 `dispatchShadowIfNeeded`) + +### 2. 改之前长这样 + +```php +$this->dispatchShadowIfNeeded([ + 'primary_generation_id' => (int) $row->id, + 'messages' => $messages, + 'agent_options' => ['scene' => self::SCENE_MR, 'kb_enabled' => null], + 'meta' => [ + 'store_id' => $storeId, + 'register_id' => $registerId, + 'doctor_id' => $doctorId, + 'scene' => self::SCENE_MR, + 'prescription_type' => 0, + ], +], $chat->provider); +``` + +### 3. 改成这样(加 context) + +```php +$this->dispatchShadowIfNeeded([ + 'primary_generation_id' => (int) $row->id, + 'messages' => $messages, + 'agent_options' => [ + 'scene' => self::SCENE_MR, + 'kb_enabled' => null, + // 【新增】检索关键词:把主诉 + 现病史关键字 + 既往史关键字拼起来 + // 这串会被 MaxKB 用来"翻书",命中煎法/证候/ICD-10 等参考资料 + 'context' => $this->buildMrKbQuery($chief, $context), + ], + 'meta' => [ + 'store_id' => $storeId, + 'register_id' => $registerId, + 'doctor_id' => $doctorId, + 'scene' => self::SCENE_MR, + 'prescription_type' => 0, + ], +], $chat->provider); +``` + +### 4. 新增 `buildMrKbQuery` 私有方法 + +在 `AiMedicalAssistService` 类里任意位置(建议放在 `dispatchShadowIfNeeded` 附近)加: + +```php +/** + * 拼接病历场景的 MaxKB 检索词 + * + * 设计:把临床上最关键的几个字段拼成一串短文本, + * MaxKB 会用这串做向量检索,命中相关的煎法/证候/ICD-10 资料。 + * + * 注意: + * - 不要太长(建议 < 100 字),否则会稀释关键词 + * - 不要带患者隐私(姓名/电话),只带医学语义 + * - 优先放中医术语(证候/治法),次放西医主诉 + * + * @param string $chiefComplaint 主诉(如"胃脘胀满反复发作3年") + * @param array $contextFields 规范化后的可选字段(现病史/既往史等) + * @return string 检索词(如"胃脘胀满 痰湿中阻 健脾化湿") + */ +private function buildMrKbQuery(string $chiefComplaint, array $contextFields): string +{ + $parts = []; + // 1. 主诉是必填,最优先 + if ($chiefComplaint !== '') { + $parts[] = $chiefComplaint; + } + // 2. 中医证候(如果前端/历史病历已填) + if (!empty($contextFields['tcm_syndrome'])) { + $parts[] = (string) $contextFields['tcm_syndrome']; + } + // 3. 中医治法 + if (!empty($contextFields['tcm_therapy'])) { + $parts[] = (string) $contextFields['tcm_therapy']; + } + // 4. 西医诊断(用于 ICD-10 匹配) + if (!empty($contextFields['western_diagnosis'])) { + $parts[] = (string) $contextFields['western_diagnosis']; + } + // 用空格分隔,去重,限长(防超长 prompt) + $query = trim(implode(' ', array_unique($parts))); + return mb_substr($query, 0, 200); +} +``` + +> **关于字段名**:`tcm_syndrome / tcm_therapy / western_diagnosis` 是猜测的字段名。 +> 你需要根据 `normalizeMrContextFields()` 实际接受的字段名调整。看一下文件里这个方法的实现,或者在测试时打印 `$context` 看实际 key。 + +--- + +## 怎么修(处方场景) + +### 1. 找到调用位置 + +文件:`xk-api/app/Service/common/ai/AiMedicalAssistService.php` +位置:**第 906 行附近**(`generatePrescription` 方法内的 `dispatchShadowIfNeeded`) + +### 2. 改之前 + +```php +'agent_options' => ['scene' => self::SCENE_RX, 'kb_enabled' => null], +``` + +### 3. 改成 + +```php +'agent_options' => [ + 'scene' => self::SCENE_RX, + 'kb_enabled' => null, + // 【新增】处方场景检索词:主诉 + 证候 + 治法 + 药味 + 'context' => $this->buildRxKbQuery($chief, $mrArr), +], +``` + +### 4. 新增 `buildRxKbQuery` 私有方法 + +```php +/** + * 拼接处方场景的 MaxKB 检索词 + * + * 处方场景更关心:药材功效、配伍禁忌、煎法、委托调剂规则 + * 所以检索词优先放:证候 + 治法 + 已选药材 + 剂型 + * + * @param string $chiefComplaint 主诉 + * @param array $mrArr 病历数据(含证候/治法等) + * @return string 检索词 + */ +private function buildRxKbQuery(string $chiefComplaint, array $mrArr): string +{ + $parts = []; + if ($chiefComplaint !== '') { + $parts[] = $chiefComplaint; + } + if (!empty($mrArr['tcm_syndrome'])) { + $parts[] = (string) $mrArr['tcm_syndrome']; + } + if (!empty($mrArr['tcm_therapy'])) { + $parts[] = (string) $mrArr['tcm_therapy']; + } + // 关键词加权:处方场景一定要查配伍禁忌和煎法 + $parts[] = '配伍禁忌'; + $parts[] = '煎法'; + $query = trim(implode(' ', array_unique($parts))); + return mb_substr($query, 0, 200); +} +``` + +--- + +## 为什么这么设计检索词 + +### ✅ 好的检索词 + +| 检索词 | MaxKB 会命中 | +|---|---| +| `胃脘胀满 痰湿中阻 健脾化湿` | 煎法说明 + 证候治法字典 | +| `黄芪 党参 补气 配伍禁忌` | 配伍禁忌表 + 药品库 | +| `高血压 ICD-10` | ICD-10 诊断字典 | + +### ❌ 坏的检索词 + +| 检索词 | 问题 | +|---|---| +| `张三 男 35岁` | 没医学语义,搜不到任何东西 | +| (空字符串) | Go Agent 直接跳过 | +| 一大段 1000 字现病史 | 关键词被稀释,命中精度差 | + +--- + +## 验证修复成功 + +改完后,发起一次病历生成请求,然后查数据库: + +```sql +-- 找最新一条 agent 路径的生成记录 +SELECT id, scene, provider, step_count, total_tokens +FROM xk_ai_generation +WHERE provider = 'agent' +ORDER BY id DESC LIMIT 1; + +-- 看这条记录的子步骤 +SELECT step_type, status, detail, prompt_tokens, completion_tokens +FROM xk_ai_generation_step +WHERE generation_id = <上面的id> +ORDER BY id; +``` + +### 成功的样子 + +``` +step_type | status | detail | tokens +kb_retrieval | 1 | 命中 5 条相关文档 | 0 +llm_call | 1 | - | 1234 +``` + +**看到 `kb_retrieval` 且 status=1 就说明 MaxKB 真的被调用了!** + +--- + +## 常见问题 + +### Q1:改完 PHP 报错"undefined index tcm_syndrome" + +字段名不对。打印 `$context` 或 `$mrArr` 看实际 key: + +```php +Log::info('[KB query debug]', ['context' => $context, 'mrArr' => $mrArr]); +``` + +然后根据实际字段名改 `buildMrKbQuery` / `buildRxKbQuery`。 + +### Q2:检索词太短搜不到 + +至少要有 2-3 个关键词。如果只有主诉一个词,MaxKB 命中可能不准。 + +### Q3:检索词太长命中精度差 + +限制在 100-200 字以内最好。 + +### Q4:影子流量才传 context,主链路不传? + +注意:上面给的代码是改在 `dispatchShadowIfNeeded` 里,**只影响影子流量**。 + +如果你要主链路也走检索,需要改的是 **主调 Go Agent 的代码**,而不仅仅是影子流量。 + +主链路在哪调?看 `AiAgentFactory::make($provider)->chatCompletions($messages, $options)` 这种调用。把 `$options` 里也加 `context` 字段即可( `$provider === 'agent'` 时才生效)。 + +--- + +下一步:[07_验证与排错.md](./07_验证与排错.md) diff --git a/docs/maxkb-ai/07_验证与排错.md b/docs/maxkb-ai/07_验证与排错.md new file mode 100644 index 0000000..a1fd4ff --- /dev/null +++ b/docs/maxkb-ai/07_验证与排错.md @@ -0,0 +1,207 @@ +# 第 7 步:完整验证与排错指南 + +> 全部配完后,怎么知道真的接通了?出了问题怎么查? + +--- + +## 4 层验证(从外到内) + +每一层独立验证,**从最外层开始**,哪一层失败就查哪一层。 + +``` +[医生请求] → [PHP] → [Go Agent] → [MaxKB] + ① ② ③ ④ +``` + +### 验证 ④ MaxKB 本身能不能搜 + +**目的**:确认知识库内容没问题。 + +**方法**:用 curl 直接打 MaxKB: + +```bash +curl -X POST "http://你的MaxKB地址:8081/api/application/你的AppID/search" ^ + -H "Authorization: Bearer 你的APIKey" ^ + -H "Content-Type: application/json" ^ + -d "{\"query\":\"痰湿中阻 煎法\",\"top_k\":3}" +``` + +| 返回结果 | 说明 | +|---|---| +| `code: 200` + 有 `documents` 数组 | ✅ MaxKB OK | +| 401 | API Key 错 | +| 404 | URL 或 AppID 错 | +| 空 documents | 文档没向量化完 / 内容问题 | + +### 验证 ③ Go Agent 能不能调通 MaxKB + +**目的**:确认 Go 配置正确 + Go ↔ MaxKB 网络通。 + +**方法**:用 curl 直接打 Go Agent 的 `/enhance` 接口: + +```bash +curl -X POST "http://localhost:8080/api/v1/agent/enhance" ^ + -H "Content-Type: application/json" ^ + -d "{\"scene\":\"medical_record\",\"context\":\"胃脘胀满 痰湿中阻\",\"messages\":[{\"role\":\"user\",\"content\":\"测试\"}],\"kb_enabled\":true,\"top_k\":3}" +``` + +看返回的 JSON: + +| 返回中的 `steps` | 说明 | +|---|---| +| 有 `step_type: "kb_retrieval"` 且 `status: 1` | ✅ Go ↔ MaxKB 通了 | +| 有 `kb_retrieval` 但 `status: 2` | MaxKB 调用失败,看 `detail` 字段 | +| 完全没有 `kb_retrieval` | Go 端 kb_enabled 没收到 true,或 context 空 | + +### 验证 ② PHP 端开关和参数 + +**目的**:确认 PHP 真的把 `kb_enabled=true` 和 `context` 传给了 Go。 + +**方法 A**:在 `TcmAgentClient.php` 加临时日志。 + +打开 `app/Service/common/ai/TcmAgentClient.php`,找到 `chatCompletions` 方法构造 `$payload` 的位置,加一行: + +```php +Log::info('[TcmAgent payload]', $payload); +``` + +发起一次病历生成请求,看日志: + +| 现象 | 原因 | +|---|---| +| `kb_enabled: true` + `context: "..."` | ✅ 参数 OK | +| `kb_enabled: false` | system_config 开关没改对 / PHP 缓存 | +| `context` 字段不存在或为空 | 第 6 步的代码没改对 | + +**方法 B**:直接查 `xk_ai_generation_step` 表。 + +```sql +SELECT id, scene, provider, step_count, created_at +FROM xk_ai_generation +ORDER BY id DESC LIMIT 5; +``` + +看 `step_count` 字段: +- `1`:只有 llm_call,没检索 +- `2+`:有检索 + LLM(说明 KB 真的被调用了) + +再查子表: +```sql +SELECT step_type, status, detail, duration_ms +FROM xk_ai_generation_step +WHERE generation_id = <上面查到的id>; +``` + +### 验证 ① 真实业务请求 + +**目的**:确认从医生点击"生成病历"开始整条链路通。 + +**方法**:在小程序/后台发起一次病历生成(`provider=agent`),完成后立即查数据库: + +```sql +SELECT + g.id, g.scene, g.provider, g.total_tokens, g.duration_ms, + (SELECT COUNT(*) FROM xk_ai_generation_step s WHERE s.generation_id = g.id AND s.step_type = 'kb_retrieval' AND s.status = 1) AS kb_hit_count +FROM xk_ai_generation g +WHERE g.provider = 'agent' +ORDER BY g.id DESC LIMIT 1; +``` + +| kb_hit_count | 说明 | +|---|---| +| `1` | ✅ 整条链路通,MaxKB 被命中 | +| `0` | 中间有断点,回上一层验证 | + +--- + +## 排错速查表 + +| 症状 | 99% 的原因 | 解决 | +|---|---|---| +| `kb_retrieval` step 没出现 | PHP 没传 `context` 或开关没开 | 回第 5、6 步 | +| `kb_retrieval` status=2 | Go 连不上 MaxKB | 回第 4 步检查 base_url/port | +| `kb_retrieval` status=1 但 detail="命中 0 条" | 检索词太偏 / 知识库没相关内容 | 换检索词或上传更多资料 | +| 整个请求超时(120s) | MaxKB 卡死或网络断了 | `docker logs maxkb` 看 MaxKB 日志 | +| Go Agent 启动报错 | config.yaml 格式错 | 用 yamllint.com 检查 | +| PHP 端报 "未配置 Go Agent 地址" | `ai_agent_base_url` 配置项或 .env 没设 | 后台系统配置或 .env 加 `AI_AGENT_BASE_URL` | + +--- + +## 看日志的几个位置 + +### MaxKB 日志 + +```bash +docker logs -f maxkb --tail 100 +``` + +### Go Agent 日志 + +**直接运行的**:终端看输出。 + +**Docker 运行的**: +```bash +docker logs -f tcm-agent --tail 100 +``` + +**1Panel 部署的**:1Panel → 容器 → tcm-agent → 日志。 + +### PHP 日志 + +文件位置:`xk-api/storage/logs/laravel-<日期>.log` + +实时看: +```bash +tail -f storage/logs/laravel-$(date +%Y-%m-%d).log +``` + +### 数据库步骤表 + +最直观的"是否成功"信号源: + +```sql +SELECT + s.id, s.generation_id, s.step_type, s.status, + s.detail, s.duration_ms, + FROM_UNIXTIME(s.started_at) AS started_at +FROM xk_ai_generation_step s +ORDER BY s.id DESC LIMIT 20; +``` + +--- + +## 性能调优(接入后再看) + +### TopK 调多大? + +默认 5。命中太少(< 3)可以调到 8,但别超过 10(会让 prompt 过长、token 成本飞涨)。 + +### 检索太慢怎么办? + +- 检查 MaxKB 服务器 CPU/内存 +- 知识库分段太大 → 在 MaxKB 后台调"分段长度"(建议 300-500 字一段) +- 用更快的 embedding 模型 + +### 检索结果不准怎么办? + +- 看检索词是否包含中医术语 +- 在 MaxKB 后台用"命中测试"功能手动试 +- 文档质量影响大,确保 md 内容结构化(用 `##` 分章节) + +--- + +## 成功后的下一步 + +接入完成后,可以: + +1. **灰度放量**:在后台把 `ai_ab_test_enabled=1` + `ai_ab_test_experiment_ratio=10`,让 10% 用户先用上 Agent + MaxKB +2. **观察对比**:在"AI 影子流量对比"页看主链路 vs Agent 的 token/耗时/相似度 +3. **逐步放量**:稳定后把 ratio 提到 30 → 50 → 100 + +--- + +## 全部完成 ✅ + +恭喜!如果所有验证都通过,你的中医 AI Agent 已经具备"翻书"能力了。 + +回主目录:[README.md](./README.md) diff --git a/docs/maxkb-ai/08_本地知识库管理.md b/docs/maxkb-ai/08_本地知识库管理.md new file mode 100644 index 0000000..e207795 --- /dev/null +++ b/docs/maxkb-ai/08_本地知识库管理.md @@ -0,0 +1,387 @@ +# 08 · 本地知识库管理(V1 全文检索版) + +> 适用:MaxKB 免费版没有"纯检索 API"时的备选方案。本地方案直接把知识库内容存在 `z_xk` 数据库里,用 MySQL FULLTEXT 检索,零外部依赖。 +> +> 适合零基础运维 / 业务人员,按步骤操作即可。 + +--- + +## 一、它是什么? + +把"中医诊疗资料"(煎法、调剂规则、证候字典、ICD-10、药品库等)放到**本地数据库表**里,由 Go Agent 直接检索。 + +### 与 MaxKB 的对比 + +| 项目 | MaxKB 平台 | 本地知识库(本文档) | +|------|------------|----------------------| +| 部署 | 单独 Docker 部署 | **零部署**,跟着 MySQL 走 | +| 检索 API | 免费版没有 / Pro 版才有 | **免费**(MySQL FULLTEXT) | +| 向量化 | 支持 | V1 不支持,V2 接 BGE-M3 | +| 中文分词 | 自带 | MySQL `ngram` 分词器(2-gram) | +| 管理界面 | 自带 Web UI | `/kb/view` 单页(Vue CDN) | +| 适合场景 | 内容多、要向量检索 | **中小规模(几千段以内)**,要快、要省 | + +### 一句话总结 + +> V1 用"本地知识库 + 全文检索"先把链路跑通;内容量大了或需要语义匹配时,再切回 MaxKB 或升级 V2 向量化。 + +--- + +## 二、V1 整体架构 + +```mermaid +flowchart LR + A["PHP AiMedicalAssistService"] -->|"POST /api/v1/agent/enhance"| B["Go Agent / EnhancerService"] + B --> C{agentcfg.KB.Source} + C -->|local 默认| D["本地知识库检索器
kb.Searcher"] + C -->|maxkb 切换| E["MaxKB 客户端
(需要 Pro 版)"] + D --> F[("z_xk.xk_kb_chunk
FULLTEXT ngram 索引")] + E --> G[[MaxKB 服务]] + D --> H["拼成参考资料 system 消息"] + E --> H + H --> I["调 LLM(DeepSeek/Spark/...)"] + I --> J["返回 PHP"] +``` + +**关键判断点:** `xk_system_config.ai_kb_source` 的值: +- `local`(默认)→ 走本地知识库 +- `maxkb` → 走 MaxKB 平台 + +切换是一行 SQL,**无需重启**: + +```sql +UPDATE xk_system_config SET config_value = 'local' WHERE config_key = 'ai_kb_source'; +-- 缓存 60 秒生效;想立即生效调 Go Agent 的 /api/v1/agent/invalidate-cache 接口 +``` + +--- + +## 三、首次部署(5 步) + +### 步骤 1:导入数据库表结构 + +执行 SQL 文件: + +``` +d:\worker\gs\sql\萧康云医\20260811\kb_local.sql +``` + +这一步会创建 3 张表 + 写入 6 条 `xk_system_config` 默认配置: + +| 表名 | 作用 | +|------|------| +| `xk_kb_library` | 知识库(一个 library = 一组文档) | +| `xk_kb_doc` | 文档(一个 doc = 一个导入文件) | +| `xk_kb_chunk` | 分段(一个 chunk = 检索的最小单元) | + +新增的 6 个配置项: + +| key | 默认值 | 说明 | +|-----|--------|------| +| `ai_kb_source` | `local` | 知识库源(local/maxkb) | +| `ai_kb_embedding_provider` | `noop` | 向量化 provider(V1 不用) | +| `ai_kb_embedding_api_key` | (空) | 向量化 API Key(V1 不用) | +| `ai_kb_top_k` | `5` | 检索返回条数 | +| `ai_kb_similarity_threshold` | `0.5` | 向量相似度阈值(V2 用) | +| `ai_kb_search_mode` | `fulltext` | 检索模式(fulltext/vector/blend) | + +### 步骤 2:确认 MySQL 版本和 ngram 支持 + +本地知识库 V1 走 **MySQL FULLTEXT + ngram 分词器**,要求: + +- MySQL **5.7.6+**(推荐 8.0+) +- InnoDB 引擎(已经是默认) +- `innodb_ft_ngram_token_size` 默认是 2(中医术语大多是 2-4 字,2-gram 正合适) + +验证 ngram 是否生效: + +```sql +SHOW VARIABLES LIKE 'innodb_ft_ngram_token_size'; +-- 期望值:2 +``` + +> 如果你的 MySQL 是 8.0 默认配置,以上检查都会通过,不用改任何东西。 + +### 步骤 3:重启 Go Agent + +```bash +# 在 Go Agent 部署目录 +go build -o tcm-agent ./cmd/server +./tcm-agent +``` + +启动后日志里应该看到: + +``` +[router] 已注册路由:POST /api/v1/kb/admin/libraries +[router] 已注册路由:POST /api/v1/kb/admin/docs/import +... +[router] 已挂载静态文件:/kb/view → view/ +``` + +### 步骤 4:打开后台管理页 + +浏览器访问: + +``` +http://你的Go-Agent地址:8080/kb/view +``` + +(端口看你的 `server.port` 配置) + +打开后会看到三个 Tab: +- **知识库**:库 / 文档 / 分段管理 +- **检索测试**:直接试关键词,看检索效果 +- **向量化(V2)**:V2 预告,V1 用不到 + +### 步骤 5:把 PHP 切到走 Go Agent + +在 PHP 后台的「系统配置」页面,把: + +``` +ai_active_provider = agent +``` + +(或者前端在调 AI 生成时显式传 `provider=agent`,详见 [05_打开PHP开关.md](05_打开PHP开关.md)) + +--- + +## 四、知识库内容从哪来? + +### 方式 A:从 MaxKB 导出(推荐) + +如果你之前已经在 MaxKB 里维护好了内容: + +1. 打开 MaxKB → 进入你的应用 → 知识库 +2. 选中要导出的文档 → 点「导出」→ 选择 **Excel 格式** +3. 下载得到一个 `.xlsx` 文件 +4. 直接用本地知识库管理页的「导入文档」上传 + +**MaxKB 导出的 Excel 默认 3 列:** + +| 列 | 内容 | 必填 | +|----|------|------| +| 第 1 列 | 分段标题 | 可空 | +| 第 2 列 | 分段内容 | **必填** | +| 第 3 列 | 关联问题列表(分号分隔) | 可空 | + +> 本地知识库会自动识别表头行(包含"标题"/"内容"字样)并跳过。 + +### 方式 B:手动写 Markdown + +适合规则类、列表类内容(如煎法、调剂规则)。 + +新建一个 `煎法规则.md`: + +```markdown +# 解表剂 + +## 麻黄汤 +麻黄 9g 桂枝 6g 杏仁 6g 炙甘草 3g +水煎服,温覆取微汗。 + +## 桂枝汤 +桂枝 9g 芍药 9g 生姜 9g 大枣 3枚 炙甘草 6g +水煎服,啜热稀粥助药力。 + +# 攻下剂 + +## 大承气汤 +大黄 12g 厚朴 15g 枳实 12g 芒硝 9g +水煎,先煮厚朴枳实,后下大黄,溶化芒硝。 +``` + +按 `#`/`##`/`###` 标题切分,每个标题下的一段成为一个 chunk。 + +### 方式 C:纯文本(txt) + +无标题的段落文本,按双换行自动切段,每段累计 500 字打包成一个 chunk。 + +--- + +## 五、典型操作流程 + +### 5.1 新建一个库 + +1. 打开 `/kb/view` +2. 点「新建知识库」 +3. 填库名(如"中医诊疗资料 v1")、描述 +4. 来源选「从 MaxKB 导出」或「手动建立」 +5. 点确定 + +### 5.2 导入文档 + +1. 在库列表点「进入」选中库 +2. 点「导入文档(xlsx / md / txt)」 +3. 选择本地文件上传 +4. 等几秒(视文件大小),看到提示"导入成功:N 个分段" +5. 文档列表里会出现新条目 + +> 单文件最大 50MB。如果文件很大建议拆分多个小文件分别导入,方便管理。 + +### 5.3 查看分段 + +点文档行的「查看分段」可看到切分后的所有 chunk。 + +### 5.4 试一试检索 + +切到「检索测试」Tab: + +1. 选择库 +2. 输入检索词(如"痰湿中阻") +3. 点「检索」 +4. 看到结果列表,每条带一个 **score(得分)**: + - 得分越高越相关 + - 得分是 MySQL FULLTEXT BM25 相关度(无固定范围,相对比较即可) + - 0 分或没结果说明关键词太冷门 + +> **检索技巧:** V1 是 2-gram 分词,关键词用 2-4 字效果最好(如"煎法"、"调剂"、"麻黄汤")。 +> 太长的句子(如"痰湿中阻怎么治")会被自动切成"痰湿""湿中""中阻""怎么""么治"等 2-gram,仍能匹配,但 shorter query 更精确。 + +### 5.5 删除文档 / 库 + +- 删除文档:会软删该文档 + 它的所有分段 +- 删除库:会软删该库 + 库下所有文档和分段 + +> 软删除 = `deleted_at` 字段填当前时间戳,不物理删除,便于追溯。如果想物理清理,自行 SQL 操作即可。 + +--- + +## 六、PHP 端如何配合? + +### 6.1 PHP 调用 Go Agent 时传 context + +PHP 端在 `AiMedicalAssistService` 里组装好检索关键词,作为 `context` 字段传给 Go Agent: + +```php +// PHP 端伪代码 +$payload = [ + 'scene' => 'medical_record', + 'context' => '痰湿中阻 煎法', // ← 关键:这是检索关键词 + 'messages' => $messages, + 'kb_enabled' => true, + 'top_k' => 5, +]; +$response = TcmAgentClient::getInstance()->chatCompletions($messages, [ + 'payload' => $payload, +]); +``` + +详见 [06_修复检索词Bug.md](06_修复检索词Bug.md)。 + +### 6.2 Go Agent 端的处理流程 + +``` +PHP POST /api/v1/agent/enhance + body.context = "痰湿中阻 煎法" + ↓ +[1] 读 agentcfg.KB.Source(默认 local) +[2] 调 kb.Searcher.Search: + SELECT *, MATCH(title,content) AGAINST('痰湿中阻 煎法' IN BOOLEAN MODE) AS score + FROM xk_kb_chunk + WHERE library_id = ? AND is_active = 1 AND deleted_at = 0 + AND MATCH(title,content) AGAINST('痰湿中阻 煎法' IN BOOLEAN MODE) + ORDER BY score DESC LIMIT 5 +[3] 把命中结果拼成 system 消息,插到 messages 头部 +[4] 调 LLM +[5] 返回 { content, steps: [{step_type:'kb_retrieval', ...}, {step_type:'llm_call', ...}] } +``` + +PHP 端拿到 `steps` 后写入 `xk_ai_generation_step` 子表,记录每次检索的耗时(如果有的话)。 + +--- + +## 七、常见问题排查 + +### Q1:检索结果为空? + +**排查清单:** + +1. 库里是否有分段?管理页「库列表」看 `chunk_count` +2. 分段是否启用?`is_active=1` +3. 检索词是否太短?(ngram 最少 2 字,单字会匹配不到) +4. 直接 SQL 验证: + +```sql +-- 检查 FULLTEXT 是否能命中 +SELECT id, title, LEFT(content, 50), MATCH(title,content) AGAINST('痰湿' IN BOOLEAN MODE) AS score +FROM xk_kb_chunk +WHERE library_id = 1 AND is_active = 1 AND deleted_at = 0 +ORDER BY score DESC +LIMIT 10; +``` + +5. 看看 ngram 索引是否建成功: + +```sql +SHOW INDEX FROM xk_kb_chunk WHERE Index_type = 'FULLTEXT'; +-- 期望看到 ft_content 索引,Index_type=FULLTEXT +``` + +### Q2:检索很慢? + +- 检查 chunk 总数,超过 10 万行时考虑加索引或换 V2 向量检索 +- 检查 MySQL `innodb_buffer_pool_size` 是否够大(建议 4G+) +- 检查 `ft_max_word_len`(默认 84 应该够) + +### Q3:导入 Excel 失败? + +- 确认文件后缀是 `.xlsx`(不支持老版 `.xls` 二进制格式) +- 确认文件大小 < 50MB +- 看 Go Agent 日志:`kb: 打开 xlsx 失败: ...`,常见原因是文件损坏或格式不对 +- 用 Excel/WPS 重新另存为 xlsx 再试 + +### Q4:切换 maxkb 模式不生效? + +`agentcfg` 有 60 秒缓存。立即生效方法: + +```bash +# 调 Go Agent 的缓存失效接口(如果实现了) +curl -X POST http://你的Go-Agent地址:8080/api/v1/agent/invalidate-cache +``` + +或者重启 Go Agent 进程。 + +--- + +## 八、V2 升级路径(接入 BGE-M3 向量化) + +V1 的设计已经为 V2 留好了所有接口,升级时**只换底层,不动业务**。 + +### V2 改造点 + +| 模块 | V1 | V2 | +|------|------|------| +| `kb.Embedder` | `NoopEmbedder`(不做向量) | `BGEM3Embedder`(本地服务) | +| `xk_kb_chunk.content_vector` | NULL | 1024 维向量(JSON 数组) | +| `xk_kb_chunk.is_vectorized` | 0 | 1(向量化后回填) | +| `kb.Searcher` | 仅 FULLTEXT | vector / blend(混合 BM25 + 余弦) | +| `ai_kb_search_mode` | `fulltext` | `blend`(推荐) | + +### V2 接入步骤(未来) + +1. 本地部署 BGE-M3 服务(Docker:`curl -X POST http://localhost:8081/embed -d '...'`) +2. 把 V1 的 `NoopEmbedder` 换成 `BGEM3Embedder`(新增文件 `embedder_bge.go`) +3. 调用 `/api/v1/kb/admin/embed` 触发批量向量化(V2 启用) +4. 把 `ai_kb_search_mode` 改成 `blend` +5. 重启 Go Agent + +**业务代码(PHP / EnhancerService)零改动。** + +--- + +## 九、文件清单(开发参考) + +| 文件 | 作用 | +|------|------| +| `internal/kb/embedder.go` | Embedder 接口 + NoopEmbedder + V2 工厂 | +| `internal/kb/importer.go` | Chunker + Importer(解析 xlsx/md/txt) | +| `internal/kb/searcher.go` | Searcher(V1 FULLTEXT / V2 vector) | +| `internal/kb/library_service.go` | 库/文档/分段管理业务层 | +| `internal/kb/helpers.go` | 小工具函数 | +| `internal/dao/kb_dao.go` | 数据访问层(GORM 实体 + CRUD) | +| `internal/handler/kb_admin_handler.go` | 9 个 HTTP 端点 | +| `internal/router/router.go` | 路由注册 + 静态文件挂载 | +| `view/index.html` | 后台管理单页(Vue CDN + Element Plus) | +| `internal/agentcfg/agentcfg.go` | KB 配置加载(`ai_kb_*` 系列) | +| `20260811/kb_local.sql` | 建表 SQL + 默认配置项 | diff --git a/docs/maxkb-ai/MaxKB创建内容.md b/docs/maxkb-ai/MaxKB创建内容.md new file mode 100644 index 0000000..db6acd5 --- /dev/null +++ b/docs/maxkb-ai/MaxKB创建内容.md @@ -0,0 +1,256 @@ +# MaxKB 智能体创建内容(直接复制版) + +> 本文档专门给 MaxKB 智能体("创建智能体 → 空白创建 → 简易配置")页面用。 +> +> **用法**:在 MaxKB 创建智能体时,每个字段直接对照本文档复制粘贴即可。 + +--- + +## 智能体基础信息 + +| 字段 | 复制这个 | +|---|---| +| **名称** | `萧康云医中医诊疗助手` | +| **描述** | `中医病历生成与处方开具的智能辅助助手,融合中医证候/治法/疾病字典、煎法、配伍禁忌、ICD-10、药品库等专业资料` | +| **AI 模型** | 选 `DeepSeek`(或 OpenAI GPT-4o)| +| **历史聊天记录** | `0`(病历/处方是单次独立任务,不需要历史上下文)| + +--- + +## 1. 系统提示词(直接复制下面整段) + +> 这一段会**固定注入每次对话的开头**,用来给模型定角色、规则、输出格式。 + +``` +你是一位资深的中医诊疗专家,专注于中医病历书写和中药处方开具。 +你的知识边界严格限定在中医临床诊疗范围内:四诊合参、辨证论治、方剂配伍、煎法调剂、ICD-10诊断、中医证候/治法/疾病字典。 + +【核心职责】 +1. 根据患者主诉、现病史、既往史等临床信息,生成结构化的中医病历(含望闻问切、辨证、治法、方药) +2. 根据病历结果开具中药处方(饮片/颗粒/成药),并标注剂量、单位、煎法、委托调剂等业务字段 +3. 所有回答必须优先参考"已知信息"中提供的知识库内容(煎法、证候、药品库等) + +【回答规则】 +- 严格基于知识库内容回答,不在资料库中的内容不得编造 +- 涉及剂量、煎法、配伍禁忌时,必须引用知识库中的具体规则 +- 输出必须为合法 JSON(除非用户明确要求其他格式) +- 处方中所有药材必须来自知识库的药品库,不得杜撰药名 +- 中医证候、治法、疾病名称必须使用规范术语(参考知识库字典) +- 严格避免中医十八反十九畏的配伍禁忌 + +【输出风格】 +- 严肃专业,不寒暄 +- 字段精简,不带多余解释 +- 数字用阿拉伯数字,剂量精确到 0.1 + +【限制】 +- 不回答与中医诊疗无关的话题 +- 不进行西医诊断与西药处方建议 +- 不给出绝对化的治愈承诺 +- 涉及急危重症立即建议转诊 +``` + +--- + +## 2. 用户提示词(直接复制下面整段) + +> 这一段会**拼在用户问题之前**,告诉模型"已知信息"和"用户问题"分别在哪个位置。 +> +> ⚠️ **`{data}` 和 `{question}` 是 MaxKB 的内置变量,必须原样保留,不要替换成实际内容**。 + +``` +已知信息: +{data} + +任务:基于上述已知信息,结合中医临床规范,完成下述任务。要求所有结论必须有据可查,涉及煎法/配伍/ICD-10 的字段必须引用已知信息中的对应规则。 + +用户问题/任务: +{question} +``` + +--- + +## 3. 知识库关联设置 + +| 字段 | 复制这个 | +|---|---| +| **关联知识库** | ✅ 勾选 `中医医疗知识库`(第 2 步创建的)| + +### 检索参数(展开"高级设置"后填) + +| 参数 | 推荐值 | 原因 | +|---|---|---| +| **检索模式** | `混合检索` | 同时用向量+全文,中医术语既需要语义匹配又需要关键词精确匹配 | +| **相似度阈值** | `0.5` | 中医术语有同义/近义词,阈值太高会漏掉相关内容 | +| **引用分段数 Top-N** | `5` | 既够覆盖一个症状的证候/煎法/药品,又不刷屏 | +| **最大引用字符数** | `3000` | 病历/处方任务需要上下文,但又不能让 prompt 爆炸 | +| **无引用时的回答策略** | `指定回复:知识库中暂无相关资料,请补充资料后重试` | **不要让模型用通用知识编造**,医疗内容必须可追溯 | +| **问题优化** | ✅ 开启 | 用户原始问题(如"胃疼怎么治")会被改写成更适合检索的表述(如"胃脘痛 辨证论治")| + +--- + +## 4. 技能(Skills)配置 + +> 我们的智能体不需要 MaxKB 的 MCP/工具/Skills —— 因为 Go Agent 已经在调用方做了所有工具编排(Function Calling、ReAct 等)。 +> +> **保持"技能"区域为空**即可。 + +如果你将来想让 MaxKB 自己也能调外部接口(比如查 HIS 系统),可以加: + +| 技能类型 | 是否需要 | 说明 | +|---|---|---| +| **MCP** | ❌ 不需要 | Go Agent 端已有 | +| **工具** | ❌ 不需要 | 同上 | +| **Skills** | ❌ 不需要 | 同上 | +| **子智能体** | ❌ 不需要 | 目前只有一个智能体 | + +--- + +## 5. 开场白(可选,给调试用) + +> 这一段是给 MaxKB 自己的"演示"窗口用的,不影响 API 调用。 +> +> MaxKB API 调用(Go Agent 走的路径)不会用到开场白。 + +``` +你好,我是萧康云医中医诊疗助手。 +我可以帮你: +- 根据患者信息生成结构化中医病历 +- 基于病历开具规范的中药处方 + +请提供患者主诉、年龄、性别等临床信息,我会参考中医知识库生成结果。 + +快捷问题: +- 帮我生成一份"痰湿中阻"证型的病历示例 +- 黄芪、党参、白术的常用配伍剂量 +- 痰湿中阻的常用煎法是什么 +``` + +> **快捷问题格式**:`-` 开头,一行一个,MaxKB 会渲染成可点击按钮。 + +--- + +## 6. 完整字段速查表(创建时对照勾选) + +把下表打印出来,逐项对照不会漏: + +| # | 字段名 | 填什么 | 完成打勾 | +|---|---|---|---| +| 1 | 名称 | `萧康云医中医诊疗助手` | ☐ | +| 2 | 描述 | 见上 | ☐ | +| 3 | AI 模型 | DeepSeek | ☐ | +| 4 | 系统提示词 | 复制本文档第 1 节 | ☐ | +| 5 | 用户提示词 | 复制本文档第 2 节(保留 `{data}` `{question}`)| ☐ | +| 6 | 历史聊天记录 | `0` | ☐ | +| 7 | 关联知识库 | ✅ 中医医疗知识库 | ☐ | +| 8 | 检索模式 | 混合检索 | ☐ | +| 9 | 相似度阈值 | `0.5` | ☐ | +| 10 | Top-N | `5` | ☐ | +| 11 | 最大引用字符数 | `3000` | ☐ | +| 12 | 无引用时回答策略 | 指定回复(拒绝编造)| ☐ | +| 13 | 问题优化 | ✅ 开启 | ☐ | +| 14 | 技能 | 留空 | ☐ | +| 15 | 开场白 | 复制本文档第 5 节(可选)| ☐ | +| 16 | **发布** | 右上角"保存并发布" | ☐ ⚠️ 必做 | + +--- + +## 7. 创建后必做的事 ⚠️ + +### 必做 1:发布智能体 + +新版 MaxKB **不会自动发布**,必须点右上角 **"保存并发布"**。 + +状态从"未发布"变成"**已发布**"才能用 API 调用。 + +### 必做 2:在调试窗口测试 + +进入智能体 → 调试窗口(右侧预览)→ 输入: + +``` +患者:男,45岁,胃脘胀满反复发作3年,加重1周。舌苔白腻,脉濡滑。 +任务:生成中医病历。 +``` + +期望返回:包含"辨证:痰湿中阻"、"治法:健脾化湿、理气和胃"、引用了知识库的煎法/证候资料。 + +### 必做 3:拿 API Key + +参见 [03_创建应用拿密钥.md](./03_创建应用拿密钥.md) 第 3 节"拿到三个钥匙"。 + +--- + +## 8. 常见问题 + +### Q1:调试时模型不回答,提示"未配置模型" + +回 MaxKB 设置 → 模型管理 → 添加一个 DeepSeek 大语言模型(带 API Key)。 + +### Q2:返回的内容里没有引用知识库 + +检查: +1. 智能体是否**关联**了知识库(不是只上传,要关联) +2. 用户提示词里是否含 `{data}` 变量 +3. 检索参数:相似度阈值是否过高(建议 0.5) + +### Q3:返回空 JSON 或不合法 JSON + +去系统提示词加一句: +``` +- 输出必须是单层 JSON 对象,不要带 markdown 代码块标记 +- 所有字符串值必须用双引号 +``` + +### Q4:返回的内容很长带很多解释 + +去系统提示词的"输出风格"加: +``` +- 字段精简,不带多余解释 +- 不要返回"以下是病历..."这种引导语 +- 直接返回 JSON 内容本身 +``` + +### Q5:API 调用还是返回"未发布" + +确认右上角状态显示"已发布"。**保存 ≠ 发布**,要单独点"发布"按钮。 + +--- + +## 9. 进阶:如果你以后想做"处方校验"专用智能体 + +可以再建一个智能体,专门校验处方合理性: + +**系统提示词(处方校验版)**: + +``` +你是一位严谨的中医处方审核专家,负责对医生开具的中药处方进行合理性、安全性校验。 + +【校验维度】 +1. 配伍禁忌:检查是否存在十八反、十九畏 +2. 剂量合理性:单味药剂量是否超出药典上限 +3. 证型匹配:药味与辨证是否对应 +4. 煎法标注:是否标注正确的煎法(先煎/后下/包煎等) +5. 委托调剂:是否符合委托调剂规则 +6. 妊娠禁忌:是否包含孕妇禁用药 + +【输出格式】 +返回 JSON: +{ + "passed": true/false, + "issues": [ + {"level": "error/warning/info", "field": "出问题的字段", "reason": "原因", "suggestion": "建议"} + ], + "summary": "总体评价" +} + +【规则】 +- error 级别必须阻断(如配伍禁忌) +- warning 级别提醒医生确认(如剂量偏大) +- 严格依据知识库中的"中医配伍禁忌"和"药品库",不主观判断 +``` + +> 处方校验智能体走另一个 App ID,PHP 端按 `prescription_validate` 场景调用即可。 + +--- + +完成创建后:回 [03_创建应用拿密钥.md](./03_创建应用拿密钥.md) 拿 API Key → 继续 [04_配置GoAgent.md](./04_配置GoAgent.md) diff --git a/docs/maxkb-ai/README.md b/docs/maxkb-ai/README.md new file mode 100644 index 0000000..2ad3e0f --- /dev/null +++ b/docs/maxkb-ai/README.md @@ -0,0 +1,106 @@ +# MaxKB 知识库接入教程(零基础版) + +> 本教程面向**没接触过 MaxKB / RAG / Go Agent** 的同学,从 0 开始一步步带你把中医知识库接到 AI Agent 上。 +> +> 跟着做完后,效果:医生开病历 / 开处方时,AI 会先去知识库里查"煎法 / 委托调剂 / 中医证候 / ICD-10 / 药品库"等固定资料,再生成回答,结果更准、幻觉更少。 + +--- + +## 这个东西是干嘛的? + +打个比方: +- **现在的 AI**:凭脑子里的训练知识回答(脑子里的知识可能过时、可能记错) +- **接入 MaxKB 后的 AI**:回答前先去你的资料库翻书,把翻到的内容当作参考再回答(更准、更可控) + +``` +医生发起请求 ──▶ AI 先去 MaxKB 查相关资料 ──▶ 资料塞进提示词 ──▶ AI 结合资料生成答案 + ↑ + 你录入的知识库 + (煎法、证候、药品、ICD-10…) +``` + +--- + +## 你需要准备什么 + +| 准备项 | 说明 | +|---|---| +| 一台能装 Docker 的服务器 | 推荐 Linux(你已经在用 1Panel,最简单) | +| 服务器至少 4G 内存 | MaxKB + 向量库吃内存,2G 会卡 | +| 服务器开放一个端口给 MaxKB | 比如 `8081`(**不要用 8080**,会和 Go Agent 冲突) | +| 知识库资料(已为你准备好) | [storage/maxkb_seed/](../../../../opt/1panel/www/sites/xk-api/index/xk-api/storage/maxkb_seed/) 下有 7 个 Markdown 文件 | + +--- + +## 学习路径(按顺序看) + +| 文档 | 做什么 | 预计耗时 | +|---|---|---| +| [01_部署MaxKB.md](./01_部署MaxKB.md) | 在服务器上装一个 MaxKB 平台 | 15 分钟 | +| [02_上传知识库.md](./02_上传知识库.md) | 把中医资料传到 MaxKB,让它能搜 | 10 分钟 | +| **[MaxKB创建内容.md](./MaxKB创建内容.md)** | **创建智能体时系统提示词/用户提示词/检索参数该怎么填**(直接复制版)| 5 分钟 | +| [03_创建应用拿密钥.md](./03_创建应用拿密钥.md) | 在 MaxKB 里建一个"应用",拿到 API 钥匙 | 5 分钟 | +| [04_配置GoAgent.md](./04_配置GoAgent.md) | 改 Go Agent 配置文件,让它知道 MaxKB 在哪 | 5 分钟 | +| [05_打开PHP开关.md](./05_打开PHP开关.md) | 在数据库里把"启用知识库"的开关打开 | 5 分钟 | +| [06_修复检索词Bug.md](./06_修复检索词Bug.md) | ⚠️ **必做**:修复 PHP 不传检索词的 Bug | 10 分钟 | +| [07_验证与排错.md](./07_验证与排错.md) | 怎么测试接入是否成功?失败了怎么查? | 按需 | +| **[08_本地知识库管理.md](./08_本地知识库管理.md)** | **MaxKB 免费版没有检索 API?改用本地知识库**(零部署、零成本) | 15 分钟 | + +> **怎么选 MaxKB vs 本地知识库?** +> +> - 你的 MaxKB 是**专业版(Pro)** → 走 [01-07](./01_部署MaxKB.md),体验最好(支持语义检索) +> - 你的 MaxKB 是**免费版** → 直接跳到 [08_本地知识库管理.md](./08_本地知识库管理.md),5 步搞定 + +**全部做完总耗时:约 55 分钟** + +--- + +## 整体架构图(看一眼就懂) + +``` +┌──────────────────────────────────────────────────────────────────┐ +│ 你的服务器 │ +│ │ +│ ┌──────────────┐ 检索 ┌──────────────────┐ │ +│ │ MaxKB 平台 │ ◀───────────── │ Go Agent │ │ +│ │ (端口 8081) │ ────────────▶ │ (端口 8080) │ │ +│ │ │ 返回文档片段 │ │ │ +│ │ 你的中医资料 │ │ - 拼 system 消息 │ │ +│ │ (煎法/证候) │ │ - 调 DeepSeek │ │ +│ └──────────────┘ └────────┬─────────┘ │ +│ │ HTTP │ +│ ▼ │ +│ ┌──────────────────┐ │ +│ │ PHP (xk-api) │ │ +│ │ │ │ +│ │ - 拼业务提示词 │ │ +│ │ - 调 Go Agent │ │ +│ │ - 写入数据库 │ │ +│ └────────┬─────────┘ │ +│ │ │ +└────────────────────────────────────────────┼──────────────────────┘ + │ + ▼ + ┌──────────────┐ + │ 医生小程序 │ + └──────────────┘ +``` + +--- + +## 常见名词解释(小白专用) + +| 名词 | 大白话解释 | +|---|---| +| **MaxKB** | 一个开源的"知识库 + AI"平台,你把资料扔进去,它帮你建索引、做检索,AI 调它就能"翻书" | +| **RAG** | Retrieval-Augmented Generation,检索增强生成。就是"先翻书再回答"的技术统称 | +| **知识库** | MaxKB 里的概念,相当于一个文件夹,装着一堆相关文档 | +| **应用 / 智能体** | MaxKB 里的概念,相当于"一个对外开放的 API 入口",关联到一个或多个知识库。
⚠️ **注意版本差异**:MaxKB **老版(1.x/2.x)叫"应用"**,**新版(4.x)叫"智能体"**。两个是同一个东西,底层 API 完全一样。如果你界面里看到的是"智能体",把它当"应用"看就行。 | +| **API Key** | 一串密码,调 API 时带着它证明"我是合法用户"。老版以 `application-` 开头,新版可能是 `application-` 或 `agent-` 开头 | +| **App ID** | 应用 ID,类似"应用编号",UUID 格式(8-4-4-4-12),调 API 时拼在 URL 里 | +| **向量化** | 把文字转成数字数组的过程,方便算相似度。MaxKB 自动做,你不用管 | +| **TopK** | 检索时返回"最相关的前 K 条",K 一般填 5(既够用又不刷屏) | + +--- + +下一步:开始 [01_部署MaxKB.md](./01_部署MaxKB.md) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..f6e6ec9 --- /dev/null +++ b/go.mod @@ -0,0 +1,50 @@ +module tcm-agent + +go 1.25.0 + +require ( + github.com/gin-gonic/gin v1.10.0 + github.com/golang-jwt/jwt/v5 v5.2.0 + github.com/ledongthuc/pdf v0.0.0-20250511090121-5959a4027728 + github.com/xuri/excelize/v2 v2.11.0 + golang.org/x/net v0.56.0 + golang.org/x/text v0.38.0 + gopkg.in/yaml.v3 v3.0.1 + gorm.io/driver/mysql v1.6.0 + gorm.io/gorm v1.31.2 +) + +require ( + filippo.io/edwards25519 v1.1.0 // indirect + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-sql-driver/mysql v1.8.1 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/richardlehane/mscfb v1.0.7 // indirect + github.com/richardlehane/msoleps v1.0.6 // indirect + github.com/tiendc/go-deepcopy v1.7.2 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + github.com/xuri/efp v0.0.1 // indirect + github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/crypto v0.53.0 // indirect + golang.org/x/sys v0.46.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..5c2987e --- /dev/null +++ b/go.sum @@ -0,0 +1,124 @@ +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= +github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= +github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/ledongthuc/pdf v0.0.0-20250511090121-5959a4027728 h1:QwWKgMY28TAXaDl+ExRDqGQltzXqN/xypdKP86niVn8= +github.com/ledongthuc/pdf v0.0.0-20250511090121-5959a4027728/go.mod h1:1fEHWurg7pvf5SG6XNE5Q8UZmOwex51Mkx3SLhrW5B4= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/richardlehane/mscfb v1.0.7 h1:oeoiM0WE79vHwE8RpIYYvIAc8ajTH2mb6UZm55/+EB0= +github.com/richardlehane/mscfb v1.0.7/go.mod h1:pe0+IUIc0AHh0+teNzBlJCtSyZdFOGgV4ZK9bsoV+Jo= +github.com/richardlehane/msoleps v1.0.6 h1:9BvkpjvD+iUBalUY4esMwv6uBkfOip/Lzvd93jvR9gg= +github.com/richardlehane/msoleps v1.0.6/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/tiendc/go-deepcopy v1.7.2 h1:Ut2yYR7W9tWjTQitganoIue4UGxZwCcJy3orjrrIj44= +github.com/tiendc/go-deepcopy v1.7.2/go.mod h1:4bKjNC2r7boYOkD2IOuZpYjmlDdzjbpTRyCx+goBCJQ= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/xuri/efp v0.0.1 h1:fws5Rv3myXyYni8uwj2qKjVaRP30PdjeYe2Y6FDsCL8= +github.com/xuri/efp v0.0.1/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI= +github.com/xuri/excelize/v2 v2.11.0 h1:HxaEFl6sRN2+8J5a8HaKq+0M4FsjBGMnWWtjOCPSG88= +github.com/xuri/excelize/v2 v2.11.0/go.mod h1:jxFLbzaIwGQ5ufFNvYfUOHqXhfPaNmP14KWfmNz2Uak= +github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 h1:+C0TIdyyYmzadGaL/HBLbf3WdLgC29pgyhTjAT/0nuE= +github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto= +golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio= +golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE= +golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY= +golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= +golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw= +golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE= +golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg= +gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo= +gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ= +gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8= +gorm.io/gorm v1.31.2 h1:3o8FXNo9v9S858gil+3LlZA1LkCOzgb4g5BL64FgaCo= +gorm.io/gorm v1.31.2/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/internal/agent/budget.go b/internal/agent/budget.go new file mode 100644 index 0000000..223fa04 --- /dev/null +++ b/internal/agent/budget.go @@ -0,0 +1,179 @@ +package agent + +// ======================================================================== +// TokenBudget —— 单次 AI 任务的 Token 预算累加器 +// ======================================================================== +// 作用: +// 给一次 AI 生成任务设置"总 token 上限",跨多轮 LLM 调用累加, +// 超过预算时主动中止,避免: +// 1. Agent 死循环/工具反复触发导致单请求烧几十万 token(成本失控) +// 2. 模型无限复读(罕见但发生过,会撑爆 max_tokens 之外的总账) +// 3. 用户构造超长 prompt 攻击 +// +// 与厂商 max_tokens 的区别: +// - 厂商 max_tokens:控制"单次响应"输出 token 数,无法跨轮累加 +// - TokenBudget :控制"整次任务"累计 token 数(prompt+completion 一起算), +// 是 Agent 客户端层面的二级防护 +// +// 使用方式: +// budget := NewTokenBudget(8000) // 后台配置 ai_token_budget_per_request +// for { +// maxTok := budget.CalcMaxTokensForCall(cfg.MaxPerCall) +// result := client.ChatWithOpts(ctx, msgs, tools, ChatOpts{MaxTokens: maxTok}) +// budget.Consume(result.PromptTokens, result.CompletionTokens) +// if budget.IsExceeded() { break } // 触发软中止 +// } +// ======================================================================== + +import ( + "fmt" + "sync" +) + +// ErrBudgetExceeded 预算超限错误(ReactLoop 据此判定软中止) +// +// 调用方应该捕获本错误后返回"已生成的部分内容",而不是直接报错给用户 +var ErrBudgetExceeded = fmt.Errorf("token budget exceeded") + +// TokenBudget Token 预算累加器(线程安全) +type TokenBudget struct { + mu sync.Mutex + used int // 已用 token 数(prompt + completion 累加) + limit int // 上限(0 表示不限制) + exceeded bool // 是否已超限 + maxPerCall int // 单次调用最大输出 token 数(用于 CalcMaxTokensForCall) +} + +// NewTokenBudget 创建预算器 +// +// 参数: +// - limit - 单任务总 token 上限(0 表示不限) +// - maxPerCall- 单次 LLM 调用输出 token 上限(透传厂商 max_tokens) +func NewTokenBudget(limit, maxPerCall int) *TokenBudget { + if limit < 0 { + limit = 0 + } + if maxPerCall < 0 { + maxPerCall = 0 + } + return &TokenBudget{ + limit: limit, + maxPerCall: maxPerCall, + } +} + +// Consume 累加一次 LLM 调用的 token 用量 +// +// 参数: +// - promptTokens - 本次输入 token 数 +// - completionTokens - 本次输出 token 数 +func (b *TokenBudget) Consume(promptTokens, completionTokens int) { + if b == nil { + return + } + b.mu.Lock() + defer b.mu.Unlock() + b.used += promptTokens + completionTokens + if b.limit > 0 && b.used > b.limit { + b.exceeded = true + } +} + +// IsExceeded 是否已超限 +func (b *TokenBudget) IsExceeded() bool { + if b == nil { + return false + } + b.mu.Lock() + defer b.mu.Unlock() + return b.exceeded +} + +// Used 已用 token 数 +func (b *TokenBudget) Used() int { + if b == nil { + return 0 + } + b.mu.Lock() + defer b.mu.Unlock() + return b.used +} + +// Remaining 剩余可用 token 数(limit=0 时返回 -1 表示不限) +func (b *TokenBudget) Remaining() int { + if b == nil { + return -1 + } + b.mu.Lock() + defer b.mu.Unlock() + if b.limit == 0 { + return -1 + } + r := b.limit - b.used + if r < 0 { + return 0 + } + return r +} + +// CalcMaxTokensForCall 计算下一次 LLM 调用应该传给厂商的 max_tokens 值 +// +// 策略:取 min(配置的单次上限, 剩余预算) +// - 配置的单次上限:ai_token_max_per_call(如 2048) +// - 剩余预算:limit - used(如剩余 1000,则这次最多 1000,否则必然超) +// +// 注意:剩余预算只算 completion 部分(厂商 max_tokens 限制的就是 completion), +// 但这里无法预知下一次的 prompt token,所以是粗略估算(保守取值,宁可少生成) +func (b *TokenBudget) CalcMaxTokensForCall(cfgMaxPerCall int) int { + if b == nil { + return cfgMaxPerCall + } + b.mu.Lock() + defer b.mu.Unlock() + + // 没设上限 → 用 cfg 值 + if b.limit == 0 { + if cfgMaxPerCall > 0 { + return cfgMaxPerCall + } + return 2048 // 兜底 + } + + // 有上限:取 min(cfgMaxPerCall, 剩余) + upper := cfgMaxPerCall + if upper <= 0 { + upper = b.maxPerCall + } + if upper <= 0 { + upper = 2048 + } + remain := b.limit - b.used + if remain < upper { + if remain < 1 { + return 1 // 至少给 1,避免厂商报错"max_tokens 必须 > 0" + } + return remain + } + return upper +} + +// Snapshot 取一份只读快照(用于日志/返回给上层) +func (b *TokenBudget) Snapshot() BudgetSnapshot { + if b == nil { + return BudgetSnapshot{} + } + b.mu.Lock() + defer b.mu.Unlock() + return BudgetSnapshot{ + Used: b.used, + Limit: b.limit, + Exceeded: b.exceeded, + } +} + +// BudgetSnapshot 预算快照(只读) +type BudgetSnapshot struct { + Used int `json:"used"` // 已用 token + Limit int `json:"limit"` // 上限(0=不限) + Exceeded bool `json:"exceeded"` // 是否超限 +} diff --git a/internal/agent/emr_agent.go b/internal/agent/emr_agent.go new file mode 100644 index 0000000..d08135e --- /dev/null +++ b/internal/agent/emr_agent.go @@ -0,0 +1,204 @@ +package agent + +import ( + "context" + "encoding/json" + "fmt" + "log" + "strings" +) + +// ======================================================================== +// 病历生成 Agent (EMR Generator) +// ======================================================================== +// 场景说明: +// 患者提供主诉和病史 → Agent 生成符合《中医病历书写规范》的结构化病历 +// +// 模型路由: +// 默认路由到 "emr-generator" → 配置中指向 DeepSeek/gpt-4o 等强推理模型 +// +// 生命周期: +// ① 感知:接收患者主诉+病史 +// ② 规划:检索病历模板 → 标准化术语 → 生成初稿 +// ③ 检索:调 MaxKB 获取病历书写规范 +// ④ 工具:查 HIS 获取既往病史 +// ⑤ 反思:规则引擎质控 → 不通过则修正 +// ⑥ 输出:结构化病历 JSON +// ======================================================================== + +// EMRGenerator 病历生成 Agent +type EMRGenerator struct { + runner *Runner + scene string // 场景名(用于模型路由) +} + +// EMRRequest 病历生成请求 +type EMRRequest struct { + PatientID string `json:"patient_id" binding:"required"` // 患者 ID + ChiefComplaint string `json:"chief_complaint" binding:"required"` // 主诉 + HistoryNotes string `json:"history_notes"` // 病史补充 + Allergies []string `json:"allergies"` // 过敏史 + PastIllness []string `json:"past_illness"` // 既往病史 +} + +// EMRResponse 病历生成响应 +type EMRResponse struct { + SessionID string `json:"session_id"` + Draft string `json:"draft"` // 病历草稿(自然语言) + Structured string `json:"structured"` // 结构化 JSON + Issues []string `json:"issues"` // 质控问题 + Status string `json:"status"` // success / need_revision +} + +// NewEMRGenerator 创建病历生成 Agent +// +// 参数: +// runner - Agent 引擎(提供模型路由、工具、会话管理) +// scene - 场景名(对应 config.yaml 中 routes 的 key,为空则用默认) +func NewEMRGenerator(runner *Runner, scene string) *EMRGenerator { + if scene == "" { + scene = "emr-generator" // 默认场景名 + } + return &EMRGenerator{ + runner: runner, + scene: scene, + } +} + +// Generate 执行病历生成(完整 Agent 生命周期) +func (g *EMRGenerator) Generate(ctx context.Context, req *EMRRequest) (*EMRResponse, error) { + // ===== ① 感知阶段 ===== + // 创建会话,绑定场景名(Runner 会根据场景路由到对应模型) + session := g.runner.CreateSession(req.PatientID, g.scene) + log.Printf("[病历Agent] 开始 | 患者:%s 会话:%s 场景:%s", + req.PatientID, session.ID, g.scene) + + // 注入系统提示词(约束 LLM 行为) + systemPrompt := `你是一位资深的中医主治医师,擅长书写规范化的中医门诊病历。 +请严格按照以下结构输出病历: +1. 主诉(Chief Complaint):简洁概括主要症状+持续时间 +2. 现病史(History of Present Illness):按时间线描述病情演变 +3. 既往史(Past History):既往疾病、手术、过敏 +4. 舌象(Tongue):舌质、舌苔描述 +5. 脉象(Pulse):脉象特征 +6. 辨证分析(Pattern Differentiation):八纲辨证+脏腑辨证 +7. 西医诊断(Western Diagnosis) +8. 中医诊断(TCM Diagnosis):证型 + +要求:术语规范,使用标准中医术语,不遗漏关键信息。` + + session.History = append(session.History, Message{ + Role: "system", Content: systemPrompt, Timestamp: 0, + }) + + // 构造用户输入 + userInput := fmt.Sprintf(`患者主诉:%s + +患者补充病史:%s + +过敏史:%v +既往病史:%v + +请生成完整中医病历。`, req.ChiefComplaint, req.HistoryNotes, req.Allergies, req.PastIllness) + + // ===== ②~⑤ Agent 推理循环 ===== + // Runner.Run 内部会: + // 1. 通过 ModelRouter 获取当前场景的 LLM + // 2. LLM 自主决定调用哪些工具(MaxKB 检索、HIS 查询等) + // 3. 工具结果喂回 LLM,循环直到产出最终答案 + result, err := g.runner.Run(ctx, session.ID, userInput) + if err != nil { + return nil, fmt.Errorf("[病历Agent] 执行失败: %w", err) + } + + // ===== ⑥ 规则引擎质控(独立于 LLM 的硬校验) ===== + issues := checkEMRQuality(result) + + resp := &EMRResponse{ + SessionID: session.ID, + Draft: result, + Issues: issues, + } + + // ===== ⑦ 反思阶段 ===== + if len(issues) > 0 { + // 有问题 → 让 Agent 基于反馈修正 + log.Printf("[病历Agent] 质控发现问题,进入反思修正 | 问题:%v", issues) + revisionInput := fmt.Sprintf("请修正以下病历中的问题:\n%s\n\n原病历:\n%s", + strings.Join(issues, "\n"), result) + revised, err := g.runner.Run(ctx, session.ID, revisionInput) + if err == nil { + resp.Draft = revised + resp.Issues = checkEMRQuality(revised) + } + resp.Status = "need_revision" + } else { + resp.Status = "success" + } + + // 提取结构化字段 + resp.Structured = extractStructuredEMR(resp.Draft) + + log.Printf("[病历Agent] 完成 | 会话:%s 状态:%s 问题数:%d", + session.ID, resp.Status, len(resp.Issues)) + return resp, nil +} + +// ======================================================================== +// 内部辅助函数 +// ======================================================================== + +// checkEMRQuality 病历质控检查 +// +// 注意:这里只做简单的文本检查。 +// 生产环境应调用 rule 包的 EMRQualityChecker(更完整的规则集)。 +func checkEMRQuality(emrText string) []string { + issues := make([]string, 0) + + requiredFields := []string{"主诉", "舌", "脉", "诊断"} + for _, field := range requiredFields { + if !strings.Contains(emrText, field) { + issues = append(issues, fmt.Sprintf("【缺失】病历缺少「%s」字段", field)) + } + } + + // 口语术语检查 + slangMap := map[string]string{ + "胃不舒服": "胃脘不适", "头晕": "眩晕", "心慌": "心悸", + "睡不着": "失眠", "吃不下": "纳差", "拉肚子": "泄泻", + } + for slang, standard := range slangMap { + if strings.Contains(emrText, slang) { + issues = append(issues, fmt.Sprintf("【术语】建议将「%s」改为「%s」", slang, standard)) + } + } + + return issues +} + +// extractStructuredEMR 从自然语言病历中提取结构化字段 +func extractStructuredEMR(draft string) string { + structured := map[string]string{ + "chief_complaint": extractField(draft, "主诉"), + "tongue": extractField(draft, "舌象"), + "pulse": extractField(draft, "脉象"), + "diagnosis_tcm": extractField(draft, "中医诊断"), + "diagnosis_wm": extractField(draft, "西医诊断"), + } + b, _ := json.Marshal(structured) + return string(b) +} + +// extractField 简单提取字段值(生产环境建议用 LLM + NER) +func extractField(text, fieldName string) string { + lines := strings.Split(text, "\n") + for _, line := range lines { + if strings.Contains(line, fieldName) { + parts := strings.SplitN(line, ":", 2) + if len(parts) == 2 { + return strings.TrimSpace(parts[1]) + } + } + } + return "" +} diff --git a/internal/agent/prescription_agent.go b/internal/agent/prescription_agent.go new file mode 100644 index 0000000..b9d2bdf --- /dev/null +++ b/internal/agent/prescription_agent.go @@ -0,0 +1,223 @@ +package agent + +import ( + "context" + "encoding/json" + "fmt" + "log" + "strings" + + "tcm-agent/internal/rule" +) + +// ======================================================================== +// 处方生成 Agent (Prescription Generator) +// ======================================================================== +// 场景说明: +// 已有结构化病历 → Agent 辨证 → 检索经典方剂 → 生成中药处方 +// +// 模型路由: +// 默认路由到 "prescription" → 配置中指向 GPT-4o/DeepSeek 等 +// +// 三层安全防护: +// Layer 3: 医生人工审核(Human-in-the-Loop) +// Layer 2: 规则引擎硬校验(十八反/十九畏/剂量/孕妇) +// Layer 1: MaxKB 知识库提供权威药典依据 +// ======================================================================== + +// PrescriptionGenerator 处方生成 Agent +type PrescriptionGenerator struct { + runner *Runner + scene string // 场景名 +} + +// PrescriptionRequest 处方生成请求 +type PrescriptionRequest struct { + PatientID string `json:"patient_id" binding:"required"` + EMRText string `json:"emr_text" binding:"required"` + Diagnosis string `json:"diagnosis" binding:"required"` + Age int `json:"age"` + IsPregnant bool `json:"is_pregnant"` + Allergies []string `json:"allergies"` +} + +// PrescriptionResponse 处方生成响应 +type PrescriptionResponse struct { + SessionID string `json:"session_id"` + Prescription *Prescription `json:"prescription"` + Draft string `json:"draft"` + Warnings []string `json:"warnings"` + Blocked bool `json:"blocked"` + Status string `json:"status"` // success/blocked/need_review +} + +// Prescription 结构化处方 +type Prescription struct { + FormulaName string `json:"formula_name"` + Herbs []Herb `json:"herbs"` + Instructions string `json:"instructions"` + Contraindications string `json:"contraindications"` + Duration int `json:"duration"` +} + +// Herb 单味药 +type Herb struct { + Name string `json:"name"` + Dose float64 `json:"dose"` + Unit string `json:"unit"` + Decoction string `json:"decoction"` +} + +// NewPrescriptionGenerator 创建处方生成 Agent +func NewPrescriptionGenerator(runner *Runner, scene string) *PrescriptionGenerator { + if scene == "" { + scene = "prescription" + } + return &PrescriptionGenerator{ + runner: runner, + scene: scene, + } +} + +// Generate 执行处方生成(完整 Agent 生命周期) +func (g *PrescriptionGenerator) Generate(ctx context.Context, req *PrescriptionRequest) (*PrescriptionResponse, error) { + // ===== ① 感知阶段 ===== + session := g.runner.CreateSession(req.PatientID, g.scene) + log.Printf("[处方Agent] 开始 | 患者:%s 诊断:%s 会话:%s 场景:%s", + req.PatientID, req.Diagnosis, session.ID, g.scene) + + // 注入系统提示词 + systemPrompt := `你是一位资深的中医师,精通经方与时方应用。 +请根据患者病历和中医诊断,遵循以下原则开具处方: + +1. 辨证论治:严格依据证型选择方剂 +2. 君臣佐使:明确君药、臣药、佐药、使药 +3. 剂量合规:参考《中国药典》2020版剂量范围 +4. 煎服法:注明先煎、后下、包煎等特殊煎法 +5. 配伍禁忌:绝对避免十八反、十九畏 +6. 特殊人群:孕妇慎用活血破血药,儿童减量 + +输出格式:先给出方剂名称和辨证思路,再逐味列出药材、剂量、煎法。` + + session.History = append(session.History, Message{ + Role: "system", Content: systemPrompt, Timestamp: 0, + }) + + // 构造用户输入 + userInput := fmt.Sprintf(`【病历】 +%s + +【中医诊断】%s +【患者年龄】%d岁 +【是否孕妇】%v +【过敏史】%v + +请开具中药处方。`, req.EMRText, req.Diagnosis, req.Age, req.IsPregnant, req.Allergies) + + // ===== ②~⑤ Agent 推理循环 ===== + // LLM 会自主决定: + // → 调 MaxKB 检索对应证型的经典方剂 + // → 调药典工具验证每味药剂量 + // → 生成处方初稿 + result, err := g.runner.Run(ctx, session.ID, userInput) + if err != nil { + return nil, fmt.Errorf("[处方Agent] 执行失败: %w", err) + } + + // ===== ⑥ 规则引擎硬校验 ===== + warnings, blocked := validatePrescription(result, req) + + resp := &PrescriptionResponse{ + SessionID: session.ID, + Draft: result, + Warnings: warnings, + Blocked: blocked, + } + + // ===== ⑦ 反思阶段 ===== + if blocked { + log.Printf("[处方Agent] 🚨 被规则引擎拦截 | 警告:%v", warnings) + revisionInput := fmt.Sprintf(`以下处方违反了配伍禁忌或剂量规则,请重新组方: +问题列表: +%s + +原处方: +%s + +请修正后重新输出。`, strings.Join(warnings, "\n"), result) + + revised, err := g.runner.Run(ctx, session.ID, revisionInput) + if err == nil { + resp.Draft = revised + newWarnings, newBlocked := validatePrescription(revised, req) + resp.Warnings = newWarnings + resp.Blocked = newBlocked + } + resp.Status = "blocked" + } else if len(warnings) > 0 { + resp.Status = "need_review" + } else { + resp.Status = "success" + } + + // 解析结构化处方 + resp.Prescription = parsePrescription(resp.Draft) + + log.Printf("[处方Agent] 完成 | 会话:%s 状态:%s 警告数:%d", + session.ID, resp.Status, len(resp.Warnings)) + return resp, nil +} + +// Validate 仅做处方校验(不生成) +func (g *PrescriptionGenerator) Validate(ctx context.Context, prescriptionText string, req *PrescriptionRequest) ([]string, bool) { + return validatePrescription(prescriptionText, req) +} + +// ======================================================================== +// 处方校验(委托给 rule 包) +// ======================================================================== +// +// 所有规则定义(十八反/十九畏/剂量/孕妇/过敏)都在 rule 包中维护。 +// agent 包仅做调用,保持解耦。 + +// validatePrescription 校验处方(核心安全方法) +// +// 委托给 rule 包的独立校验器,保持 agent 包与 rule 包解耦。 +func validatePrescription(prescription string, req *PrescriptionRequest) ([]string, bool) { + // 构造 rule 包的患者信息 + patient := &rule.PatientInfo{ + IsPregnant: req.IsPregnant, + Allergies: req.Allergies, + Age: req.Age, + } + + // 调用独立规则引擎 + return rule.NewPrescriptionValidator().Validate(prescription, patient) +} + +// ======================================================================== +// 处方解析 +// ======================================================================== + +// parsePrescription 从自然语言处方中解析结构化数据 +func parsePrescription(text string) *Prescription { + p := &Prescription{ + Herbs: make([]Herb, 0), + Duration: 7, + Instructions: "水煎服,日一剂,分两次温服", + } + + lines := strings.Split(text, "\n") + for _, line := range lines { + // 提取方剂名 + if strings.Contains(line, "方剂") || strings.Contains(line, "方名") { + parts := strings.SplitN(line, ":", 2) + if len(parts) == 2 { + p.FormulaName = strings.TrimSpace(parts[1]) + } + } + } + + _, _ = json.Marshal(p) + return p +} diff --git a/internal/agent/runner.go b/internal/agent/runner.go new file mode 100644 index 0000000..24d1075 --- /dev/null +++ b/internal/agent/runner.go @@ -0,0 +1,463 @@ +package agent + +import ( + "context" + "crypto/rand" + "fmt" + "log" + "sync" + "time" + + "tcm-agent/internal/config" + "tcm-agent/internal/llm" + "tcm-agent/internal/tool" + "tcm-agent/internal/types" +) + +// ======================================================================== +// Runner —— Agent 引擎核心调度器 +// ======================================================================== +// 职责: +// - 管理会话生命周期(创建/获取/清理) +// - 管理工具注册表 +// - 执行 Agent 推理循环(感知→规划→检索→工具→反思→输出) +// +// 关键升级: +// - 不再硬编码 DeepSeek,通过 llm.ModelRouter 动态获取模型 +// - 不同 Agent 场景可以绑定不同模型(病历用 DeepSeek,处方用 GPT-4o) +// - 支持降级链:主模型挂了自动切备用 +// +// 架构关系: +// Handler → Agent(EMR/Prescription) → Runner → ModelRouter → LLMClient +// ↓ +// ProviderFactory +// ↓ +// DeepSeek/OpenAI/... +// ======================================================================== + +// Runner Agent 引擎核心调度器 +type Runner struct { + router *llm.ModelRouter // 模型路由器(核心升级点) + fallback *llm.FallbackChain // 降级链(高可用保障) + tools map[string]Tool // 注册的工具集 + sessions map[string]*Session // 会话缓存(短期记忆) + mu sync.RWMutex // 保护 sessions 的并发锁 + maxkb *tool.MaxKBClient // MaxKB 知识库客户端 + cfg *RunnerConfig // Runner 自身配置 +} + +// RunnerConfig Runner 运行参数 +type RunnerConfig struct { + MaxIterations int // Agent 最大推理轮数 + Timeout time.Duration // 单次调用超时 + DefaultScene string // 默认场景名(用于获取模型) +} + +// Session 单次 Agent 会话的上下文 +// +// 一个 Session 代表一次完整的"患者就诊"过程: +// - 从患者描述主诉开始 +// - 到病历生成、处方开具 +// - 全程保持对话上下文 +type Session struct { + ID string `json:"id"` // 会话唯一 ID + UserID string `json:"user_id"` // 关联用户(医生/患者) + Scene string `json:"scene"` // 当前场景(emr/prescription) + History []Message `json:"history"` // 对话历史(短期记忆) + State map[string]any `json:"state"` // 中间状态 + CreatedAt time.Time `json:"created_at"` // 创建时间 + UpdatedAt time.Time `json:"updated_at"` // 最后更新 + Status string `json:"status"` // running/completed/failed +} + +// Message 单条对话消息(type 别名,向后兼容旧调用方) +// +// 真正的定义在 internal/types 包,目的是打破 llm <-> agent 循环依赖 +type Message = types.Message + +// Tool Agent 可调用的工具接口(type 别名) +type Tool = types.Tool + +// ToolCallInfo 工具调用记录(type 别名) +type ToolCallInfo = types.ToolCallInfo + +// ======================================================================== +// 初始化 +// ======================================================================== + +// InitRunner 初始化 Agent 引擎 +// +// 参数: +// router - 模型路由器(由 llm.InitLLM 创建) +// fallback - 降级链(可为 nil,表示不启用降级) +// cfg - 全局配置(用于读取 MaxKB 配置和 Agent 参数) +// +// 返回: +// 初始化完成的 Runner 实例 +func InitRunner(router *llm.ModelRouter, fallback *llm.FallbackChain, cfg interface{ GetMaxKB() MaxKBConfigGetter; GetAgent() AgentConfigGetter }) *Runner { + // 从配置中提取需要的信息 + maxkbCfg := config.MaxKBConfig{} + var agentCfg RunnerConfig + + if cfg != nil { + if m := cfg.GetMaxKB(); m != nil { + maxkbCfg = config.MaxKBConfig{ + BaseURL: m.GetBaseURL(), + APIKey: m.GetAPIKey(), + AppID: m.GetAppID(), + } + } + if a := cfg.GetAgent(); a != nil { + agentCfg = RunnerConfig{ + MaxIterations: a.GetMaxIterations(), + Timeout: time.Duration(a.GetTimeout()) * time.Second, + } + } + } + + // 设置默认值 + if agentCfg.MaxIterations == 0 { + agentCfg.MaxIterations = 10 + } + if agentCfg.Timeout == 0 { + agentCfg.Timeout = 120 * time.Second + } + + r := &Runner{ + router: router, + fallback: fallback, + tools: make(map[string]Tool), + sessions: make(map[string]*Session), + maxkb: tool.NewMaxKBClient(maxkbCfg), + cfg: &agentCfg, + } + + // 注册默认工具集 + r.registerDefaultTools() + + // 启动会话清理协程 + go r.cleanupExpiredSessions() + + log.Printf("[Runner] ✅ 初始化完成 | 工具数: %d | 最大推理轮数: %d", + len(r.tools), r.cfg.MaxIterations) + return r +} + +// registerDefaultTools 注册 Agent 默认工具集 +func (r *Runner) registerDefaultTools() { + r.RegisterTool(tool.NewMaxKBRetrieveTool(r.maxkb)) // 知识库检索 + r.RegisterTool(tool.NewHISTool(nil)) // HIS 系统查询 + r.RegisterTool(tool.NewPharmacopoeiaTool(r.maxkb)) // 药典查询 + r.RegisterTool(tool.NewRuleCheckTool()) // 规则引擎校验 +} + +// MaxKBConfigGetter MaxKB 配置读取接口(type 别名指向 config 包同名接口) +// +// 为什么要别名:InitRunner 形参类型必须和 config.Config 的 GetMaxKB() 返回类型一致, +// 否则 main.go 里传 cfg 给 InitRunner 会报"接口未实现"。 +type MaxKBConfigGetter = config.MaxKBConfigGetter + +// AgentConfigGetter Agent 配置读取接口(type 别名指向 config 包同名接口) +type AgentConfigGetter = config.AgentConfigGetter + +// ======================================================================== +// 会话管理 +// ======================================================================== + +// CreateSession 创建新会话 +// +// 参数: +// userID - 用户标识(医生 ID 或患者 ID) +// scene - 场景名称(对应路由表中的 key,如 "emr-generator") +func (r *Runner) CreateSession(userID, scene string) *Session { + r.mu.Lock() + defer r.mu.Unlock() + + session := &Session{ + ID: generateSessionID(), + UserID: userID, + Scene: scene, + History: make([]Message, 0), + State: make(map[string]any), + CreatedAt: time.Now(), + UpdatedAt: time.Now(), + Status: "running", + } + r.sessions[session.ID] = session + + log.Printf("[Runner] 创建会话: %s | 用户: %s | 场景: %s", session.ID, userID, scene) + return session +} + +// GetSession 获取会话 +func (r *Runner) GetSession(id string) (*Session, bool) { + r.mu.RLock() + defer r.mu.RUnlock() + s, ok := r.sessions[id] + return s, ok +} + +// DeleteSession 删除会话(释放资源) +func (r *Runner) DeleteSession(id string) { + r.mu.Lock() + defer r.mu.Unlock() + delete(r.sessions, id) + log.Printf("[Runner] 删除会话: %s", id) +} + +// ======================================================================== +// 工具管理 +// ======================================================================== + +// RegisterTool 注册工具 +func (r *Runner) RegisterTool(t Tool) { + r.mu.Lock() + defer r.mu.Unlock() + r.tools[t.Name()] = t + log.Printf("[Runner] 注册工具: %s - %s", t.Name(), t.Description()) +} + +// GetTools 获取所有已注册工具 +func (r *Runner) GetTools() []Tool { + r.mu.RLock() + defer r.mu.RUnlock() + list := make([]Tool, 0, len(r.tools)) + for _, t := range r.tools { + list = append(list, t) + } + return list +} + +// ======================================================================== +// 核心:Agent 推理循环 +// ======================================================================== + +// Run 执行一次完整的 Agent 生命周期 +// +// 这是整个系统最核心的方法,实现了: +// +// 感知 → 规划 → 检索 → 工具调用 → 反思 → 输出 +// +// 参数: +// ctx - 上下文(支持超时取消) +// sessionID - 会话 ID +// userInput - 用户输入 +// +// 返回: +// Agent 最终输出文本 +// +// 流程详解: +// +// ┌─────────────────────────────────────────────────────────────┐ +// │ ① 感知:接收用户输入,加载会话记忆 │ +// │ ② 获取模型:通过 Router 拿到当前场景对应的 LLM │ +// │ ③ 规划+执行循环(最多 MaxIterations 轮): │ +// │ a. 调用 LLM(附带工具定义) │ +// │ b. LLM 决定:直接回复 or 调用工具 │ +// │ c. 若调用工具 → 执行 → 结果喂回 LLM → 继续循环 │ +// │ d. 若直接回复 → 结束循环 │ +// │ ④ 输出:返回最终回复,更新会话状态 │ +// └─────────────────────────────────────────────────────────────┘ +func (r *Runner) Run(ctx context.Context, sessionID string, userInput string) (string, error) { + session, ok := r.GetSession(sessionID) + if !ok { + return "", fmt.Errorf("[Runner] 会话不存在: %s", sessionID) + } + + // ===== ① 感知阶段:加载上下文 ===== + session.History = append(session.History, Message{ + Role: "user", Content: userInput, Timestamp: time.Now().Unix(), + }) + session.UpdatedAt = time.Now() + + // ===== ② 获取当前场景对应的模型 ===== + scene := session.Scene + if scene == "" { + scene = "default" + } + + // ===== ③ Agent 推理循环 ===== + for i := 0; i < r.cfg.MaxIterations; i++ { + // --- 调用 LLM(带降级) --- + var resp *Message + var err error + + if r.fallback != nil { + // 使用降级链:主模型挂了自动切备用 + llmResp, fbErr := r.fallback.ChatWithFallback(ctx, scene, session.History, r.GetTools()) + if fbErr != nil { + return "", fmt.Errorf("[Runner] 所有模型均不可用: %w", fbErr) + } + resp = llmResp + err = nil + _ = err + } else { + // 直连模式:通过 Router 获取模型 + client, rtErr := r.router.Get(scene) + if rtErr != nil { + return "", fmt.Errorf("[Runner] 获取模型失败: %w", rtErr) + } + resp, err = client.Chat(ctx, session.History, r.GetTools()) + if err != nil { + return "", fmt.Errorf("[Runner] LLM 调用失败: %w", err) + } + } + + // --- 检查是否需要调用工具 --- + if resp.ToolCall != nil { + // 【协议修复】先把 assistant 这一帧(含 tool_calls)入栈 + // OpenAI Function Calling 协议要求 messages 数组中: + // ... → assistant(tool_calls) → tool(result) → assistant(...) + // 之前只 append tool 帧不 append assistant 帧,部分模型会报 + // "messages must alternate between user/assistant/tool" 错误 + session.History = append(session.History, *resp) + + // 执行工具 + toolResult, toolErr := r.executeTool(ctx, resp.ToolCall) + + // tool 帧必须带 ToolCallID 与 assistant 帧 tool_calls[].id 对应(OpenAI 协议) + toolMsg := Message{ + Role: "tool", Content: toolResult, + ToolCallID: resp.ToolCall.ID, + Timestamp: time.Now().Unix(), + } + if toolErr != nil { + toolMsg.Content = fmt.Sprintf("工具执行错误: %v", toolErr) + log.Printf("[Runner] 工具执行失败: %s → %v", resp.ToolCall.ToolName, toolErr) + } else { + log.Printf("[Runner] 工具执行成功: %s → %.80s...", resp.ToolCall.ToolName, toolResult) + } + + session.History = append(session.History, toolMsg) + continue // 带着工具结果进入下一轮推理 + } + + // --- LLM 产出最终回复 --- + session.History = append(session.History, *resp) + session.Status = "completed" + session.UpdatedAt = time.Now() + + log.Printf("[Runner] ✅ Agent 完成 | 会话: %s | 推理轮数: %d", sessionID, i+1) + return resp.Content, nil + } + + // 达到最大轮数仍未完成 + session.Status = "failed" + return "", fmt.Errorf("[Runner] Agent 达到最大推理轮数(%d)仍未完成", r.cfg.MaxIterations) +} + +// executeTool 执行工具调用 +func (r *Runner) executeTool(ctx context.Context, call *ToolCallInfo) (string, error) { + r.mu.RLock() + t, ok := r.tools[call.ToolName] + r.mu.RUnlock() + + if !ok { + return "", fmt.Errorf("[Runner] 工具不存在: %s", call.ToolName) + } + + result, err := t.Execute(ctx, call.Params) + return result, err +} + +// ======================================================================== +// 会话清理 +// ======================================================================== + +// cleanupExpiredSessions 定期清理过期会话(超过1小时) +func (r *Runner) cleanupExpiredSessions() { + ticker := time.NewTicker(10 * time.Minute) + defer ticker.Stop() + + for range ticker.C { + r.mu.Lock() + now := time.Now() + expired := 0 + for id, s := range r.sessions { + if now.Sub(s.UpdatedAt) > time.Hour { + delete(r.sessions, id) + expired++ + } + } + r.mu.Unlock() + + if expired > 0 { + log.Printf("[Runner] 清理 %d 个过期会话", expired) + } + } +} + +// ======================================================================== +// 辅助方法 +// ======================================================================== + +// MaxKB 获取 MaxKB 客户端(供 Handler 直接调用知识库) +func (r *Runner) MaxKB() *tool.MaxKBClient { + return r.maxkb +} + +// GetAllSessions 获取所有会话(管理/调试用) +func (r *Runner) GetAllSessions() map[string]*Session { + r.mu.RLock() + defer r.mu.RUnlock() + sessions := make(map[string]*Session) + for k, v := range r.sessions { + sessions[k] = v + } + return sessions +} + +// UpdateSessionStatus 更新会话状态 +func (r *Runner) UpdateSessionStatus(id string, status string) error { + r.mu.Lock() + defer r.mu.Unlock() + session, ok := r.sessions[id] + if !ok { + return fmt.Errorf("[Runner] 会话不存在: %s", id) + } + session.Status = status + session.UpdatedAt = time.Now() + return nil +} + +// GetSessionHistory 获取会话对话历史 +func (r *Runner) GetSessionHistory(id string) ([]Message, error) { + r.mu.RLock() + defer r.mu.RUnlock() + session, ok := r.sessions[id] + if !ok { + return nil, fmt.Errorf("[Runner] 会话不存在: %s", id) + } + return session.History, nil +} + +// ListTools 列出所有已注册工具名称 +func (r *Runner) ListTools() []string { + r.mu.RLock() + defer r.mu.RUnlock() + names := make([]string, 0, len(r.tools)) + for name := range r.tools { + names = append(names, name) + } + return names +} + +// generateSessionID 生成唯一会话 ID +func generateSessionID() string { + return fmt.Sprintf("sess-%d-%s", time.Now().UnixNano(), randomSuffix(6)) +} + +// randomSuffix 生成 n 位 hex 随机后缀(用于会话 ID 防碰撞) +// +// 用 crypto/rand 保证多并发场景下的唯一性,比 math/rand 更安全 +func randomSuffix(n int) string { + if n <= 0 { + n = 6 + } + b := make([]byte, n/2+1) + if _, err := rand.Read(b); err != nil { + // 极端情况下 rand 失败,回落到时间戳末位,保证不阻塞业务 + return fmt.Sprintf("%x", time.Now().UnixNano()%0xffffff)[:n] + } + return fmt.Sprintf("%x", b)[:n] +} diff --git a/internal/agentcfg/agentcfg.go b/internal/agentcfg/agentcfg.go new file mode 100644 index 0000000..a1bba4b --- /dev/null +++ b/internal/agentcfg/agentcfg.go @@ -0,0 +1,409 @@ +package agentcfg + +// ======================================================================== +// agentcfg —— Agent 运行时配置加载器 +// ======================================================================== +// 职责: +// 从 z_xk 库的 xk_system_config 表读取 Agent 高级能力的开关与阈值, +// 包括 ReAct 循环、Token 预算、影子流量、A/B Test 等。 +// +// 为什么要单独一个包: +// 1. 业务上这些配置属于"AI 运营策略",PHP 后台运营人员会频繁修改, +// 必须支持动态生效(缓存 TTL 60s 即可,最长 1 分钟内全集群一致) +// 2. dao 包是纯数据访问层,不该承载业务配置语义; +// agent 包又怕引入循环依赖,所以新建独立 agentcfg 包 +// 3. 集中管理所有 AI 运营 key,避免散落各文件 +// +// 设计要点: +// - 复用 dao.DB(已在 main.go 启动时初始化),不重复建连接池 +// - 60s 内存缓存(与 dao.LoadLLMConfigsFromDB 同款 sync.RWMutex + cacheAt 模式) +// - 提供强类型 getter:GetReActConfig / GetTokenBudgetConfig / GetShadowConfig / GetABTestConfig +// - DB 不可用 / key 不存在时回落到安全默认值(不影响线上稳定性) +// ======================================================================== + +import ( + "fmt" + "log" + "strconv" + "strings" + "sync" + "time" + + "tcm-agent/internal/dao" +) + +// ------------------------------------------------------------------ +// 强类型配置结构 +// ------------------------------------------------------------------ + +// ReActConfig ReAct 多轮推理循环相关配置 +type ReActConfig struct { + Enabled bool // 总开关 + MaxIterations int // 单任务最多 Think-Act-Observe 轮数 + PlanningEnabled bool // 任务开始前是否让模型先出 Plan + ReflectionEnabled bool // 生成后是否做反思自检 + ReflectionTemperature float64 // 反思步骤温度(低于生成温度,结果更稳定) + JSONRepairEnabled bool // JSON 解析失败时是否让模型修复 + JSONRepairMaxRetries int // JSON 修复最多重试次数(防死循环) +} + +// TokenBudgetConfig Token 预算管理配置(双层控制) +type TokenBudgetConfig struct { + Enabled bool // 总开关 + PerRequest int // 单次 AI 任务总 token 上限(prompt+completion 累加) + MaxTokensPerCall int // 单次 LLM 调用输出 token 上限(透传厂商 max_tokens 字段) +} + +// ShadowConfig 影子流量配置(PHP 调用时透传,Go 端只读不写) +// +// 注意:影子流量的实际分发逻辑在 PHP AiMedicalAssistService 中实现, +// Go 端读取这个配置主要是为了在 EnhanceResponse 里标记本次调用是否来自影子链路 +type ShadowConfig struct { + Enabled bool // 总开关 + Ratio int // 影子流量百分比 0-100 +} + +// ABTestConfig A/B Test 配置 +type ABTestConfig struct { + Enabled bool // 总开关 + ExperimentRatio int // 实验组流量百分比 0-100(命中即走 provider=agent) +} + +// KBConfig 知识库源 + 检索相关配置 +// +// 设计:让运营在后台一键切换"走 MaxKB"还是"走本地知识库",无需改代码 +type KBConfig struct { + Source string // 知识库源:local(本地) / maxkb(MaxKB平台) + EmbeddingProvider string // 向量化 provider:noop(V1默认) / bge_m3 / aliyun / openai + EmbeddingAPIKey string // 向量化 API Key(V1 noop 不用) + TopK int // 检索返回条数(默认 5) + SimilarityThreshold float64 // 向量相似度阈值(V2 用,V1 不读) + SearchMode string // 检索模式:fulltext(V1默认) / vector(V2) / blend(V2) +} + +// MedicalGuardConfig 医疗相关性前置守卫配置 +// +// 业务背景:spark-lite 等轻量模型对长 prompt 角色定位能力弱, +// 如果 PHP 端组错 messages(或被滥用),Agent 会跑题输出"项目管理"等通用内容。 +// 本守卫在 Enhance 入口拦截非医疗请求,节省 token 并防止滥用。 +// +// 运维策略: +// - 默认开启(true),可在 xk_system_config 中关闭以兼容特殊场景 +// - 拦截后的请求会返回 error,PHP 端会得到 503/业务错误码 +type MedicalGuardConfig struct { + Enabled bool // 总开关(默认 true) +} + +// DebugConfig 调试日志配置 +// +// 业务背景:排查厂商 API 错误(如讯飞 10003 消息格式错误)时需要看完整请求体, +// 但请求体包含患者病历(PHI 隐私数据),生产环境不能常开。 +// +// 运维策略: +// - 默认关闭(false),排查问题时通过 xk_system_config 的 ai_agent_debug_log 临时打开 +// - 打开后 LLM 客户端会打印完整请求体(截断到 1500 字符) +// - 错误响应体日志不受本开关控制(始终打印,错误响应不含患者数据) +type DebugConfig struct { + LogRequestBody bool // 是否打印 LLM 请求体(含患者隐私,生产默认关闭) +} + +// AllConfig 全部 Agent 配置的聚合视图(一次性读出来传给 Enhancer) +type AllConfig struct { + ReAct ReActConfig + TokenBudget TokenBudgetConfig + Shadow ShadowConfig + ABTest ABTestConfig + KB KBConfig + MedicalGuard MedicalGuardConfig + Debug DebugConfig +} + +// ------------------------------------------------------------------ +// 默认值(DB 不可用 / key 不存在时回落) +// ------------------------------------------------------------------ +// +// 默认值策略:保守优先 +// - ReAct / Planning / Reflection:默认关(避免线上突然多轮调用拉高延迟和成本) +// - JSONRepair:默认开(成本低、显著提升可用性) +// - TokenBudget:默认开 + 单任务 8000(防止 Agent 死循环烧 token) +// - MaxTokensPerCall:默认 2048(单次响应足够,留出预算给后续轮次) +// - Shadow / ABTest:默认全关(流量实验必须显式开启) + +var defaultConfig = AllConfig{ + ReAct: ReActConfig{ + Enabled: false, + MaxIterations: 3, + PlanningEnabled: false, + ReflectionEnabled: false, + ReflectionTemperature: 0.2, + JSONRepairEnabled: true, + JSONRepairMaxRetries: 2, + }, + TokenBudget: TokenBudgetConfig{ + Enabled: true, + PerRequest: 8000, + MaxTokensPerCall: 2048, + }, + Shadow: ShadowConfig{ + Enabled: false, + Ratio: 0, + }, + ABTest: ABTestConfig{ + Enabled: false, + ExperimentRatio: 10, + }, + KB: KBConfig{ + Source: "local", // V1 默认本地(避免依赖 MaxKB Pro) + EmbeddingProvider: "noop", + EmbeddingAPIKey: "", + TopK: 5, + SimilarityThreshold: 0.5, + SearchMode: "fulltext", + }, + MedicalGuard: MedicalGuardConfig{ + // 默认开启:Go Agent 定位是医疗专用服务,非医疗请求直接拦截 + // 若特殊场景需要放行(如内部联调测试),可在 xk_system_config 里关闭 + Enabled: true, + }, + Debug: DebugConfig{ + // 默认关闭:请求体含患者隐私,只在排查厂商 API 错误时临时打开 + LogRequestBody: false, + }, +} + +// ------------------------------------------------------------------ +// 全局缓存(仿 dao 包 cfgCacheMutex 模式) +// ------------------------------------------------------------------ + +const ( + cacheTTL = 60 * time.Second // 缓存 60 秒,最长 1 分钟内全集群一致 +) + +var ( + cacheMu sync.RWMutex + cacheData *AllConfig + cacheAt time.Time +) + +// ------------------------------------------------------------------ +// 对外暴露的方法 +// ------------------------------------------------------------------ + +// Get 获取全部 Agent 配置(命中缓存直接返回,否则从 DB 重新加载) +// +// 调用方:EnhancerService.Enhance / ShadowJob 等 +func Get() *AllConfig { + cacheMu.RLock() + if cacheData != nil && time.Since(cacheAt) < cacheTTL { + out := *cacheData // 拷贝一份,避免调用方误改全局缓存 + cacheMu.RUnlock() + return &out + } + cacheMu.RUnlock() + + // 缓存未命中或已过期,加写锁重新加载(double-check 模式避免重复加载) + cacheMu.Lock() + defer cacheMu.Unlock() + if cacheData != nil && time.Since(cacheAt) < cacheTTL { + out := *cacheData + return &out + } + + loaded := loadFromDB() + cacheData = loaded + cacheAt = time.Now() + return loaded +} + +// Invalidate 主动失效缓存 +// +// 使用场景:PHP 后台改完配置后,可以调一个 admin/agent/invalidate-cache 接口 +// 让 Go 端立即重新读取(避免等 60s) +func Invalidate() { + cacheMu.Lock() + cacheData = nil + cacheAt = time.Time{} + cacheMu.Unlock() + log.Printf("[agentcfg] 缓存已主动失效") +} + +// GetReActConfig 便捷方法:只取 ReAct 配置 +func GetReActConfig() ReActConfig { return Get().ReAct } + +// GetTokenBudgetConfig 便捷方法:只取 Token 预算配置 +func GetTokenBudgetConfig() TokenBudgetConfig { return Get().TokenBudget } + +// GetShadowConfig 便捷方法:只取影子流量配置 +func GetShadowConfig() ShadowConfig { return Get().Shadow } + +// GetABTestConfig 便捷方法:只取 A/B Test 配置 +func GetABTestConfig() ABTestConfig { return Get().ABTest } + +// ------------------------------------------------------------------ +// 从 DB 加载实现 +// ------------------------------------------------------------------ + +// loadFromDB 从 xk_system_config 表读取所有 ai_xxx key 并装配成 AllConfig +// +// 容错策略: +// - dao.DB 未初始化 → 返回 defaultConfig(启动顺序问题不应让业务挂) +// - DB 查询失败 → 返回 defaultConfig + 打日志(DB 抖动不应阻断 AI 生成) +// - 单个 key 缺失或解析失败 → 用 defaultConfig 里对应字段的值(不影响其他 key) +func loadFromDB() *AllConfig { + cfg := defaultConfig // 拷贝默认值,逐字段覆盖 + + if dao.DB == nil { + log.Printf("[agentcfg] dao.DB 未初始化,回落默认配置") + return &cfg + } + + // 一次性查所有 ai_ 开头的配置项(避免多次往返 DB) + rows, err := fetchAIConfigRows() + if err != nil { + log.Printf("[agentcfg] 查询 xk_system_config 失败,回落默认配置: %v", err) + return &cfg + } + + // 逐 key 覆盖(缺失的 key 保持默认值,不报错) + applyKey(&cfg.ReAct.Enabled, rows, "ai_react_enabled", parseBool) + applyKey(&cfg.ReAct.MaxIterations, rows, "ai_react_max_iterations", parseInt) + applyKey(&cfg.ReAct.PlanningEnabled, rows, "ai_react_planning_enabled", parseBool) + applyKey(&cfg.ReAct.ReflectionEnabled, rows, "ai_react_reflection_enabled", parseBool) + applyKey(&cfg.ReAct.ReflectionTemperature, rows, "ai_react_reflection_temperature", parseFloat) + applyKey(&cfg.ReAct.JSONRepairEnabled, rows, "ai_react_json_repair_enabled", parseBool) + + applyKey(&cfg.TokenBudget.Enabled, rows, "ai_token_budget_enabled", parseBool) + applyKey(&cfg.TokenBudget.PerRequest, rows, "ai_token_budget_per_request", parseInt) + applyKey(&cfg.TokenBudget.MaxTokensPerCall, rows, "ai_token_max_per_call", parseInt) + + applyKey(&cfg.Shadow.Enabled, rows, "ai_shadow_traffic_enabled", parseBool) + applyKey(&cfg.Shadow.Ratio, rows, "ai_shadow_traffic_ratio", parseInt) + + applyKey(&cfg.ABTest.Enabled, rows, "ai_ab_test_enabled", parseBool) + applyKey(&cfg.ABTest.ExperimentRatio, rows, "ai_ab_test_experiment_ratio", parseInt) + + // KB 配置 + applyKey(&cfg.KB.Source, rows, "ai_kb_source", parseString) + applyKey(&cfg.KB.EmbeddingProvider, rows, "ai_kb_embedding_provider", parseString) + applyKey(&cfg.KB.EmbeddingAPIKey, rows, "ai_kb_embedding_api_key", parseString) + applyKey(&cfg.KB.TopK, rows, "ai_kb_top_k", parseInt) + applyKey(&cfg.KB.SimilarityThreshold, rows, "ai_kb_similarity_threshold", parseFloat) + applyKey(&cfg.KB.SearchMode, rows, "ai_kb_search_mode", parseString) + + // 医疗守卫:默认开启,运维可通过 ai_agent_medical_guard 关闭(联调/测试场景) + applyKey(&cfg.MedicalGuard.Enabled, rows, "ai_agent_medical_guard", parseBool) + + // 调试日志:默认关闭(请求体含患者隐私),排查厂商 API 错误时临时打开 + applyKey(&cfg.Debug.LogRequestBody, rows, "ai_agent_debug_log", parseBool) + + // 业务校验:MaxIterations 必须 >= 1,避免循环跑不起来 + if cfg.ReAct.Enabled && cfg.ReAct.MaxIterations < 1 { + cfg.ReAct.MaxIterations = 1 + } + // Ratio 必须 0-100 + if cfg.Shadow.Ratio < 0 { + cfg.Shadow.Ratio = 0 + } else if cfg.Shadow.Ratio > 100 { + cfg.Shadow.Ratio = 100 + } + if cfg.ABTest.ExperimentRatio < 0 { + cfg.ABTest.ExperimentRatio = 0 + } else if cfg.ABTest.ExperimentRatio > 100 { + cfg.ABTest.ExperimentRatio = 100 + } + // TokenBudget 上限必须 >= MaxTokensPerCall,否则单次调用就能撑爆预算 + if cfg.TokenBudget.Enabled && cfg.TokenBudget.PerRequest < cfg.TokenBudget.MaxTokensPerCall { + cfg.TokenBudget.PerRequest = cfg.TokenBudget.MaxTokensPerCall + } + // KB 配置容错:未知 source / mode 回落默认值 + if cfg.KB.Source != "local" && cfg.KB.Source != "maxkb" { + cfg.KB.Source = "local" + } + if cfg.KB.SearchMode != "fulltext" && cfg.KB.SearchMode != "vector" && cfg.KB.SearchMode != "blend" { + cfg.KB.SearchMode = "fulltext" + } + if cfg.KB.TopK <= 0 { + cfg.KB.TopK = 5 + } + + return &cfg +} + +// fetchAIConfigRows 一次性查所有 ai_ 开头的配置项,返回 map[key]value +// +// 为什么不用 dao.SystemConfigRow 单查每个 key: +// 一次 IN 查询只往返 1 次 DB,性能远好于按 key 逐个 First +func fetchAIConfigRows() (map[string]string, error) { + var rows []dao.SystemConfigRow + // 用 LIKE 一次拉所有 ai_ 前缀的 key(共 13 个,几乎不占带宽) + err := dao.DB. + Select("config_key, config_value"). + Where("config_key LIKE ?", "ai\\_%"). // _ 是 SQL 通配符,需转义 + Find(&rows).Error + if err != nil { + return nil, fmt.Errorf("query xk_system_config: %w", err) + } + + out := make(map[string]string, len(rows)) + for _, r := range rows { + out[r.ConfigKey] = r.ConfigValue + } + return out, nil +} + +// applyKey 通用的"按 key 从 map 取值并赋给目标字段"工具方法 +// +// 泛型 T 是目标字段类型(bool/int/float64); +// parser 负责把字符串值解析成 T,解析失败或 key 缺失时保持 *target 原值不变 +func applyKey[T any](target *T, rows map[string]string, key string, parser func(string) (T, bool)) { + if val, ok := rows[key]; ok { + if parsed, ok2 := parser(val); ok2 { + *target = parsed + } + } +} + +// ------------------------------------------------------------------ +// 字符串解析工具(与 PHP SystemConfigService::castValue 对齐) +// ------------------------------------------------------------------ + +// parseBool 解析 bool:与 PHP castValue 一致,接受 1/true/yes(不区分大小写) +func parseBool(s string) (bool, bool) { + switch strings.ToLower(strings.TrimSpace(s)) { + case "1", "true", "yes": + return true, true + case "0", "false", "no", "": + return false, true + } + return false, false +} + +// parseInt 解析 int:失败返回 (0, false) 让调用方保持原值 +func parseInt(s string) (int, bool) { + n, err := strconv.Atoi(strings.TrimSpace(s)) + if err != nil { + return 0, false + } + return n, true +} + +// parseFloat 解析 float64 +func parseFloat(s string) (float64, bool) { + f, err := strconv.ParseFloat(strings.TrimSpace(s), 64) + if err != nil { + return 0, false + } + return f, true +} + +// parseString 解析 string:去首尾空格;空串视为不存在(保持默认) +func parseString(s string) (string, bool) { + t := strings.TrimSpace(s) + if t == "" { + return "", false + } + return t, true +} + +// GetKBConfig 便捷方法:只取知识库配置 +func GetKBConfig() KBConfig { return Get().KB } diff --git a/internal/config/config.go b/internal/config/config.go new file mode 100644 index 0000000..360d95b --- /dev/null +++ b/internal/config/config.go @@ -0,0 +1,337 @@ +package config + +import ( + "os" + + "gopkg.in/yaml.v3" +) + +// ======================================================================== +// 配置模块 —— 支持多模型、多场景路由 +// ======================================================================== +// 核心设计: +// - LLM 配置从"单一模型"升级为"模型池" +// - 每个模型有独立名称、供应商、API Key、BaseURL、模型名 +// - 通过 Routes 映射"业务场景"到"具体模型" +// - 通过 FallbackChains 配置降级链 +// +// 配置优先级:环境变量 > config.yaml > 代码默认值 +// ======================================================================== + +// Config 全局配置结构体 +type Config struct { + Server ServerConfig `yaml:"server"` // HTTP 服务配置 + MaxKB MaxKBConfig `yaml:"maxkb"` // MaxKB 知识库配置 + LLM LLMConfig `yaml:"llm"` // 多模型 LLM 配置 + DB DBConfig `yaml:"db"` // 数据库配置 + Agent AgentConfig `yaml:"agent"` // Agent 引擎配置 + KB KBConfigYAML `yaml:"kb"` // 本地知识库配置(V1 用 noop,V2 接 BGE-M3) + Panel PanelConfig `yaml:"panel"` // 独立管理前端(/admin SPA)登录配置 +} + +// PanelConfig 独立管理前端的登录凭据配置 +// +// 为什么单独一组而不复用 KB.AdminPassword: +// - 旧面板走口令头(X-KB-Admin-Password),新前端走「账号+密码+验证码 → JWT」, +// 两套体系并存互不影响,凭据分开配置便于独立轮换 +// - 验证码是固定值(内网面板防脚本误触即可,不做图形码) +// +// 默认值在 Load() 里写死兜底,生产环境建议在 config.yaml 覆盖 +type PanelConfig struct { + Username string `yaml:"username"` // 登录账号 + Password string `yaml:"password"` // 登录密码 + Captcha string `yaml:"captcha"` // 固定验证码 +} + +// ServerConfig HTTP 服务器配置 +type ServerConfig struct { + Port string `yaml:"port"` // 监听端口 +} + +// MaxKBConfig MaxKB 知识库平台配置 +type MaxKBConfig struct { + BaseURL string `yaml:"base_url"` // MaxKB 服务地址 + APIKey string `yaml:"api_key"` // 应用 API Key + AppID string `yaml:"app_id"` // 知识库应用 ID +} + +// ======================================================================== +// LLM 多模型配置(核心升级点) +// ======================================================================== + +// LLMConfig 大语言模型总配置 +// +// 示例 YAML: +// +// llm: +// default_provider: "deepseek" # 默认供应商 +// models: +// deepseek: +// provider: "deepseek" +// api_key: "sk-xxx" +// base_url: "https://api.deepseek.com" +// model: "deepseek-chat" +// timeout: 120 +// openai: +// provider: "openai" +// api_key: "sk-xxx" +// base_url: "https://api.openai.com/v1" +// model: "gpt-4o" +// embedding_model: "text-embedding-3-small" +// timeout: 120 +// ollama: +// provider: "ollama" +// base_url: "http://localhost:11434" +// model: "qwen2.5:72b" +// timeout: 300 +// qwen: +// provider: "qwen" +// api_key: "sk-xxx" +// base_url: "https://dashscope.aliyuncs.com/compatible-mode/v1" +// model: "qwen-max" +// timeout: 120 +// routes: +// emr-generator: "deepseek" # 病历生成用 DeepSeek +// prescription: "openai" # 处方校验用 GPT-4o +// knowledge-qa: "qwen" # 知识问答用通义千问 +// embedding: "openai" # 向量化用 OpenAI +// fallback: "ollama" # 降级兜底用本地模型 +// fallback_chains: +// emr-generator: ["deepseek", "qwen", "ollama"] +// prescription: ["openai", "deepseek"] +type LLMConfig struct { + DefaultProvider string `yaml:"default_provider"` // 默认供应商名 + Models map[string]LLMConfigEx `yaml:"models"` // 模型池(名称→配置) + Routes map[string]string `yaml:"routes"` // 场景→模型路由 + FallbackChains map[string][]string `yaml:"fallback_chains"` // 降级链 +} + +// LLMConfigEx 单个模型的扩展配置 +// +// 在基础配置上增加了 Extra 字段,用于存放各供应商特有的参数 +// (如 Azure 的 deployment/api_version,Ollama 的 num_ctx 等) +type LLMConfigEx struct { + Provider string `yaml:"provider"` // 供应商类型:deepseek/openai/azure/ollama/qwen + APIKey string `yaml:"api_key"` // API 密钥 + BaseURL string `yaml:"base_url"` // API 地址 + Model string `yaml:"model"` // 模型名称 + EmbeddingModel string `yaml:"embedding_model"` // Embedding 模型(可选) + Timeout int `yaml:"timeout"` // 超时(秒) + Extra map[string]string `yaml:"extra"` // 供应商特有参数 +} + +// DBConfig 数据库配置 +type DBConfig struct { + DSN string `yaml:"dsn"` // z_xk 库连接串 + EncryptKey string `yaml:"encrypt_key"` // AES 加密主密钥(与 PHP .env ENCRYPT_KEY 同源) +} + +// AgentConfig Agent 引擎配置 +// +// 字段分两组: +// - 引擎行为:MaxIterations(ReAct 最大轮数)/ Timeout(单次调用超时秒数) +// - 服务鉴权:SharedSecret / JWTSecret(middleware.Auth 读取) +// +// 鉴权双轨制(与 PHP 后台 ai_agent_secret 对接): +// - SharedSecret:简单字符串密钥,运维在 PHP 后台填一个值即可 +// PHP TcmAgentClient 把同样的字符串塞进 Authorization: Bearer xxx, +// Go 端 middleware.Auth 拿到后直接 == 比对,无需签发 JWT +// - JWTSecret:严格 HS256 签名校验,适合需要解析 user_id/role 的场景 +// (如小程序直连 Agent);留空则禁用 JWT 路径,仅比对 SharedSecret +// +// middleware.Auth 校验顺序:JWT 先试 → SharedSecret 比对 → 默认密钥(开发模式) +type AgentConfig struct { + MaxIterations int `yaml:"max_iterations"` // Agent 最大推理轮数 + Timeout int `yaml:"timeout"` // 单次调用超时(秒) + SharedSecret string `yaml:"shared_secret"` // 共享密钥(与 PHP 后台 ai_agent_secret 对应;空则放行无 Token 请求) + JWTSecret string `yaml:"jwt_secret"` // JWT 签名密钥(留空则禁用 JWT 路径,仅启用 SharedSecret) +} + +// KBConfigYAML 本地知识库的 YAML 配置(兜底用) +// +// 注意:V1 实际开关在 xk_system_config 表里(agentcfg 包加载), +// 这里只是兜底——DB 不可用或 key 缺失时回落到这些值。 +// +// V2 接入 BGE-M3 时建议在 yaml 里配 api_key(避免明文入 DB)。 +type KBConfigYAML struct { + EmbeddingProvider string `yaml:"embedding_provider"` // 向量化 provider:noop / bge_m3 / aliyun / openai + EmbeddingAPIKey string `yaml:"embedding_api_key"` // embedding API Key(V2 接 BGE-M3 时填) + EmbeddingBaseURL string `yaml:"embedding_base_url"` // embedding 服务地址(如本地部署的 BGE-M3 HTTP 服务) + EmbeddingModel string `yaml:"embedding_model"` // embedding 模型名(如 bge-m3) + AdminPassword string `yaml:"admin_password"` // /kb/view 后台访问口令(HTTP Basic Auth 密码) +} + +// ======================================================================== +// 接口实现(供 agent.Runner 的 InitRunner 使用) +// ======================================================================== +// +// Runner 通过接口(而非具体类型)获取配置,实现解耦。 +// 这样 testing 时可以用 mock 配置替换。 + +// GetMaxKB 返回 MaxKB 配置(实现 MaxKBConfigGetter 接口) +func (c *Config) GetMaxKB() MaxKBConfigGetter { + return &maxKBWrapper{c.MaxKB} +} + +// GetAgent 返回 Agent 配置(实现 AgentConfigGetter 接口) +func (c *Config) GetAgent() AgentConfigGetter { + return &agentCfgWrapper{c.Agent} +} + +// MaxKBConfigGetter MaxKB 配置读取接口 +type MaxKBConfigGetter interface { + GetBaseURL() string + GetAPIKey() string + GetAppID() string +} + +// AgentConfigGetter Agent 配置读取接口 +type AgentConfigGetter interface { + GetMaxIterations() int + GetTimeout() int +} + +// maxKBWrapper 包装 MaxKBConfig 实现接口 +type maxKBWrapper struct{ cfg MaxKBConfig } + +func (w *maxKBWrapper) GetBaseURL() string { return w.cfg.BaseURL } +func (w *maxKBWrapper) GetAPIKey() string { return w.cfg.APIKey } +func (w *maxKBWrapper) GetAppID() string { return w.cfg.AppID } + +// agentCfgWrapper 包装 AgentConfig 实现接口 +type agentCfgWrapper struct{ cfg AgentConfig } + +func (w *agentCfgWrapper) GetMaxIterations() int { return w.cfg.MaxIterations } +func (w *agentCfgWrapper) GetTimeout() int { return w.cfg.Timeout } + +// ======================================================================== +// 配置加载 +// ======================================================================== + +// Load 加载配置文件 +// +// 加载顺序(后者覆盖前者): +// 1. 代码内置默认值 +// 2. manifest/config/config.yaml 文件 +// 3. 环境变量(容器化部署时常用) +// +// 环境变量映射: +// SERVER_PORT → server.port +// MAXKB_API_KEY → maxkb.api_key +// LLM_API_KEY → 所有模型的 api_key(通用覆盖) +// DEEPSEEK_API_KEY → 仅覆盖 deepseek 模型 +// OPENAI_API_KEY → 仅覆盖 openai 模型 +// QWEN_API_KEY → 仅覆盖 qwen 模型 +// AZURE_API_KEY → 仅覆盖 azure 模型 +// OLLAMA_URL → 仅覆盖 ollama 的 base_url +func Load() *Config { + cfg := &Config{ + // 默认值 + Server: ServerConfig{Port: "8080"}, + Agent: AgentConfig{MaxIterations: 10, Timeout: 120}, + // 管理前端登录默认凭据(生产环境在 config.yaml 的 panel 段覆盖) + Panel: PanelConfig{Username: "liqi", Password: "qiqi991012", Captcha: "999999"}, + LLM: LLMConfig{ + DefaultProvider: "deepseek", + Models: map[string]LLMConfigEx{ + "deepseek": { + Provider: "deepseek", + BaseURL: "https://api.deepseek.com", + Model: "deepseek-chat", + Timeout: 120, + }, + }, + Routes: map[string]string{ + // PHP TcmAgentClient 透传的业务场景名(必须能命中,否则会走默认 provider) + "medical_record": "deepseek", // 病历生成(PHP 业务侧叫 medical_record) + "prescription": "deepseek", // 处方生成 + // Go 内部兼容名(Go 自己的 /api/v1/emr/generate 等端点用 emr-generator) + "emr-generator": "deepseek", + "knowledge-qa": "deepseek", + "embedding": "deepseek", + }, + }, + } + + // 尝试读取 YAML 配置文件 + data, err := os.ReadFile("manifest/config/config.yaml") + if err == nil { + yaml.Unmarshal(data, cfg) + } + + // 环境变量覆盖(优先级最高) + applyEnvOverrides(cfg) + + return cfg +} + +// applyEnvOverrides 用环境变量覆盖配置 +func applyEnvOverrides(cfg *Config) { + // Server + if port := os.Getenv("SERVER_PORT"); port != "" { + cfg.Server.Port = port + } + + // MaxKB + if key := os.Getenv("MAXKB_API_KEY"); key != "" { + cfg.MaxKB.APIKey = key + } + if url := os.Getenv("MAXKB_BASE_URL"); url != "" { + cfg.MaxKB.BaseURL = url + } + + // 通用 LLM Key(覆盖所有模型) + if key := os.Getenv("LLM_API_KEY"); key != "" { + // 注意:Go 中 map 元素不可寻址,必须先取出副本改完再写回 + for name, m := range cfg.LLM.Models { + m.APIKey = key + cfg.LLM.Models[name] = m + } + } + + // 按供应商分别覆盖 + envMap := map[string]string{ + "DEEPSEEK_API_KEY": "deepseek", + "OPENAI_API_KEY": "openai", + "AZURE_API_KEY": "azure", + "QWEN_API_KEY": "qwen", + } + urlMap := map[string]string{ + "OLLAMA_URL": "ollama", + } + + for envKey, modelName := range envMap { + if val := os.Getenv(envKey); val != "" { + if m, ok := cfg.LLM.Models[modelName]; ok { + m.APIKey = val + cfg.LLM.Models[modelName] = m + } + } + } + for envKey, modelName := range urlMap { + if val := os.Getenv(envKey); val != "" { + if m, ok := cfg.LLM.Models[modelName]; ok { + m.BaseURL = val + cfg.LLM.Models[modelName] = m + } + } + } + + // 数据库 + if dsn := os.Getenv("DB_DSN"); dsn != "" { + cfg.DB.DSN = dsn + } + // AES 主密钥(与 PHP .env ENCRYPT_KEY 同源,用于解密 xk_ai_api_key.api_key) + if key := os.Getenv("ENCRYPT_KEY"); key != "" { + cfg.DB.EncryptKey = key + } + + // Agent 鉴权(与 PHP 后台 ai_agent_secret 对接) + // 优先级:环境变量 > config.yaml > 空(开发模式放行无 Token 请求) + if secret := os.Getenv("AGENT_SHARED_SECRET"); secret != "" { + cfg.Agent.SharedSecret = secret + } + if jwtSecret := os.Getenv("AGENT_JWT_SECRET"); jwtSecret != "" { + cfg.Agent.JWTSecret = jwtSecret + } +} diff --git a/internal/crawler/crawler.go b/internal/crawler/crawler.go new file mode 100644 index 0000000..96e16e3 --- /dev/null +++ b/internal/crawler/crawler.go @@ -0,0 +1,191 @@ +package crawler + +import ( + "context" + "fmt" + "io" + "net/http" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/text/encoding/simplifiedchinese" +) + +// ======================================================================== +// crawler —— 中药药材抓取框架 +// ======================================================================== +// 职责: +// - 定义抓取源接口(Source)与药材结构(Medicine) +// - 提供源注册表:新增抓取源只需实现 Source 并在 init 注册 +// - 提供通用 HTTP 抓取 / 编码转换 / HTML 清洗工具 +// +// 设计要点: +// - 抓取是"礼貌抓取":全局限速(默认 600ms/请求)、明确 UA、超时兜底, +// 避免给源站造成压力 +// - 编码自适应:先验 UTF-8,不合法则按 GB18030 解(GB2312/GBK 的超集), +// 国内中医药老站基本都是 GB 系编码 +// ======================================================================== + +// Medicine 一味药材的解析结果 +type Medicine struct { + Name string // 药名(如"白果") + Pinyin string // 拼音(如"baiguo",可空) + Aliases []string // 别名列表(如 银杏核、公孙树子) + Sections []Section // 有序的标记段落(性味归经/功效与作用/...) + SourceURL string // 详情页地址(溯源) +} + +// Section 详情页中的一个【标记】段落 +type Section struct { + Label string // 标记名(不含【】,如"性味归经") + Text string // 段落正文 +} + +// GetSection 按标记名取段落正文(没有返回空串) +func (m *Medicine) GetSection(label string) string { + for _, s := range m.Sections { + if s.Label == label { + return s.Text + } + } + return "" +} + +// Source 抓取源接口 +// +// 实现者要求: +// - FetchIndex 返回全量详情页 URL(有序、去重),调用方按游标切片实现断点续抓 +// - FetchDetail 抓取并解析单个详情页 +type Source interface { + // Name 源标识(存 DB 的 source 字段,如 zhongyoo) + Name() string + // Label 源中文名(面板展示,如 中药查询网) + Label() string + // FetchIndex 抓取索引页,返回全部详情页 URL + FetchIndex(ctx context.Context) ([]string, error) + // FetchDetail 抓取并解析单个药材详情页 + FetchDetail(ctx context.Context, url string) (*Medicine, error) +} + +// ---------------------------- 源注册表 ---------------------------- + +// sources 已注册的抓取源(init 时注册,运行期只读,无需加锁) +var sources = map[string]Source{} + +// register 注册一个抓取源(各源文件 init 里调用) +func register(s Source) { sources[s.Name()] = s } + +// GetSource 按标识取抓取源 +func GetSource(name string) (Source, bool) { + s, ok := sources[name] + return s, ok +} + +// ListSources 列出所有可用源(面板下拉框用) +// +// 按 name 排序:map 遍历顺序随机,不排序会导致前端下拉每次刷新顺序乱跳 +func ListSources() []map[string]string { + out := make([]map[string]string, 0, len(sources)) + for _, s := range sources { + out = append(out, map[string]string{"name": s.Name(), "label": s.Label()}) + } + sort.Slice(out, func(i, j int) bool { return out[i]["name"] < out[j]["name"] }) + return out +} + +// ---------------------------- 通用抓取工具 ---------------------------- + +// crawlUA 统一 User-Agent(表明普通浏览器身份,部分站点拒绝空 UA) +const crawlUA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36" + +// httpClient 抓取共用客户端:15s 超时(详情页都很小,够用) +var httpClient = &http.Client{Timeout: 15 * time.Second} + +// fetchBytes 抓取一个 URL 的原始字节(带一次重试,容忍瞬时网络抖动) +func fetchBytes(ctx context.Context, url string) ([]byte, error) { + var lastErr error + for attempt := 0; attempt < 2; attempt++ { + if attempt > 0 { + // 重试前稍等,避开瞬时抖动 + select { + case <-time.After(1 * time.Second): + case <-ctx.Done(): + return nil, ctx.Err() + } + } + req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) + if err != nil { + return nil, err + } + req.Header.Set("User-Agent", crawlUA) + resp, err := httpClient.Do(req) + if err != nil { + lastErr = err + continue + } + body, err := io.ReadAll(io.LimitReader(resp.Body, 2<<20)) // 单页最大 2MB 防异常 + resp.Body.Close() + if err != nil { + lastErr = err + continue + } + if resp.StatusCode != http.StatusOK { + lastErr = fmt.Errorf("HTTP %d", resp.StatusCode) + continue + } + return body, nil + } + return nil, fmt.Errorf("抓取失败 %s: %w", url, lastErr) +} + +// decodeGBAware 编码自适应解码:合法 UTF-8 原样返回,否则按 GB18030 解码 +func decodeGBAware(data []byte) string { + if utf8.Valid(data) { + return string(data) + } + decoded, err := simplifiedchinese.GB18030.NewDecoder().Bytes(data) + if err != nil { + // 解码失败兜底:按原字节返回(后续正则匹配不到会自然报"解析失败") + return string(data) + } + return string(decoded) +} + +// 预编译的 HTML 清洗正则(包级复用,避免每次抓取重复编译) +var ( + reScript = regexp.MustCompile(`(?is)`) + reStyle = regexp.MustCompile(`(?is)`) + reBlockEnd = regexp.MustCompile(`(?i)|]*>`) + reTag = regexp.MustCompile(`<[^>]+>`) + reBlank = regexp.MustCompile(`\n{3,}`) +) + +// htmlToText 把 HTML 清洗成保留段落结构的纯文本 +// +// 步骤:去 script/style → 块级闭合标签转换行 → 去所有标签 → 反转义实体 → 压缩空行 +func htmlToText(html string) string { + s := reScript.ReplaceAllString(html, "") + s = reStyle.ReplaceAllString(s, "") + s = reBlockEnd.ReplaceAllString(s, "\n") + s = reTag.ReplaceAllString(s, "") + s = htmlUnescape(s) + // 逐行 trim,去掉行内残留空白 + lines := strings.Split(s, "\n") + for i := range lines { + lines[i] = strings.TrimSpace(lines[i]) + } + s = strings.Join(lines, "\n") + return strings.TrimSpace(reBlank.ReplaceAllString(s, "\n\n")) +} + +// htmlUnescape 反转义常见 HTML 实体(够用即可,不引 html 包避免全量实体表开销) +func htmlUnescape(s string) string { + r := strings.NewReplacer( + " ", " ", "&", "&", "<", "<", ">", ">", + """, `"`, "'", "'", "“", "“", "”", "”", + ) + return r.Replace(s) +} diff --git a/internal/crawler/zhongyoo.go b/internal/crawler/zhongyoo.go new file mode 100644 index 0000000..fb498eb --- /dev/null +++ b/internal/crawler/zhongyoo.go @@ -0,0 +1,204 @@ +package crawler + +import ( + "context" + "fmt" + "regexp" + "strconv" + "strings" + "time" +) + +// ======================================================================== +// zhongyoo —— 中药查询网(www.zhongyoo.com)抓取源 +// ======================================================================== +// 站点结构(2026-08 实测): +// - 索引页:/name/(第 1 页)、/name/page_{N}.html(第 2 页起), +// 页脚有「共 45页899条」可解析总页数 +// - 详情页:/name/{拼音}_{id}.html,正文为标记式结构: +// 【中药名】白果 baiguo +// 【别名】银杏核、公孙树子、鸭脚树子。 +// 【性味归经】性平,味甘、苦、涩。归肺经、肾经。 +// 【功效与作用】敛肺定喘、止带浊、缩小便。... +// 这种「标记 + 正文」结构非常稳定,正则解析即可,不依赖 DOM 层级 +// - 编码:GB2312(decodeGBAware 自动处理) +// +// 礼貌抓取:每个请求间隔 600ms,索引页间隔 300ms +// ======================================================================== + +// zhongyooSource 中药查询网抓取源 +type zhongyooSource struct{} + +// init 注册到源注册表 +func init() { register(&zhongyooSource{}) } + +// Name 源标识 +func (z *zhongyooSource) Name() string { return "zhongyoo" } + +// Label 源中文名 +func (z *zhongyooSource) Label() string { return "中药查询网(zhongyoo.com,约899味)" } + +// zhongyoo 站点常量与解析正则 +const ( + zyBase = "http://www.zhongyoo.com" + zyIndexURL = zyBase + "/name/" + zyMaxPages = 60 // 总页数解析失败时的保险上限(当前实际 45 页) + zyDetailGap = 600 * time.Millisecond + zyIndexGap = 300 * time.Millisecond +) + +var ( + // 详情链接:兼容绝对/相对两种写法;拼音段允许下划线 + // (实测存在 luo__5947.html 这类双下划线链接,字符类漏掉 _ 会丢药材) + reZyDetail = regexp.MustCompile(`href="(?:http://www\.zhongyoo\.com)?(/name/[a-z0-9_]+_\d+\.html)"`) + // 总页数:页脚「共 45页899条」 + reZyPages = regexp.MustCompile(`共\s*(\d+)\s*页`) + // 段落标记:【标签】(Go RE2 不支持前瞻,正文靠相邻标记位置切片提取) + reZyMarker = regexp.MustCompile(`【([^】]{1,20})】`) + // 详情页 :固定格式「药名_药名的功效与作用 - 中药查询」, + // 取第一个 _ 或 - 之前的部分作为药名兜底 + reZyTitle = regexp.MustCompile(`<title>([^<_-]+)`) +) + +// FetchIndex 抓取全部索引页,返回详情页 URL 列表(有序去重) +// +// 为什么每次全量抓索引:索引页只有 45 个、体积小(每页 ~25KB), +// 全量抓一遍 <20s;换来的是断点游标始终基于同一份有序列表,逻辑简单可靠 +func (z *zhongyooSource) FetchIndex(ctx context.Context) ([]string, error) { + first, err := fetchBytes(ctx, zyIndexURL) + if err != nil { + return nil, fmt.Errorf("索引首页抓取失败: %w", err) + } + html := decodeGBAware(first) + + // 解析总页数(失败用保险上限,靠 404 终止) + totalPages := zyMaxPages + if m := reZyPages.FindStringSubmatch(html); len(m) == 2 { + if n, err := strconv.Atoi(m[1]); err == nil && n > 0 && n <= zyMaxPages { + totalPages = n + } + } + + seen := map[string]bool{} + var urls []string + collect := func(pageHTML string) { + for _, m := range reZyDetail.FindAllStringSubmatch(pageHTML, -1) { + u := zyBase + m[1] + if !seen[u] { + seen[u] = true + urls = append(urls, u) + } + } + } + collect(html) + + for p := 2; p <= totalPages; p++ { + select { + case <-time.After(zyIndexGap): + case <-ctx.Done(): + return nil, ctx.Err() + } + body, err := fetchBytes(ctx, fmt.Sprintf("%s/name/page_%d.html", zyBase, p)) + if err != nil { + // 单页失败不中断(可能是尾页变动),跳过继续 + continue + } + collect(decodeGBAware(body)) + } + if len(urls) == 0 { + return nil, fmt.Errorf("索引页未解析到任何详情链接(站点结构可能已变更)") + } + return urls, nil +} + +// FetchDetail 抓取并解析单个药材详情页 +func (z *zhongyooSource) FetchDetail(ctx context.Context, url string) (*Medicine, error) { + // 礼貌限速:详情页抓取前统一等待 + select { + case <-time.After(zyDetailGap): + case <-ctx.Done(): + return nil, ctx.Err() + } + + body, err := fetchBytes(ctx, url) + if err != nil { + return nil, err + } + html := decodeGBAware(body) + text := htmlToText(html) + + // 定位所有【标记】,正文 = 本标记结束位置 到 下一个标记开始位置 + // (RE2 不支持前瞻断言,用位置切片等价实现) + locs := reZyMarker.FindAllStringSubmatchIndex(text, -1) + med := &Medicine{SourceURL: url} + for i, loc := range locs { + label := strings.TrimSpace(text[loc[2]:loc[3]]) + end := len(text) + if i+1 < len(locs) { + end = locs[i+1][0] + } + content := strings.TrimSpace(text[loc[1]:end]) + if label == "" || content == "" { + continue + } + switch label { + case "中药名", "药名", "正名": + // 源站存在三代版式:新版【中药名】、老版【药名】、更老的【正名】,全部兼容 + // 格式:"白果 baiguo" → 药名 + 拼音(老版可能没有拼音) + parts := strings.Fields(content) + if len(parts) > 0 { + med.Name = cleanMedicineName(parts[0]) + } + if len(parts) > 1 { + med.Pinyin = parts[1] + } + case "别名": + med.Aliases = splitAliases(content) + default: + med.Sections = append(med.Sections, Section{Label: label, Text: content}) + } + } + + if med.Name == "" { + // 兜底:正文标签一个都没匹配到药名时,从 <title> 提取 + // (标题格式全站统一,比正文版式稳定得多,防止未来出现第四种标签变体丢数据) + if m := reZyTitle.FindStringSubmatch(html); len(m) == 2 { + if name := cleanMedicineName(m[1]); name != "" && len([]rune(name)) <= 20 { + med.Name = name + } + } + } + if med.Name == "" { + return nil, fmt.Errorf("详情页未解析到药名(%s)", url) + } + return med, nil +} + +// cleanMedicineName 清洗药名:去首尾空白与尾随标点 +// +// 为什么必须清洗:药名是知识库 upsert 的判重键(doc.title), +// 老版式正文可能写成"广东合欢花。"——尾随句号会让同一味药判成两个文档 +func cleanMedicineName(s string) string { + return strings.Trim(strings.TrimSpace(s), "。,、;..·,;") +} + +// splitAliases 拆分别名串:"银杏核、公孙树子、鸭脚树子。" → [银杏核 公孙树子 鸭脚树子] +// +// 兼容 、 , , ; ; 多种分隔符,去掉句尾句号和空项 +func splitAliases(s string) []string { + s = strings.TrimSuffix(strings.TrimSpace(s), "。") + fields := strings.FieldsFunc(s, func(r rune) bool { + switch r { + case '、', ',', ',', ';', ';': + return true + } + return false + }) + out := make([]string, 0, len(fields)) + for _, f := range fields { + if v := strings.TrimSpace(f); v != "" { + out = append(out, v) + } + } + return out +} diff --git a/internal/dao/ai_generation_dao.go b/internal/dao/ai_generation_dao.go new file mode 100644 index 0000000..3492b5a --- /dev/null +++ b/internal/dao/ai_generation_dao.go @@ -0,0 +1,174 @@ +package dao + +import ( + "errors" + "fmt" +) + +// ======================================================================== +// AI 生成历史 DAO —— 只读查询 xk_ai_generation / xk_ai_generation_step +// ======================================================================== +// 背景:Go 内存环形缓冲只保留最近 200 条运行且重启清零; +// PHP 侧每次生成都落库这两张表(权威审计数据)。 +// 管理前端的「历史记录」页通过这里补齐长期视角。 +// +// 边界:只读。写入方是 PHP(AiGenerationService / AiGenerationStepService), +// Go 端绝不写这两张表,避免双写方打架。 +// ======================================================================== + +// AIGenerationRow xk_ai_generation 行(列表 + 详情共用) +// +// input_snapshot / result_json 是 MySQL JSON 列,扫进 string 由前端解析展示, +// Go 端不需要理解其结构(各场景结构不同) +type AIGenerationRow struct { + ID uint `gorm:"column:id" json:"id"` + StoreID int `gorm:"column:store_id" json:"store_id"` + RegisterID int `gorm:"column:register_id" json:"register_id"` + DoctorID int `gorm:"column:doctor_id" json:"doctor_id"` + Scene string `gorm:"column:scene" json:"scene"` + PrescriptionType int `gorm:"column:prescription_type" json:"prescription_type"` + Name string `gorm:"column:name" json:"name"` + Provider string `gorm:"column:provider" json:"provider"` + Model string `gorm:"column:model" json:"model"` + Status int `gorm:"column:status" json:"status"` // 0进行中1成功2失败 + APIKeyID int `gorm:"column:api_key_id" json:"api_key_id"` + ViaAgent int `gorm:"column:via_agent" json:"via_agent"` + StepCount int `gorm:"column:step_count" json:"step_count"` + PromptTokens int `gorm:"column:prompt_tokens" json:"prompt_tokens"` + CompletionTokens int `gorm:"column:completion_tokens" json:"completion_tokens"` + TotalTokens int `gorm:"column:total_tokens" json:"total_tokens"` + StartedAt int `gorm:"column:started_at" json:"started_at"` + FinishedAt int `gorm:"column:finished_at" json:"finished_at"` + DurationMs int `gorm:"column:duration_ms" json:"duration_ms"` + ErrorMsg string `gorm:"column:error_msg" json:"error_msg"` + InputSnapshot string `gorm:"column:input_snapshot" json:"input_snapshot,omitempty"` + ResultJSON string `gorm:"column:result_json" json:"result_json,omitempty"` + CreatedAt int `gorm:"column:created_at" json:"created_at"` +} + +// TableName 指定表名 +func (AIGenerationRow) TableName() string { return "xk_ai_generation" } + +// AIGenerationStepRow xk_ai_generation_step 行(详情页时间线数据源) +type AIGenerationStepRow struct { + ID uint `gorm:"column:id" json:"id"` + GenerationID uint `gorm:"column:generation_id" json:"generation_id"` + StepNo int `gorm:"column:step_no" json:"step_no"` + StepType string `gorm:"column:step_type" json:"step_type"` + ToolName string `gorm:"column:tool_name" json:"tool_name"` + Provider string `gorm:"column:provider" json:"provider"` + Model string `gorm:"column:model" json:"model"` + APIKeyID int `gorm:"column:api_key_id" json:"api_key_id"` + PromptTokens int `gorm:"column:prompt_tokens" json:"prompt_tokens"` + CompletionTokens int `gorm:"column:completion_tokens" json:"completion_tokens"` + TotalTokens int `gorm:"column:total_tokens" json:"total_tokens"` + UsageJSON string `gorm:"column:usage_json" json:"usage_json,omitempty"` + DurationMs int `gorm:"column:duration_ms" json:"duration_ms"` + StartedAt int `gorm:"column:started_at" json:"started_at"` + FinishedAt int `gorm:"column:finished_at" json:"finished_at"` + Status int `gorm:"column:status" json:"status"` // 0进行中1成功2失败 + Detail string `gorm:"column:detail" json:"detail"` +} + +// TableName 指定表名 +func (AIGenerationStepRow) TableName() string { return "xk_ai_generation_step" } + +// AIGenerationListFilter 历史列表的筛选条件 +// +// Status / ViaAgent 用 -1 表示"不筛选"(0 是合法业务值,不能当哨兵) +type AIGenerationListFilter struct { + Page int // 页码(从 1 开始) + Size int // 每页条数(1~100) + Scene string // 场景精确匹配,空=全部 + Status int // -1=全部 0进行中 1成功 2失败 + ViaAgent int // -1=全部 0=PHP直连 1=Go Agent + Provider string // 供应商精确匹配,空=全部 + DateStart int64 // created_at >= 起始时间戳,0=不限 + DateEnd int64 // created_at <= 截止时间戳,0=不限 +} + +// AIGenerationList 分页查询生成历史(倒序) +// +// 列表不查 input_snapshot / result_json 两个 JSON 大字段(省带宽), +// 详情接口才返回完整内容 +func AIGenerationList(f AIGenerationListFilter) ([]AIGenerationRow, int64, error) { + if DB == nil { + return nil, 0, errors.New("dao: DB 未初始化") + } + if f.Page < 1 { + f.Page = 1 + } + if f.Size < 1 || f.Size > 100 { + f.Size = 20 + } + + q := DB.Model(&AIGenerationRow{}).Where("deleted_at = 0") + if f.Scene != "" { + q = q.Where("scene = ?", f.Scene) + } + if f.Status >= 0 { + q = q.Where("status = ?", f.Status) + } + if f.ViaAgent >= 0 { + q = q.Where("via_agent = ?", f.ViaAgent) + } + if f.Provider != "" { + q = q.Where("provider = ?", f.Provider) + } + if f.DateStart > 0 { + q = q.Where("created_at >= ?", f.DateStart) + } + if f.DateEnd > 0 { + q = q.Where("created_at <= ?", f.DateEnd) + } + + var total int64 + if err := q.Count(&total).Error; err != nil { + return nil, 0, fmt.Errorf("dao: 查询历史总数失败: %w", err) + } + + var rows []AIGenerationRow + err := q.Select("id, store_id, register_id, doctor_id, scene, prescription_type, name, provider, model, status, api_key_id, via_agent, step_count, prompt_tokens, completion_tokens, total_tokens, started_at, finished_at, duration_ms, error_msg, created_at"). + Order("id DESC"). + Offset((f.Page - 1) * f.Size). + Limit(f.Size). + Find(&rows).Error + if err != nil { + return nil, 0, fmt.Errorf("dao: 查询历史列表失败: %w", err) + } + return rows, total, nil +} + +// AIGenerationGet 取单条历史详情 + 全部步骤 +func AIGenerationGet(id uint) (*AIGenerationRow, []AIGenerationStepRow, error) { + if DB == nil { + return nil, nil, errors.New("dao: DB 未初始化") + } + var row AIGenerationRow + if err := DB.Where("id = ? AND deleted_at = 0", id).First(&row).Error; err != nil { + return nil, nil, fmt.Errorf("dao: 历史记录不存在 id=%d: %w", id, err) + } + var steps []AIGenerationStepRow + if err := DB.Where("generation_id = ? AND deleted_at = 0", id). + Order("step_no ASC"). + Find(&steps).Error; err != nil { + return nil, nil, fmt.Errorf("dao: 查询步骤明细失败: %w", err) + } + return &row, steps, nil +} + +// AIGenerationScenes 列出历史里出现过的全部场景(前端筛选下拉用) +func AIGenerationScenes() ([]string, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var scenes []string + err := DB.Model(&AIGenerationRow{}). + Where("deleted_at = 0"). + Distinct(). + Pluck("scene", &scenes).Error + if err != nil { + return nil, fmt.Errorf("dao: 查询场景列表失败: %w", err) + } + return scenes, nil +} diff --git a/internal/dao/dao.go b/internal/dao/dao.go new file mode 100644 index 0000000..b4d4220 --- /dev/null +++ b/internal/dao/dao.go @@ -0,0 +1,567 @@ +package dao + +import ( + "errors" + "fmt" + "log" + "strings" + "sync" + "time" + + "tcm-agent/internal/security/xkaes" + + "gorm.io/driver/mysql" + "gorm.io/gorm" + "gorm.io/gorm/logger" +) + +// ======================================================================== +// 数据访问层(DAO) +// ======================================================================== +// 本层负责直连萧康云医的 z_xk 库,按 PHP 端 AiRuntimeConfigService 的 +// 完全一致规则,读取"当前激活平台/模型/API Key",并装配成 Go LLM 层 +// 期望的 map[provider]LLMConfigEx 结构。 +// +// 为什么不让 PHP 把配置推过来? +// - 单一可信源:DB 已经是配置中心,Go 直接读库避免双写不一致 +// - 解耦:Go Agent 可独立部署,不依赖 PHP 进程在线 +// - 实时性:DB 改完 1 分钟(TTL)内全集群生效 +// +// 数据来源(z_xk 库): +// - xk_system_config:3 个 AI 配置键(当前激活的平台/密钥/模型) +// - xk_ai_platform:平台表(code → api_url) +// - xk_ai_model:模型表(platform_id → 默认模型 code) +// - xk_ai_api_key:密钥表(密文 api_key,需 AES-256-CBC 解密) +// ======================================================================== + +// DB 全局数据库连接句柄(Init 后非空) +var DB *gorm.DB + +// 全局缓存:DB 读到的 LLM 配置 + 失效时间(TTL 60s) +// +// 为什么需要缓存? +// 每次外部请求都查 4 张表会有额外 RTT;AiRuntimeConfigService 也走 Redis 缓存 +var ( + cfgCache map[string]*LLMConfigFromDB + cfgCacheAt time.Time + cfgCacheTTL = 60 * time.Second + cfgCacheMutex sync.RWMutex +) + +// LLMConfigFromDB DB 读出的单个供应商完整配置(解密后的明文 API Key) +// +// 字段含义与 llm.LLMConfigEx 对齐,由调用方(config_assembler)负责映射 +type LLMConfigFromDB struct { + Provider string // 平台 code(spark/deepseek/qwen/...),小写 + APIURL string // 平台 api_url + APIKey string // 解密后的明文密钥 + APIKeyID int // 密钥记录 id(写入审计日志用) + Model string // 模型 code(如 spark-max / deepseek-chat) + PlatformID int // 平台 id + TimeoutSecs int // 超时秒(DB 暂无字段,回落到调用方默认) +} + +// ActiveSelection DB 中"全局激活"的平台/密钥/模型组合 +// +// 来源:xk_system_config 表的三个 key(由后台"模型配置"Tab 保存): +// - ai_active_provider :当前激活的平台 code(如 spark / deepseek / agent) +// - ai_active_api_key_id :当前激活的 API Key ID(可能不属于激活平台的默认 key) +// - ai_active_model :当前激活的模型 code(可能不是激活平台的默认模型) +// +// 与 LLMConfigFromDB 的关系: +// - LLMConfigFromDB 是"每个平台自己的默认 key/model"(平台级) +// - ActiveSelection 是"运维跨平台指定的激活组合"(全局级) +// - 实际生效规则:ActiveSelection 非空时优先用它,否则回落到平台默认 +type ActiveSelection struct { + Provider string // 激活平台 code(小写);空表示未配置 + APIKeyID int // 激活 API Key ID;0 表示未配置(回落平台默认) + Model string // 激活模型 code;空表示未配置(回落平台默认) +} + +// ======================================================================== +// z_xk 库表结构(按字段读取,不绑定 ORM 实体) +// ======================================================================== +// 注意:xk_ai_* 三张表的 DDL 没有提交到 sql 仓库, +// 字段名是从 PHP Service 反推的,如果后续 DB 结构有出入, +// 调整下面的 Select 字段即可,不需要改 entity。 +// ======================================================================== + +// PlatformRow 平台表行 +type PlatformRow struct { + ID int `gorm:"column:id"` + Code string `gorm:"column:code"` + Name string `gorm:"column:name"` + APIURL string `gorm:"column:api_url"` +} + +// TableName 指定表名(GORM 约定) +func (PlatformRow) TableName() string { return "xk_ai_platform" } + +// ModelRow 模型表行 +type ModelRow struct { + ID int `gorm:"column:id"` + PlatformID int `gorm:"column:platform_id"` + Code string `gorm:"column:code"` + Name string `gorm:"column:name"` + IsDefault int `gorm:"column:is_default"` + Sort int `gorm:"column:sort"` +} + +// TableName 指定表名 +func (ModelRow) TableName() string { return "xk_ai_model" } + +// APIKeyRow 密钥表行 +type APIKeyRow struct { + ID int `gorm:"column:id"` + PlatformID int `gorm:"column:platform_id"` + Name string `gorm:"column:name"` + APIKey string `gorm:"column:api_key"` // 密文(前缀 xk_ase_256_) + IsDefault int `gorm:"column:is_default"` + Sort int `gorm:"column:sort"` +} + +// TableName 指定表名 +func (APIKeyRow) TableName() string { return "xk_ai_api_key" } + +// SystemConfigRow 系统配置表行 +type SystemConfigRow struct { + ConfigKey string `gorm:"column:config_key"` + ConfigValue string `gorm:"column:config_value"` +} + +// TableName 指定表名 +func (SystemConfigRow) TableName() string { return "xk_system_config" } + +// Init 连接 z_xk 库 +// +// 参数: +// dsn - 形如 "user:pass@tcp(host:3306)/z_xk?charset=utf8mb4&parseTime=true&loc=Local" +// (注意:parseTime=true 必填,否则 GORM 无法把 DATETIME 转成 time.Time) +// +// 失败时返回错误,由 main 决定是否继续(建议:DB 不可用时降级用 yaml/env 配置) +func Init(dsn string) error { + if dsn == "" { + return errors.New("dao: DSN 为空") + } + var err error + DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{ + // 生产用 Error 级别,避免每条 SQL 都打日志;调试时改成 Info + Logger: logger.Default.LogMode(logger.Warn), + }) + if err != nil { + // 关键:gorm.Open 失败时 DB 仍可能被赋值为部分初始化的 *gorm.DB, + // 内部 Statement.ConnPool 为 nil,后续调用 DB.Where 会 panic。 + // 这里显式置 nil,让后续的 `if DB == nil` 检查能正确拦截。 + DB = nil + return fmt.Errorf("dao: 连接 z_xk 库失败: %w", err) + } + // 验证连接 + 时区(PHP 端用 Asia/Shanghai) + sqlDB, err := DB.DB() + if err != nil { + DB = nil + return err + } + sqlDB.SetMaxIdleConns(5) + sqlDB.SetMaxOpenConns(20) + sqlDB.SetConnMaxLifetime(time.Hour) + + log.Printf("[DAO] z_xk 库连接成功 | DSN=%s", maskDSN(dsn)) + return nil +} + +// ======================================================================== +// 核心:加载当前激活的 LLM 配置 +// ======================================================================== + +// LoadLLMConfigsFromDB 从 z_xk 库读取所有可用供应商配置(带 60s 缓存) +// +// 复刻 PHP AiRuntimeConfigService 的解析逻辑: +// 1. 读 xk_system_config 拿当前激活的 provider(ai_active_provider) +// 2. 从 xk_ai_platform 读所有启用平台(不只激活那个,全部返回,让 yaml 的 routes 自由映射) +// 3. 对每个平台: +// - 查 xk_ai_api_key 的默认/激活 key +// - 用 xkaes.Decrypt 解密 api_key +// - 查 xk_ai_model 的默认模型 +// 4. 装配成 map[provider]*LLMConfigFromDB 返回 +// +// 参数: +// encryptKey - PHP 端 env('ENCRYPT_KEY') 的原值(用于 AES 解密) +// +// 失败处理: +// - 单个供应商失败不阻塞其他供应商,记日志后跳过 +// - 整体失败(如 DB 连不上)返回 error +func LoadLLMConfigsFromDB(encryptKey string) (map[string]*LLMConfigFromDB, error) { + // 命中缓存直接返回(避免高频查询打 DB) + cfgCacheMutex.RLock() + if cfgCache != nil && time.Since(cfgCacheAt) < cfgCacheTTL { + out := make(map[string]*LLMConfigFromDB, len(cfgCache)) + for k, v := range cfgCache { + out[k] = v + } + cfgCacheMutex.RUnlock() + return out, nil + } + cfgCacheMutex.RUnlock() + + if DB == nil { + return nil, errors.New("dao: DB 未初始化,请先调用 Init()") + } + + // 读所有启用的平台(status=1, deleted_at=0) + var platforms []PlatformRow + if err := DB.Where("status = 1 AND deleted_at = 0"). + Order("sort DESC, id ASC"). + Find(&platforms).Error; err != nil { + return nil, fmt.Errorf("dao: 查询 xk_ai_platform 失败: %w", err) + } + + out := make(map[string]*LLMConfigFromDB, len(platforms)) + for _, p := range platforms { + provider := strings.ToLower(strings.TrimSpace(p.Code)) + if provider == "" { + continue + } + + // 解密密钥失败时跳过该供应商,不阻塞其他 + apiKey, apiKeyID, err := resolveAPIKey(p.ID, encryptKey) + if err != nil { + log.Printf("[DAO] 平台 %s(%s) 取密钥失败: %v(跳过)", p.Code, p.Name, err) + continue + } + + // 取默认模型(失败时用空字符串,调用方回落 yaml 默认值) + model := resolveDefaultModel(p.ID) + + out[provider] = &LLMConfigFromDB{ + Provider: provider, + APIURL: p.APIURL, + APIKey: apiKey, + APIKeyID: apiKeyID, + Model: model, + PlatformID: p.ID, + } + log.Printf("[DAO] 加载平台: code=%s model=%s api_key_id=%d", provider, model, apiKeyID) + } + + // 写缓存 + cfgCacheMutex.Lock() + cfgCache = out + cfgCacheAt = time.Now() + cfgCacheMutex.Unlock() + + return out, nil +} + +// InvalidateCache 清空配置缓存(运维改完 DB 后可主动调用) +func InvalidateCache() { + cfgCacheMutex.Lock() + cfgCache = nil + cfgCacheMutex.Unlock() +} + +// LoadActiveSelection 读取后台"模型配置"Tab 保存的全局激活组合 +// +// 数据源:xk_system_config 表的三个 key: +// - ai_active_provider :激活平台 code(如 spark / deepseek / agent) +// - ai_active_api_key_id :激活 API Key ID(数字字符串) +// - ai_active_model :激活模型 code +// +// 返回值语义: +// - 三个字段全空 → 后台未配置,调用方应回落到 LLMConfigFromDB 的平台默认值 +// - Provider 非空 → 用它覆盖 cfg.LLM.DefaultProvider,让 EnhanceService 路由到正确平台 +// - APIKeyID/Model 非空 → 调用方据此到 LLMConfigFromDB[Provider] 里覆盖对应字段 +// +// 失败处理:单 key 查询失败不影响其他 key(用空值兜底);DB 不可用返回错误 +func LoadActiveSelection() (*ActiveSelection, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化,请先调用 Init()") + } + // 一次性读三个 key(IN 查询比三条单查高效) + var rows []SystemConfigRow + keys := []string{"ai_active_provider", "ai_active_api_key_id", "ai_active_model"} + if err := DB.Where("config_key IN ?", keys). + Find(&rows).Error; err != nil { + return nil, fmt.Errorf("dao: 查询 xk_system_config 失败: %w", err) + } + sel := &ActiveSelection{} + for _, r := range rows { + switch r.ConfigKey { + case "ai_active_provider": + // 平台 code 小写化,与 LLMConfigFromDB.Provider 保持一致 + sel.Provider = strings.ToLower(strings.TrimSpace(r.ConfigValue)) + case "ai_active_api_key_id": + // 数字字符串转 int;非法值(如空串/字母)兜底为 0 + n := 0 + fmt.Sscanf(r.ConfigValue, "%d", &n) + sel.APIKeyID = n + case "ai_active_model": + sel.Model = strings.TrimSpace(r.ConfigValue) + } + } + return sel, nil +} + +// ResolvedLLMConfig 解析后的最终 LLM 配置(已应用激活组合覆盖) +// +// 本结构是"按需调用 LLM"时使用的最终配置—— +// 已经合并了三层数据源(平台默认 + 全局激活 + api_key_id 反查), +// 调用方拿到后可以直接据此创建/复用 LLMClient,无需再处理覆盖逻辑。 +// +// 字段语义: +// - Provider :实际使用的供应商 code(小写) +// - APIURL :实际使用的 API 地址(来自平台表) +// - APIKey :实际使用的明文 API Key(已解密) +// - APIKeyID :实际使用的密钥 id(写入审计日志) +// - Model :实际使用的模型 code +// - Source :来源标记:"active"(激活组合) / "platform_default"(平台默认) +// 用于日志排查"为什么调用的是这个模型" +type ResolvedLLMConfig struct { + Provider string + APIURL string + APIKey string + APIKeyID int + Model string + Source string +} + +// 全局缓存:LoadActiveLLMConfig 的解析结果(60s TTL,独立缓存锁) +// +// 为什么单独缓存: +// - LoadLLMConfigsFromDB 的缓存是"全量平台列表",命中后整个 map 共享; +// LoadActiveLLMConfig 是"最终生效的那一个",缓存粒度不同,不能复用同一把锁 +// - 缓存中包含解密后的明文 APIKey,仅在内存中保存,不出日志/不落盘 +var ( + activeCfgCache *ResolvedLLMConfig + activeCfgCacheAt time.Time + activeCfgCacheMu sync.RWMutex + activeCfgCacheTTL = 60 * time.Second // 与 LoadLLMConfigsFromDB 同步:60s 内全集群一致 +) + +// LoadActiveLLMConfig 一次性解析出"当前实际生效"的 LLM 配置(带 60s 缓存) +// +// 解析规则(与 PHP AiRuntimeConfigService::resolve() 严格对齐): +// 1. 读 xk_system_config 拿 ai_active_provider / ai_active_api_key_id / ai_active_model +// 2. 若 active.Provider 为空或为 "agent"(PHP 中转标记)→ 回落到 cfg.LLM.DefaultProvider +// (agent 标记 Go 端不处理,PHP 自己会路由;Go 端按 yaml 默认 provider 兜底) +// 3. 从 xk_ai_platform 读该 provider 的 api_url,从 xk_ai_model 读默认 model +// 4. 若 active.APIKeyID > 0 → 按主键反查 key(跨平台指定场景),否则用平台默认 key +// 5. 若 active.Model 非空 → 覆盖 model +// +// 入参 fallbackProvider: +// - 当 active.Provider 为空或 agent 时,使用此值作为回落 provider +// - 一般传 cfg.LLM.DefaultProvider(来自 yaml/env) +// +// 入参 fallbackTimeoutSecs: +// - DB 中平台表没有 timeout 字段,这里从 yaml 透传,作为客户端创建时的 HTTP 超时 +// +// 失败处理: +// - DB 不可用 → 返回 error,调用方应回落到 yaml/env 配置 +// - 单个 provider 解析失败 → 返回 error(不同于 LoadLLMConfigsFromDB 的"跳过继续", +// 因为这里只查一个目标,失败就该报错让上层处理) +func LoadActiveLLMConfig(fallbackProvider string) (*ResolvedLLMConfig, error) { + // 1) 命中缓存直接返回(深拷贝,避免调用方误改全局缓存) + activeCfgCacheMu.RLock() + if activeCfgCache != nil && time.Since(activeCfgCacheAt) < activeCfgCacheTTL { + out := *activeCfgCache + activeCfgCacheMu.RUnlock() + return &out, nil + } + activeCfgCacheMu.RUnlock() + + if DB == nil { + return nil, errors.New("dao: DB 未初始化,请先调用 Init()") + } + + // 2) 读全局激活组合 + active, err := LoadActiveSelection() + if err != nil { + return nil, fmt.Errorf("dao: 读取激活组合失败: %w", err) + } + + // 3) 决定最终使用的 provider + // 重要语义(2026-08-11 重构后): + // ai_active_provider 永远是真实 provider(spark/deepseek/...), + // "是否走 Go Agent 中转"由 PHP 端独立开关 ai_agent_via_agent 控制(PHP 自己处理路由), + // Go 端被调用时永远代表"我要用真实模型",所以这里不再判断 agent。 + provider := active.Provider + source := "active" + if provider == "" { + // 后台未配置 ai_active_provider,回落 yaml/env 默认 provider + provider = strings.ToLower(strings.TrimSpace(fallbackProvider)) + if provider == "" { + provider = "deepseek" // 兜底中的兜底,避免空 provider 导致后续查表失败 + } + source = "platform_default" + } + + // 4) 从 xk_ai_platform 查目标 provider + var platform PlatformRow + if err := DB.Where("code = ? AND status = 1 AND deleted_at = 0", provider). + First(&platform).Error; err != nil { + return nil, fmt.Errorf("dao: 查询 xk_ai_platform code=%s 失败: %w", provider, err) + } + + // 5) 决定使用的 API Key(激活 key_id 优先,否则用平台默认 key) + var apiKeyRow APIKeyRow + if active.APIKeyID > 0 { + // 后台指定了具体 key_id(跨平台场景),按主键反查 + if err := DB.Where("id = ? AND status = 1 AND deleted_at = 0", active.APIKeyID). + First(&apiKeyRow).Error; err != nil { + return nil, fmt.Errorf("dao: 按 id=%d 查 xk_ai_api_key 失败: %w", active.APIKeyID, err) + } + } else { + // 未指定 key_id,用平台默认 key(与 resolveAPIKey 同样排序规则) + if err := DB.Where("platform_id = ? AND status = 1 AND deleted_at = 0", platform.ID). + Order("is_default DESC, sort DESC, id ASC"). + First(&apiKeyRow).Error; err != nil { + return nil, fmt.Errorf("dao: 查询 xk_ai_api_key platform_id=%d 失败: %w", platform.ID, err) + } + } + + // 6) 解密 API Key + // 注意:本函数入参没有 encryptKey,从全局缓存取(main.go 启动时通过 SetEncryptKey 注入) + if globalEncryptKey == "" { + return nil, errors.New("dao: encryptKey 未注入,请先调用 dao.SetEncryptKey()") + } + plainKey, err := xkaes.Decrypt(apiKeyRow.APIKey, globalEncryptKey) + if err != nil { + return nil, fmt.Errorf("dao: 解密 api_key(id=%d) 失败: %w", apiKeyRow.ID, err) + } + if plainKey == "" { + return nil, fmt.Errorf("dao: api_key(id=%d) 解密后为空", apiKeyRow.ID) + } + + // 7) 决定使用的 Model(激活 model 优先,否则用平台默认模型) + model := active.Model + if model == "" { + model = resolveDefaultModel(platform.ID) + } + + resolved := &ResolvedLLMConfig{ + Provider: provider, + APIURL: platform.APIURL, + APIKey: plainKey, + APIKeyID: apiKeyRow.ID, + Model: model, + Source: source, + } + + // 8) 写缓存 + activeCfgCacheMu.Lock() + activeCfgCache = resolved + activeCfgCacheAt = time.Now() + activeCfgCacheMu.Unlock() + + log.Printf("[DAO] 解析生效配置: provider=%s model=%s api_key_id=%d source=%s", + resolved.Provider, resolved.Model, resolved.APIKeyID, resolved.Source) + return resolved, nil +} + +// InvalidateActiveLLMCache 主动失效"生效配置"缓存 +// +// 使用场景:PHP 后台改完模型配置后调 /admin/invalidate-cache 接口 +// 让 Go 端下一次请求时重新从 DB 读取最新配置 +func InvalidateActiveLLMCache() { + activeCfgCacheMu.Lock() + activeCfgCache = nil + activeCfgCacheAt = time.Time{} + activeCfgCacheMu.Unlock() + log.Printf("[DAO] 生效配置缓存已主动失效") +} + +// 全局 AES 主密钥(启动期由 main.go 通过 SetEncryptKey 注入) +// +// 为什么放全局而不是函数入参: +// - 调用链 EnhancerService → dao.LoadActiveLLMConfig 每次都要传 key 太冗长 +// - 主密钥整个进程生命周期不变,放全局变量 + 启动期注入更符合实际使用模式 +var globalEncryptKey string + +// SetEncryptKey 注入 AES 主密钥(main.go 启动时调用一次) +// +// 与 PHP 端 .env ENCRYPT_KEY 同源,用于解密 xk_ai_api_key.api_key 字段 +func SetEncryptKey(key string) { + globalEncryptKey = key +} + +// ======================================================================== +// 内部辅助 +// ======================================================================== + +// resolveAPIKey 取平台的默认密钥(按 PHP 同样规则排序)并解密 +// +// 排序规则(与 AiRuntimeConfigService 一致): +// 1. is_default=1 优先 +// 2. sort 倒序 +// 3. id 升序 +// 返回:明文 API Key + 该 key 的 id(用于审计) +func resolveAPIKey(platformID int, encryptKey string) (string, int, error) { + var row APIKeyRow + err := DB.Where("platform_id = ? AND status = 1 AND deleted_at = 0", platformID). + Order("is_default DESC, sort DESC, id ASC"). + First(&row).Error + if err != nil { + return "", 0, fmt.Errorf("查 xk_ai_api_key 失败: %w", err) + } + + // 解密 + plain, err := xkaes.Decrypt(row.APIKey, encryptKey) + if err != nil { + return "", 0, fmt.Errorf("解密 api_key(id=%d) 失败: %w", row.ID, err) + } + if plain == "" { + return "", 0, fmt.Errorf("api_key(id=%d) 解密后为空", row.ID) + } + return plain, row.ID, nil +} + +// GetAPIKeyByID 按 id 取密钥并解密 +// +// 用途:后台"模型配置"Tab 通过 ai_active_api_key_id 跨平台指定激活 key 时, +// Go 端需要按 id 直接取这条 key 的明文(与 resolveAPIKey 不同——后者按平台 +// 取"默认 key",前者按 id 取"指定 key",可能不是同一个)。 +// +// 失败处理:DB 错误或解密失败都返回 error,由调用方决定是否回落到平台默认 key +func GetAPIKeyByID(keyID int, encryptKey string) (string, error) { + if DB == nil { + return "", errors.New("dao: DB 未初始化") + } + if keyID <= 0 { + return "", errors.New("dao: keyID 非法") + } + var row APIKeyRow + if err := DB.Where("id = ? AND status = 1 AND deleted_at = 0", keyID). + First(&row).Error; err != nil { + return "", fmt.Errorf("查 xk_ai_api_key id=%d 失败: %w", keyID, err) + } + plain, err := xkaes.Decrypt(row.APIKey, encryptKey) + if err != nil { + return "", fmt.Errorf("解密 api_key(id=%d) 失败: %w", row.ID, err) + } + return plain, nil +} + +// resolveDefaultModel 取平台的默认模型 code +// +// 排序:is_default DESC, sort DESC, id ASC(与 PHP 一致) +func resolveDefaultModel(platformID int) string { + var row ModelRow + err := DB.Where("platform_id = ? AND status = 1 AND deleted_at = 0", platformID). + Order("is_default DESC, sort DESC, id ASC"). + First(&row).Error + if err != nil { + return "" // 失败返回空,由调用方回落默认值 + } + return row.Code +} + +// maskDSN 把 DSN 中的密码打码,避免日志泄露 +// +// 例:root:secret@tcp(127.0.0.1:3306)/z_xk → root:***@tcp(127.0.0.1:3306)/z_xk +func maskDSN(dsn string) string { + i := strings.Index(dsn, ":") + j := strings.Index(dsn, "@") + if i < 0 || j < 0 || j <= i { + return dsn + } + return dsn[:i+1] + "***" + dsn[j:] +} diff --git a/internal/dao/formula_dao.go b/internal/dao/formula_dao.go new file mode 100644 index 0000000..d17474a --- /dev/null +++ b/internal/dao/formula_dao.go @@ -0,0 +1,74 @@ +package dao + +import ( + "errors" + "fmt" +) + +// ======================================================================== +// 金方库(xk_golden_formula)检索 DAO —— P1 处方场景第二检索源 +// ======================================================================== +// 数据源分工(与业务确认过的铁律): +// - 方剂知识 = 金方库(平台手动维护,动态读取,不写死不爬取) +// - 可开药品 = 自家药品库 yii_drug(PHP 侧对照,Go 不碰) +// - 爬取药材数据 = 辅助参照(别名归一/安全校验) +// 三者严格分开。本文件只读金方表,供处方场景检索"参考方剂"注入 prompt。 +// +// 依赖索引:ft_formula_search(ngram FULLTEXT,见 20260813/golden_formula_fulltext.sql), +// 未建索引时 MATCH 查询会报 1191,调用方(enhancer)按"检索失败不阻断"降级。 +// ======================================================================== + +// GoldenFormulaHit 金方检索命中行 +// +// 只取注入 prompt 需要的字段:方名、组成(drugs_json 原文)、主治。 +// original_formula/intro 等长文不取——注入 prompt 会撑爆长度预算 +type GoldenFormulaHit struct { + ID uint `gorm:"column:id" json:"id"` + Name string `gorm:"column:name" json:"name"` + HerbOverview string `gorm:"column:herb_overview" json:"herb_overview"` + DrugsJSON *string `gorm:"column:drugs_json" json:"drugs_json"` + IndicationOriginal string `gorm:"column:indication_original" json:"indication_original"` + IndicationTranslation string `gorm:"column:indication_translation" json:"indication_translation"` + Score float64 `gorm:"column:score" json:"score"` +} + +// GoldenFormulaSearch 金方库 FULLTEXT 检索 +// +// 与 KBFullTextSearch 同款两段式设计(模式由上层编排): +// - natural=false:BOOLEAN MODE,短证候关键词精确匹配 +// - natural=true:NATURAL LANGUAGE MODE,整段辨证上下文自动 2-gram 分词 +// +// 过滤条件(与接诊端金方展示口径一致): +// status=1 启用、is_abnormal=0 药味解析正常、deleted_at=0 未删除。 +// 平台手动更新金方后立即生效(每次生成实时查询,无缓存无同步延迟) +func GoldenFormulaSearch(query string, topK int, natural bool) ([]GoldenFormulaHit, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + if query == "" { + return []GoldenFormulaHit{}, nil + } + if topK <= 0 { + topK = 3 + } + // 模式字面量只来自 bool 分支,不存在注入风险 + mode := "IN BOOLEAN MODE" + if natural { + mode = "IN NATURAL LANGUAGE MODE" + } + sql := ` + SELECT id, name, herb_overview, drugs_json, indication_original, indication_translation, + MATCH(name, herb_overview, indication_original, indication_translation) AGAINST (? ` + mode + `) AS score + FROM xk_golden_formula + WHERE status = 1 + AND is_abnormal = 0 + AND deleted_at = 0 + AND MATCH(name, herb_overview, indication_original, indication_translation) AGAINST (? ` + mode + `) + ORDER BY score DESC + LIMIT ?` + var results []GoldenFormulaHit + if err := DB.Raw(sql, query, query, topK).Scan(&results).Error; err != nil { + return nil, fmt.Errorf("dao: 金方 FULLTEXT 检索失败: %w", err) + } + return results, nil +} diff --git a/internal/dao/kb_crawl_dao.go b/internal/dao/kb_crawl_dao.go new file mode 100644 index 0000000..f048e96 --- /dev/null +++ b/internal/dao/kb_crawl_dao.go @@ -0,0 +1,194 @@ +package dao + +import ( + "errors" + "fmt" + "time" +) + +// ======================================================================== +// 知识库抓取任务 DAO(xk_kb_crawl_task / xk_kb_crawl_log) +// ======================================================================== +// 职责: +// - 任务 CRUD(面板配置定时抓取:源 / 目标库 / 调度方式 / 单次限量) +// - 运行日志写入与查询(每次运行一行,审计 + 排障) +// - 文档 upsert 辅助(按标题找库内已有文档,决定新建还是更新) +// +// 设计约定: +// - 时间戳全部 int(与全库规范一致),业务代码手动 time.Now().Unix() 填 +// - 软删除:deleted_at != 0 即删除,查询统一带 deleted_at = 0 +// ======================================================================== + +// KBCrawlTaskRow 抓取任务表行(与 xk_kb_crawl_task 一一对应) +type KBCrawlTaskRow struct { + ID uint `gorm:"column:id;primaryKey" json:"id"` + Name string `gorm:"column:name" json:"name"` + Source string `gorm:"column:source" json:"source"` + LibraryID uint `gorm:"column:library_id" json:"library_id"` + ScheduleType string `gorm:"column:schedule_type" json:"schedule_type"` + IntervalHours int `gorm:"column:interval_hours" json:"interval_hours"` + RunAtHour int `gorm:"column:run_at_hour" json:"run_at_hour"` + RunAtWeekday int `gorm:"column:run_at_weekday" json:"run_at_weekday"` + ItemsPerRun int `gorm:"column:items_per_run" json:"items_per_run"` + ProgressOffset int `gorm:"column:progress_offset" json:"progress_offset"` + Status int `gorm:"column:status" json:"status"` + LastRunAt int `gorm:"column:last_run_at" json:"last_run_at"` + LastStatus string `gorm:"column:last_status" json:"last_status"` + LastMessage string `gorm:"column:last_message" json:"last_message"` + CreatedAt int `gorm:"column:created_at" json:"created_at"` + UpdatedAt int `gorm:"column:updated_at" json:"updated_at"` + DeletedAt int `gorm:"column:deleted_at" json:"deleted_at"` +} + +// TableName 指定表名 +func (KBCrawlTaskRow) TableName() string { return "xk_kb_crawl_task" } + +// KBCrawlLogRow 抓取运行日志表行(与 xk_kb_crawl_log 一一对应) +type KBCrawlLogRow struct { + ID uint `gorm:"column:id;primaryKey" json:"id"` + TaskID uint `gorm:"column:task_id" json:"task_id"` + TriggerType string `gorm:"column:trigger_type" json:"trigger_type"` + StartedAt int `gorm:"column:started_at" json:"started_at"` + FinishedAt int `gorm:"column:finished_at" json:"finished_at"` + Status string `gorm:"column:status" json:"status"` + TotalFetched int `gorm:"column:total_fetched" json:"total_fetched"` + CreatedDocs int `gorm:"column:created_docs" json:"created_docs"` + UpdatedDocs int `gorm:"column:updated_docs" json:"updated_docs"` + FailedItems int `gorm:"column:failed_items" json:"failed_items"` + Message string `gorm:"column:message" json:"message"` + CreatedAt int `gorm:"column:created_at" json:"created_at"` + UpdatedAt int `gorm:"column:updated_at" json:"updated_at"` + DeletedAt int `gorm:"column:deleted_at" json:"deleted_at"` +} + +// TableName 指定表名 +func (KBCrawlLogRow) TableName() string { return "xk_kb_crawl_log" } + +// ---------------------------- 任务 CRUD ---------------------------- + +// KBCrawlTaskList 列出所有未删除任务(按 id 倒序,新建的在前) +func KBCrawlTaskList() ([]KBCrawlTaskRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var rows []KBCrawlTaskRow + err := DB.Where("deleted_at = 0").Order("id DESC").Find(&rows).Error + return rows, err +} + +// KBCrawlTaskGet 取单个任务 +func KBCrawlTaskGet(id uint) (*KBCrawlTaskRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var row KBCrawlTaskRow + if err := DB.Where("id = ? AND deleted_at = 0", id).First(&row).Error; err != nil { + return nil, fmt.Errorf("任务不存在: %w", err) + } + return &row, nil +} + +// KBCrawlTaskCreate 创建任务(CreatedAt/UpdatedAt 由这里统一填) +func KBCrawlTaskCreate(row *KBCrawlTaskRow) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + now := int(time.Now().Unix()) + row.CreatedAt = now + row.UpdatedAt = now + return DB.Create(row).Error +} + +// KBCrawlTaskUpdate 更新任务字段(fields 为列名→值;自动补 updated_at) +// +// 用 map 而非结构体:GORM 结构体更新会跳过零值字段, +// 而这里"把 status 改成 0(禁用)"恰恰是零值,必须用 map 显式更新 +func KBCrawlTaskUpdate(id uint, fields map[string]any) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + fields["updated_at"] = int(time.Now().Unix()) + return DB.Model(&KBCrawlTaskRow{}).Where("id = ? AND deleted_at = 0", id).Updates(fields).Error +} + +// KBCrawlTaskDelete 软删除任务 +func KBCrawlTaskDelete(id uint) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + now := int(time.Now().Unix()) + return DB.Model(&KBCrawlTaskRow{}).Where("id = ?", id). + Updates(map[string]any{"deleted_at": now, "updated_at": now}).Error +} + +// ---------------------------- 运行日志 ---------------------------- + +// KBCrawlLogCreate 新建一条运行日志(status=running,结束时再补终态) +func KBCrawlLogCreate(row *KBCrawlLogRow) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + now := int(time.Now().Unix()) + row.CreatedAt = now + row.UpdatedAt = now + return DB.Create(row).Error +} + +// KBCrawlLogFinish 补写运行日志终态(结束时间/状态/统计/摘要) +func KBCrawlLogFinish(id uint, fields map[string]any) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + fields["updated_at"] = int(time.Now().Unix()) + return DB.Model(&KBCrawlLogRow{}).Where("id = ?", id).Updates(fields).Error +} + +// KBCrawlLogList 某任务最近 N 条运行日志(倒序) +func KBCrawlLogList(taskID uint, limit int) ([]KBCrawlLogRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + if limit <= 0 || limit > 100 { + limit = 20 + } + var rows []KBCrawlLogRow + err := DB.Where("task_id = ? AND deleted_at = 0", taskID). + Order("id DESC").Limit(limit).Find(&rows).Error + return rows, err +} + +// ---------------------------- 文档 upsert 辅助 ---------------------------- + +// KBFindDocByTitle 在某库内按标题精确找文档(抓取 upsert 判重用) +// +// 返回 (nil, nil) 表示没找到(不是错误)——调用方据此决定 insert 还是 update +func KBFindDocByTitle(libraryID uint, title string) (*KBDocRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var row KBDocRow + err := DB.Where("library_id = ? AND title = ? AND deleted_at = 0", libraryID, title). + Limit(1).Find(&row).Error + if err != nil { + return nil, err + } + if row.ID == 0 { + return nil, nil + } + return &row, nil +} + +// KBUpdateDocContent 更新文档正文与元数据(抓取到新内容时刷新已有文档) +// +// 只更新 content / meta_json / source_type,标题不动(标题是 upsert 的判重键) +func KBUpdateDocContent(docID uint, content string, metaJSON *string, sourceType string) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + return DB.Model(&KBDocRow{}).Where("id = ?", docID).Updates(map[string]any{ + "content": content, + "meta_json": metaJSON, + "source_type": sourceType, + "updated_at": int(time.Now().Unix()), + }).Error +} diff --git a/internal/dao/kb_dao.go b/internal/dao/kb_dao.go new file mode 100644 index 0000000..1a8ef65 --- /dev/null +++ b/internal/dao/kb_dao.go @@ -0,0 +1,694 @@ +package dao + +import ( + "encoding/json" + "errors" + "fmt" + "time" + + "gorm.io/gorm" +) + +// ======================================================================== +// 本地知识库 DAO(V1: 仅全文检索;V2 预留向量字段) +// ======================================================================== +// 本文件负责所有本地知识库相关的 DB 操作(库/文档/分段)。 +// 全部走 GORM + 全局 DB 句柄(dao.Init() 初始化的 z_xk 库连接)。 +// +// 与外部包的边界: +// - internal/kb/* 的 Service 只调用本文件暴露的方法,不直接操作 gorm.DB +// - 实体定义对外暴露(kb 包可以引用 KBLibraryRow 等类型) +// ======================================================================== + +// KBLibraryRow 知识库表行 +// +// 字段与表 xk_kb_library 一一对应,gorm tag 指定列名 +type KBLibraryRow struct { + ID uint `gorm:"column:id;primaryKey" json:"id"` + Name string `gorm:"column:name" json:"name"` + Description string `gorm:"column:description" json:"description"` + Source string `gorm:"column:source" json:"source"` + EmbeddingProvider string `gorm:"column:embedding_provider" json:"embedding_provider"` + EmbeddingDim int `gorm:"column:embedding_dim" json:"embedding_dim"` + DocCount int `gorm:"column:doc_count" json:"doc_count"` + ChunkCount int `gorm:"column:chunk_count" json:"chunk_count"` + VectorizedCount int `gorm:"column:vectorized_count" json:"vectorized_count"` + Status int `gorm:"column:status" json:"status"` + CreatedAt int `gorm:"column:created_at" json:"created_at"` + UpdatedAt int `gorm:"column:updated_at" json:"updated_at"` + DeletedAt int `gorm:"column:deleted_at" json:"deleted_at"` +} + +// TableName 指定表名(GORM 约定) +func (KBLibraryRow) TableName() string { return "xk_kb_library" } + +// KBDocRow 知识库文档表行 +type KBDocRow struct { + ID uint `gorm:"column:id;primaryKey" json:"id"` + LibraryID uint `gorm:"column:library_id" json:"library_id"` + Title string `gorm:"column:title" json:"title"` + Content string `gorm:"column:content" json:"content"` + SourceFile string `gorm:"column:source_file" json:"source_file"` + SourceType string `gorm:"column:source_type" json:"source_type"` + // meta_json 用 string 持有 JSON 文本,Go 端按需 json.Unmarshal + MetaJSON *string `gorm:"column:meta_json" json:"meta_json"` + ChunkCount int `gorm:"column:chunk_count" json:"chunk_count"` + Status int `gorm:"column:status" json:"status"` + CreatedAt int `gorm:"column:created_at" json:"created_at"` + UpdatedAt int `gorm:"column:updated_at" json:"updated_at"` + DeletedAt int `gorm:"column:deleted_at" json:"deleted_at"` +} + +// TableName 指定表名 +func (KBDocRow) TableName() string { return "xk_kb_doc" } + +// KBChunkRow 知识库分段表行(检索单元) +type KBChunkRow struct { + ID uint `gorm:"column:id;primaryKey" json:"id"` + LibraryID uint `gorm:"column:library_id" json:"library_id"` + DocID uint `gorm:"column:doc_id" json:"doc_id"` + Title string `gorm:"column:title" json:"title"` + Content string `gorm:"column:content" json:"content"` + // V2 预留:content_vector 是 JSON 数组(float32 list);V1 永远 NULL + // 用 *string 持有原始 JSON 文本,需要时 Unmarshal 成 []float32 + ContentVector *string `gorm:"column:content_vector" json:"content_vector"` + IsVectorized int `gorm:"column:is_vectorized" json:"is_vectorized"` + ChunkIndex int `gorm:"column:chunk_index" json:"chunk_index"` + MetaJSON *string `gorm:"column:meta_json" json:"meta_json"` + IsActive int `gorm:"column:is_active" json:"is_active"` + CreatedAt int `gorm:"column:created_at" json:"created_at"` + UpdatedAt int `gorm:"column:updated_at" json:"updated_at"` + DeletedAt int `gorm:"column:deleted_at" json:"deleted_at"` +} + +// TableName 指定表名 +func (KBChunkRow) TableName() string { return "xk_kb_chunk" } + +// ======================================================================== +// 库(library)CRUD +// ======================================================================== + +// KBCreateLibraryInput 建库参数(仅暴露可设置字段) +type KBCreateLibraryInput struct { + Name string `json:"name"` + Description string `json:"description"` + Source string `json:"source"` // 默认 manual + EmbeddingProvider string `json:"embedding_provider"` // V1 默认 noop +} + +// KBCreateLibrary 创建知识库 +// +// 设计: +// - 调用方传 Source/EmbeddingProvider 为空时回落到合理默认 +// - 自动填入 created_at/updated_at 时间戳 +func KBCreateLibrary(input KBCreateLibraryInput) (*KBLibraryRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + if input.Name == "" { + return nil, errors.New("dao: 库名不能为空") + } + if input.Source == "" { + input.Source = "manual" + } + if input.EmbeddingProvider == "" { + input.EmbeddingProvider = "noop" // V1 默认不做向量化 + } + now := int(time.Now().Unix()) + row := &KBLibraryRow{ + Name: input.Name, + Description: input.Description, + Source: input.Source, + EmbeddingProvider: input.EmbeddingProvider, + Status: 1, + CreatedAt: now, + UpdatedAt: now, + DeletedAt: 0, + } + if err := DB.Create(row).Error; err != nil { + return nil, fmt.Errorf("dao: 创建知识库失败: %w", err) + } + return row, nil +} + +// KBListLibraries 列出所有库(按 id 倒序,最新的在前) +// +// includeDisabled=true 时连禁用的也返回,便于后台管理 +func KBListLibraries(includeDisabled bool) ([]KBLibraryRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var rows []KBLibraryRow + q := DB.Where("deleted_at = 0") + if !includeDisabled { + q = q.Where("status = 1") + } + if err := q.Order("id DESC").Find(&rows).Error; err != nil { + return nil, fmt.Errorf("dao: 查询知识库列表失败: %w", err) + } + return rows, nil +} + +// KBGetLibrary 按 id 取单个库 +func KBGetLibrary(id uint) (*KBLibraryRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var row KBLibraryRow + if err := DB.Where("id = ? AND deleted_at = 0", id).First(&row).Error; err != nil { + return nil, fmt.Errorf("dao: 知识库不存在 id=%d: %w", id, err) + } + return &row, nil +} + +// KBDeleteLibrary 软删除库(连带软删该库下所有文档和分段) +// +// 软删而非物理删:知识库内容删除需要可追溯(医疗合规) +// 三张表都用 deleted_at = now 来标记删除 +func KBDeleteLibrary(id uint) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + now := int(time.Now().Unix()) + // 事务保证三张表一致性 + return DB.Transaction(func(tx *gorm.DB) error { + if err := tx.Model(&KBLibraryRow{}). + Where("id = ? AND deleted_at = 0", id). + Updates(map[string]interface{}{"deleted_at": now, "updated_at": now, "status": 0}).Error; err != nil { + return fmt.Errorf("dao: 删除库失败 id=%d: %w", id, err) + } + if err := tx.Model(&KBDocRow{}). + Where("library_id = ? AND deleted_at = 0", id). + Updates(map[string]interface{}{"deleted_at": now, "updated_at": now, "status": 0}).Error; err != nil { + return fmt.Errorf("dao: 删除库下文档失败 id=%d: %w", id, err) + } + if err := tx.Model(&KBChunkRow{}). + Where("library_id = ? AND deleted_at = 0", id). + Updates(map[string]interface{}{"deleted_at": now, "updated_at": now, "is_active": 0}).Error; err != nil { + return fmt.Errorf("dao: 删除库下分段失败 id=%d: %w", id, err) + } + return nil + }) +} + +// KBUpdateLibraryStats 刷新库的统计字段(doc_count / chunk_count / vectorized_count) +// +// 调用时机:导入新文档后、批量向量化后、删除文档后 +// 设计:用 COUNT 子查询而非业务层维护,避免不一致 +func KBUpdateLibraryStats(libraryID uint) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + now := int(time.Now().Unix()) + // 注意:MySQL 的 VALUES() 在 8.0.20+ 推荐改用 ON DUPLICATE,但 GORM 的 Updates 不直接支持 + // 这里用 SELECT 查 3 个 count,再 UPDATE + var docCount, chunkCount, vecCount int64 + DB.Model(&KBDocRow{}).Where("library_id = ? AND deleted_at = 0 AND status = 1", libraryID).Count(&docCount) + DB.Model(&KBChunkRow{}).Where("library_id = ? AND deleted_at = 0 AND is_active = 1", libraryID).Count(&chunkCount) + DB.Model(&KBChunkRow{}).Where("library_id = ? AND deleted_at = 0 AND is_active = 1 AND is_vectorized = 1", libraryID).Count(&vecCount) + + return DB.Model(&KBLibraryRow{}). + Where("id = ?", libraryID). + Updates(map[string]interface{}{ + "doc_count": docCount, + "chunk_count": chunkCount, + "vectorized_count": vecCount, + "updated_at": now, + }).Error +} + +// ======================================================================== +// 文档(doc)CRUD +// ======================================================================== + +// KBListDocs 列出某个库下的所有文档 +func KBListDocs(libraryID uint) ([]KBDocRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var rows []KBDocRow + if err := DB.Where("library_id = ? AND deleted_at = 0", libraryID). + Order("id DESC"). + Find(&rows).Error; err != nil { + return nil, fmt.Errorf("dao: 查询文档列表失败: %w", err) + } + return rows, nil +} + +// KBGetDoc 按 id 取单个文档 +func KBGetDoc(id uint) (*KBDocRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var row KBDocRow + if err := DB.Where("id = ? AND deleted_at = 0", id).First(&row).Error; err != nil { + return nil, fmt.Errorf("dao: 文档不存在 id=%d: %w", id, err) + } + return &row, nil +} + +// KBDeleteDoc 软删除单个文档(连带该文档的所有分段) +func KBDeleteDoc(id uint) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + now := int(time.Now().Unix()) + doc, err := KBGetDoc(id) + if err != nil { + return err + } + return DB.Transaction(func(tx *gorm.DB) error { + if err := tx.Model(&KBDocRow{}). + Where("id = ?", id). + Updates(map[string]interface{}{"deleted_at": now, "updated_at": now, "status": 0}).Error; err != nil { + return err + } + if err := tx.Model(&KBChunkRow{}). + Where("doc_id = ?", id). + Updates(map[string]interface{}{"deleted_at": now, "updated_at": now, "is_active": 0}).Error; err != nil { + return err + } + // 不在事务里刷库统计(避免长事务),由调用方在事务成功后调 KBUpdateLibraryStats + _ = doc.LibraryID + return nil + }) +} + +// ======================================================================== +// 分段(chunk)操作 +// ======================================================================== + +// KBListChunks 列出某文档的分段(按 chunk_index 升序) +func KBListChunks(docID uint) ([]KBChunkRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var rows []KBChunkRow + if err := DB.Where("doc_id = ? AND deleted_at = 0", docID). + Order("chunk_index ASC"). + Find(&rows).Error; err != nil { + return nil, fmt.Errorf("dao: 查询分段列表失败: %w", err) + } + return rows, nil +} + +// KBGetChunk 按 id 取单个分段(编辑时用) +func KBGetChunk(id uint) (*KBChunkRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var row KBChunkRow + if err := DB.Where("id = ? AND deleted_at = 0", id).First(&row).Error; err != nil { + return nil, fmt.Errorf("dao: 分段不存在 id=%d: %w", id, err) + } + return &row, nil +} + +// KBUpdateChunkInput 更新分段的入参(指针字段为 nil 表示不更新) +// +// 设计:用指针而非值,便于区分「不更新」和「清空」 +// - Title *string nil=不改 / &""=清空标题 / &"新标题"=改标题 +// - Content *string 同上 +// - MetaJSON *string 同上(关联问题等元数据编进 meta_json) +type KBUpdateChunkInput struct { + Title *string + Content *string + MetaJSON *string + IsActive *int // nil=不改 / &1=启用 / &0=禁用(管理前端的分段启停开关) +} + +// KBUpdateChunk 更新分段(部分字段) +// +// 仅更新 title/content/meta_json 三个字段,不动 library_id/doc_id/chunk_index +// (这三个字段是结构信息,编辑不该动) +// +// 注意:更新 content 后 V2 需要重新向量化(V1 不做) +func KBUpdateChunk(id uint, input KBUpdateChunkInput) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + now := int(time.Now().Unix()) + updates := map[string]interface{}{"updated_at": now} + if input.Title != nil { + updates["title"] = *input.Title + } + if input.Content != nil { + updates["content"] = *input.Content + // 内容变了:V2 时需重新向量化(标记为未向量化) + // V1 这一行不影响业务,但为 V2 留好钩子 + updates["is_vectorized"] = 0 + updates["content_vector"] = nil + } + if input.MetaJSON != nil { + updates["meta_json"] = *input.MetaJSON + } + if input.IsActive != nil { + updates["is_active"] = *input.IsActive + } + result := DB.Model(&KBChunkRow{}). + Where("id = ? AND deleted_at = 0", id). + Updates(updates) + if result.Error != nil { + return fmt.Errorf("dao: 更新分段失败 id=%d: %w", id, result.Error) + } + if result.RowsAffected == 0 { + return fmt.Errorf("dao: 分段不存在或已删除 id=%d", id) + } + return nil +} + +// KBInsertDocWithChunks 一次性插入一个文档 + 它的所有分段(事务) +// +// 这是导入流程的核心方法: +// - doc.MetaJSON / chunk.MetaJSON 由调用方传 *string(已经 json.Marshal 过) +// - 自动维护 doc.ChunkCount +// - 不维护 library.doc_count / chunk_count(调用方调 KBUpdateLibraryStats) +// +// 参数: +// - doc:要插入的文档(ID/created_at 等会自动填) +// - chunks:该文档的所有分段(按 chunk_index 顺序) +// +// 返回:插入后的 doc.ID(chunks 也会被自动回填 ID) +func KBInsertDocWithChunks(doc *KBDocRow, chunks []*KBChunkRow) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + if doc == nil { + return errors.New("dao: doc 不能为空") + } + now := int(time.Now().Unix()) + doc.CreatedAt = now + doc.UpdatedAt = now + doc.DeletedAt = 0 + if doc.Status == 0 { + doc.Status = 1 + } + doc.ChunkCount = len(chunks) + + return DB.Transaction(func(tx *gorm.DB) error { + // 插入文档 + if err := tx.Create(doc).Error; err != nil { + return fmt.Errorf("dao: 插入文档失败: %w", err) + } + // 回填 chunks 的关联字段 + for i, c := range chunks { + c.LibraryID = doc.LibraryID + c.DocID = doc.ID + c.ChunkIndex = i + c.CreatedAt = now + c.UpdatedAt = now + c.DeletedAt = 0 + if c.IsActive == 0 { + c.IsActive = 1 + } + // V1 不向量化:强制 is_vectorized=0, content_vector=nil + c.IsVectorized = 0 + c.ContentVector = nil + } + // 批量插入分段(一次性 INSERT,比循环插入快 10x+) + if len(chunks) > 0 { + if err := tx.CreateInBatches(chunks, 500).Error; err != nil { + return fmt.Errorf("dao: 批量插入分段失败: %w", err) + } + } + return nil + }) +} + +// KBFullTextSearch 用 MySQL FULLTEXT 检索(V1 主要检索路径) +// +// 设计: +// - 用 MySQL 原生 AGAINST 走 FULLTEXT 索引(ngram 分词器,token_size=2) +// - 两种模式由 natural 参数控制,ngram 解析器对 query 的处理方式完全不同: +// BOOLEAN MODE(natural=false):整个 query 转成「连续 2-gram 短语」, +// 等价于子串匹配——短关键词(如 麻黄汤)精确,但自然语言长句几乎必然 0 命中; +// NATURAL LANGUAGE MODE(natural=true):query 自动拆成 2-gram 做 OR 匹配 + +// 相关度排序,等价于查询侧自动分词,适合整句/整段检索 +// - 模式选择与回退策略由上层 kb.Searcher 编排,本函数只管执行 +// - 返回 score 倒序的 TopN +// +// 返回:每条含 chunk 完整字段 + score 字段(额外加在 SELECT 里) +type KBFTSearchResult struct { + KBChunkRow + Score float64 `gorm:"column:score" json:"score"` // FULLTEXT 相关度分数 +} + +func KBFullTextSearch(libraryID uint, query string, topK int, natural bool) ([]KBFTSearchResult, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + if query == "" { + return []KBFTSearchResult{}, nil + } + if topK <= 0 { + topK = 5 + } + // 模式字面量只来自 bool 分支,不存在注入风险 + mode := "IN BOOLEAN MODE" + if natural { + mode = "IN NATURAL LANGUAGE MODE" + } + // 用原生 SQL:FULLTEXT 必须用 MATCH...AGAINST 才能走索引 + sql := ` + SELECT *, MATCH(title, content) AGAINST (? ` + mode + `) AS score + FROM xk_kb_chunk + WHERE library_id = ? + AND deleted_at = 0 + AND is_active = 1 + AND MATCH(title, content) AGAINST (? ` + mode + `) + ORDER BY score DESC + LIMIT ?` + var results []KBFTSearchResult + if err := DB.Raw(sql, query, libraryID, query, topK).Scan(&results).Error; err != nil { + return nil, fmt.Errorf("dao: FULLTEXT 检索失败: %w", err) + } + return results, nil +} + +// KBCrawlDocAliasRow 爬取文档的别名元数据(构建"别名→正名"映射用) +// +// title = 药材正名(爬取时以正名建文档),meta_json.aliases = 别名列表 +type KBCrawlDocAliasRow struct { + Title string `gorm:"column:title"` + MetaJSON *string `gorm:"column:meta_json"` +} + +// KBListCrawlDocAliases 列出全部爬取来源文档的 title + meta_json +// +// 用途(P1 别名归一):kb.AliasIndex 定期加载,把查询词中的药材别名 +// 扩展为正名后再检索(如"淮山"→"山药"),提高证候/药材语料召回率。 +// 只取 source_type='crawl' 的文档:手动导入文档的 meta 结构不保证有 aliases +func KBListCrawlDocAliases() ([]KBCrawlDocAliasRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var rows []KBCrawlDocAliasRow + if err := DB.Model(&KBDocRow{}). + Select("title, meta_json"). + Where("source_type = ? AND deleted_at = 0 AND status = 1", "crawl"). + Find(&rows).Error; err != nil { + return nil, fmt.Errorf("dao: 查询爬取文档别名失败: %w", err) + } + return rows, nil +} + +// KBListChunksByLibrary 列出某库下的所有已激活分段(V2 向量检索用:拉全量算余弦) +// +// V1 不调用,V2 接入向量后才用 +func KBListChunksByLibrary(libraryID uint) ([]KBChunkRow, error) { + if DB == nil { + return nil, errors.New("dao: DB 未初始化") + } + var rows []KBChunkRow + if err := DB.Where("library_id = ? AND deleted_at = 0 AND is_active = 1", libraryID). + Order("id ASC"). + Find(&rows).Error; err != nil { + return nil, fmt.Errorf("dao: 查询库下分段失败: %w", err) + } + return rows, nil +} + +// KBHasVectorized 判断某库是否已经向量化(V2 用,V1 永远 false) +// +// Searcher 用这个方法决定是否启用向量分支 +func KBHasVectorized(libraryID uint) (bool, error) { + if DB == nil { + return false, errors.New("dao: DB 未初始化") + } + var cnt int64 + if err := DB.Model(&KBChunkRow{}). + Where("library_id = ? AND deleted_at = 0 AND is_active = 1 AND is_vectorized = 1", libraryID). + Count(&cnt).Error; err != nil { + return false, err + } + return cnt > 0, nil +} + +// ======================================================================== +// 分段批量操作 / 文档重新分段(管理前端扩展功能) +// ======================================================================== + +// KBBatchChunkAction 批量启用/禁用/软删除分段 +// +// 为什么放 DAO 做而不是前端循环调单条接口: +// - 一个事务保证原子性(部分成功会让 chunk_count 统计对不上) +// - 一条 UPDATE ... WHERE id IN (...) 比 N 次请求快得多 +// +// 返回:实际受影响的行数 + 涉及的库 ID 集合(调用方刷新库统计用) +func KBBatchChunkAction(ids []uint, action string) (int64, []uint, error) { + if DB == nil { + return 0, nil, errors.New("dao: DB 未初始化") + } + if len(ids) == 0 { + return 0, nil, errors.New("dao: ids 不能为空") + } + now := int(time.Now().Unix()) + + // 先查涉及的库/文档(软删后就查不到了,必须先查) + var rows []KBChunkRow + if err := DB.Select("id, library_id, doc_id"). + Where("id IN ? AND deleted_at = 0", ids). + Find(&rows).Error; err != nil { + return 0, nil, fmt.Errorf("dao: 查询待操作分段失败: %w", err) + } + if len(rows) == 0 { + return 0, nil, errors.New("dao: 未找到可操作的分段(可能已被删除)") + } + libSet := map[uint]bool{} + docSet := map[uint]bool{} + for _, r := range rows { + libSet[r.LibraryID] = true + docSet[r.DocID] = true + } + + var updates map[string]interface{} + switch action { + case "enable": + updates = map[string]interface{}{"is_active": 1, "updated_at": now} + case "disable": + updates = map[string]interface{}{"is_active": 0, "updated_at": now} + case "delete": + updates = map[string]interface{}{"deleted_at": now, "is_active": 0, "updated_at": now} + default: + return 0, nil, fmt.Errorf("dao: 不支持的操作 %q(仅 enable/disable/delete)", action) + } + + var affected int64 + err := DB.Transaction(func(tx *gorm.DB) error { + res := tx.Model(&KBChunkRow{}). + Where("id IN ? AND deleted_at = 0", ids). + Updates(updates) + if res.Error != nil { + return fmt.Errorf("dao: 批量更新分段失败: %w", res.Error) + } + affected = res.RowsAffected + // 删除会改变文档的分段数:重算受影响文档的 chunk_count + if action == "delete" { + for docID := range docSet { + if err := tx.Exec( + "UPDATE xk_kb_doc SET chunk_count = (SELECT COUNT(*) FROM xk_kb_chunk WHERE doc_id = ? AND deleted_at = 0), updated_at = ? WHERE id = ?", + docID, now, docID, + ).Error; err != nil { + return fmt.Errorf("dao: 重算文档分段数失败 doc_id=%d: %w", docID, err) + } + } + } + return nil + }) + if err != nil { + return 0, nil, err + } + + libs := make([]uint, 0, len(libSet)) + for id := range libSet { + libs = append(libs, id) + } + return affected, libs, nil +} + +// KBReplaceDocChunks 用新分段整体替换文档的旧分段(重新分段用) +// +// 事务内三步:软删旧分段 → 批量插入新分段 → 更新 doc.chunk_count。 +// 旧分段软删而非物理删:保留审计痕迹,误操作可人工恢复 +func KBReplaceDocChunks(docID uint, chunks []*KBChunkRow) error { + if DB == nil { + return errors.New("dao: DB 未初始化") + } + doc, err := KBGetDoc(docID) + if err != nil { + return err + } + now := int(time.Now().Unix()) + + return DB.Transaction(func(tx *gorm.DB) error { + // 1. 软删该文档现有全部分段 + if err := tx.Model(&KBChunkRow{}). + Where("doc_id = ? AND deleted_at = 0", docID). + Updates(map[string]interface{}{"deleted_at": now, "is_active": 0, "updated_at": now}).Error; err != nil { + return fmt.Errorf("dao: 清理旧分段失败: %w", err) + } + // 2. 插入新分段(关联字段统一回填) + for i, c := range chunks { + c.ID = 0 // 强制新插入(防调用方复用旧行带 ID) + c.LibraryID = doc.LibraryID + c.DocID = docID + c.ChunkIndex = i + c.CreatedAt = now + c.UpdatedAt = now + c.DeletedAt = 0 + if c.IsActive == 0 { + c.IsActive = 1 + } + c.IsVectorized = 0 + c.ContentVector = nil + } + if len(chunks) > 0 { + if err := tx.CreateInBatches(chunks, 500).Error; err != nil { + return fmt.Errorf("dao: 插入新分段失败: %w", err) + } + } + // 3. 更新文档的分段数 + if err := tx.Model(&KBDocRow{}). + Where("id = ?", docID). + Updates(map[string]interface{}{"chunk_count": len(chunks), "updated_at": now}).Error; err != nil { + return fmt.Errorf("dao: 更新文档分段数失败: %w", err) + } + return nil + }) +} + +// ======================================================================== +// 辅助:JSON 字段编码 +// ======================================================================== + +// MarshalMeta 把任意结构编成 meta_json 字段需要的 *string +// +// 用法: +// meta := map[string]any{"related_questions": []string{"痰湿中阻怎么治"}} +// metaStr := dao.MarshalMeta(meta) +// chunk.MetaJSON = metaStr +// +// 注意:返回 *string 而非 string,nil 时数据库存 NULL +func MarshalMeta(v any) *string { + if v == nil { + return nil + } + b, err := json.Marshal(v) + if err != nil { + return nil + } + s := string(b) + return &s +} + +// UnmarshalMeta 把 meta_json 字段反编成 map(用于详情展示) +func UnmarshalMeta(s *string) map[string]any { + if s == nil || *s == "" { + return nil + } + var out map[string]any + if err := json.Unmarshal([]byte(*s), &out); err != nil { + return nil + } + return out +} diff --git a/internal/handler/agent_handler.go b/internal/handler/agent_handler.go new file mode 100644 index 0000000..80c99a4 --- /dev/null +++ b/internal/handler/agent_handler.go @@ -0,0 +1,105 @@ +package handler + +import ( + "tcm-agent/internal/agent" + + "github.com/gin-gonic/gin" +) + +// ======================================================================== +// 通用 Agent 对话接口 +// ======================================================================== +// 用于:自由问诊、多轮对话、调试 Agent 行为 +// ======================================================================== + +// AgentHandler 通用 Agent 对话处理器 +type AgentHandler struct { + runner *agent.Runner +} + +// NewAgentHandler 创建 Agent 处理器 +func NewAgentHandler(runner *agent.Runner) *AgentHandler { + return &AgentHandler{runner: runner} +} + +// ChatRequest 对话请求 +type ChatRequest struct { + SessionID string `json:"session_id"` // 可选,不传则创建新会话 + Message string `json:"message" binding:"required"` + UserID string `json:"user_id"` // 用户 ID + Scene string `json:"scene"` // 场景名(决定用哪个模型) +} + +// Chat 通用 Agent 对话接口 +// +// POST /api/v1/agent/chat +// +// 支持多轮对话:传 session_id 则延续上下文。 +// 不传 scene 时使用默认路由。 +func (h *AgentHandler) Chat(c *gin.Context) { + var req ChatRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(400, gin.H{"error": "消息内容不能为空"}) + return + } + + // 获取或创建会话 + sessionID := req.SessionID + if sessionID == "" { + userID := req.UserID + if userID == "" { + userID = c.GetString("user_id") + } + // 使用请求的 scene(为空则用默认) + session := h.runner.CreateSession(userID, req.Scene) + sessionID = session.ID + } + + // 执行 Agent 推理 + response, err := h.runner.Run(c.Request.Context(), sessionID, req.Message) + if err != nil { + c.JSON(500, gin.H{ + "error": "Agent 执行失败", + "detail": err.Error(), + }) + return + } + + session, _ := h.runner.GetSession(sessionID) + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "session_id": sessionID, + "response": response, + "history_len": len(session.History), + "status": session.Status, + }, + }) +} + +// GetSession 查看会话详情 +// +// GET /api/v1/agent/session/:id +func (h *AgentHandler) GetSession(c *gin.Context) { + id := c.Param("id") + session, ok := h.runner.GetSession(id) + if !ok { + c.JSON(404, gin.H{"error": "会话不存在"}) + return + } + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "id": session.ID, + "user_id": session.UserID, + "scene": session.Scene, + "status": session.Status, + "history": session.History, + "state": session.State, + "created_at": session.CreatedAt, + "updated_at": session.UpdatedAt, + }, + }) +} diff --git a/internal/handler/auth_handler.go b/internal/handler/auth_handler.go new file mode 100644 index 0000000..e5ae940 --- /dev/null +++ b/internal/handler/auth_handler.go @@ -0,0 +1,236 @@ +package handler + +import ( + "log" + "net/http" + "strings" + "sync" + "time" + + "tcm-agent/internal/config" + "tcm-agent/internal/middleware" + + "github.com/gin-gonic/gin" + "github.com/golang-jwt/jwt/v5" +) + +// ======================================================================== +// AuthHandler —— 独立管理前端(/admin SPA)的登录鉴权 +// ======================================================================== +// 暴露 3 个端点(前缀 /api/v1/auth): +// POST /login 账号+密码+固定验证码 → 签发 HS256 JWT(7 天) +// POST /refresh 带有效 token 换新 token(前端剩余有效期不足时静默续签) +// GET /profile 带 token 返回用户信息(前端启动时校验会话有效性) +// +// 设计要点: +// - 凭据来自 config.Panel(默认 liqi/qiqi991012/999999,config.yaml 可覆盖) +// - 签名密钥复用 middleware.JWTSecret(与业务 API 的 JWT 校验同一把钥匙, +// 所以登录发的 token 天然能过所有现有接口的鉴权) +// - 登录失败统一模糊报错(不区分账号错还是密码错,防枚举) +// - 防爆破:同 IP 连续失败 5 次锁 10 分钟(内存计数,重启清零,内网面板够用) +// ======================================================================== + +// panelTokenTTL 登录 token 有效期(7 天,前端会在剩余 <24h 时自动续签) +const panelTokenTTL = 7 * 24 * time.Hour + +// panelRole 面板管理员角色名(写进 JWT claims,profile 返回给前端展示) +const panelRole = "panel_admin" + +// 防爆破参数:同 IP 连续 maxLoginFails 次失败 → 锁定 loginLockDuration +const ( + maxLoginFails = 5 + loginLockDuration = 10 * time.Minute +) + +// loginFailEntry 单个 IP 的失败计数 +type loginFailEntry struct { + Count int // 连续失败次数 + LockUntil time.Time // 锁定截止时间(零值表示未锁定) + LastFail time.Time // 最后一次失败时间(做过期清理用) +} + +// AuthHandler 登录处理器 +type AuthHandler struct { + cfg *config.Config + mu sync.Mutex + fails map[string]*loginFailEntry // key=客户端 IP +} + +// NewAuthHandler 构造 +func NewAuthHandler(cfg *config.Config) *AuthHandler { + return &AuthHandler{cfg: cfg, fails: map[string]*loginFailEntry{}} +} + +// loginRequest 登录入参 +type loginRequest struct { + Username string `json:"username" binding:"required"` + Password string `json:"password" binding:"required"` + Captcha string `json:"captcha" binding:"required"` +} + +// Login 登录换 token +// POST /api/v1/auth/login +func (h *AuthHandler) Login(c *gin.Context) { + var req loginRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "请填写账号、密码和验证码"}) + return + } + + ip := c.ClientIP() + + // 先查锁定状态:锁定期内直接拒绝,不做凭据比对(省 CPU 也防继续试探) + if locked, remain := h.isLocked(ip); locked { + c.JSON(http.StatusOK, gin.H{"code": 429, "message": "失败次数过多,请 " + remain + " 后再试"}) + return + } + + panel := h.cfg.Panel + // 验证码 / 账号 / 密码全部比对;任何一项不对都返回同一句模糊报错(防枚举) + if strings.TrimSpace(req.Captcha) != panel.Captcha || + req.Username != panel.Username || + req.Password != panel.Password { + h.recordFail(ip) + log.Printf("[Auth] 登录失败 ip=%s username=%s", ip, req.Username) + c.JSON(http.StatusOK, gin.H{"code": 401, "message": "账号、密码或验证码错误"}) + return + } + + // 登录成功:清空该 IP 的失败计数 + h.clearFail(ip) + + token, expireAt, err := h.signToken(panel.Username) + if err != nil { + log.Printf("[Auth] 签发 token 失败: %v", err) + c.JSON(http.StatusOK, gin.H{"code": 500, "message": "签发凭证失败"}) + return + } + + log.Printf("[Auth] 登录成功 ip=%s username=%s", ip, panel.Username) + c.JSON(http.StatusOK, gin.H{"code": 200, "data": gin.H{ + "token": token, + "expire_at": expireAt, // unix 秒,前端据此判断何时续签 + "nick_name": panel.Username, // 顶栏展示 + "role_name": "面板管理员", + "role": panelRole, + }}) +} + +// Refresh 续签 token +// POST /api/v1/auth/refresh +// +// 必须带一个仍然有效的 JWT(中间件已校验并注入 user_id), +// 用旧 token 的身份签发一个全新 7 天 token。 +// 过期的 token 无法续签(中间件直接 401),需要重新登录。 +func (h *AuthHandler) Refresh(c *gin.Context) { + userID := c.GetString("user_id") + if userID == "" || c.GetString("auth_mode") != "jwt" { + // 走 SharedSecret / 口令进来的调用方没有"会话"概念,不支持续签 + c.JSON(http.StatusOK, gin.H{"code": 401, "message": "当前凭证不支持续签,请重新登录"}) + return + } + token, expireAt, err := h.signToken(userID) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": "续签失败"}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": gin.H{ + "token": token, + "expire_at": expireAt, + }}) +} + +// Profile 返回当前登录用户信息 +// GET /api/v1/auth/profile +// +// 前端启动时调用:能拿到数据说明 token 还有效,直接进面板;401 则跳登录页 +func (h *AuthHandler) Profile(c *gin.Context) { + userID := c.GetString("user_id") + if userID == "" || c.GetString("auth_mode") != "jwt" { + c.JSON(http.StatusOK, gin.H{"code": 401, "message": "会话无效,请重新登录"}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": gin.H{ + "username": userID, + "nick_name": userID, + "role": c.GetString("user_role"), + "role_name": "面板管理员", + }}) +} + +// signToken 签发面板 JWT +// +// claims:sub=用户名、role=panel_admin、iat/exp 标准字段。 +// 密钥与 middleware.Auth 校验用的是同一把(middleware.JWTSecret), +// 所以这个 token 能直接通过所有业务 API 的 JWT 鉴权路径。 +func (h *AuthHandler) signToken(username string) (string, int64, error) { + now := time.Now() + expireAt := now.Add(panelTokenTTL) + claims := jwt.MapClaims{ + "sub": username, + "role": panelRole, + "iat": now.Unix(), + "exp": expireAt.Unix(), + } + token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) + signed, err := token.SignedString([]byte(middleware.JWTSecret(h.cfg))) + if err != nil { + return "", 0, err + } + return signed, expireAt.Unix(), nil +} + +// ---------------------------- 防爆破(内存计数) ---------------------------- + +// isLocked 判断某 IP 是否处于锁定期,返回剩余时间的人类可读描述 +func (h *AuthHandler) isLocked(ip string) (bool, string) { + h.mu.Lock() + defer h.mu.Unlock() + entry, ok := h.fails[ip] + if !ok { + return false, "" + } + if entry.LockUntil.IsZero() || time.Now().After(entry.LockUntil) { + return false, "" + } + remain := time.Until(entry.LockUntil).Round(time.Second) + return true, remain.String() +} + +// recordFail 记录一次失败;达到阈值后设置锁定 +func (h *AuthHandler) recordFail(ip string) { + h.mu.Lock() + defer h.mu.Unlock() + + // 顺手清理超过 1 小时没动静的旧条目,防 map 无限膨胀 + cutoff := time.Now().Add(-time.Hour) + for k, v := range h.fails { + if v.LastFail.Before(cutoff) && (v.LockUntil.IsZero() || time.Now().After(v.LockUntil)) { + delete(h.fails, k) + } + } + + entry, ok := h.fails[ip] + if !ok { + entry = &loginFailEntry{} + h.fails[ip] = entry + } + // 锁定期已过则重新从 1 开始计数 + if !entry.LockUntil.IsZero() && time.Now().After(entry.LockUntil) { + entry.Count = 0 + entry.LockUntil = time.Time{} + } + entry.Count++ + entry.LastFail = time.Now() + if entry.Count >= maxLoginFails { + entry.LockUntil = time.Now().Add(loginLockDuration) + log.Printf("[Auth] IP %s 连续失败 %d 次,锁定至 %s", ip, entry.Count, entry.LockUntil.Format("15:04:05")) + } +} + +// clearFail 登录成功后清空该 IP 的失败计数 +func (h *AuthHandler) clearFail(ip string) { + h.mu.Lock() + defer h.mu.Unlock() + delete(h.fails, ip) +} diff --git a/internal/handler/emr_handler.go b/internal/handler/emr_handler.go new file mode 100644 index 0000000..82a8168 --- /dev/null +++ b/internal/handler/emr_handler.go @@ -0,0 +1,211 @@ +package handler + +import ( + "net/http" + "strconv" + "time" + + "tcm-agent/internal/agent" + "tcm-agent/internal/model/entity" + + "github.com/gin-gonic/gin" +) + +// ======================================================================== +// 病历 HTTP 接口处理器 +// ======================================================================== +// 职责链: +// HTTP 请求 → 参数校验 → 调用 Agent → 持久化 → 响应封装 +// ======================================================================== + +// EMRHandler 病历接口处理器 +type EMRHandler struct { + agentRunner *agent.Runner + emrAgent *agent.EMRGenerator +} + +// NewEMRHandler 创建病历处理器 +// +// 参数: +// +// runner - Agent 引擎 +// scene - 场景名(对应 config.yaml 中 routes 的 key) +// 为空则使用默认值 "emr-generator" +func NewEMRHandler(runner *agent.Runner, scene string) *EMRHandler { + return &EMRHandler{ + agentRunner: runner, + emrAgent: agent.NewEMRGenerator(runner, scene), + } +} + +// GenerateRequest 生成病历请求体 +type GenerateRequest struct { + PatientID string `json:"patient_id" binding:"required"` + ChiefComplaint string `json:"chief_complaint" binding:"required"` + HistoryNotes string `json:"history_notes"` + Allergies []string `json:"allergies"` + PastIllness []string `json:"past_illness"` +} + +// Generate 根据主诉+病史生成病历 +// +// POST /api/v1/emr/generate +// +// 完整生命周期: +// 1. 参数校验 +// 2. Agent 感知 → 规划 → 检索 → 工具 → 反思 → 输出 +// 3. 规则引擎质控 +// 4. 持久化到数据库 +// 5. 返回结构化响应 +func (h *EMRHandler) Generate(c *gin.Context) { + // ===== ① 参数校验 ===== + var req GenerateRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "error": "参数错误", + "detail": err.Error(), + "example": `{"patient_id":"P001","chief_complaint":"反复头晕3个月","history_notes":"...","allergies":[],"past_illness":[]}`, + }) + return + } + + doctorID := c.GetString("user_id") + + // ===== ②~⑤ 调用 Agent ===== + agentReq := &agent.EMRRequest{ + PatientID: req.PatientID, + ChiefComplaint: req.ChiefComplaint, + HistoryNotes: req.HistoryNotes, + Allergies: req.Allergies, + PastIllness: req.PastIllness, + } + + resp, err := h.emrAgent.Generate(c.Request.Context(), agentReq) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{ + "error": "病历生成失败", + "detail": err.Error(), + }) + return + } + + // ===== ⑥ 持久化 ===== + emr := &entity.EMR{ + PatientID: req.PatientID, + DoctorID: doctorID, + Draft: resp.Draft, + Structured: resp.Structured, + Status: resp.Status, + SessionID: resp.SessionID, + CreatedAt: time.Now(), + UpdatedAt: time.Now(), + } + // dao.EMR.Create(emr) // 实际项目取消注释 + + // ===== ⑦ 返回响应 ===== + c.JSON(http.StatusOK, gin.H{ + "code": 200, + "message": "病历生成成功", + "data": gin.H{ + "session_id": resp.SessionID, + "draft": resp.Draft, + "structured": resp.Structured, + "issues": resp.Issues, + "status": resp.Status, + "emr_id": emr.ID, + "next_action": getNextAction(resp.Status), + }, + }) +} + +// KnowledgeQA 病历书写规范问答 +// +// POST /api/v1/emr/qa +func (h *EMRHandler) KnowledgeQA(c *gin.Context) { + var req struct { + Question string `json:"question" binding:"required"` + } + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(400, gin.H{"error": "问题不能为空"}) + return + } + + answer, err := h.agentRunner.MaxKB().Chat(c.Request.Context(), req.Question) + if err != nil { + c.JSON(500, gin.H{"error": "知识库查询失败", "detail": err.Error()}) + return + } + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "question": req.Question, + "answer": answer, + "source": "MaxKB 知识库", + }, + }) +} + +// GetByID 查询病历详情 +// +// GET /api/v1/emr/:id +func (h *EMRHandler) GetByID(c *gin.Context) { + idStr := c.Param("id") + id, _ := strconv.ParseInt(idStr, 10, 64) + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "id": id, + "note": "实际项目从数据库查询", + }, + }) +} + +// Update 更新病历(医生人工修改后保存) +// +// PUT /api/v1/emr/:id +func (h *EMRHandler) Update(c *gin.Context) { + idStr := c.Param("id") + id, _ := strconv.ParseInt(idStr, 10, 64) + + var req struct { + Draft string `json:"draft"` + IsFinal bool `json:"is_final"` + } + c.ShouldBindJSON(&req) + + userID := c.GetString("user_id") + logAudit("emr_update", userID, idStr, req.Draft) + + c.JSON(200, gin.H{ + "code": 200, + "message": "病历已更新", + "data": gin.H{ + "id": id, + "is_final": req.IsFinal, + "updated_by": userID, + }, + }) +} + +// getNextAction 根据状态给出下一步建议 +func getNextAction(status string) string { + switch status { + case "success": + return "病历生成完成,请医生审核确认" + case "need_revision": + return "病历存在质控问题,请查看 issues 列表并修改" + default: + return "请检查输入信息是否完整" + } +} + +// logAudit 审计日志 +func logAudit(action, userID, targetID, detail string) { + // 实际项目:写入审计表 + _ = action + _ = userID + _ = targetID + _ = detail +} diff --git a/internal/handler/enhancer_handler.go b/internal/handler/enhancer_handler.go new file mode 100644 index 0000000..994cec0 --- /dev/null +++ b/internal/handler/enhancer_handler.go @@ -0,0 +1,100 @@ +package handler + +import ( + "net/http" + + "tcm-agent/internal/service" + + "github.com/gin-gonic/gin" +) + +// ======================================================================== +// EnhancerHandler —— 知识增强接口的 HTTP 处理器 +// ======================================================================== +// 对接 PHP 端的 TcmAgentClient,提供 POST /api/v1/agent/enhance 端点。 +// PHP 端拿到的响应里包含 content + steps,会把 steps 写入 xk_ai_generation_step。 +// ======================================================================== + +// EnhancerHandler 知识增强接口处理器 +type EnhancerHandler struct { + svc *service.EnhancerService +} + +// NewEnhancerHandler 构造函数 +func NewEnhancerHandler(svc *service.EnhancerService) *EnhancerHandler { + return &EnhancerHandler{svc: svc} +} + +// Enhance HTTP 入口 +// +// POST /api/v1/agent/enhance +// +// 请求体(与 service.EnhanceRequest 一致): +// +// { +// "scene": "medical_record", +// "context": "痰湿中阻 煎法", +// "messages": [ +// {"role": "system", "content": "..."}, +// {"role": "user", "content": "..."} +// ], +// "kb_enabled": true, +// "top_k": 5, +// "provider": "" // 空 = 按 scene 路由 +// } +// +// 响应: +// +// { +// "code": 200, +// "data": { +// "content": "...", +// "provider": "spark", +// "model": "spark-max", +// "steps": [...], +// "total_ms": 1234 +// } +// } +func (h *EnhancerHandler) Enhance(c *gin.Context) { + if h.svc == nil { + c.JSON(http.StatusServiceUnavailable, gin.H{ + "code": 503, + "message": "知识增强服务未初始化", + }) + return + } + + var req service.EnhanceRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 400, + "message": "参数错误: " + err.Error(), + }) + return + } + + // 校验:messages 至少 1 条 + if len(req.Messages) == 0 { + c.JSON(http.StatusBadRequest, gin.H{ + "code": 400, + "message": "messages 不能为空", + }) + return + } + + resp, err := h.svc.Enhance(c.Request.Context(), &req) + if err != nil { + // 业务失败:仍然把已收集的 steps 返回,让 PHP 能记录失败过程 + c.JSON(http.StatusOK, gin.H{ + "code": 500, + "message": err.Error(), + "data": resp, + }) + return + } + + c.JSON(http.StatusOK, gin.H{ + "code": 200, + "data": resp, + }) +} diff --git a/internal/handler/helpers.go b/internal/handler/helpers.go new file mode 100644 index 0000000..6353362 --- /dev/null +++ b/internal/handler/helpers.go @@ -0,0 +1,8 @@ +package handler + +import "errors" + +// errInvalidID 通用路径参数 id 非法错误 +// +// 各 handler 用 parseUintParam 统一返回这个错误 +var errInvalidID = errors.New("id 参数非法") diff --git a/internal/handler/history_handler.go b/internal/handler/history_handler.go new file mode 100644 index 0000000..4698e60 --- /dev/null +++ b/internal/handler/history_handler.go @@ -0,0 +1,101 @@ +package handler + +import ( + "net/http" + "strconv" + + "tcm-agent/internal/dao" + + "github.com/gin-gonic/gin" +) + +// ======================================================================== +// HistoryHandler —— AI 生成历史(DB 长期数据)只读查询 +// ======================================================================== +// 暴露 3 个端点(前缀 /api/v1/agent): +// GET /history 分页列表(场景/状态/via_agent/供应商/日期筛选) +// GET /history/:id 单条详情 + 步骤时间线 +// GET /history/scenes 出现过的场景列表(前端筛选下拉) +// +// 与 /agent/runs 的区别: +// - runs:内存环形缓冲,最近 200 条,含守卫拦截等"没到 PHP"的运行,重启清零 +// - history:读 PHP 落库的 xk_ai_generation(_step),长期审计视角,只读 +// ======================================================================== + +// HistoryHandler 历史查询处理器 +type HistoryHandler struct{} + +// NewHistoryHandler 构造 +func NewHistoryHandler() *HistoryHandler { + return &HistoryHandler{} +} + +// List 分页查询历史 +// GET /api/v1/agent/history?page=1&size=20&scene=&status=-1&via_agent=-1&provider=&date_start=0&date_end=0 +func (h *HistoryHandler) List(c *gin.Context) { + filter := dao.AIGenerationListFilter{ + Page: queryInt(c, "page", 1), + Size: queryInt(c, "size", 20), + Scene: c.Query("scene"), + Status: queryInt(c, "status", -1), + ViaAgent: queryInt(c, "via_agent", -1), + Provider: c.Query("provider"), + } + filter.DateStart = int64(queryInt(c, "date_start", 0)) + filter.DateEnd = int64(queryInt(c, "date_end", 0)) + + rows, total, err := dao.AIGenerationList(filter) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": gin.H{ + "list": rows, + "total": total, + "page": filter.Page, + "size": filter.Size, + }}) +} + +// Detail 单条详情 + 步骤 +// GET /api/v1/agent/history/:id +func (h *HistoryHandler) Detail(c *gin.Context) { + id, err := strconv.ParseUint(c.Param("id"), 10, 64) + if err != nil || id == 0 { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "id 参数无效"}) + return + } + row, steps, err := dao.AIGenerationGet(uint(id)) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 404, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": gin.H{ + "generation": row, + "steps": steps, + }}) +} + +// Scenes 场景下拉数据 +// GET /api/v1/agent/history/scenes +func (h *HistoryHandler) Scenes(c *gin.Context) { + scenes, err := dao.AIGenerationScenes() + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": scenes}) +} + +// queryInt 读取整型 query 参数,缺失或非法时返回默认值 +func queryInt(c *gin.Context, key string, def int) int { + v := c.Query(key) + if v == "" { + return def + } + n, err := strconv.Atoi(v) + if err != nil { + return def + } + return n +} diff --git a/internal/handler/kb_admin_handler.go b/internal/handler/kb_admin_handler.go new file mode 100644 index 0000000..ce90a0f --- /dev/null +++ b/internal/handler/kb_admin_handler.go @@ -0,0 +1,397 @@ +package handler + +import ( + "io" + "log" + "net/http" + "strconv" + + "tcm-agent/internal/kb" + + "github.com/gin-gonic/gin" +) + +// ======================================================================== +// KBAdminHandler —— 本地知识库后台管理 API +// ======================================================================== +// 暴露 9 个端点(前缀 /api/v1/kb/admin): +// +// 库管理: +// GET /libraries 列出所有库(含禁用的) +// GET /libraries/:id 取单个库详情 +// POST /libraries 创建库 +// DELETE /libraries/:id 软删除库(连带文档+分段) +// +// 文档管理: +// GET /libraries/:id/docs 列出某库下所有文档 +// POST /docs/import 导入文档(multipart 上传文件) +// GET /docs/:id 取文档详情 +// DELETE /docs/:id 软删除文档(连带分段) +// +// 分段管理: +// GET /docs/:id/chunks 列出某文档的分段 +// +// 工具: +// POST /search 检索测试(前端"试一试"按钮用) +// POST /embed 【V2 预留】触发批量向量化,V1 返回"未启用" +// ======================================================================== + +// KBAdminHandler 后台管理处理器 +type KBAdminHandler struct { + libSvc *kb.LibraryService + searcher *kb.Searcher +} + +// NewKBAdminHandler 构造 +func NewKBAdminHandler(libSvc *kb.LibraryService, searcher *kb.Searcher) *KBAdminHandler { + return &KBAdminHandler{libSvc: libSvc, searcher: searcher} +} + +// ---------------------------- 库管理 ---------------------------- + +// ListLibraries 列出所有库 +// GET /api/v1/kb/admin/libraries +func (h *KBAdminHandler) ListLibraries(c *gin.Context) { + rows, err := h.libSvc.ListLibraries(c.Request.Context()) + if err != nil { + // 关键:把错误打到日志,方便后端排查(DB 未连/表不存在/SQL 语法错都会在这里暴露) + log.Printf("[KB] ListLibraries 失败: %v", err) + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": rows}) +} + +// GetLibrary 取单个库详情 +// GET /api/v1/kb/admin/libraries/:id +func (h *KBAdminHandler) GetLibrary(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + row, err := h.libSvc.GetLibrary(c.Request.Context(), id) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 404, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": row}) +} + +// CreateLibrary 创建库 +// POST /api/v1/kb/admin/libraries +// +// Body: kb.CreateLibraryInput +func (h *KBAdminHandler) CreateLibrary(c *gin.Context) { + var in kb.CreateLibraryInput + if err := c.ShouldBindJSON(&in); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "参数错误: " + err.Error()}) + return + } + row, err := h.libSvc.CreateLibrary(c.Request.Context(), in) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": row}) +} + +// DeleteLibrary 软删除库(连带文档+分段) +// DELETE /api/v1/kb/admin/libraries/:id +func (h *KBAdminHandler) DeleteLibrary(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + if err := h.libSvc.DeleteLibrary(c.Request.Context(), id); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "message": "删除成功"}) +} + +// ---------------------------- 文档管理 ---------------------------- + +// ListDocs 列出某库下的文档 +// GET /api/v1/kb/admin/libraries/:id/docs +func (h *KBAdminHandler) ListDocs(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + rows, err := h.libSvc.ListDocs(c.Request.Context(), id) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": rows}) +} + +// ImportDocument 导入文档 +// POST /api/v1/kb/admin/docs/import +// +// 表单字段: +// library_id (必填, form 字段) +// title (可选, form 字段,自定义文档标题) +// file (必填, multipart 文件) +// max_len (可选, form 字段,自定义分段最大长度 100~2000,缺省 500) +// overlap (可选, form 字段,自定义分段重叠 0~500,缺省 50) +// +// 支持 .xlsx / .xls / .csv / .md / .txt / .pdf / .docx / .html, +// 具体解析与自动分段规则见 kb.ParseFileFromBytes +func (h *KBAdminHandler) ImportDocument(c *gin.Context) { + libraryIDStr := c.PostForm("library_id") + libraryID, err := strconv.ParseUint(libraryIDStr, 10, 64) + if err != nil || libraryID == 0 { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "library_id 不能为空"}) + return + } + title := c.PostForm("title") + + // 自定义分段参数:解析失败或未传时用哨兵值(max_len=0 / overlap=-1 表示"用默认") + // overlap 不能用 0 当哨兵——0 是合法值(不重叠),语义与"没传"不同 + maxLen := 0 + if v := c.PostForm("max_len"); v != "" { + if n, e := strconv.Atoi(v); e == nil { + maxLen = n + } + } + overlap := -1 + if v := c.PostForm("overlap"); v != "" { + if n, e := strconv.Atoi(v); e == nil { + overlap = n + } + } + + fileHeader, err := c.FormFile("file") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "请上传文件: " + err.Error()}) + return + } + // 限制文件大小 50MB(中医知识库单文件不会超过这个) + if fileHeader.Size > 50*1024*1024 { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "文件过大(最大 50MB)"}) + return + } + file, err := fileHeader.Open() + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": "打开上传文件失败: " + err.Error()}) + return + } + defer file.Close() + + // 读全部字节:必须用 io.ReadFull 而不是单次 file.Read—— + // 大文件(>32MB)multipart 会落磁盘临时文件,单次 Read 不保证读满缓冲区, + // 读不满会导致导入的内容被截断 + buf := make([]byte, fileHeader.Size) + if _, err := io.ReadFull(file, buf); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": "读取上传文件失败: " + err.Error()}) + return + } + + result, err := h.libSvc.ImportDocument(c.Request.Context(), kb.ImportDocInput{ + LibraryID: uint(libraryID), + Filename: fileHeader.Filename, + Content: buf, + Title: title, + MaxLen: maxLen, + Overlap: overlap, + }) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": result}) +} + +// GetDoc 取文档详情 +// GET /api/v1/kb/admin/docs/:id +func (h *KBAdminHandler) GetDoc(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + row, err := h.libSvc.GetDoc(c.Request.Context(), id) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 404, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": row}) +} + +// DeleteDoc 软删除文档(连带分段) +// DELETE /api/v1/kb/admin/docs/:id +func (h *KBAdminHandler) DeleteDoc(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + if err := h.libSvc.DeleteDoc(c.Request.Context(), id); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "message": "删除成功"}) +} + +// ---------------------------- 分段管理 ---------------------------- + +// ListChunks 列出文档的分段 +// GET /api/v1/kb/admin/docs/:id/chunks +func (h *KBAdminHandler) ListChunks(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + rows, err := h.libSvc.ListChunks(c.Request.Context(), id) + if err != nil { + log.Printf("[KB] ListChunks 失败: %v", err) + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": rows}) +} + +// UpdateChunk 编辑分段 +// PUT /api/v1/kb/admin/chunks/:id +// +// Body: kb.UpdateChunkInput +// { "title": "...", "content": "...", "related_questions": ["问题1","问题2"] } +// +// 三个字段都可选,传啥改啥;related_questions 传空数组表示清空关联问题 +func (h *KBAdminHandler) UpdateChunk(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + var in kb.UpdateChunkInput + if err := c.ShouldBindJSON(&in); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "参数错误: " + err.Error()}) + return + } + // 内容不能为空(标题可空);例外:只带 is_active 的启停开关调用不改内容,放行 + if in.Content == "" && in.IsActive == nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "content 不能为空"}) + return + } + updated, err := h.libSvc.UpdateChunk(c.Request.Context(), id, in) + if err != nil { + log.Printf("[KB] UpdateChunk 失败 id=%d: %v", id, err) + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": updated, "message": "已保存"}) +} + +// BatchUpdateChunks 批量启用/禁用/删除分段 +// PUT /api/v1/kb/admin/chunks/batch +// +// Body: { "ids": [1,2,3], "action": "enable|disable|delete" } +// +// 管理前端的分段多选批量操作入口;事务原子性由 DAO 保证 +func (h *KBAdminHandler) BatchUpdateChunks(c *gin.Context) { + var in kb.BatchChunkInput + if err := c.ShouldBindJSON(&in); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "参数错误: " + err.Error()}) + return + } + affected, err := h.libSvc.BatchUpdateChunks(c.Request.Context(), in) + if err != nil { + log.Printf("[KB] BatchUpdateChunks 失败 action=%s ids=%d: %v", in.Action, len(in.IDs), err) + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": gin.H{"affected": affected}, "message": "操作成功"}) +} + +// RechunkDocument 用新参数对文档重新分段 +// POST /api/v1/kb/admin/docs/:id/rechunk +// +// Body: { "max_len": 500, "overlap": 50 }(0/-1 表示用默认值) +// +// 用 xk_kb_doc.content 存的原文重切,旧分段软删、新分段插入(事务)。 +// 注意:人工编辑过的分段内容会被覆盖,前端调用前必须二次确认 +func (h *KBAdminHandler) RechunkDocument(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + var in kb.RechunkInput + // body 可以整个不传(全用默认参数),绑定失败不视为错误 + if err := c.ShouldBindJSON(&in); err != nil { + in = kb.RechunkInput{MaxLen: 0, Overlap: -1} + } + result, err := h.libSvc.RechunkDocument(c.Request.Context(), id, in) + if err != nil { + log.Printf("[KB] RechunkDocument 失败 id=%d: %v", id, err) + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": result, "message": "重新分段完成"}) +} + +// ---------------------------- 工具 ---------------------------- + +// KBSearchRequest 检索测试入参 +type KBSearchRequest struct { + LibraryID uint `json:"library_id" binding:"required"` + Query string `json:"query" binding:"required"` + TopK int `json:"top_k"` + Mode string `json:"mode"` +} + +// Search 检索测试 +// POST /api/v1/kb/admin/search +// +// V1 返回 FULLTEXT 得分;V2 接入向量后支持 mode=vector/blend +func (h *KBAdminHandler) Search(c *gin.Context) { + var req KBSearchRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "参数错误: " + err.Error()}) + return + } + results, err := h.searcher.Search(c.Request.Context(), kb.SearchOptions{ + LibraryID: req.LibraryID, + Query: req.Query, + TopK: req.TopK, + Mode: req.Mode, + }) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": results}) +} + +// EmbedRequest 触发向量化入参(V2 用) +type EmbedRequest struct { + LibraryID uint `json:"library_id" binding:"required"` +} + +// Embed 【V2 预留】触发批量向量化 +// POST /api/v1/kb/admin/embed +// +// V1 始终返回"未启用",前端展示对应提示 +func (h *KBAdminHandler) Embed(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{ + "code": 501, + "message": "向量化功能 V2 才支持(当前 NoopEmbedder 未启用)。请保持 search_mode=fulltext。", + }) +} + +// ---------------------------- 工具函数 ---------------------------- + +// parseUintParam 解析路径参数 :id 为 uint +func parseUintParam(c *gin.Context, key string) (uint, error) { + v, err := strconv.ParseUint(c.Param(key), 10, 64) + if err != nil || v == 0 { + return 0, errInvalidID + } + return uint(v), nil +} diff --git a/internal/handler/kb_crawl_handler.go b/internal/handler/kb_crawl_handler.go new file mode 100644 index 0000000..312649c --- /dev/null +++ b/internal/handler/kb_crawl_handler.go @@ -0,0 +1,237 @@ +package handler + +import ( + "net/http" + "strconv" + + "tcm-agent/internal/crawler" + "tcm-agent/internal/dao" + "tcm-agent/internal/service" + + "github.com/gin-gonic/gin" +) + +// ======================================================================== +// KBCrawlHandler —— 药品抓取任务管理 API +// ======================================================================== +// 暴露 7 个端点(前缀 /api/v1/kb/admin/crawl,复用 KB 管理鉴权: +// 口令头或面板 JWT 均可): +// +// GET /sources 可用抓取源列表(前端下拉) +// GET /tasks 任务列表(含实时 running 标记) +// POST /tasks 创建任务 +// PUT /tasks/:id 更新任务(名称/目标库/调度/限量/启停) +// DELETE /tasks/:id 软删除任务 +// POST /tasks/:id/run 立即抓取(异步,立即返回) +// GET /tasks/:id/logs 任务运行历史(最近 N 条) +// ======================================================================== + +// KBCrawlHandler 抓取任务处理器(无状态,直接调 dao/service) +type KBCrawlHandler struct{} + +// NewKBCrawlHandler 构造 +func NewKBCrawlHandler() *KBCrawlHandler { return &KBCrawlHandler{} } + +// ListSources 可用抓取源 +// GET /api/v1/kb/admin/crawl/sources +func (h *KBCrawlHandler) ListSources(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{"code": 200, "data": crawler.ListSources()}) +} + +// ListTasks 任务列表 +// GET /api/v1/kb/admin/crawl/tasks +// +// 每行附加 running 字段(内存实时状态)——DB 的 last_status 有落库延迟, +// 前端旋转图标要跟内存状态走 +func (h *KBCrawlHandler) ListTasks(c *gin.Context) { + rows, err := dao.KBCrawlTaskList() + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + out := make([]gin.H, 0, len(rows)) + for _, t := range rows { + out = append(out, gin.H{ + "id": t.ID, "name": t.Name, "source": t.Source, + "library_id": t.LibraryID, "schedule_type": t.ScheduleType, + "interval_hours": t.IntervalHours, "run_at_hour": t.RunAtHour, + "run_at_weekday": t.RunAtWeekday, "items_per_run": t.ItemsPerRun, + "progress_offset": t.ProgressOffset, "status": t.Status, + "last_run_at": t.LastRunAt, "last_status": t.LastStatus, + "last_message": t.LastMessage, "created_at": t.CreatedAt, + "running": service.CrawlTaskRunning(t.ID), + }) + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": out}) +} + +// crawlTaskRequest 创建/更新任务的入参 +type crawlTaskRequest struct { + Name string `json:"name"` + Source string `json:"source"` + LibraryID uint `json:"library_id"` + ScheduleType string `json:"schedule_type"` + IntervalHours int `json:"interval_hours"` + RunAtHour int `json:"run_at_hour"` + RunAtWeekday int `json:"run_at_weekday"` + ItemsPerRun int `json:"items_per_run"` + Status *int `json:"status"` // 指针区分"没传"和"传了 0(禁用)" +} + +// normalize 归一化 + 校验入参(创建和更新共用) +func (r *crawlTaskRequest) normalize() string { + if r.Name == "" { + return "任务名称不能为空" + } + if r.Source == "" { + r.Source = "zhongyoo" + } + if _, ok := crawler.GetSource(r.Source); !ok { + return "抓取源不存在: " + r.Source + } + if r.LibraryID == 0 { + return "请选择目标知识库" + } + switch r.ScheduleType { + case "", "manual": + r.ScheduleType = "manual" + case "interval": + if r.IntervalHours < 1 { + r.IntervalHours = 24 + } + case "daily", "weekly": + if r.RunAtHour < 0 || r.RunAtHour > 23 { + r.RunAtHour = 3 + } + if r.RunAtWeekday < 0 || r.RunAtWeekday > 6 { + r.RunAtWeekday = 1 + } + default: + return "调度类型不合法: " + r.ScheduleType + } + if r.ItemsPerRun < 1 || r.ItemsPerRun > 500 { + r.ItemsPerRun = 50 + } + return "" +} + +// CreateTask 创建任务 +// POST /api/v1/kb/admin/crawl/tasks +func (h *KBCrawlHandler) CreateTask(c *gin.Context) { + var req crawlTaskRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "参数格式错误: " + err.Error()}) + return + } + if msg := req.normalize(); msg != "" { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": msg}) + return + } + // 目标库必须真实存在(防手滑填错 ID,跑的时候才发现) + if _, err := dao.KBGetLibrary(req.LibraryID); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "目标知识库不存在,请先在知识库管理里创建"}) + return + } + row := &dao.KBCrawlTaskRow{ + Name: req.Name, Source: req.Source, LibraryID: req.LibraryID, + ScheduleType: req.ScheduleType, IntervalHours: req.IntervalHours, + RunAtHour: req.RunAtHour, RunAtWeekday: req.RunAtWeekday, + ItemsPerRun: req.ItemsPerRun, Status: 1, + } + if err := dao.KBCrawlTaskCreate(row); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": row, "message": "任务已创建"}) +} + +// UpdateTask 更新任务 +// PUT /api/v1/kb/admin/crawl/tasks/:id +func (h *KBCrawlHandler) UpdateTask(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + var req crawlTaskRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "参数格式错误: " + err.Error()}) + return + } + if msg := req.normalize(); msg != "" { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": msg}) + return + } + if _, err := dao.KBGetLibrary(req.LibraryID); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "目标知识库不存在"}) + return + } + fields := map[string]any{ + "name": req.Name, "source": req.Source, "library_id": req.LibraryID, + "schedule_type": req.ScheduleType, "interval_hours": req.IntervalHours, + "run_at_hour": req.RunAtHour, "run_at_weekday": req.RunAtWeekday, + "items_per_run": req.ItemsPerRun, + } + if req.Status != nil { + fields["status"] = *req.Status + } + if err := dao.KBCrawlTaskUpdate(id, fields); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "message": "任务已更新"}) +} + +// DeleteTask 软删除任务 +// DELETE /api/v1/kb/admin/crawl/tasks/:id +func (h *KBCrawlHandler) DeleteTask(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + if service.CrawlTaskRunning(id) { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": "任务正在运行中,等本次跑完再删除"}) + return + } + if err := dao.KBCrawlTaskDelete(id); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "message": "任务已删除"}) +} + +// RunTask 立即抓取(异步触发) +// POST /api/v1/kb/admin/crawl/tasks/:id/run +func (h *KBCrawlHandler) RunTask(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + if err := service.TriggerCrawlTask(id, "manual"); err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{ + "code": 200, + "message": "抓取已在后台启动,可在运行历史里查看进度(每批约需 1-3 分钟)", + }) +} + +// ListLogs 任务运行历史 +// GET /api/v1/kb/admin/crawl/tasks/:id/logs?limit=20 +func (h *KBCrawlHandler) ListLogs(c *gin.Context) { + id, err := parseUintParam(c, "id") + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 400, "message": err.Error()}) + return + } + limit, _ := strconv.Atoi(c.DefaultQuery("limit", "20")) + rows, err := dao.KBCrawlLogList(id, limit) + if err != nil { + c.JSON(http.StatusOK, gin.H{"code": 500, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"code": 200, "data": rows}) +} diff --git a/internal/handler/knowledge_handler.go b/internal/handler/knowledge_handler.go new file mode 100644 index 0000000..f75c583 --- /dev/null +++ b/internal/handler/knowledge_handler.go @@ -0,0 +1,94 @@ +package handler + +import ( + "tcm-agent/internal/agent" + + "github.com/gin-gonic/gin" +) + +// KnowledgeHandler 知识库接口处理器 +// 提供:检索知识库、上传文档等能力 +type KnowledgeHandler struct { + agentRunner *agent.Runner +} + +// NewKnowledgeHandler 创建知识库处理器 +func NewKnowledgeHandler(runner *agent.Runner) *KnowledgeHandler { + return &KnowledgeHandler{agentRunner: runner} +} + +// SearchRequest 知识检索请求 +type SearchRequest struct { + Query string `json:"query" binding:"required"` // 检索关键词 + TopK int `json:"top_k"` // 返回条数(默认5) +} + +// Search 检索知识库 +// POST /api/v1/knowledge/search +// +// 直接调用MaxKB的RAG检索能力 +// 用于:查询方剂组成、药典条目、诊疗规范等 +func (h *KnowledgeHandler) Search(c *gin.Context) { + var req SearchRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(400, gin.H{"error": "查询关键词不能为空"}) + return + } + + if req.TopK <= 0 { + req.TopK = 5 + } + + // 调用MaxKB检索 + answer, err := h.agentRunner.MaxKB().Chat(c.Request.Context(), req.Query) + if err != nil { + c.JSON(500, gin.H{ + "error": "知识库检索失败", + "detail": err.Error(), + }) + return + } + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "query": req.Query, + "answer": answer, + "source": "MaxKB RAG", + "top_k": req.TopK, + }, + }) +} + +// IngestRequest 文档上传请求 +type IngestRequest struct { + Title string `json:"title" binding:"required"` // 文档标题 + Content string `json:"content" binding:"required"` // 文档内容 + Category string `json:"category"` // 分类(方剂/药典/指南/病历模板) +} + +// Ingest 上传文档到知识库 +// POST /api/v1/knowledge/ingest +// +// 将文档写入MaxKB知识库,触发自动向量化 +// 支持后续RAG检索 +func (h *KnowledgeHandler) Ingest(c *gin.Context) { + var req IngestRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(400, gin.H{"error": "标题和内容不能为空"}) + return + } + + // 实际项目中调用MaxKB的文档上传API + // 这里返回模拟成功 + c.JSON(200, gin.H{ + "code": 200, + "message": "文档已加入知识库队列", + "data": gin.H{ + "title": req.Title, + "category": req.Category, + "status": "pending_vectorization", + "note": "实际项目请调用MaxKB文档上传API", + }, + }) +} diff --git a/internal/handler/observe_handler.go b/internal/handler/observe_handler.go new file mode 100644 index 0000000..7701fe2 --- /dev/null +++ b/internal/handler/observe_handler.go @@ -0,0 +1,194 @@ +package handler + +// ======================================================================== +// ObserveHandler —— /agent/view 面板观测与调试接口 +// ======================================================================== +// 端点清单(全部走全局 Auth,无放行): +// GET /api/v1/agent/logs 增量日志(内存环形缓冲) +// GET /api/v1/agent/system 进程运行时状态 +// GET /api/v1/agent/config Agent 配置只读视图(含守卫词表) +// POST /api/v1/agent/guard-test 医疗守卫测试台 +// POST /api/v1/agent/kb-test 知识库检索测试 +// POST /api/v1/models/test 模型连通性测试(注册在 modelGroup) +// +// 安全边界: +// - 全部只读或无持久副作用(ModelTest 消耗少量 token) +// - 日志可能含 PHI(debug 开关打开时),logs 接口必须有 Auth +// - config 视图不返回任何密钥(EmbeddingAPIKey 等一律不出) +// ======================================================================== + +import ( + "runtime" + "strconv" + "time" + + "tcm-agent/internal/agentcfg" + "tcm-agent/internal/service" + + "github.com/gin-gonic/gin" +) + +// ObserveHandler 观测接口处理器 +type ObserveHandler struct { + enhancer *service.EnhancerService // 复用 enhance 同款检索/模型解析逻辑 + startedAt time.Time // 进程启动时间(算 uptime) +} + +// NewObserveHandler 构造函数(router.Setup 启动时创建一次) +func NewObserveHandler(enhancer *service.EnhancerService) *ObserveHandler { + return &ObserveHandler{ + enhancer: enhancer, + startedAt: time.Now(), + } +} + +// Logs 增量拉取内存日志 +// +// GET /api/v1/agent/logs?since_id=0&limit=200 +// 面板首次加载 since_id=0 全量拉,之后带上一次返回的最大 ID 增量拉 +func (h *ObserveHandler) Logs(c *gin.Context) { + sinceID, _ := strconv.ParseInt(c.DefaultQuery("since_id", "0"), 10, 64) + limit, _ := strconv.Atoi(c.DefaultQuery("limit", "200")) + entries := service.MemLog.List(sinceID, limit) + // 返回最大 ID 作为下次轮询游标(无新日志时沿用请求值) + lastID := sinceID + if len(entries) > 0 { + lastID = entries[len(entries)-1].ID + } + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "entries": entries, + "last_id": lastID, + }, + }) +} + +// System 进程运行时状态 +// +// GET /api/v1/agent/system +// 面板「系统状态」Tab 5s 轮询,全部从 runtime 取,零外部依赖 +func (h *ObserveHandler) System(c *gin.Context) { + var ms runtime.MemStats + runtime.ReadMemStats(&ms) + + concUsed, concCap := service.GetConcurrency() + runUsed, runCap := service.RunLogUsage() + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "started_at": h.startedAt.Unix(), + "uptime_seconds": int64(time.Since(h.startedAt).Seconds()), + "go_version": runtime.Version(), + "goroutines": runtime.NumGoroutine(), + // 内存三个关键指标:堆占用 / 累计分配 / 从 OS 拿到的总量 + "heap_alloc_mb": float64(ms.HeapAlloc) / 1024 / 1024, + "sys_mb": float64(ms.Sys) / 1024 / 1024, + "num_gc": ms.NumGC, + // enhance 并发状态(信号量探针) + "enhance_concurrency": gin.H{"used": concUsed, "capacity": concCap}, + // RunLog 缓冲占用 + "runlog_usage": gin.H{"used": runUsed, "capacity": runCap}, + }, + }) +} + +// Config Agent 配置只读视图 +// +// GET /api/v1/agent/config +// 数据来自 agentcfg.Get()(xk_system_config 实时加载,30s 缓存)+ 守卫词表。 +// 面板只展示不修改——开关的写入口统一在 PHP 后台,避免双写 +func (h *ObserveHandler) Config(c *gin.Context) { + cfg := agentcfg.Get() + white, black := service.MedicalGuardKeywords() + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "react": gin.H{ + "enabled": cfg.ReAct.Enabled, + "max_iterations": cfg.ReAct.MaxIterations, + "planning_enabled": cfg.ReAct.PlanningEnabled, + "reflection_enabled": cfg.ReAct.ReflectionEnabled, + "json_repair_enabled": cfg.ReAct.JSONRepairEnabled, + }, + "token_budget": gin.H{ + "enabled": cfg.TokenBudget.Enabled, + "per_request": cfg.TokenBudget.PerRequest, + "max_tokens_per_call": cfg.TokenBudget.MaxTokensPerCall, + }, + "kb": gin.H{ + "source": cfg.KB.Source, + "embedding_provider": cfg.KB.EmbeddingProvider, + "top_k": cfg.KB.TopK, + "search_mode": cfg.KB.SearchMode, + }, + "medical_guard": gin.H{ + "enabled": cfg.MedicalGuard.Enabled, + "whitelist": white, + "blacklist": black, + }, + "debug": gin.H{ + "log_request_body": cfg.Debug.LogRequestBody, + }, + }, + }) +} + +// GuardTest 医疗守卫测试台 +// +// POST /api/v1/agent/guard-test body: {"text": "..."} +// 用与 Enhance 入口完全相同的守卫逻辑跑一遍给定文本 +func (h *ObserveHandler) GuardTest(c *gin.Context) { + var req struct { + Text string `json:"text" binding:"required"` + } + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(400, gin.H{"code": 400, "message": "text 必填"}) + return + } + result := service.GuardTest(req.Text) + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "passed": result.Passed, + "reason": result.Reason, + "hit_whitelist": result.HitWhitelist, + "hit_blacklist": result.HitBlacklist, + }, + }) +} + +// KBTest 知识库检索测试 +// +// POST /api/v1/agent/kb-test body: {"query": "...", "top_k": 5} +// 走 enhance 主流程同款检索路径(含 ai_kb_source 分流), +// 回答「Agent 实际会检索到什么」 +func (h *ObserveHandler) KBTest(c *gin.Context) { + var req struct { + Query string `json:"query" binding:"required"` + TopK int `json:"top_k"` + } + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(400, gin.H{"code": 400, "message": "query 必填"}) + return + } + result := h.enhancer.KBTest(c.Request.Context(), req.Query, req.TopK) + c.JSON(200, gin.H{"code": 200, "data": result}) +} + +// ModelTest 模型连通性测试 +// +// POST /api/v1/models/test body: {"provider": "", "message": ""} +// provider 留空 = 测当前生效配置;会真实调一次 LLM(max_tokens 64) +func (h *ObserveHandler) ModelTest(c *gin.Context) { + var req struct { + Provider string `json:"provider"` + Message string `json:"message"` + } + // body 可以整个为空(全默认),解析失败也不阻断 + _ = c.ShouldBindJSON(&req) + result := h.enhancer.ModelTest(c.Request.Context(), req.Provider, req.Message) + c.JSON(200, gin.H{"code": 200, "data": result}) +} diff --git a/internal/handler/prescription_handler.go b/internal/handler/prescription_handler.go new file mode 100644 index 0000000..afc4b35 --- /dev/null +++ b/internal/handler/prescription_handler.go @@ -0,0 +1,252 @@ +package handler + +import ( + "net/http" + "strconv" + "time" + + "tcm-agent/internal/agent" + "tcm-agent/internal/model/entity" + + "github.com/gin-gonic/gin" +) + +// ======================================================================== +// 处方 HTTP 接口处理器 +// ======================================================================== +// 职责链: +// HTTP 请求 → 参数校验 → 调用 Agent → 规则校验 → 持久化 → 响应 +// ======================================================================== + +// PrescriptionHandler 处方接口处理器 +type PrescriptionHandler struct { + agentRunner *agent.Runner + rxAgent *agent.PrescriptionGenerator +} + +// NewPrescriptionHandler 创建处方处理器 +// +// 参数: +// +// runner - Agent 引擎 +// scene - 场景名(为空则使用默认值 "prescription") +func NewPrescriptionHandler(runner *agent.Runner, scene string) *PrescriptionHandler { + return &PrescriptionHandler{ + agentRunner: runner, + rxAgent: agent.NewPrescriptionGenerator(runner, scene), + } +} + +// PrescriptionGenerateRequest 处方生成请求体(避免与 emr_handler.GenerateRequest 重名) +type PrescriptionGenerateRequest struct { + PatientID string `json:"patient_id" binding:"required"` + EMRText string `json:"emr_text" binding:"required"` + Diagnosis string `json:"diagnosis" binding:"required"` + Age int `json:"age"` + IsPregnant bool `json:"is_pregnant"` + Allergies []string `json:"allergies"` +} + +// Generate 根据病历生成处方 +// +// POST /api/v1/prescription/generate +func (h *PrescriptionHandler) Generate(c *gin.Context) { + // ===== ① 参数校验 ===== + var req PrescriptionGenerateRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "error": "参数错误", + "detail": err.Error(), + "example": `{"patient_id":"P001","emr_text":"...","diagnosis":"痰湿中阻证","age":45,"is_pregnant":false,"allergies":[]}`, + }) + return + } + + doctorID := c.GetString("user_id") + + // ===== ②~⑤ 调用 Agent ===== + agentReq := &agent.PrescriptionRequest{ + PatientID: req.PatientID, + EMRText: req.EMRText, + Diagnosis: req.Diagnosis, + Age: req.Age, + IsPregnant: req.IsPregnant, + Allergies: req.Allergies, + } + + resp, err := h.rxAgent.Generate(c.Request.Context(), agentReq) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{ + "error": "处方生成失败", + "detail": err.Error(), + }) + return + } + + // ===== ⑥ 持久化 ===== + rx := &entity.Prescription{ + PatientID: req.PatientID, + DoctorID: doctorID, + SessionID: resp.SessionID, + Draft: resp.Draft, + Status: resp.Status, + Blocked: resp.Blocked, + Warnings: sliceToJSON(resp.Warnings), + CreatedAt: time.Now(), + UpdatedAt: time.Now(), + } + // dao.Prescription.Create(rx) + + // ===== ⑦ 返回响应 ===== + httpStatus := http.StatusOK + if resp.Blocked { + httpStatus = http.StatusConflict // 409 + } + + c.JSON(httpStatus, gin.H{ + "code": httpStatus, + "message": getPrescriptionMessage(resp.Status), + "data": gin.H{ + "session_id": resp.SessionID, + "prescription": resp.Prescription, + "draft": resp.Draft, + "warnings": resp.Warnings, + "blocked": resp.Blocked, + "status": resp.Status, + "rx_id": rx.ID, + "next_action": getPrescriptionNextAction(resp.Status), + }, + }) +} + +// Validate 仅校验处方(不生成) +// +// POST /api/v1/prescription/validate +func (h *PrescriptionHandler) Validate(c *gin.Context) { + var req struct { + PrescriptionText string `json:"prescription_text" binding:"required"` + PatientID string `json:"patient_id"` + IsPregnant bool `json:"is_pregnant"` + Allergies []string `json:"allergies"` + } + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(400, gin.H{"error": "处方文本不能为空"}) + return + } + + agentReq := &agent.PrescriptionRequest{ + PatientID: req.PatientID, + IsPregnant: req.IsPregnant, + Allergies: req.Allergies, + } + warnings, blocked := h.rxAgent.Validate(c.Request.Context(), req.PrescriptionText, agentReq) + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "warnings": warnings, + "blocked": blocked, + "safe": !blocked && len(warnings) == 0, + }, + }) +} + +// GetByID 查询处方详情 +// +// GET /api/v1/prescription/:id +func (h *PrescriptionHandler) GetByID(c *gin.Context) { + idStr := c.Param("id") + id, _ := strconv.ParseInt(idStr, 10, 64) + + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "id": id, + "note": "实际项目从数据库查询处方详情", + }, + }) +} + +// Approve 医生审核确认处方 +// +// POST /api/v1/prescription/:id/approve +// +// 这是 Human-in-the-Loop 的关键环节: +// AI 生成 → 规则校验 → 医生最终审核 → 生效 +func (h *PrescriptionHandler) Approve(c *gin.Context) { + idStr := c.Param("id") + id, _ := strconv.ParseInt(idStr, 10, 64) + + var req struct { + Approved bool `json:"approved"` + DoctorNote string `json:"doctor_note"` + ModifiedRx string `json:"modified_rx"` + } + c.ShouldBindJSON(&req) + + doctorID := c.GetString("user_id") + + logAudit("prescription_approve", doctorID, idStr, req.DoctorNote) + + status := "approved" + if !req.Approved { + status = "rejected" + } + + c.JSON(200, gin.H{ + "code": 200, + "message": "审核完成", + "data": gin.H{ + "id": id, + "status": status, + "approved_by": doctorID, + "doctor_note": req.DoctorNote, + "modified_rx": req.ModifiedRx, + }, + }) +} + +// getPrescriptionMessage 根据状态返回提示信息 +func getPrescriptionMessage(status string) string { + switch status { + case "success": + return "处方生成成功,请医生审核" + case "blocked": + return "处方被安全规则拦截,已自动修正,请查看" + case "need_review": + return "处方存在警告,需医生重点关注" + default: + return "处方生成完成" + } +} + +// getPrescriptionNextAction 下一步操作建议 +func getPrescriptionNextAction(status string) string { + switch status { + case "success": + return "请医生审核处方并确认" + case "blocked": + return "处方已被拦截修正,请医生重新审阅" + case "need_review": + return "存在安全警告,请医生评估后决定" + default: + return "请检查输入信息" + } +} + +// sliceToJSON 将字符串切片转为 JSON 字符串(用于数据库存储) +func sliceToJSON(s []string) string { + if len(s) == 0 { + return "[]" + } + // 简单拼接,生产环境用 json.Marshal + result := "[" + for i, v := range s { + if i > 0 { + result += "," + } + result += `"` + v + `"` + } + result += "]" + return result +} diff --git a/internal/kb/alias.go b/internal/kb/alias.go new file mode 100644 index 0000000..707c1a8 --- /dev/null +++ b/internal/kb/alias.go @@ -0,0 +1,159 @@ +package kb + +import ( + "encoding/json" + "log" + "sort" + "strings" + "sync" + "time" + + "tcm-agent/internal/dao" +) + +// ======================================================================== +// AliasIndex —— 药材"别名 → 正名"归一索引(P1 检索质量) +// ======================================================================== +// 数据来源:爬取的药材文档(xk_kb_doc.source_type='crawl') +// - title = 正名(如"山药") +// - meta_json.aliases = 别名列表(如["淮山药","土薯","怀山药"]) +// +// 用途:enhance 链路检索前,把查询词中出现的别名**追加**正名到查询尾部 +// (不做原地替换——ngram OR 语义下追加更安全:原词与正名都参与匹配, +// 召回只增不减;替换有把长句里的短词误换、破坏语境的风险)。 +// +// 数据定位(与业务确认过的铁律):爬取数据只做辅助参照(别名归一/安全校验), +// 不作为药品来源——本索引只影响"检索召回",不影响 AI 可开什么药。 +// +// 刷新策略:进程内缓存 + TTL(10 分钟)。899 味药 + 别名约几千条, +// 全量加载 <10ms,无需增量;抓取任务更新别名后最迟 10 分钟生效。 +// ======================================================================== + +// aliasTTL 别名索引缓存有效期 +const aliasTTL = 10 * time.Minute + +// maxAliasAppends 单次查询最多追加的正名个数 +// +// 长病历上下文可能命中十几个别名,全部追加会稀释原始查询词权重, +// 取命中顺序前 8 个足够覆盖一份处方的核心药材 +const maxAliasAppends = 8 + +// AliasIndex 别名归一索引(并发安全) +type AliasIndex struct { + mu sync.RWMutex + aliasMap map[string]string // 别名 → 正名 + aliases []string // 别名列表(按长度降序,先匹配长别名避免子串误命中) + loadedAt time.Time +} + +// globalAliasIndex 进程级单例:enhance 是高频路径,共享一份索引 +var globalAliasIndex = &AliasIndex{} + +// GetAliasIndex 取全局别名索引(自动按 TTL 惰性加载/刷新) +func GetAliasIndex() *AliasIndex { + globalAliasIndex.ensureFresh() + return globalAliasIndex +} + +// ensureFresh TTL 过期则重新加载(双重检查锁,避免并发重复加载) +func (a *AliasIndex) ensureFresh() { + a.mu.RLock() + fresh := time.Since(a.loadedAt) < aliasTTL && a.aliasMap != nil + a.mu.RUnlock() + if fresh { + return + } + a.mu.Lock() + defer a.mu.Unlock() + if time.Since(a.loadedAt) < aliasTTL && a.aliasMap != nil { + return + } + a.loadLocked() +} + +// loadLocked 从爬取文档构建"别名→正名"映射(调用方必须已持写锁) +// +// 冲突处理:同一别名指向多个正名时保留先加载的(zhongyoo 数据中极少见, +// 且检索场景下任选其一都能召回相近语料,不值得为此做复杂消歧) +func (a *AliasIndex) loadLocked() { + rows, err := dao.KBListCrawlDocAliases() + if err != nil { + // 加载失败保留旧索引可用(DB 抖动时检索退化为无别名扩展,不阻断) + log.Printf("[AliasIndex] ⚠️ 加载别名映射失败(沿用旧索引): %v", err) + if a.aliasMap == nil { + a.aliasMap = map[string]string{} + } + a.loadedAt = time.Now() + return + } + aliasMap := make(map[string]string, len(rows)*4) + for _, row := range rows { + canonical := strings.TrimSpace(row.Title) + if canonical == "" || row.MetaJSON == nil { + continue + } + var meta struct { + Aliases []string `json:"aliases"` + } + if err := json.Unmarshal([]byte(*row.MetaJSON), &meta); err != nil { + continue + } + for _, alias := range meta.Aliases { + alias = strings.TrimSpace(alias) + // 过滤:空串、与正名相同、单字(单字别名误命中率太高,如"术") + if alias == "" || alias == canonical || len([]rune(alias)) < 2 { + continue + } + if _, exists := aliasMap[alias]; !exists { + aliasMap[alias] = canonical + } + } + } + aliases := make([]string, 0, len(aliasMap)) + for alias := range aliasMap { + aliases = append(aliases, alias) + } + // 长别名优先匹配:如"淮山药"先于"淮山",避免同前缀重复追加 + sort.Slice(aliases, func(i, j int) bool { return len(aliases[i]) > len(aliases[j]) }) + a.aliasMap = aliasMap + a.aliases = aliases + a.loadedAt = time.Now() + log.Printf("[AliasIndex] 别名索引加载完成:%d 个别名 ← %d 篇爬取文档", len(aliasMap), len(rows)) +} + +// ExpandQuery 别名归一扩展:查询中出现的别名,把对应正名追加到查询尾部 +// +// 返回:扩展后的查询 + 实际追加的正名列表(供 kb_retrieval 步骤 detail 记录, +// 面板上能看到"这次检索做了哪些别名扩展",排障直观) +func (a *AliasIndex) ExpandQuery(query string) (string, []string) { + if query == "" { + return query, nil + } + a.mu.RLock() + defer a.mu.RUnlock() + if len(a.aliases) == 0 { + return query, nil + } + appended := make([]string, 0, 4) + seen := map[string]bool{} + for _, alias := range a.aliases { + if len(appended) >= maxAliasAppends { + break + } + if !strings.Contains(query, alias) { + continue + } + canonical := a.aliasMap[alias] + // 正名已在查询里(或已追加过)就不重复追加 + if canonical == "" || seen[canonical] || strings.Contains(query, canonical) { + continue + } + seen[canonical] = true + appended = append(appended, canonical) + } + if len(appended) == 0 { + return query, nil + } + // 空格分隔追加:ngram FULLTEXT 的自然语言/BOOLEAN 模式都按词处理 + return query + " " + strings.Join(appended, " "), appended +} diff --git a/internal/kb/embedder.go b/internal/kb/embedder.go new file mode 100644 index 0000000..3fbed87 --- /dev/null +++ b/internal/kb/embedder.go @@ -0,0 +1,103 @@ +package kb + +import "context" + +// ======================================================================== +// Embedder 接口(V2 预留) +// ======================================================================== +// V1 只实现 NoopEmbedder(默认),不调任何向量化服务 +// +// V2 接入 BGE-M3 / 阿里 / OpenAI 时只需: +// 1. 新增文件 embedder_bge.go 实现 Embedder 接口 +// 2. 在 NewEmbedder 工厂函数里加 case +// 3. 业务代码(Searcher / Importer)零改动 +// ======================================================================== + +// Embedder 向量化接口 +// +// 各实现的差异主要在: +// - Name():返回 provider 标识(noop/bge_m3/aliyun/openai) +// - Embed():批量把文本转成向量(V1 noop 直接返回 nil) +// - Dim():向量维度(V1 noop 返回 0) +// - Available():是否能用(V1 noop 返回 false) +type Embedder interface { + // Name 返回 provider 名(用于日志/前端展示) + Name() string + + // Embed 批量向量化 + // + // 入参:texts 一段或多段文本 + // 出参:与 texts 等长的向量数组;每个向量是 []float32(维度由实现决定) + // V1 NoopEmbedder 返回 nil, nil(不报错,调用方判断 Available() 后再调用) + Embed(ctx context.Context, texts []string) ([][]float32, error) + + // Dim 返回向量维度 + // NoopEmbedder 返回 0 + // BGE-M3 返回 1024,阿里 text-embedding-v3 返回 1024 + Dim() int + + // Available 是否可用 + // NoopEmbedder 返回 false(明确告知调用方"我不做向量化") + // 真实 provider 返回 true + Available() bool +} + +// ======================================================================== +// NoopEmbedder —— V1 默认实现(不做任何向量化) +// ======================================================================== + +// NoopEmbedder 空实现,所有方法返回零值 +// +// 设计意图: +// - 让 V1 的 Importer/Searcher 代码结构里就有 Embedder 接口位置 +// - 通过判断 Available() 自动跳过向量化逻辑 +// - V2 替换为真实 Embedder 时无需改业务代码 +type NoopEmbedder struct{} + +// NewNoopEmbedder 构造 +func NewNoopEmbedder() *NoopEmbedder { return &NoopEmbedder{} } + +// Name 返回 provider 名 +func (n *NoopEmbedder) Name() string { return "noop" } + +// Embed 不做向量化,直接返回 nil +func (n *NoopEmbedder) Embed(ctx context.Context, texts []string) ([][]float32, error) { + return nil, nil +} + +// Dim 返回 0(noop 没有维度) +func (n *NoopEmbedder) Dim() int { return 0 } + +// Available 返回 false(明确告知调用方不要依赖我) +func (n *NoopEmbedder) Available() bool { return false } + +// ======================================================================== +// Embedder 工厂(V1 只支持 noop;V2 扩展) +// ======================================================================== + +// NewEmbedder 根据 provider 名构造对应的 Embedder +// +// 参数: +// - provider:从 xk_system_config.ai_kb_embedding_provider 读到的值 +// - apiKey:从 xk_system_config.ai_kb_embedding_api_key 读到的值(V1 noop 不用) +// +// 返回: +// V1 默认走 noop 分支 +// V2 新增 bge_m3/aliyun/openai 时在这里加 case +// 未知 provider 也回落到 noop(不阻断业务) +func NewEmbedder(provider, apiKey string) Embedder { + switch provider { + case "noop", "": + return NewNoopEmbedder() + // V2 预留: + // case "bge_m3": + // return NewBGEM3Embedder(apiKey) + // case "aliyun": + // return NewAliyunEmbedder(apiKey) + // case "openai": + // return NewOpenAIEmbedder(apiKey) + default: + // 未知 provider 回落到 noop(保证可用性) + return NewNoopEmbedder() + } +} diff --git a/internal/kb/helpers.go b/internal/kb/helpers.go new file mode 100644 index 0000000..525785b --- /dev/null +++ b/internal/kb/helpers.go @@ -0,0 +1,51 @@ +package kb + +import ( + "bytes" + "unicode/utf8" + + "golang.org/x/text/encoding/simplifiedchinese" + "golang.org/x/text/encoding/unicode" +) + +// bytesReader 把 []byte 包装成 *bytes.Reader(excelize.OpenReader 需要 io.Reader) +// +// 单独抽出来是因为 excelize/v2 同时支持 OpenReader(io.Reader), +// 而 bytes.NewReader 是最直接的方式。 +func bytesReader(data []byte) *bytes.Reader { + return bytes.NewReader(data) +} + +// decodeToUTF8 把未知编码的文本字节兜底转成 UTF-8 字符串 +// +// 为什么需要:国内 Windows 环境导出的 txt/csv/html 大量是 GBK 编码, +// 记事本「Unicode」格式存的是 UTF-16LE;不转码直接入库会变乱码, +// FULLTEXT 检索也永远命中不了 +// +// 识别顺序: +// 1. UTF-16 BOM(FF FE = LE / FE FF = BE)→ 按 UTF-16 解码 +// 2. 合法 UTF-8(剥 BOM 后)→ 原样返回 +// 3. 其他 → 按 GB18030(GBK/GB2312 的超集)解码 +func decodeToUTF8(data []byte) string { + if len(data) >= 2 { + if data[0] == 0xFF && data[1] == 0xFE { + if out, err := unicode.UTF16(unicode.LittleEndian, unicode.UseBOM).NewDecoder().Bytes(data); err == nil { + return string(out) + } + } + if data[0] == 0xFE && data[1] == 0xFF { + if out, err := unicode.UTF16(unicode.BigEndian, unicode.UseBOM).NewDecoder().Bytes(data); err == nil { + return string(out) + } + } + } + data = bytes.TrimPrefix(data, []byte{0xEF, 0xBB, 0xBF}) + if utf8.Valid(data) { + return string(data) + } + if out, err := simplifiedchinese.GB18030.NewDecoder().Bytes(data); err == nil { + return string(out) + } + // 极端情况:连 GB18030 都解不了,原样返回(至少不丢数据) + return string(data) +} diff --git a/internal/kb/importer.go b/internal/kb/importer.go new file mode 100644 index 0000000..249d3e2 --- /dev/null +++ b/internal/kb/importer.go @@ -0,0 +1,471 @@ +package kb + +import ( + "encoding/csv" + "fmt" + "io" + "path/filepath" + "strings" + "unicode/utf8" + + "github.com/xuri/excelize/v2" +) + +// ======================================================================== +// Chunker:把长文本切成小段(chunk) +// ======================================================================== +// 设计目标: +// - md 文件:按 H1/H2/H3 标题切,标题作为 chunk.title +// - txt 文件:按段落(双换行)切,无标题 +// - 通用文本:滑动窗口按字符数切(不破坏 utf-8 字符边界) +// ======================================================================== + +// Chunk 切分结果(还没入库的中间产物) +type Chunk struct { + Title string // 分段标题 + Content string // 分段正文 + Meta map[string]any // 附加元数据(可空) +} + +// ChunkOptions 切分参数 +type ChunkOptions struct { + // MaxLen 单个 chunk 的最大字符数(按 rune 计,中文友好) + // 默认 500(中医知识片段大多 200-500 字) + MaxLen int + + // Overlap 滑动窗口重叠字符数(按 rune 计) + // 默认 50,避免在关键句中间断开 + Overlap int +} + +// DefaultChunkOptions 默认切分参数 +func DefaultChunkOptions() ChunkOptions { + return ChunkOptions{MaxLen: 500, Overlap: 50} +} + +// ChunkMarkdown 切分 Markdown 文本 +// +// 切分规则: +// 1. 先按 H1/H2/H3 (# / ## / ###) 把文档切成"章节" +// 2. 每个章节:标题作为 chunk.title,章节正文作为 chunk.content +// 3. 章节正文仍超 MaxLen 时,按段落滑动窗口再切 +// 4. 没有标题的段落(如文档开头)归到一个 title="" 的 chunk +func ChunkMarkdown(text string, opt ChunkOptions) []*Chunk { + if opt.MaxLen <= 0 { + opt = DefaultChunkOptions() + } + lines := strings.Split(text, "\n") + var chunks []*Chunk + + curTitle := "" + curBody := strings.Builder{} + + // flush 把当前 buffer 的内容打包成一个或多个 chunk + flush := func() { + body := strings.TrimSpace(curBody.String()) + if body == "" { + curBody.Reset() + return + } + // 仍然超过 MaxLen 的,按滑动窗口再切 + for _, piece := range slideWindow(body, opt.MaxLen, opt.Overlap) { + chunks = append(chunks, &Chunk{ + Title: curTitle, + Content: piece, + }) + } + curBody.Reset() + } + + for _, raw := range lines { + line := strings.TrimRight(raw, "\r") + trimmed := strings.TrimSpace(line) + // 命中 H1/H2/H3 + if strings.HasPrefix(trimmed, "# ") || + strings.HasPrefix(trimmed, "## ") || + strings.HasPrefix(trimmed, "### ") { + flush() + curTitle = strings.TrimSpace(strings.TrimLeft(trimmed, "#")) + continue + } + curBody.WriteString(line) + curBody.WriteString("\n") + } + flush() + return chunks +} + +// ChunkPlainText 切分纯文本(txt) +// +// 切分规则: +// 1. 按双换行切段落 +// 2. 段落累计达到 MaxLen 时打包成 chunk +// 3. 单段落仍超 MaxLen 时,按滑动窗口切 +func ChunkPlainText(text string, opt ChunkOptions) []*Chunk { + if opt.MaxLen <= 0 { + opt = DefaultChunkOptions() + } + text = strings.ReplaceAll(text, "\r\n", "\n") + paras := strings.Split(text, "\n\n") + + var chunks []*Chunk + curBody := strings.Builder{} + flush := func() { + body := strings.TrimSpace(curBody.String()) + if body == "" { + curBody.Reset() + return + } + for _, piece := range slideWindow(body, opt.MaxLen, opt.Overlap) { + chunks = append(chunks, &Chunk{Title: "", Content: piece}) + } + curBody.Reset() + } + + for _, p := range paras { + p = strings.TrimSpace(p) + if p == "" { + continue + } + // 如果累加后超过 MaxLen,先 flush 再开新段 + if utf8.RuneCountInString(curBody.String())+utf8.RuneCountInString(p) > opt.MaxLen { + flush() + } + curBody.WriteString(p) + curBody.WriteString("\n\n") + } + flush() + return chunks +} + +// slideWindow 滑动窗口切长文本 +// +// 不破坏 utf-8 字符边界(按 rune 而不是 byte 切) +// 当文本长度 <= maxLen 时直接返回原文 +func slideWindow(text string, maxLen, overlap int) []string { + runes := []rune(text) + if len(runes) <= maxLen { + return []string{text} + } + if overlap < 0 { + overlap = 0 + } + if overlap >= maxLen { + overlap = maxLen / 4 // 防止 overlap 过大导致死循环 + } + var out []string + step := maxLen - overlap + if step <= 0 { + step = maxLen + } + for i := 0; i < len(runes); i += step { + end := i + maxLen + if end > len(runes) { + end = len(runes) + } + out = append(out, string(runes[i:end])) + if end >= len(runes) { + break + } + } + return out +} + +// ======================================================================== +// Importer:从文件解析成 []*Chunk +// ======================================================================== + +// ParsedDoc 文件解析结果(导入流程的中间产物) +type ParsedDoc struct { + Title string // 文档标题(默认取文件名不带扩展名) + SourceType string // 文件类型:xlsx / csv / md / txt / pdf / docx / html / manual + SourceFile string // 原始文件名(含扩展名) + RawContent string // 完整原文(用于详情展示) + Chunks []*Chunk // 切分好的分段 +} + +// ParseFileFromBytes 从字节流解析文件(不依赖磁盘) +// +// 用 Bytes 而非文件路径:HTTP 上传场景拿到的是 multipart.File, +// 调用方读成 []byte 传进来更通用 +// +// 支持扩展名(解析产出纯文本后统一走自动分段,入库/检索链路完全复用): +// .xlsx/.xls → MaxKB 导出三列格式按行成段;≥4 列的普通表格逐行拼文本再切分 +// .csv → 通用表格,逐行拼文本后滑动窗口切分 +// .md → 按 markdown H1/H2/H3 标题切分 +// .txt → 按段落(双换行)切分 +// .pdf → 逐页抽取文字层后按段落切分(扫描版无文字层会明确报错) +// .docx → 解析 word/document.xml 抽正文后按段落切分(老版 .doc 不支持) +// .html/.htm → 抽正文并把 h1~h6 转成 # 标题,走 markdown 章节切分 +// +// txt/csv/md/html 会自动识别编码(UTF-8 / UTF-16 BOM / GBK)转成 UTF-8 入库 +func ParseFileFromBytes(filename string, data []byte, opt ChunkOptions) (*ParsedDoc, error) { + ext := strings.ToLower(filepath.Ext(filename)) + title := strings.TrimSuffix(filename, filepath.Ext(filename)) + + pdoc := &ParsedDoc{ + Title: title, + SourceFile: filename, + } + + switch ext { + case ".xlsx", ".xls": + pdoc.SourceType = "xlsx" + chunks, raw, err := parseExcel(data, opt) + if err != nil { + return nil, err + } + pdoc.Chunks = chunks + pdoc.RawContent = raw + case ".csv": + pdoc.SourceType = "csv" + chunks, raw, err := parseCSV(data, opt) + if err != nil { + return nil, err + } + pdoc.Chunks = chunks + pdoc.RawContent = raw + case ".md", ".markdown": + pdoc.SourceType = "md" + text := decodeToUTF8(data) + pdoc.RawContent = text + pdoc.Chunks = ChunkMarkdown(text, opt) + case ".txt", "": + pdoc.SourceType = "txt" + text := decodeToUTF8(data) + pdoc.RawContent = text + pdoc.Chunks = ChunkPlainText(text, opt) + case ".pdf": + pdoc.SourceType = "pdf" + text, err := extractPDFText(data) + if err != nil { + return nil, err + } + pdoc.RawContent = text + pdoc.Chunks = ChunkPlainText(text, opt) + case ".docx": + pdoc.SourceType = "docx" + text, err := extractDocxText(data) + if err != nil { + return nil, err + } + pdoc.RawContent = text + pdoc.Chunks = ChunkPlainText(text, opt) + case ".doc": + // 老版 .doc 是 OLE 二进制格式,纯 Go 解析成本极高且不可靠,明确拒绝并给出替代方案 + return nil, fmt.Errorf("kb: 不支持老版二进制 .doc,请用 Word 另存为 .docx 后再导入") + case ".html", ".htm": + pdoc.SourceType = "html" + text, err := extractHTMLText(data) + if err != nil { + return nil, err + } + pdoc.RawContent = text + // HTML 抽取时已把 h1~h6 转成 # 标题,按 markdown 章节切分能保留标题到 chunk.title + pdoc.Chunks = ChunkMarkdown(text, opt) + default: + return nil, fmt.Errorf("kb: 不支持的文件格式 %s(支持 xlsx/xls/csv/md/txt/pdf/docx/html)", ext) + } + + // 空内容防御:解析成功但没有任何 chunk 时明确报错, + // 避免入库一个空文档让用户误以为导入成功 + if len(pdoc.Chunks) == 0 { + if ext == ".pdf" { + return nil, fmt.Errorf("kb: PDF 未提取到文本——扫描版/图片型 PDF 没有文字层,请先 OCR 或转成 txt 再导入") + } + return nil, fmt.Errorf("kb: 文件中没有可导入的文本内容") + } + return pdoc, nil +} + +// parseExcel 解析 xlsx,自动识别两种模式 +// +// 模式一(MaxKB 导出格式,兼容原有行为): +// 第 1 列:分段标题(必填) +// 第 2 列:分段内容(必填) +// 第 3 列:关联问题列表(可选,分号分隔) +// 判定条件:首行是表头(含 标题/内容/title/content 字样)或最大列数 ≤ 3, +// 每行直接成为一个 chunk,不再二次切分 +// +// 模式二(通用表格): +// 列数 ≥ 4 且无 MaxKB 表头的普通业务表格(如 药名|性味|归经|功效), +// 逐行把单元格用「 | 」拼成一行文本,按滑动窗口切分,遍历所有 sheet +// +// 注意:老版二进制 .xls 无法被 excelize 打开,会走到「打开失败」的报错提示 +func parseExcel(data []byte, opt ChunkOptions) ([]*Chunk, string, error) { + f, err := excelize.OpenReader(bytesReader(data)) + if err != nil { + return nil, "", fmt.Errorf("kb: 打开 Excel 失败(若为老版 .xls 请另存为 .xlsx): %w", err) + } + defer f.Close() + + sheets := f.GetSheetList() + if len(sheets) == 0 { + return nil, "", fmt.Errorf("kb: xlsx 没有任何 sheet") + } + // 先读第一个 sheet 判定模式(MaxKB 导出只有一个 sheet) + rows, err := f.GetRows(sheets[0]) + if err != nil { + return nil, "", fmt.Errorf("kb: 读取 xlsx 行失败: %w", err) + } + + // 模式判定:无 MaxKB 表头且列数 ≥ 4 → 通用表格模式 + maxCols := 0 + for _, row := range rows { + if len(row) > maxCols { + maxCols = len(row) + } + } + hasHeader := len(rows) > 0 && isHeaderRow(rows[0]) + if !hasHeader && maxCols >= 4 { + return parseExcelGeneric(f, opt) + } + + var chunks []*Chunk + var rawBuilder strings.Builder + for i, row := range rows { + // 第一行如果是表头(含"标题"/"内容"等字样)则跳过 + if i == 0 && isHeaderRow(row) { + continue + } + if len(row) == 0 { + continue + } + // 容错:不足 2 列时补空字符串 + title := cellOr(row, 0, "") + content := cellOr(row, 1, "") + related := cellOr(row, 2, "") + + // 至少要有 content(如果只有 title 没 content,跳过) + if strings.TrimSpace(content) == "" { + // 如果只有 1 列且非空,把第 1 列当 content(无标题) + if strings.TrimSpace(title) != "" && len(row) == 1 { + chunks = append(chunks, &Chunk{Title: "", Content: title}) + rawBuilder.WriteString(title) + rawBuilder.WriteString("\n") + } + continue + } + + chunk := &Chunk{Title: title, Content: content} + // 关联问题塞到 meta 里(V1 仅作展示,V2 也用作 keyword boost) + if strings.TrimSpace(related) != "" { + qs := strings.Split(related, ";") + cleaned := make([]string, 0, len(qs)) + for _, q := range qs { + if s := strings.TrimSpace(q); s != "" { + cleaned = append(cleaned, s) + } + } + if len(cleaned) > 0 { + chunk.Meta = map[string]any{"related_questions": cleaned} + } + } + chunks = append(chunks, chunk) + + rawBuilder.WriteString(title) + rawBuilder.WriteString("\n") + rawBuilder.WriteString(content) + rawBuilder.WriteString("\n\n") + } + return chunks, rawBuilder.String(), nil +} + +// parseExcelGeneric 通用表格模式:遍历所有 sheet,逐行拼接文本后滑动窗口切分 +// +// 每行单元格用「 | 」连接保持列对应关系,chunk.title 用 sheet 名, +// 检索时 sheet 名也参与 FULLTEXT 匹配(如 sheet 叫「感冒用药」) +func parseExcelGeneric(f *excelize.File, opt ChunkOptions) ([]*Chunk, string, error) { + if opt.MaxLen <= 0 { + opt = DefaultChunkOptions() + } + var chunks []*Chunk + var rawBuilder strings.Builder + for _, sheet := range f.GetSheetList() { + rows, err := f.GetRows(sheet) + if err != nil { + continue // 单个 sheet 读取失败不影响其他 sheet + } + var sheetText strings.Builder + for _, row := range rows { + line := strings.TrimSpace(strings.Join(row, " | ")) + // 跳过全空行(只剩分隔符和空白) + if strings.Trim(line, "| ") == "" { + continue + } + sheetText.WriteString(line) + sheetText.WriteString("\n") + } + text := strings.TrimSpace(sheetText.String()) + if text == "" { + continue + } + rawBuilder.WriteString("【" + sheet + "】\n") + rawBuilder.WriteString(text) + rawBuilder.WriteString("\n\n") + for _, piece := range slideWindow(text, opt.MaxLen, opt.Overlap) { + chunks = append(chunks, &Chunk{Title: sheet, Content: piece}) + } + } + return chunks, rawBuilder.String(), nil +} + +// parseCSV 解析 CSV 文件:逐行拼接文本后滑动窗口切分 +// +// 容错设计: +// FieldsPerRecord=-1 允许每行列数不同(业务系统导出的 csv 经常不规整) +// LazyQuotes=true 容忍不规范的引号用法 +// 编码自动识别(Excel 另存的 csv 大概率是 GBK) +func parseCSV(data []byte, opt ChunkOptions) ([]*Chunk, string, error) { + if opt.MaxLen <= 0 { + opt = DefaultChunkOptions() + } + r := csv.NewReader(strings.NewReader(decodeToUTF8(data))) + r.FieldsPerRecord = -1 + r.LazyQuotes = true + + var lines []string + for { + record, err := r.Read() + if err == io.EOF { + break + } + if err != nil { + return nil, "", fmt.Errorf("kb: 解析 CSV 失败: %w", err) + } + line := strings.TrimSpace(strings.Join(record, " | ")) + if strings.Trim(line, "| ") == "" { + continue + } + lines = append(lines, line) + } + text := strings.Join(lines, "\n") + if strings.TrimSpace(text) == "" { + return nil, "", nil + } + var chunks []*Chunk + for _, piece := range slideWindow(text, opt.MaxLen, opt.Overlap) { + chunks = append(chunks, &Chunk{Title: "", Content: piece}) + } + return chunks, text, nil +} + +// isHeaderRow 判断是否表头行(包含"标题"或"内容"字样) +func isHeaderRow(row []string) bool { + if len(row) == 0 { + return false + } + joined := strings.ToLower(strings.Join(row, "")) + return strings.Contains(joined, "标题") || + strings.Contains(joined, "title") || + strings.Contains(joined, "内容") || + strings.Contains(joined, "content") +} + +// cellOr 安全取单元格(防止行不满列数导致 index out of range) +func cellOr(row []string, idx int, def string) string { + if idx >= len(row) { + return def + } + return row[idx] +} diff --git a/internal/kb/library_service.go b/internal/kb/library_service.go new file mode 100644 index 0000000..77199d9 --- /dev/null +++ b/internal/kb/library_service.go @@ -0,0 +1,397 @@ +package kb + +import ( + "context" + "fmt" + "time" + + "tcm-agent/internal/dao" +) + +// ======================================================================== +// LibraryService:库 / 文档 / 分段的业务管理(不含检索) +// ======================================================================== +// 这是 KB Admin Handler 直接调用的服务,负责: +// - 库的 CRUD(list/create/delete) +// - 文档导入(解析文件 + 切分 + 入库 + 自动刷新库统计) +// - 文档/分段的 list / detail / delete +// +// 不在这里做: +// - 向量化(V1 不做;V2 单独有 VectorizeService 走异步任务) +// - 检索(走 Searcher) +// ======================================================================== + +// LibraryService 库管理服务 +type LibraryService struct { + embedder Embedder // V1 是 NoopEmbedder +} + +// NewLibraryService 构造 +func NewLibraryService(embedder Embedder) *LibraryService { + return &LibraryService{embedder: embedder} +} + +// ---------------------------------------------------------------------- +// 库(library) +// ---------------------------------------------------------------------- + +// LibraryDTO 库的列表/详情 DTO(带人类可读字段) +type LibraryDTO struct { + dao.KBLibraryRow + // 额外展示字段(可空) + EmbeddingAvailable bool `json:"embedding_available"` // 该库的 embedder 是否可用(V1 noop=false) +} + +// ListLibraries 列出所有库(含禁用的,便于后台展示) +func (s *LibraryService) ListLibraries(ctx context.Context) ([]LibraryDTO, error) { + rows, err := dao.KBListLibraries(true) + if err != nil { + return nil, err + } + out := make([]LibraryDTO, 0, len(rows)) + for _, r := range rows { + out = append(out, LibraryDTO{ + KBLibraryRow: r, + EmbeddingAvailable: s.embedder.Available(), + }) + } + return out, nil +} + +// GetLibrary 取单个库 +func (s *LibraryService) GetLibrary(ctx context.Context, id uint) (*LibraryDTO, error) { + row, err := dao.KBGetLibrary(id) + if err != nil { + return nil, err + } + return &LibraryDTO{ + KBLibraryRow: *row, + EmbeddingAvailable: s.embedder.Available(), + }, nil +} + +// CreateLibraryInput 建库入参(HTTP body 直接反序列化) +type CreateLibraryInput struct { + Name string `json:"name" binding:"required"` + Description string `json:"description"` + Source string `json:"source"` // 默认 manual + EmbeddingProvider string `json:"embedding_provider"` // 默认 noop +} + +// CreateLibrary 建库 +func (s *LibraryService) CreateLibrary(ctx context.Context, in CreateLibraryInput) (*LibraryDTO, error) { + row, err := dao.KBCreateLibrary(dao.KBCreateLibraryInput{ + Name: in.Name, + Description: in.Description, + Source: in.Source, + EmbeddingProvider: in.EmbeddingProvider, + }) + if err != nil { + return nil, err + } + return &LibraryDTO{KBLibraryRow: *row}, nil +} + +// DeleteLibrary 软删除库(连带该库下所有文档和分段) +func (s *LibraryService) DeleteLibrary(ctx context.Context, id uint) error { + return dao.KBDeleteLibrary(id) +} + +// ---------------------------------------------------------------------- +// 文档(doc) +// ---------------------------------------------------------------------- + +// ListDocs 列出某库下的所有文档 +func (s *LibraryService) ListDocs(ctx context.Context, libraryID uint) ([]dao.KBDocRow, error) { + return dao.KBListDocs(libraryID) +} + +// GetDoc 取单个文档 +func (s *LibraryService) GetDoc(ctx context.Context, id uint) (*dao.KBDocRow, error) { + return dao.KBGetDoc(id) +} + +// DeleteDoc 软删除文档(连带分段) +// +// 删除后自动刷新库的统计字段 +func (s *LibraryService) DeleteDoc(ctx context.Context, id uint) error { + doc, err := dao.KBGetDoc(id) + if err != nil { + return err + } + if err := dao.KBDeleteDoc(id); err != nil { + return err + } + // 刷新库统计 + return dao.KBUpdateLibraryStats(doc.LibraryID) +} + +// ---------------------------------------------------------------------- +// 文档导入 +// ---------------------------------------------------------------------- + +// ImportDocInput 导入文档入参 +type ImportDocInput struct { + LibraryID uint `json:"library_id" binding:"required"` + Filename string `json:"filename" binding:"required"` // 文件名(含扩展名) + Content []byte `json:"-"` // 文件二进制(HTTP multipart 上传) + Title string `json:"title"` // 自定义文档标题(可空,默认取文件名) + MaxLen int `json:"max_len"` // 自定义分段最大长度(0=用默认 500) + Overlap int `json:"overlap"` // 自定义分段重叠(-1 或缺省=用默认 50) +} + +// resolveChunkOptions 把用户传入的自定义分段参数归一化成合法的 ChunkOptions +// +// 规则: +// - MaxLen 允许 100~2000(太小切得稀碎、太大失去检索意义),越界回落默认 +// - Overlap 允许 0~500 且必须小于 MaxLen(否则滑窗永不前进会死循环) +// - 都不传(0 值)时用 DefaultChunkOptions,行为与旧版完全一致 +func resolveChunkOptions(maxLen, overlap int) ChunkOptions { + opt := DefaultChunkOptions() + if maxLen >= 100 && maxLen <= 2000 { + opt.MaxLen = maxLen + } + if overlap >= 0 && overlap <= 500 && overlap < opt.MaxLen { + opt.Overlap = overlap + } + return opt +} + +// ImportDocResult 导入结果 +type ImportDocResult struct { + DocID uint `json:"doc_id"` + Title string `json:"title"` + ChunkCount int `json:"chunk_count"` + SourceType string `json:"source_type"` +} + +// ImportDocument 导入单个文档 +// +// 流程: +// 1. 解析文件 → ParsedDoc(含切分好的 chunks) +// 2. 构造 KBDocRow + []*KBChunkRow +// 3. 调 dao.KBInsertDocWithChunks 一次性入库 +// 4. 刷新库统计(doc_count / chunk_count) +// +// 注意:V1 全程不调 embedding,content_vector 始终为 NULL +func (s *LibraryService) ImportDocument(ctx context.Context, in ImportDocInput) (*ImportDocResult, error) { + if in.LibraryID == 0 { + return nil, fmt.Errorf("kb: library_id 不能为空") + } + // 验证库存在 + lib, err := dao.KBGetLibrary(in.LibraryID) + if err != nil { + return nil, fmt.Errorf("kb: 库不存在: %w", err) + } + _ = lib + + // 1. 解析文件 + 切分(支持自定义 max_len/overlap,缺省走默认 500/50) + pdoc, err := ParseFileFromBytes(in.Filename, in.Content, resolveChunkOptions(in.MaxLen, in.Overlap)) + if err != nil { + return nil, fmt.Errorf("kb: 解析文件失败: %w", err) + } + + // 2. 构造 doc + docTitle := in.Title + if docTitle == "" { + docTitle = pdoc.Title + } + doc := &dao.KBDocRow{ + LibraryID: in.LibraryID, + Title: docTitle, + Content: pdoc.RawContent, + SourceFile: pdoc.SourceFile, + SourceType: pdoc.SourceType, + } + + // 3. 构造 chunks + chunks := make([]*dao.KBChunkRow, 0, len(pdoc.Chunks)) + for _, c := range pdoc.Chunks { + row := &dao.KBChunkRow{ + Title: c.Title, + Content: c.Content, + } + // related_questions 等元数据编进 meta_json + if len(c.Meta) > 0 { + row.MetaJSON = dao.MarshalMeta(c.Meta) + } + chunks = append(chunks, row) + } + + // 4. 入库 + if err := dao.KBInsertDocWithChunks(doc, chunks); err != nil { + return nil, fmt.Errorf("kb: 入库失败: %w", err) + } + + // 5. 刷新库统计 + _ = dao.KBUpdateLibraryStats(in.LibraryID) + + return &ImportDocResult{ + DocID: doc.ID, + Title: doc.Title, + ChunkCount: len(chunks), + SourceType: pdoc.SourceType, + }, nil +} + +// ---------------------------------------------------------------------- +// 分段(chunk) +// ---------------------------------------------------------------------- + +// ListChunks 列出某文档的分段 +func (s *LibraryService) ListChunks(ctx context.Context, docID uint) ([]dao.KBChunkRow, error) { + return dao.KBListChunks(docID) +} + +// UpdateChunkInput 编辑分段入参(HTTP body) +type UpdateChunkInput struct { + Title string `json:"title"` + Content string `json:"content"` + RelatedQuestions []string `json:"related_questions"` // 关联问题列表(自动塞到 meta_json.related_questions) + IsActive *int `json:"is_active"` // 分段启停开关:nil=不改 / 1=启用 / 0=禁用 +} + +// UpdateChunk 编辑分段 +// +// 支持改:标题、内容、关联问题 +// 不支持改:所属库、所属文档、chunk_index(结构信息) +// +// V2 改进点:内容变更后异步触发重新向量化 +func (s *LibraryService) UpdateChunk(ctx context.Context, chunkID uint, in UpdateChunkInput) (*dao.KBChunkRow, error) { + // 先验证分段存在 + chunk, err := dao.KBGetChunk(chunkID) + if err != nil { + return nil, err + } + + // 构造更新入参(用指针区分"不改"和"清空") + // + // 特殊分支:只切换启停开关时(title/content 都是空串且带 is_active), + // 不能把空串写进 title/content 覆盖原内容——只更新 is_active + var input dao.KBUpdateChunkInput + onlyToggle := in.IsActive != nil && in.Title == "" && in.Content == "" && in.RelatedQuestions == nil + if !onlyToggle { + input.Title = &in.Title + input.Content = &in.Content + // 关联问题列表 → meta_json.related_questions + if in.RelatedQuestions != nil { + // 即使是空数组也写入(清空关联问题) + meta := map[string]any{} + if len(in.RelatedQuestions) > 0 { + meta["related_questions"] = in.RelatedQuestions + } + metaStr := dao.MarshalMeta(meta) + input.MetaJSON = metaStr + } + } + input.IsActive = in.IsActive + + if err := dao.KBUpdateChunk(chunkID, input); err != nil { + return nil, err + } + + // 启停开关影响库的 chunk_count 统计(只统计 is_active=1),需要刷新 + if in.IsActive != nil { + _ = dao.KBUpdateLibraryStats(chunk.LibraryID) + } + + // 返回更新后的分段 + return dao.KBGetChunk(chunkID) +} + +// BatchChunkInput 批量分段操作入参(HTTP body) +type BatchChunkInput struct { + IDs []uint `json:"ids" binding:"required"` // 分段 ID 列表 + Action string `json:"action" binding:"required"` // enable / disable / delete +} + +// BatchUpdateChunks 批量启用/禁用/删除分段 +// +// 事务在 DAO 层保证原子性,这里负责入参校验 + 事后刷新受影响库的统计 +func (s *LibraryService) BatchUpdateChunks(ctx context.Context, in BatchChunkInput) (int64, error) { + if len(in.IDs) == 0 { + return 0, fmt.Errorf("kb: ids 不能为空") + } + if len(in.IDs) > 500 { + return 0, fmt.Errorf("kb: 单次最多操作 500 条分段") + } + affected, libIDs, err := dao.KBBatchChunkAction(in.IDs, in.Action) + if err != nil { + return 0, err + } + // 刷新受影响库的统计(chunk_count 只统计 is_active=1 且未删除的) + for _, libID := range libIDs { + _ = dao.KBUpdateLibraryStats(libID) + } + return affected, nil +} + +// RechunkInput 重新分段入参(HTTP body) +type RechunkInput struct { + MaxLen int `json:"max_len"` // 新的分段最大长度(0=默认 500) + Overlap int `json:"overlap"` // 新的分段重叠(-1=默认 50) +} + +// RechunkResult 重新分段结果 +type RechunkResult struct { + DocID uint `json:"doc_id"` + OldCount int `json:"old_count"` // 重切前的分段数 + ChunkCount int `json:"chunk_count"` // 重切后的分段数 +} + +// RechunkDocument 用新分段参数对已导入文档重新切分 +// +// 场景:调整 max_len/overlap 后不用删除重传——直接用 xk_kb_doc.content +// 存的原文重切。注意人工编辑过的分段内容会被重切结果覆盖(前端有二次确认提示)。 +// +// 切分器选择与导入时一致:md/html 存的是带 # 标题的文本走 ChunkMarkdown, +// 其余(txt/pdf/docx/xlsx/csv)走 ChunkPlainText +func (s *LibraryService) RechunkDocument(ctx context.Context, docID uint, in RechunkInput) (*RechunkResult, error) { + doc, err := dao.KBGetDoc(docID) + if err != nil { + return nil, err + } + if doc.Content == "" { + return nil, fmt.Errorf("kb: 该文档没有保存原文,无法重新分段(早期导入的文档可删除后重新上传)") + } + + opt := resolveChunkOptions(in.MaxLen, in.Overlap) + var parsed []*Chunk + if doc.SourceType == "md" || doc.SourceType == "html" { + parsed = ChunkMarkdown(doc.Content, opt) + } else { + parsed = ChunkPlainText(doc.Content, opt) + } + if len(parsed) == 0 { + return nil, fmt.Errorf("kb: 按新参数切分后没有产生任何分段,已保留原分段") + } + + rows := make([]*dao.KBChunkRow, 0, len(parsed)) + for _, c := range parsed { + row := &dao.KBChunkRow{Title: c.Title, Content: c.Content} + if len(c.Meta) > 0 { + row.MetaJSON = dao.MarshalMeta(c.Meta) + } + rows = append(rows, row) + } + + oldCount := doc.ChunkCount + if err := dao.KBReplaceDocChunks(docID, rows); err != nil { + return nil, fmt.Errorf("kb: 替换分段失败: %w", err) + } + _ = dao.KBUpdateLibraryStats(doc.LibraryID) + + return &RechunkResult{DocID: docID, OldCount: oldCount, ChunkCount: len(rows)}, nil +} + +// ---------------------------------------------------------------------- +// 工具:时间戳格式化(前端展示用) +// ---------------------------------------------------------------------- + +// FormatTime 把 int 时间戳转成人类可读字符串(前端可选不用) +func FormatTime(ts int) string { + if ts <= 0 { + return "" + } + return time.Unix(int64(ts), 0).Format("2006-01-02 15:04:05") +} diff --git a/internal/kb/parser_docx.go b/internal/kb/parser_docx.go new file mode 100644 index 0000000..3b53b99 --- /dev/null +++ b/internal/kb/parser_docx.go @@ -0,0 +1,93 @@ +package kb + +import ( + "archive/zip" + "bytes" + "encoding/xml" + "fmt" + "io" + "strings" +) + +// ======================================================================== +// DOCX 解析器:从 Word (.docx) 字节流抽取纯文本 +// ======================================================================== +// 选型说明: +// - docx 本质是 zip 包,正文全部在 word/document.xml 里, +// 用标准库 archive/zip + encoding/xml 流式解析即可,零第三方依赖 +// - 不用 unioffice(AGPL 许可证,商用需付费授权) +// - 老版二进制 .doc 是 OLE 复合文档格式,纯 Go 解析成本极高, +// 明确不支持,提示用户用 Word 另存为 .docx +// ======================================================================== + +// extractDocxText 抽取 docx 正文文本 +// +// 解析规则(只认元素局部名,忽略 w: 命名空间前缀): +// <w:t> 文本节点,累加内容 +// <w:p> 段落结束时补双换行(配合 ChunkPlainText 按双换行切段) +// <w:br> 手动换行 → \n +// <w:tab> 制表符 → \t +// +// 表格(w:tbl)里的单元格内容也是 w:p 段落,天然会被上面的规则覆盖, +// 不需要单独处理表格结构 +func extractDocxText(data []byte) (string, error) { + zr, err := zip.NewReader(bytes.NewReader(data), int64(len(data))) + if err != nil { + return "", fmt.Errorf("kb: 打开 docx 失败(若为老版 .doc 请用 Word 另存为 .docx): %w", err) + } + + // 定位正文文件 word/document.xml + var docFile *zip.File + for _, f := range zr.File { + if f.Name == "word/document.xml" { + docFile = f + break + } + } + if docFile == nil { + return "", fmt.Errorf("kb: docx 中找不到 word/document.xml,不是有效的 Word 文档") + } + + rc, err := docFile.Open() + if err != nil { + return "", fmt.Errorf("kb: 读取 docx 正文失败: %w", err) + } + defer rc.Close() + + dec := xml.NewDecoder(rc) + var sb strings.Builder + inText := false // 是否处于 <w:t> 内部(只收集 w:t 里的字符,跳过样式等噪音) + for { + tok, terr := dec.Token() + if terr == io.EOF { + break + } + if terr != nil { + return "", fmt.Errorf("kb: 解析 docx XML 失败: %w", terr) + } + switch t := tok.(type) { + case xml.StartElement: + switch t.Name.Local { + case "t": + inText = true + case "br", "cr": + sb.WriteString("\n") + case "tab": + sb.WriteString("\t") + } + case xml.EndElement: + switch t.Name.Local { + case "t": + inText = false + case "p": + // 段落边界 → 空行,供 ChunkPlainText 按段落切分 + sb.WriteString("\n\n") + } + case xml.CharData: + if inText { + sb.Write(t) + } + } + } + return strings.TrimSpace(sb.String()), nil +} diff --git a/internal/kb/parser_html.go b/internal/kb/parser_html.go new file mode 100644 index 0000000..77c34a5 --- /dev/null +++ b/internal/kb/parser_html.go @@ -0,0 +1,119 @@ +package kb + +import ( + "fmt" + "regexp" + "strings" + + "golang.org/x/net/html" +) + +// ======================================================================== +// HTML 解析器:从 HTML 字节流抽取正文文本 +// ======================================================================== +// 设计目标: +// - 跳过 script/style/head/nav 等非正文节点,只留可读内容 +// - h1~h6 转成 markdown 井号标题,这样产出文本可以直接走 ChunkMarkdown, +// 按章节切分并把标题写进 chunk.title(检索时标题参与 FULLTEXT 加权) +// - 依赖 golang.org/x/net/html(官方扩展库,本项目已有该依赖) +// ======================================================================== + +// htmlSkipTags 整棵子树跳过的标签(非正文内容) +var htmlSkipTags = map[string]bool{ + "script": true, "style": true, "noscript": true, "head": true, + "iframe": true, "svg": true, "template": true, "nav": true, + "footer": true, "form": true, "button": true, +} + +// htmlHeadingPrefix 标题标签 → markdown 前缀 +// h4~h6 统一归到 ###(ChunkMarkdown 只识别到三级,再深的层级对分段没有意义) +var htmlHeadingPrefix = map[string]string{ + "h1": "# ", "h2": "## ", "h3": "### ", + "h4": "### ", "h5": "### ", "h6": "### ", +} + +// htmlBlockTags 块级标签:子树遍历结束后补换行,保持段落结构 +var htmlBlockTags = map[string]bool{ + "p": true, "div": true, "section": true, "article": true, + "ul": true, "ol": true, "table": true, "blockquote": true, + "pre": true, "figcaption": true, "main": true, "header": true, +} + +// 压缩连续 3 个以上换行为 2 个(保持「空行分段」语义又不产生大量空白) +var multiNewlineRe = regexp.MustCompile(`\n{3,}`) + +// extractHTMLText 抽取 HTML 正文,返回带 markdown 标题标记的纯文本 +// +// 返回文本交给 ChunkMarkdown 切分:h1~h3 成为章节边界 + chunk 标题 +func extractHTMLText(data []byte) (string, error) { + doc, err := html.Parse(strings.NewReader(decodeToUTF8(data))) + if err != nil { + return "", fmt.Errorf("kb: 解析 HTML 失败: %w", err) + } + + var sb strings.Builder + var walk func(n *html.Node) + walk = func(n *html.Node) { + if n.Type == html.ElementNode { + tag := strings.ToLower(n.Data) + if htmlSkipTags[tag] { + return + } + // 标题:整行输出「# 标题文本」,前后空行隔开 + if prefix, ok := htmlHeadingPrefix[tag]; ok { + headText := strings.TrimSpace(plainTextOf(n)) + if headText != "" { + sb.WriteString("\n\n") + sb.WriteString(prefix) + sb.WriteString(headText) + sb.WriteString("\n\n") + } + return + } + switch tag { + case "br": + sb.WriteString("\n") + case "li": + sb.WriteString("\n- ") // 列表项前置符号,保持可读性 + case "tr": + sb.WriteString("\n") + case "td", "th": + sb.WriteString(" ") // 单元格之间留空格,避免不同列文字黏连 + } + } + if n.Type == html.TextNode { + // HTML 源码缩进产生的纯空白文本节点直接丢弃 + txt := strings.TrimSpace(n.Data) + if txt != "" { + sb.WriteString(txt) + } + } + for c := n.FirstChild; c != nil; c = c.NextSibling { + walk(c) + } + // 块级元素结束 → 空行分段 + if n.Type == html.ElementNode && htmlBlockTags[strings.ToLower(n.Data)] { + sb.WriteString("\n\n") + } + } + walk(doc) + + text := multiNewlineRe.ReplaceAllString(sb.String(), "\n\n") + return strings.TrimSpace(text), nil +} + +// plainTextOf 收集节点子树内的纯文本(用于标题内容,不处理块级结构) +func plainTextOf(n *html.Node) string { + var sb strings.Builder + var walk func(node *html.Node) + walk = func(node *html.Node) { + if node.Type == html.TextNode { + sb.WriteString(strings.TrimSpace(node.Data)) + } + for c := node.FirstChild; c != nil; c = c.NextSibling { + walk(c) + } + } + walk(n) + return sb.String() +} diff --git a/internal/kb/parser_pdf.go b/internal/kb/parser_pdf.go new file mode 100644 index 0000000..ab96fe5 --- /dev/null +++ b/internal/kb/parser_pdf.go @@ -0,0 +1,62 @@ +package kb + +import ( + "bytes" + "fmt" + "strings" + + "github.com/ledongthuc/pdf" +) + +// ======================================================================== +// PDF 解析器:从 PDF 字节流抽取纯文本 +// ======================================================================== +// 选型说明: +// - 用 github.com/ledongthuc/pdf(rsc.io/pdf 的维护分支,纯 Go 无 CGO), +// 许可证 BSD,可商用;不引 unioffice/unipdf(AGPL 商用有坑) +// - 只能抽「文字型 PDF」的文本;扫描版/图片型 PDF 没有文字层, +// 需要 OCR,超出本服务范围,由上层给出友好报错 +// ======================================================================== + +// extractPDFText 逐页抽取 PDF 文本,页与页之间用双换行分隔 +// +// 为什么逐页而不是整本 GetPlainText: +// 页边界是天然的段落边界,配合 ChunkPlainText 按双换行切段, +// 能避免跨页内容被硬拼成一大段 +// +// 为什么要 recover: +// ledongthuc/pdf 遇到畸形/加密 PDF 时内部会直接 panic(继承自 rsc.io/pdf 的风格), +// 不兜底会把整个 HTTP 请求打崩 +func extractPDFText(data []byte) (text string, err error) { + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("kb: PDF 解析异常(文件可能损坏或加密): %v", r) + } + }() + + reader, err := pdf.NewReader(bytes.NewReader(data), int64(len(data))) + if err != nil { + return "", fmt.Errorf("kb: 打开 PDF 失败: %w", err) + } + + var sb strings.Builder + totalPage := reader.NumPage() + for i := 1; i <= totalPage; i++ { + page := reader.Page(i) + if page.V.IsNull() { + continue + } + // 单页解析失败不中断整本导入(常见于个别页含特殊字体) + pageText, perr := page.GetPlainText(nil) + if perr != nil { + continue + } + pageText = strings.TrimSpace(pageText) + if pageText == "" { + continue + } + sb.WriteString(pageText) + sb.WriteString("\n\n") + } + return strings.TrimSpace(sb.String()), nil +} diff --git a/internal/kb/parser_test.go b/internal/kb/parser_test.go new file mode 100644 index 0000000..ca6948f --- /dev/null +++ b/internal/kb/parser_test.go @@ -0,0 +1,305 @@ +package kb + +// ======================================================================== +// 多格式解析器单元测试 +// ======================================================================== +// 测试样本全部在内存里构造(docx 手工拼 zip、pdf 手工拼对象表、 +// xlsx 用 excelize 生成),不依赖外部测试文件,CI 环境可直接跑 +// ======================================================================== + +import ( + "archive/zip" + "bytes" + "fmt" + "strings" + "testing" + "unicode/utf8" + + "github.com/xuri/excelize/v2" +) + +// buildMiniDocx 在内存构造一个最小可用的 docx(zip + word/document.xml) +func buildMiniDocx(t *testing.T, documentXML string) []byte { + t.Helper() + var buf bytes.Buffer + zw := zip.NewWriter(&buf) + w, err := zw.Create("word/document.xml") + if err != nil { + t.Fatalf("创建 zip 条目失败: %v", err) + } + if _, err := w.Write([]byte(documentXML)); err != nil { + t.Fatalf("写入 document.xml 失败: %v", err) + } + if err := zw.Close(); err != nil { + t.Fatalf("关闭 zip 失败: %v", err) + } + return buf.Bytes() +} + +// TestExtractDocxText 验证 docx 抽取:段落分隔、换行、制表符、表格单元格 +func TestExtractDocxText(t *testing.T) { + xml := `<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> + <w:body> + <w:p><w:r><w:t>感冒的中医辨证</w:t></w:r></w:p> + <w:p><w:r><w:t>风寒感冒:</w:t><w:br/><w:t>恶寒重发热轻</w:t><w:tab/><w:t>无汗头痛</w:t></w:r></w:p> + <w:tbl> + <w:tr><w:tc><w:p><w:r><w:t>药名</w:t></w:r></w:p></w:tc><w:tc><w:p><w:r><w:t>麻黄</w:t></w:r></w:p></w:tc></w:tr> + </w:tbl> + </w:body> +</w:document>` + data := buildMiniDocx(t, xml) + + text, err := extractDocxText(data) + if err != nil { + t.Fatalf("extractDocxText 报错: %v", err) + } + for _, want := range []string{"感冒的中医辨证", "风寒感冒:\n恶寒重发热轻\t无汗头痛", "药名", "麻黄"} { + if !strings.Contains(text, want) { + t.Errorf("抽取文本缺少 %q,实际:\n%s", want, text) + } + } + // 段落之间必须有空行(ChunkPlainText 依赖双换行切段) + if !strings.Contains(text, "感冒的中医辨证\n\n") { + t.Errorf("段落后缺少空行分隔,实际:\n%s", text) + } +} + +// TestExtractDocxText_InvalidZip 非 zip 内容要报友好错误而不是 panic +func TestExtractDocxText_InvalidZip(t *testing.T) { + if _, err := extractDocxText([]byte("这不是一个zip文件")); err == nil { + t.Fatal("非法 docx 应当报错") + } +} + +// TestExtractHTMLText 验证 HTML 抽取:跳过 script/style、标题转 #、列表、表格 +func TestExtractHTMLText(t *testing.T) { + htmlSrc := `<!DOCTYPE html> +<html><head><title>页面标题 + + +

中医基础理论

+

阴阳五行学说是中医的理论基础。

+

四诊

+
  • 望诊
  • 闻诊
+
寒证热证
+` + + text, err := extractHTMLText([]byte(htmlSrc)) + if err != nil { + t.Fatalf("extractHTMLText 报错: %v", err) + } + if strings.Contains(text, "alert") || strings.Contains(text, "color:red") || strings.Contains(text, "导航栏不要") { + t.Errorf("script/style/nav 内容未被过滤,实际:\n%s", text) + } + if !strings.Contains(text, "# 中医基础理论") || !strings.Contains(text, "## 四诊") { + t.Errorf("标题未转成 markdown 井号,实际:\n%s", text) + } + if !strings.Contains(text, "- 望诊") { + t.Errorf("列表项缺少 - 前缀,实际:\n%s", text) + } + + // 走 ChunkMarkdown 后标题应进入 chunk.title + chunks := ChunkMarkdown(text, DefaultChunkOptions()) + foundTitle := false + for _, c := range chunks { + if c.Title == "中医基础理论" || c.Title == "四诊" { + foundTitle = true + } + } + if !foundTitle { + t.Errorf("ChunkMarkdown 未把 HTML 标题切进 chunk.title,chunks=%+v", chunks) + } +} + +// buildMiniPDF 在内存构造一个最小合法 PDF(单页 + Helvetica + 一行文本) +// +// 手工维护对象偏移量表(xref),这是 PDF 规范要求的最小骨架 +func buildMiniPDF(text string) []byte { + content := fmt.Sprintf("BT /F1 12 Tf 72 720 Td (%s) Tj ET", text) + objs := []string{ + "<< /Type /Catalog /Pages 2 0 R >>", + "<< /Type /Pages /Kids [3 0 R] /Count 1 >>", + "<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>", + fmt.Sprintf("<< /Length %d >>\nstream\n%s\nendstream", len(content), content), + "<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>", + } + var buf bytes.Buffer + buf.WriteString("%PDF-1.4\n") + offsets := make([]int, len(objs)+1) + for i, o := range objs { + offsets[i+1] = buf.Len() + fmt.Fprintf(&buf, "%d 0 obj\n%s\nendobj\n", i+1, o) + } + xrefPos := buf.Len() + fmt.Fprintf(&buf, "xref\n0 %d\n", len(objs)+1) + buf.WriteString("0000000000 65535 f \n") + for i := 1; i <= len(objs); i++ { + fmt.Fprintf(&buf, "%010d 00000 n \n", offsets[i]) + } + fmt.Fprintf(&buf, "trailer\n<< /Size %d /Root 1 0 R >>\nstartxref\n%d\n%%%%EOF", len(objs)+1, xrefPos) + return buf.Bytes() +} + +// TestExtractPDFText 验证文字版 PDF 能抽出文本 +func TestExtractPDFText(t *testing.T) { + data := buildMiniPDF("Mahuang Decoction for cold") + text, err := extractPDFText(data) + if err != nil { + t.Fatalf("extractPDFText 报错: %v", err) + } + if !strings.Contains(text, "Mahuang") { + t.Errorf("PDF 文本抽取结果不含预期内容,实际: %q", text) + } +} + +// TestExtractPDFText_Invalid 畸形 PDF 要报错而不是 panic +func TestExtractPDFText_Invalid(t *testing.T) { + if _, err := extractPDFText([]byte("%PDF-1.4 这是坏文件")); err == nil { + t.Fatal("畸形 PDF 应当报错") + } +} + +// TestDecodeToUTF8_GBK 验证 GBK 字节流自动转码(「中医药」的 GBK 编码) +func TestDecodeToUTF8_GBK(t *testing.T) { + gbk := []byte{0xD6, 0xD0, 0xD2, 0xBD, 0xD2, 0xA9} + if got := decodeToUTF8(gbk); got != "中医药" { + t.Errorf("GBK 解码失败,got=%q", got) + } + // 合法 UTF-8 原样保留 + if got := decodeToUTF8([]byte("中医药")); got != "中医药" { + t.Errorf("UTF-8 被误转码,got=%q", got) + } + // UTF-8 BOM 被剥掉 + withBOM := append([]byte{0xEF, 0xBB, 0xBF}, []byte("中医药")...) + if got := decodeToUTF8(withBOM); got != "中医药" { + t.Errorf("UTF-8 BOM 未剥离,got=%q", got) + } +} + +// TestParseCSV 验证 CSV 解析(含引号字段与不等列数容错) +func TestParseCSV(t *testing.T) { + csvData := []byte("药名,性味,功效\n麻黄,辛温,\"发汗解表,宣肺平喘\"\n桂枝,辛甘温\n") + chunks, raw, err := parseCSV(csvData, DefaultChunkOptions()) + if err != nil { + t.Fatalf("parseCSV 报错: %v", err) + } + if len(chunks) == 0 { + t.Fatal("parseCSV 未产出 chunk") + } + if !strings.Contains(raw, "麻黄 | 辛温 | 发汗解表,宣肺平喘") { + t.Errorf("CSV 行未按「 | 」拼接,raw:\n%s", raw) + } + if !strings.Contains(raw, "桂枝 | 辛甘温") { + t.Errorf("不等列数的行解析失败,raw:\n%s", raw) + } +} + +// TestParseExcel_MaxKB 三列带表头 → 保持 MaxKB 语义(行即 chunk) +func TestParseExcel_MaxKB(t *testing.T) { + f := excelize.NewFile() + sheet := f.GetSheetName(0) + _ = f.SetSheetRow(sheet, "A1", &[]interface{}{"分段标题", "分段内容", "问题"}) + _ = f.SetSheetRow(sheet, "A2", &[]interface{}{"麻黄汤", "主治外感风寒表实证", "感冒怎么办;风寒感冒用什么方"}) + buf, err := f.WriteToBuffer() + if err != nil { + t.Fatalf("生成 xlsx 失败: %v", err) + } + + chunks, _, err := parseExcel(buf.Bytes(), DefaultChunkOptions()) + if err != nil { + t.Fatalf("parseExcel 报错: %v", err) + } + if len(chunks) != 1 { + t.Fatalf("MaxKB 模式应产出 1 个 chunk,实际 %d 个", len(chunks)) + } + if chunks[0].Title != "麻黄汤" || !strings.Contains(chunks[0].Content, "外感风寒") { + t.Errorf("MaxKB 三列语义解析错误: %+v", chunks[0]) + } + if chunks[0].Meta == nil { + t.Errorf("related_questions 未写入 meta") + } +} + +// TestParseExcel_Generic 四列以上无表头 → 通用表格模式(sheet 名为 chunk 标题) +func TestParseExcel_Generic(t *testing.T) { + f := excelize.NewFile() + sheet := f.GetSheetName(0) + _ = f.SetSheetName(sheet, "常用中药") + _ = f.SetSheetRow("常用中药", "A1", &[]interface{}{"麻黄", "辛温", "肺经", "发汗解表"}) + _ = f.SetSheetRow("常用中药", "A2", &[]interface{}{"桂枝", "辛甘温", "心经", "温通经脉"}) + buf, err := f.WriteToBuffer() + if err != nil { + t.Fatalf("生成 xlsx 失败: %v", err) + } + + chunks, raw, err := parseExcel(buf.Bytes(), DefaultChunkOptions()) + if err != nil { + t.Fatalf("parseExcel 报错: %v", err) + } + if len(chunks) == 0 { + t.Fatal("通用表格模式未产出 chunk") + } + if chunks[0].Title != "常用中药" { + t.Errorf("通用模式 chunk 标题应为 sheet 名,实际 %q", chunks[0].Title) + } + if !strings.Contains(raw, "麻黄 | 辛温 | 肺经 | 发汗解表") { + t.Errorf("通用表格行拼接错误,raw:\n%s", raw) + } +} + +// TestTruncateRunes 验证查询截断不破坏 UTF-8 字符边界 +func TestTruncateRunes(t *testing.T) { + if got := truncateRunes("麻黄汤治感冒", 3); got != "麻黄汤" { + t.Errorf("中文截断错误,got=%q", got) + } + if got := truncateRunes("短查询", 500); got != "短查询" { + t.Errorf("短于上限不应截断,got=%q", got) + } + if got := truncateRunes("abc", 0); got != "abc" { + t.Errorf("max<=0 应原样返回,got=%q", got) + } + // 截断结果必须仍是合法 UTF-8 + long := strings.Repeat("风寒感冒", 200) + if cut := truncateRunes(long, 500); !utf8.ValidString(cut) || utf8.RuneCountInString(cut) != 500 { + t.Errorf("长文本截断错误,len=%d valid=%v", utf8.RuneCountInString(cut), utf8.ValidString(cut)) + } +} + +// TestParseFileFromBytes_Dispatch 验证扩展名分发与防御逻辑 +func TestParseFileFromBytes_Dispatch(t *testing.T) { + // docx 走 docx 分支 + docx := buildMiniDocx(t, `四君子汤补气健脾`) + pdoc, err := ParseFileFromBytes("方剂.docx", docx, DefaultChunkOptions()) + if err != nil { + t.Fatalf("docx 分发失败: %v", err) + } + if pdoc.SourceType != "docx" || len(pdoc.Chunks) == 0 { + t.Errorf("docx 解析结果异常: type=%s chunks=%d", pdoc.SourceType, len(pdoc.Chunks)) + } + + // 老版 .doc 明确拒绝 + if _, err := ParseFileFromBytes("旧文档.doc", []byte("x"), DefaultChunkOptions()); err == nil { + t.Error(".doc 应当被拒绝") + } + + // 不支持的扩展名报错 + if _, err := ParseFileFromBytes("图片.png", []byte("x"), DefaultChunkOptions()); err == nil { + t.Error("png 应当被拒绝") + } + + // 空文本文件:解析成功但没有 chunk → 报「没有可导入的文本内容」 + if _, err := ParseFileFromBytes("空.txt", []byte(" \n\n "), DefaultChunkOptions()); err == nil { + t.Error("空文件应当报错") + } + + // html 走 html 分支且标题进 chunk.title + html := []byte(`

温病条辨

太阴风温、温热、温疫、冬温,初起恶风寒者,桂枝汤主之。

`) + pdoc, err = ParseFileFromBytes("wenbing.html", html, DefaultChunkOptions()) + if err != nil { + t.Fatalf("html 分发失败: %v", err) + } + if pdoc.SourceType != "html" || len(pdoc.Chunks) == 0 || pdoc.Chunks[0].Title != "温病条辨" { + t.Errorf("html 解析结果异常: type=%s chunks=%+v", pdoc.SourceType, pdoc.Chunks) + } +} diff --git a/internal/kb/searcher.go b/internal/kb/searcher.go new file mode 100644 index 0000000..764ed81 --- /dev/null +++ b/internal/kb/searcher.go @@ -0,0 +1,184 @@ +package kb + +import ( + "context" + "fmt" + "unicode/utf8" + + "tcm-agent/internal/dao" +) + +// ======================================================================== +// Searcher:知识库检索(V1 仅全文检索;V2 预留向量分支) +// ======================================================================== +// V1 路径: +// 1. 从 xk_system_config 读 search_mode(默认 fulltext) +// 2. 走 KBFullTextSearch(MySQL ngram FULLTEXT) +// 先 BOOLEAN MODE(短关键词=精确子串匹配),零命中或语法报错时 +// 自动回退 NATURAL LANGUAGE MODE(整句自动 2-gram 分词 + 相关度排序), +// 让 Agent 链路传整段病历上下文时也能检索到内容 +// 3. 返回带 score 的结果 +// +// V2 路径(设计已留好): +// - search_mode=vector:调 Embedder 把 query 转向量 → 拉库内已向量化 chunk → 算余弦 +// - search_mode=blend:fulltext + vector 加权融合 +// - 都靠 KBHasVectorized() 判断库是否已经向量化,未向量化自动降级到 fulltext +// ======================================================================== + +// maxQueryRunes 检索词长度上限(rune 计) +// +// Agent 链路会把整段病历上下文当 query 传进来(可能几千字), +// ngram 自然语言模式下 query 每个 2-gram 都参与匹配,过长会拖慢查询; +// 截断到与 chunk 尺寸同量级(500)足够表达检索意图 +const maxQueryRunes = 500 + +// naturalFallbackMinRunes 触发自然语言回退的最小查询长度 +// +// ≤2 字的查询本身就是单个 2-gram,BOOLEAN 短语匹配和自然语言模式 +// 结果完全等价,零命中时回退纯属浪费一次查询 +const naturalFallbackMinRunes = 3 + +// SearchResult 单条检索结果 +type SearchResult struct { + ChunkID uint `json:"chunk_id"` + LibraryID uint `json:"library_id"` + DocID uint `json:"doc_id"` + Title string `json:"title"` + Content string `json:"content"` + Score float64 `json:"score"` // 相关度(V1 是 FULLTEXT BM25 分数) + SourceType string `json:"source_type"` // 命中类型:fulltext / vector / blend +} + +// SearchOptions 检索参数 +type SearchOptions struct { + LibraryID uint // 必填:在哪个库里检索 + Query string // 必填:检索词 + TopK int // 默认 5 + Mode string // fulltext / vector / blend(V1 强制 fulltext) +} + +// Searcher 检索器 +// +// 通过 NewSearcher 构造,依赖 Embedder(V1 是 NoopEmbedder) +type Searcher struct { + embedder Embedder +} + +// NewSearcher 构造检索器 +// +// 参数: +// - embedder:向量化器(V1 传 NoopEmbedder,V2 传真实实现) +func NewSearcher(embedder Embedder) *Searcher { + return &Searcher{embedder: embedder} +} + +// Search 执行检索 +// +// 决策流程: +// 1. mode=fulltext 或库未向量化 → 走 KBFullTextSearch +// 2. mode=vector 且 embedder 可用且库已向量化 → 走 V2 向量分支 +// 3. mode=blend → 两路都跑(V2) +// +// V1 实现只走分支 1,分支 2/3 留 TODO 注释 +func (s *Searcher) Search(ctx context.Context, opt SearchOptions) ([]*SearchResult, error) { + if opt.LibraryID == 0 { + return nil, fmt.Errorf("kb: library_id 不能为空") + } + if opt.Query == "" { + return []*SearchResult{}, nil + } + if opt.TopK <= 0 { + opt.TopK = 5 + } + // 超长查询截断(Agent 链路传整段病历上下文的场景) + opt.Query = truncateRunes(opt.Query, maxQueryRunes) + + mode := opt.Mode + if mode == "" { + mode = "fulltext" + } + + // 判断库是否已向量化(V2 用,V1 始终 false) + vectorized, _ := dao.KBHasVectorized(opt.LibraryID) + + // 分支选择 + switch { + case mode == "fulltext": + return s.searchFullText(opt) + case mode == "vector" && s.embedder.Available() && vectorized: + // V2 实现:return s.searchVector(ctx, opt) + return nil, fmt.Errorf("kb: 向量检索 V2 未实现,请配置 ai_kb_search_mode=fulltext") + case mode == "blend" && s.embedder.Available() && vectorized: + // V2 实现:fulltext + vector 加权融合 + return nil, fmt.Errorf("kb: 混合检索 V2 未实现,请配置 ai_kb_search_mode=fulltext") + default: + // 自动降级到全文检索(最稳妥) + return s.searchFullText(opt) + } +} + +// searchFullText 走 MySQL FULLTEXT + ngram 检索(V1 主路径) +// +// 两段式策略(查询侧「自动分词」的实现方式): +// 1. 先 BOOLEAN MODE:ngram 把整个 query 转成连续 2-gram 短语,等价子串匹配, +// 短关键词(麻黄汤 / 风寒感冒)和带空格的多词查询(OR 语义)都精确高效 +// 2. 零命中或报错、且 query ≥ 3 字时,回退 NATURAL LANGUAGE MODE: +// MySQL 自动把 query 拆成 2-gram 做 OR 匹配 + 相关度排序, +// 自然语言长句(如整段病历上下文)也能召回相关分段 +// +// 为什么 BOOLEAN 报错也走回退:自然文本里的半角括号/引号/加减号 +// 会被 BOOLEAN MODE 当运算符解析,畸形组合会直接 SQL 报错(如括号不配对), +// 回退到自然语言模式对这类输入天然免疫 +func (s *Searcher) searchFullText(opt SearchOptions) ([]*SearchResult, error) { + rows, err := dao.KBFullTextSearch(opt.LibraryID, opt.Query, opt.TopK, false) + matchType := "fulltext" + if (err != nil || len(rows) == 0) && utf8.RuneCountInString(opt.Query) >= naturalFallbackMinRunes { + var nErr error + rows, nErr = dao.KBFullTextSearch(opt.LibraryID, opt.Query, opt.TopK, true) + if nErr != nil { + // 两种模式都失败:报自然语言模式的错(同一根因,如 DB 不可用) + return nil, fmt.Errorf("kb: FULLTEXT 检索失败: %w", nErr) + } + matchType = "fulltext-natural" + } else if err != nil { + return nil, fmt.Errorf("kb: FULLTEXT 检索失败: %w", err) + } + out := make([]*SearchResult, 0, len(rows)) + for _, r := range rows { + out = append(out, &SearchResult{ + ChunkID: r.ID, + LibraryID: r.LibraryID, + DocID: r.DocID, + Title: r.Title, + Content: r.Content, + Score: r.Score, + SourceType: matchType, + }) + } + return out, nil +} + +// truncateRunes 按 rune 截断字符串(不破坏 UTF-8 字符边界) +func truncateRunes(s string, max int) string { + if max <= 0 || utf8.RuneCountInString(s) <= max { + return s + } + runes := []rune(s) + return string(runes[:max]) +} + +// ======================================================================== +// V2 预留:向量检索(不实现,仅占位) +// ======================================================================== +// func (s *Searcher) searchVector(ctx context.Context, opt SearchOptions) ([]*SearchResult, error) { +// // 1. 把 query 转向量 +// qv, err := s.embedder.Embed(ctx, []string{opt.Query}) +// if err != nil || len(qv) == 0 { +// return nil, err +// } +// // 2. 拉库内已向量化 chunk +// chunks, _ := dao.KBListChunksByLibrary(opt.LibraryID) +// // 3. 算余弦相似度,排序取 TopK +// // (这一步 V2 用 flat 暴力搜索;如果 chunk 量大需要换 HNSW/faiss) +// // ... +// } diff --git a/internal/llm/deepseek.go b/internal/llm/deepseek.go new file mode 100644 index 0000000..f04ddef --- /dev/null +++ b/internal/llm/deepseek.go @@ -0,0 +1,451 @@ +package llm + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "time" + + "tcm-agent/internal/config" + "tcm-agent/internal/types" +) + +// ======================================================================== +// DeepSeek 客户端 +// ======================================================================== +// DeepSeek 提供 OpenAI 兼容协议,因此底层的 HTTP 调用逻辑与 OpenAI 几乎 +// 一致,主要区别在于默认 BaseURL 和模型名称。 +// +// 适用场景: +// - 病历生成(推理能力强,中文医学知识丰富) +// - 处方辅助(逻辑推理链清晰) +// - 知识问答(性价比高) +// +// 支持的能力: +// - function_calling(工具调用) +// - streaming(流式输出) +// - json_mode(结构化输出) +// - long_context(DeepSeek-V2 支持 128K) +// ======================================================================== + +// DeepSeekClient DeepSeek 模型客户端 +type DeepSeekClient struct { + apiKey string // API 密钥 + baseURL string // API 地址(默认 https://api.deepseek.com) + model string // 模型名称(deepseek-chat / deepseek-reasoner) + client *http.Client // HTTP 客户端(带超时) + capabilities map[string]bool // 能力声明 + lastResult *types.ChatResult // 最近一次 Chat 的 token/finish_reason 快照(线程不安全,仅用于单线程场景) +} + +// createDeepSeekClient 工厂方法:创建 DeepSeek 客户端 +func createDeepSeekClient(cfg *config.LLMConfigEx) (LLMClient, error) { + // 设置默认值 + baseURL := cfg.BaseURL + if baseURL == "" { + baseURL = "https://api.deepseek.com" + } + model := cfg.Model + if model == "" { + model = "deepseek-chat" // 默认用 V3 对话模型 + } + + client := &DeepSeekClient{ + apiKey: cfg.APIKey, + baseURL: baseURL, + model: model, + client: &http.Client{Timeout: time.Duration(cfg.Timeout) * time.Second}, + capabilities: map[string]bool{ + CapFunctionCalling: true, + CapStreaming: true, + CapJSONMode: true, + CapLongContext: true, // V2 支持 128K + CapEmbedding: false, // DeepSeek 暂不支持 Embedding + }, + } + + // 如果是 reasoner 模型,额外标注强推理能力 + if model == "deepseek-reasoner" { + client.capabilities["deep_reasoning"] = true + } + + log.Printf("[DeepSeek] 初始化完成 | 模型: %s | 地址: %s", model, baseURL) + return client, nil +} + +// Name 返回模型名称 +func (c *DeepSeekClient) Name() string { + return c.model +} + +// Provider 返回供应商名称 +func (c *DeepSeekClient) Provider() string { + return "deepseek" +} + +// Supports 查询是否支持某项能力 +func (c *DeepSeekClient) Supports(capability string) bool { + return c.capabilities[capability] +} + +// Chat 发起对话请求(非流式) +// +// 内部流程: +// 1. 将 types.Message 转换为 OpenAI 兼容格式 +// 2. 附加工具定义(Function Calling) +// 3. 发送 POST 请求到 /chat/completions +// 4. 解析响应,包装为 *types.Message +// +// 本方法使用客户端默认参数(temperature=0.3, max_tokens=4096); +// 需要运行时覆盖参数请用 ChatWithOpts(实现 OptAwareClient)。 +func (c *DeepSeekClient) Chat(ctx context.Context, messages []types.Message, tools []types.Tool) (*types.Message, error) { + return c.ChatWithOpts(ctx, messages, tools, ChatOpts{}) +} + +// ChatWithOpts 带运行时参数的 Chat(实现 OptAwareClient 接口) +// +// 为什么需要 opts: +// Agent 高级能力(Token 预算、ReAct 多轮)需要按场景动态调整: +// - max_tokens:每轮调小,给后续轮次留预算 +// - temperature:反思步骤降温,结果更稳定 +func (c *DeepSeekClient) ChatWithOpts(ctx context.Context, messages []types.Message, tools []types.Tool, opts ChatOpts) (*types.Message, error) { + // ===== 步骤1:转换消息格式 ===== + openAIMsgs := c.convertMessages(messages) + + // ===== 步骤2:构建请求体(带默认值) ===== + temperature := 0.3 // 医疗场景默认低温度 + if opts.Temperature > 0 { + temperature = opts.Temperature + } + maxTokens := 4096 // 默认输出上限 + if opts.MaxTokens > 0 { + maxTokens = opts.MaxTokens + } + + body := map[string]any{ + "model": c.model, + "messages": openAIMsgs, + "temperature": temperature, + "max_tokens": maxTokens, + } + + // 附加工具定义 + if len(tools) > 0 { + body["tools"] = c.buildToolDefs(tools) + body["tool_choice"] = "auto" // 让模型自主决定是否调用工具 + } + + // ===== 步骤3:发送请求 ===== + startedAt := time.Now() + resp, err := c.doRequest(ctx, body) + if err != nil { + return nil, fmt.Errorf("[DeepSeek] 请求失败: %w", err) + } + + // ===== 步骤4:解析响应(含 usage / finish_reason) ===== + msg, chatResult := c.parseResponseWithMeta(resp) + if chatResult != nil { + chatResult.Provider = "deepseek" + chatResult.Model = c.model + chatResult.DurationMs = int(time.Since(startedAt).Milliseconds()) + c.lastResult = chatResult + } + return msg, nil +} + +// LastChatResult 实现 TokenAwareClient 接口 +// +// 返回最近一次 Chat 调用的 token/finish_reason 快照,供 EnhancerService 写 step 表 +func (c *DeepSeekClient) LastChatResult() *types.ChatResult { + return c.lastResult +} + +// StreamChat 流式对话(逐块输出) +// +// 用于前端实时显示模型输出,提升用户体验。 +// 返回 channel,调用方用 for range 消费即可。 +func (c *DeepSeekClient) StreamChat(ctx context.Context, messages []types.Message, tools []types.Tool) (<-chan string, error) { + openAIMsgs := c.convertMessages(messages) + + body := map[string]any{ + "model": c.model, + "messages": openAIMsgs, + "temperature": 0.3, + "max_tokens": 4096, + "stream": true, // 开启流式 + } + + if len(tools) > 0 { + body["tools"] = c.buildToolDefs(tools) + } + + buf, _ := json.Marshal(body) + req, _ := http.NewRequestWithContext(ctx, "POST", c.baseURL+"/chat/completions", bytes.NewReader(buf)) + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Accept", "text/event-stream") // SSE 流 + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[DeepSeek] 流式请求失败: %w", err) + } + + // 解析 SSE 流,逐块发送到 channel + ch := make(chan string, 10) + go func() { + defer resp.Body.Close() + defer close(ch) + + // 简单的 SSE 解析(生产环境建议用专门的 SSE 库) + buf := make([]byte, 4096) + for { + n, err := resp.Body.Read(buf) + if n > 0 { + // 解析 "data: {...}" 格式 + chunk := string(buf[:n]) + // 这里简化解析,实际应处理完整的 SSE 事件 + ch <- chunk + } + if err != nil { + break + } + } + }() + + return ch, nil +} + +// Embed 生成文本向量 +// +// 注意:DeepSeek 官方 API 目前不提供 Embedding 服务。 +// 如果配置了 DeepSeek 做 Embedding,会返回错误。 +// 建议使用专门的 Embedding 模型(如 text-embedding-3-small)。 +func (c *DeepSeekClient) Embed(ctx context.Context, texts []string) ([][]float32, error) { + return nil, fmt.Errorf("[DeepSeek] 该模型不支持 Embedding,请配置专门的 Embedding 模型") +} + +// Close 释放资源 +func (c *DeepSeekClient) Close() error { + c.client.CloseIdleConnections() + return nil +} + +// ======================================================================== +// 内部辅助方法 +// ======================================================================== + +// convertMessages 将内部消息格式转换为 OpenAI 兼容格式 +// +// 工具调用相关帧遵守 OpenAI Function Calling 协议: +// - assistant 帧的 tool_calls 带 id,arguments 为 JSON 字符串 +// - tool 结果帧带 tool_call_id 与上面的 id 对应 +// 若 tool 帧缺 tool_call_id(老数据/异常路径),降级为 assistant 角色 +// 保持旧行为兜底(DeepSeek 会拒绝没有 tool_call_id 的 tool 帧) +func (c *DeepSeekClient) convertMessages(messages []types.Message) []map[string]any { + openAIMsgs := make([]map[string]any, 0, len(messages)) + for _, m := range messages { + msg := map[string]any{ + "role": m.Role, + "content": m.Content, + } + // tool 结果帧处理 + if m.Role == "tool" { + if m.ToolCallID != "" { + // 协议正确路径:带 tool_call_id 回传 + msg["tool_call_id"] = m.ToolCallID + } else { + // 兜底:没有 id 时降级为 assistant(旧 hack,避免被 DeepSeek 拒收) + msg["role"] = "assistant" + } + } + // assistant 工具调用帧回放(arguments 必须是 JSON 字符串,不能传对象) + if m.ToolCall != nil { + args, _ := json.Marshal(m.ToolCall.Params) + id := m.ToolCall.ID + if id == "" { + id = fmt.Sprintf("call_%d", time.Now().UnixNano()) + } + msg["tool_calls"] = []map[string]any{ + { + "id": id, + "type": "function", + "function": map[string]any{ + "name": m.ToolCall.ToolName, + "arguments": string(args), + }, + }, + } + } + openAIMsgs = append(openAIMsgs, msg) + } + return openAIMsgs +} + +// buildToolDefs 构建 OpenAI Function Calling 工具定义 +func (c *DeepSeekClient) buildToolDefs(tools []types.Tool) []map[string]any { + toolDefs := make([]map[string]any, 0, len(tools)) + for _, t := range tools { + toolDefs = append(toolDefs, map[string]any{ + "type": "function", + "function": map[string]any{ + "name": t.Name(), + "description": t.Description(), + "parameters": map[string]any{ + "type": "object", + "properties": map[string]any{ + "query": map[string]any{ + "type": "string", + "description": "检索/查询的关键词或问题", + }, + }, + "required": []string{"query"}, + }, + }, + }) + } + return toolDefs +} + +// doRequest 执行 HTTP 请求 +func (c *DeepSeekClient) doRequest(ctx context.Context, body map[string]any) (map[string]any, error) { + buf, _ := json.Marshal(body) + req, err := http.NewRequestWithContext(ctx, "POST", c.baseURL+"/chat/completions", bytes.NewReader(buf)) + if err != nil { + return nil, fmt.Errorf("创建请求失败: %w", err) + } + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("网络请求失败: %w", err) + } + defer resp.Body.Close() + + data, _ := io.ReadAll(resp.Body) + + // 检查 HTTP 状态码 + if resp.StatusCode != 200 { + return nil, fmt.Errorf("DeepSeek API 返回 %d: %s", resp.StatusCode, string(data)) + } + + // 解析 JSON + var result map[string]any + if err := json.Unmarshal(data, &result); err != nil { + return nil, fmt.Errorf("解析响应失败: %w | 原始: %s", err, string(data[:min(len(data), 500)])) + } + + // 检查 API 错误 + if errObj, ok := result["error"].(map[string]any); ok { + msg, _ := errObj["message"].(string) + return nil, fmt.Errorf("DeepSeek API 错误: %s", msg) + } + + return result, nil +} + +// parseResponse 解析模型响应为 types.Message(保留旧 API 供 StreamChat 复用) +func (c *DeepSeekClient) parseResponse(data map[string]any) *types.Message { + msg, _ := c.parseResponseWithMeta(data) + return msg +} + +// parseResponseWithMeta 解析响应并附带 token/finish_reason 等元数据 +// +// 返回: +// - *types.Message:assistant 消息(可能含 tool_calls) +// - *types.ChatResult:token 用量 + finish_reason(写入 lastResult 供 LastChatResult 取) +// +// 为什么不修改 parseResponse 签名: +// parseResponse 被 StreamChat 调用,StreamChat 不需要 token 统计。 +// 新增独立方法避免破坏流式路径。 +func (c *DeepSeekClient) parseResponseWithMeta(data map[string]any) (*types.Message, *types.ChatResult) { + msg := &types.Message{ + Role: "assistant", + Timestamp: time.Now().Unix(), + } + chatResult := &types.ChatResult{} + + choices, ok := data["choices"].([]any) + if !ok || len(choices) == 0 { + msg.Content = "(模型返回空响应)" + return msg, chatResult + } + + choice, ok := choices[0].(map[string]any) + if !ok { + msg.Content = "(无法解析模型响应)" + return msg, chatResult + } + + // 解析 finish_reason(stop/length/content_filter/tool_calls) + // length 表示被 max_tokens 截断,调用方据此可触发重试或修复 + if fr, ok := choice["finish_reason"].(string); ok { + chatResult.FinishReason = fr + } + + respMsg, ok := choice["message"].(map[string]any) + if !ok { + msg.Content = "(响应格式异常)" + return msg, chatResult + } + + // 提取文本内容 + if content, ok := respMsg["content"].(string); ok { + msg.Content = content + } + + // 检查工具调用 + if toolCalls, ok := respMsg["tool_calls"].([]any); ok && len(toolCalls) > 0 { + tc := toolCalls[0].(map[string]any) + fn, _ := tc["function"].(map[string]any) + + name, _ := fn["name"].(string) + argsStr, _ := fn["arguments"].(string) + + params := make(map[string]any) + json.Unmarshal([]byte(argsStr), ¶ms) + + // id 厂商未返回时生成一个,保证回放帧协议完整(tool_call_id 有对应目标) + id, _ := tc["id"].(string) + if id == "" { + id = fmt.Sprintf("call_%d", time.Now().UnixNano()) + } + msg.ToolCall = &types.ToolCallInfo{ + ID: id, + ToolName: name, + Params: params, + } + chatResult.ToolCall = msg.ToolCall + log.Printf("[DeepSeek] 模型决定调用工具: %s 参数: %v", name, params) + } + + // 解析 token 用量(usage 字段) + // DeepSeek 与 OpenAI 协议一致:prompt_tokens / completion_tokens / total_tokens + if usage, ok := data["usage"].(map[string]any); ok { + chatResult.Usage = usage + if v, ok := usage["prompt_tokens"].(float64); ok { + chatResult.PromptTokens = int(v) + } + if v, ok := usage["completion_tokens"].(float64); ok { + chatResult.CompletionTokens = int(v) + } + if v, ok := usage["total_tokens"].(float64); ok { + chatResult.TotalTokens = int(v) + } + } + + return msg, chatResult +} + +// min 取较小值(Go 1.21 以下没有泛型 min) +func min(a, b int) int { + if a < b { + return a + } + return b +} diff --git a/internal/llm/factory.go b/internal/llm/factory.go new file mode 100644 index 0000000..86344de --- /dev/null +++ b/internal/llm/factory.go @@ -0,0 +1,737 @@ +package llm + +import ( + "context" + "fmt" + "log" + "os" + "strings" + "sync" + + "tcm-agent/internal/config" + "tcm-agent/internal/dao" + "tcm-agent/internal/types" +) + +// ======================================================================== +// LLM 模型工厂 —— 设计思路说明 +// ======================================================================== +// 为什么要工厂模式? +// AI Agent 平台不可能只绑定一家模型厂商。今天用 DeepSeek,明天可能要 +// 接入 GPT-4o、通义千问、本地 Ollama,甚至要同时用多个模型(比如: +// 病历生成用 DeepSeek,处方校验用 GPT-4,Embedding 用本地模型)。 +// +// 工厂模式解决的问题: +// 1. 统一接口:所有模型实现同一个 LLMClient 接口 +// 2. 按名取用:通过 Provider 名称("deepseek"/"openai")动态创建 +// 3. 配置驱动:新增模型只需改 config.yaml,不改一行业务代码 +// 4. 多模型共存:不同 Agent 可以用不同模型,互不干扰 +// 5. 降级兜底:主模型挂了可以自动切到备用模型 +// +// 架构层次: +// ┌─────────────────────────────────────────────────────────┐ +// │ Agent Runner (调度层) │ +// │ 病历Agent → 用 ModelRouter.Get("emr-generator") │ +// │ 处方Agent → 用 ModelRouter.Get("prescription-maker") │ +// ├─────────────────────────────────────────────────────────┤ +// │ ModelRouter (路由层) │ +// │ 按场景名 → 映射到具体 Provider → 返回 LLMClient │ +// ├─────────────────────────────────────────────────────────┤ +// │ LLMFactory (工厂层) │ +// │ "deepseek" → DeepSeekClient │ +// │ "openai" → OpenAIClient │ +// │ "azure" → AzureOpenAIClient │ +// │ "ollama" → OllamaClient (本地模型) │ +// │ "qwen" → QwenClient (通义千问) │ +// │ "spark" → SparkClient (讯飞星火 OpenAPI) │ +// ├─────────────────────────────────────────────────────────┤ +// │ LLMClient Interface (统一接口) │ +// │ Chat() / Embed() / StreamChat() / Name() / Supports()│ +// └─────────────────────────────────────────────────────────┘ +// ======================================================================== + +// ======================================================================== +// 统一接口定义 +// ======================================================================== + +// LLMClient 大语言模型客户端统一接口 +// +// 所有模型供应商(DeepSeek/OpenAI/Azure/Ollama/通义千问)都必须实现此接口。 +// Agent Runner 只依赖这个接口,不关心背后是哪家的模型。 +// +// 设计原则: +// - 输入统一:messages + tools,所有模型都一样 +// - 输出统一:返回 *types.Message,Agent 不感知模型差异 +// - 能力声明:Supports() 让调用方知道这个模型支持哪些特性 +type LLMClient interface { + // Chat 发起一次对话请求(非流式) + // ctx - 上下文,支持超时取消 + // messages - 对话历史(包含 system/user/assistant/tool 角色) + // tools - 可供模型调用的工具列表(Function Calling) + // 返回 - 模型生成的消息(可能包含工具调用指令) + Chat(ctx context.Context, messages []types.Message, tools []types.Tool) (*types.Message, error) + + // StreamChat 发起流式对话(可选实现,用于实时输出) + // 返回 chan 逐块输出文本,调用方按需消费 + StreamChat(ctx context.Context, messages []types.Message, tools []types.Tool) (<-chan string, error) + + // Embed 生成文本向量(用于知识库检索、语义记忆) + // 输入文本列表,返回对应的向量数组 + Embed(ctx context.Context, texts []string) ([][]float32, error) + + // Name 返回模型标识(如 "deepseek-chat" / "gpt-4o") + Name() string + + // Provider 返回供应商名称(如 "deepseek" / "openai") + Provider() string + + // Supports 查询该模型是否支持某项能力 + // 常用能力: "function_calling" / "vision" / "streaming" / "json_mode" + Supports(capability string) bool + + // Close 释放资源(关闭连接池等) + Close() error +} + +// ======================================================================== +// 能力常量定义 +// ======================================================================== + +const ( + CapFunctionCalling = "function_calling" // 函数调用(工具使用) + CapVision = "vision" // 多模态视觉理解 + CapStreaming = "streaming" // 流式输出 + CapJSONMode = "json_mode" // JSON 模式输出 + CapEmbedding = "embedding" // 文本向量化 + CapLongContext = "long_context" // 长上下文(>32K) +) + +// ------------------------------------------------------------------ +// 可选能力接口(用于类型断言取 token/finish_reason) +// ------------------------------------------------------------------ + +// TokenAwareClient 可选接口:实现此接口的 provider 可以返回 token 用量 +// +// 为什么不直接改 LLMClient.Chat 返回类型: +// Chat 返回 *types.Message 是为了"对话内容"语义清晰,且接口已被所有 provider +// 实现;强行加 token 字段会污染所有调用方。改用可选接口让需要 token 统计的 +// 调用方(EnhancerService、ReactLoop)通过类型断言获取,老 provider 不实现 +// 时自动回落到 0,零破坏。 +// +// 实现方:DeepSeekClient / SparkClient / OpenAIClient +type TokenAwareClient interface { + // LastChatResult 返回最近一次 Chat 调用的 token 用量与 finish_reason + // + // 注意:本方法是"线程不安全"的——它返回的是客户端实例最近一次调用的快照。 + // 业务上 LLMClient 通常是单例,多协程并发调用同一 client 时本方法返回值 + // 不可靠。EnhancerService 调用模式是"一次请求串行一次 Chat",不存在并发, + // 所以可用。如果将来加并发,需要换成 Chat 直接返回 *ChatResult。 + LastChatResult() *types.ChatResult +} + +// ChatOpts 调用 LLM 时的可配置参数(覆盖客户端默认值) +// +// 用途:Agent 高级能力(ReAct / Token 预算)需要按场景动态调整 max_tokens、 +// temperature 等参数。但 LLMClient.Chat 接口签名固定为 (ctx, messages, tools), +// 不能扩。所以本结构配合 OptAwareClient 可选接口使用:实现此接口的客户端 +// 可以接受运行时参数。 +type ChatOpts struct { + MaxTokens int // 单次响应最大 token 数(透传厂商 max_tokens) + Temperature float64 // 温度(0-2) + TopP float64 // nucleus sampling +} + +// OptAwareClient 可选接口:支持运行时传 ChatOpts 的客户端 +// +// 实现方:DeepSeekClient / SparkClient / OpenAIClient +// 调用方:ReactLoop、EnhancerService(通过类型断言判断是否支持) +type OptAwareClient interface { + // ChatWithOpts 带 opts 调用 LLM + // + // opts 字段为 0 值时客户端使用自身默认值 + ChatWithOpts(ctx context.Context, messages []types.Message, tools []types.Tool, opts ChatOpts) (*types.Message, error) +} + +// ======================================================================== +// 工厂实现 +// ======================================================================== + +// ProviderFactory 模型工厂 +// +// 负责根据 Provider 名称创建对应的 LLMClient 实例。 +// 采用"注册模式 + 工厂方法"的组合: +// - 内置常见供应商的创建逻辑 +// - 支持外部注册自定义供应商 +type ProviderFactory struct { + mu sync.RWMutex + creators map[string]CreatorFunc // 已注册的创建函数 + configs map[string]*config.LLMConfigEx +} + +// CreatorFunc 创建 LLMClient 的函数签名 +// 外部扩展时实现此函数并注册到工厂 +type CreatorFunc func(cfg *config.LLMConfigEx) (LLMClient, error) + +// NewProviderFactory 创建模型工厂(注册所有内置供应商) +func NewProviderFactory(cfgs map[string]*config.LLMConfigEx) *ProviderFactory { + f := &ProviderFactory{ + creators: make(map[string]CreatorFunc), + configs: cfgs, + } + + // 注册内置供应商 + f.Register("deepseek", createDeepSeekClient) + f.Register("openai", createOpenAIClient) + f.Register("azure", createAzureClient) + f.Register("ollama", createOllamaClient) + f.Register("qwen", createQwenClient) + f.Register("spark", createSparkClient) // 讯飞星火(OpenAPI 协议) + f.Register("mock", createMockClient) // 测试用 + + return f +} + +// Register 注册自定义模型供应商 +// +// 使用示例: +// factory.Register("my-custom-llm", func(cfg *config.LLMConfigEx) (LLMClient, error) { +// return &MyCustomClient{...}, nil +// }) +func (f *ProviderFactory) Register(provider string, creator CreatorFunc) { + f.mu.Lock() + defer f.mu.Unlock() + f.creators[provider] = creator + log.Printf("[LLM工厂] 注册模型供应商: %s", provider) +} + +// Create 根据供应商名称创建 LLMClient +// +// 参数: +// provider - 供应商名称("deepseek"/"openai" 等) +// +// 返回: +// 对应的 LLMClient 实例 +// +// 错误: +// 供应商未注册 / 配置缺失 / 初始化失败 +func (f *ProviderFactory) Create(provider string) (LLMClient, error) { + f.mu.RLock() + creator, ok := f.creators[provider] + cfg, hasCfg := f.configs[provider] + f.mu.RUnlock() + + if !ok { + return nil, fmt.Errorf("[LLM工厂] 未注册的模型供应商: %s(已注册: %v)", + provider, f.ListProviders()) + } + if !hasCfg { + return nil, fmt.Errorf("[LLM工厂] 供应商 %s 缺少配置信息", provider) + } + + client, err := creator(cfg) + if err != nil { + return nil, fmt.Errorf("[LLM工厂] 创建 %s 客户端失败: %w", provider, err) + } + + log.Printf("[LLM工厂] ✅ 成功创建模型: %s (模型名: %s, 地址: %s)", + provider, cfg.Model, cfg.BaseURL) + return client, nil +} + +// ListProviders 列出所有已注册的供应商 +func (f *ProviderFactory) ListProviders() []string { + f.mu.RLock() + defer f.mu.RUnlock() + names := make([]string, 0, len(f.creators)) + for name := range f.creators { + names = append(names, name) + } + return names +} + +// GetConfig 获取指定供应商的配置 +func (f *ProviderFactory) GetConfig(provider string) (*config.LLMConfigEx, bool) { + f.mu.RLock() + defer f.mu.RUnlock() + cfg, ok := f.configs[provider] + return cfg, ok +} + +// ======================================================================== +// 模型路由 —— 按场景自动选择最合适的模型 +// ======================================================================== + +// ModelRouter 模型路由器 +// +// 核心职责:将"业务场景"映射到"具体模型",实现"不同任务用不同模型"。 +// +// 为什么要路由? +// 不同的 Agent 任务对模型的要求不同: +// - 病历生成:需要强推理 + 医学知识 → 用 DeepSeek V3 / GPT-4o +// - 处方校验:需要严谨规则判断 → 用 GPT-4o / Claude +// - 简单问答:轻量快速即可 → 用 DeepSeek V2-Lite / 本地 Ollama +// - Embedding:纯向量化 → 用专门的 Embedding 模型 +// +// 通过路由配置,可以灵活组合,且随时切换。 +type ModelRouter struct { + factory *ProviderFactory + routes map[string]string // 场景名 → 供应商名 + clients map[string]LLMClient // 已创建的客户端缓存(单例复用,按 provider 名) + configClients map[string]*clientCacheEntry // 按"运行时完整配置"缓存(支持配置变更自动重建) + mu sync.RWMutex + defaultProvider string +} + +// NewModelRouter 创建模型路由器 +// +// 参数: +// factory - 模型工厂实例 +// routes - 场景到供应商的映射(如 "emr" → "deepseek") +// defaultProvider - 默认供应商(找不到路由时使用) +func NewModelRouter(factory *ProviderFactory, routes map[string]string, defaultProvider string) *ModelRouter { + return &ModelRouter{ + factory: factory, + routes: routes, + clients: make(map[string]LLMClient), + configClients: make(map[string]*clientCacheEntry), + defaultProvider: defaultProvider, + } +} + +// Get 根据场景名获取对应的 LLMClient +// +// 这是 Agent 代码中最常调用的方法: +// llm := router.Get("emr-generator") +// resp, err := llm.Chat(ctx, messages, tools) +func (r *ModelRouter) Get(scene string) (LLMClient, error) { + // 1. 查路由表,找到对应的供应商 + provider, ok := r.routes[scene] + if !ok { + provider = r.defaultProvider + log.Printf("[模型路由] 场景 %s 未配置路由,使用默认: %s", scene, provider) + } + + // 2. 检查缓存(已创建的客户端直接复用) + r.mu.RLock() + if client, ok := r.clients[provider]; ok { + r.mu.RUnlock() + return client, nil + } + r.mu.RUnlock() + + // 3. 未缓存则通过工厂创建 + client, err := r.factory.Create(provider) + if err != nil { + return nil, err + } + + // 4. 写入缓存 + r.mu.Lock() + r.clients[provider] = client + r.mu.Unlock() + + return client, nil +} + +// GetByProvider 直接按供应商名获取(绕过路由) +func (r *ModelRouter) GetByProvider(provider string) (LLMClient, error) { + r.mu.RLock() + if client, ok := r.clients[provider]; ok { + r.mu.RUnlock() + return client, nil + } + r.mu.RUnlock() + + client, err := r.factory.Create(provider) + if err != nil { + return nil, err + } + r.mu.Lock() + r.clients[provider] = client + r.mu.Unlock() + return client, nil +} + +// 内部结构:client 缓存里同时保存"配置指纹",用于检测 DB 配置变更 +// +// 为什么需要指纹:DB 是配置单一可信源,后台改完 1 分钟内要生效; +// 没有指纹就只能用 client 创建时间,无法判断"是否需要重建"。 +// cfgFingerprint 用 model + api_key_id + base_url + api_key 后 4 位组成(api_key 不全打出来避免泄露) +type clientCacheEntry struct { + client LLMClient + fingerprint string // 配置指纹,变化时需要重建 client +} + +// computeFingerprint 计算配置指纹 +// +// 用于判断"DB 里的配置是否变了"—— +// 只要 model / base_url / api_key_id / api_key 拼接出的字符串变了, +// 指纹就变,从而触发 client 重建。 +func computeFingerprint(cfg *config.LLMConfigEx) string { + // api_key 只取后 4 位避免日志/内存中泄露完整密钥 + keyTail := "" + if len(cfg.APIKey) > 4 { + keyTail = cfg.APIKey[len(cfg.APIKey)-4:] + } else { + keyTail = cfg.APIKey + } + return fmt.Sprintf("%s|%s|%s|%s", cfg.Model, cfg.BaseURL, keyTail, cfg.Provider) +} + +// GetByConfig 按完整配置获取 client,配置变更时自动重建 +// +// 这是支持"DB 配置即时生效"的核心方法—— +// 调用方每次都传最新的 cfg(来自 dao.LoadActiveLLMConfig 的结果), +// ModelRouter 通过指纹比对决定是复用现有 client 还是重建。 +// +// 为什么不复用 GetByProvider:GetByProvider 只按 provider 名缓存, +// 无法感知配置变更(model/api_key 变了它不知道,会用旧 client)。 +// +// 入参 cacheKey:缓存键,一般传 provider 名(同一 provider 多次调用复用同一条目) +// 入参 cfg:完整配置(含 Provider/APIKey/BaseURL/Model/Timeout 等) +// +// 返回:可用的 LLMClient(可能是新建的也可能是复用的) +func (r *ModelRouter) GetByConfig(cacheKey string, cfg *config.LLMConfigEx) (LLMClient, error) { + if cfg == nil { + return nil, fmt.Errorf("[模型路由] cfg 为空") + } + + newFingerprint := computeFingerprint(cfg) + + r.mu.Lock() + defer r.mu.Unlock() + + // 同一 cacheKey 已有 client 且指纹一致 → 直接复用 + if entry, ok := r.configClients[cacheKey]; ok && entry.fingerprint == newFingerprint { + return entry.client, nil + } + + // 指纹变了或首次创建:通过工厂创建新 client + // 工厂需要 cfg 在 configs map 里能查到,这里临时写一份进去 + r.factory.configs[cfg.Provider] = cfg + client, err := r.factory.Create(cfg.Provider) + if err != nil { + return nil, fmt.Errorf("[模型路由] 按 config 创建 %s 失败: %w", cfg.Provider, err) + } + + // 关闭旧 client(如果有)释放 HTTP 连接池 + if old, ok := r.configClients[cacheKey]; ok { + old.client.Close() + } + + r.configClients[cacheKey] = &clientCacheEntry{ + client: client, + fingerprint: newFingerprint, + } + + reason := "首次创建" + if _, existed := r.clients[cacheKey]; existed { + reason = "配置变更重建" + } + log.Printf("[模型路由] %s: cacheKey=%s provider=%s model=%s fp=%s", + reason, cacheKey, cfg.Provider, cfg.Model, newFingerprint) + return client, nil +} + +// RegisterRoute 动态注册/修改路由规则 +func (r *ModelRouter) RegisterRoute(scene, provider string) { + r.mu.Lock() + defer r.mu.Unlock() + r.routes[scene] = provider + log.Printf("[模型路由] 注册路由: %s → %s", scene, provider) +} + +// ListRoutes 列出所有路由规则 +func (r *ModelRouter) ListRoutes() map[string]string { + r.mu.RLock() + defer r.mu.RUnlock() + result := make(map[string]string, len(r.routes)) + for k, v := range r.routes { + result[k] = v + } + return result +} + +// ResolveProvider 反查场景对应的 provider 名(不创建客户端,仅返回字符串) +// +// 用于上层记录"实际使用了哪个 provider"到审计日志/DB 子表 +// 若场景未注册返回空串 +func (r *ModelRouter) ResolveProvider(scene string) string { + r.mu.RLock() + defer r.mu.RUnlock() + return r.routes[scene] +} + +// Close 关闭所有客户端连接 +func (r *ModelRouter) Close() { + r.mu.Lock() + defer r.mu.Unlock() + for name, client := range r.clients { + client.Close() + log.Printf("[模型路由] 关闭模型连接: %s", name) + } + r.clients = make(map[string]LLMClient) + // 同时关闭 configClients(DB 驱动创建的 client 不在 clients map 里) + for key, entry := range r.configClients { + entry.client.Close() + log.Printf("[模型路由] 关闭 configClient: %s", key) + } + r.configClients = make(map[string]*clientCacheEntry) +} + +// invalidateConfigClients 清空 configClients 缓存(不关闭 client,避免正在调用中的请求中断) +// +// 设计权衡: +// - 配置变更后旧 client 立即不可用 → 但已 in-flight 的 HTTP 请求通常几百毫秒就完成 +// - 关闭旧 client 会触发底层连接池中断,可能导致刚发起的请求失败 +// - 折中:清空缓存 map(让下次 GetByConfig 重建),但不主动 Close 旧 client, +// 让 Go GC 在所有引用消失后自动回收(HTTP 连接池的 idle conns 会在 KeepAlive 超时后自然关闭) +func (r *ModelRouter) invalidateConfigClients() { + r.mu.Lock() + count := len(r.configClients) + r.configClients = make(map[string]*clientCacheEntry) + r.mu.Unlock() + log.Printf("[模型路由] 已清空 configClients 缓存(%d 条),下次请求将按最新配置重建", count) +} + +// ======================================================================== +// 降级策略 —— 主模型挂了自动切换备用 +// ======================================================================== + +// FallbackChain 降级链 +// +// 当主模型 API 超时或报错时,按预设顺序尝试备用模型。 +// 确保 Agent 服务的高可用。 +type FallbackChain struct { + router *ModelRouter + chains map[string][]string // 场景 → 降级顺序列表 + mu sync.RWMutex +} + +// NewFallbackChain 创建降级链 +// +// chains 示例: +// { +// "emr-generator": ["deepseek", "qwen", "ollama"], // 主→备1→备2 +// "prescription": ["openai", "deepseek"], +// } +func NewFallbackChain(router *ModelRouter, chains map[string][]string) *FallbackChain { + return &FallbackChain{ + router: router, + chains: chains, + } +} + +// ChatWithFallback 带降级的对话调用 +// +// 依次尝试链中的模型,第一个成功的即返回。 +// 全部失败则返回最后一个错误。 +func (fc *FallbackChain) ChatWithFallback( + ctx context.Context, + scene string, + messages []types.Message, + tools []types.Tool, +) (*types.Message, error) { + fc.mu.RLock() + chain, ok := fc.chains[scene] + fc.mu.RUnlock() + + if !ok || len(chain) == 0 { + // 无降级配置,直接走正常路由 + client, err := fc.router.Get(scene) + if err != nil { + return nil, err + } + return client.Chat(ctx, messages, tools) + } + + // 按降级链依次尝试 + var lastErr error + for i, provider := range chain { + client, err := fc.router.GetByProvider(provider) + if err != nil { + log.Printf("[降级] 获取 %s 失败: %v,尝试下一个", provider, err) + lastErr = err + continue + } + + resp, err := client.Chat(ctx, messages, tools) + if err == nil { + if i > 0 { + log.Printf("[降级] ✅ 使用备用模型 %s 成功(主模型不可用)", provider) + } + return resp, nil + } + log.Printf("[降级] %s 调用失败: %v,尝试下一个", provider, err) + lastErr = err + } + + return nil, fmt.Errorf("[降级] 所有模型均不可用,最后错误: %w", lastErr) +} + +// RegisterChain 注册降级链 +func (fc *FallbackChain) RegisterChain(scene string, providers []string) { + fc.mu.Lock() + defer fc.mu.Unlock() + fc.chains[scene] = providers + log.Printf("[降级] 注册降级链: %s → %v", scene, providers) +}// GetChain 读取某个 scene 的降级链(不创建客户端,仅返回字符串列表) +// +// 用于 enhancer.go 在主模型失败时手动遍历重试: +// - 拿到链后跳过已经失败的 provider,逐个 GetByProvider + callLLMWithMeta +// - 比 ChatWithFallback 更灵活,能保留 token 统计到 EnhanceStep +// +// 不存在返回 (nil, false) +func (fc *FallbackChain) GetChain(scene string) ([]string, bool) { + fc.mu.RLock() + defer fc.mu.RUnlock() + chain, ok := fc.chains[scene] + if !ok { + return nil, false + } + // 拷贝一份,避免调用方误改内部状态 + out := make([]string, len(chain)) + copy(out, chain) + return out, true +} + +// ======================================================================== +// 便捷初始化函数 +// ======================================================================== + +// 包级全局变量:当前 ModelRouter 单例 +// +// 用途:InvalidateConfigClientCache 这种"运维接口"在 handler 里无法直接拿到 router 引用, +// 通过包级变量让外部能调到 router 内部的清理逻辑。 +// +// 启动时由 InitLLM 写入;进程生命周期内不变。 +var globalRouter *ModelRouter + +// InitLLM 一键初始化整个LLM层(工厂+路由+降级) +// +// 这是 main.go 中调用的入口函数,根据配置文件自动装配所有模型。 +// +// 参数: +// cfg - 全局配置(包含 LLM 多模型配置) +// +// 返回: +// router - 模型路由器(Agent 日常使用) +// fallback - 降级链(带高可用保障) +// factory - 工厂(需要动态创建时用) +func InitLLM(cfg *config.Config) (*ModelRouter, *FallbackChain, *ProviderFactory) { + // 1. 构建配置映射 + configs := make(map[string]*config.LLMConfigEx) + for name, llmCfg := range cfg.LLM.Models { + configs[name] = &llmCfg + } + + // 2. 创建工厂 + factory := NewProviderFactory(configs) + + // 3. 构建路由表 + // 从配置中读取场景→模型的映射,没有则用默认值 + routes := cfg.LLM.Routes + if routes == nil { + // 默认路由:所有场景走默认模型 + routes = make(map[string]string) + for scene := range defaultSceneRoutes() { + routes[scene] = cfg.LLM.DefaultProvider + } + } + + router := NewModelRouter(factory, routes, cfg.LLM.DefaultProvider) + + // 4. 构建降级链 + fallback := NewFallbackChain(router, cfg.LLM.FallbackChains) + + // ★ 把 router 存到包级变量,让运维接口能调到 + globalRouter = router + + log.Printf("[LLM初始化] ✅ 完成 | 已注册模型: %v | 默认: %s", + factory.ListProviders(), cfg.LLM.DefaultProvider) + + return router, fallback, factory +} + +// InvalidateConfigClientCache 清空所有"按 config 创建"的 client 缓存 + dao 的 active 配置缓存 +// +// 使用场景:PHP 后台改完 xk_system_config 的 ai_active_* 后, +// 调 POST /api/v1/models/invalidate-cache,Go 端立刻: +// 1. 清 dao.LoadActiveLLMConfig 的 60s 缓存 → 下次读 DB 拿到新 provider/model +// 2. 清 ModelRouter.configClients 的指纹缓存 → 下次按新 config 重建 client +// +// 注意:不会清 clients map(yaml 路由的兜底 client 保留,避免 DB 抖动时全断) +func InvalidateConfigClientCache() { + // 先失效 dao 缓存,让下次 LoadActiveLLMConfig 重新查 DB + dao.InvalidateActiveLLMCache() + // 再失效 router 的 configClients 缓存 + if globalRouter != nil { + globalRouter.invalidateConfigClients() + } +} + +// PeekActiveLLMConfig 探测当前生效的 LLM 配置(绕过 dao 缓存) +// +// 用途:GET /api/v1/models/active-config 排查接口调用, +// 不走缓存直读 DB,让运维看到的就是当前 DB 里的真实值 +func PeekActiveLLMConfig(fallbackProvider string) (*dao.ResolvedLLMConfig, error) { + // 先失效 dao 缓存,保证读到的是 DB 最新值 + dao.InvalidateActiveLLMCache() + return dao.LoadActiveLLMConfig(fallbackProvider) +} + +// defaultSceneRoutes 返回推荐的场景→模型路由(用户未配置时使用) +// +// 注意:scene 名必须与 PHP TcmAgentClient 透传的 scene 字段对齐, +// 否则 PHP 调过来路由表查不到,会走默认 provider,日志会出现 +// "[模型路由] 场景 medical_record 未配置路由,使用默认" +// 并导致 enhancer 的 provider 字段为空串 +func defaultSceneRoutes() map[string]string { + return map[string]string{ + "medical_record": "emr-model", // 病历生成(PHP 业务侧命名,TcmAgentClient 透传) + "prescription": "rx-model", // 处方生成 + "emr-generator": "emr-model", // 病历生成(Go 内部命名兼容) + "knowledge-qa": "qa-model", // 知识问答 + "embedding": "embedding-model", // 向量化 + "fallback": "fallback-model", // 降级兜底 + } +} + +// ======================================================================== +// 环境变量覆盖(方便容器化部署) +// ======================================================================== + +// applyEnvOverrides 用环境变量覆盖配置中的敏感信息 +// +// 优先级:环境变量 > 配置文件 > 默认值 +// 这样在 K8s/Docker 中部署时,API Key 通过 Secret 注入,不写进配置文件 +func applyEnvOverrides(configs map[string]*config.LLMConfigEx) { + // 通用 API Key 覆盖 + if key := os.Getenv("LLM_API_KEY"); key != "" { + for _, cfg := range configs { + cfg.APIKey = key + } + } + + // 按供应商分别覆盖 + envMappings := map[string]string{ + "DEEPSEEK_API_KEY": "deepseek", + "OPENAI_API_KEY": "openai", + "AZURE_API_KEY": "azure", + "QWEN_API_KEY": "qwen", + "OLLAMA_URL": "ollama", + "SPARK_API_KEY": "spark", + } + + for envKey, provider := range envMappings { + if val := os.Getenv(envKey); val != "" { + if cfg, ok := configs[provider]; ok { + if strings.Contains(envKey, "URL") { + cfg.BaseURL = val + } else { + cfg.APIKey = val + } + } + } + } +} diff --git a/internal/llm/openai.go b/internal/llm/openai.go new file mode 100644 index 0000000..c3ca8cb --- /dev/null +++ b/internal/llm/openai.go @@ -0,0 +1,357 @@ +package llm + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "time" + + "tcm-agent/internal/config" + "tcm-agent/internal/types" +) + +// ======================================================================== +// OpenAI 客户端 +// ======================================================================== +// 支持模型: +// - gpt-4o / gpt-4o-mini(综合能力最强,适合处方校验) +// - gpt-4-turbo(长上下文) +// - o1-preview / o1-mini(深度推理) +// - text-embedding-3-large / small(向量化) +// +// 协议兼容性: +// OpenAI 的 API 协议已成为行业事实标准,很多国产模型 +// (DeepSeek/通义千问/Moonshot)都兼容此协议。 +// 因此这个客户端稍作修改(换 BaseURL)就能对接很多服务。 +// ======================================================================== + +// OpenAIClient OpenAI 模型客户端 +type OpenAIClient struct { + apiKey string + baseURL string + model string + embeddingModel string + client *http.Client + capabilities map[string]bool +} + +// createOpenAIClient 工厂方法:创建 OpenAI 客户端 +func createOpenAIClient(cfg *config.LLMConfigEx) (LLMClient, error) { + baseURL := cfg.BaseURL + if baseURL == "" { + baseURL = "https://api.openai.com/v1" + } + model := cfg.Model + if model == "" { + model = "gpt-4o" // 默认用 4o + } + + // 判断是否为推理模型(o1 系列不支持 temperature 等参数) + isReasoningModel := len(model) >= 2 && model[:2] == "o1" + + client := &OpenAIClient{ + apiKey: cfg.APIKey, + baseURL: baseURL, + model: model, + embeddingModel: cfg.EmbeddingModel, + client: &http.Client{Timeout: time.Duration(cfg.Timeout) * time.Second}, + capabilities: map[string]bool{ + CapFunctionCalling: true, + CapStreaming: true, + CapJSONMode: true, + CapLongContext: model == "gpt-4o" || model == "gpt-4-turbo", + CapEmbedding: cfg.EmbeddingModel != "", + "reasoning": isReasoningModel, + }, + } + + log.Printf("[OpenAI] 初始化完成 | 模型: %s | 地址: %s | 推理模型: %v", + model, baseURL, isReasoningModel) + return client, nil +} + +// Name 返回模型名称 +func (c *OpenAIClient) Name() string { return c.model } + +// Provider 返回供应商名称 +func (c *OpenAIClient) Provider() string { return "openai" } + +// Supports 查询能力 +func (c *OpenAIClient) Supports(capability string) bool { + return c.capabilities[capability] +} + +// Chat 发起对话请求 +func (c *OpenAIClient) Chat(ctx context.Context, messages []types.Message, tools []types.Tool) (*types.Message, error) { + // 转换消息(工具帧协议与 Spark/DeepSeek 客户端保持一致): + // - tool 结果帧带 tool_call_id 与 assistant 帧 tool_calls[].id 对应 + // - assistant 工具帧回放 tool_calls(id + arguments JSON 字符串) + openAIMsgs := make([]map[string]any, 0, len(messages)) + for _, m := range messages { + msg := map[string]any{ + "role": m.Role, + "content": m.Content, + } + if m.Role == "tool" && m.ToolCallID != "" { + msg["tool_call_id"] = m.ToolCallID + } + if m.ToolCall != nil { + args, _ := json.Marshal(m.ToolCall.Params) + id := m.ToolCall.ID + if id == "" { + id = fmt.Sprintf("call_%d", time.Now().UnixNano()) + } + msg["tool_calls"] = []map[string]any{ + { + "id": id, + "type": "function", + "function": map[string]any{ + "name": m.ToolCall.ToolName, + "arguments": string(args), + }, + }, + } + } + openAIMsgs = append(openAIMsgs, msg) + } + + // 构建请求体 + body := map[string]any{ + "model": c.model, + "messages": openAIMsgs, + } + + // o1 系列模型不支持 temperature 和 max_tokens 参数 + if !c.capabilities["reasoning"] { + body["temperature"] = 0.3 + body["max_tokens"] = 4096 + } else { + // o1 使用 max_completion_tokens + body["max_completion_tokens"] = 4096 + } + + // 附加工具 + if len(tools) > 0 && !c.capabilities["reasoning"] { + // o1 系列目前不支持 function calling + toolDefs := make([]map[string]any, 0, len(tools)) + for _, t := range tools { + toolDefs = append(toolDefs, map[string]any{ + "type": "function", + "function": map[string]any{ + "name": t.Name(), + "description": t.Description(), + "parameters": map[string]any{ + "type": "object", + "properties": map[string]any{ + "query": map[string]any{ + "type": "string", + "description": "检索/查询的关键词", + }, + }, + "required": []string{"query"}, + }, + }, + }) + } + body["tools"] = toolDefs + body["tool_choice"] = "auto" + } + + // 发送请求 + buf, _ := json.Marshal(body) + url := c.baseURL + "/chat/completions" + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[OpenAI] 请求失败: %w", err) + } + defer resp.Body.Close() + + data, _ := io.ReadAll(resp.Body) + if resp.StatusCode != 200 { + return nil, fmt.Errorf("[OpenAI] API 返回 %d: %s", resp.StatusCode, string(data[:min(len(data), 500)])) + } + + // 解析响应 + var result struct { + Choices []struct { + Message struct { + Role string `json:"role"` + Content string `json:"content"` + ToolCalls []struct { + ID string `json:"id"` // 厂商生成的调用 id(回放时须原样带回) + Function struct { + Name string `json:"name"` + Arguments string `json:"arguments"` + } `json:"function"` + } `json:"tool_calls"` + } `json:"message"` + } `json:"choices"` + Error *struct { + Message string `json:"message"` + } `json:"error"` + } + + if err := json.Unmarshal(data, &result); err != nil { + return nil, fmt.Errorf("[OpenAI] 解析响应失败: %w", err) + } + + if result.Error != nil { + return nil, fmt.Errorf("[OpenAI] API 错误: %s", result.Error.Message) + } + + if len(result.Choices) == 0 { + return nil, fmt.Errorf("[OpenAI] 返回空响应") + } + + msg := &types.Message{ + Role: "assistant", + Content: result.Choices[0].Message.Content, + Timestamp: time.Now().Unix(), + } + + // 工具调用 + if len(result.Choices[0].Message.ToolCalls) > 0 { + tc := result.Choices[0].Message.ToolCalls[0] + params := make(map[string]any) + json.Unmarshal([]byte(tc.Function.Arguments), ¶ms) + // id 厂商未返回时生成一个,保证回放帧协议完整 + id := tc.ID + if id == "" { + id = fmt.Sprintf("call_%d", time.Now().UnixNano()) + } + msg.ToolCall = &types.ToolCallInfo{ + ID: id, + ToolName: tc.Function.Name, + Params: params, + } + log.Printf("[OpenAI] 模型决定调用工具: %s", tc.Function.Name) + } + + return msg, nil +} + +// StreamChat 流式对话 +func (c *OpenAIClient) StreamChat(ctx context.Context, messages []types.Message, tools []types.Tool) (<-chan string, error) { + // 实现与 DeepSeek 类似,设置 stream: true + // 为节省篇幅,这里用简化的实现 + ch := make(chan string, 10) + + openAIMsgs := make([]map[string]any, 0, len(messages)) + for _, m := range messages { + openAIMsgs = append(openAIMsgs, map[string]any{ + "role": m.Role, "content": m.Content, + }) + } + + body := map[string]any{ + "model": c.model, + "messages": openAIMsgs, + "stream": true, + } + + buf, _ := json.Marshal(body) + url := c.baseURL + "/chat/completions" + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("Content-Type", "application/json") + req.Header.Set("Accept", "text/event-stream") + + resp, err := c.client.Do(req) + if err != nil { + close(ch) + return nil, fmt.Errorf("[OpenAI] 流式请求失败: %w", err) + } + + go func() { + defer resp.Body.Close() + defer close(ch) + buf := make([]byte, 4096) + for { + n, err := resp.Body.Read(buf) + if n > 0 { + ch <- string(buf[:n]) + } + if err != nil { + break + } + } + }() + + return ch, nil +} + +// Embed 生成文本向量 +// +// OpenAI 的 text-embedding-3 系列是目前质量最高的 Embedding 模型之一。 +// 推荐: +// - text-embedding-3-large(3072维,精度最高) +// - text-embedding-3-small(1536维,性价比高) +func (c *OpenAIClient) Embed(ctx context.Context, texts []string) ([][]float32, error) { + if c.embeddingModel == "" { + return nil, fmt.Errorf("[OpenAI] 未配置 Embedding 模型") + } + + // OpenAI Embedding API 一次最多传 2048 条文本 + results := make([][]float32, 0, len(texts)) + + // 分批处理 + batchSize := 100 + for i := 0; i < len(texts); i += batchSize { + end := i + batchSize + if end > len(texts) { + end = len(texts) + } + batch := texts[i:end] + + body := map[string]any{ + "model": c.embeddingModel, + "input": batch, + } + + buf, _ := json.Marshal(body) + url := c.baseURL + "/embeddings" + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[OpenAI] Embedding 请求失败: %w", err) + } + + data, _ := io.ReadAll(resp.Body) + resp.Body.Close() + + if resp.StatusCode != 200 { + return nil, fmt.Errorf("[OpenAI] Embedding 返回 %d: %s", resp.StatusCode, string(data[:min(len(data), 300)])) + } + + var result struct { + Data []struct { + Embedding []float32 `json:"embedding"` + } `json:"data"` + } + json.Unmarshal(data, &result) + + for _, d := range result.Data { + results = append(results, d.Embedding) + } + } + + log.Printf("[OpenAI] Embedding 完成 | 模型: %s | 文本数: %d", c.embeddingModel, len(texts)) + return results, nil +} + +// Close 释放资源 +func (c *OpenAIClient) Close() error { + c.client.CloseIdleConnections() + return nil +} diff --git a/internal/llm/other_providers.go b/internal/llm/other_providers.go new file mode 100644 index 0000000..ca17218 --- /dev/null +++ b/internal/llm/other_providers.go @@ -0,0 +1,677 @@ +package llm + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "strings" + "time" + + "tcm-agent/internal/config" + "tcm-agent/internal/types" +) + +// ======================================================================== +// Azure OpenAI 客户端 +// ======================================================================== +// 适用场景: +// - 企业级部署,需要 SLA 保障 +// - 数据不离开 Azure 区域(合规要求) +// - 支持 GPT-4o / GPT-4 Turbo / o1 系列 +// +// 与 OpenAI 的区别: +// - BaseURL 格式不同:https://{resource}.openai.azure.com/openai/deployments/{deployment} +// - 认证方式不同:api-key 放在 Header(非 Bearer) +// - 模型名换成部署名(Deployment Name) +// ======================================================================== + +// AzureOpenAIClient Azure OpenAI 客户端 +type AzureOpenAIClient struct { + apiKey string + baseURL string // 完整路径到 deployment + deployment string // Azure 中的部署名称 + apiVersion string // API 版本号 + client *http.Client + capabilities map[string]bool +} + +// createAzureClient 工厂方法 +func createAzureClient(cfg *config.LLMConfigEx) (LLMClient, error) { + apiVersion := cfg.Extra["api_version"] + if apiVersion == "" { + apiVersion = "2024-06-01" // 默认 API 版本 + } + + deployment := cfg.Extra["deployment"] + if deployment == "" { + deployment = cfg.Model // 没配 deployment 就用 model 名 + } + + // Azure 的 URL 格式比较特殊 + baseURL := cfg.BaseURL + if !strings.Contains(baseURL, "/deployments/") { + // 自动拼接 + baseURL = fmt.Sprintf("%s/openai/deployments/%s", strings.TrimRight(baseURL, "/"), deployment) + } + + client := &AzureOpenAIClient{ + apiKey: cfg.APIKey, + baseURL: baseURL, + deployment: deployment, + apiVersion: apiVersion, + client: &http.Client{Timeout: time.Duration(cfg.Timeout) * time.Second}, + capabilities: map[string]bool{ + CapFunctionCalling: true, + CapStreaming: true, + CapJSONMode: true, + CapLongContext: true, + CapEmbedding: true, + }, + } + + log.Printf("[Azure] 初始化完成 | 部署: %s | 地址: %s", deployment, baseURL) + return client, nil +} + +func (c *AzureOpenAIClient) Name() string { return c.deployment } +func (c *AzureOpenAIClient) Provider() string { return "azure" } +func (c *AzureOpenAIClient) Supports(cap string) bool { return c.capabilities[cap] } + +func (c *AzureOpenAIClient) Chat(ctx context.Context, messages []types.Message, tools []types.Tool) (*types.Message, error) { + // Azure 的 chat completions URL 格式 + url := fmt.Sprintf("%s/chat/completions?api-version=%s", c.baseURL, c.apiVersion) + + openAIMsgs := make([]map[string]any, 0, len(messages)) + for _, m := range messages { + openAIMsgs = append(openAIMsgs, map[string]any{ + "role": m.Role, "content": m.Content, + }) + } + + body := map[string]any{ + "messages": openAIMsgs, + "temperature": 0.3, + "max_tokens": 4096, + } + + if len(tools) > 0 { + // 工具定义(同 OpenAI 格式) + toolDefs := make([]map[string]any, 0, len(tools)) + for _, t := range tools { + toolDefs = append(toolDefs, map[string]any{ + "type": "function", + "function": map[string]any{ + "name": t.Name(), "description": t.Description(), + "parameters": map[string]any{ + "type": "object", + "properties": map[string]any{ + "query": map[string]any{"type": "string", "description": "查询关键词"}, + }, + "required": []string{"query"}, + }, + }, + }) + } + body["tools"] = toolDefs + body["tool_choice"] = "auto" + } + + buf, _ := json.Marshal(body) + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("api-key", c.apiKey) // 注意:Azure 用 "api-key" 不是 "Authorization: Bearer" + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[Azure] 请求失败: %w", err) + } + defer resp.Body.Close() + + data, _ := io.ReadAll(resp.Body) + if resp.StatusCode != 200 { + return nil, fmt.Errorf("[Azure] API 返回 %d: %s", resp.StatusCode, string(data[:min(len(data), 500)])) + } + + // 解析(与 OpenAI 格式一致) + var result struct { + Choices []struct { + Message struct { + Role string `json:"role"` + Content string `json:"content"` + } `json:"message"` + } `json:"choices"` + } + json.Unmarshal(data, &result) + + if len(result.Choices) == 0 { + return nil, fmt.Errorf("[Azure] 返回空响应") + } + + return &types.Message{ + Role: "assistant", + Content: result.Choices[0].Message.Content, + Timestamp: time.Now().Unix(), + }, nil +} + +func (c *AzureOpenAIClient) StreamChat(ctx context.Context, messages []types.Message, tools []types.Tool) (<-chan string, error) { + // Azure 的流式接口与 OpenAI 类似,省略实现细节 + ch := make(chan string, 10) + close(ch) // 简化实现 + return ch, fmt.Errorf("[Azure] 流式输出暂未实现") +} + +func (c *AzureOpenAIClient) Embed(ctx context.Context, texts []string) ([][]float32, error) { + // Azure Embedding URL + url := fmt.Sprintf("%s/embeddings?api-version=%s", c.baseURL, c.apiVersion) + + body := map[string]any{ + "input": texts, + } + + buf, _ := json.Marshal(body) + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("api-key", c.apiKey) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[Azure] Embedding 失败: %w", err) + } + defer resp.Body.Close() + + data, _ := io.ReadAll(resp.Body) + + var result struct { + Data []struct { + Embedding []float32 `json:"embedding"` + } `json:"data"` + } + json.Unmarshal(data, &result) + + embeddings := make([][]float32, 0, len(result.Data)) + for _, d := range result.Data { + embeddings = append(embeddings, d.Embedding) + } + return embeddings, nil +} + +func (c *AzureOpenAIClient) Close() error { + c.client.CloseIdleConnections() + return nil +} + +// ======================================================================== +// Ollama 客户端(本地模型) +// ======================================================================== +// 适用场景: +// - 内网/离线环境,数据不能出域 +// - 开发测试,不需要花 API 费用 +// - 轻量任务(简单分类、文本清洗) +// +// 推荐模型: +// - qwen2.5:72b(通义千问,中文最强开源) +// - llama3.1:70b(英文推理) +// - deepseek-r1:14b(本地推理) +// - nomic-embed-text(Embedding) +// +// 启动方式: +// ollama serve & +// ollama pull qwen2.5:72b +// ======================================================================== + +// OllamaClient Ollama 本地模型客户端 +type OllamaClient struct { + baseURL string // 默认 http://localhost:11434 + model string + client *http.Client + capabilities map[string]bool +} + +// createOllamaClient 工厂方法 +func createOllamaClient(cfg *config.LLMConfigEx) (LLMClient, error) { + baseURL := cfg.BaseURL + if baseURL == "" { + baseURL = "http://localhost:11434" // Ollama 默认端口 + } + model := cfg.Model + if model == "" { + model = "qwen2.5:7b" // 默认用 7B 轻量模型 + } + + client := &OllamaClient{ + baseURL: strings.TrimRight(baseURL, "/"), + model: model, + client: &http.Client{Timeout: time.Duration(cfg.Timeout) * time.Second}, + capabilities: map[string]bool{ + CapFunctionCalling: true, // Ollama 支持 tool calling(部分模型) + CapStreaming: true, + CapJSONMode: false, // 原生不支持,需 Prompt 引导 + CapLongContext: false, // 取决于具体模型 + CapEmbedding: true, // 需单独拉取 embedding 模型 + }, + } + + log.Printf("[Ollama] 初始化完成 | 模型: %s | 地址: %s", model, baseURL) + return client, nil +} + +func (c *OllamaClient) Name() string { return c.model } +func (c *OllamaClient) Provider() string { return "ollama" } +func (c *OllamaClient) Supports(cap string) bool { return c.capabilities[cap] } + +func (c *OllamaClient) Chat(ctx context.Context, messages []types.Message, tools []types.Tool) (*types.Message, error) { + // Ollama 的 API 格式与 OpenAI 略有不同 + openAIMsgs := make([]map[string]any, 0, len(messages)) + for _, m := range messages { + openAIMsgs = append(openAIMsgs, map[string]any{ + "role": m.Role, "content": m.Content, + }) + } + + body := map[string]any{ + "model": c.model, + "messages": openAIMsgs, + "stream": false, + "options": map[string]any{ + "temperature": 0.3, + "num_ctx": 4096, // 上下文窗口 + }, + } + + // Ollama 也支持 tool calling(用 OpenAI 兼容格式) + if len(tools) > 0 { + toolDefs := make([]map[string]any, 0, len(tools)) + for _, t := range tools { + toolDefs = append(toolDefs, map[string]any{ + "type": "function", + "function": map[string]any{ + "name": t.Name(), "description": t.Description(), + "parameters": map[string]any{ + "type": "object", + "properties": map[string]any{ + "query": map[string]any{"type": "string"}, + }, + "required": []string{"query"}, + }, + }, + }) + } + body["tools"] = toolDefs + } + + buf, _ := json.Marshal(body) + url := c.baseURL + "/api/chat" + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[Ollama] 请求失败(是否启动了 ollama serve?): %w", err) + } + defer resp.Body.Close() + + data, _ := io.ReadAll(resp.Body) + + var result struct { + Message struct { + Role string `json:"role"` + Content string `json:"content"` + } `json:"message"` + Error string `json:"error"` + } + + if err := json.Unmarshal(data, &result); err != nil { + return nil, fmt.Errorf("[Ollama] 解析失败: %w", err) + } + + if result.Error != "" { + return nil, fmt.Errorf("[Ollama] 模型错误: %s", result.Error) + } + + return &types.Message{ + Role: "assistant", + Content: result.Message.Content, + Timestamp: time.Now().Unix(), + }, nil +} + +func (c *OllamaClient) StreamChat(ctx context.Context, messages []types.Message, tools []types.Tool) (<-chan string, error) { + ch := make(chan string, 10) + + openAIMsgs := make([]map[string]any, 0, len(messages)) + for _, m := range messages { + openAIMsgs = append(openAIMsgs, map[string]any{ + "role": m.Role, "content": m.Content, + }) + } + + body := map[string]any{ + "model": c.model, + "messages": openAIMsgs, + "stream": true, + } + + buf, _ := json.Marshal(body) + url := c.baseURL + "/api/chat" + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + close(ch) + return nil, fmt.Errorf("[Ollama] 流式请求失败: %w", err) + } + + go func() { + defer resp.Body.Close() + defer close(ch) + // Ollama 的流是逐行 JSON(NDJSON),每行一个完整 JSON + buf := make([]byte, 4096) + for { + n, err := resp.Body.Read(buf) + if n > 0 { + ch <- string(buf[:n]) + } + if err != nil { + break + } + } + }() + + return ch, nil +} + +func (c *OllamaClient) Embed(ctx context.Context, texts []string) ([][]float32, error) { + // Ollama 的 embedding 接口 + results := make([][]float32, 0, len(texts)) + + for _, text := range texts { + body := map[string]any{ + "model": c.model, // 需要是 embedding 模型,如 nomic-embed-text + "prompt": text, + } + + buf, _ := json.Marshal(body) + url := c.baseURL + "/api/embeddings" + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[Ollama] Embedding 失败: %w", err) + } + + data, _ := io.ReadAll(resp.Body) + resp.Body.Close() + + var result struct { + Embedding []float32 `json:"embedding"` + } + json.Unmarshal(data, &result) + results = append(results, result.Embedding) + } + + return results, nil +} + +func (c *OllamaClient) Close() error { + c.client.CloseIdleConnections() + return nil +} + +// ======================================================================== +// 通义千问 (Qwen) 客户端 +// ======================================================================== +// 适用场景: +// - 中文医疗场景(阿里有医学大模型经验) +// - 需要 DashScope 平台的其他能力(语音、图像) +// - 国内合规部署 +// +// 推荐模型: +// - qwen-max(最强,适合复杂推理) +// - qwen-plus(性价比) +// - qwen-turbo(最快) +// - qwen-long(长文本 1000万 tokens) +// ======================================================================== + +// QwenClient 通义千问客户端 +type QwenClient struct { + apiKey string + baseURL string + model string + client *http.Client + capabilities map[string]bool +} + +// createQwenClient 工厂方法 +func createQwenClient(cfg *config.LLMConfigEx) (LLMClient, error) { + baseURL := cfg.BaseURL + if baseURL == "" { + baseURL = "https://dashscope.aliyuncs.com/compatible-mode/v1" // 兼容 OpenAI 协议 + } + model := cfg.Model + if model == "" { + model = "qwen-max" + } + + client := &QwenClient{ + apiKey: cfg.APIKey, + baseURL: baseURL, + model: model, + client: &http.Client{Timeout: time.Duration(cfg.Timeout) * time.Second}, + capabilities: map[string]bool{ + CapFunctionCalling: true, + CapStreaming: true, + CapJSONMode: true, + CapLongContext: model == "qwen-long", + CapEmbedding: true, // text-embedding-v3 + }, + } + + log.Printf("[Qwen] 初始化完成 | 模型: %s | 地址: %s", model, baseURL) + return client, nil +} + +func (c *QwenClient) Name() string { return c.model } +func (c *QwenClient) Provider() string { return "qwen" } +func (c *QwenClient) Supports(cap string) bool { return c.capabilities[cap] } + +func (c *QwenClient) Chat(ctx context.Context, messages []types.Message, tools []types.Tool) (*types.Message, error) { + // 通义千问兼容 OpenAI 协议,调用方式与 DeepSeek 几乎一致 + openAIMsgs := make([]map[string]any, 0, len(messages)) + for _, m := range messages { + openAIMsgs = append(openAIMsgs, map[string]any{ + "role": m.Role, "content": m.Content, + }) + } + + body := map[string]any{ + "model": c.model, + "messages": openAIMsgs, + "temperature": 0.3, + "max_tokens": 4096, + } + + if len(tools) > 0 { + toolDefs := make([]map[string]any, 0, len(tools)) + for _, t := range tools { + toolDefs = append(toolDefs, map[string]any{ + "type": "function", + "function": map[string]any{ + "name": t.Name(), "description": t.Description(), + "parameters": map[string]any{ + "type": "object", + "properties": map[string]any{ + "query": map[string]any{"type": "string"}, + }, + "required": []string{"query"}, + }, + }, + }) + } + body["tools"] = toolDefs + body["tool_choice"] = "auto" + } + + buf, _ := json.Marshal(body) + url := c.baseURL + "/chat/completions" + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[Qwen] 请求失败: %w", err) + } + defer resp.Body.Close() + + data, _ := io.ReadAll(resp.Body) + if resp.StatusCode != 200 { + return nil, fmt.Errorf("[Qwen] API 返回 %d: %s", resp.StatusCode, string(data[:min(len(data), 500)])) + } + + var result struct { + Choices []struct { + Message struct { + Role string `json:"role"` + Content string `json:"content"` + } `json:"message"` + } `json:"choices"` + } + + json.Unmarshal(data, &result) + + if len(result.Choices) == 0 { + return nil, fmt.Errorf("[Qwen] 返回空响应") + } + + return &types.Message{ + Role: "assistant", + Content: result.Choices[0].Message.Content, + Timestamp: time.Now().Unix(), + }, nil +} + +func (c *QwenClient) StreamChat(ctx context.Context, messages []types.Message, tools []types.Tool) (<-chan string, error) { + ch := make(chan string, 10) + close(ch) + return ch, fmt.Errorf("[Qwen] 流式输出暂未实现") +} + +func (c *QwenClient) Embed(ctx context.Context, texts []string) ([][]float32, error) { + // 通义千问的 embedding 接口 + body := map[string]any{ + "model": "text-embedding-v3", + "input": texts, + } + + buf, _ := json.Marshal(body) + url := c.baseURL + "/embeddings" + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[Qwen] Embedding 失败: %w", err) + } + defer resp.Body.Close() + + data, _ := io.ReadAll(resp.Body) + + var result struct { + Data []struct { + Embedding []float32 `json:"embedding"` + } `json:"data"` + } + json.Unmarshal(data, &result) + + embeddings := make([][]float32, 0, len(result.Data)) + for _, d := range result.Data { + embeddings = append(embeddings, d.Embedding) + } + return embeddings, nil +} + +func (c *QwenClient) Close() error { + c.client.CloseIdleConnections() + return nil +} + +// ======================================================================== +// Mock 客户端(测试用) +// ======================================================================== +// 用于单元测试,不发起任何真实网络请求。 +// 返回预设的回复,让测试可以离线运行。 +// ======================================================================== + +// MockClient 模拟 LLM 客户端 +type MockClient struct { + name string + provider string + response string // 预设回复 + calls int // 调用次数统计 +} + +// createMockClient 工厂方法 +func createMockClient(cfg *config.LLMConfigEx) (LLMClient, error) { + return &MockClient{ + name: cfg.Model, + provider: "mock", + response: "这是 Mock 模型的预设回复。配置正确,LLM 层工作正常。", + }, nil +} + +func (c *MockClient) Name() string { return c.name } +func (c *MockClient) Provider() string { return c.provider } +func (c *MockClient) Supports(cap string) bool { + // Mock 支持所有能力(测试用) + return true +} + +func (c *MockClient) Chat(ctx context.Context, messages []types.Message, tools []types.Tool) (*types.Message, error) { + c.calls++ + log.Printf("[Mock] 第 %d 次调用 | 消息数: %d | 工具数: %d", c.calls, len(messages), len(tools)) + + // 模拟工具调用(如果提供了工具,第一次返回工具调用,第二次返回最终回复) + if len(tools) > 0 && c.calls == 1 { + return &types.Message{ + Role: "assistant", + Content: "", + Timestamp: time.Now().Unix(), + ToolCall: &types.ToolCallInfo{ + ToolName: tools[0].Name(), + Params: map[string]any{"query": "test query"}, + }, + }, nil + } + + return &types.Message{ + Role: "assistant", + Content: c.response, + Timestamp: time.Now().Unix(), + }, nil +} + +func (c *MockClient) StreamChat(ctx context.Context, messages []types.Message, tools []types.Tool) (<-chan string, error) { + ch := make(chan string, 1) + ch <- c.response + close(ch) + return ch, nil +} + +func (c *MockClient) Embed(ctx context.Context, texts []string) ([][]float32, error) { + // 返回随机向量(维度 1536) + results := make([][]float32, len(texts)) + for i := range results { + results[i] = make([]float32, 1536) + } + return results, nil +} + +func (c *MockClient) Close() error { return nil } diff --git a/internal/llm/spark.go b/internal/llm/spark.go new file mode 100644 index 0000000..b2d3517 --- /dev/null +++ b/internal/llm/spark.go @@ -0,0 +1,467 @@ +package llm + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "strings" + "time" + + "tcm-agent/internal/agentcfg" + "tcm-agent/internal/config" + "tcm-agent/internal/types" +) + +// ======================================================================== +// 讯飞星火 (Xunfei Spark) 客户端 +// ======================================================================== +// 对接方式: +// - 讯飞星火当前提供两套对外协议: +// 1) 老协议:基于 APIKey + APISecret 做 JWT 签名,WebSocket 长连接(v1/v2/v3/v4) +// 2) 新协议 OpenAPI:HTTPS POST /v1/chat/completions,Authorization: Bearer APIPassword +// - PHP 端 SparkAiAgent 已经走的是新协议 OpenAPI(与 OpenAI 协议一致), +// 为了保持多端行为一致、降低维护成本,Go 端也走 OpenAPI 协议。 +// +// 适用场景: +// - 国内合规部署(讯飞数据不出境) +// - 中文医疗场景(讯飞有医学大模型经验:spark-medicine) +// +// 推荐模型: +// - spark-lite 轻量,免费额度大,适合分类/简单问答 +// - spark-pro 中等档位,性价比高 +// - spark-max 最强档位,适合复杂医学推理 +// - spark-medicine 医学专用模型(需开通对应授权) +// ======================================================================== + +// SparkClient 讯飞星火客户端(OpenAPI 兼容协议) +type SparkClient struct { + apiKey string // Bearer 鉴权用的 APIPassword + baseURL string // OpenAPI 完整地址(含 /v1/chat/completions) + model string // 默认模型名(spark-pro / spark-max 等) + client *http.Client // 复用的 HTTP 连接 + capabilities map[string]bool // 能力声明 + lastResult *types.ChatResult // 最近一次 Chat 的 token/finish_reason 快照 +} + +// createSparkClient 工厂方法 +// +// 参数: +// cfg - 从 config.yaml / DB 读到的供应商配置 +// +// 默认值约定(与 PHP 端 AiRuntimeConfigService 一致): +// - BaseURL 未配置 → 回落到讯飞官方域名(与 .env 中 SPARK_API_URL 同源) +// - Model 未配置 → spark-lite(轻量档位,便于联调) +func createSparkClient(cfg *config.LLMConfigEx) (LLMClient, error) { + baseURL := cfg.BaseURL + if baseURL == "" { + // 讯飞星火 OpenAPI 默认域名(与 PHP 端 .env 默认值保持一致) + baseURL = "https://spark-api-open.xf-yun.com/v1/chat/completions" + } + + model := cfg.Model + if model == "" { + model = "lite" // 默认轻量档位 + } + + // 按版本检测 function calling 能力(文档说仅 Pro/Max/Ultra 支持) + // capability map 在客户端初始化时就标好,运行时 Supports() 查这个 map + supportsFC := supportsSparkFunctionCalling(model) + + client := &SparkClient{ + apiKey: cfg.APIKey, + baseURL: baseURL, + model: model, + client: &http.Client{Timeout: time.Duration(cfg.Timeout) * time.Second}, + capabilities: map[string]bool{ + // FunctionCalling:按 model 版本动态判断(lite/general* 不支持,pro/max/ultra 支持) + CapFunctionCalling: supportsFC, + CapStreaming: true, + CapJSONMode: true, + // spark-max 支持 8K~32K,spark-pro 一般 8K,统一标 false,按需打开 + CapLongContext: false, + // 讯飞 Embedding 需要走独立接口,本客户端暂不实现 + CapEmbedding: false, + }, + } + + log.Printf("[Spark] 初始化完成 | 模型: %s | 地址: %s | function_calling=%v", + model, baseURL, supportsFC) + return client, nil +} + +// supportsSparkFunctionCalling 独立函数版(供 createSparkClient 在构造 capabilities 前调用) +// +// 与 (*SparkClient).supportsFunctionCalling 是同一份白名单, +// 拆成独立函数是为了在客户端尚未构造完成时也能调用 +func supportsSparkFunctionCalling(model string) bool { + m := strings.ToLower(strings.TrimSpace(model)) + switch m { + case "generalv3", "pro-128k", + "generalv3.5", "max-32k", + "4.0ultra": + return true + } + return false +} + +func (c *SparkClient) Name() string { return c.model } +func (c *SparkClient) Provider() string { return "spark" } +func (c *SparkClient) Supports(cap string) bool { return c.capabilities[cap] } + +// supportsFunctionCalling 检测当前 model 是否支持 OpenAI 风格 function calling +// +// 讯飞 OpenAPI 各版本 model 名(来自官方文档): +// - lite → Lite 版(不支持 function calling) +// - general → Spark V1.5(不支持) +// - generalv2 → Spark V2(不支持) +// - generalv3 → Pro 版(支持) +// - pro-128k → Pro-128K(支持) +// - generalv3.5 → Max 版(支持) +// - max-32k → Max-32K(支持) +// - 4.0Ultra → 4.0 Ultra(支持) +// +// 判断规则:model 名命中以下白名单才算支持 +// 用白名单而非黑名单,是为了未来新增 model 时默认保守(不允许), +// 避免新版本突然能传 tools 时反而不被识别 +func (c *SparkClient) supportsFunctionCalling() bool { + m := strings.ToLower(strings.TrimSpace(c.model)) + switch m { + case "generalv3", "pro-128k", // Pro 系列 + "generalv3.5", "max-32k", // Max 系列 + "4.0ultra": // 4.0 Ultra(已经 ToLower) + return true + } + return false +} + +// Chat 发起一次非流式对话(与 OpenAI 协议一致) +// +// 本方法使用客户端默认参数(temperature=0.3, max_tokens=4096); +// 需要运行时覆盖参数请用 ChatWithOpts(实现 OptAwareClient)。 +// +// 返回的 Message 可能包含 ToolCall(触发工具调用),由上层 Runner 决定下一步。 +func (c *SparkClient) Chat(ctx context.Context, messages []types.Message, tools []types.Tool) (*types.Message, error) { + return c.ChatWithOpts(ctx, messages, tools, ChatOpts{}) +} + +// ChatWithOpts 带运行时参数的 Chat(实现 OptAwareClient 接口) +func (c *SparkClient) ChatWithOpts(ctx context.Context, messages []types.Message, tools []types.Tool, opts ChatOpts) (*types.Message, error) { + // 组装请求体(与 DeepSeek/OpenAI 一致) + temperature := 0.3 + if opts.Temperature > 0 { + temperature = opts.Temperature + } + maxTokens := 4096 + if opts.MaxTokens > 0 { + maxTokens = opts.MaxTokens + } + + reqBody := map[string]any{ + "model": c.model, + "messages": c.convertMessages(messages), + // 默认关闭流式,业务侧解析整包 JSON 更简单(与 PHP 端默认一致) + "stream": false, + "temperature": temperature, + "max_tokens": maxTokens, + } + + // 函数调用(仅 Pro/Max/Ultra 支持,Lite 不支持) + // + // 讯飞 OpenAPI 文档明确说明: + // - Lite 版不支持 function calling + // - Pro/Max/4.0 Ultra 支持 function calling + // 若给 Lite 版传 tools 字段,讯飞会返回 10003 "用户的消息格式有错误" + // 这里按 model 名自动降级,避免低版本模型直接报错 + if len(tools) > 0 { + if !c.supportsFunctionCalling() { + log.Printf("[Spark] ⚠️ 当前 model=%s 不支持 function calling,已自动降级为纯文本(忽略 %d 个工具)", + c.model, len(tools)) + } else { + reqBody["tools"] = c.buildToolDefs(tools) + reqBody["tool_choice"] = "auto" + } + } + + buf, _ := json.Marshal(reqBody) + req, err := http.NewRequestWithContext(ctx, "POST", c.baseURL, bytes.NewReader(buf)) + if err != nil { + return nil, fmt.Errorf("[Spark] 构造请求失败: %w", err) + } + // 讯飞 OpenAPI 用 Bearer + APIPassword(与 PHP 端 Authorization 头一致) + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("Content-Type", "application/json") + + // ===== 调试日志:请求体打印受 ai_agent_debug_log 开关控制 ===== + // 请求体包含完整患者病历(PHI 隐私数据),生产环境默认只打不含内容的摘要行; + // 排查厂商 API 错误(如 10003 消息格式错误)时,把 xk_system_config 的 + // ai_agent_debug_log 置 1 即可看到完整请求体(60s 内生效,无需重启) + if agentcfg.Get().Debug.LogRequestBody { + reqSnippet := string(buf) + if len(reqSnippet) > 1500 { + reqSnippet = reqSnippet[:1500] + "...(截断)" + } + log.Printf("[Spark] → POST %s | model=%s | msgs=%d | tools=%d | body=%s", + c.baseURL, c.model, len(messages), len(tools), reqSnippet) + } else { + // 摘要行:不含消息内容,只有规模信息,便于观察调用频率与请求大小 + log.Printf("[Spark] → POST | model=%s | msgs=%d | tools=%d | bytes=%d", + c.model, len(messages), len(tools), len(buf)) + } + + startedAt := time.Now() + resp, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("[Spark] 请求失败(请检查网络或密钥): %w", err) + } + defer resp.Body.Close() + + data, _ := io.ReadAll(resp.Body) + if resp.StatusCode != 200 { + // 截取前 1000 字符,包含完整错误信息(讯飞的 10003 错误响应通常 < 300 字符) + snippet := string(data) + if len(snippet) > 1000 { + snippet = snippet[:1000] + } + log.Printf("[Spark] ← HTTP %d | resp=%s", resp.StatusCode, snippet) + return nil, fmt.Errorf("[Spark] API 返回 %d: %s", resp.StatusCode, snippet) + } + + // 解析响应并提取 usage / finish_reason + msg, chatResult := c.parseResponseWithMeta(data) + if chatResult != nil { + chatResult.Provider = "spark" + chatResult.Model = c.model + chatResult.DurationMs = int(time.Since(startedAt).Milliseconds()) + c.lastResult = chatResult + } + + // 记录耗时(仅日志,token 计费统计在 KnowledgeEnhancer 层做) + log.Printf("[Spark] 调用耗时 %v | finish_reason=%s tokens=%d/%d", + time.Since(startedAt), chatResult.FinishReason, + chatResult.PromptTokens, chatResult.CompletionTokens) + return msg, nil +} + +// LastChatResult 实现 TokenAwareClient 接口 +func (c *SparkClient) LastChatResult() *types.ChatResult { + return c.lastResult +} + +// StreamChat 流式对话(暂未实现) +// +// 讯飞星火支持 SSE 流式输出,等业务侧确实需要"边生成边展示"时再补: +// - 设置 stream=true +// - 用 bufio.Scanner 逐行解析 data: {...} 块 +func (c *SparkClient) StreamChat(ctx context.Context, messages []types.Message, tools []types.Tool) (<-chan string, error) { + ch := make(chan string, 10) + close(ch) + return ch, fmt.Errorf("[Spark] 流式输出暂未实现") +} + +// Embed 文本向量化(讯飞 Embedding 走独立接口,本客户端暂不实现) +// +// 若后续需要把处方/病历向量化做相似度匹配,可在此实现: +// - 调用讯飞独立 embedding 接口 +// - 或回落到本地 Ollama embedding(避免重复请求) +func (c *SparkClient) Embed(ctx context.Context, texts []string) ([][]float32, error) { + return nil, fmt.Errorf("[Spark] Embedding 暂未实现,请使用 Ollama/Qwen 的 Embed 能力") +} + +// Close 释放资源(关闭底层连接池) +func (c *SparkClient) Close() error { + c.client.CloseIdleConnections() + return nil +} + +// ======================================================================== +// 内部辅助方法 +// ======================================================================== + +// convertMessages 把 types.Message 转成讯飞 OpenAPI 接受的格式 +// +// 讯飞接口与 OpenAI 协议一致,role + content 即可。 +// 工具调用相关帧必须严格遵守 OpenAI Function Calling 协议: +// - assistant 帧的 tool_calls 必须带 id,arguments 必须是 JSON 字符串(不是对象) +// - tool 结果帧必须带 tool_call_id 与上面的 id 对应 +// 否则讯飞会报 10003 消息格式错误(曾因 arguments 传对象踩过坑) +func (c *SparkClient) convertMessages(messages []types.Message) []map[string]any { + out := make([]map[string]any, 0, len(messages)) + for _, m := range messages { + item := map[string]any{ + "role": m.Role, + "content": m.Content, + } + // tool 结果帧:带上与 assistant 帧 tool_calls[].id 对应的 tool_call_id + if m.Role == "tool" && m.ToolCallID != "" { + item["tool_call_id"] = m.ToolCallID + } + // assistant 工具调用帧回放 + if m.ToolCall != nil { + // arguments 必须是 JSON 字符串(OpenAI 协议),不能直接传 map 对象 + args, _ := json.Marshal(m.ToolCall.Params) + // id 优先用厂商返回的原始 id;缺失时生成一个(保证协议完整性) + id := m.ToolCall.ID + if id == "" { + id = fmt.Sprintf("call_%d", time.Now().UnixNano()) + } + item["tool_calls"] = []map[string]any{ + { + "id": id, + "type": "function", + "function": map[string]any{ + "name": m.ToolCall.ToolName, + "arguments": string(args), + }, + }, + } + } + out = append(out, item) + } + return out +} + +// buildToolDefs 构造 tool 列表(OpenAI 风格的 function 定义) +func (c *SparkClient) buildToolDefs(tools []types.Tool) []map[string]any { + defs := make([]map[string]any, 0, len(tools)) + for _, t := range tools { + defs = append(defs, map[string]any{ + "type": "function", + "function": map[string]any{ + "name": t.Name(), + "description": t.Description(), + "parameters": map[string]any{ + "type": "object", + "properties": map[string]any{ + "query": map[string]any{ + "type": "string", + "description": "检索/查询关键词", + }, + }, + "required": []string{"query"}, + }, + }, + }) + } + return defs +} + +// parseResponse 解析讯飞返回的 JSON(保留旧 API) +func (c *SparkClient) parseResponse(data []byte) *types.Message { + msg, _ := c.parseResponseWithMeta(data) + return msg +} + +// parseResponseWithMeta 解析响应并附带 token/finish_reason 等元数据 +// +// 返回: +// - *types.Message:assistant 消息(可能含 tool_calls) +// - *types.ChatResult:token 用量 + finish_reason +func (c *SparkClient) parseResponseWithMeta(data []byte) (*types.Message, *types.ChatResult) { + var result struct { + Choices []struct { + Message struct { + Role string `json:"role"` + Content string `json:"content"` + ToolCalls []struct { + ID string `json:"id"` // 厂商生成的调用 id(回放时须原样带回) + Function struct { + Name string `json:"name"` + Arguments string `json:"arguments"` // JSON 字符串 + } `json:"function"` + } `json:"tool_calls"` + } `json:"message"` + FinishReason string `json:"finish_reason"` // stop/length/content_filter/tool_calls + } `json:"choices"` + Usage struct { + PromptTokens int `json:"prompt_tokens"` + CompletionTokens int `json:"completion_tokens"` + TotalTokens int `json:"total_tokens"` + } `json:"usage"` + Error struct { + Message string `json:"message"` + } `json:"error"` + } + + chatResult := &types.ChatResult{} + + if err := json.Unmarshal(data, &result); err != nil { + // JSON 解析失败也要返回一个 Message,避免上层 nil panic + return &types.Message{ + Role: "assistant", + Content: fmt.Sprintf("[Spark] 响应解析失败: %v | 原始: %s", err, string(data[:min(len(data), 200)])), + Timestamp: time.Now().Unix(), + }, chatResult + } + + // 错误响应(如额度耗尽 / 模型未授权) + if result.Error.Message != "" { + return &types.Message{ + Role: "assistant", + Content: fmt.Sprintf("[Spark] 调用失败: %s", result.Error.Message), + Timestamp: time.Now().Unix(), + }, chatResult + } + + if len(result.Choices) == 0 { + return &types.Message{ + Role: "assistant", + Content: "[Spark] 返回空响应", + Timestamp: time.Now().Unix(), + }, chatResult + } + + // 解析 finish_reason + chatResult.FinishReason = result.Choices[0].FinishReason + + // 解析 token 用量 + chatResult.PromptTokens = result.Usage.PromptTokens + chatResult.CompletionTokens = result.Usage.CompletionTokens + chatResult.TotalTokens = result.Usage.TotalTokens + + choice := result.Choices[0].Message + msg := &types.Message{ + Role: "assistant", + Content: choice.Content, + Timestamp: time.Now().Unix(), + } + + // 若触发工具调用,构造 ToolCallInfo + if len(choice.ToolCalls) > 0 { + tc := choice.ToolCalls[0] + // arguments 是 JSON 字符串,解析成 map,解析失败则原样塞进 query + params := map[string]any{} + if tc.Function.Arguments != "" { + if err := json.Unmarshal([]byte(tc.Function.Arguments), ¶ms); err != nil { + params["query"] = tc.Function.Arguments + } + } + // id 厂商未返回时生成一个,保证回放帧协议完整(tool_call_id 有对应目标) + id := tc.ID + if id == "" { + id = fmt.Sprintf("call_%d", time.Now().UnixNano()) + } + msg.ToolCall = &types.ToolCallInfo{ + ID: id, + ToolName: tc.Function.Name, + Params: params, + } + chatResult.ToolCall = msg.ToolCall + } + + // finish_reason 回落:讯飞非流式成功响应本身不带 finish_reason 字段 + // (官方文档的成功响应示例里没有该字段),为空不是解析错误。 + // 这里按语义回落:有工具调用 → tool_calls,否则 → stop,避免日志误导 + if chatResult.FinishReason == "" { + if msg.ToolCall != nil { + chatResult.FinishReason = "tool_calls" + } else { + chatResult.FinishReason = "stop" + } + } + + return msg, chatResult +} diff --git a/internal/middleware/middleware.go b/internal/middleware/middleware.go new file mode 100644 index 0000000..ecf73bf --- /dev/null +++ b/internal/middleware/middleware.go @@ -0,0 +1,323 @@ +package middleware + +import ( + "fmt" + "log" + "os" + "strings" + "time" + + "tcm-agent/internal/config" + + "github.com/gin-gonic/gin" + "github.com/golang-jwt/jwt/v5" +) + +// ======================================================================== +// 全局中间件 +// ======================================================================== +// 包含:请求日志 / 跨域支持 / JWT 鉴权 +// ======================================================================== + +// pollingPaths 面板轮询类端点集合(成功时不打请求日志) +// +// 为什么要跳过:/agent/view 面板每 2~5 秒轮询这些端点,每次轮询产生一行 +// [HTTP] 日志——500 行的 MemLog 环形缓冲十几分钟就会被轮询噪音刷满, +// 真正的业务日志(enhance/守卫/LLM 调用)全被顶掉; +// 且「实时日志」页会看到自己轮询产生的日志(自激循环)。 +// 只跳过 200 成功的轮询请求;出错(401/500 等)仍然照常记录,不丢排查线索 +var pollingPaths = map[string]bool{ + "/health": true, + "/api/v1/agent/logs": true, + "/api/v1/agent/runs": true, + "/api/v1/agent/stats": true, + "/api/v1/agent/system": true, + "/api/v1/agent/config": true, + "/api/v1/models/active-config": true, + "/api/v1/models/routes": true, +} + +// Logger 请求日志中间件 +// +// 记录每个请求的耗时、路径、状态码。 +// 格式:[HTTP] GET /api/v1/emr/generate | 200 | 1.2s +// 面板轮询类 GET 端点成功时静默(见 pollingPaths 注释) +func Logger() gin.HandlerFunc { + return func(c *gin.Context) { + start := time.Now() + path := c.Request.URL.Path + method := c.Request.Method + + c.Next() + + latency := time.Since(start) + status := c.Writer.Status() + + // 面板轮询成功请求不打日志,避免刷爆 MemLog 环形缓冲 + if method == "GET" && status == 200 && pollingPaths[path] { + return + } + log.Printf("[HTTP] %s %s | %d | %v", method, path, status, latency) + } +} + +// CORS 跨域中间件 +// +// 允许前端(医生工作站、患者小程序)跨域调用 API。 +// 生产环境应限制 Allow-Origin 为具体域名。 +func CORS() gin.HandlerFunc { + return func(c *gin.Context) { + c.Header("Access-Control-Allow-Origin", "*") + c.Header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS") + // X-KB-Admin-Password:KB 后台与 Agent 面板的共用口令头,跨域部署时预检需要放行 + c.Header("Access-Control-Allow-Headers", "Origin, Content-Type, Authorization, X-KB-Admin-Password") + c.Header("Access-Control-Max-Age", "86400") + + if c.Request.Method == "OPTIONS" { + c.AbortWithStatus(204) + return + } + c.Next() + } +} + +// Auth 鉴权中间件(双轨制:JWT + 共享密钥) +// +// 校验顺序: +// 1. KB admin 路径:走 X-KB-Admin-Password(独立体系,互不干扰) +// 2. 健康检查 / 静态资源:直接放行 +// 3. 业务 API(如 /api/v1/agent/enhance): +// a) 无 Authorization 头: +// - SharedSecret 也为空 → 放行(纯内网开发模式) +// - SharedSecret 非空 → 401(必须带密钥) +// b) 有 Authorization 头(去掉 "Bearer " 前缀后): +// - 路径 1:JWT 校验(JWTSecret 非空时启用,向后兼容小程序直连场景) +// - 路径 2:SharedSecret 字符串 == 比对(PHP 后台填一个值即可对接) +// - 路径 3:开发模式默认密钥(JWTSecret 为空时回落到硬编码开发密钥) +// - 三者任一通过即放行 +// +// Token 注入 Context: +// - JWT 模式:user_id / user_role(来自 claims.sub / claims.role) +// - SharedSecret 模式:auth_mode = "shared_secret" +// +// 生产环境建议: +// - 必须设置 SharedSecret(config.Agent.SharedSecret 或 env AGENT_SHARED_SECRET) +// - 需要解析用户身份的场景额外设置 JWTSecret 并用 RS256 非对称签名 +// - 密钥从环境变量或 KMS 读取,不要写死在 config.yaml +func Auth(cfg *config.Config) gin.HandlerFunc { + return func(c *gin.Context) { + path := c.Request.URL.Path + + // /health 直接放行(健康检查,无需鉴权) + if path == "/health" { + c.Next() + return + } + + // 管理前端登录接口放行:登录本身就是来换 token 的,不能先要求 token + if path == "/api/v1/auth/login" { + c.Next() + return + } + + // /admin SPA 静态资源放行(HTML/JS/CSS 公开,无敏感数据; + // 页面里的数据请求仍走下方 JWT/口令鉴权) + if path == "/admin" || strings.HasPrefix(path, "/admin/") { + c.Next() + return + } + + // 本地知识库后台(前端单页 + Admin API):口令头 或 面板 JWT 双通道 + // - 旧 KB 页 / 旧观测面板:X-KB-Admin-Password 口令头(原有体系,保留不动) + // - 新管理前端(/admin SPA):登录后带 Bearer JWT + // + // 注意:/kb/view 静态资源本身不鉴权(HTML/JS 公开,无敏感数据) + // 只有 /api/v1/kb/admin/* 的 API 才校验 + if strings.HasPrefix(path, "/api/v1/kb/admin/") { + expectedPwd := "qiqi991012" // 默认口令(生产环境必须在 config.yaml 覆盖) + if cfg != nil && cfg.KB.AdminPassword != "" { + expectedPwd = cfg.KB.AdminPassword + } + if c.GetHeader("X-KB-Admin-Password") == expectedPwd { + c.Set("auth_mode", "kb_admin") + c.Next() + return + } + // 口令没过:尝试面板 JWT(新前端路径) + if claims, ok := ValidateJWT(cfg, bearerFromHeader(c)); ok { + injectJWTClaims(c, claims) + c.Next() + return + } + c.JSON(401, gin.H{"code": 401, "message": "需要管理员口令或登录凭证"}) + c.Abort() + return + } + + // /kb/view 静态资源放行(HTML/JS/CSS 公开) + if path == "/kb/view" || strings.HasPrefix(path, "/kb/view/") { + c.Next() + return + } + + // 观测面板静态页放行(HTML 本身无敏感数据; + // 页面调用的 /api/v1/agent/runs 等数据 API 仍走下方业务鉴权) + // "/" 是面板主入口,"/agent/view" 保留为兼容旧入口; + // /favicon.ico 放行:浏览器自动请求,被鉴权拦会产生 401 控制台噪音 + if path == "/" || path == "/agent/view" || path == "/favicon.ico" { + c.Next() + return + } + + // ---------- 面板共用口令通道(与 KB 页同一口令) ---------- + // /agent/view 面板的所有数据请求带 X-KB-Admin-Password 头, + // 与 KB 管理口令比对通过即放行——运维只需记一个口令,两个面板通用。 + // PHP 走的 Bearer SharedSecret 路径在下方原样保留,互不影响 + if pwd := c.GetHeader("X-KB-Admin-Password"); pwd != "" { + expectedPwd := "qiqi991012" // 默认口令(生产环境必须在 config.yaml 覆盖) + if cfg != nil && cfg.KB.AdminPassword != "" { + expectedPwd = cfg.KB.AdminPassword + } + if pwd == expectedPwd { + c.Set("auth_mode", "kb_admin") + c.Next() + return + } + // 口令带了但不对:直接 401,让面板清缓存重新弹框 + c.JSON(401, gin.H{"error": "口令错误"}) + c.Abort() + return + } + + // ==================================================================== + // 业务 API 鉴权(双轨制:JWT + SharedSecret) + // ==================================================================== + sharedSecret := "" + if cfg != nil { + sharedSecret = cfg.Agent.SharedSecret + } + + tokenStr := c.GetHeader("Authorization") + // 无 Authorization 头:若 SharedSecret 也为空则放行(纯内网开发),否则 401 + if tokenStr == "" { + if sharedSecret == "" { + c.Set("auth_mode", "dev_open") + c.Next() + return + } + c.JSON(401, gin.H{"error": "未提供认证 Token"}) + c.Abort() + return + } + + // 去掉 "Bearer " 前缀 + bearer := tokenStr + if len(bearer) > 7 && bearer[:7] == "Bearer " { + bearer = bearer[7:] + } + + // ---------- 路径 1:JWT 校验(面板登录 token / 小程序直连场景) ---------- + if claims, ok := ValidateJWT(cfg, bearer); ok { + injectJWTClaims(c, claims) + c.Next() + return + } + // JWT 解析失败:继续尝试 SharedSecret 路径(可能是 PHP 端发来的简单密钥) + jwtSecret := getJWTSecret(cfg) + + // ---------- 路径 2:SharedSecret 字符串比对(PHP 后台对接主路径) ---------- + // PHP TcmAgentClient 把 ai_agent_secret 的值塞进 Bearer, + // 这里直接 == 比对,运维无需懂 JWT 也能配置 + if sharedSecret != "" && bearer == sharedSecret { + c.Set("auth_mode", "shared_secret") + c.Next() + return + } + + // ---------- 路径 3:开发模式默认密钥(仅 JWTSecret 为空时回落) ---------- + // 保留原硬编码默认密钥兼容老调用方;生产环境 JWTSecret 必填,此分支不会触发 + if jwtSecret == "tcm-agent-dev-secret-change-in-production" && bearer == jwtSecret { + c.Set("auth_mode", "dev_default") + c.Next() + return + } + + // 三条路径全部失败:401 + c.JSON(401, gin.H{"error": "Token 无效或密钥不匹配"}) + c.Abort() + } +} + +// getJWTSecret 获取 JWT 签名密钥 +// +// 优先级:环境变量 > 配置文件(cfg.Agent.JWTSecret)> 默认值(仅开发用) +// +// 注意:默认值仅用于开发环境,生产环境必须通过 env AGENT_JWT_SECRET +// 或 config.yaml agent.jwt_secret 覆盖 +func getJWTSecret(cfg *config.Config) string { + // 环境变量优先 + if secret := os.Getenv("JWT_SECRET"); secret != "" { + return secret + } + // 配置文件(agent.jwt_secret) + if cfg != nil && cfg.Agent.JWTSecret != "" { + return cfg.Agent.JWTSecret + } + // 默认值(仅开发环境!生产环境必须修改) + return "tcm-agent-dev-secret-change-in-production" +} + +// JWTSecret 导出 JWT 签名密钥的解析逻辑 +// +// 为什么导出:auth_handler 签发登录 token 必须与本中间件用同一把密钥, +// 单点维护密钥优先级(env > yaml > 默认值),避免两处逻辑漂移 +func JWTSecret(cfg *config.Config) string { + return getJWTSecret(cfg) +} + +// bearerFromHeader 从 Authorization 头提取 Bearer token(无前缀时原样返回) +func bearerFromHeader(c *gin.Context) string { + tokenStr := c.GetHeader("Authorization") + if len(tokenStr) > 7 && tokenStr[:7] == "Bearer " { + return tokenStr[7:] + } + return tokenStr +} + +// ValidateJWT 校验一个 JWT 字符串,返回 claims +// +// 供两处复用: +// - Auth 中间件的业务 API JWT 路径 +// - /api/v1/kb/admin/* 的面板 JWT 通道 +// +// 校验点:HMAC 签名算法 + 签名有效 +(jwt/v5 默认校验 exp 过期) +func ValidateJWT(cfg *config.Config, tokenStr string) (jwt.MapClaims, bool) { + if tokenStr == "" { + return nil, false + } + jwtSecret := getJWTSecret(cfg) + token, err := jwt.Parse(tokenStr, func(t *jwt.Token) (interface{}, error) { + if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { + return nil, fmt.Errorf("非预期的签名算法: %v", t.Header["alg"]) + } + return []byte(jwtSecret), nil + }) + if err != nil || !token.Valid { + return nil, false + } + claims, ok := token.Claims.(jwt.MapClaims) + return claims, ok +} + +// injectJWTClaims 把 JWT claims 中的用户信息注入 gin Context +// +// 下游 handler(如 /auth/profile、/auth/refresh)从 Context 读取身份 +func injectJWTClaims(c *gin.Context, claims jwt.MapClaims) { + if sub, ok := claims["sub"].(string); ok { + c.Set("user_id", sub) + } + if role, ok := claims["role"].(string); ok { + c.Set("user_role", role) + } + c.Set("auth_mode", "jwt") +} diff --git a/internal/model/entity/entity.go b/internal/model/entity/entity.go new file mode 100644 index 0000000..97802ed --- /dev/null +++ b/internal/model/entity/entity.go @@ -0,0 +1,61 @@ +package entity + +import "time" + +// EMR 电子病历实体(对应数据库表 emr) +type EMR struct { + ID int64 `json:"id" gorm:"primaryKey;autoIncrement"` + PatientID string `json:"patient_id" gorm:"index;not null"` + DoctorID string `json:"doctor_id" gorm:"index"` + Draft string `json:"draft" gorm:"type:text"` // 病历全文 + Structured string `json:"structured" gorm:"type:json"` // 结构化字段(JSON) + Status string `json:"status" gorm:"index"` // success/need_revision/draft + SessionID string `json:"session_id" gorm:"index"` // Agent会话ID + IsFinal bool `json:"is_final" gorm:"default:false"` // 是否为最终版 + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +// Prescription 处方实体(对应数据库表 prescription) +type Prescription struct { + ID int64 `json:"id" gorm:"primaryKey;autoIncrement"` + PatientID string `json:"patient_id" gorm:"index;not null"` + DoctorID string `json:"doctor_id" gorm:"index"` + SessionID string `json:"session_id" gorm:"index"` + Draft string `json:"draft" gorm:"type:text"` // 处方全文 + FormulaName string `json:"formula_name"` // 方剂名 + Herbs string `json:"herbs" gorm:"type:json"` // 药材列表(JSON) + Status string `json:"status" gorm:"index"` // success/blocked/need_review + Blocked bool `json:"blocked" gorm:"default:false"` // 是否被规则拦截 + Warnings string `json:"warnings" gorm:"type:json"` // 警告列表(JSON) + Approved bool `json:"approved" gorm:"default:false"` // 医生是否已审核 + ApprovedBy string `json:"approved_by"` // 审核医生ID + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +// AuditLog 审计日志实体(对应数据库表 audit_log) +// 记录所有关键操作,满足医疗合规要求 +type AuditLog struct { + ID int64 `json:"id" gorm:"primaryKey;autoIncrement"` + Action string `json:"action" gorm:"index"` // emr_create/emr_update/rx_generate/rx_approve + UserID string `json:"user_id" gorm:"index"` // 操作人 + TargetType string `json:"target_type"` // emr/prescription + TargetID string `json:"target_id" gorm:"index"` // 目标ID + Detail string `json:"detail" gorm:"type:text"` // 操作详情 + IPAddress string `json:"ip_address"` // 操作IP + CreatedAt time.Time `json:"created_at"` +} + +// KnowledgeDoc 知识库文档实体(对应数据库表 knowledge_doc) +type KnowledgeDoc struct { + ID int64 `json:"id" gorm:"primaryKey;autoIncrement"` + Title string `json:"title" gorm:"index"` + Category string `json:"category" gorm:"index"` // 方剂/药典/指南/病历模板 + Content string `json:"content" gorm:"type:longtext"` + Source string `json:"source"` // 来源 + MaxKBID string `json:"maxkb_id"` // MaxKB中的文档ID + Status string `json:"status" gorm:"default:pending"` // pending/vectorized/failed + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} diff --git a/internal/router/router.go b/internal/router/router.go new file mode 100644 index 0000000..c63329c --- /dev/null +++ b/internal/router/router.go @@ -0,0 +1,462 @@ +package router + +import ( + "fmt" + "log" + "net/http" + "os" + "path/filepath" + "strconv" + "strings" + + "tcm-agent/internal/agent" + "tcm-agent/internal/config" + "tcm-agent/internal/handler" + "tcm-agent/internal/kb" + "tcm-agent/internal/llm" + "tcm-agent/internal/middleware" + "tcm-agent/internal/service" + "tcm-agent/internal/tool" + tool_types "tcm-agent/internal/types" + + "github.com/gin-gonic/gin" +) + +// ======================================================================== +// 路由注册 +// ======================================================================== +// 完整初始化链: +// config → llm.InitLLM (工厂+路由+降级) → agent.InitRunner → router.Setup +// +// 不同场景的 Agent 自动使用不同模型: +// /emr/generate → "emr-generator" 场景 → DeepSeek/gpt-4o +// /prescription/... → "prescription" 场景 → GPT-4o/DeepSeek +// /agent/chat → 通用对话 → 默认模型 +// ======================================================================== + +// Setup 注册所有 HTTP 路由 +// +// 参数: +// router - Agent 引擎(Runner) +// cfg - 全局配置 +// llmRouter - 模型路由器(各 Handler 可按需使用) +// +// 返回: +// http.Handler 可直接传给 http.Server +func Setup(runner *agent.Runner, cfg *config.Config, llmRouter *llm.ModelRouter) http.Handler { + // 创建 Gin 引擎 + r := gin.New() + + // 全局中间件 + r.Use(gin.CustomRecovery(func(c *gin.Context, recovered any) { + // 把 panic 的完整堆栈打到日志,方便排查(默认 Recovery 会吞掉堆栈) + log.Printf("[PANIC] %v", recovered) + c.JSON(http.StatusInternalServerError, gin.H{ + "code": 500, + "message": fmt.Sprintf("服务器内部错误: %v", recovered), + }) + c.Abort() + })) + r.Use(middleware.Logger()) // 请求日志 + r.Use(middleware.CORS()) // 跨域支持 + r.Use(middleware.Auth(cfg)) // JWT 鉴权 + + // 健康检查(无需鉴权) + r.GET("/health", func(c *gin.Context) { + // 顺便返回当前模型路由信息,方便排查 + sceneCount := 0 + if llmRouter != nil { + sceneCount = len(llmRouter.ListRoutes()) + } + c.JSON(200, gin.H{ + "status": "ok", + "service": "tcm-agent", + "model_routes": sceneCount, + }) + }) + + // KB DB 健康检查(无需鉴权):方便排查 DB 是否就绪 + // 用法:curl http://localhost:18123/kb/health + r.GET("/kb/health", func(c *gin.Context) { + // 直接调一次 KBListLibraries 验证 dao.DB 是否真的可用 + // (内部有 if DB == nil 拦截) + _, err := service.KBHealthCheck() + if err != nil { + c.JSON(200, gin.H{"status": "fail", "error": err.Error()}) + return + } + c.JSON(200, gin.H{"status": "ok"}) + }) + + // ======================================================================== + // API v1 路由组 + // ======================================================================== + v1 := r.Group("/api/v1") + + // ========== 管理前端登录鉴权 ========== + // /admin SPA 的登录体系:login 换 JWT(中间件放行)、refresh 续签、profile 会话校验 + // 签发的 JWT 与业务 API 的 JWT 校验共用一把密钥,token 天然可调所有接口 + authHandler := handler.NewAuthHandler(cfg) + authGroup := v1.Group("/auth") + { + authGroup.POST("/login", authHandler.Login) // 中间件已放行,无需 token + authGroup.POST("/refresh", authHandler.Refresh) // 需带仍有效的 JWT + authGroup.GET("/profile", authHandler.Profile) // 需带仍有效的 JWT + } + + // ========== 病历相关接口 ========== + emr := v1.Group("/emr") + { + // 场景名从配置中读取,决定用哪个模型 + emrScene := getScene(cfg, "emr-generator") + emrHandler := handler.NewEMRHandler(runner, emrScene) + + emr.POST("/generate", emrHandler.Generate) + emr.POST("/qa", emrHandler.KnowledgeQA) + emr.GET("/:id", emrHandler.GetByID) + emr.PUT("/:id", emrHandler.Update) + } + + // ========== 处方相关接口 ========== + rx := v1.Group("/prescription") + { + rxScene := getScene(cfg, "prescription") + rxHandler := handler.NewPrescriptionHandler(runner, rxScene) + + rx.POST("/generate", rxHandler.Generate) + rx.POST("/validate", rxHandler.Validate) + rx.GET("/:id", rxHandler.GetByID) + rx.POST("/:id/approve", rxHandler.Approve) + } + + // ========== 知识库相关接口 ========== + know := v1.Group("/knowledge") + { + kbHandler := handler.NewKnowledgeHandler(runner) + know.POST("/search", kbHandler.Search) + know.POST("/ingest", kbHandler.Ingest) + } + + // ========== 本地知识库后台管理 ========== + // V1 不依赖 MaxKB:直接读写 z_xk.xk_kb_* 表,前端单页放在 /kb/view + // + // Embedder 在 V1 是 NoopEmbedder(不做向量化), + // V2 接入 BGE-M3 时在这里换 NewEmbedder(cfg.KB.EmbeddingProvider, cfg.KB.EmbeddingAPIKey) + kbEmbedder := kb.NewEmbedder("noop", "") + kbLibSvc := kb.NewLibraryService(kbEmbedder) + kbSearcher := kb.NewSearcher(kbEmbedder) + kbAdminHandler := handler.NewKBAdminHandler(kbLibSvc, kbSearcher) + kbGroup := v1.Group("/kb/admin") + { + // 库管理 + kbGroup.GET("/libraries", kbAdminHandler.ListLibraries) + kbGroup.GET("/libraries/:id", kbAdminHandler.GetLibrary) + kbGroup.POST("/libraries", kbAdminHandler.CreateLibrary) + kbGroup.DELETE("/libraries/:id", kbAdminHandler.DeleteLibrary) + // 文档管理 + kbGroup.GET("/libraries/:id/docs", kbAdminHandler.ListDocs) + kbGroup.POST("/docs/import", kbAdminHandler.ImportDocument) + kbGroup.GET("/docs/:id", kbAdminHandler.GetDoc) + kbGroup.DELETE("/docs/:id", kbAdminHandler.DeleteDoc) + // 分段管理 + kbGroup.GET("/docs/:id/chunks", kbAdminHandler.ListChunks) + kbGroup.PUT("/chunks/:id", kbAdminHandler.UpdateChunk) + // 分段批量启停/删除(管理前端多选操作;gin 1.6+ 支持静态段与 :id 参数段共存) + kbGroup.PUT("/chunks/batch", kbAdminHandler.BatchUpdateChunks) + // 文档重新分段(用新 max_len/overlap 重切,不用删除重传) + kbGroup.POST("/docs/:id/rechunk", kbAdminHandler.RechunkDocument) + // 工具 + kbGroup.POST("/search", kbAdminHandler.Search) + kbGroup.POST("/embed", kbAdminHandler.Embed) + + // 药品抓取定时任务(中药材+别名 → 知识库;调度器在 main 启动) + crawlHandler := handler.NewKBCrawlHandler() + kbGroup.GET("/crawl/sources", crawlHandler.ListSources) + kbGroup.GET("/crawl/tasks", crawlHandler.ListTasks) + kbGroup.POST("/crawl/tasks", crawlHandler.CreateTask) + kbGroup.PUT("/crawl/tasks/:id", crawlHandler.UpdateTask) + kbGroup.DELETE("/crawl/tasks/:id", crawlHandler.DeleteTask) + kbGroup.POST("/crawl/tasks/:id/run", crawlHandler.RunTask) + kbGroup.GET("/crawl/tasks/:id/logs", crawlHandler.ListLogs) + } + + // ========== 本地知识库前端单页(HTML+Vue CDN) ========== + // 访问 /kb/view 直接打开 view/index.html(开发阶段无需鉴权) + viewDir := filepath.Join("view") + r.StaticFS("/kb/view", http.Dir(viewDir)) + + // ========== Agent 运行观测面板(HTML+Vue CDN 单页) ========== + // "/" 是面板主入口(首页仪表盘 + 左侧菜单),/agent/view 保留兼容旧入口。 + // 页面本身公开(无敏感数据),数据 API 走口令(X-KB-Admin-Password,与 KB 页共用) + // 或 Bearer SharedSecret(PHP 对接用) + r.StaticFile("/", filepath.Join("view", "agent.html")) + r.StaticFile("/agent/view", filepath.Join("view", "agent.html")) + + // ========== 独立管理前端 /admin(Vue3 SPA 构建产物) ========== + // 前端项目 nl-tcm-agent-admin 执行 pnpm build 后产物落在 view/admin-dist, + // 这里不用 r.Static 挂 wildcard——SPA 的 history 路由(如 /admin/runs)刷新时 + // 磁盘上没有对应文件,静态文件服务器会直接 404; + // 改在 NoRoute 里统一处理:文件存在发文件,不存在回退 index.html(history 路由刷新可用) + adminDist := filepath.Join("view", "admin-dist") + r.NoRoute(func(c *gin.Context) { + p := c.Request.URL.Path + if p != "/admin" && !strings.HasPrefix(p, "/admin/") { + c.JSON(404, gin.H{"code": 404, "message": "路由不存在: " + p}) + return + } + // 尝试把路径映射到构建产物里的真实文件(js/css/图片等资源) + rel := strings.TrimPrefix(strings.TrimPrefix(p, "/admin"), "/") + if rel != "" { + full := filepath.Join(adminDist, filepath.Clean(rel)) + // 防路径穿越:Clean 后必须仍在 admin-dist 目录内 + if strings.HasPrefix(full, adminDist) { + if st, err := os.Stat(full); err == nil && !st.IsDir() { + c.File(full) + return + } + } + } + // 非真实文件(首页或 history 深链):回退 index.html + index := filepath.Join(adminDist, "index.html") + if _, err := os.Stat(index); err == nil { + c.File(index) + return + } + c.JSON(404, gin.H{ + "code": 404, + "message": "管理前端未构建:请在 nl-tcm-agent-admin 目录执行 pnpm build(产物输出到 view/admin-dist)", + }) + }) + + // ========== Agent 会话接口 ========== + // registerModelTest:模型连通性测试的 handler 在 agentGroup 块内创建 + // (依赖 enhancerSvc),但按 REST 语义注册到下方 modelGroup + var registerModelTest gin.HandlerFunc + agentGroup := v1.Group("/agent") + { + agentHandler := handler.NewAgentHandler(runner) + agentGroup.POST("/chat", agentHandler.Chat) + agentGroup.GET("/session/:id", agentHandler.GetSession) + + // 知识增强端点(给 PHP 端 TcmAgentClient 调用) + // PHP 拼好 messages 后调这个端点:Go 端负责 KB 检索 + LLM 调用 + 步骤记录 + maxkbClient := tool.NewMaxKBClient(cfg.MaxKB) + enhancerSvc := service.NewEnhancerService(maxkbClient, llmRouter, nil, cfg) + // V1:注入本地知识库检索器(默认走 ai_kb_source=local) + enhancerSvc.WithLocalSearcher(kbSearcher) + // 把 Runner 注册的工具集注入 EnhancerService,让 ReactLoop 路径可触发 Function Calling + // 注意:这里转换 []agent.Tool → map[string]types.Tool(去重按 Tool.Name()) + if runner != nil { + toolMap := make(map[string]tool_types.Tool) + for _, t := range runner.GetTools() { + toolMap[t.Name()] = t + } + enhancerSvc.WithTools(toolMap) + } + enhancerHandler := handler.NewEnhancerHandler(enhancerSvc) + + // ---------- 稳定性加固:enhance 并发限流(信号量) ---------- + // 每个 enhance 请求要占用一整条 LLM 调用链(10s~2min), + // 上游 PHP 若出现重试风暴,无限并发会打爆 LLM 配额并拖垮本服务。 + // 用带缓冲 channel 做信号量:满 16 个并发时直接 503 快速失败, + // 让 PHP 端走自己的降级逻辑(直连模式),而不是排队堆积超时 + enhanceSem := make(chan struct{}, 16) + // 注册并发探针:面板「系统状态」Tab 通过 /agent/system 读当前并发/上限 + // 用回调注入避免 service 反向依赖 router + service.SetConcurrencyProbe(func() (int, int) { + return len(enhanceSem), cap(enhanceSem) + }) + agentGroup.POST("/enhance", func(c *gin.Context) { + select { + case enhanceSem <- struct{}{}: + defer func() { <-enhanceSem }() + enhancerHandler.Enhance(c) + default: + c.JSON(http.StatusServiceUnavailable, gin.H{ + "code": 503, + "message": "Agent 并发已满(16),请稍后重试或走直连模式", + }) + } + }) + + // ========== 运行轨迹观测接口(/agent/view 面板数据源) ========== + // 数据来自 Go 进程内的 RunLog 环形缓冲(最近 200 次运行), + // 走全局 Auth 中间件:面板带 X-KB-Admin-Password 口令头(与 KB 后台共用), + // PHP 对接走 Bearer SharedSecret,两条鉴权路径互不影响 + + // 运行列表(摘要,不含 step detail 全文) + // GET /api/v1/agent/runs?limit=50&scene=medical_record&status=1 + agentGroup.GET("/runs", func(c *gin.Context) { + limit, _ := strconv.Atoi(c.DefaultQuery("limit", "50")) + status, _ := strconv.Atoi(c.DefaultQuery("status", "0")) + scene := c.Query("scene") + c.JSON(200, gin.H{ + "code": 200, + "data": service.RunLogList(limit, scene, status), + }) + }) + + // 单次运行详情(含完整 steps 时间线) + // GET /api/v1/agent/runs/123 + agentGroup.GET("/runs/:id", func(c *gin.Context) { + id, err := strconv.ParseInt(c.Param("id"), 10, 64) + if err != nil { + c.JSON(400, gin.H{"code": 400, "message": "id 必须是数字"}) + return + } + rec, ok := service.RunLogGet(id) + if !ok { + c.JSON(404, gin.H{"code": 404, "message": "记录不存在(可能已被环形缓冲覆盖或服务重启)"}) + return + } + c.JSON(200, gin.H{"code": 200, "data": rec}) + }) + + // 聚合统计(成功率/平均耗时/token 消耗/按场景分布) + // GET /api/v1/agent/stats + agentGroup.GET("/stats", func(c *gin.Context) { + c.JSON(200, gin.H{"code": 200, "data": service.RunLogStats()}) + }) + + // ========== AI 生成历史(DB 长期数据,只读) ========== + // 与 /runs(内存环形缓冲,最近 200 条)互补: + // 这里读 PHP 落库的 xk_ai_generation(_step),管理前端「历史记录」页数据源 + historyHandler := handler.NewHistoryHandler() + agentGroup.GET("/history", historyHandler.List) + agentGroup.GET("/history/scenes", historyHandler.Scenes) + agentGroup.GET("/history/:id", historyHandler.Detail) + + // ========== 观测与调试接口(面板「实时日志/系统状态/调试工具/配置总览」数据源) ========== + // 全部只读或无持久副作用;日志可能含 PHI(debug 开关打开时),必须走 Auth + observeHandler := handler.NewObserveHandler(enhancerSvc) + agentGroup.GET("/logs", observeHandler.Logs) // 增量日志 + agentGroup.GET("/system", observeHandler.System) // 进程运行时状态 + agentGroup.GET("/config", observeHandler.Config) // Agent 配置只读视图 + agentGroup.POST("/guard-test", observeHandler.GuardTest) // 医疗守卫测试台 + agentGroup.POST("/kb-test", observeHandler.KBTest) // 知识库检索测试 + + // 模型连通性测试挂在 modelGroup 语义更合适,但 handler 需要 enhancerSvc, + // 而 modelGroup 在下方定义——这里先存引用,注册放到 modelGroup 代码块里 + registerModelTest = observeHandler.ModelTest + } + + // ========== 模型管理接口(运维用) ========== + modelGroup := v1.Group("/models") + { + // 模型连通性测试(面板「调试工具」Tab):真实调一次 LLM(max_tokens 64) + // POST /api/v1/models/test body: {"provider":"", "message":""} + if registerModelTest != nil { + modelGroup.POST("/test", registerModelTest) + } + modelGroup.GET("/routes", func(c *gin.Context) { + if llmRouter == nil { + c.JSON(503, gin.H{"error": "模型路由未初始化"}) + return + } + // fallbacks / default_provider 一并返回:管理前端「模型管理」页 + // 需要画降级链可视化(主模型 → 降级1 → 降级2),数据来自 config.yaml + fallbacks := map[string][]string{} + defaultProvider := "" + if cfg != nil { + fallbacks = cfg.LLM.FallbackChains + defaultProvider = cfg.LLM.DefaultProvider + } + c.JSON(200, gin.H{ + "code": 200, + "routes": llmRouter.ListRoutes(), + "fallbacks": fallbacks, + "default_provider": defaultProvider, + }) + }) + + modelGroup.POST("/route", func(c *gin.Context) { + // 动态注册新路由(热更新,无需重启) + var req struct { + Scene string `json:"scene" binding:"required"` + Provider string `json:"provider" binding:"required"` + } + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(400, gin.H{"error": "参数错误"}) + return + } + llmRouter.RegisterRoute(req.Scene, req.Provider) + c.JSON(200, gin.H{ + "code": 200, + "message": "路由已更新", + "scene": req.Scene, + "provider": req.Provider, + }) + }) + + // ★ 主动失效"生效 LLM 配置"缓存 + // 使用场景:PHP 后台"模型配置"Tab 改完 provider/model/key 后调一下本接口, + // 让 Go 端下一次请求时立刻从 DB 读取最新配置(无需等 60s TTL 自然过期) + // 鉴权:复用全局 middleware.Auth(需带 Authorization) + modelGroup.POST("/invalidate-cache", func(c *gin.Context) { + llm.InvalidateConfigClientCache() + c.JSON(200, gin.H{ + "code": 200, + "message": "Go 端 LLM 配置缓存已失效,下次请求将重新从 DB 读取", + }) + }) + + // ★ 查询当前生效的 LLM 配置(运维排查用) + // 走全局 Auth(口令头或 Bearer 均可),返回值已脱敏(api_key 只出后 4 位) + modelGroup.GET("/active-config", func(c *gin.Context) { + // 直读 DB(绕过缓存),保证看到的是最新数据 + fallback := "" + if cfg != nil { + fallback = cfg.LLM.DefaultProvider + } + resolved, err := llm.PeekActiveLLMConfig(fallback) + if err != nil { + c.JSON(200, gin.H{ + "code": 500, + "message": err.Error(), + "hint": "DB 解析失败,请检查 dao.DB 是否就绪或 xk_system_config 是否配置", + }) + return + } + // 脱敏:不返回完整 api_key,仅返回后 4 位 + keyTail := "" + if len(resolved.APIKey) > 4 { + keyTail = resolved.APIKey[len(resolved.APIKey)-4:] + } + c.JSON(200, gin.H{ + "code": 200, + "data": gin.H{ + "provider": resolved.Provider, + "model": resolved.Model, + "api_url": resolved.APIURL, + "api_key_id": resolved.APIKeyID, + "api_key_tail": keyTail, + "source": resolved.Source, + }, + }) + }) + } + + return r +} + +// getScene 从配置中获取场景对应的模型名 +// +// 优先级: +// config.LLM.Routes[sceneName] → 默认值 +func getScene(cfg *config.Config, defaultScene string) string { + if cfg == nil || cfg.LLM.Routes == nil { + return "" + } + // 尝试常见变体 + candidates := []string{ + defaultScene, + defaultScene + "-model", + defaultScene + "-scene", + } + for _, c := range candidates { + if v, ok := cfg.LLM.Routes[c]; ok { + return v + } + } + return "" +} diff --git a/internal/rule/rule_engine.go b/internal/rule/rule_engine.go new file mode 100644 index 0000000..a164262 --- /dev/null +++ b/internal/rule/rule_engine.go @@ -0,0 +1,234 @@ +package rule + +import ( + "fmt" + "strings" +) + +// ======================================================================== +// 规则引擎(独立包,不依赖 agent 包) +// ======================================================================== +// 设计原则: +// - 规则引擎是"硬约束",必须独立于 LLM 运行 +// - 不依赖 agent 包,避免循环引用 +// - 输入是纯文本 + 患者信息,输出是警告列表 + 拦截标志 +// +// 使用方式: +// checker := rule.NewPrescriptionValidator() +// warnings, blocked := checker.Validate(prescriptionText, &rule.PatientInfo{...}) +// ======================================================================== + +// ========== 配伍禁忌规则 ========== + +// eighteenAnti 十八反:绝对禁止同用的药对 +// +// 中医经典配伍禁忌,源自《神农本草经》: +// "甘草反甘遂、大戟、芫花、海藻" +// "乌头反贝母、瓜蒌、半夏、白蔹、白及" +// "藜芦反人参、沙参、丹参、玄参、苦参、细辛、芍药" +var eighteenAnti = map[string][]string{ + "甘草": {"甘遂", "大戟", "芫花", "海藻"}, + "乌头": {"贝母", "瓜蒌", "半夏", "白蔹", "白及"}, + "藜芦": {"人参", "沙参", "丹参", "玄参", "苦参", "细辛", "芍药"}, +} + +// nineteenFear 十九畏:原则上不宜同用 +// +// 源自《药性论》等文献: +// "硫黄畏朴硝,水银畏砒霜,狼毒畏密陀僧..." +var nineteenFear = map[string]string{ + "硫黄": "朴硝", "水银": "砒霜", "狼毒": "密陀僧", + "巴豆": "牵牛", "丁香": "郁金", "牙硝": "三棱", + "川乌": "犀角", "草乌": "犀角", "人参": "五灵脂", "官桂": "赤石脂", +} + +// ========== 剂量上限规则(《中国药典》2020版) ========== +// +// 安全剂量上限(克/日),超过需要特殊标注或禁止。 +// 数据来源:《中华人民共和国药典》2020年版 一部 +var doseLimit = map[string]float64{ + "麻黄": 9, // 常用3-9g,超量可致心悸 + "附子": 15, // 常用3-15g,超量有毒 + "细辛": 3, // 常用1-3g,超量伤肾 + "朱砂": 0.5, // 有毒,极量0.5g + "雄黄": 0.1, // 有毒 + "大黄": 15, // 常用3-15g + "桂枝": 10, // 常用3-10g + "石膏": 60, // 常用15-60g + "知母": 12, // 常用6-12g + "甘草": 10, // 常用2-10g,长期大剂量致水肿 +} + +// ========== 孕妇慎用/禁用药 ========== +// +// 分为"禁用"(毒性/破血)和"慎用"(需医师评估) +// 参考:《中国药典》妊娠禁忌表 +var pregnancyRisk = map[string]string{ + // 禁用(毒性/破血) + "附子": "禁用", "乌头": "禁用", "半夏": "禁用", "南星": "禁用", + "桃仁": "禁用", "红花": "禁用", "三棱": "禁用", "莪术": "禁用", + "水蛭": "禁用", "虻虫": "禁用", "麝香": "禁用", "巴豆": "禁用", + // 慎用 + "大黄": "慎用", "芒硝": "慎用", "枳实": "慎用", "肉桂": "慎用", + "干姜": "慎用", "益母草": "慎用", +} + +// ========== 患者信息(规则引擎的输入) ========== +// +// 独立于 agent 包的类型,避免循环依赖。 +// agent.PrescriptionRequest 在调用规则引擎时转换为此类型。 +type PatientInfo struct { + IsPregnant bool // 是否孕妇 + Allergies []string // 过敏史 + Age int // 年龄(影响剂量) +} + +// ======================================================================== +// 病历质控 +// ======================================================================== + +// EMRQualityChecker 病历质控检查器 +// +// 独立于 LLM,做硬规则校验。 +// 检查项:必填字段、术语规范、格式合规。 +type EMRQualityChecker struct{} + +// NewEMRQualityChecker 创建病历质控器 +func NewEMRQualityChecker() *EMRQualityChecker { return &EMRQualityChecker{} } + +// Check 检查病历质量,返回问题列表 +// +// 检查项: +// 1. 必须包含「主诉」 +// 2. 必须包含「舌象」描述 +// 3. 必须包含「脉象」描述 +// 4. 必须包含「诊断」 +// 5. 口语术语建议替换为标准术语 +func (c *EMRQualityChecker) Check(emrText string) []string { + issues := make([]string, 0) + + // 规则1:必须包含主诉 + if !strings.Contains(emrText, "主诉") && !strings.Contains(emrText, "主 诉") { + issues = append(issues, "【缺失】病历缺少「主诉」字段") + } + + // 规则2:必须包含舌象 + if !strings.Contains(emrText, "舌") { + issues = append(issues, "【缺失】病历缺少「舌象」描述") + } + + // 规则3:必须包含脉象 + if !strings.Contains(emrText, "脉") { + issues = append(issues, "【缺失】病历缺少「脉象」描述") + } + + // 规则4:必须包含诊断 + if !strings.Contains(emrText, "诊断") { + issues = append(issues, "【缺失】病历缺少「诊断」字段") + } + + // 规则5:术语规范化检查(口语→标准术语) + slangMap := map[string]string{ + "胃不舒服": "胃脘不适", "头晕": "眩晕", "心慌": "心悸", + "睡不着": "失眠", "吃不下": "纳差", "拉肚子": "泄泻", + } + for slang, standard := range slangMap { + if strings.Contains(emrText, slang) { + issues = append(issues, fmt.Sprintf("【术语】建议将「%s」改为标准术语「%s」", slang, standard)) + } + } + + return issues +} + +// ======================================================================== +// 处方校验 +// ======================================================================== + +// PrescriptionValidator 处方校验器 +// +// 核心安全组件,执行所有硬性规则检查。 +// 任何处方在到达医生审核前,必须通过此校验。 +type PrescriptionValidator struct{} + +// NewPrescriptionValidator 创建处方校验器 +func NewPrescriptionValidator() *PrescriptionValidator { return &PrescriptionValidator{} } + +// Validate 校验处方,返回 (警告列表, 是否被硬规则拦截) +// +// 参数: +// prescription - 处方文本(自然语言或结构化均可) +// patient - 患者信息(孕妇/过敏/年龄) +// +// 返回: +// warnings - 所有警告信息(含拦截原因) +// blocked - true 表示被硬规则拦截,处方不可通过 +// +// 检查顺序: +// ① 十八反 → ② 十九畏 → ③ 孕妇禁忌 → ④ 过敏冲突 → ⑤ 剂量提醒 +func (v *PrescriptionValidator) Validate(prescription string, patient *PatientInfo) ([]string, bool) { + warnings := make([]string, 0) + blocked := false + + // ===== 规则1:十八反检查(硬拦截) ===== + // 经典配伍禁忌,绝对禁止 + for herb, conflicts := range eighteenAnti { + if strings.Contains(prescription, herb) { + for _, c := range conflicts { + if strings.Contains(prescription, c) { + warnings = append(warnings, + fmt.Sprintf("【十八反-拦截】%s 反 %s,禁止同用!", herb, c)) + blocked = true + } + } + } + } + + // ===== 规则2:十九畏检查(硬拦截) ===== + // 原则上不宜同用 + for a, b := range nineteenFear { + if strings.Contains(prescription, a) && strings.Contains(prescription, b) { + warnings = append(warnings, + fmt.Sprintf("【十九畏-拦截】%s 畏 %s,原则不宜同用!", a, b)) + blocked = true + } + } + + // ===== 规则3:孕妇禁忌检查(硬拦截/警告) ===== + if patient != nil && patient.IsPregnant { + for herb, risk := range pregnancyRisk { + if strings.Contains(prescription, herb) { + if risk == "禁用" { + warnings = append(warnings, + fmt.Sprintf("【孕妇安全-拦截】孕妇禁用 %s!", herb)) + blocked = true + } else { + warnings = append(warnings, + fmt.Sprintf("【孕妇安全-警告】孕妇慎用 %s", herb)) + } + } + } + } + + // ===== 规则4:过敏史检查(硬拦截) ===== + if patient != nil { + for _, allergen := range patient.Allergies { + if allergen != "" && strings.Contains(prescription, allergen) { + warnings = append(warnings, + fmt.Sprintf("【过敏-拦截】处方含过敏原 %s!", allergen)) + blocked = true + } + } + } + + // ===== 规则5:剂量超限检查(仅警告,不拦截) ===== + // 生产环境应解析处方中的精确剂量做对比 + for herb, limit := range doseLimit { + if strings.Contains(prescription, herb) { + warnings = append(warnings, + fmt.Sprintf("【剂量提醒】%s 用量请控制在 %.0fg 以内(药典上限)", herb, limit)) + } + } + + return warnings, blocked +} diff --git a/internal/security/xkaes/xkaes.go b/internal/security/xkaes/xkaes.go new file mode 100644 index 0000000..258339b --- /dev/null +++ b/internal/security/xkaes/xkaes.go @@ -0,0 +1,108 @@ +package xkaes + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/sha256" + "encoding/base64" + "errors" + "strings" +) + +// ======================================================================== +// 萧康云医字段加密复刻包(xkaes) +// ======================================================================== +// 目的:1:1 复刻 PHP App\Core\DatabaseEncryptor 的 AES-256-CBC 解密逻辑, +// 让 Go Agent 直连 z_xk 库时能正确解出 xk_ai_api_key.api_key 字段。 +// +// PHP 端算法(App\Core\DatabaseEncryptor.php): +// 1. 算法:AES-256-CBC +// 2. 密钥派生:key = SHA-256(ENCRYPT_KEY) → 32 字节 raw(不是 hex 字符串!) +// 3. IV:每次加密随机生成 16 字节,前置于密文一起 base64 +// 4. padding:PKCS#7(OPENSSL_RAW_DATA 即默认 PKCS#7) +// 5. 编码:标准 base64(带 = padding) +// 6. 前缀:明文用 "xk_ase_256_" 标记,便于识别密文 +// +// 密文格式:xk_ase_256_ +// +// 易错点(任一条不对都会解密失败): +// - 密钥不是直接用 ENCRYPT_KEY,而是 SHA-256 取 32 raw 字节 +// - IV 不是固定值,base64 解码后前 16 字节切出来当 IV +// - Go 的 CBC Decrypter 不会自动去 padding,要手动去 PKCS#7 +// - 不含前缀的串视为未加密旧数据,原样返回(PHP decrypt 第一步就判断) +// ======================================================================== + +// Prefix 加密字段前缀(与 PHP DatabaseEncryptor 保持一致) +const Prefix = "xk_ase_256_" + +// Decrypt 解密用 AES-256-CBC 加密的字符串 +// +// 参数: +// cipherText - 形如 "xk_ase_256_" 的密文; +// 若不含前缀则视为明文,原样返回(兼容历史未加密数据) +// encryptKey - PHP 端 env('ENCRYPT_KEY') 的原始值(任意长度字符串) +// +// 返回: +// 解密后的明文;任何一步出错返回 error +// +// 注意: +// PHP 端 decryptApiKey 在异常时吞错返回空串,Go 端保留 error 便于排查 +func Decrypt(cipherText, encryptKey string) (string, error) { + cipherText = strings.TrimSpace(cipherText) + if cipherText == "" { + // 空串原样返回,与 PHP 一致 + return "", nil + } + + // 不含前缀 = 未加密的旧数据,直接当明文返回 + if !strings.HasPrefix(cipherText, Prefix) { + return cipherText, nil + } + + // 去前缀后做标准 base64 解码 + raw, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(cipherText, Prefix)) + if err != nil { + return "", errors.New("xkaes: base64 解码失败: " + err.Error()) + } + + // IV 固定 16 字节(AES block size) + // 这里的 16 与 PHP openssl_cipher_iv_length('AES-256-CBC') 一致 + if len(raw) < aes.BlockSize { + return "", errors.New("xkaes: 密文长度不足,无法切出 IV") + } + iv := raw[:aes.BlockSize] + body := raw[aes.BlockSize:] + + // 密钥派生:SHA-256(encryptKey) 取 32 字节 raw 二进制 + digest := sha256.Sum256([]byte(encryptKey)) + block, err := aes.NewCipher(digest[:]) + if err != nil { + return "", errors.New("xkaes: 创建 AES cipher 失败: " + err.Error()) + } + + // 密文长度必须是 block size 的整数倍,否则说明密文损坏 + if len(body) == 0 || len(body)%block.BlockSize() != 0 { + return "", errors.New("xkaes: 密文不是 block 对齐的,可能已损坏") + } + + // CBC 解密(在原 buffer 上就地解密,节省一次拷贝) + dst := make([]byte, len(body)) + cipher.NewCBCDecrypter(block, iv).CryptBlocks(dst, body) + + // 去 PKCS#7 padding + // Go 的 CBC Decrypter 不会自动去 padding,必须手动去 + // PHP 的 OPENSSL_RAW_DATA flag 会自动去 padding,行为差异点在这里 + pad := int(dst[len(dst)-1]) + if pad <= 0 || pad > block.BlockSize() || pad > len(dst) { + return "", errors.New("xkaes: 无效的 PKCS#7 padding,密钥可能不对或密文损坏") + } + + // 校验 padding 字节(PKCS#7 要求末尾 pad 个字节都等于 pad) + for i := len(dst) - pad; i < len(dst); i++ { + if int(dst[i]) != pad { + return "", errors.New("xkaes: PKCS#7 padding 字节不一致") + } + } + + return string(dst[:len(dst)-pad]), nil +} diff --git a/internal/service/crawl_service.go b/internal/service/crawl_service.go new file mode 100644 index 0000000..1cefac8 --- /dev/null +++ b/internal/service/crawl_service.go @@ -0,0 +1,471 @@ +package service + +import ( + "context" + "fmt" + "log" + "strings" + "sync" + "time" + "unicode/utf8" + + "tcm-agent/internal/crawler" + "tcm-agent/internal/dao" +) + +// ======================================================================== +// CrawlService —— 药品抓取的运行编排 + 进程内定时调度 +// ======================================================================== +// 两个入口: +// 1. 手动触发:面板点「立即抓取」→ handler 调 TriggerCrawlTask(异步跑) +// 2. 定时触发:StartCrawlScheduler 常驻 goroutine 每分钟检查到期任务 +// +// 一次运行的完整流程(runCrawl): +// 加载任务 → 建运行日志(running) → 抓索引 → 按游标切本批 URL → +// 逐个抓详情+解析 → upsert 到目标知识库(按药名判重)→ +// 更新游标/日志终态/任务摘要 → 刷新库统计 +// +// 并发控制: +// - 同一任务同一时刻只允许一次运行(crawlRunning 内存标记) +// - 全局同一时刻只跑一个抓取任务(信号量容量 1)——抓取是 IO 慢活, +// 串行既保护源站也避免多任务写同一库的统计竞态 +// ======================================================================== + +// crawl 运行状态(内存标记;重启后自然清零,DB 里 running 状态由启动时校正) +var ( + crawlMu sync.Mutex + crawlRunning = map[uint]bool{} + // 全局串行信号量:容量 1,多任务同时到期时排队执行 + crawlSem = make(chan struct{}, 1) +) + +// CrawlTaskRunning 查询某任务是否正在运行(API 列表展示用) +func CrawlTaskRunning(id uint) bool { + crawlMu.Lock() + defer crawlMu.Unlock() + return crawlRunning[id] +} + +// markCrawlRunning 尝试标记任务开始运行;已在运行返回 false +func markCrawlRunning(id uint) bool { + crawlMu.Lock() + defer crawlMu.Unlock() + if crawlRunning[id] { + return false + } + crawlRunning[id] = true + return true +} + +// unmarkCrawlRunning 清除运行标记 +func unmarkCrawlRunning(id uint) { + crawlMu.Lock() + defer crawlMu.Unlock() + delete(crawlRunning, id) +} + +// TriggerCrawlTask 触发一次抓取(异步) +// +// 同步做完所有"可立即拒绝"的校验(任务存在/启用/未在运行/源合法), +// 通过后丢 goroutine 后台跑,立即返回给前端——抓取一批要几分钟,HTTP 不能等 +func TriggerCrawlTask(taskID uint, trigger string) error { + task, err := dao.KBCrawlTaskGet(taskID) + if err != nil { + return err + } + if task.Status != 1 { + return fmt.Errorf("任务已禁用,请先启用再触发") + } + if _, ok := crawler.GetSource(task.Source); !ok { + return fmt.Errorf("抓取源 %s 不存在", task.Source) + } + if _, err := dao.KBGetLibrary(task.LibraryID); err != nil { + return fmt.Errorf("目标知识库不存在(id=%d),请先在知识库管理里创建", task.LibraryID) + } + if !markCrawlRunning(taskID) { + return fmt.Errorf("任务正在运行中,请等待本次完成") + } + go func() { + defer unmarkCrawlRunning(taskID) + // 全局串行:等别的抓取任务跑完(保护源站 + 避免统计竞态) + crawlSem <- struct{}{} + defer func() { <-crawlSem }() + // 排队等待期间任务可能被用户禁用或改配置: + // 拿到执行权后重读最新配置再跑,避免按触发时的旧快照执行 + fresh, err := dao.KBCrawlTaskGet(taskID) + if err != nil { + log.Printf("[Crawl] 任务 #%d 排队后重读失败(可能已删除),跳过: %v", taskID, err) + return + } + if fresh.Status != 1 { + log.Printf("[Crawl] 任务 #%d 排队期间被禁用,跳过本次运行", taskID) + return + } + runCrawl(fresh, trigger) + }() + return nil +} + +// StartCrawlScheduler 启动定时调度器(main 里调用一次) +// +// 每 60s 醒来检查所有启用的非手动任务是否到期,到期的异步触发。 +// 用轮询而非精确定时器:任务量小(个位数),分钟级精度足够,逻辑最简单 +func StartCrawlScheduler() { + go func() { + // 启动时先校正一遍"孤儿 running"状态: + // 上次进程崩溃/重启时正在跑的任务,DB 里 last_status 会永远停在 running, + // 面板会一直显示进行中——这里统一改成 failed 并注明原因 + fixOrphanRunning() + + ticker := time.NewTicker(60 * time.Second) + defer ticker.Stop() + log.Printf("[Crawl] 定时调度器已启动(每分钟检查到期任务)") + for range ticker.C { + checkDueTasks() + } + }() +} + +// fixOrphanRunning 把因进程重启滞留在 running 的任务/日志校正为 failed +func fixOrphanRunning() { + tasks, err := dao.KBCrawlTaskList() + if err != nil { + return + } + now := int(time.Now().Unix()) + for _, t := range tasks { + if t.LastStatus == "running" { + _ = dao.KBCrawlTaskUpdate(t.ID, map[string]any{ + "last_status": "failed", + "last_message": "服务重启中断(进程退出时任务未完成)", + }) + // 对应的运行中日志也补终态 + if logs, err := dao.KBCrawlLogList(t.ID, 5); err == nil { + for _, lg := range logs { + if lg.Status == "running" && lg.FinishedAt == 0 { + _ = dao.KBCrawlLogFinish(lg.ID, map[string]any{ + "status": "failed", "finished_at": now, + "message": "服务重启中断", + }) + } + } + } + } + } +} + +// checkDueTasks 扫描启用任务,把到期的触发执行 +func checkDueTasks() { + tasks, err := dao.KBCrawlTaskList() + if err != nil { + return + } + now := time.Now() + for _, t := range tasks { + if t.Status != 1 || t.ScheduleType == "" || t.ScheduleType == "manual" { + continue + } + if CrawlTaskRunning(t.ID) { + continue + } + if crawlDue(&t, now) { + log.Printf("[Crawl] 任务 #%d「%s」到期,定时触发", t.ID, t.Name) + if err := TriggerCrawlTask(t.ID, "schedule"); err != nil { + log.Printf("[Crawl] 任务 #%d 定时触发失败: %v", t.ID, err) + } + } + } +} + +// crawlDue 判断任务是否到期 +// +// 三种调度语义(都基于本地时区): +// - interval:距上次运行 >= interval_hours 小时(从未运行视为立即到期) +// - daily: 今天的 run_at_hour 整点已过,且上次运行早于该时点 +// - weekly: 本周 run_at_weekday 的 run_at_hour 已过,且上次运行早于该时点 +func crawlDue(t *dao.KBCrawlTaskRow, now time.Time) bool { + last := time.Unix(int64(t.LastRunAt), 0) + switch t.ScheduleType { + case "interval": + hours := t.IntervalHours + if hours < 1 { + hours = 24 + } + return t.LastRunAt == 0 || now.Sub(last) >= time.Duration(hours)*time.Hour + case "daily": + due := time.Date(now.Year(), now.Month(), now.Day(), t.RunAtHour, 0, 0, 0, now.Location()) + return now.After(due) && last.Before(due) + case "weekly": + // 找到本周的目标星期(周日=0 与 time.Weekday 语义一致) + offset := t.RunAtWeekday - int(now.Weekday()) + due := time.Date(now.Year(), now.Month(), now.Day(), t.RunAtHour, 0, 0, 0, now.Location()). + AddDate(0, 0, offset) + // 目标时点在未来(本周还没到)则不触发;已过则比对上次运行 + return now.After(due) && last.Before(due) + } + return false +} + +// runCrawl 执行一次抓取(同步;调用方负责放 goroutine + 运行标记) +func runCrawl(task *dao.KBCrawlTaskRow, trigger string) { + src, _ := crawler.GetSource(task.Source) + startAt := int(time.Now().Unix()) + + // 建运行日志 + 任务标记 running + logRow := &dao.KBCrawlLogRow{ + TaskID: task.ID, TriggerType: trigger, + StartedAt: startAt, Status: "running", + } + if err := dao.KBCrawlLogCreate(logRow); err != nil { + log.Printf("[Crawl] 任务 #%d 创建运行日志失败: %v", task.ID, err) + return + } + _ = dao.KBCrawlTaskUpdate(task.ID, map[string]any{ + "last_run_at": startAt, "last_status": "running", "last_message": "", + }) + + // 超时预算:索引抓取 ~1min + 每条详情 ~2s(含限速)+ 入库余量 + itemsPerRun := task.ItemsPerRun + if itemsPerRun < 1 { + itemsPerRun = 50 + } + if itemsPerRun > 500 { + itemsPerRun = 500 + } + timeout := time.Duration(itemsPerRun)*3*time.Second + 3*time.Minute + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + + finish := func(status, msg string, fetched, created, updated, failed int, newOffset int) { + _ = dao.KBCrawlLogFinish(logRow.ID, map[string]any{ + "status": status, "finished_at": int(time.Now().Unix()), + "total_fetched": fetched, "created_docs": created, + "updated_docs": updated, "failed_items": failed, + "message": truncateRunes(msg, 900), + }) + _ = dao.KBCrawlTaskUpdate(task.ID, map[string]any{ + "last_status": status, "last_message": truncateRunes(msg, 450), + "progress_offset": newOffset, + }) + } + + // panic 兜底:抓取解析的是外部 HTML,任何解析路径的意外 panic + // 都不能带崩整个 Agent 服务进程;恢复后把本次运行记为失败、游标原地不动 + defer func() { + if r := recover(); r != nil { + log.Printf("[Crawl] 任务 #%d panic 已恢复: %v", task.ID, r) + finish("failed", fmt.Sprintf("运行异常(panic 已恢复): %v", r), 0, 0, 0, 0, task.ProgressOffset) + } + }() + + // 1. 抓索引(全量 URL 列表,游标基于它切片) + urls, err := src.FetchIndex(ctx) + if err != nil { + log.Printf("[Crawl] 任务 #%d 索引抓取失败: %v", task.ID, err) + finish("failed", "索引抓取失败: "+err.Error(), 0, 0, 0, 0, task.ProgressOffset) + return + } + + // 2. 游标切片:offset 越界(源站条目变少)自动归零重来 + offset := task.ProgressOffset + if offset < 0 || offset >= len(urls) { + offset = 0 + } + end := offset + itemsPerRun + if end > len(urls) { + end = len(urls) + } + batch := urls[offset:end] + log.Printf("[Crawl] 任务 #%d 开始:总 %d 条,本批 [%d, %d)", task.ID, len(urls), offset, end) + + // 3. 逐条抓详情 + upsert + // + // attempted 记录"实际处理完的条数"——超时中断时游标只推进到断点, + // 而不是整批跳过(否则未抓的条目要等下一整轮才会补上) + var created, updated, failed, attempted int + var failMsgs []string + timedOut := false + for _, u := range batch { + med, err := src.FetchDetail(ctx, u) + if err != nil { + // 上下文超时/取消:当前条没有处理完,不计入 attempted, + // 游标停在这条之前,下次运行从断点续抓 + if ctx.Err() != nil { + timedOut = true + break + } + attempted++ + failed++ + if len(failMsgs) < 3 { + failMsgs = append(failMsgs, err.Error()) + } + continue + } + attempted++ + isNew, err := upsertMedicine(task.LibraryID, med) + if err != nil { + failed++ + if len(failMsgs) < 3 { + failMsgs = append(failMsgs, med.Name+": "+err.Error()) + } + continue + } + if isNew { + created++ + } else { + updated++ + } + } + fetched := created + updated + failed + + // 4. 新游标:只按实际处理量推进;一轮抓完归零(下轮转增量更新模式) + progressed := offset + attempted + newOffset := progressed + roundDone := newOffset >= len(urls) + if roundDone { + newOffset = 0 + } + + // 5. 刷新目标库统计(doc_count/chunk_count 冗余字段) + _ = dao.KBUpdateLibraryStats(task.LibraryID) + + // 6. 终态判定 + 摘要(超时中断视为异常:有产出算 partial,无产出算 failed) + status := "success" + if failed > 0 || timedOut { + if created+updated > 0 { + status = "partial" + } else { + status = "failed" + } + } + msg := fmt.Sprintf("本批 %d 条:新建 %d、更新 %d、失败 %d;进度 %d/%d", + fetched, created, updated, failed, progressed, len(urls)) + if timedOut { + msg += fmt.Sprintf("(运行超时中断,本批只完成 %d/%d,游标停在断点下次续抓)", attempted, len(batch)) + } + if roundDone { + msg += "(一轮抓取完成,游标归零转增量更新)" + } + if len(failMsgs) > 0 { + msg += ";失败示例: " + strings.Join(failMsgs, " | ") + } + log.Printf("[Crawl] 任务 #%d 完成:%s", task.ID, msg) + finish(status, msg, fetched, created, updated, failed, newOffset) +} + +// ---------------------------- 药材 → 知识库映射 ---------------------------- + +// coreSectionOrder 核心检索段落的优先顺序(组装 chunk 正文用) +// +// 为什么选这些:临床开方最关心的字段,且都在几百字内—— +// 性味归经/功效/临床应用/禁忌是处方校验的关键依据。 +// 「来源/生境分布」是源站老版条目的标签(对应新版的 药用部位/产地分布),两套都收 +var coreSectionOrder = []string{ + "性味归经", "功效与作用", "临床应用", "使用禁忌", + "药用部位", "来源", "产地分布", "生境分布", "采收加工", "药材性状", +} + +// upsertMedicine 把一味药材写入知识库(按药名判重:有则更新,无则新建) +// +// 返回 isNew:true=新建文档,false=更新已有文档 +func upsertMedicine(libraryID uint, med *crawler.Medicine) (bool, error) { + content, chunks := buildMedicineContent(med) + + // 文档元数据:别名/拼音/来源 URL(面板文档详情可见,便于溯源) + meta := dao.MarshalMeta(map[string]any{ + "aliases": med.Aliases, + "pinyin": med.Pinyin, + "source_url": med.SourceURL, + "crawled_at": time.Now().Format("2006-01-02 15:04:05"), + }) + + existing, err := dao.KBFindDocByTitle(libraryID, med.Name) + if err != nil { + return false, err + } + if existing != nil { + // 已存在:刷新文档正文 + 整体替换分段(幂等,重复抓取内容不膨胀) + if err := dao.KBUpdateDocContent(existing.ID, content, meta, "crawl"); err != nil { + return false, err + } + return false, dao.KBReplaceDocChunks(existing.ID, chunks) + } + + // 不存在:新建文档 + 分段 + doc := &dao.KBDocRow{ + LibraryID: libraryID, + Title: med.Name, + Content: content, + SourceFile: med.SourceURL, + SourceType: "crawl", + MetaJSON: meta, + } + return true, dao.KBInsertDocWithChunks(doc, chunks) +} + +// buildMedicineContent 组装文档正文与检索分段 +// +// 分段策略(检索质量优先): +// - 分段 1「核心卡」:药名+别名开头(别名参与 FULLTEXT,按别名搜也能命中) +// + 核心段落(性味归经/功效/临床应用/禁忌...),这是检索主力 +// - 分段 2「配伍药方」:方剂内容独立成段(可能很长,且检索意图不同) +// - 其余长段落(植物形态/药理研究/化学成分)只进文档原文,不进分段—— +// 它们对临床检索噪音大于价值,文档详情页仍可完整查看 +func buildMedicineContent(med *crawler.Medicine) (string, []*dao.KBChunkRow) { + // 头行:药名(别名:a、b、c;拼音:xx) + head := med.Name + var headExtra []string + if len(med.Aliases) > 0 { + headExtra = append(headExtra, "别名:"+strings.Join(med.Aliases, "、")) + } + if med.Pinyin != "" { + headExtra = append(headExtra, "拼音:"+med.Pinyin) + } + if len(headExtra) > 0 { + head += "(" + strings.Join(headExtra, ";") + ")" + } + + // 分段 1:核心卡(按 coreSectionOrder 顺序拼装) + var core strings.Builder + core.WriteString(head) + core.WriteString("\n") + for _, label := range coreSectionOrder { + if text := med.GetSection(label); text != "" { + core.WriteString("\n【" + label + "】" + text) + } + } + chunks := []*dao.KBChunkRow{{ + Title: med.Name, + Content: truncateRunes(core.String(), 1800), + MetaJSON: dao.MarshalMeta(map[string]any{ + "related_questions": med.Aliases, // 别名当关联问题,面板分段列表可见 + }), + }} + + // 分段 2:配伍药方(有才建) + if recipes := med.GetSection("配伍药方"); recipes != "" { + chunks = append(chunks, &dao.KBChunkRow{ + Title: med.Name + "·配伍药方", + Content: truncateRunes(med.Name+"的配伍药方:\n"+recipes, 1800), + }) + } + + // 文档原文:头行 + 全部段落按原始顺序(详情页完整可查) + var full strings.Builder + full.WriteString(head) + full.WriteString("\n") + for _, s := range med.Sections { + full.WriteString("\n【" + s.Label + "】" + s.Text + "\n") + } + full.WriteString("\n来源:" + med.SourceURL) + return full.String(), chunks +} + +// truncateRunes 按 rune 截断(不破坏中文字符边界) +func truncateRunes(s string, max int) string { + if utf8.RuneCountInString(s) <= max { + return s + } + runes := []rune(s) + return string(runes[:max]) + "…" +} diff --git a/internal/service/enhancer.go b/internal/service/enhancer.go new file mode 100644 index 0000000..2cc3443 --- /dev/null +++ b/internal/service/enhancer.go @@ -0,0 +1,948 @@ +package service + +import ( + "context" + "encoding/json" + "fmt" + "log" + "sort" + "strconv" + "strings" + "time" + + "tcm-agent/internal/agent" + "tcm-agent/internal/agentcfg" + "tcm-agent/internal/config" + "tcm-agent/internal/dao" + "tcm-agent/internal/kb" + "tcm-agent/internal/llm" + "tcm-agent/internal/tool" + "tcm-agent/internal/types" +) + +// ======================================================================== +// KnowledgeEnhancer —— 知识增强服务 +// ======================================================================== +// 这是 Go Agent 给 PHP 提供的"知识库增强 + 模型调用"一体化入口。 +// +// 业务定位: +// PHP 端依然负责"提示词拼装 + 业务编排",但有一类"固定查询"内容 +// (委托调剂规则、煎法、中医字典、ICD-10、药品库等)已经录到 MaxKB, +// Go Agent 接管这部分:从知识库检索 → 追加 system 消息 → 调 LLM → 回原文。 +// +// 数据流: +// PHP POST /api/v1/agent/enhance +// body: { scene, context, messages: [...], kb_enabled } +// ↓ +// [1] 如果 kb_enabled=true: +// - 用 context 关键词调 MaxKB.Search 取 TopK 文档 +// - 把检索结果作为 system 消息插到 messages 头部 +// [2] 按 scene 路由到对应 LLM 调用 Chat +// [3] 记录每一步的 token 用量、耗时(返回给 PHP,PHP 写 xk_ai_generation_step) +// [4] 返回 { content, steps: [...], provider, model } +// +// 设计原则: +// - 不接管提示词拼装:messages 直接来自 PHP,Go 只做"增强 + 调用" +// - 失败可降级:知识库检索失败不阻断,只用原始 messages 调 LLM +// - 可观测:每一步耗时/token 都记录,PHP 据此算成本 +// ======================================================================== + +// EnhancerService 知识增强服务 +type EnhancerService struct { + maxkb *tool.MaxKBClient // MaxKB 客户端(kb_enabled=false 或 source=local 时可为 nil) + localSearch *kb.Searcher // 本地知识库检索器(V1 默认走这条路径) + llmRouter *llm.ModelRouter // 模型路由(按 scene 取 LLM) + llmFallback *llm.FallbackChain + cfg *config.Config + toolRegistry map[string]types.Tool // ReactLoop 用:工具注册表(name → tool);非空时启用 Function Calling +} + +// resolveMeta resolveClient 的解析元信息(配置来源 + api_key_id) +// +// 为什么用返回值而不是存到 EnhancerService 字段: +// EnhancerService 是单例,/agent/enhance 限流器允许 16 并发—— +// 共享字段会被并发请求互相覆盖(run 记录的 cfg_source/api_key_id 串号 + data race), +// 用返回值让每个请求协程持有自己的一份,天然并发安全。 +type resolveMeta struct { + APIKeyID int // DB 解析到的 api_key_id(审计用,写入 EnhanceStep.APIKeyID) + CfgSource string // 配置来源:active / yaml_force / yaml_route / yaml_default +} + +// NewEnhancerService 构造函数 +// +// 参数: +// maxkb - MaxKB 客户端(kb 关闭或 source=local 时可传 nil) +// router - 模型路由器(必填) +// fallback - 降级链(可空) +// cfg - 全局配置 +func NewEnhancerService(maxkb *tool.MaxKBClient, router *llm.ModelRouter, fallback *llm.FallbackChain, cfg *config.Config) *EnhancerService { + return &EnhancerService{ + maxkb: maxkb, + llmRouter: router, + llmFallback: fallback, + cfg: cfg, + } +} + +// WithLocalSearcher 注入本地知识库检索器 +// +// 调用方:router.Setup 启动时根据 agentcfg.KB.EmbeddingProvider 构造 Searcher, +// 调用本方法注入。V1 默认走 NoopEmbedder(仅全文检索)。 +func (s *EnhancerService) WithLocalSearcher(searcher *kb.Searcher) *EnhancerService { + s.localSearch = searcher + return s +} + +// WithTools 注入工具注册表(让 ReactLoop 可触发 Function Calling) +// +// 调用方:main.go 启动时若 agent.Runner 已注册工具,把同一份 map 注入给 EnhancerService。 +// 不调用本方法时 toolRegistry 为 nil,ReactLoop 会以纯 chat 模式运行(无工具调用)。 +func (s *EnhancerService) WithTools(tools map[string]types.Tool) *EnhancerService { + s.toolRegistry = tools + return s +} + +// ======================================================================== +// 请求/响应结构(与 PHP TcmAgentClient 严格对齐) +// ======================================================================== + +// EnhanceRequest PHP 发来的增强请求 +type EnhanceRequest struct { + Scene string `json:"scene"` // 场景:medical_record / prescription + Context string `json:"context"` // 检索关键词(如"痰湿中阻 煎法") + Messages []types.Message `json:"messages"` // PHP 拼好的完整消息列表 + KBEnabled bool `json:"kb_enabled"` // 是否启用知识库检索 + TopK int `json:"top_k,omitempty"` // 检索条数(默认 5) + Provider string `json:"provider,omitempty"` // 强制用某 provider(空则走路由表) + AgentConfig *AgentConfigOpts `json:"agent_config,omitempty"` // 可选:PHP 透传覆盖 DB 中的 Agent 配置(不传则 Go 直读 DB) + // 生成参数(P0 修复:此前 PHP 按场景调的参数在 via-agent 路径被丢弃) + // 0 表示"未显式指定",走客户端默认(deepseek/spark 默认 0.3 / 4096) + Temperature float64 `json:"temperature,omitempty"` // 生成温度(0-2) + MaxTokens int `json:"max_tokens,omitempty"` // 单次响应 token 上限 +} + +// AgentConfigOpts 可选的 Agent 配置覆盖项(PHP 透传) +// +// 设计:默认情况下 Go Agent 直读 xk_system_config(agentcfg 包); +// 但 PHP 端如果已经有完整配置视图,可以通过本字段强制覆盖某些项。 +// 所有字段都是指针,nil 表示不覆盖、用 DB 配置。 +type AgentConfigOpts struct { + ReactEnabled *bool `json:"react_enabled,omitempty"` + ReactMaxIterations *int `json:"react_max_iterations,omitempty"` +} + +// EnhanceStep 一次增强调用的过程步骤(写入 xk_ai_generation_step) +type EnhanceStep struct { + StepType string `json:"step_type"` // kb_retrieval / llm_call + Provider string `json:"provider,omitempty"` // llm_call 才填 + Model string `json:"model,omitempty"` // llm_call 才填 + APIKeyID int `json:"api_key_id,omitempty"` + PromptTokens int `json:"prompt_tokens,omitempty"` + CompletionTokens int `json:"completion_tokens,omitempty"` + TotalTokens int `json:"total_tokens,omitempty"` + Usage map[string]any `json:"usage,omitempty"` + DurationMs int `json:"duration_ms"` + StartedAt int64 `json:"started_at"` // unix 秒 + FinishedAt int64 `json:"finished_at"` + Detail string `json:"detail,omitempty"` // 备注(如命中文档数 / 失败原因) + Status int `json:"status"` // 0进行中 1成功 2失败(与 xk_ai_generation.status 一致) + lastMessage *types.Message `json:"-"` // ReactLoop 内部用:缓存 LLM 返回的 Message(不入 JSON) +} + +// EnhanceResponse 返回给 PHP 的结果 +type EnhanceResponse struct { + Content string `json:"content"` // LLM 生成的文本 + Provider string `json:"provider"` // 实际使用的供应商 + Model string `json:"model"` // 实际使用的模型名 + Steps []EnhanceStep `json:"steps"` // 每一步过程(PHP 据此写 step 子表) + TotalMs int `json:"total_ms"` // 总耗时 + // cfgSource 本次请求的配置来源(内部字段,不返回 PHP): + // doEnhance 写入,Enhance 包装层读出来写 RunLog—— + // 用 resp 传递而不是 service 字段,保证并发请求间不串号 + cfgSource string `json:"-"` +} + +// ======================================================================== +// 核心方法 +// ======================================================================== + +// Enhance 执行一次知识增强 + 模型调用(对外入口) +// +// 这是一个包装层:真正的业务逻辑在 doEnhance,本层负责把每次运行 +// (成功/失败/守卫拦截)统一记入 RunLog 环形缓冲,供 /agent/view 面板观测。 +// 包装层方案的好处:doEnhance 内部有 5 个 return 出口,不用逐个插埋点代码。 +func (s *EnhancerService) Enhance(ctx context.Context, req *EnhanceRequest) (*EnhanceResponse, error) { + startedAt := time.Now() + resp, err := s.doEnhance(ctx, req) + // cfgSource 由 doEnhance 写入 resp(解析失败/守卫拦截时为空) + cfgSource := "" + if resp != nil { + cfgSource = resp.cfgSource + } + recordAgentRun(req, resp, err, startedAt, cfgSource) + return resp, err +} + +// doEnhance 知识增强主流程(内部实现) +func (s *EnhancerService) doEnhance(ctx context.Context, req *EnhanceRequest) (*EnhanceResponse, error) { + totalStart := time.Now() + resp := &EnhanceResponse{Steps: []EnhanceStep{}} + + if len(req.Messages) == 0 { + return nil, fmt.Errorf("messages 不能为空") + } + + // 复制一份 messages,避免污染入参(追加 KB 检索结果时使用) + messages := make([]types.Message, len(req.Messages)) + copy(messages, req.Messages) + + // ===== 步骤 0:医疗相关性前置守卫 ===== + // 在做任何 KB 检索 / LLM 调用之前先检查请求是否医疗相关: + // - PHP 端 prompt 组装出错(或接口被滥用)时,轻量模型会跑题输出通用内容 + // - 提前拦截可以省一次完整 ReactLoop 的 token 花费 + // 守卫默认开启,可通过 xk_system_config 的 ai_agent_medical_guard 关闭 + guardCfg := agentcfg.Get() + if guardCfg.MedicalGuard.Enabled { + guard := validateMedicalRelevance(messages) + if !guard.Passed { + log.Printf("[Enhancer] ⛔ 医疗守卫拦截 scene=%s 命中黑名单=%v 命中白名单=%v", + req.Scene, guard.HitBlacklist, guard.HitWhitelist) + guardStep := EnhanceStep{ + StepType: "medical_guard", + StartedAt: time.Now().Unix(), + FinishedAt: time.Now().Unix(), + Status: 2, + Detail: guard.Reason, + } + resp.Steps = append(resp.Steps, guardStep) + resp.TotalMs = int(time.Since(totalStart).Milliseconds()) + return resp, fmt.Errorf("医疗守卫拦截: %s", guard.Reason) + } + // 通过时打一行简短日志(白名单命中数),便于观察守卫是否在正常工作 + log.Printf("[Enhancer] 医疗守卫通过 scene=%s 白名单命中=%d", req.Scene, len(guard.HitWhitelist)) + } + + // ===== 步骤 1:知识库检索(可选) ===== + // 根据 agentcfg.KB.Source 分流到 MaxKB 或本地知识库; + // 处方场景额外检索金方库(参考方剂),与药材知识分块注入 + if req.KBEnabled && strings.TrimSpace(req.Context) != "" { + step, kbDocs, kbFormulas, kerr := s.performKBRetrieval(ctx, req) + if step != nil { + resp.Steps = append(resp.Steps, *step) + // 检索成功时把结果合并进首条 system 消息 + if kerr == nil && (len(kbDocs) > 0 || len(kbFormulas) > 0) { + messages = injectKBContext(messages, kbDocs, kbFormulas) + } + } + } + + // ===== 步骤 2:解析 LLM 客户端 ===== + client, provider, meta, err := s.resolveClient(req.Scene, req.Provider) + resp.cfgSource = meta.CfgSource + if err != nil { + errStep := EnhanceStep{ + StepType: "llm_call", + StartedAt: time.Now().Unix(), + FinishedAt: time.Now().Unix(), + DurationMs: 0, + Status: 2, + Detail: "解析 LLM 失败: " + err.Error(), + } + resp.Steps = append(resp.Steps, errStep) + resp.TotalMs = int(time.Since(totalStart).Milliseconds()) + return resp, fmt.Errorf("解析 LLM 失败: %w", err) + } + + // ===== 步骤 3:根据 AgentConfig 决定走 ReactLoop 还是单次 Chat ===== + agentCfg := agentcfg.Get() + // PHP 透传的覆盖项优先 + reactOn := agentCfg.ReAct.Enabled + maxIter := agentCfg.ReAct.MaxIterations + if req.AgentConfig != nil { + if req.AgentConfig.ReactEnabled != nil { + reactOn = *req.AgentConfig.ReactEnabled + } + if req.AgentConfig.ReactMaxIterations != nil { + maxIter = *req.AgentConfig.ReactMaxIterations + } + } + + if reactOn { + // ---- 路径 A:ReactLoop(多轮 + Planning + Reflection + JSON 修复)---- + reactReq := &ReactLoopRequest{ + Scene: req.Scene, + Messages: messages, + Client: client, + Provider: provider, + Temperature: req.Temperature, // PHP 场景化温度透传(0=用默认) + } + // 工具集:若 EnhancerService 注入了 toolRegistry,转换为 []types.Tool + if s.toolRegistry != nil { + tools := make([]types.Tool, 0, len(s.toolRegistry)) + for _, t := range s.toolRegistry { + tools = append(tools, t) + } + reactReq.Tools = tools + } + // 应用 PHP 透传的 maxIter 覆盖 + reactCfg := agentCfg.ReAct + if maxIter > 0 { + reactCfg.MaxIterations = maxIter + } + loopResult := s.runReactLoop(ctx, reactReq, reactCfg, agentCfg.TokenBudget) + + // 把 ReactLoop 的步骤合并进 resp.Steps + resp.Steps = append(resp.Steps, loopResult.Steps...) + resp.Content = loopResult.Content + resp.Provider = provider + resp.Model = client.Name() + resp.TotalMs = int(time.Since(totalStart).Milliseconds()) + + // 给 ReactLoop 的所有 step 补 api_key_id(来自 DB 解析,client 内部拿不到) + if meta.APIKeyID > 0 { + for i := range resp.Steps { + if resp.Steps[i].APIKeyID == 0 { + resp.Steps[i].APIKeyID = meta.APIKeyID + } + } + } + + logTag := "ReactLoop" + if loopResult.Aborted { + logTag = "ReactLoop(BudgetAborted)" + } + if raw, err := json.Marshal(resp.Steps); err == nil { + log.Printf("[Enhancer] %s scene=%s provider=%s source=%s total=%dms steps=%d budget=%s raw=%s", + logTag, req.Scene, provider, meta.CfgSource, resp.TotalMs, len(resp.Steps), + jsonSnapshot(loopResult.Budget), string(raw)) + } + return resp, nil + } + + // ---- 路径 B:单次 Chat(兼容原有行为,但补 token 统计 + max_tokens 透传)---- + llmStep := EnhanceStep{ + StepType: "llm_call", + StartedAt: time.Now().Unix(), + } + llmStart := time.Now() + + // 按 agentcfg 决定 max_tokens(开启预算管理时透传 MaxTokensPerCall) + opts := llm.ChatOpts{} + if agentCfg.TokenBudget.Enabled { + opts.MaxTokens = agentCfg.TokenBudget.MaxTokensPerCall + } + // PHP 显式传入的生成参数优先(P0:处方/病历按场景调温不再被忽略) + if req.Temperature > 0 { + opts.Temperature = req.Temperature + } + if req.MaxTokens > 0 { + // 与预算上限取小:业务可以要求更小的输出,但不能借此绕开 token 预算 + if opts.MaxTokens == 0 || req.MaxTokens < opts.MaxTokens { + opts.MaxTokens = req.MaxTokens + } + } + + msg, chatResult := s.callLLMWithMeta(ctx, client, messages, nil, opts) + llmStep.DurationMs = int(time.Since(llmStart).Milliseconds()) + llmStep.FinishedAt = time.Now().Unix() + llmStep.Provider = provider + llmStep.Model = client.Name() + + // ★ api_key_id 优先用 DB 解析出来的真实 id(resolveClient 透传) + // client 内部的 chatResult.APIKeyID 通常为 0(厂商 API 不会回传 key_id), + // 只有 Go 端从 DB 取的 key 才能拿到准确 id 用于审计 + if meta.APIKeyID > 0 { + llmStep.APIKeyID = meta.APIKeyID + } + if chatResult != nil { + llmStep.PromptTokens = chatResult.PromptTokens + llmStep.CompletionTokens = chatResult.CompletionTokens + llmStep.TotalTokens = chatResult.TotalTokens + llmStep.Usage = chatResult.Usage + // chatResult.APIKeyID 兜底(仅当 DB 没解析到时才有意义) + if llmStep.APIKeyID == 0 { + llmStep.APIKeyID = chatResult.APIKeyID + } + } + + if msg == nil { + // 主模型调用失败,尝试从 fallback 链里取下一个 provider 重试一次 + // + // 为什么不直接调 llmFallback.ChatWithFallback: + // 那个方法会按链从头开始尝试,主模型已经在上面调过失败, + // 这里只想跳过当前 provider 用下一个,避免重复打主模型 + if s.llmFallback != nil && provider != "" { + sceneKey := req.Scene + if sceneKey == "" { + sceneKey = "emr-generator" + } + chain, ok := s.llmFallback.GetChain(sceneKey) + if ok { + for _, nextProvider := range chain { + if nextProvider == provider { + continue // 跳过已经失败的当前 provider + } + fbClient, fbErr := s.llmRouter.GetByProvider(nextProvider) + if fbErr != nil { + log.Printf("[Enhancer] fallback 取 %s 失败: %v", nextProvider, fbErr) + continue + } + log.Printf("[Enhancer] 主模型 %s 调用失败,尝试 fallback %s", provider, nextProvider) + fbMsg, fbChatResult := s.callLLMWithMeta(ctx, fbClient, messages, nil, opts) + if fbMsg != nil { + // fallback 成功:用新结果替换上下文中的 client/provider/chatResult + client = fbClient + provider = nextProvider + msg = fbMsg + chatResult = fbChatResult + llmStep.Provider = provider + llmStep.Model = client.Name() + if fbChatResult != nil { + llmStep.PromptTokens = fbChatResult.PromptTokens + llmStep.CompletionTokens = fbChatResult.CompletionTokens + llmStep.TotalTokens = fbChatResult.TotalTokens + llmStep.Usage = fbChatResult.Usage + llmStep.APIKeyID = fbChatResult.APIKeyID + llmStep.Detail = "成功(fallback)" + } + break + } + log.Printf("[Enhancer] fallback %s 也失败,继续尝试下一个", nextProvider) + } + } + } + } + + if msg == nil { + llmStep.Status = 2 + llmStep.Detail = "LLM 调用失败" + resp.Steps = append(resp.Steps, llmStep) + resp.TotalMs = int(time.Since(totalStart).Milliseconds()) + return resp, fmt.Errorf("LLM 调用失败") + } + + llmStep.Status = 1 + if chatResult != nil && chatResult.FinishReason != "" { + llmStep.Detail = "成功 | finish_reason=" + chatResult.FinishReason + } else { + llmStep.Detail = "成功" + } + resp.Steps = append(resp.Steps, llmStep) + + resp.Content = msg.Content + resp.Provider = provider + resp.Model = client.Name() + resp.TotalMs = int(time.Since(totalStart).Milliseconds()) + + // 把 step 详情打成日志,便于运维排查 + if raw, err := json.Marshal(resp.Steps); err == nil { + log.Printf("[Enhancer] scene=%s provider=%s source=%s total=%dms steps=%s", + req.Scene, provider, meta.CfgSource, resp.TotalMs, string(raw)) + } + + return resp, nil +} + +// jsonSnapshot 把 BudgetSnapshot 序列化成短字符串(仅用于日志) +func jsonSnapshot(s agent.BudgetSnapshot) string { + b, _ := json.Marshal(s) + return string(b) +} + +// resolveClient 按场景 + 强制 provider 解析出 LLM 客户端 +// +// ★★★ 核心升级:DB 优先 + 即时生效 ★★★ +// +// 解析优先级: +// 1. req.Provider 非空 → 强制用此 provider(PHP 显式指定,覆盖一切) +// 但仍会从 DB 拉取该 provider 的最新 model/api_key(保证 key 轮换即时生效) +// 2. dao.LoadActiveLLMConfig 实时解析(带 60s 缓存): +// 读 xk_system_config 的 ai_active_provider / ai_active_api_key_id / ai_active_model, +// 按 PHP AiRuntimeConfigService::resolve() 同款规则合并到最终配置 +// 这样后台切完 provider/model 1 分钟内全集群生效,无需重启 Go 进程 +// 3. 若 DB 解析失败 → 回落到 yaml/env 配置(保证服务可用性) +// +// 返回值: +// - client:可用的 LLMClient(可能新建可能复用,由 ModelRouter.GetByConfig 决定) +// - provider:实际使用的 provider 名(用于审计/日志) +// - meta:解析元信息(api_key_id + 配置来源),调用方持有局部拷贝,并发安全 +func (s *EnhancerService) resolveClient(scene, forceProvider string) (llm.LLMClient, string, resolveMeta, error) { + if s.llmRouter == nil { + return nil, "", resolveMeta{}, fmt.Errorf("llmRouter 未初始化") + } + + // ===== 路径 1:DB 实时解析(带 60s 缓存) ===== + // + // 这是默认路径——后台运维改完模型配置后最长 60s 内全集群生效。 + // 失败时(如 DB 抖动)回落到老路径,保证服务可用。 + if dao.DB != nil { + // 决定"DB 兜底 provider":forceProvider > yaml DefaultProvider + fallback := forceProvider + if fallback == "" { + fallback = s.cfg.LLM.DefaultProvider + } + + resolved, err := dao.LoadActiveLLMConfig(fallback) + if err != nil { + // 仅打日志,继续走老路径(不要因 DB 抖动中断业务) + log.Printf("[Enhancer] ⚠️ DB 解析生效配置失败,回落 yaml 路由: %v", err) + } else { + // 如果 PHP 强制指定了 provider,但 DB 解析出的 provider 与之不同, + // 说明 PHP 显式覆盖——这种情况下以 PHP 指定为准, + // 但 model/api_key 仍用 DB 的(保证 key 轮换即时生效) + finalProvider := resolved.Provider + if forceProvider != "" && forceProvider != resolved.Provider { + log.Printf("[Enhancer] PHP 强制 provider=%s 覆盖 DB provider=%s", + forceProvider, resolved.Provider) + finalProvider = forceProvider + } + + // 组装完整 LLMConfigEx + cfg := &config.LLMConfigEx{ + Provider: finalProvider, + APIKey: resolved.APIKey, + BaseURL: resolved.APIURL, + Model: resolved.Model, + Timeout: s.getTimeoutForProvider(finalProvider), + } + + // 按配置创建/复用 client(指纹变化时自动重建) + client, cErr := s.llmRouter.GetByConfig(finalProvider, cfg) + if cErr != nil { + log.Printf("[Enhancer] ⚠️ 按 config 创建 %s 失败,回落 yaml 路由: %v", + finalProvider, cErr) + } else { + // api_key_id / source 通过 meta 返回,供 Enhance 主流程写 step 用 + return client, finalProvider, resolveMeta{APIKeyID: resolved.APIKeyID, CfgSource: resolved.Source}, nil + } + } + } + + // ===== 路径 2:DB 不可用时的兜底(保留原有 yaml 路由逻辑) ===== + // + // 仅在 DB 连接失败、LoadActiveLLMConfig 报错、GetByConfig 失败时进入。 + // 保证 LLM 调用链不因 DB 抖动完全中断。 + + // 1) PHP 强制指定 provider + if forceProvider != "" { + c, err := s.llmRouter.GetByProvider(forceProvider) + if err != nil { + return nil, "", resolveMeta{}, fmt.Errorf("强制 provider=%s 取模型失败: %w", forceProvider, err) + } + return c, forceProvider, resolveMeta{CfgSource: "yaml_force"}, nil + } + + // 2) 按 scene 路由(路由表里 scene 名约定如 "medical_record"/"prescription") + // + // 注意:ModelRouter.Get(scene) 在 scene 未注册时会**内部回落 defaultProvider** + // 并成功返回 client,但同行的 ResolveProvider(scene) 只查 routes[scene], + // 未注册时返回空串。如果不补这个空串判断,会让日志/响应里出现 provider=空。 + if scene != "" { + if c, err := s.llmRouter.Get(scene); err == nil { + p := s.llmRouter.ResolveProvider(scene) + if p == "" { + // scene 未注册但 Get 内部已回落 default,这里对齐 provider 字符串 + p = s.cfg.LLM.DefaultProvider + if p == "" { + p = "deepseek" + } + log.Printf("[Enhancer] scene=%s 未注册路由,已回落默认 provider=%s", scene, p) + } + return c, p, resolveMeta{CfgSource: "yaml_route"}, nil + } + } + + // 3) 默认 provider + defProvider := s.cfg.LLM.DefaultProvider + if defProvider == "" { + defProvider = "deepseek" + } + c, err := s.llmRouter.GetByProvider(defProvider) + if err != nil { + return nil, "", resolveMeta{}, fmt.Errorf("默认 provider=%s 取模型失败: %w", defProvider, err) + } + return c, defProvider, resolveMeta{CfgSource: "yaml_default"}, nil +} + +// getTimeoutForProvider 取指定 provider 的 HTTP 超时(秒) +// +// DB 表 xk_ai_platform 没有超时字段,从 yaml/env 配置中查对应 provider 的 timeout。 +// 如果 yaml 里没有该 provider,回落到 120 秒(与 config.go 默认值一致)。 +func (s *EnhancerService) getTimeoutForProvider(provider string) int { + if s.cfg == nil { + return 120 + } + if cfg, ok := s.cfg.LLM.Models[provider]; ok && cfg.Timeout > 0 { + return cfg.Timeout + } + return 120 +} + +// kbRetrievalLimits 注入长度预算(rune 计) +// +// 为什么要限:TopK*整段 chunk + 方剂可能过万字,直接塞 system 会稀释业务指令 +// 且逼近轻量模型上下文上限;预算按"药材知识为主、方剂为辅"分配 +const ( + kbDocMaxRunes = 500 // 单条药材知识注入上限 + kbDocsTotalRunes = 2600 // 药材知识总预算 + kbFormulaMaxRunes = 400 // 单条参考方剂注入上限 + kbFormulaTopK = 3 // 方剂检索条数(方剂是"参考骨架",2~3 个足够化裁) + kbMinScoreRatio = 0.15 // 相对分数阈值:低于最高分 15% 的命中视为弱相关噪声 +) + +// performKBRetrieval 执行知识库检索(按 agentcfg.KB.Source 分流) +// +// 返回值: +// - step:检索过程步骤(写入 EnhanceResponse.Steps,PHP 据此写子表) +// - docs:药材/文档知识块(多库归并 + 阈值过滤 + title 加权后格式化) +// - formulas:参考方剂块(仅处方场景,金方库 xk_golden_formula 动态检索) +// - err:检索失败原因(仅用于调用方决定是否阻断;step 内已经记录) +// +// 分流策略: +// 1. agentcfg.KB.Source == "local" → 走 LocalKB(V1 默认,多库归并) +// 2. agentcfg.KB.Source == "maxkb" → 走 MaxKB(需 maxkb 客户端可用) +// 3. 选定路径失败时不阻断主流程,调用方仍用原始 messages 调 LLM +// 4. 金方检索独立于 KB source(直查 z_xk 库),失败只降级不影响文档检索 +func (s *EnhancerService) performKBRetrieval(ctx context.Context, req *EnhanceRequest) (*EnhanceStep, []string, []string, error) { + kbCfg := agentcfg.GetKBConfig() + topK := req.TopK + if topK <= 0 { + topK = kbCfg.TopK + if topK <= 0 { + topK = 5 + } + } + + step := &EnhanceStep{ + StepType: "kb_retrieval", + StartedAt: time.Now().Unix(), + } + start := time.Now() + + // 别名归一扩展(P1):查询中的药材别名追加正名,提高召回 + // 例:主诉里写"淮山",扩展后能命中"山药"的性味/配伍语料 + query, aliasHits := kb.GetAliasIndex().ExpandQuery(req.Context) + detailParts := []string{} + if len(aliasHits) > 0 { + detailParts = append(detailParts, "别名扩展→"+strings.Join(aliasHits, "/")) + } + + var docs []string + var docsDetail string + var err error + source := kbCfg.Source + + switch source { + case "local": + docs, docsDetail, err = s.retrieveFromLocalMulti(ctx, query, topK, kbCfg.SearchMode) + case "maxkb": + docs, err = s.retrieveFromMaxKB(ctx, query, topK) + docsDetail = fmt.Sprintf("命中 %d 条", len(docs)) + default: + // 未知 source 回落到本地 + source = "local(fallback)" + docs, docsDetail, err = s.retrieveFromLocalMulti(ctx, query, topK, kbCfg.SearchMode) + } + + // 金方库检索(P1):处方场景第二检索源,动态读取平台维护的方剂 + // 与药材知识独立:金方失败不影响文档结果(只补一条 detail 说明) + var formulas []string + if req.Scene == "prescription" { + var ferr error + formulas, ferr = retrieveGoldenFormulas(query, kbFormulaTopK) + if ferr != nil { + log.Printf("[Enhancer] 金方检索失败(不阻断): %v", ferr) + detailParts = append(detailParts, "方剂检索失败:"+ferr.Error()) + } else if len(formulas) > 0 { + detailParts = append(detailParts, fmt.Sprintf("参考方剂 %d 条", len(formulas))) + } + } + + step.DurationMs = int(time.Since(start).Milliseconds()) + step.FinishedAt = time.Now().Unix() + + if err != nil { + step.Status = 2 + step.Detail = fmt.Sprintf("[%s] 检索失败: %s", source, err.Error()) + log.Printf("[Enhancer] [%s] 检索失败,降级用原始消息: %v", source, err) + // 文档检索失败但方剂命中时仍可注入方剂(调用方按 err==nil 判断,这里直接吞掉 + // 文档错误会丢失告警信息——保持原有"失败降级"语义,方剂一并放弃) + return step, nil, nil, err + } + + step.Status = 1 + detail := fmt.Sprintf("[%s] %s", source, docsDetail) + if len(detailParts) > 0 { + detail += "|" + strings.Join(detailParts, "|") + } + step.Detail = detail + return step, docs, formulas, nil +} + +// localKBHit 本地多库归并检索的中间结果(按 doc 去重、加权后排序用) +type localKBHit struct { + docID uint + title string + content string + score float64 + libName string +} + +// retrieveFromLocalMulti 本地知识库多库归并检索(P1 主路径) +// +// 与旧版(只查第一个库)的差异: +// 1. 遍历全部 status=1 的库分别检索,按分数归并 +// 2. title 命中加权:查询词包含文档标题(如药名/方名直接出现在证候上下文里) +// 的命中 ×1.3——标题级命中的相关性远高于正文碰撞 +// 3. 相对分数阈值:低于最高分 15% 的命中丢弃(过滤 ngram 2-gram 碰撞噪声) +// 4. 按 doc 去重:同一文档多个分段命中时只保留最高分那段,避免同一味药占满 TopK +// +// 返回:格式化好的知识块列表 + 命中摘要(step detail 用) +func (s *EnhancerService) retrieveFromLocalMulti(ctx context.Context, query string, topK int, mode string) ([]string, string, error) { + if s.localSearch == nil { + return nil, "", fmt.Errorf("本地知识库检索器未初始化") + } + libs, err := listActiveLibraries() + if err != nil { + return nil, "", err + } + if len(libs) == 0 { + return nil, "", fmt.Errorf("本地无可用知识库(请先在 /kb/view 导入文档)") + } + // 逐库检索(库数量少,串行足够;每库拿 topK 再全局归并) + all := make([]localKBHit, 0, topK*len(libs)) + libHitDesc := make([]string, 0, len(libs)) + for _, lib := range libs { + results, serr := s.localSearch.Search(ctx, kb.SearchOptions{ + LibraryID: lib.ID, + Query: query, + TopK: topK, + Mode: mode, + }) + if serr != nil { + // 单库失败不整体报错(可能只是某库空/索引缺失),记录后继续 + log.Printf("[Enhancer] 库[%s]检索失败(跳过): %v", lib.Name, serr) + continue + } + if len(results) > 0 { + libHitDesc = append(libHitDesc, fmt.Sprintf("%s:%d", lib.Name, len(results))) + } + for _, r := range results { + score := r.Score + title := strings.TrimSpace(r.Title) + // title 加权:查询上下文直接点名该文档(药名/方名)→ 相关性强提升 + if title != "" && strings.Contains(query, title) { + score *= 1.3 + } + all = append(all, localKBHit{ + docID: r.DocID, + title: title, + content: strings.TrimSpace(r.Content), + score: score, + libName: lib.Name, + }) + } + } + if len(all) == 0 { + return []string{}, "命中 0 条", nil + } + // 按 doc 去重:保留每个文档的最高分分段 + bestByDoc := make(map[uint]localKBHit, len(all)) + for _, h := range all { + if cur, ok := bestByDoc[h.docID]; !ok || h.score > cur.score { + bestByDoc[h.docID] = h + } + } + merged := make([]localKBHit, 0, len(bestByDoc)) + for _, h := range bestByDoc { + merged = append(merged, h) + } + sort.Slice(merged, func(i, j int) bool { return merged[i].score > merged[j].score }) + // 相对分数阈值:过滤远低于最高分的弱相关噪声 + minScore := merged[0].score * kbMinScoreRatio + filtered := merged[:0] + for _, h := range merged { + if h.score >= minScore { + filtered = append(filtered, h) + } + } + if len(filtered) > topK { + filtered = filtered[:topK] + } + // 格式化 + 总长度预算控制 + out := make([]string, 0, len(filtered)) + usedRunes := 0 + for _, h := range filtered { + content := truncateRunesStr(h.content, kbDocMaxRunes) + var block string + if h.title == "" { + block = content + } else { + // 带来源标题与库名:LLM 引用时可指明出处,排障时可定位语料 + block = fmt.Sprintf("【%s|来源:%s】\n%s", h.title, h.libName, content) + } + blockRunes := len([]rune(block)) + if usedRunes+blockRunes > kbDocsTotalRunes && len(out) > 0 { + break // 预算用尽:保留已有条目(至少注入 1 条) + } + usedRunes += blockRunes + out = append(out, block) + } + desc := fmt.Sprintf("命中 %d 条(%s)", len(out), strings.Join(libHitDesc, ", ")) + return out, desc, nil +} + +// retrieveGoldenFormulas 金方库检索(处方场景专用) +// +// 两段式与 KB 检索一致:BOOLEAN 精确 → 零命中回退 NATURAL LANGUAGE。 +// 输出格式固定三行:方名 / 组成(解析 drugs_json)/ 主治(优先译文), +// 提示词侧告知 LLM"可在参考方基础上化裁",不强制照搬 +func retrieveGoldenFormulas(query string, topK int) ([]string, error) { + hits, err := dao.GoldenFormulaSearch(query, topK, false) + if (err != nil || len(hits) == 0) && len([]rune(query)) >= 3 { + hits, err = dao.GoldenFormulaSearch(query, topK, true) + } + if err != nil { + return nil, err + } + out := make([]string, 0, len(hits)) + for _, h := range hits { + drugs := formatFormulaDrugs(h.DrugsJSON) + if drugs == "" { + // drugs_json 解析不出组成时回退药材速览(herb_overview 是人读格式) + drugs = strings.TrimSpace(h.HerbOverview) + } + indication := strings.TrimSpace(h.IndicationTranslation) + if indication == "" { + indication = strings.TrimSpace(h.IndicationOriginal) + } + block := fmt.Sprintf("〔%s〕组成:%s。主治:%s", h.Name, drugs, indication) + out = append(out, truncateRunesStr(block, kbFormulaMaxRunes)) + } + return out, nil +} + +// formatFormulaDrugs 把金方 drugs_json 解析成"桂枝46.9g、芍药46.9g"形式 +// +// drugs_json 元素结构(金方后台维护):{name, dose(克数), unit, usage, prep, ancient_dose} +// 解析失败返回空串,调用方回退 herb_overview +func formatFormulaDrugs(raw *string) string { + if raw == nil || *raw == "" { + return "" + } + var items []struct { + Name string `json:"name"` + Dose float64 `json:"dose"` + Unit string `json:"unit"` + Usage string `json:"usage"` + } + if err := json.Unmarshal([]byte(*raw), &items); err != nil { + return "" + } + parts := make([]string, 0, len(items)) + for _, it := range items { + name := strings.TrimSpace(it.Name) + if name == "" { + continue + } + p := name + if it.Dose > 0 { + unit := it.Unit + if unit == "" { + unit = "g" + } + // 去掉多余小数(46.88 → 46.88,36 → 36) + p += strconv.FormatFloat(it.Dose, 'f', -1, 64) + unit + } + if it.Usage != "" { + p += "(" + it.Usage + ")" + } + parts = append(parts, p) + } + return strings.Join(parts, "、") +} + +// truncateRunesStr 按 rune 截断(不破坏 UTF-8 边界),超长加省略号 +func truncateRunesStr(s string, max int) string { + runes := []rune(s) + if max <= 0 || len(runes) <= max { + return s + } + return string(runes[:max]) + "…" +} + +// retrieveFromMaxKB 从 MaxKB 检索(兼容旧路径,需要 MaxKB Pro) +func (s *EnhancerService) retrieveFromMaxKB(ctx context.Context, query string, topK int) ([]string, error) { + if s.maxkb == nil { + return nil, fmt.Errorf("MaxKB 客户端未初始化") + } + return s.maxkb.Search(ctx, query, topK) +} + +// listActiveLibraries 取所有启用的本地知识库(按 id 升序) +// +// 单独抽出来避免在 retrieveFromLocal 里直接 import dao(service 包不直接依赖 dao) +// 但这里仍要调 dao.KBListLibraries —— service 包对 dao 的依赖在 enhancer 之外已有先例 +// (agentcfg 也依赖 dao),保持一致 +func listActiveLibraries() ([]libraryView, error) { + rows, err := listActiveLibrariesFromDAO() + if err != nil { + return nil, err + } + out := make([]libraryView, 0, len(rows)) + for _, r := range rows { + out = append(out, libraryView{ID: r.ID, Name: r.Name}) + } + return out, nil +} +// +// 插入位置策略: +// - 若 messages[0] 是 system → 在其后插入(保持业务 system 优先级最高) +// - 若不是 → 在最前面插入 +// +// 这样设计的理由:业务 system prompt 是"医生角色/输出格式"等核心指令, +// 不能被 KB 内容稀释;KB 内容是"参考资料",定位次于业务 system。 +func injectKBContext(messages []types.Message, docs []string, formulas []string) []types.Message { + if len(docs) == 0 && len(formulas) == 0 { + return messages + } + + // 分块注入:药材/文档知识块 + 参考方剂块(P1) + // 方剂块单独成段并明确"可化裁"——避免 LLM 把参考方当唯一答案照抄剂量 + var sb strings.Builder + if len(docs) > 0 { + sb.WriteString("以下是知识库检索到的参考资料,请在生成时参考:\n\n") + for i, d := range docs { + sb.WriteString(fmt.Sprintf("【参考 %d】\n%s\n\n", i+1, strings.TrimSpace(d))) + } + } + if len(formulas) > 0 { + sb.WriteString("以下是金方库检索到的参考方剂(与患者证候相关的经典方)。") + sb.WriteString("可在参考方基础上按患者实际辨证化裁加减,不必照搬原方与剂量;") + sb.WriteString("若证不对应则不要用:\n\n") + for i, f := range formulas { + sb.WriteString(fmt.Sprintf("【参考方剂 %d】%s\n\n", i+1, strings.TrimSpace(f))) + } + } + sb.WriteString("(参考资料结束,请基于以上资料和你的医学知识完成后续任务)") + kbText := sb.String() + + // ★ 注入方式必须是"合并进首条 system"而不是"追加第二条 system": + // 讯飞 Spark 等厂商强制 system 只能作为第一条消息,出现第二条 system + // 会直接报 HTTP 500 NotFirstSystemError(code=10049)(P0 打通 context 后实测踩坑)。 + // 合并进首条对 deepseek/openai 也完全兼容,行为一致性最好 + out := make([]types.Message, len(messages)) + copy(out, messages) + if len(out) > 0 && out[0].Role == "system" { + // 业务 system 指令在前,KB 参考资料附在其后(保持业务指令优先级最高) + out[0].Content = out[0].Content + "\n\n" + kbText + return out + } + // 没有业务 system 时,KB 参考作为唯一 system 放最前 + kbMsg := types.Message{ + Role: "system", + Content: kbText, + Timestamp: time.Now().Unix(), + } + return append([]types.Message{kbMsg}, out...) +} diff --git a/internal/service/kb_health.go b/internal/service/kb_health.go new file mode 100644 index 0000000..7ea0b64 --- /dev/null +++ b/internal/service/kb_health.go @@ -0,0 +1,9 @@ +package service + +import "tcm-agent/internal/dao" + +// KBHealthCheck KB DB 健康检查 +// 用于 router 暴露 /kb/health 端点,便于运维排查 +func KBHealthCheck() ([]dao.KBLibraryRow, error) { + return dao.KBListLibraries(true) +} diff --git a/internal/service/kb_helper.go b/internal/service/kb_helper.go new file mode 100644 index 0000000..dafee0b --- /dev/null +++ b/internal/service/kb_helper.go @@ -0,0 +1,32 @@ +package service + +import ( + "tcm-agent/internal/dao" +) + +// ======================================================================== +// 本地知识库辅助(service 包对 dao 的薄封装) +// ======================================================================== +// 把 dao.KBListLibraries 这种 DB 操作抽出来,主要原因: +// - EnhancerService 业务方法不直接 import dao(service 只依赖 agentcfg / kb) +// - 单独文件承载,便于以后 service 改成不依赖 dao 时统一替换 +// ======================================================================== + +// libraryView 库的轻量视图(只取检索需要的字段) +type libraryView struct { + ID uint + Name string +} + +// listActiveLibrariesFromDAO 从 dao 取所有启用的本地知识库 +func listActiveLibrariesFromDAO() ([]libraryView, error) { + rows, err := dao.KBListLibraries(false) // includeDisabled=false + if err != nil { + return nil, err + } + out := make([]libraryView, 0, len(rows)) + for _, r := range rows { + out = append(out, libraryView{ID: r.ID, Name: r.Name}) + } + return out, nil +} diff --git a/internal/service/medical_guard.go b/internal/service/medical_guard.go new file mode 100644 index 0000000..eacec45 --- /dev/null +++ b/internal/service/medical_guard.go @@ -0,0 +1,184 @@ +package service + +// ======================================================================== +// MedicalGuard —— 医疗相关性前置守卫 +// ======================================================================== +// 本模块用于在 Enhance 入口处拦截「非医疗业务」的请求, +// 避免外部误调用(或 prompt 被污染后)把 Agent 当成通用 ChatGPT 使用。 +// +// 为什么需要: +// 1. spark-lite 这类轻量模型对长 prompt 的角色定位能力较弱, +// 如果 user 内容不是医疗场景,模型会泛泛地套用"项目管理/通用模板"输出。 +// 2. Go Agent 对外暴露的是 :18123 端口,理论上任何能访问该端口的进程都能调用, +// 加一道语义守卫可以防止被滥用(哪怕有 Authorization)。 +// 3. 业务侧(PHP)已经按"病历/处方"场景组装 messages, +// 如果 Go 端发现内容明显不是医疗(比如 user 里全是"项目计划/代码生成"), +// 可以提前拒绝,节省一次 LLM 调用费用。 +// +// 实现策略: +// - 白名单关键词命中 → 视为医疗场景,放行 +// - 黑名单关键词命中 → 视为明显跑题,拒绝 +// - 都没命中 → 保守放行(避免误杀罕见医学名词) +// +// 调用方:EnhancerService.Enhance 在解析 LLM 客户端之前调用本守卫 +// ======================================================================== + +import ( + "fmt" + "strings" + + "tcm-agent/internal/types" +) + +// medicalGuardConfig 守卫配置(关键词表) +// +// 关键词来源: +// - 白名单:中医典籍 / 中药名 / 西医症状 / 科室 / 检查项目 / 处方用语 +// - 黑名单:明显与医疗无关的领域(软件开发/企业管理/考试作弊等) +// +// 维护策略: +// - 用小写匹配,避免大小写敏感 +// - 关键词尽量短(2-4 字),保证召回率 +// - 添加新关键词时同步更新注释,方便后续维护 +type medicalGuardConfig struct { + // whitelist 医疗领域关键词(命中任一即视为医疗场景) + whitelist []string + + // blacklist 明显非医疗的关键词(命中任一即视为跑题) + blacklist []string + + // minWhitelistHits 白名单最少命中数(低于此值视为可疑) + // 设为 1 表示只要命中一个医疗词就放行(保守策略,避免误杀) + minWhitelistHits int +} + +// defaultMedicalGuardConfig 默认守卫配置 +// +// 白名单分若干类别维护,注释中标明类别,方便后续按类别增删 +// +// 【关键词长度原则】所有关键词至少 2 个汉字、或含中文的混合词、或 ≥4 字母的英文词: +// - 匹配用的是 strings.Contains 子串匹配,过短的词会误命中 +// - 反面案例(已修正):白名单 "ct" 会命中 "project",单字 "男"/"女" 命中几乎所有中文; +// 黑名单 "api" 会命中 "rapid"/"therapist" 等正常英文医学词 +var defaultMedicalGuardConfig = medicalGuardConfig{ + whitelist: []string{ + // —— 中医核心术语 —— + "中医", "中药", "方剂", "辨证", "论治", "经方", "证候", "脉象", "舌苔", + "君臣佐使", "十八反", "十九畏", "配伍", "饮片", "汤剂", "丸散膏丹", + "伤寒论", "金匮要略", "温病条辨", "本草纲目", "神农本草经", + // —— 常见中药名(覆盖度优先)—— + "桂枝", "白芍", "甘草", "生姜", "大枣", "黄芪", "当归", "党参", + "茯苓", "白术", "川芎", "丹参", "陈皮", "半夏", "黄连", "黄芩", + "柴胡", "防风", "荆芥", "薄荷", "连翘", "金银花", "板蓝根", + // —— 西医症状与常见病 —— + "主诉", "现病史", "既往史", "过敏史", "体征", "诊断", "治疗", + "血压", "血糖", "心率", "体温", "头痛", "发热", "咳嗽", "腹痛", + "糖尿病", "高血压", "冠心病", "胃炎", "肝炎", "肺炎", "骨折", + // —— 检查与科室 —— + "血常规", "尿常规", "ct检查", "ct平扫", "b超", "心电图", "x光", "核磁", + "内科", "外科", "妇科", "儿科", "骨科", "皮肤科", "急诊", + // —— 处方与药品 —— + "处方", "开方", "医嘱", "用法用量", "口服", "静脉", "肌注", + "剂量", "剂数", "疗程", "联合用药", "禁忌", + "阿莫西林", "布洛芬", "青霉素", "头孢", + // —— 人口学与就诊用语 —— + "患者", "病人", "就诊", "复诊", "门诊", "住院", "病历", + "年龄", "性别", "体重", "身高", + }, + blacklist: []string{ + // —— 软件开发 / IT —— + "代码", "编程", "接口开发", "api文档", "接口文档", "数据库设计", "sql优化", + "前端开发", "后端开发", "vue组件", "react组件", "golang", "python", + // —— 企业管理 / 通用办公 —— + "项目管理", "项目计划", "需求分析", "里程碑", "甘特图", + "团队会议", "绩效考核", "kpi", "okr", "流程优化", + "市场营销", "品牌策划", "销售方案", "商业模式", + // —— 学术无关 / 违规 —— + "考试作弊", "论文代写", "黑客", "攻击教程", + }, + minWhitelistHits: 1, +} + +// MedicalGuardResult 守卫检查结果 +type MedicalGuardResult struct { + Passed bool // 是否通过(true=放行,false=拒绝) + Reason string // 拒绝原因(拒绝时填) + HitWhitelist []string // 命中的白名单关键词(用于日志/调试) + HitBlacklist []string // 命中的黑名单关键词(用于日志/调试) +} + +// validateMedicalRelevance 检查 messages 是否医疗相关 +// +// 入参: +// - messages: PHP 透传的完整消息列表(system + user + ...) +// +// 返回: +// - MedicalGuardResult: 检查结果(passed=true 可放行) +// +// 检查逻辑: +// 1. 把所有 message 内容拼成一个长字符串(小写化) +// 2. 白名单关键词命中 ≥ minWhitelistHits → 放行 +// 3. 黑名单关键词命中 > 0 且白名单未命中 → 拒绝 +// 4. 都没命中 → 保守放行(避免误杀罕见医学名词) +func validateMedicalRelevance(messages []types.Message) MedicalGuardResult { + cfg := defaultMedicalGuardConfig + + // 拼接所有消息内容(小写),方便做包含匹配 + // 同时拼接 role,避免某些情况下用户用 user 帧塞了"软件代码"但 system 伪装成医疗 + var sb strings.Builder + for _, m := range messages { + sb.WriteString(strings.ToLower(m.Content)) + sb.WriteString(" ") + } + allText := sb.String() + + // 黑名单先检查(优先级高,一旦命中直接标记可疑) + var hitBlack []string + for _, kw := range cfg.blacklist { + if strings.Contains(allText, kw) { + hitBlack = append(hitBlack, kw) + } + } + + // 白名单检查 + var hitWhite []string + for _, kw := range cfg.whitelist { + if strings.Contains(allText, kw) { + hitWhite = append(hitWhite, kw) + } + } + + // 决策: + // - 白名单命中 ≥ 阈值 → 放行(即使有黑名单命中,因为业务 prompt 可能举例对比) + // - 白名单命中 < 阈值 且 黑名单命中 > 0 → 拒绝(明显跑题) + // - 都没命中 → 放行(保守,避免误杀) + if len(hitWhite) >= cfg.minWhitelistHits { + return MedicalGuardResult{ + Passed: true, + HitWhitelist: hitWhite, + HitBlacklist: hitBlack, + } + } + + if len(hitBlack) > 0 { + return MedicalGuardResult{ + Passed: false, + Reason: fmt.Sprintf( + "请求内容未命中任何医疗关键词,且命中 %d 个非医疗关键词(如「%s」),"+ + "判定为非医疗场景,已被前置守卫拦截。"+ + "Go Agent 仅服务于中医病历/处方/医学辅助场景,请检查 PHP 端 prompt 组装是否出错。", + len(hitBlack), + strings.Join(hitBlack[:min(len(hitBlack), 3)], "、"), + ), + HitWhitelist: hitWhite, + HitBlacklist: hitBlack, + } + } + + // 都没命中:保守放行(可能是罕见医学名词) + return MedicalGuardResult{ + Passed: true, + HitWhitelist: hitWhite, + HitBlacklist: hitBlack, + } +} diff --git a/internal/service/memlog.go b/internal/service/memlog.go new file mode 100644 index 0000000..e16e8a2 --- /dev/null +++ b/internal/service/memlog.go @@ -0,0 +1,96 @@ +package service + +// ======================================================================== +// MemLog —— 内存日志环形缓冲(/agent/view 面板「实时日志」Tab 数据源) +// ======================================================================== +// 设计: +// - main.go 启动时 log.SetOutput(io.MultiWriter(os.Stdout, service.MemLog)) +// 控制台/systemd 日志完全不受影响,只是多复制一份到内存 +// - 环形缓冲 500 行,每行带自增 ID + 时间戳,面板用 since_id 增量拉取 +// (轮询只传新增行,不用每次全量传 500 行) +// - 为什么不用文件尾随(tail -f 方案):容器/Windows 部署时日志文件路径 +// 不确定,而 log 包的输出流是唯一稳定的挂接点 +// +// 安全提示:debug 开关(ai_agent_debug_log)打开时日志含请求体(PHI), +// 因此 /agent/logs 接口必须走全局 Auth,绝不放行 +// ======================================================================== + +import ( + "strings" + "sync" + "time" +) + +// MemLogEntry 一行日志 +type MemLogEntry struct { + ID int64 `json:"id"` // 自增 ID(增量拉取的游标) + Time int64 `json:"time"` // 写入时间(unix 秒) + Line string `json:"line"` // 日志原文(含 log 包自带的日期前缀) +} + +// MemLogWriter 实现 io.Writer,把日志行写入环形缓冲 +// +// 并发说明:log 包对每次 Print 调用内部加锁后才调 Write, +// 但我们仍自己加锁——因为 List 的读取和 Write 是并发的 +type MemLogWriter struct { + mu sync.RWMutex + items []MemLogEntry // 定长环形数组 + size int // 容量 + count int // 已写入条数(<= size) + head int // 下一个写入位置 + nextID int64 // 自增 ID +} + +// MemLog 全局单例:保留最近 500 行日志 +var MemLog = &MemLogWriter{ + items: make([]MemLogEntry, 500), + size: 500, +} + +// Write 实现 io.Writer +// +// log 包每次调用传入完整的一条日志(含结尾 \n), +// 但保险起见仍按 \n 拆分(防止某些直接写 writer 的多行输出粘连) +func (w *MemLogWriter) Write(p []byte) (int, error) { + now := time.Now().Unix() + w.mu.Lock() + for _, line := range strings.Split(strings.TrimRight(string(p), "\n"), "\n") { + if line == "" { + continue + } + w.nextID++ + w.items[w.head] = MemLogEntry{ID: w.nextID, Time: now, Line: line} + w.head = (w.head + 1) % w.size + if w.count < w.size { + w.count++ + } + } + w.mu.Unlock() + return len(p), nil +} + +// List 增量拉取日志 +// +// 参数: +// - sinceID:只返回 ID > sinceID 的行(0 表示从最旧开始全量拉) +// - limit :返回条数上限(<=0 时取 200) +// +// 返回按 ID 升序(时间正序),面板直接 append 到滚动区尾部 +func (w *MemLogWriter) List(sinceID int64, limit int) []MemLogEntry { + if limit <= 0 { + limit = 200 + } + w.mu.RLock() + defer w.mu.RUnlock() + + out := make([]MemLogEntry, 0, min(limit, w.count)) + // 从最旧的一条开始正序遍历(head 指向"下一个写入位",最旧 = head-count) + start := (w.head - w.count + w.size*2) % w.size + for i := 0; i < w.count && len(out) < limit; i++ { + idx := (start + i) % w.size + if w.items[idx].ID > sinceID { + out = append(out, w.items[idx]) + } + } + return out +} diff --git a/internal/service/observe.go b/internal/service/observe.go new file mode 100644 index 0000000..3dbf85c --- /dev/null +++ b/internal/service/observe.go @@ -0,0 +1,181 @@ +package service + +// ======================================================================== +// Observe —— 观测与调试支持(/agent/view 面板「调试工具」「系统状态」数据源) +// ======================================================================== +// 本文件集中放面板用的只读/无副作用能力: +// - GuardTest :医疗守卫测试台(贴文本看命中词) +// - MedicalGuardKeywords:守卫白/黑名单只读导出(配置总览 Tab 展示) +// - KBTest :知识库检索测试(走 enhance 同款检索路径) +// - ModelTest :模型连通性测试(发一条小消息,max_tokens 64) +// - 并发探针 :router 注册回调,暴露 enhance 当前并发/上限 +// +// 设计原则:全部只读或无持久副作用(ModelTest 会真实调一次 LLM, +// 消耗极少量 token,这是「连通性测试」的业务语义,可接受) +// ======================================================================== + +import ( + "context" + "time" + + "tcm-agent/internal/llm" + "tcm-agent/internal/types" +) + +// ------------------------------------------------------------------ +// 医疗守卫测试 +// ------------------------------------------------------------------ + +// GuardTest 用给定文本跑一次医疗守卫(与 Enhance 入口同款逻辑) +// +// 用途:面板「守卫测试台」——运维贴一段 prompt 就能看到会命中哪些词、 +// 是否会被拦截,用于调守卫词表或排查「为什么这个请求被拦了」 +func GuardTest(text string) MedicalGuardResult { + return validateMedicalRelevance([]types.Message{{Role: "user", Content: text}}) +} + +// MedicalGuardKeywords 导出守卫白/黑名单(只读拷贝) +// +// 面板「配置总览」Tab 展示当前词表;返回拷贝防止调用方改动内部切片 +func MedicalGuardKeywords() (whitelist []string, blacklist []string) { + w := make([]string, len(defaultMedicalGuardConfig.whitelist)) + copy(w, defaultMedicalGuardConfig.whitelist) + b := make([]string, len(defaultMedicalGuardConfig.blacklist)) + copy(b, defaultMedicalGuardConfig.blacklist) + return w, b +} + +// ------------------------------------------------------------------ +// 知识库检索测试 +// ------------------------------------------------------------------ + +// KBTestResult 知识库测试返回 +type KBTestResult struct { + Source string `json:"source"` // 实际走的检索源(local/maxkb) + DurationMs int `json:"duration_ms"` // 检索耗时 + Docs []string `json:"docs"` // 命中的文档片段(【标题】+内容 格式) + Error string `json:"error,omitempty"` +} + +// KBTest 用给定 query 跑一次知识库检索(与 enhance 主流程完全同款路径) +// +// 为什么复用 performKBRetrieval 而不是直接调 searcher: +// 面板测试的意义是回答「Agent 实际会检索到什么」, +// 必须连 ai_kb_source 分流、默认库选择、TopK 兜底这些逻辑一起走 +func (s *EnhancerService) KBTest(ctx context.Context, query string, topK int) KBTestResult { + step, docs, formulas, err := s.performKBRetrieval(ctx, &EnhanceRequest{ + Context: query, + TopK: topK, + }) + // 测试台把方剂块也并入 docs 展示(测试请求 scene 为空时 formulas 恒为空, + // 若以后测试台支持选 scene=prescription 也能直接看到方剂命中) + res := KBTestResult{ + DurationMs: step.DurationMs, + Docs: append(docs, formulas...), + } + // step.Detail 形如 "[local] 命中 3 条相关文档",把 source 提出来单独给前端 + res.Source = step.Detail + if err != nil { + res.Error = err.Error() + } + return res +} + +// ------------------------------------------------------------------ +// 模型连通性测试 +// ------------------------------------------------------------------ + +// ModelTestResult 模型测试返回 +type ModelTestResult struct { + OK bool `json:"ok"` // 是否连通 + Provider string `json:"provider"` // 实际使用的 provider + Model string `json:"model"` // 实际使用的模型名 + CfgSource string `json:"cfg_source"` // 配置来源(active/yaml_default 等) + APIKeyID int `json:"api_key_id"` // 使用的 API Key ID + DurationMs int `json:"duration_ms"` // 调用耗时 + Reply string `json:"reply"` // 模型回复片段(截断 200 字符) + Error string `json:"error,omitempty"` +} + +// ModelTest 发一条小消息测试模型连通性 +// +// 参数: +// - provider:留空 = 测当前生效配置;指定则强制走该 provider +// - message :测试消息,留空用默认的"请回复:连接正常" +// +// 走 resolveClient 同款解析逻辑(DB 优先),所以测的就是线上真实链路; +// max_tokens 压到 64,单次测试成本可忽略 +func (s *EnhancerService) ModelTest(ctx context.Context, provider, message string) ModelTestResult { + if message == "" { + message = "这是一次连通性测试,请只回复四个字:连接正常" + } + + client, actualProvider, meta, err := s.resolveClient("", provider) + if err != nil { + return ModelTestResult{OK: false, Provider: provider, Error: "解析模型配置失败: " + err.Error()} + } + + res := ModelTestResult{ + Provider: actualProvider, + Model: client.Name(), + CfgSource: meta.CfgSource, + APIKeyID: meta.APIKeyID, + } + + messages := []types.Message{ + {Role: "user", Content: message}, + } + opts := llm.ChatOpts{MaxTokens: 64} + + start := time.Now() + var msg *types.Message + if optClient, ok := client.(llm.OptAwareClient); ok { + msg, err = optClient.ChatWithOpts(ctx, messages, nil, opts) + } else { + msg, err = client.Chat(ctx, messages, nil) + } + res.DurationMs = int(time.Since(start).Milliseconds()) + + if err != nil { + res.Error = err.Error() + return res + } + if msg == nil { + res.Error = "模型返回空" + return res + } + res.OK = true + res.Reply = truncateForLog(msg.Content, 200) + return res +} + +// ------------------------------------------------------------------ +// enhance 并发探针 +// ------------------------------------------------------------------ + +// concurrencyProbe 由 router 启动时注册的回调,返回 (当前并发数, 并发上限) +// +// 为什么用回调而不是把信号量挪进 service 包: +// 信号量的生命周期属于路由层(限流是 HTTP 层职责), +// service 只是观测方;回调注入避免 router ↔ service 反向依赖 +var concurrencyProbe func() (used, capacity int) + +// SetConcurrencyProbe 注册并发探针(router.Setup 启动时调用一次) +func SetConcurrencyProbe(f func() (used, capacity int)) { + concurrencyProbe = f +} + +// GetConcurrency 读取当前 enhance 并发状态(未注册时返回 0,0) +func GetConcurrency() (used, capacity int) { + if concurrencyProbe == nil { + return 0, 0 + } + return concurrencyProbe() +} + +// RunLogUsage RunLog 缓冲占用(系统状态 Tab 用) +func RunLogUsage() (used, capacity int) { + runLog.mu.RLock() + defer runLog.mu.RUnlock() + return runLog.count, runLog.size +} diff --git a/internal/service/reactloop.go b/internal/service/reactloop.go new file mode 100644 index 0000000..bad34b3 --- /dev/null +++ b/internal/service/reactloop.go @@ -0,0 +1,779 @@ +package service + +// ======================================================================== +// ReactLoop —— 完整 ReAct 循环(Planning + Reflection + JSON 自修复) +// ======================================================================== +// 本模块是 EnhanceService 的"增强路径",独立于 agent.Runner。 +// +// 为什么不复用 agent.Runner.Run: +// 1. Runner.Run 是按 sessionID 操作的(带会话管理、并发清理协程), +// 而 EnhanceService 是"无状态一次性请求",没有 session 概念; +// 2. Runner.Run 只返回最终文本,无法返回步骤明细(token/耗时/思考过程), +// 而我们需要把每一步落到 xk_ai_generation_step 子表; +// 3. Runner.Run 没有预算管理、没有 Reflection、没有 JSON 修复。 +// +// 本循环的执行步骤(每一步都生成 EnhanceStep 落表): +// [1] Planning(可选):让模型先输出 plan JSON +// [2] 多轮 Think-Act-Observe: +// for i := 0; i < maxIter; i++ { +// budget 检查(超限中止) +// LLM 调用(带 tools,可触发 Function Calling) +// 累加 token,写 llm_call step +// 若触发工具 → 执行 → 工具结果入栈 → continue +// 否则进入 Reflection +// } +// [3] Reflection(可选):让模型自检输出(温度更低) +// [4] JSON 修复(可选):JSON 不合法时让模型修复 +// +// 设计原则: +// - 任一步骤失败都不中断整体(除非超预算或 ctx 取消) +// - 所有 LLM 调用都通过 TokenBudget 控制 +// - 步骤明细实时累加到 resp.Steps(即使中途失败也要返回已生成的部分) +// ======================================================================== + +import ( + "context" + "encoding/json" + "fmt" + "log" + "strings" + "time" + + "tcm-agent/internal/agent" + "tcm-agent/internal/agentcfg" + "tcm-agent/internal/llm" + "tcm-agent/internal/types" +) + +// ------------------------------------------------------------------ +// 入参与返回结构 +// ------------------------------------------------------------------ + +// ReactLoopRequest ReactLoop 的一次调用入参 +// +// 与 EnhanceRequest 区别: +// - Messages 已注入 KB 检索结果(KB 步骤已由 EnhancerService 完成) +// - Tools 是可选的(若客户端模型不支持 Function Calling,传 nil 走纯 chat) +// - Client 已通过 resolveClient 解析好(避免 ReactLoop 重复解析) +type ReactLoopRequest struct { + Scene string // 场景(仅用于日志/step 记录) + Messages []types.Message // 注入 KB 后的消息列表(会被本循环修改) + Tools []types.Tool // 可用工具集(可空) + Client llm.LLMClient // 已解析的 LLM 客户端 + Provider string // 客户端对应的 provider 名 + // Temperature 主生成温度覆盖(PHP 按场景显式传入时 >0); + // 只影响主生成调用,Planning/Reflection/JSON 修复仍用各自的低温配置 + Temperature float64 +} + +// ReactLoopResult ReactLoop 的执行结果 +type ReactLoopResult struct { + Content string // 最终生成内容(最后一次 LLM 返回的文本) + Steps []EnhanceStep // 全部步骤明细(Planning + 多轮 Chat + Reflection + JSON 修复) + Aborted bool // 是否因预算超限而中止(true 时 Content 仍是已生成部分) + Budget agent.BudgetSnapshot // 预算使用快照 +} + +// ------------------------------------------------------------------ +// ReactLoop 主体 +// ------------------------------------------------------------------ + +// runReactLoop 执行完整 ReAct 循环 +// +// 调用方:EnhancerService.Enhance(仅在 agentcfg.ReAct.Enabled=true 时调用) +// +// 参数: +// - ctx - 请求上下文(支持超时取消) +// - req - 循环入参(messages/client/tools 已就绪) +// - reactCfg - ReAct 配置(maxIter/Planning/Reflection 等,来自 agentcfg) +// - budgetCfg - Token 预算配置(用于创建 budget 累加器) +// +// 返回:循环结果(含步骤明细 + 最终内容) +func (s *EnhancerService) runReactLoop( + ctx context.Context, + req *ReactLoopRequest, + reactCfg agentcfg.ReActConfig, + budgetCfg agentcfg.TokenBudgetConfig, +) *ReactLoopResult { + result := &ReactLoopResult{Steps: []EnhanceStep{}} + + // 创建 Token 预算器(limit=0 表示不限制,按配置决定) + var limit int + if budgetCfg.Enabled { + limit = budgetCfg.PerRequest + } + budget := agent.NewTokenBudget(limit, budgetCfg.MaxTokensPerCall) + + // 消息快照(循环内修改的是这份拷贝,不污染调用方原 messages) + messages := make([]types.Message, len(req.Messages)) + copy(messages, req.Messages) + + // ===== [1] Planning 阶段(可选) ===== + if reactCfg.PlanningEnabled { + planStep := s.doPlanning(ctx, req, reactCfg, budget, &messages) + result.Steps = append(result.Steps, planStep) + if budget.IsExceeded() { + result.Aborted = true + result.Budget = budget.Snapshot() + return result + } + } + + // ===== [2] Think-Act-Observe 多轮循环 ===== + maxIter := reactCfg.MaxIterations + if maxIter < 1 { + maxIter = 3 + } + + var lastContent string + var lastProvider = req.Provider + var lastModel = req.Client.Name() + + for i := 0; i < maxIter; i++ { + // 预算检查(超限立即中止,返回已生成的部分) + if budget.IsExceeded() { + result.Aborted = true + log.Printf("[ReactLoop] scene=%s 预算超限中止 at iter=%d used=%d limit=%d", + req.Scene, i, budget.Used(), limit) + break + } + + // 计算本次调用 max_tokens(取 min(配置单次上限, 剩余预算)) + maxTokens := budget.CalcMaxTokensForCall(budgetCfg.MaxTokensPerCall) + // 主生成温度:PHP 按场景显式指定时优先(处方 0.3→可调低),否则用默认 0.3 + mainTemp := 0.3 + if req.Temperature > 0 { + mainTemp = req.Temperature + } + opts := llm.ChatOpts{ + MaxTokens: maxTokens, + Temperature: mainTemp, + } + + // 调用 LLM(带工具) + callStep := s.callLLMOnce(ctx, req, opts, messages, "llm_call") + result.Steps = append(result.Steps, callStep) + + // 累加预算 + budget.Consume(callStep.PromptTokens, callStep.CompletionTokens) + + if callStep.Status != 1 { + // 调用失败:直接返回(上层决定要不要走降级) + break + } + + // 取 LLM 实际返回的 Message(callLLMOnce 已通过 LastChatResult 拿到 token, + // 这里要拿 Message 内容 + ToolCall 信息) + llmMsg := callStep.lastMessage + if llmMsg == nil { + break + } + lastContent = llmMsg.Content + lastProvider = req.Provider + lastModel = req.Client.Name() + + // 触发工具调用 → 执行工具 → 工具结果入栈 → 进入下一轮 + if llmMsg.ToolCall != nil { + toolStep := s.executeToolCall(ctx, llmMsg.ToolCall) + result.Steps = append(result.Steps, toolStep) + + // 【协议正确性】assistant 帧 + tool 帧都入栈(与 runner.go 修复一致) + // tool 帧必须带 ToolCallID 与 assistant 帧 tool_calls[].id 对应, + // 否则 OpenAI 协议厂商(讯飞/DeepSeek)会拒绝下一轮请求 + messages = append(messages, *llmMsg) + messages = append(messages, types.Message{ + Role: "tool", + Content: toolStep.Detail, + ToolCallID: llmMsg.ToolCall.ID, + Timestamp: time.Now().Unix(), + }) + continue + } + + // 未触发工具:本轮就是最终答案,跳出循环进入 Reflection + break + } + + // ===== [3] Reflection 阶段(可选) ===== + if reactCfg.ReflectionEnabled && lastContent != "" && !budget.IsExceeded() { + reflectStep, reflectOK := s.doReflection(ctx, req, reactCfg, budgetCfg, budget, lastContent) + result.Steps = append(result.Steps, reflectStep) + // 反思未通过:把反思详情放到 lastContent 末尾,让用户看到模型自检结果 + if !reflectOK && reflectStep.Detail != "" { + lastContent += "\n\n[反思反馈] " + reflectStep.Detail + } + } + + // ===== [4] JSON 修复(可选) ===== + if reactCfg.JSONRepairEnabled && lastContent != "" { + repaired, repairStep := s.repairJSONIfNeeded(ctx, req, reactCfg, budget, lastContent) + if repairStep != nil { + result.Steps = append(result.Steps, *repairStep) + if repaired != "" { + lastContent = repaired + } + } + } + + result.Content = lastContent + _ = lastProvider + _ = lastModel + result.Budget = budget.Snapshot() + return result +} + +// ------------------------------------------------------------------ +// [1] Planning 阶段 +// ------------------------------------------------------------------ + +// doPlanning 让模型先输出任务计划(先查什么 → 再查什么 → 最后生成) +// +// 设计目的: +// - 让模型在"消耗大量 token 之前"先规划清楚步骤 +// - 复杂任务(如开中药处方)效果显著:模型可能意识到要"先查 18 反禁忌" +// - 计划本身也作为 step 落表,运维可以审计 +// +// prompt 策略: +// - 单独一次 LLM 调用,只产出 plan,不让它真的执行 +// - 用低温度(0.15)+ 强约束 prompt,避免计划发散 +func (s *EnhancerService) doPlanning( + ctx context.Context, + req *ReactLoopRequest, + reactCfg agentcfg.ReActConfig, + budget *agent.TokenBudget, + messages *[]types.Message, +) EnhanceStep { + step := EnhanceStep{ + StepType: "plan", + StartedAt: time.Now().Unix(), + } + start := time.Now() + + // 构造规划 prompt:复用业务 system + 追加"请先输出计划"指令 + // + // 【prompt 锚定】明确提示"这是医疗任务",避免轻量模型(spark-lite 等) + // 把"执行计划"模式匹配成"软件项目管理计划"套话(已实际发生过的跑题案例) + planPrompt := "【Planning 阶段】你正在处理一个中医/医疗任务(见上面的 system 与用户消息)。" + + "请基于该医疗任务输出一个简短的执行计划(不超过 5 步,每步一句话," + + "说明你打算查什么医学知识/做什么医疗判断,例如:先辨证、查配伍禁忌、再组方)。" + + "计划必须紧扣上面的医疗任务本身,不要输出通用的项目管理步骤。" + + "不要执行任务,只输出计划。" + + tryMessages := append([]types.Message{}, *messages...) + tryMessages = append(tryMessages, types.Message{ + Role: "user", + Content: planPrompt, + Timestamp: time.Now().Unix(), + }) + + opts := llm.ChatOpts{ + MaxTokens: budget.CalcMaxTokensForCall(512), // 计划阶段最多 512 token + Temperature: 0.15, // 低温保证稳定 + } + msg, chatResult := s.callLLMWithMeta(ctx, req.Client, tryMessages, nil, opts) + + step.DurationMs = int(time.Since(start).Milliseconds()) + step.FinishedAt = time.Now().Unix() + step.Provider = req.Provider + step.Model = req.Client.Name() + + if msg == nil || msg.Content == "" { + step.Status = 2 + step.Detail = "Planning 调用失败" + if chatResult != nil { + budget.Consume(chatResult.PromptTokens, chatResult.CompletionTokens) + step.PromptTokens = chatResult.PromptTokens + step.CompletionTokens = chatResult.CompletionTokens + step.TotalTokens = chatResult.TotalTokens + } + return step + } + + // 累加预算 + if chatResult != nil { + budget.Consume(chatResult.PromptTokens, chatResult.CompletionTokens) + step.PromptTokens = chatResult.PromptTokens + step.CompletionTokens = chatResult.CompletionTokens + step.TotalTokens = chatResult.TotalTokens + step.Usage = chatResult.Usage + } + + // ===== 计划跑题检测:只有命中医疗白名单的计划才允许注入 ===== + // + // 为什么用白名单制(而不是"没命中黑名单就放行"): + // 轻量模型可能输出既无医疗词也无黑名单词的泛泛计划(如"1.收集信息 2.分析 3.输出"), + // 这种计划注入后同样会稀释医疗任务焦点、污染后续生成 + // (实际案例:plan 跑题成项目管理 → 最终处方输出也变成了项目管理步骤)。 + // 丢弃计划无副作用:step 记录保留(status=2 便于后台审计),主循环按无计划模式继续。 + planGuard := validateMedicalRelevance([]types.Message{{Content: msg.Content}}) + if len(planGuard.HitWhitelist) == 0 { + log.Printf("[ReactLoop] ⚠️ scene=%s Planning 输出未命中任何医疗关键词已丢弃(命中非医疗词=%v),主循环按无计划模式继续", + req.Scene, planGuard.HitBlacklist) + step.Status = 2 + step.Detail = "计划跑题已丢弃: " + truncateForLog(msg.Content, 200) + return step + } + + // ===== 把计划追加到对话历史,让后续主循环能参考 ===== + // + // 【关键约定】messages 序列最后必须是 user 角色才能让下一次 LLM 调用生效。 + // 之前直接把 plan 当 assistant 帧追加,导致序列以 assistant 结尾, + // 触发讯飞 Lite "10003 用户的消息格式有错误"(Pro/Max 宽松,Lite 严格)。 + // + // 正确做法: + // 1) 先把 plan 当 user 帧(标明是"计划"内容)追加 → 让 LLM 知道计划是什么 + // 2) 再追加一个 user 帧作为"执行指令" → 保证最后一条是 user + *messages = append(*messages, types.Message{ + Role: "user", + Content: "[Planning 阶段输出的计划]\n" + msg.Content, + Timestamp: time.Now().Unix(), + }) + *messages = append(*messages, types.Message{ + Role: "user", + Content: "【执行阶段】请严格按照上述计划完成最初的医疗任务,并按 system 要求的格式输出最终结果。", + Timestamp: time.Now().Unix(), + }) + + step.Status = 1 + step.Detail = "计划: " + truncateForLog(msg.Content, 200) + return step +} + +// ------------------------------------------------------------------ +// [2] 单次 LLM 调用(带预算与 step 记录) +// ------------------------------------------------------------------ + +// callLLMOnce 调用一次 LLM,包装成 EnhanceStep(含 token 统计) +// +// 调用方:runReactLoop 主循环 +func (s *EnhancerService) callLLMOnce( + ctx context.Context, + req *ReactLoopRequest, + opts llm.ChatOpts, + messages []types.Message, + stepType string, +) EnhanceStep { + step := EnhanceStep{ + StepType: stepType, + StartedAt: time.Now().Unix(), + } + start := time.Now() + + msg, chatResult := s.callLLMWithMeta(ctx, req.Client, messages, req.Tools, opts) + + step.DurationMs = int(time.Since(start).Milliseconds()) + step.FinishedAt = time.Now().Unix() + step.Provider = req.Provider + step.Model = req.Client.Name() + step.lastMessage = msg + + if chatResult != nil { + step.PromptTokens = chatResult.PromptTokens + step.CompletionTokens = chatResult.CompletionTokens + step.TotalTokens = chatResult.TotalTokens + step.Usage = chatResult.Usage + step.APIKeyID = chatResult.APIKeyID + } + + if msg == nil { + step.Status = 2 + step.Detail = "LLM 返回空" + return step + } + + step.Status = 1 + if msg.ToolCall != nil { + step.Detail = fmt.Sprintf("触发工具调用: %s", msg.ToolCall.ToolName) + } else { + step.Detail = "成功 | finish_reason=" + chatResult.FinishReason + } + return step +} + +// callLLMWithMeta 调用 LLM 并提取 token 元数据(统一入口) +// +// 策略: +// 1. 若客户端实现 OptAwareClient(DeepSeek/Spark/OpenAI)→ 用 ChatWithOpts 透传参数 +// 2. 否则回落到 LLMClient.Chat +// 3. 若客户端实现 TokenAwareClient → 取 LastChatResult 拿 token/finish_reason +func (s *EnhancerService) callLLMWithMeta( + ctx context.Context, + client llm.LLMClient, + messages []types.Message, + tools []types.Tool, + opts llm.ChatOpts, +) (*types.Message, *types.ChatResult) { + var ( + msg *types.Message + err error + ) + + // 单次调用的闭包(优先用 ChatWithOpts) + doCall := func() (*types.Message, error) { + if optClient, ok := client.(llm.OptAwareClient); ok { + return optClient.ChatWithOpts(ctx, messages, tools, opts) + } + return client.Chat(ctx, messages, tools) + } + + msg, err = doCall() + + // ---------- 稳定性加固:网络类错误自动重试 1 次 ---------- + // 只重试瞬时网络抖动(连接失败/超时/reset),不重试业务错误(4xx/5xx API 返回): + // - 业务错误重试大概率还是失败,白白双倍消耗 token 配额 + // - 网络抖动重试一次通常就能恢复,显著提升单点抖动下的成功率 + // 间隔 1s:给对端 LB/连接池一个恢复窗口,也避免瞬间重试风暴 + if err != nil && isRetryableNetworkError(err) && ctx.Err() == nil { + log.Printf("[Enhancer] LLM 网络类错误,1s 后自动重试 1 次: %v", err) + select { + case <-time.After(1 * time.Second): + msg, err = doCall() + case <-ctx.Done(): + // 上游已取消(如客户端断开),不再重试 + } + } + + if err != nil { + log.Printf("[Enhancer] LLM 调用失败: %v", err) + return nil, nil + } + + // 尝试取 token 用量(DeepSeek/Spark 实现 TokenAwareClient) + var chatResult *types.ChatResult + if tac, ok := client.(llm.TokenAwareClient); ok { + chatResult = tac.LastChatResult() + } + if chatResult == nil { + chatResult = &types.ChatResult{} + } + return msg, chatResult +} + +// isRetryableNetworkError 判断 LLM 调用错误是否属于「可重试的网络类错误」 +// +// 判定思路:LLM 客户端返回的错误是 fmt.Errorf 包装的字符串, +// 无法用 errors.Is 精确匹配,只能按错误文案特征识别。 +// 白名单只收纯网络故障(连接/超时/reset),凡是「API 返回 xxx」 +// 这种服务端已给出响应的业务错误一律不重试,避免双倍烧 token。 +func isRetryableNetworkError(err error) bool { + if err == nil { + return false + } + s := strings.ToLower(err.Error()) + // 服务端已返回明确响应(业务错误),不属于网络抖动 + if strings.Contains(s, "api 返回") { + return false + } + // 常见网络故障特征(Go net/http 错误文案) + networkHints := []string{ + "timeout", "deadline exceeded", // 超时 + "connection refused", "connection reset", // 连接被拒/被重置 + "broken pipe", "unexpected eof", "eof", // 传输中断 + "no such host", "dial tcp", // DNS/建连失败 + "tls handshake", // TLS 握手失败 + "请求失败", // 客户端封装的通用请求失败前缀 + } + for _, hint := range networkHints { + if strings.Contains(s, hint) { + return true + } + } + return false +} + +// ------------------------------------------------------------------ +// [3] Reflection 阶段 +// ------------------------------------------------------------------ + +// doReflection 让模型自检生成结果是否合格 +// +// prompt 策略: +// - 用更低温度(reactCfg.ReflectionTemperature,默认 0.2) +// - 强约束输出:要求模型回答"合格"或"不合格 + 原因" +// - 用预算的剩余部分作为 max_tokens,避免反思膨胀 +// +// 返回: +// - EnhanceStep:反思过程记录 +// - bool:是否合格(true=通过,false=不通过,调用方可决定是否重试) +func (s *EnhancerService) doReflection( + ctx context.Context, + req *ReactLoopRequest, + reactCfg agentcfg.ReActConfig, + budgetCfg agentcfg.TokenBudgetConfig, + budget *agent.TokenBudget, + generatedContent string, +) (EnhanceStep, bool) { + step := EnhanceStep{ + StepType: "reflection", + StartedAt: time.Now().Unix(), + } + start := time.Now() + + // 构造反思 prompt:让模型扮演"审核者"角色 + reflectPrompt := fmt.Sprintf( + "【Reflection 反思阶段】请对以下 AI 生成内容进行严格审核:\n\n"+ + "---\n%s\n---\n\n"+ + "审核标准:\n"+ + "1. 是否有医学常识性错误(剂量、配伍禁忌、诊断矛盾)\n"+ + "2. 是否漏掉关键字段(处方缺剂量/用法;病历缺主诉对应诊断)\n"+ + "3. 是否符合中文医疗文案规范(无歧义、无营销用语)\n\n"+ + "输出格式:第一行必须是「合格」或「不合格」;如果不合格,第二行起说明原因。\n"+ + "不要重新生成内容,只做审核。", + generatedContent, + ) + + // 反思用独立 messages,避免污染主对话 + reflectMessages := []types.Message{ + { + Role: "system", + Content: "你是一名严谨的中医临床审核专家。", + Timestamp: time.Now().Unix(), + }, + { + Role: "user", + Content: reflectPrompt, + Timestamp: time.Now().Unix(), + }, + } + + temp := reactCfg.ReflectionTemperature + if temp <= 0 { + temp = 0.2 + } + maxTokens := budget.CalcMaxTokensForCall(1024) // 反思最多 1024 token + opts := llm.ChatOpts{ + MaxTokens: maxTokens, + Temperature: temp, + } + msg, chatResult := s.callLLMWithMeta(ctx, req.Client, reflectMessages, nil, opts) + + step.DurationMs = int(time.Since(start).Milliseconds()) + step.FinishedAt = time.Now().Unix() + step.Provider = req.Provider + step.Model = req.Client.Name() + + if chatResult != nil { + budget.Consume(chatResult.PromptTokens, chatResult.CompletionTokens) + step.PromptTokens = chatResult.PromptTokens + step.CompletionTokens = chatResult.CompletionTokens + step.TotalTokens = chatResult.TotalTokens + step.Usage = chatResult.Usage + } + + if msg == nil { + step.Status = 2 + step.Detail = "反思调用失败(不阻断,按合格处理)" + return step, true + } + + // 解析"合格/不合格" + content := strings.TrimSpace(msg.Content) + firstLine := strings.ToLower(strings.SplitN(content, "\n", 2)[0]) + passed := true + if strings.Contains(firstLine, "不合格") { + passed = false + } + + step.Status = 1 + if passed { + step.Detail = "审核通过" + } else { + step.Detail = "审核不通过: " + truncateForLog(content, 300) + } + return step, passed +} + +// ------------------------------------------------------------------ +// [4] JSON 修复阶段 +// ------------------------------------------------------------------ + +// repairJSONIfNeeded 检查内容是否为合法 JSON,不合法时让模型修复 +// +// 返回: +// - string:修复后的内容(无需修复或修复失败时返回空字符串) +// - *EnhanceStep:修复步骤(无需修复时返回 nil) +func (s *EnhancerService) repairJSONIfNeeded( + ctx context.Context, + req *ReactLoopRequest, + reactCfg agentcfg.ReActConfig, + budget *agent.TokenBudget, + content string, +) (string, *EnhanceStep) { + trimmed := strings.TrimSpace(content) + + // 已经是合法 JSON:不修复 + if json.Valid([]byte(trimmed)) { + return "", nil + } + + // 不是 JSON 但不是预期的 JSON 场景(内容不以 { 或 [ 开头):也不修复 + // 避免对纯文本响应(如知识问答)误触发修复 + if !strings.HasPrefix(trimmed, "{") && !strings.HasPrefix(trimmed, "[") { + return "", nil + } + + maxRetries := reactCfg.JSONRepairMaxRetries + if maxRetries < 1 { + maxRetries = 2 + } + + var lastRepaired string + var lastStep *EnhanceStep + + for retry := 0; retry < maxRetries; retry++ { + if budget.IsExceeded() { + break + } + + repairStep, repaired := s.doJSONRepairOnce(ctx, req, budget, content, retry) + lastStep = repairStep + + if repaired != "" && json.Valid([]byte(repaired)) { + lastRepaired = repaired + break // 修复成功 + } + + // 用修复后的内容(即使还不合法)作为下次输入 + if repaired != "" { + content = repaired + } + } + + return lastRepaired, lastStep +} + +// doJSONRepairOnce 一次 JSON 修复尝试 +func (s *EnhancerService) doJSONRepairOnce( + ctx context.Context, + req *ReactLoopRequest, + budget *agent.TokenBudget, + brokenContent string, + retry int, +) (*EnhanceStep, string) { + step := EnhanceStep{ + StepType: "json_repair", + StartedAt: time.Now().Unix(), + } + start := time.Now() + + repairPrompt := fmt.Sprintf( + "以下内容应当是合法 JSON 但解析失败,请修复并只输出修复后的 JSON(不要解释、不要 markdown):\n\n---\n%s\n---", + brokenContent, + ) + + messages := []types.Message{ + { + Role: "system", + Content: "你是一个 JSON 修复工具,只输出合法的 JSON 内容,不要任何其他文字。", + Timestamp: time.Now().Unix(), + }, + { + Role: "user", + Content: repairPrompt, + Timestamp: time.Now().Unix(), + }, + } + + opts := llm.ChatOpts{ + MaxTokens: budget.CalcMaxTokensForCall(2048), + Temperature: 0.1, // 极低温度保证修复稳定 + } + msg, chatResult := s.callLLMWithMeta(ctx, req.Client, messages, nil, opts) + + step.DurationMs = int(time.Since(start).Milliseconds()) + step.FinishedAt = time.Now().Unix() + step.Provider = req.Provider + step.Model = req.Client.Name() + step.Detail = fmt.Sprintf("第 %d 次修复尝试", retry+1) + + if chatResult != nil { + budget.Consume(chatResult.PromptTokens, chatResult.CompletionTokens) + step.PromptTokens = chatResult.PromptTokens + step.CompletionTokens = chatResult.CompletionTokens + step.TotalTokens = chatResult.TotalTokens + step.Usage = chatResult.Usage + } + + if msg == nil { + step.Status = 2 + step.Detail = "修复调用失败" + return &step, "" + } + + repaired := strings.TrimSpace(msg.Content) + // 剥离可能的 markdown 代码块包裹 + if strings.HasPrefix(repaired, "```json") { + repaired = strings.TrimPrefix(repaired, "```json") + repaired = strings.TrimSuffix(repaired, "```") + repaired = strings.TrimSpace(repaired) + } else if strings.HasPrefix(repaired, "```") { + repaired = strings.TrimPrefix(repaired, "```") + repaired = strings.TrimSuffix(repaired, "```") + repaired = strings.TrimSpace(repaired) + } + + if json.Valid([]byte(repaired)) { + step.Status = 1 + step.Detail = fmt.Sprintf("第 %d 次修复成功", retry+1) + } else { + step.Status = 2 + step.Detail = fmt.Sprintf("第 %d 次修复仍不合法", retry+1) + } + + return &step, repaired +} + +// ------------------------------------------------------------------ +// [5] 工具调用执行 +// ------------------------------------------------------------------ + +// executeToolCall 执行一次工具调用并记录 step +// +// 注意:本服务目前没有直接持有 tool 注册表(工具注册在 agent.Runner 里), +// 这里通过 s.toolRegistry 引用 runner 的工具集。如果 toolRegistry 为 nil, +// 本方法返回"工具未注册"的失败 step。 +func (s *EnhancerService) executeToolCall(ctx context.Context, call *types.ToolCallInfo) EnhanceStep { + step := EnhanceStep{ + StepType: "tool_call", + StartedAt: time.Now().Unix(), + } + start := time.Now() + step.Detail = fmt.Sprintf("调用工具: %s", call.ToolName) + + var result string + var err error + if s.toolRegistry != nil { + if t, ok := s.toolRegistry[call.ToolName]; ok { + result, err = t.Execute(ctx, call.Params) + } else { + err = fmt.Errorf("工具 %s 未注册", call.ToolName) + } + } else { + err = fmt.Errorf("工具注册表为空") + } + + step.DurationMs = int(time.Since(start).Milliseconds()) + step.FinishedAt = time.Now().Unix() + + if err != nil { + step.Status = 2 + step.Detail = fmt.Sprintf("工具 %s 执行失败: %v", call.ToolName, err) + // 失败时仍返回错误内容作为 Detail,让 LLM 下一轮知道工具挂了 + } else { + step.Status = 1 + step.Detail = truncateForLog(result, 2000) // 工具结果可能很长,截断 + } + return step +} + +// ------------------------------------------------------------------ +// 工具方法 +// ------------------------------------------------------------------ + +// truncateForLog 截断字符串用于日志(保留前 n 字符) +func truncateForLog(s string, n int) string { + if len(s) <= n { + return s + } + return s[:n] + "...(截断)" +} diff --git a/internal/service/runlog.go b/internal/service/runlog.go new file mode 100644 index 0000000..3a08a80 --- /dev/null +++ b/internal/service/runlog.go @@ -0,0 +1,365 @@ +package service + +// ======================================================================== +// RunLog —— Agent 运行轨迹记录器(内存环形缓冲) +// ======================================================================== +// 记录最近 N 次 Enhance 运行的完整轨迹(每一步干了什么、时间节点、token), +// 供 /api/v1/agent/runs 系列接口与 /agent/view 可视化面板查询。 +// +// 为什么用内存环形缓冲而不是落库: +// 1. 历史明细 PHP 端已经写入 xk_ai_generation_step(权威审计数据); +// Go 端的定位是「实时观测最近运行」,重启清空可接受 +// 2. 内存缓冲能记录到"PHP 侧看不到"的运行:守卫拦截、resolveClient 失败 +// 这类在返回 PHP 之前就终止的请求 +// 3. 零依赖:DB 抖动时面板依然可用(观测工具不能依赖被观测对象) +// +// 并发安全:所有读写都经过 sync.RWMutex,Add 是 O(1) 覆盖写 +// ======================================================================== + +import ( + "encoding/json" + "strings" + "sync" + "time" +) + +// AgentRunStatus 运行状态枚举(与面板徽标颜色对应) +const ( + RunStatusOK = 1 // 成功 + RunStatusFail = 2 // 失败(LLM 调用失败 / 配置解析失败等) + RunStatusBlocked = 3 // 医疗守卫拦截 +) + +// AgentRunRecord 一次 Agent 运行的完整轨迹 +// +// Steps 直接复用 EnhanceStep(与返回 PHP 的结构一致), +// 每个 step 自带 started_at / finished_at / duration_ms,就是面板时间线的数据源 +type AgentRunRecord struct { + ID int64 `json:"id"` // 递增 ID(进程内唯一,重启重置) + Scene string `json:"scene"` // 场景:medical_record / prescription + Provider string `json:"provider"` // 实际使用的供应商 + Model string `json:"model"` // 实际使用的模型名 + CfgSource string `json:"cfg_source"` // 配置来源:active / yaml_default 等 + Status int `json:"status"` // 1成功 2失败 3守卫拦截 + Error string `json:"error,omitempty"` // 失败原因(成功时为空) + TotalMs int `json:"total_ms"` // 总耗时毫秒 + StartedAt int64 `json:"started_at"` // 开始时间(unix 秒) + FinishedAt int64 `json:"finished_at"` // 结束时间(unix 秒) + PromptTokens int `json:"prompt_tokens"` // 输入 token 合计 + CompletionTokens int `json:"completion_tokens"` // 输出 token 合计 + TotalTokens int `json:"total_tokens"` // 总 token 合计 + Steps []EnhanceStep `json:"steps"` // 完整步骤明细(时间线数据源) + // RequestSnapshot 请求入参快照(截断后的 JSON 字符串) + // 用途:管理前端的「失败一键重放」——把入参回填进 Enhance 调试台重跑。 + // 只在详情接口返回(列表摘要不含),内容截断控制内存(200 条 × ~2KB ≈ 400KB 上限) + RequestSnapshot string `json:"request_snapshot,omitempty"` +} + +// AgentRunSummary 列表视图用的轻量摘要(不含 step 的 detail 全文,节省传输) +type AgentRunSummary struct { + ID int64 `json:"id"` + Scene string `json:"scene"` + Provider string `json:"provider"` + Model string `json:"model"` + CfgSource string `json:"cfg_source"` + Status int `json:"status"` + Error string `json:"error,omitempty"` + TotalMs int `json:"total_ms"` + StartedAt int64 `json:"started_at"` + TotalTokens int `json:"total_tokens"` + StepBriefs []RunStepBrief `json:"step_briefs"` // 每步的类型/状态/耗时(列表里画小圆点用) +} + +// RunStepBrief 步骤摘要(列表视图用) +type RunStepBrief struct { + StepType string `json:"step_type"` + Status int `json:"status"` + DurationMs int `json:"duration_ms"` +} + +// runLogBuffer 环形缓冲本体 +type runLogBuffer struct { + mu sync.RWMutex + items []AgentRunRecord // 定长环形数组 + size int // 容量 + count int // 已写入条数(<= size) + head int // 下一个写入位置 + nextID int64 // 自增 ID +} + +// 全局单例:保留最近 200 次运行 +var runLog = &runLogBuffer{ + items: make([]AgentRunRecord, 200), + size: 200, +} + +// Add 追加一条运行记录(环形覆盖写,O(1)) +func (b *runLogBuffer) Add(rec AgentRunRecord) int64 { + b.mu.Lock() + defer b.mu.Unlock() + b.nextID++ + rec.ID = b.nextID + b.items[b.head] = rec + b.head = (b.head + 1) % b.size + if b.count < b.size { + b.count++ + } + return rec.ID +} + +// List 按时间倒序返回运行摘要(最新在前) +// +// 过滤参数: +// - limit : 返回条数上限(<=0 时取 50) +// - scene : 非空时只返回该场景 +// - status : >0 时只返回该状态 +func (b *runLogBuffer) List(limit int, scene string, status int) []AgentRunSummary { + if limit <= 0 { + limit = 50 + } + b.mu.RLock() + defer b.mu.RUnlock() + + out := make([]AgentRunSummary, 0, min(limit, b.count)) + // 从最新写入的位置往回遍历(head-1 是最新一条) + for i := 0; i < b.count && len(out) < limit; i++ { + idx := (b.head - 1 - i + b.size*2) % b.size + rec := b.items[idx] + if scene != "" && rec.Scene != scene { + continue + } + if status > 0 && rec.Status != status { + continue + } + briefs := make([]RunStepBrief, 0, len(rec.Steps)) + for _, st := range rec.Steps { + briefs = append(briefs, RunStepBrief{ + StepType: st.StepType, + Status: st.Status, + DurationMs: st.DurationMs, + }) + } + out = append(out, AgentRunSummary{ + ID: rec.ID, + Scene: rec.Scene, + Provider: rec.Provider, + Model: rec.Model, + CfgSource: rec.CfgSource, + Status: rec.Status, + Error: rec.Error, + TotalMs: rec.TotalMs, + StartedAt: rec.StartedAt, + TotalTokens: rec.TotalTokens, + StepBriefs: briefs, + }) + } + return out +} + +// Get 按 ID 取完整记录(含全部 step detail) +func (b *runLogBuffer) Get(id int64) (*AgentRunRecord, bool) { + b.mu.RLock() + defer b.mu.RUnlock() + for i := 0; i < b.count; i++ { + idx := (b.head - 1 - i + b.size*2) % b.size + if b.items[idx].ID == id { + // 返回拷贝,避免调用方拿到内部切片引用后被后续覆盖写污染 + rec := b.items[idx] + steps := make([]EnhanceStep, len(rec.Steps)) + copy(steps, rec.Steps) + rec.Steps = steps + return &rec, true + } + } + return nil, false +} + +// RunLogStatsResult 统计聚合结果(面板「统计概览」Tab 数据源) +type RunLogStatsResult struct { + Total int `json:"total"` // 缓冲内总运行数 + Success int `json:"success"` // 成功数 + Failed int `json:"failed"` // 失败数 + Blocked int `json:"blocked"` // 守卫拦截数 + AvgMs int `json:"avg_ms"` // 平均耗时(毫秒,只算成功的) + TotalTokens int `json:"total_tokens"` // token 消耗合计 + SceneCounts map[string]int `json:"scene_counts"` // 按场景分布 + LastError string `json:"last_error"` // 最近一次失败的原因 + LastErrorAt int64 `json:"last_error_at"` // 最近一次失败的时间 + BufferSize int `json:"buffer_size"` // 缓冲容量(面板显示"最近 N 条") +} + +// Stats 聚合统计(O(n),n<=200 可忽略) +func (b *runLogBuffer) Stats() RunLogStatsResult { + b.mu.RLock() + defer b.mu.RUnlock() + + res := RunLogStatsResult{ + SceneCounts: map[string]int{}, + BufferSize: b.size, + } + sumMs := 0 + okCount := 0 + for i := 0; i < b.count; i++ { + idx := (b.head - 1 - i + b.size*2) % b.size + rec := b.items[idx] + res.Total++ + res.TotalTokens += rec.TotalTokens + res.SceneCounts[rec.Scene]++ + switch rec.Status { + case RunStatusOK: + res.Success++ + sumMs += rec.TotalMs + okCount++ + case RunStatusBlocked: + res.Blocked++ + default: + res.Failed++ + // 只记录最新的一条失败(遍历是从新到旧,第一条命中即最新) + if res.LastError == "" { + res.LastError = rec.Error + res.LastErrorAt = rec.StartedAt + } + } + } + if okCount > 0 { + res.AvgMs = sumMs / okCount + } + return res +} + +// ------------------------------------------------------------------ +// 包级导出函数(供 router 层调用,隐藏 buffer 实现细节) +// ------------------------------------------------------------------ + +// RunLogList 查询运行摘要列表 +func RunLogList(limit int, scene string, status int) []AgentRunSummary { + return runLog.List(limit, scene, status) +} + +// RunLogGet 查询单条完整记录 +func RunLogGet(id int64) (*AgentRunRecord, bool) { + return runLog.Get(id) +} + +// RunLogStats 查询聚合统计 +func RunLogStats() RunLogStatsResult { + return runLog.Stats() +} + +// recordAgentRun 把一次 Enhance 运行写入环形缓冲 +// +// 调用方:EnhancerService.Enhance(包装层,成功/失败/拦截统一走这里) +// +// 状态推断规则: +// - err == nil → 成功 +// - steps 里有 medical_guard 步骤 → 守卫拦截(在 err != nil 的前提下) +// - 其他 → 失败 +func recordAgentRun(req *EnhanceRequest, resp *EnhanceResponse, err error, startedAt time.Time, cfgSource string) { + rec := AgentRunRecord{ + Scene: req.Scene, + CfgSource: cfgSource, + StartedAt: startedAt.Unix(), + FinishedAt: time.Now().Unix(), + TotalMs: int(time.Since(startedAt).Milliseconds()), + RequestSnapshot: buildRequestSnapshot(req), + } + + if resp != nil { + rec.Provider = resp.Provider + rec.Model = resp.Model + rec.Steps = resp.Steps + if resp.TotalMs > 0 { + rec.TotalMs = resp.TotalMs + } + // token 汇总 + 从步骤里兜底 provider/model(守卫拦截时 resp.Provider 为空) + for _, st := range resp.Steps { + rec.PromptTokens += st.PromptTokens + rec.CompletionTokens += st.CompletionTokens + rec.TotalTokens += st.TotalTokens + if rec.Provider == "" && st.Provider != "" { + rec.Provider = st.Provider + } + if rec.Model == "" && st.Model != "" { + rec.Model = st.Model + } + } + } + + if err == nil { + rec.Status = RunStatusOK + } else { + rec.Error = err.Error() + rec.Status = RunStatusFail + // 守卫拦截的错误信息以"医疗守卫拦截"开头(enhancer.go 里约定的前缀) + if strings.HasPrefix(rec.Error, "医疗守卫拦截") { + rec.Status = RunStatusBlocked + } + } + + runLog.Add(rec) +} + +// snapshotMessage 快照里的单条消息(只留角色 + 截断后的内容) +type snapshotMessage struct { + Role string `json:"role"` + Content string `json:"content"` +} + +// requestSnapshot 快照结构(重放时前端按这个结构回填调试台表单) +type requestSnapshot struct { + Scene string `json:"scene"` + Context string `json:"context,omitempty"` + KBEnabled bool `json:"kb_enabled"` + TopK int `json:"top_k,omitempty"` + Provider string `json:"provider,omitempty"` + Messages []snapshotMessage `json:"messages"` + Truncated bool `json:"truncated,omitempty"` // 有内容被截断时置 true,前端提示"非完整入参" +} + +// buildRequestSnapshot 构造请求入参快照 +// +// 为什么不直接 json.Marshal(req) 再截断字符串: +// 粗暴截断会产生非法 JSON,重放时前端没法解析回填。 +// 这里逐字段限长(rune 级,中文安全)后再序列化,保证输出永远是合法 JSON: +// - context 最多 800 字 +// - 每条消息 content 最多 600 字,最多保留前 8 条 +func buildRequestSnapshot(req *EnhanceRequest) string { + if req == nil { + return "" + } + const ( + maxContextRunes = 800 + maxMsgRunes = 600 + maxMsgCount = 8 + ) + snap := requestSnapshot{ + Scene: req.Scene, + KBEnabled: req.KBEnabled, + TopK: req.TopK, + Provider: req.Provider, + } + snap.Context, snap.Truncated = truncateSnapRunes(req.Context, maxContextRunes, snap.Truncated) + for i, m := range req.Messages { + if i >= maxMsgCount { + snap.Truncated = true + break + } + content, truncated := truncateSnapRunes(m.Content, maxMsgRunes, snap.Truncated) + snap.Truncated = truncated + snap.Messages = append(snap.Messages, snapshotMessage{Role: m.Role, Content: content}) + } + b, err := json.Marshal(snap) + if err != nil { + return "" + } + return string(b) +} + +// truncateSnapRunes 按 rune 截断字符串,并传递"是否发生过截断"标记 +func truncateSnapRunes(s string, max int, alreadyTruncated bool) (string, bool) { + r := []rune(s) + if len(r) <= max { + return s, alreadyTruncated + } + return string(r[:max]), true +} diff --git a/internal/tool/agent_tools.go b/internal/tool/agent_tools.go new file mode 100644 index 0000000..f596515 --- /dev/null +++ b/internal/tool/agent_tools.go @@ -0,0 +1,199 @@ +package tool + +import ( + "context" + "encoding/json" + "fmt" + "log" + "net/http" + "strings" + "time" + + "tcm-agent/internal/config" +) + +// ======================================================================== +// Agent 工具集 +// ======================================================================== +// 工具是 Agent 的"手脚"——LLM 通过 Function Calling 自主决定 +// 何时调用哪个工具。 +// +// 已注册工具: +// - maxkb_retrieve :检索中医知识库(方剂/药典/指南) +// - his_query :查询 HIS 患者数据 +// - pharmacopoeia_query:查询《中国药典》单味药详情 +// - rule_check :校验处方配伍禁忌 +// +// 新增工具只需:实现 types.Tool 接口 → 在 Runner 中 RegisterTool +// ======================================================================== + +// ========== 工具1:MaxKB 知识库检索 ========== + +// MaxKBRetrieveTool 知识库检索工具 +type MaxKBRetrieveTool struct { + client *MaxKBClient +} + +// NewMaxKBRetrieveTool 创建知识库检索工具 +func NewMaxKBRetrieveTool(client *MaxKBClient) *MaxKBRetrieveTool { + return &MaxKBRetrieveTool{client: client} +} + +func (t *MaxKBRetrieveTool) Name() string { return "maxkb_retrieve" } + +func (t *MaxKBRetrieveTool) Description() string { + return "检索中医知识库,获取权威的中医典籍、方剂、药典、病历书写规范等内容。输入应为检索关键词或问题。" +} + +func (t *MaxKBRetrieveTool) Execute(ctx context.Context, params map[string]any) (string, error) { + query, _ := params["query"].(string) + if query == "" { + return "", fmt.Errorf("检索关键词不能为空") + } + log.Printf("[工具] 知识库检索 | 关键词: %s", query) + return t.client.Chat(ctx, query) +} + +// ========== 工具2:HIS 系统查询 ========== + +// HISTool 医院信息系统查询工具 +// +// 实际项目对接真实的 HIS/PACS/LIS 系统。 +// 这里用模拟数据演示。 +type HISTool struct { + cfg config.MaxKBConfig // 复用配置结构(实际应独立 HIS 配置) + client *http.Client +} + +// NewHISTool 创建 HIS 查询工具 +func NewHISTool(cfg *config.MaxKBConfig) *HISTool { + var c config.MaxKBConfig + if cfg != nil { + c = *cfg + } + return &HISTool{ + cfg: c, + client: &http.Client{Timeout: 10 * time.Second}, + } +} + +func (t *HISTool) Name() string { return "his_query" } + +func (t *HISTool) Description() string { + return "查询医院信息系统(HIS)中的患者数据,包括既往病史、检查报告、用药记录、过敏史等。输入为患者ID或查询条件。" +} + +func (t *HISTool) Execute(ctx context.Context, params map[string]any) (string, error) { + patientID, _ := params["query"].(string) + log.Printf("[工具] HIS 查询 | 患者 ID: %s", patientID) + + // ===== 实际项目这里调用 HIS 接口 ===== + // 以下是模拟数据 + mockData := map[string]string{ + "P001": `患者 P001 既往病史: +- 2023 年: 慢性胃炎 +- 2024 年: 高血压(轻度) +- 过敏: 青霉素 +- 近期检查: 血常规正常, 肝功能正常`, + "P002": `患者 P002 既往病史: +- 2022 年: 子宫肌瘤手术 +- 2024 年: 妊娠期糖尿病 +- 过敏: 无 +- 近期检查: 血糖偏高`, + } + + result, ok := mockData[patientID] + if !ok { + result = fmt.Sprintf("未找到患者 %s 的 HIS 记录", patientID) + } + return result, nil +} + +// ========== 工具3:药典查询 ========== + +// PharmacopoeiaTool 中国药典查询工具 +// +// 复用 MaxKB 客户端(药典内容已录入知识库)。 +type PharmacopoeiaTool struct { + client *MaxKBClient +} + +// NewPharmacopoeiaTool 创建药典查询工具 +func NewPharmacopoeiaTool(client *MaxKBClient) *PharmacopoeiaTool { + return &PharmacopoeiaTool{client: client} +} + +func (t *PharmacopoeiaTool) Name() string { return "pharmacopoeia_query" } + +func (t *PharmacopoeiaTool) Description() string { + return "查询《中国药典》中某味中药的性味归经、功效主治、用法用量、禁忌事项。输入为药名。" +} + +func (t *PharmacopoeiaTool) Execute(ctx context.Context, params map[string]any) (string, error) { + herbName, _ := params["query"].(string) + log.Printf("[工具] 药典查询 | 药名: %s", herbName) + + query := fmt.Sprintf("《中国药典》%s 的性味归经、功效、用法用量、禁忌", herbName) + return t.client.Chat(ctx, query) +} + +// ========== 工具4:规则引擎校验 ========== + +// RuleCheckTool 规则校验工具(供 Agent 自查) +type RuleCheckTool struct{} + +// NewRuleCheckTool 创建规则校验工具 +func NewRuleCheckTool() *RuleCheckTool { return &RuleCheckTool{} } + +func (t *RuleCheckTool) Name() string { return "rule_check" } + +func (t *RuleCheckTool) Description() string { + return "校验处方是否符合中医配伍规则(十八反、十九畏、剂量范围、孕妇禁忌等)。输入为处方文本。" +} + +func (t *RuleCheckTool) Execute(ctx context.Context, params map[string]any) (string, error) { + prescription, _ := params["query"].(string) + log.Printf("[工具] 规则校验 | 处方: %.50s...", prescription) + + // 十八反 + conflicts18 := map[string][]string{ + "甘草": {"甘遂", "大戟", "芫花", "海藻"}, + "乌头": {"贝母", "瓜蒌", "半夏", "白蔹", "白及"}, + "藜芦": {"人参", "沙参", "丹参", "玄参", "苦参", "细辛", "芍药"}, + } + // 十九畏 + conflicts19 := map[string]string{ + "硫黄": "朴硝", "水银": "砒霜", "狼毒": "密陀僧", + "巴豆": "牵牛", "丁香": "郁金", "牙硝": "三棱", + "川乌": "犀角", "草乌": "犀角", "人参": "五灵脂", "官桂": "赤石脂", + } + + issues := make([]string, 0) + + // 检查十八反 + for herb, conflicts := range conflicts18 { + if strings.Contains(prescription, herb) { + for _, conflict := range conflicts { + if strings.Contains(prescription, conflict) { + issues = append(issues, fmt.Sprintf("【十八反】%s 反 %s", herb, conflict)) + } + } + } + } + + // 检查十九畏 + for a, b := range conflicts19 { + if strings.Contains(prescription, a) && strings.Contains(prescription, b) { + issues = append(issues, fmt.Sprintf("【十九畏】%s 畏 %s", a, b)) + } + } + + if len(issues) == 0 { + return "处方校验通过,未发现配伍禁忌。", nil + } + + return "校验发现问题:\n" + strings.Join(issues, "\n"), nil +} + +// 确保 import 使用 +var _ = json.Marshal diff --git a/internal/tool/maxkb.go b/internal/tool/maxkb.go new file mode 100644 index 0000000..e428055 --- /dev/null +++ b/internal/tool/maxkb.go @@ -0,0 +1,150 @@ +package tool + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "time" + + "tcm-agent/internal/config" +) + +// ======================================================================== +// MaxKB 知识库客户端 +// ======================================================================== +// MaxKB 是一个开源的企业级 RAG 知识库平台: +// - 文档管理(PDF/Word/Markdown 等) +// - 智能分段 + 向量化(pgvector) +// - 语义检索 + LLM 增强生成 +// - 兼容 OpenAI 协议 +// +// 官方文档:https://maxkb.cn/docs/ +// Docker 一键部署:docker run -d --name maxkb -p 8080:8080 1panel/maxkb +// ======================================================================== + +// MaxKBClient MaxKB 知识库客户端 +type MaxKBClient struct { + BaseURL string `json:"base_url"` + APIKey string `json:"api_key"` + AppID string `json:"app_id"` + Client *http.Client `json:"-"` +} + +// NewMaxKBClient 创建 MaxKB 客户端 +// +// 参数: +// cfg - MaxKB 配置(BaseURL/APIKey/AppID) +// +// 返回: +// 初始化完成的客户端 +func NewMaxKBClient(cfg config.MaxKBConfig) *MaxKBClient { + return &MaxKBClient{ + BaseURL: cfg.BaseURL, + APIKey: cfg.APIKey, + AppID: cfg.AppID, + Client: &http.Client{Timeout: 60 * time.Second}, + } +} + +// Chat 调用 MaxKB 的对话接口(兼容 OpenAI 格式) +// +// 这是最核心的方法:把问题发给 MaxKB, +// 它会自动做 RAG 检索 + LLM 生成,返回融合知识库的回答。 +// +// 参数: +// ctx - 上下文(支持超时取消) +// query - 用户问题或检索关键词 +// +// 返回: +// MaxKB 生成的回答(已融合知识库检索结果) +func (c *MaxKBClient) Chat(ctx context.Context, query string) (string, error) { + body := map[string]any{ + "model": "maxkb-model", + "messages": []map[string]string{ + {"role": "user", "content": query}, + }, + "stream": false, + } + + buf, _ := json.Marshal(body) + url := fmt.Sprintf("%s/api/application/%s/chat/completions", c.BaseURL, c.AppID) + + req, err := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + if err != nil { + return "", fmt.Errorf("[MaxKB] 创建请求失败: %w", err) + } + req.Header.Set("Authorization", "Bearer "+c.APIKey) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.Client.Do(req) + if err != nil { + return "", fmt.Errorf("[MaxKB] 调用失败: %w", err) + } + defer resp.Body.Close() + + if resp.StatusCode != 200 { + data, _ := io.ReadAll(resp.Body) + return "", fmt.Errorf("[MaxKB] 返回错误 %d: %s", resp.StatusCode, string(data)) + } + + var result struct { + Choices []struct { + Message struct { + Content string `json:"content"` + } `json:"message"` + } `json:"choices"` + } + json.NewDecoder(resp.Body).Decode(&result) + + if len(result.Choices) == 0 { + return "", fmt.Errorf("[MaxKB] 返回空结果") + } + + log.Printf("[MaxKB] ✅ 检索成功 | 查询: %.50s...", query) + return result.Choices[0].Message.Content, nil +} + +// Search 仅做知识检索(不生成,返回原始片段) +// +// 适合需要"引用来源"的场景。 +// 返回 TopK 条相关文档片段。 +func (c *MaxKBClient) Search(ctx context.Context, query string, topK int) ([]string, error) { + if topK <= 0 { + topK = 5 + } + + body := map[string]any{ + "query": query, + "top_k": topK, + } + buf, _ := json.Marshal(body) + url := fmt.Sprintf("%s/api/application/%s/search", c.BaseURL, c.AppID) + + req, _ := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(buf)) + req.Header.Set("Authorization", "Bearer "+c.APIKey) + req.Header.Set("Content-Type", "application/json") + + resp, err := c.Client.Do(req) + if err != nil { + return nil, fmt.Errorf("[MaxKB] 检索失败: %w", err) + } + defer resp.Body.Close() + + var result struct { + Documents []struct { + Content string `json:"content"` + Score float64 `json:"score"` + } `json:"documents"` + } + json.NewDecoder(resp.Body).Decode(&result) + + docs := make([]string, 0, len(result.Documents)) + for _, d := range result.Documents { + docs = append(docs, d.Content) + } + return docs, nil +} diff --git a/internal/types/types.go b/internal/types/types.go new file mode 100644 index 0000000..d49c6b3 --- /dev/null +++ b/internal/types/types.go @@ -0,0 +1,86 @@ +package types + +import ( + "context" +) + +// ======================================================================== +// 公共类型定义(types 包) +// ======================================================================== +// 为什么需要独立的 types 包? +// 原结构中 llm 包用 agent.Message/agent.Tool,agent 包又用 llm.ModelRouter, +// 形成 llm <-> agent 的循环依赖(Go 不允许)。 +// +// 解决方案: +// 把 LLM 调用所需的"消息/工具/工具调用"等纯数据类型抽到 types 包, +// agent 和 llm 都依赖 types,单向依赖:agent → types ← llm,agent → llm。 +// +// 迁移范围: +// - Message(原 agent.Message) +// - Tool 接口(原 agent.Tool) +// - ToolCallInfo(原 agent.ToolCallInfo) +// +// 兼容策略: +// agent 包用 type 别名保留旧 API(agent.Message = types.Message), +// 老调用方无需改 import;llm 包改用 types.Xxx。 +// ======================================================================== + +// Message 单条对话消息(system / user / assistant / tool) +type Message struct { + Role string `json:"role"` // 角色:system/user/assistant/tool + Content string `json:"content"` // 消息正文 + Timestamp int64 `json:"timestamp"` // 时间戳 + ToolCall *ToolCallInfo `json:"tool_call,omitempty"` // 工具调用信息(assistant 触发工具时) + // ToolCallID tool 结果帧回传时对应的 tool_calls[].id + // + // OpenAI Function Calling 协议要求: + // assistant 帧的 tool_calls[].id 必须与后续 tool 帧的 tool_call_id 一一对应, + // 否则部分厂商(讯飞 10003 / OpenAI 400)会直接拒绝请求。 + // 只在 Role=="tool" 时有意义。 + ToolCallID string `json:"tool_call_id,omitempty"` +} + +// Tool Agent 可调用的工具接口 +// +// 实现此接口的对象注册到 Runner 后,LLM 可通过 Function Calling 自主决定调用 +type Tool interface { + Name() string + Description() string + Execute(ctx context.Context, params map[string]any) (string, error) +} + +// ToolCallInfo 一次工具调用的完整信息 +type ToolCallInfo struct { + // ID 厂商返回的 tool_calls[].id(回放对话历史时必须原样带回, + // 供 tool 结果帧的 tool_call_id 对应;厂商未返回时由客户端生成) + ID string `json:"id,omitempty"` + ToolName string `json:"tool_name"` // 工具名 + Params map[string]any `json:"params"` // 调用参数 + Result string `json:"result"` // 调用结果 + Error string `json:"error,omitempty"` // 错误信息(失败时) +} + +// ======================================================================== +// 统一 chat 结果(供 LLM 客户端与上层共享) +// ======================================================================== +// 含 token 用量与计时,便于 Agent 上层把每一步落到 xk_ai_generation_step +// ======================================================================== + +// ChatResult LLM 调用统一返回结构 +// +// 各 provider(DeepSeek/Spark/Qwen 等)调用 LLM 后,把内容、token 用量、耗时 +// 等打包到本结构,方便 KnowledgeEnhancer 把每一步记入 step 子表 +type ChatResult struct { + Content string `json:"content"` // 助手文本(choices[0].message.content) + Provider string `json:"provider"` // 供应商标识 + Model string `json:"model"` // 实际使用的模型名 + APIKeyID int `json:"api_key_id"` // 使用的密钥 ID(env 回落为 0) + PromptTokens int `json:"prompt_tokens"` // 输入 token 数 + CompletionTokens int `json:"completion_tokens"` // 输出 token 数 + TotalTokens int `json:"total_tokens"` // 总 token 数 + Usage map[string]any `json:"usage"` // 完整 usage 原始对象 + DurationMs int `json:"duration_ms"` // 耗时毫秒 + FinishReason string `json:"finish_reason"` // 终止原因:stop/length/content_filter/tool_calls;length=被 max_tokens 截断 + ToolCall *ToolCallInfo `json:"tool_call,omitempty"` // 模型触发的工具调用(Function Calling) + Raw any `json:"-"` // 供应商原始响应(不入 JSON) +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..a59968d --- /dev/null +++ b/main.go @@ -0,0 +1,247 @@ +package main + +// ======================================================================== +// 中医 AI Agent 系统 —— 程序入口 +// ======================================================================== +// 启动流程: +// config.Load → llm.InitLLM (工厂+路由+降级) → agent.InitRunner → router.Setup +// +// 模型层初始化链路: +// config.yaml 中定义模型池 → llm.NewProviderFactory → 注册各供应商 +// → llm.NewModelRouter → 按场景名路由到具体模型 +// → llm.NewFallbackChain → 降级保障 +// +// 不同 Agent 场景自动使用不同模型,无需改代码。 +// ======================================================================== + +import ( + "context" + "fmt" + "io" + "log" + "net/http" + "os" + "os/signal" + "syscall" + "time" + + "tcm-agent/internal/agent" + "tcm-agent/internal/config" + "tcm-agent/internal/dao" + "tcm-agent/internal/llm" + "tcm-agent/internal/router" + "tcm-agent/internal/service" +) + +// @title 中医 AI Agent API +// @version 2.0 +// @description 基于 Go + MaxKB + 多模型工厂 的中医智能诊疗 Agent 系统 +// @host localhost:8080 +// @BasePath /api/v1 +func main() { + // ========== ⓪ 挂接内存日志缓冲 ========== + // 日志同时写控制台和内存环形缓冲(500 行), + // 供 /agent/view 面板「实时日志」Tab 增量拉取,控制台输出不受影响。 + // 必须放在第一行——保证启动日志也能被面板看到 + log.SetOutput(io.MultiWriter(os.Stdout, service.MemLog)) + + // ========== ① 加载配置 ========== + cfg := config.Load() + log.Printf("[启动] 配置加载完成 | 默认模型: %s | 模型池: %d 个", + cfg.LLM.DefaultProvider, len(cfg.LLM.Models)) + + // ========== ② 连接 z_xk 库,注入 AES 主密钥,准备从 DB 加载 LLM 配置 ========== + // + // 设计思路(DB 优先 + 即时生效): + // - DB 是单一可信源(与 PHP 端 AiRuntimeConfigService 同源) + // - yaml/env 仅作为 DB 不可用时的兜底(如本地开发没连库) + // - 启动期不做"全量 merge"——改为运行时按需解析(dao.LoadActiveLLMConfig), + // 这样后台切完模型配置 60s 内全集群生效,无需重启 Go 进程 + // + // 启动期仍然保留 mergeDBLLMConfigs 的意义: + // - 让 EnhanceService 走 DB 解析失败时(如 DB 抖动)能回落到一份"最新已知"配置, + // 而不是 yaml 默认的 deepseek + // - 同时把 ollama 等本地模型(DB 中没有)的配置补全 + if cfg.DB.DSN != "" { + if err := dao.Init(cfg.DB.DSN); err != nil { + // DB 连不上不致命:降级用 yaml/env 配置继续启动 + log.Printf("[启动] ⚠️ z_xk 库连接失败,将使用 yaml/env 配置: %v", err) + } else { + // ★ 关键:注入 AES 主密钥,让 dao 能解密 api_key + // 不注入的话 LoadActiveLLMConfig 会直接报错,整个"DB 优先"链路失效 + dao.SetEncryptKey(cfg.DB.EncryptKey) + log.Printf("[启动] ✅ z_xk 库连接成功,已注入 AES 主密钥,DB 优先链路就绪") + + // 仍然保留 mergeDBLLMConfigs 作为"启动期一次性 merge"—— + // 它把所有平台配置塞进 cfg.LLM.Models,作为 EnhanceService DB 解析失败时的兜底 + if err := mergeDBLLMConfigs(cfg); err != nil { + log.Printf("[启动] ⚠️ 从 DB 加载 LLM 配置失败(不影响运行时解析): %v", err) + } else { + log.Printf("[启动] ↳ 启动期 merge 完成(运行时仍按需实时解析)") + } + } + } else { + log.Printf("[启动] ⚠️ 未配置 DB.DSN,使用 yaml/env 配置(生产环境必须配置 DSN)") + } + + // ========== ③ 初始化 LLM 层(工厂 + 路由 + 降级) ========== + // + // 这是本次升级的核心: + // - ProviderFactory:注册所有模型供应商(DeepSeek/OpenAI/Azure/Ollama/Qwen) + // - ModelRouter:按场景名(emr-generator/prescription 等)路由到对应模型 + // - FallbackChain:主模型挂了自动切备用 + // + // 所有 Agent 通过 Router 获取模型,不直接依赖具体供应商。 + llmRouter, fallback, factory := llm.InitLLM(cfg) + + // 打印路由表(方便排查) + log.Println("[启动] 模型路由表:") + for scene, provider := range llmRouter.ListRoutes() { + log.Printf(" %-20s → %s", scene, provider) + } + + // ========== ③ 初始化 Agent 引擎 ========== + // + // Runner 通过 llmRouter 动态获取模型: + // - 病历 Agent → 路由到 "emr-generator" → DeepSeek + // - 处方 Agent → 路由到 "prescription" → GPT-4o + // + // 如果某个模型 API 挂了,FallbackChain 会自动切到备用模型。 + agentRunner := agent.InitRunner(llmRouter, fallback, cfg) + + // ========== ④ 初始化 HTTP 路由 ========== + r := router.Setup(agentRunner, cfg, llmRouter) + + // ========== ④.5 启动药品抓取定时调度器 ========== + // 依赖 DB(任务表/知识库表都在 z_xk):DB 没连上时不启动, + // 面板的抓取任务页会明确报"DB 未初始化",不影响其他功能 + if dao.DB != nil { + service.StartCrawlScheduler() + } + + // ========== ⑤ 启动 HTTP 服务(优雅启停) ========== + srv := &http.Server{ + Addr: ":" + cfg.Server.Port, + Handler: r, + // ---------- 稳定性加固:防慢连接占死服务 ---------- + // ReadHeaderTimeout:读完请求头的最长时间,防 Slowloris 攻击 + ReadHeaderTimeout: 10 * time.Second, + // ReadTimeout:读完整个请求体的最长时间(enhance 请求体最大几十 KB,60s 绰绰有余) + ReadTimeout: 60 * time.Second, + // WriteTimeout:从读完请求到写完响应的最长时间。 + // 必须大于最长的 LLM 调用链(ReactLoop 多轮 + fallback 可能超过 2 分钟), + // 设 300s 兜底:超过说明彻底卡死,强制断开释放连接 + WriteTimeout: 300 * time.Second, + // IdleTimeout:keep-alive 空闲连接保留时间 + IdleTimeout: 120 * time.Second, + } + + go func() { + log.Printf("[启动] ✅ 中医 AI Agent 服务已启动,监听端口 :%s", cfg.Server.Port) + log.Printf("[启动] 已注册模型供应商: %v", factory.ListProviders()) + if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { + log.Fatalf("[致命] 服务启动失败: %v", err) + } + }() + + // 等待中断信号 + quit := make(chan os.Signal, 1) + signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) + <-quit + + log.Println("[关闭] 正在优雅关闭服务...") + + // 关闭模型连接 + llmRouter.Close() + + // 关闭 HTTP 服务(30 秒超时) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + srv.Shutdown(ctx) + + log.Println("[关闭] ✅ 服务已安全停止") + fmt.Println("再见!") +} + +// mergeDBLLMConfigs 从 DB 加载 LLM 配置,覆盖 cfg.LLM.Models +// +// 覆盖规则: +// - DB 中存在的 provider(如 spark/deepseek):完全替换 yaml 同名条目(DB 是可信源) +// - DB 中没有的 provider(如 ollama 本地):保留 yaml 中的配置 +// - DB 提供 APIKey/APIURL/Model,timeout/embedding_model 等保留 yaml 值(DB 没存) +// +// 关键:额外读 xk_system_config 的全局激活组合(ai_active_provider / ai_active_api_key_id / +// ai_active_model),它优先级最高——后台运维跨平台指定的"激活组合"会覆盖平台默认值。 +// 这是 PHP AiRuntimeConfigService::resolve() 的核心逻辑,Go 端必须复刻, +// 否则会出现"后台切了平台但 Go Agent 还用 yaml 默认平台"的不一致。 +func mergeDBLLMConfigs(cfg *config.Config) error { + dbCfgs, err := dao.LoadLLMConfigsFromDB(cfg.DB.EncryptKey) + if err != nil { + return err + } + + for provider, db := range dbCfgs { + // 取出 yaml 已有条目(可能不存在,先准备一个空模板) + yamlCfg, exists := cfg.LLM.Models[provider] + if !exists { + yamlCfg = config.LLMConfigEx{Timeout: 120} + } + + // 用 DB 值覆盖关键字段 + yamlCfg.Provider = provider + yamlCfg.APIKey = db.APIKey + if db.APIURL != "" { + yamlCfg.BaseURL = db.APIURL + } + if db.Model != "" { + yamlCfg.Model = db.Model + } + cfg.LLM.Models[provider] = yamlCfg + + log.Printf("[启动] ↳ DB 覆盖: %s → model=%s api_key_id=%d", provider, db.Model, db.APIKeyID) + } + + // ===== 读全局激活组合,覆盖 yaml 路由表 ===== + // 这一步是 Go Agent "尊重后台运维选择"的关键: + // - 后台"模型配置"Tab 保存的 ai_active_provider 会被设到 cfg.LLM.DefaultProvider, + // 让 EnhanceService 在 scene 未命中路由表时回落到这个 provider(而不是 yaml 写死的 deepseek) + // - 后台指定的 api_key_id / model 会覆盖对应 provider 的字段, + // 保证 Go 调 LLM 时用的就是后台选中的具体 key/model + // + // 语义说明(2026-08-11 重构后): + // ai_active_provider 永远是真实 provider(spark/deepseek/...), + // "是否走 Go Agent 中转"由 PHP 端独立开关 ai_agent_via_agent 控制, + // Go 端被调用时已经是"我要用真实模型",这里不再处理 agent 短路。 + active, err := dao.LoadActiveSelection() + if err != nil { + log.Printf("[启动] ⚠️ 读取全局激活组合失败,将仅使用平台默认值: %v", err) + } else if active != nil && active.Provider != "" { + // 仅当激活的 provider 在配置中存在时才覆盖 + if _, ok := cfg.LLM.Models[active.Provider]; ok { + // 覆盖默认 provider,让 EnhanceService 走后台选中的平台 + cfg.LLM.DefaultProvider = active.Provider + log.Printf("[启动] ↳ 全局激活: provider=%s", active.Provider) + + // 用后台指定的 key/model 覆盖该 provider 的字段 + if active.Model != "" || active.APIKeyID > 0 { + pCfg := cfg.LLM.Models[active.Provider] + if active.Model != "" { + pCfg.Model = active.Model + log.Printf("[启动] ↳ 激活 model 覆盖: %s → %s", active.Provider, active.Model) + } + if active.APIKeyID > 0 { + // 按 api_key_id 反查对应明文 key(DB 中存的可能是非默认 key) + if plain, err := dao.GetAPIKeyByID(active.APIKeyID, cfg.DB.EncryptKey); err == nil && plain != "" { + pCfg.APIKey = plain + log.Printf("[启动] ↳ 激活 api_key_id 覆盖: %s → key_id=%d", active.Provider, active.APIKeyID) + } else if err != nil { + log.Printf("[启动] ⚠️ 取激活 api_key_id=%d 失败: %v(保留平台默认 key)", active.APIKeyID, err) + } + } + cfg.LLM.Models[active.Provider] = pCfg + } + } + } + + return nil +} diff --git a/manifest/config/config.yaml b/manifest/config/config.yaml new file mode 100644 index 0000000..cc72bc2 --- /dev/null +++ b/manifest/config/config.yaml @@ -0,0 +1,147 @@ +# ============================================================================ +# 中医 AI Agent 系统配置文件 +# ============================================================================ +# 核心升级:LLM 支持多模型池 + 场景路由 + 降级链 +# +# 修改此文件后无需改代码,Agent 会自动使用新配置的模型。 +# ============================================================================ + +# ========== HTTP 服务配置 ========== +server: + port: "18123" + +# ========== 本地知识库配置(V1 用 noop,V2 接 BGE-M3) ========== +kb: + # /kb/view 后台管理页访问口令(HTTP Basic Auth 密码) + # 用户名固定 admin,密码在这里填。生产环境改强口令。 + admin_password: "qiqi991012" + +# ========== MaxKB 知识库配置 ========== +maxkb: + base_url: "https://agent.nailaoyun.cn/chat/api/019fee3f-a6bf-7592-9a7a-4003b4beed1e" + api_key: "agent-18351a765802a68bd35cf6e0f989bde0" + app_id: "xxxxxxxx-xxxx-xxxx" + +# ========== 多模型 LLM 配置(核心) ========== +llm: + # 默认供应商(找不到路由时使用) + default_provider: "deepseek" + + # ---------- 模型池:定义所有可用的模型 ---------- + models: + # 模型1:DeepSeek(病历生成主力) + deepseek: + provider: "deepseek" + api_key: "sk-xxxxxxxx" + base_url: "https://api.deepseek.com" + model: "deepseek-chat" # 可选: deepseek-chat / deepseek-reasoner + timeout: 120 + + # 模型2:OpenAI(处方校验/高质量推理) + openai: + provider: "openai" + api_key: "sk-xxxxxxxx" + base_url: "https://api.openai.com/v1" + model: "gpt-4o" # 可选: gpt-4o / gpt-4o-mini / o1-preview + embedding_model: "text-embedding-3-small" + timeout: 120 + + # 模型3:Azure OpenAI(企业合规部署) + azure: + provider: "azure" + api_key: "xxxxxxxxxxxxxxxx" + base_url: "https://my-resource.openai.azure.com" + model: "gpt-4o" # Azure 中对应的 deployment 名 + timeout: 120 + extra: + deployment: "gpt-4o-deployment" + api_version: "2024-06-01" + + # 模型4:通义千问(中文医疗场景) + qwen: + provider: "qwen" + api_key: "sk-xxxxxxxx" + base_url: "https://dashscope.aliyuncs.com/compatible-mode/v1" + model: "qwen-max" # 可选: qwen-max / qwen-plus / qwen-turbo / qwen-long + timeout: 120 + + # 模型5:讯飞星火(OpenAPI 协议,与 PHP 端 SparkAiAgent 一致) + spark: + provider: "spark" + api_key: "xxxxxxxxxxxxxxxxxxxxxxxx" # APIPassword(与 .env SPARK_API_PASSWORD 同源) + base_url: "https://spark-api-open.xf-yun.com/v1/chat/completions" + model: "spark-lite" # 可选: spark-lite / spark-pro / spark-max / spark-medicine + timeout: 120 + + # 模型6:Ollama 本地模型(离线/内网) + ollama: + provider: "ollama" + base_url: "http://localhost:11434" + model: "qwen2.5:72b" # 本地拉取的模型名 + timeout: 300 # 本地推理可能较慢 + + # 模型7:Embedding 专用 + embedding: + provider: "openai" + api_key: "sk-xxxxxxxx" + base_url: "https://api.openai.com/v1" + model: "text-embedding-3-small" + timeout: 60 + + # ---------- 场景路由:业务场景 → 用哪个模型 ---------- + # 注意:PHP TcmAgentClient 透传过来的 scene 名是 medical_record / prescription, + # Go 内部端点(/api/v1/emr/generate)用的是 emr-generator。 + # 两套名字都必须在这里注册,否则 PHP 调过来会走默认 provider。 + routes: + medical_record: "deepseek" # 病历生成(PHP 业务侧命名) + prescription: "openai" # 处方校验 → GPT-4o(推理严谨) + emr-generator: "deepseek" # 病历生成(Go 内部命名) + knowledge-qa: "qwen" # 知识问答 → 通义千问(中文检索好) + embedding: "embedding" # 向量化 → 专用 Embedding 模型 + fallback: "ollama" # 降级兜底 → 本地模型 + + # ---------- 降级链:主模型挂了按序切换 ---------- + fallback_chains: + # PHP 业务场景名(与 routes 对齐) + medical_record: + - "deepseek" + - "qwen" + - "ollama" + # Go 内部场景名 + emr-generator: + - "deepseek" + - "qwen" + - "ollama" + prescription: + - "openai" + - "deepseek" + - "ollama" + knowledge-qa: + - "qwen" + - "deepseek" + +# ========== 数据库配置 ========== +# 直连萧康云医 z_xk 库读取 xk_ai_* 配置表 +# parseTime=true 必填,否则 GORM 无法把 DATETIME 转成 time.Time +# loc=Local 让时间用本机时区(生产建议 Asia/Shanghai) +db: + dsn: "root:root@tcp(127.0.0.1:3306)/z_xk?charset=utf8mb4&parseTime=true&loc=Local" + # AES 主密钥(与 PHP .env ENCRYPT_KEY 同源,用于解密 xk_ai_api_key.api_key) + # 生产环境通过 K8s Secret / .env 注入,不要写死在这里 + encrypt_key: "3a8f9b2d7c1e4f8a9b2d7c1e4f8a9b2d7c1e4f8a9b2d7c1e4f8a9b2d7c1e4f8a" + +# ========== Agent 引擎配置 ========== +agent: + max_iterations: 10 # Agent 最大推理轮数(防止无限循环) + timeout: 120 # 单次 Agent 调用超时(秒) + + # 鉴权密钥(与 PHP 后台 ai_agent_secret 对应,双轨制) + # PHP TcmAgentClient 把 shared_secret 的值塞进 Authorization: Bearer xxx + # Go middleware.Auth 拿到后直接字符串比对,无需签发 JWT + # 留空则放行无 Token 请求(仅限纯内网调试,生产环境必填) + shared_secret: "qiqi991012" + + # JWT 签名密钥(严格 HS256 校验,适合小程序直连场景) + # 留空则禁用 JWT 路径,仅启用 SharedSecret 模式 + # 也可用环境变量 AGENT_JWT_SECRET 覆盖 + jwt_secret: "" diff --git a/manifest/docker/Dockerfile b/manifest/docker/Dockerfile new file mode 100644 index 0000000..a212316 --- /dev/null +++ b/manifest/docker/Dockerfile @@ -0,0 +1,42 @@ +# ===== 多阶段构建 ===== +# 阶段1:构建 +FROM golang:1.22-alpine AS builder + +WORKDIR /build + +# 复制go.mod和go.sum +COPY go.mod go.sum ./ +RUN go mod download + +# 复制源代码 +COPY . . + +# 编译(静态链接,不依赖glibc) +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o tcm-agent main.go + +# 阶段2:运行 +FROM alpine:3.19 + +# 安装CA证书(HTTPS请求需要) +RUN apk --no-cache add ca-certificates tzdata + +# 设置时区 +ENV TZ=Asia/Shanghai + +WORKDIR /app + +# 从构建阶段复制二进制 +COPY --from=builder /build/tcm-agent . + +# 复制配置文件 +COPY manifest/config/config.yaml ./manifest/config/config.yaml + +# 暴露端口 +EXPOSE 8080 + +# 健康检查 +HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ + CMD wget -qO- http://localhost:8080/health || exit 1 + +# 启动 +CMD ["./tcm-agent"] diff --git a/manifest/docker/docker-compose.yml b/manifest/docker/docker-compose.yml new file mode 100644 index 0000000..ce495dd --- /dev/null +++ b/manifest/docker/docker-compose.yml @@ -0,0 +1,68 @@ +version: "3.9" + +services: + # ========== MaxKB 知识库平台 ========== + maxkb: + image: 1panel/maxkb:latest + container_name: maxkb + ports: + - "8080:8080" + volumes: + - maxkb_data:/app/data + environment: + - MAXKB_PORT=8080 + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"] + interval: 30s + timeout: 5s + retries: 3 + + # ========== MySQL 数据库 ========== + mysql: + image: mysql:8.0 + container_name: tcm-mysql + ports: + - "3306:3306" + environment: + MYSQL_ROOT_PASSWORD: tcm123456 + MYSQL_DATABASE: tcm_agent + MYSQL_CHARSET: utf8mb4 + volumes: + - mysql_data:/var/lib/mysql + restart: unless-stopped + + # ========== 向量数据库(可选,用于长期记忆) ========== + milvus: + image: milvusdb/milvus:latest + container_name: tcm-milvus + ports: + - "19530:19530" + volumes: + - milvus_data:/var/lib/milvus + restart: unless-stopped + + # ========== Go Agent 服务 ========== + agent: + build: + context: ../.. + dockerfile: manifest/docker/Dockerfile + container_name: tcm-agent + ports: + - "9000:8080" + environment: + - SERVER_PORT=8080 + - MAXKB_API_KEY=${MAXKB_API_KEY:-your-key-here} + - LLM_API_KEY=${LLM_API_KEY:-your-key-here} + - DB_DSN=root:tcm123456@tcp(mysql:3306)/tcm_agent?charset=utf8mb4 + depends_on: + maxkb: + condition: service_healthy + mysql: + condition: service_started + restart: unless-stopped + +volumes: + maxkb_data: + mysql_data: + milvus_data: diff --git a/test/agent_test.go b/test/agent_test.go new file mode 100644 index 0000000..9fe7149 --- /dev/null +++ b/test/agent_test.go @@ -0,0 +1,510 @@ +package test + +import ( + "context" + "encoding/json" + "testing" + + "tcm-agent/internal/agent" + "tcm-agent/internal/config" + "tcm-agent/internal/llm" + "tcm-agent/internal/rule" +) + +// ======================================================================== +// 测试文件 +// ======================================================================== +// 覆盖: +// - 模型工厂注册和创建 +// - 模型路由(场景→模型) +// - 降级链 +// - Agent 会话管理 +// - 规则引擎(十八反/十九畏/孕妇/过敏)— 使用 rule 包独立类型 +// - 结构化 JSON 序列化 +// - 配置加载(多模型) +// ======================================================================== + +// ---------- 辅助函数 ---------- + +// newTestConfig 创建测试用配置(多模型) +func newTestConfig() *config.Config { + return &config.Config{ + Server: config.ServerConfig{Port: "8080"}, + MaxKB: config.MaxKBConfig{ + BaseURL: "http://mock", APIKey: "test", AppID: "test", + }, + LLM: config.LLMConfig{ + DefaultProvider: "mock-primary", + Models: map[string]config.LLMConfigEx{ + "mock-primary": { + Provider: "mock", APIKey: "test", + BaseURL: "http://mock", Model: "mock-model-1", + }, + "mock-backup": { + Provider: "mock", APIKey: "test", + BaseURL: "http://mock", Model: "mock-model-2", + }, + "deepseek": { + Provider: "deepseek", APIKey: "test", + BaseURL: "http://mock", Model: "deepseek-chat", + }, + }, + Routes: map[string]string{ + "emr-generator": "mock-primary", + "prescription": "mock-primary", + "knowledge-qa": "deepseek", + }, + FallbackChains: map[string][]string{ + "emr-generator": {"mock-primary", "mock-backup"}, + }, + }, + Agent: config.AgentConfig{MaxIterations: 5, Timeout: 30}, + } +} + +// newTestRouter 创建测试用模型路由 +func newTestRouter(cfg *config.Config) (*llm.ModelRouter, *llm.FallbackChain) { + configs := make(map[string]*config.LLMConfigEx) + for name, m := range cfg.LLM.Models { + m2 := m + configs[name] = &m2 + } + factory := llm.NewProviderFactory(configs) + router := llm.NewModelRouter(factory, cfg.LLM.Routes, cfg.LLM.DefaultProvider) + fallback := llm.NewFallbackChain(router, cfg.LLM.FallbackChains) + return router, fallback +} + +// ---------- 模型工厂测试 ---------- + +// TestProviderFactory 测试工厂注册和创建 +func TestProviderFactory(t *testing.T) { + cfg := newTestConfig() + configs := make(map[string]*config.LLMConfigEx) + for name, m := range cfg.LLM.Models { + m2 := m + configs[name] = &m2 + } + + factory := llm.NewProviderFactory(configs) + + // 验证内置供应商已注册 + providers := factory.ListProviders() + t.Logf("已注册供应商: %v", providers) + + expectedProviders := []string{"deepseek", "openai", "azure", "ollama", "qwen", "mock"} + for _, ep := range expectedProviders { + found := false + for _, p := range providers { + if p == ep { + found = true + break + } + } + if !found { + t.Errorf("供应商 %s 未注册", ep) + } + } + + // 验证创建客户端 + client, err := factory.Create("deepseek") + if err != nil { + t.Fatalf("创建 DeepSeek 客户端失败: %v", err) + } + if client.Provider() != "deepseek" { + t.Errorf("期望 provider=deepseek, 实际=%s", client.Provider()) + } + if !client.Supports(llm.CapFunctionCalling) { + t.Error("DeepSeek 应支持 function_calling") + } + t.Logf("✅ DeepSeek 客户端创建成功: %s", client.Name()) + client.Close() + + // 验证未知供应商报错 + _, err = factory.Create("unknown-provider") + if err == nil { + t.Error("未知供应商应返回错误") + } + t.Logf("✅ 未知供应商正确报错: %v", err) +} + +// TestCustomProvider 测试注册自定义供应商 +func TestCustomProvider(t *testing.T) { + configs := make(map[string]*config.LLMConfigEx) + configs["custom"] = &config.LLMConfigEx{ + Provider: "custom", APIKey: "test", Model: "my-model", + } + factory := llm.NewProviderFactory(configs) + + // 注册自定义创建函数 + factory.Register("custom", func(cfg *config.LLMConfigEx) (llm.LLMClient, error) { + return &mockClientForTest{name: cfg.Model, provider: "custom"}, nil + }) + + client, err := factory.Create("custom") + if err != nil { + t.Fatalf("创建自定义客户端失败: %v", err) + } + if client.Name() != "my-model" { + t.Errorf("期望 name=my-model, 实际=%s", client.Name()) + } + t.Logf("✅ 自定义供应商注册成功") + client.Close() +} + +// ---------- 模型路由测试 ---------- + +// TestModelRouter 测试场景路由 +func TestModelRouter(t *testing.T) { + cfg := newTestConfig() + router, _ := newTestRouter(cfg) + + // 验证路由表 + routes := router.ListRoutes() + for scene, provider := range routes { + t.Logf("路由: %-20s → %s", scene, provider) + } + + // 验证获取客户端 + client, err := router.Get("emr-generator") + if err != nil { + t.Fatalf("路由获取失败: %v", err) + } + if client.Provider() != "mock" { + t.Errorf("期望 mock provider, 实际=%s", client.Provider()) + } + t.Logf("✅ 路由 emr-generator → %s", client.Name()) + + // 验证未知场景使用默认 + client2, err := router.Get("unknown-scene") + if err != nil { + t.Fatalf("默认路由失败: %v", err) + } + t.Logf("✅ 未知场景使用默认 → %s", client2.Name()) + + router.Close() +} + +// TestDynamicRoute 测试动态注册路由 +func TestDynamicRoute(t *testing.T) { + cfg := newTestConfig() + router, _ := newTestRouter(cfg) + + router.RegisterRoute("new-scene", "deepseek") + routes := router.ListRoutes() + if routes["new-scene"] != "deepseek" { + t.Error("动态路由注册失败") + } + t.Logf("✅ 动态路由注册成功: new-scene → deepseek") + + router.Close() +} + +// ---------- 降级链测试 ---------- + +// TestFallbackChain 测试降级 +func TestFallbackChain(t *testing.T) { + cfg := newTestConfig() + router, fallback := newTestRouter(cfg) + + // 降级链存在 + resp, err := fallback.ChatWithFallback(context.Background(), "emr-generator", nil, nil) + if err != nil { + t.Logf("降级链执行(预期可能有错误,因为 mock 模式): %v", err) + } else { + t.Logf("✅ 降级链成功: %s", resp.Content) + } + + router.Close() +} + +// ---------- Agent 会话管理测试 ---------- + +// TestAgentSessionLifecycle 测试完整会话生命周期 +func TestAgentSessionLifecycle(t *testing.T) { + cfg := newTestConfig() + router, fallback := newTestRouter(cfg) + runner := agent.InitRunner(router, fallback, cfg) + + // 创建会话 + session := runner.CreateSession("test-doctor", "emr-generator") + if session.ID == "" { + t.Fatal("会话 ID 不能为空") + } + if session.UserID != "test-doctor" { + t.Errorf("期望 user_id=test-doctor, 实际=%s", session.UserID) + } + if session.Scene != "emr-generator" { + t.Errorf("期望 scene=emr-generator, 实际=%s", session.Scene) + } + t.Logf("✅ 会话创建成功: ID=%s, Scene=%s", session.ID, session.Scene) + + // 获取会话 + got, ok := runner.GetSession(session.ID) + if !ok { + t.Fatal("无法获取已创建的会话") + } + if got.Status != "running" { + t.Errorf("期望 status=running, 实际=%s", got.Status) + } + + // 删除会话 + runner.DeleteSession(session.ID) + _, ok = runner.GetSession(session.ID) + if ok { + t.Error("删除后会话应不存在") + } + t.Logf("✅ 会话删除成功") + + router.Close() +} + +// TestAgentToolRegistration 测试工具注册 +func TestAgentToolRegistration(t *testing.T) { + cfg := newTestConfig() + router, fallback := newTestRouter(cfg) + runner := agent.InitRunner(router, fallback, cfg) + + tools := runner.ListTools() + t.Logf("已注册工具: %v", tools) + + expectedTools := []string{"maxkb_retrieve", "his_query", "pharmacopoeia_query", "rule_check"} + for _, et := range expectedTools { + found := false + for _, toolName := range tools { + if toolName == et { + found = true + break + } + } + if !found { + t.Errorf("工具 %s 未注册", et) + } + } + t.Logf("✅ 默认工具全部注册成功 (%d 个)", len(tools)) + + router.Close() +} + +// ---------- 规则引擎测试(使用 rule 包独立类型)---------- + +// TestEighteenAnti 专项测试:十八反 +func TestEighteenAnti(t *testing.T) { + tests := []struct { + name string + prescription string + shouldBlock bool + }{ + {"甘草反甘遂", "甘草6g 甘遂3g", true}, + {"甘草反大戟", "甘草6g 大戟3g", true}, + {"乌头反贝母", "乌头5g 贝母6g", true}, + {"藜芦反人参", "藜芦3g 人参10g", true}, + {"正常处方", "桂枝10g 白芍10g 甘草6g", false}, + } + + validator := rule.NewPrescriptionValidator() + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + patient := &rule.PatientInfo{} + warnings, blocked := validator.Validate(tt.prescription, patient) + if blocked != tt.shouldBlock { + t.Errorf("[%s] 期望 blocked=%v, 实际=%v, warnings=%v", + tt.name, tt.shouldBlock, blocked, warnings) + } else { + t.Logf("✓ [%s] blocked=%v, warnings=%v", tt.name, blocked, warnings) + } + }) + } +} + +// TestNineteenFear 测试:十九畏 +func TestNineteenFear(t *testing.T) { + tests := []struct { + name string + prescription string + }{ + {"硫黄畏朴硝", "硫黄3g 朴硝6g"}, + {"丁香畏郁金", "丁香3g 郁金10g"}, + {"巴豆畏牵牛", "巴豆3g 牵牛10g"}, + } + + validator := rule.NewPrescriptionValidator() + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + patient := &rule.PatientInfo{} + warnings, blocked := validator.Validate(tt.prescription, patient) + if !blocked { + t.Errorf("[%s] 应被拦截但未拦截, warnings=%v", tt.name, warnings) + } else { + t.Logf("✓ [%s] 正确拦截: %v", tt.name, warnings) + } + }) + } +} + +// TestPregnancyRisk 测试:孕妇禁忌(使用 rule.PatientInfo) +func TestPregnancyRisk(t *testing.T) { + tests := []struct { + name string + prescription string + shouldBlock bool + }{ + {"孕妇禁用桃仁", "桃仁9g 红花6g", true}, + {"孕妇慎用大黄", "大黄6g 芒硝3g", false}, // 慎用不拦截 + {"正常处方", "桂枝10g 白芍10g", false}, + } + + validator := rule.NewPrescriptionValidator() + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + patient := &rule.PatientInfo{IsPregnant: true} + warnings, blocked := validator.Validate(tt.prescription, patient) + if blocked != tt.shouldBlock { + t.Errorf("[%s] 期望 blocked=%v, 实际=%v, warnings=%v", + tt.name, tt.shouldBlock, blocked, warnings) + } else { + t.Logf("✓ [%s] blocked=%v, warnings=%v", tt.name, blocked, warnings) + } + }) + } +} + +// TestAllergyCheck 测试:过敏史冲突 +func TestAllergyCheck(t *testing.T) { + validator := rule.NewPrescriptionValidator() + patient := &rule.PatientInfo{Allergies: []string{"麻黄"}} + + warnings, blocked := validator.Validate("麻黄9g 杏仁6g", patient) + if !blocked { + t.Error("过敏冲突应被拦截") + } + if len(warnings) == 0 { + t.Error("应产生警告") + } + t.Logf("✅ 过敏检查正确拦截: %v", warnings) +} + +// TestEMRQualityChecker 测试病历质控(使用 rule 包) +func TestEMRQualityChecker(t *testing.T) { + checker := rule.NewEMRQualityChecker() + + // 完整病历应通过 + goodEMR := `主诉:反复头晕3个月 +现病史:患者3个月前出现头晕 +舌象:舌质暗红,苔白腻 +脉象:脉弦滑 +诊断:痰湿中阻证` + issues := checker.Check(goodEMR) + if len(issues) > 0 { + t.Errorf("完整病历不应有问题: %v", issues) + } + t.Logf("✅ 完整病历质控通过") + + // 缺失字段应被检出 + badEMR := "患者头晕,开了点药。" + issues = checker.Check(badEMR) + if len(issues) == 0 { + t.Error("缺失字段应被检出") + } + t.Logf("✅ 缺失字段正确检出: %v", issues) +} + +// ---------- JSON 序列化测试 ---------- + +// TestStructToJSON 测试 API 响应格式 +func TestStructToJSON(t *testing.T) { + resp := &agent.PrescriptionResponse{ + SessionID: "sess-123", + Draft: "桂枝汤:桂枝10g...", + Warnings: []string{}, + Blocked: false, + Status: "success", + Prescription: &agent.Prescription{ + FormulaName: "桂枝汤", + Herbs: []agent.Herb{ + {Name: "桂枝", Dose: 10, Unit: "g"}, + {Name: "白芍", Dose: 10, Unit: "g"}, + }, + Instructions: "水煎服,日一剂", + Duration: 7, + }, + } + + data, err := json.MarshalIndent(resp, "", " ") + if err != nil { + t.Fatalf("JSON 序列化失败: %v", err) + } + + t.Logf("API 响应 JSON 示例:\n%s", string(data)) + + // 验证关键字段 + var parsed map[string]any + json.Unmarshal(data, &parsed) + if parsed["status"] != "success" { + t.Error("status 字段不正确") + } + if parsed["blocked"] != false { + t.Error("blocked 字段不正确") + } +} + +// ---------- 配置加载测试 ---------- + +// TestConfigLoading 测试多模型配置加载 +func TestConfigLoading(t *testing.T) { + cfg := newTestConfig() + + // 验证模型池 + if len(cfg.LLM.Models) != 3 { + t.Errorf("期望 3 个模型,实际 %d 个", len(cfg.LLM.Models)) + } + + // 验证默认供应商 + if cfg.LLM.DefaultProvider != "mock-primary" { + t.Errorf("期望默认=mock-primary, 实际=%s", cfg.LLM.DefaultProvider) + } + + // 验证路由 + if cfg.LLM.Routes["emr-generator"] != "mock-primary" { + t.Error("emr-generator 路由不正确") + } + + // 验证降级链 + chain, ok := cfg.LLM.FallbackChains["emr-generator"] + if !ok || len(chain) != 2 { + t.Error("降级链配置不正确") + } + + t.Logf("✅ 配置加载正确 | 模型数:%d | 路由数:%d", + len(cfg.LLM.Models), len(cfg.LLM.Routes)) +} + +// ======================================================================== +// 测试辅助 +// ======================================================================== + +// mockClientForTest 测试用自定义客户端 +type mockClientForTest struct { + name string + provider string +} + +func (m *mockClientForTest) Chat(ctx context.Context, messages []agent.Message, tools []agent.Tool) (*agent.Message, error) { + return &agent.Message{Role: "assistant", Content: "mock reply", Timestamp: 123}, nil +} +func (m *mockClientForTest) StreamChat(ctx context.Context, messages []agent.Message, tools []agent.Tool) (<-chan string, error) { + ch := make(chan string, 1) + ch <- "mock" + close(ch) + return ch, nil +} +func (m *mockClientForTest) Embed(ctx context.Context, texts []string) ([][]float32, error) { + return make([][]float32, len(texts)), nil +} +func (m *mockClientForTest) Name() string { return m.name } +func (m *mockClientForTest) Provider() string { return m.provider } +func (m *mockClientForTest) Supports(cap string) bool { return true } +func (m *mockClientForTest) Close() error { return nil } diff --git a/tools/applysql/main.go b/tools/applysql/main.go new file mode 100644 index 0000000..d86b5ea --- /dev/null +++ b/tools/applysql/main.go @@ -0,0 +1,85 @@ +// applysql —— 开发辅助工具:把 SQL 文件应用到 z_xk 库 +// +// 为什么需要它:Windows 开发机没有 mysql 客户端,而 Go 项目本身带着 +// GORM 依赖与 config.Load() 的 DSN 解析逻辑,直接复用即可执行 DDL, +// 且凭据不经过命令行/控制台(从 manifest/config/config.yaml 读取)。 +// +// 用法(必须在 nl-tcm-agent 项目根目录执行,保证能读到配置文件): +// go run ./tools/applysql [sql文件2 ...] +// +// 说明: +// - 按 ";\n" 粗粒度拆分语句(我们自己的 SQL 文件都是规范的分号+换行结尾) +// - "--" 开头的注释行会被剥掉 +// - 任一语句失败立即退出(DDL 顺序有依赖,跳过会导致后续更混乱) +package main + +import ( + "fmt" + "log" + "os" + "strings" + + "tcm-agent/internal/config" + "tcm-agent/internal/dao" +) + +func main() { + if len(os.Args) < 2 { + log.Fatal("用法: go run ./tools/applysql ") + } + cfg := config.Load() + if cfg.DB.DSN == "" { + log.Fatal("配置缺少 db.dsn(检查 manifest/config/config.yaml)") + } + if err := dao.Init(cfg.DB.DSN); err != nil { + log.Fatalf("连接数据库失败: %v", err) + } + for _, path := range os.Args[1:] { + raw, err := os.ReadFile(path) + if err != nil { + log.Fatalf("读取 %s 失败: %v", path, err) + } + stmts := splitStatements(string(raw)) + fmt.Printf("== %s:%d 条语句 ==\n", path, len(stmts)) + for i, stmt := range stmts { + if err := dao.DB.Exec(stmt).Error; err != nil { + log.Fatalf("第 %d 条语句执行失败: %v\n语句片段: %.120s", i+1, err, stmt) + } + fmt.Printf(" [%d/%d] OK %.60s...\n", i+1, len(stmts), firstLine(stmt)) + } + } + fmt.Println("全部执行完成") +} + +// splitStatements 把 SQL 文本拆成可执行语句:剥注释行后按分号结尾切分 +func splitStatements(sqlText string) []string { + // Windows 编辑器写出的文件是 CRLF,先统一成 LF,否则 ";\n" 切分匹配不到 + sqlText = strings.ReplaceAll(sqlText, "\r\n", "\n") + var sb strings.Builder + for _, line := range strings.Split(sqlText, "\n") { + trimmed := strings.TrimSpace(line) + // 剥掉整行注释(字段内注释在行中不受影响) + if strings.HasPrefix(trimmed, "--") || trimmed == "" { + continue + } + sb.WriteString(line) + sb.WriteString("\n") + } + parts := strings.Split(sb.String(), ";\n") + out := make([]string, 0, len(parts)) + for _, p := range parts { + p = strings.TrimSpace(p) + if p != "" { + out = append(out, p) + } + } + return out +} + +// firstLine 取语句首行用于进度展示 +func firstLine(stmt string) string { + if i := strings.Index(stmt, "\n"); i > 0 { + return stmt[:i] + } + return stmt +} diff --git a/tools/p1smoke/main.go b/tools/p1smoke/main.go new file mode 100644 index 0000000..86f33a7 --- /dev/null +++ b/tools/p1smoke/main.go @@ -0,0 +1,53 @@ +// P1 冒烟验证工具(临时):验证金方 FULLTEXT 检索 + 别名归一索引 +// +// 用法:go run ./tools/p1smoke +// 验证点: +// 1. dao.GoldenFormulaSearch 在 BOOLEAN / NATURAL 两种模式下能命中 +// 2. kb.AliasIndex 能从爬取文档加载别名并做查询扩展 +package main + +import ( + "fmt" + "log" + + "tcm-agent/internal/config" + "tcm-agent/internal/dao" + "tcm-agent/internal/kb" +) + +func main() { + cfg := config.Load() + if cfg.DB.DSN == "" { + log.Fatal("配置缺少 db.dsn(检查 manifest/config/config.yaml)") + } + if err := dao.Init(cfg.DB.DSN); err != nil { + log.Fatalf("初始化 DB 失败: %v", err) + } + + // ---- 1. 金方检索(自然语言模式:整段证候)---- + fmt.Println("== 金方检索(NATURAL):恶寒发热 头痛 汗出 脉浮缓 ==") + hits, err := dao.GoldenFormulaSearch("恶寒发热 头痛 汗出 脉浮缓", 3, true) + if err != nil { + log.Fatalf("金方 NATURAL 检索失败: %v", err) + } + for _, h := range hits { + fmt.Printf(" [%.2f] %s | 主治: %.40s\n", h.Score, h.Name, h.IndicationTranslation) + } + + // ---- 2. 金方检索(BOOLEAN 模式:短关键词)---- + fmt.Println("== 金方检索(BOOLEAN):桂枝 ==") + hits2, err := dao.GoldenFormulaSearch("桂枝", 3, false) + if err != nil { + log.Fatalf("金方 BOOLEAN 检索失败: %v", err) + } + for _, h := range hits2 { + fmt.Printf(" [%.2f] %s\n", h.Score, h.Name) + } + + // ---- 3. 别名索引加载 + 查询扩展 ---- + fmt.Println("== 别名索引 ==") + idx := kb.GetAliasIndex() + q, appended := idx.ExpandQuery("患者常年脾虚,日常以淮山药、于术调理,近日恶寒") + fmt.Printf(" 扩展后查询: %s\n", q) + fmt.Printf(" 追加正名: %v\n", appended) +} diff --git a/tools/safetyseed/main.go b/tools/safetyseed/main.go new file mode 100644 index 0000000..906977d --- /dev/null +++ b/tools/safetyseed/main.go @@ -0,0 +1,274 @@ +// safetyseed —— P2 安全参照表初始化工具 +// +// 职责:从已爬取的药材知识文档(xk_kb_doc.source_type='crawl')解析 +// "临床应用/用法用量"中的常规剂量范围、"使用禁忌"中的孕妇禁忌级别, +// 写入 xk_tcm_safety_ref 表,作为 PHP 处方安全校验(标红)的数据源。 +// +// 用法(在 nl-tcm-agent 项目根目录):go run ./tools/safetyseed +// +// 幂等策略:按 name 唯一键 upsert;source='manual'(人工修正过)的行跳过 +// 不覆盖——爬取解析是"初始化",人工修正优先级更高。 +package main + +import ( + "encoding/json" + "fmt" + "log" + "regexp" + "strconv" + "strings" + "time" + + "tcm-agent/internal/config" + "tcm-agent/internal/dao" +) + +// docRow 从 xk_kb_doc 取的原料行 +type docRow struct { + Title string `gorm:"column:title"` + MetaJSON *string `gorm:"column:meta_json"` + Content string `gorm:"column:content"` +} + +// safetyRow 解析结果(对应 xk_tcm_safety_ref 一行) +type safetyRow struct { + Name string + AliasesJSON *string + DoseMin float64 + DoseMax float64 + DoseNote string + PregnancyLevel int + PregnancyNote string + TabooText string +} + +// reSection 提取"【标签】单行正文"(爬取入库时每段一行) +var reSection = regexp.MustCompile(`【([^】]+)】([^\n]*)`) + +// reDoseRange 剂量区间:"用量3~9克"、"用量1.5-4.5克"(容忍全半角波浪线/横线/至) +var reDoseRange = regexp.MustCompile(`用量\s*([0-9]+(?:\.[0-9]+)?)\s*[~~—-至-]\s*([0-9]+(?:\.[0-9]+)?)\s*克`) + +// reDoseSingle 单值剂量:"用量1.5克"(无区间时兜底) +var reDoseSingle = regexp.MustCompile(`用量\s*([0-9]+(?:\.[0-9]+)?)\s*克`) + +// reDecoctRange "煎汤,2~6克"式(老版条目"内服:煎汤,X~Y克"没有"用量"二字) +var reDecoctRange = regexp.MustCompile(`煎汤[,,]?\s*([0-9]+(?:\.[0-9]+)?)\s*[~~—-至-]\s*([0-9]+(?:\.[0-9]+)?)\s*克`) + +// rePregForbid / rePregCaution 孕妇禁忌级别 +// +// 容忍中间插入词("孕妇及月经过多者慎用"、"孕妇均禁服"), +// 限定 15 字内避免跨句误判("孕妇不宜……其他人慎用"这种不算孕妇慎用) +var rePregForbid = regexp.MustCompile(`孕妇[^。;!?\n]{0,15}?(禁用|禁服|忌用|忌服)`) +var rePregCaution = regexp.MustCompile(`孕妇[^。;!?\n]{0,15}?(慎用|慎服)`) + +func main() { + cfg := config.Load() + if cfg.DB.DSN == "" { + log.Fatal("配置缺少 db.dsn(检查 manifest/config/config.yaml)") + } + if err := dao.Init(cfg.DB.DSN); err != nil { + log.Fatalf("连接数据库失败: %v", err) + } + + // 1. 拉取全部爬取文档 + var docs []docRow + if err := dao.DB.Table("xk_kb_doc"). + Select("title, meta_json, content"). + Where("source_type = ? AND deleted_at = 0 AND status = 1", "crawl"). + Find(&docs).Error; err != nil { + log.Fatalf("查询爬取文档失败: %v", err) + } + fmt.Printf("爬取文档共 %d 篇,开始解析...\n", len(docs)) + + // 2. 逐篇解析 + rows := make([]safetyRow, 0, len(docs)) + doseCnt, pregCnt := 0, 0 + for _, d := range docs { + row := parseDoc(&d) + if row == nil { + continue + } + if row.DoseMax > 0 { + doseCnt++ + } + if row.PregnancyLevel > 0 { + pregCnt++ + } + rows = append(rows, *row) + } + fmt.Printf("解析完成:%d 行(含剂量 %d 行,孕妇禁忌 %d 行)\n", len(rows), doseCnt, pregCnt) + + // 3. upsert(source='manual' 的行不覆盖) + now := time.Now().Unix() + inserted, updated, skipped := 0, 0, 0 + for _, r := range rows { + var existing struct { + ID uint `gorm:"column:id"` + Source string `gorm:"column:source"` + } + err := dao.DB.Table("xk_tcm_safety_ref"). + Select("id, source"). + Where("name = ?", r.Name). + Take(&existing).Error + if err == nil && existing.Source == "manual" { + skipped++ + continue + } + values := map[string]any{ + "name": r.Name, + "aliases_json": r.AliasesJSON, + "dose_min": r.DoseMin, + "dose_max": r.DoseMax, + "dose_note": r.DoseNote, + "pregnancy_level": r.PregnancyLevel, + "pregnancy_note": r.PregnancyNote, + "taboo_text": r.TabooText, + "source": "zhongyoo", + "status": 1, + "updated_at": now, + "deleted_at": 0, + } + if err == nil { + if uerr := dao.DB.Table("xk_tcm_safety_ref").Where("id = ?", existing.ID).Updates(values).Error; uerr != nil { + log.Fatalf("更新 %s 失败: %v", r.Name, uerr) + } + updated++ + } else { + values["created_at"] = now + if ierr := dao.DB.Table("xk_tcm_safety_ref").Create(values).Error; ierr != nil { + log.Fatalf("插入 %s 失败: %v", r.Name, ierr) + } + inserted++ + } + } + fmt.Printf("入库完成:新建 %d,更新 %d,跳过人工行 %d\n", inserted, updated, skipped) +} + +// parseDoc 单篇文档 → 安全参照行(title 为空返回 nil) +func parseDoc(d *docRow) *safetyRow { + name := strings.TrimSpace(d.Title) + if name == "" { + return nil + } + row := &safetyRow{Name: name} + + // 别名直接复用爬取 meta_json.aliases(转成纯数组 JSON 存储) + if d.MetaJSON != nil { + var meta struct { + Aliases []string `json:"aliases"` + } + if json.Unmarshal([]byte(*d.MetaJSON), &meta) == nil && len(meta.Aliases) > 0 { + if b, err := json.Marshal(meta.Aliases); err == nil { + s := string(b) + row.AliasesJSON = &s + } + } + } + + // 按标签切段落 + sections := map[string]string{} + for _, m := range reSection.FindAllStringSubmatch(d.Content, -1) { + label := strings.TrimSpace(m[1]) + if _, ok := sections[label]; !ok { + sections[label] = strings.TrimSpace(m[2]) + } + } + + // 剂量:优先"临床应用",其次"用法用量"(老版条目标签) + doseText := sections["临床应用"] + if doseText == "" { + doseText = sections["用法用量"] + } + if doseText != "" { + parseDose(doseText, row) + } + + // 孕妇禁忌:主看"使用禁忌",没有时兜底扫剂量段(部分条目把禁忌写在临床应用里) + taboo := sections["使用禁忌"] + pregSource := taboo + if pregSource == "" { + pregSource = doseText + } + if pregSource != "" { + parsePregnancy(pregSource, row) + } + if taboo != "" { + row.TabooText = truncateRunes(taboo, 1000) + } + return row +} + +// parseDose 从段落文本解析常规剂量范围 +// +// 只取第一个匹配:甘草"用量2~6克……中毒抢救可用30~60克", +// 第一个区间才是常规量,后面的是特殊场景不能当上限 +func parseDose(text string, row *safetyRow) { + if m := reDoseRange.FindStringSubmatchIndex(text); m != nil { + row.DoseMin = parseF(text[m[2]:m[3]]) + row.DoseMax = parseF(text[m[4]:m[5]]) + row.DoseNote = snippetAround(text, m[0], 60) + return + } + if m := reDecoctRange.FindStringSubmatchIndex(text); m != nil { + row.DoseMin = parseF(text[m[2]:m[3]]) + row.DoseMax = parseF(text[m[4]:m[5]]) + row.DoseNote = snippetAround(text, m[0], 60) + return + } + if m := reDoseSingle.FindStringSubmatchIndex(text); m != nil { + v := parseF(text[m[2]:m[3]]) + row.DoseMin, row.DoseMax = v, v + row.DoseNote = snippetAround(text, m[0], 60) + } +} + +// parsePregnancy 解析孕妇禁忌级别(禁用优先于慎用) +func parsePregnancy(text string, row *safetyRow) { + if loc := rePregForbid.FindStringIndex(text); loc != nil { + row.PregnancyLevel = 2 + row.PregnancyNote = sentenceAround(text, loc[0]) + return + } + if loc := rePregCaution.FindStringIndex(text); loc != nil { + row.PregnancyLevel = 1 + row.PregnancyNote = sentenceAround(text, loc[0]) + } +} + +// parseF 字符串转 float(正则已保证格式,失败返回 0) +func parseF(s string) float64 { + v, _ := strconv.ParseFloat(s, 64) + return v +} + +// snippetAround 从 byteIdx 起截 n 个 rune 作原文摘录 +func snippetAround(text string, byteIdx, n int) string { + return truncateRunes(text[byteIdx:], n) +} + +// sentenceAround 取 byteIdx 所在的完整句子(按 。;!? 切)作原文摘录 +func sentenceAround(text string, byteIdx int) string { + start := 0 + for _, sep := range []string{"。", ";", "!", "?"} { + if i := strings.LastIndex(text[:byteIdx], sep); i >= 0 && i+len(sep) > start { + start = i + len(sep) + } + } + rest := text[start:] + end := len(rest) + for _, sep := range []string{"。", ";", "!", "?"} { + if i := strings.Index(rest, sep); i >= 0 && i < end { + end = i + } + } + return truncateRunes(strings.TrimSpace(rest[:end]), 120) +} + +// truncateRunes 按 rune 截断(不破坏中文字符边界) +func truncateRunes(s string, max int) string { + runes := []rune(s) + if len(runes) <= max { + return s + } + return string(runes[:max]) + "…" +} diff --git a/view/admin-dist/assets/ClearOutlined-n8aZ-G2p.js b/view/admin-dist/assets/ClearOutlined-n8aZ-G2p.js new file mode 100644 index 0000000..c5265c1 --- /dev/null +++ b/view/admin-dist/assets/ClearOutlined-n8aZ-G2p.js @@ -0,0 +1 @@ +import{c as i,I as u}from"./index-C0Houbmd.js";var o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"};function c(r){for(var e=1;e"u"&&typeof self<"u"?yt.worker=!0:!yt.hasGlobalWindow||"Deno"in window?(yt.node=!0,yt.svgSupported=!0):YI(navigator.userAgent,yt);function YI(r,e){var t=e.browser,a=r.match(/Firefox\/([\d.]+)/),n=r.match(/MSIE\s([\d.]+)/)||r.match(/Trident\/.+?rv:(([\d.]+))/),i=r.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(r);a&&(t.firefox=!0,t.version=a[1]),n&&(t.ie=!0,t.version=n[1]),i&&(t.edge=!0,t.version=i[1],t.newEdge=+i[1].split(".")[0]>18),o&&(t.weChat=!0),e.svgSupported=typeof SVGRect<"u",e.touchEventsSupported="ontouchstart"in window&&!t.ie&&!t.edge,e.pointerEventsSupported="onpointerdown"in window&&(t.edge||t.ie&&+t.version>=11),e.domSupported=typeof document<"u";var s=document.documentElement.style;e.transform3dSupported=(t.ie&&"transition"in s||t.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||t.ie&&+t.version>=9}var Wd=12,tw="sans-serif",Ua=Wd+"px "+tw,XI=20,ZI=100,$I="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function qI(r){var e={};if(typeof JSON>"u")return e;for(var t=0;t=0)s=o*t.length;else for(var l=0;l>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",a[l]+":0",n[u]+":0",a[1-l]+":auto",n[1-u]+":auto",""].join("!important;"),r.appendChild(o),t.push(o)}return t}function gL(r,e,t){for(var a=t?"invTrans":"trans",n=e[a],i=e.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var f=r[u].getBoundingClientRect(),h=2*u,v=f.left,c=f.top;o.push(v,c),l=l&&i&&v===i[h]&&c===i[h+1],s.push(r[u].offsetLeft,r[u].offsetTop)}return l&&n?n:(e.srcCoords=o,e[a]=t?rm(s,o):rm(o,s))}function sw(r){return r.nodeName.toUpperCase()==="CANVAS"}var yL=/([&<>"'])/g,mL={"&":"&","<":"<",">":">",'"':""","'":"'"};function we(r){return r==null?"":(r+"").replace(yL,function(e,t){return mL[t]})}var _L=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Rh=[],SL=yt.browser.firefox&&+yt.browser.version.split(".")[0]<39;function sp(r,e,t,a){return t=t||{},a?nm(r,e,t):SL&&e.layerX!=null&&e.layerX!==e.offsetX?(t.zrX=e.layerX,t.zrY=e.layerY):e.offsetX!=null?(t.zrX=e.offsetX,t.zrY=e.offsetY):nm(r,e,t),t}function nm(r,e,t){if(yt.domSupported&&r.getBoundingClientRect){var a=e.clientX,n=e.clientY;if(sw(r)){var i=r.getBoundingClientRect();t.zrX=a-i.left,t.zrY=n-i.top;return}else if(op(Rh,r,a,n)){t.zrX=Rh[0],t.zrY=Rh[1];return}}t.zrX=t.zrY=0}function Kd(r){return r||window.event}function qe(r,e,t){if(e=Kd(e),e.zrX!=null)return e;var a=e.type,n=a&&a.indexOf("touch")>=0;if(n){var o=a!=="touchend"?e.targetTouches[0]:e.changedTouches[0];o&&sp(r,o,e,t)}else{sp(r,e,e,t);var i=xL(e);e.zrDelta=i?i/120:-(e.detail||0)/3}var s=e.button;return e.which==null&&s!==void 0&&_L.test(e.type)&&(e.which=s&1?1:s&2?3:s&4?2:0),e}function xL(r){var e=r.wheelDelta;if(e)return e;var t=r.deltaX,a=r.deltaY;if(t==null||a==null)return e;var n=Math.abs(a!==0?a:t),i=a>0?-1:a<0?1:t>0?-1:1;return 3*n*i}function lp(r,e,t,a){r.addEventListener(e,t,a)}function bL(r,e,t,a){r.removeEventListener(e,t,a)}var oa=function(r){r.preventDefault(),r.stopPropagation(),r.cancelBubble=!0};function im(r){return r.which===2||r.which===3}var wL=function(){function r(){this._track=[]}return r.prototype.recognize=function(e,t,a){return this._doTrack(e,t,a),this._recognize(e)},r.prototype.clear=function(){return this._track.length=0,this},r.prototype._doTrack=function(e,t,a){var n=e.touches;if(n){for(var i={points:[],touches:[],target:t,event:e},o=0,s=n.length;o1&&a&&a.length>1){var i=om(a)/om(n);!isFinite(i)&&(i=1),e.pinchScale=i;var o=TL(a);return e.pinchX=o[0],e.pinchY=o[1],{type:"pinch",target:r[0].target,event:e}}}}};function Fe(){return[1,0,0,1,0,0]}function Xf(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function Jd(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r}function ra(r,e,t){var a=e[0]*t[0]+e[2]*t[1],n=e[1]*t[0]+e[3]*t[1],i=e[0]*t[2]+e[2]*t[3],o=e[1]*t[2]+e[3]*t[3],s=e[0]*t[4]+e[2]*t[5]+e[4],l=e[1]*t[4]+e[3]*t[5]+e[5];return r[0]=a,r[1]=n,r[2]=i,r[3]=o,r[4]=s,r[5]=l,r}function Fr(r,e,t){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4]+t[0],r[5]=e[5]+t[1],r}function si(r,e,t,a){a===void 0&&(a=[0,0]);var n=e[0],i=e[2],o=e[4],s=e[1],l=e[3],u=e[5],f=Math.sin(t),h=Math.cos(t);return r[0]=n*h+s*f,r[1]=-n*f+s*h,r[2]=i*h+l*f,r[3]=-i*f+h*l,r[4]=h*(o-a[0])+f*(u-a[1])+a[0],r[5]=h*(u-a[1])-f*(o-a[0])+a[1],r}function Qd(r,e,t){var a=t[0],n=t[1];return r[0]=e[0]*a,r[1]=e[1]*n,r[2]=e[2]*a,r[3]=e[3]*n,r[4]=e[4]*a,r[5]=e[5]*n,r}function fo(r,e){var t=e[0],a=e[2],n=e[4],i=e[1],o=e[3],s=e[5],l=t*o-i*a;return l?(l=1/l,r[0]=o*l,r[1]=-i*l,r[2]=-a*l,r[3]=t*l,r[4]=(a*s-o*n)*l,r[5]=(i*n-t*s)*l,r):null}function AL(r){var e=Fe();return Jd(e,r),e}var ft=function(){function r(e,t){this.x=e||0,this.y=t||0}return r.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.set=function(e,t){return this.x=e,this.y=t,this},r.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},r.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},r.prototype.scale=function(e){this.x*=e,this.y*=e},r.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},r.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},r.prototype.dot=function(e){return this.x*e.x+this.y*e.y},r.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},r.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},r.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},r.prototype.distance=function(e){var t=this.x-e.x,a=this.y-e.y;return Math.sqrt(t*t+a*a)},r.prototype.distanceSquare=function(e){var t=this.x-e.x,a=this.y-e.y;return t*t+a*a},r.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},r.prototype.transform=function(e){if(e){var t=this.x,a=this.y;return this.x=e[0]*t+e[2]*a+e[4],this.y=e[1]*t+e[3]*a+e[5],this}},r.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},r.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},r.set=function(e,t,a){e.x=t,e.y=a},r.copy=function(e,t){e.x=t.x,e.y=t.y},r.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},r.lenSquare=function(e){return e.x*e.x+e.y*e.y},r.dot=function(e,t){return e.x*t.x+e.y*t.y},r.add=function(e,t,a){e.x=t.x+a.x,e.y=t.y+a.y},r.sub=function(e,t,a){e.x=t.x-a.x,e.y=t.y-a.y},r.scale=function(e,t,a){e.x=t.x*a,e.y=t.y*a},r.scaleAndAdd=function(e,t,a,n){e.x=t.x+a.x*n,e.y=t.y+a.y*n},r.lerp=function(e,t,a,n){var i=1-n;e.x=i*t.x+n*a.x,e.y=i*t.y+n*a.y},r}(),Cl=Math.min,Dl=Math.max,en=new ft,rn=new ft,an=new ft,nn=new ft,Ao=new ft,Co=new ft,ht=function(){function r(e,t,a,n){a<0&&(e=e+a,a=-a),n<0&&(t=t+n,n=-n),this.x=e,this.y=t,this.width=a,this.height=n}return r.prototype.union=function(e){var t=Cl(e.x,this.x),a=Cl(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Dl(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Dl(e.y+e.height,this.y+this.height)-a:this.height=e.height,this.x=t,this.y=a},r.prototype.applyTransform=function(e){r.applyTransform(this,this,e)},r.prototype.calculateTransform=function(e){var t=this,a=e.width/t.width,n=e.height/t.height,i=Fe();return Fr(i,i,[-t.x,-t.y]),Qd(i,i,[a,n]),Fr(i,i,[e.x,e.y]),i},r.prototype.intersect=function(e,t){if(!e)return!1;e instanceof r||(e=r.create(e));var a=this,n=a.x,i=a.x+a.width,o=a.y,s=a.y+a.height,l=e.x,u=e.x+e.width,f=e.y,h=e.y+e.height,v=!(ip&&(p=_,dp&&(p=S,y=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height},r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copy=function(e){r.copy(this,e)},r.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},r.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},r.prototype.isZero=function(){return this.width===0||this.height===0},r.create=function(e){return new r(e.x,e.y,e.width,e.height)},r.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},r.applyTransform=function(e,t,a){if(!a){e!==t&&r.copy(e,t);return}if(a[1]<1e-5&&a[1]>-1e-5&&a[2]<1e-5&&a[2]>-1e-5){var n=a[0],i=a[3],o=a[4],s=a[5];e.x=t.x*n+o,e.y=t.y*i+s,e.width=t.width*n,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}en.x=an.x=t.x,en.y=nn.y=t.y,rn.x=nn.x=t.x+t.width,rn.y=an.y=t.y+t.height,en.transform(a),nn.transform(a),rn.transform(a),an.transform(a),e.x=Cl(en.x,rn.x,an.x,nn.x),e.y=Cl(en.y,rn.y,an.y,nn.y);var l=Dl(en.x,rn.x,an.x,nn.x),u=Dl(en.y,rn.y,an.y,nn.y);e.width=l-e.x,e.height=u-e.y},r}(),lw="silent";function CL(r,e,t){return{type:r,event:t,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:t.zrX,offsetY:t.zrY,gestureEvent:t.gestureEvent,pinchX:t.pinchX,pinchY:t.pinchY,pinchScale:t.pinchScale,wheelDelta:t.zrDelta,zrByTouch:t.zrByTouch,which:t.which,stop:DL}}function DL(){oa(this.event)}var ML=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.handler=null,t}return e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(or),Do=function(){function r(e,t){this.x=e,this.y=t}return r}(),IL=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],kh=new ht(0,0,0,0),uw=function(r){k(e,r);function e(t,a,n,i,o){var s=r.call(this)||this;return s._hovered=new Do(0,0),s.storage=t,s.painter=a,s.painterRoot=i,s._pointerSize=o,n=n||new ML,s.proxy=null,s.setHandlerProxy(n),s._draggingMgr=new vL(s),s}return e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(D(IL,function(a){t.on&&t.on(a,this[a],this)},this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var a=t.zrX,n=t.zrY,i=fw(this,a,n),o=this._hovered,s=o.target;s&&!s.__zr&&(o=this.findHover(o.x,o.y),s=o.target);var l=this._hovered=i?new Do(a,n):this.findHover(a,n),u=l.target,f=this.proxy;f.setCursor&&f.setCursor(u?u.cursor:"default"),s&&u!==s&&this.dispatchToElement(o,"mouseout",t),this.dispatchToElement(l,"mousemove",t),u&&u!==s&&this.dispatchToElement(l,"mouseover",t)},e.prototype.mouseout=function(t){var a=t.zrEventControl;a!=="only_globalout"&&this.dispatchToElement(this._hovered,"mouseout",t),a!=="no_globalout"&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new Do(0,0)},e.prototype.dispatch=function(t,a){var n=this[t];n&&n.call(this,a)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var a=this.proxy;a.setCursor&&a.setCursor(t)},e.prototype.dispatchToElement=function(t,a,n){t=t||{};var i=t.target;if(!(i&&i.silent)){for(var o="on"+a,s=CL(a,t,n);i&&(i[o]&&(s.cancelBubble=!!i[o].call(i,s)),i.trigger(a,s),i=i.__hostTarget?i.__hostTarget:i.parent,!s.cancelBubble););s.cancelBubble||(this.trigger(a,s),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(l){typeof l[o]=="function"&&l[o].call(l,s),l.trigger&&l.trigger(a,s)}))}},e.prototype.findHover=function(t,a,n){var i=this.storage.getDisplayList(),o=new Do(t,a);if(sm(i,o,t,a,n),this._pointerSize&&!o.target){for(var s=[],l=this._pointerSize,u=l/2,f=new ht(t-u,a-u,l,l),h=i.length-1;h>=0;h--){var v=i[h];v!==n&&!v.ignore&&!v.ignoreCoarsePointer&&(!v.parent||!v.parent.ignoreCoarsePointer)&&(kh.copy(v.getBoundingRect()),v.transform&&kh.applyTransform(v.transform),kh.intersect(f)&&s.push(v))}if(s.length)for(var c=4,p=Math.PI/12,d=Math.PI*2,g=0;g4)return;this._downPoint=null}this.dispatchToElement(i,r,e)}});function LL(r,e,t){if(r[r.rectHover?"rectContain":"contain"](e,t)){for(var a=r,n=void 0,i=!1;a;){if(a.ignoreClip&&(i=!0),!i){var o=a.getClipPath();if(o&&!o.contain(e,t))return!1}a.silent&&(n=!0);var s=a.__hostTarget;a=s||a.parent}return n?lw:!0}return!1}function sm(r,e,t,a,n){for(var i=r.length-1;i>=0;i--){var o=r[i],s=void 0;if(o!==n&&!o.ignore&&(s=LL(o,t,a))&&(!e.topTarget&&(e.topTarget=o),s!==lw)){e.target=o;break}}}function fw(r,e,t){var a=r.painter;return e<0||e>a.getWidth()||t<0||t>a.getHeight()}var hw=32,Mo=7;function PL(r){for(var e=0;r>=hw;)e|=r&1,r>>=1;return r+e}function lm(r,e,t,a){var n=e+1;if(n===t)return 1;if(a(r[n++],r[e])<0){for(;n=0;)n++;return n-e}function RL(r,e,t){for(t--;e>>1,n(i,r[l])<0?s=l:o=l+1;var u=a-o;switch(u){case 3:r[o+3]=r[o+2];case 2:r[o+2]=r[o+1];case 1:r[o+1]=r[o];break;default:for(;u>0;)r[o+u]=r[o+u-1],u--}r[o]=i}}function Oh(r,e,t,a,n,i){var o=0,s=0,l=1;if(i(r,e[t+n])>0){for(s=a-n;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}else{for(s=n+1;ls&&(l=s);var u=o;o=n-l,l=n-u}for(o++;o>>1);i(r,e[t+f])>0?o=f+1:l=f}return l}function Nh(r,e,t,a,n,i){var o=0,s=0,l=1;if(i(r,e[t+n])<0){for(s=n+1;ls&&(l=s);var u=o;o=n-l,l=n-u}else{for(s=a-n;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}for(o++;o>>1);i(r,e[t+f])<0?l=f:o=f+1}return l}function EL(r,e){var t=Mo,a,n,i=0,o=[];a=[],n=[];function s(c,p){a[i]=c,n[i]=p,i+=1}function l(){for(;i>1;){var c=i-2;if(c>=1&&n[c-1]<=n[c]+n[c+1]||c>=2&&n[c-2]<=n[c]+n[c-1])n[c-1]n[c+1])break;f(c)}}function u(){for(;i>1;){var c=i-2;c>0&&n[c-1]=Mo||w>=Mo);if(T)break;b<0&&(b=0),b+=2}if(t=b,t<1&&(t=1),p===1){for(y=0;y=0;y--)r[x+y]=r[b+y];r[S]=o[_];return}for(var w=t;;){var T=0,A=0,C=!1;do if(e(o[_],r[m])<0){if(r[S--]=r[m--],T++,A=0,--p===0){C=!0;break}}else if(r[S--]=o[_--],A++,T=0,--g===1){C=!0;break}while((T|A)=0;y--)r[x+y]=r[b+y];if(p===0){C=!0;break}}if(r[S--]=o[_--],--g===1){C=!0;break}if(A=g-Oh(r[m],o,0,g,g-1,e),A!==0){for(S-=A,_-=A,g-=A,x=S+1,b=_+1,y=0;y=Mo||A>=Mo);if(C)break;w<0&&(w=0),w+=2}if(t=w,t<1&&(t=1),g===1){for(S-=p,m-=p,x=S+1,b=m+1,y=p-1;y>=0;y--)r[x+y]=r[b+y];r[S]=o[_]}else{if(g===0)throw new Error;for(b=S-(g-1),y=0;ys&&(l=s),um(r,t,t+l,t+i,e),i=l}o.pushRun(t,i),o.mergeRuns(),n-=i,t+=i}while(n!==0);o.forceMergeRuns()}}var Vr=1,Pu=2,ts=4,fm=!1;function Bh(){fm||(fm=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function hm(r,e){return r.zlevel===e.zlevel?r.z===e.z?r.z2-e.z2:r.z-e.z:r.zlevel-e.zlevel}var kL=function(){function r(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=hm}return r.prototype.traverse=function(e,t){for(var a=0;a0&&(f.__clipPaths=[]),isNaN(f.z)&&(Bh(),f.z=0),isNaN(f.z2)&&(Bh(),f.z2=0),isNaN(f.zlevel)&&(Bh(),f.zlevel=0),this._displayList[this._displayListLen++]=f}var h=e.getDecalElement&&e.getDecalElement();h&&this._updateAndAddDisplayable(h,t,a);var v=e.getTextGuideLine();v&&this._updateAndAddDisplayable(v,t,a);var c=e.getTextContent();c&&this._updateAndAddDisplayable(c,t,a)}},r.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},r.prototype.delRoot=function(e){if(e instanceof Array){for(var t=0,a=e.length;t=0&&this._roots.splice(n,1)},r.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},r.prototype.getRoots=function(){return this._roots},r.prototype.dispose=function(){this._displayList=null,this._roots=null},r}(),Ku;Ku=yt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(r){return setTimeout(r,16)};var cs={linear:function(r){return r},quadraticIn:function(r){return r*r},quadraticOut:function(r){return r*(2-r)},quadraticInOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)},cubicIn:function(r){return r*r*r},cubicOut:function(r){return--r*r*r+1},cubicInOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)},quarticIn:function(r){return r*r*r*r},quarticOut:function(r){return 1- --r*r*r*r},quarticInOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)},quinticIn:function(r){return r*r*r*r*r},quinticOut:function(r){return--r*r*r*r*r+1},quinticInOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)},sinusoidalIn:function(r){return 1-Math.cos(r*Math.PI/2)},sinusoidalOut:function(r){return Math.sin(r*Math.PI/2)},sinusoidalInOut:function(r){return .5*(1-Math.cos(Math.PI*r))},exponentialIn:function(r){return r===0?0:Math.pow(1024,r-1)},exponentialOut:function(r){return r===1?1:1-Math.pow(2,-10*r)},exponentialInOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)},circularIn:function(r){return 1-Math.sqrt(1-r*r)},circularOut:function(r){return Math.sqrt(1- --r*r)},circularInOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)},elasticIn:function(r){var e,t=.1,a=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=a/4):e=a*Math.asin(1/t)/(2*Math.PI),-(t*Math.pow(2,10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/a)))},elasticOut:function(r){var e,t=.1,a=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=a/4):e=a*Math.asin(1/t)/(2*Math.PI),t*Math.pow(2,-10*r)*Math.sin((r-e)*(2*Math.PI)/a)+1)},elasticInOut:function(r){var e,t=.1,a=.4;return r===0?0:r===1?1:(!t||t<1?(t=1,e=a/4):e=a*Math.asin(1/t)/(2*Math.PI),(r*=2)<1?-.5*(t*Math.pow(2,10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/a)):t*Math.pow(2,-10*(r-=1))*Math.sin((r-e)*(2*Math.PI)/a)*.5+1)},backIn:function(r){var e=1.70158;return r*r*((e+1)*r-e)},backOut:function(r){var e=1.70158;return--r*r*((e+1)*r+e)+1},backInOut:function(r){var e=2.5949095;return(r*=2)<1?.5*(r*r*((e+1)*r-e)):.5*((r-=2)*r*((e+1)*r+e)+2)},bounceIn:function(r){return 1-cs.bounceOut(1-r)},bounceOut:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},bounceInOut:function(r){return r<.5?cs.bounceIn(r*2)*.5:cs.bounceOut(r*2-1)*.5+.5}},Ml=Math.pow,Ga=Math.sqrt,vw=1e-8,cw=1e-4,vm=Ga(3),Il=1/3,Pr=oi(),je=oi(),Yi=oi();function ka(r){return r>-1e-8&&rvw||r<-1e-8}function te(r,e,t,a,n){var i=1-n;return i*i*(i*r+3*n*e)+n*n*(n*a+3*i*t)}function cm(r,e,t,a,n){var i=1-n;return 3*(((e-r)*i+2*(t-e)*n)*i+(a-t)*n*n)}function Ju(r,e,t,a,n,i){var o=a+3*(e-t)-r,s=3*(t-e*2+r),l=3*(e-r),u=r-n,f=s*s-3*o*l,h=s*l-9*o*u,v=l*l-3*s*u,c=0;if(ka(f)&&ka(h))if(ka(s))i[0]=0;else{var p=-l/s;p>=0&&p<=1&&(i[c++]=p)}else{var d=h*h-4*f*v;if(ka(d)){var g=h/f,p=-s/o+g,y=-g/2;p>=0&&p<=1&&(i[c++]=p),y>=0&&y<=1&&(i[c++]=y)}else if(d>0){var m=Ga(d),_=f*s+1.5*o*(-h+m),S=f*s+1.5*o*(-h-m);_<0?_=-Ml(-_,Il):_=Ml(_,Il),S<0?S=-Ml(-S,Il):S=Ml(S,Il);var p=(-s-(_+S))/(3*o);p>=0&&p<=1&&(i[c++]=p)}else{var b=(2*f*s-3*o*h)/(2*Ga(f*f*f)),x=Math.acos(b)/3,w=Ga(f),T=Math.cos(x),p=(-s-2*w*T)/(3*o),y=(-s+w*(T+vm*Math.sin(x)))/(3*o),A=(-s+w*(T-vm*Math.sin(x)))/(3*o);p>=0&&p<=1&&(i[c++]=p),y>=0&&y<=1&&(i[c++]=y),A>=0&&A<=1&&(i[c++]=A)}}return c}function dw(r,e,t,a,n){var i=6*t-12*e+6*r,o=9*e+3*a-3*r-9*t,s=3*e-3*r,l=0;if(ka(o)){if(pw(i)){var u=-s/i;u>=0&&u<=1&&(n[l++]=u)}}else{var f=i*i-4*o*s;if(ka(f))n[0]=-i/(2*o);else if(f>0){var h=Ga(f),u=(-i+h)/(2*o),v=(-i-h)/(2*o);u>=0&&u<=1&&(n[l++]=u),v>=0&&v<=1&&(n[l++]=v)}}return l}function Xa(r,e,t,a,n,i){var o=(e-r)*n+r,s=(t-e)*n+e,l=(a-t)*n+t,u=(s-o)*n+o,f=(l-s)*n+s,h=(f-u)*n+u;i[0]=r,i[1]=o,i[2]=u,i[3]=h,i[4]=h,i[5]=f,i[6]=l,i[7]=a}function gw(r,e,t,a,n,i,o,s,l,u,f){var h,v=.005,c=1/0,p,d,g,y;Pr[0]=l,Pr[1]=u;for(var m=0;m<1;m+=.05)je[0]=te(r,t,n,o,m),je[1]=te(e,a,i,s,m),g=Un(Pr,je),g=0&&g=0&&u<=1&&(n[l++]=u)}}else{var f=o*o-4*i*s;if(ka(f)){var u=-o/(2*i);u>=0&&u<=1&&(n[l++]=u)}else if(f>0){var h=Ga(f),u=(-o+h)/(2*i),v=(-o-h)/(2*i);u>=0&&u<=1&&(n[l++]=u),v>=0&&v<=1&&(n[l++]=v)}}return l}function yw(r,e,t){var a=r+t-2*e;return a===0?.5:(r-e)/a}function Ls(r,e,t,a,n){var i=(e-r)*a+r,o=(t-e)*a+e,s=(o-i)*a+i;n[0]=r,n[1]=i,n[2]=s,n[3]=s,n[4]=o,n[5]=t}function mw(r,e,t,a,n,i,o,s,l){var u,f=.005,h=1/0;Pr[0]=o,Pr[1]=s;for(var v=0;v<1;v+=.05){je[0]=oe(r,t,n,v),je[1]=oe(e,a,i,v);var c=Un(Pr,je);c=0&&c=1?1:Ju(0,a,i,1,l,s)&&te(0,n,o,1,s[0])}}}var zL=function(){function r(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Xt,this.ondestroy=e.ondestroy||Xt,this.onrestart=e.onrestart||Xt,e.easing&&this.setEasing(e.easing)}return r.prototype.step=function(e,t){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),this._paused){this._pausedTime+=t;return}var a=this._life,n=e-this._startTime-this._pausedTime,i=n/a;i<0&&(i=0),i=Math.min(i,1);var o=this.easingFunc,s=o?o(i):i;if(this.onframe(s),i===1)if(this.loop){var l=n%a;this._startTime=e-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){this._paused=!1},r.prototype.setEasing=function(e){this.easing=e,this.easingFunc=J(e)?e:cs[e]||jd(e)},r}(),_w=function(){function r(e){this.value=e}return r}(),GL=function(){function r(){this._len=0}return r.prototype.insert=function(e){var t=new _w(e);return this.insertEntry(t),t},r.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},r.prototype.remove=function(e){var t=e.prev,a=e.next;t?t.next=a:this.head=a,a?a.prev=t:this.tail=t,e.next=e.prev=null,this._len--},r.prototype.len=function(){return this._len},r.prototype.clear=function(){this.head=this.tail=null,this._len=0},r}(),al=function(){function r(e){this._list=new GL,this._maxSize=10,this._map={},this._maxSize=e}return r.prototype.put=function(e,t){var a=this._list,n=this._map,i=null;if(n[e]==null){var o=a.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=a.head;a.remove(l),delete n[l.key],i=l.value,this._lastRemovedEntry=l}s?s.value=t:s=new _w(t),s.key=e,a.insertEntry(s),n[e]=s}return i},r.prototype.get=function(e){var t=this._map[e],a=this._list;if(t!=null)return t!==a.tail&&(a.remove(t),a.insertEntry(t)),t.value},r.prototype.clear=function(){this._list.clear(),this._map={}},r.prototype.len=function(){return this._list.len()},r}(),pm={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function yr(r){return r=Math.round(r),r<0?0:r>255?255:r}function FL(r){return r=Math.round(r),r<0?0:r>360?360:r}function Ps(r){return r<0?0:r>1?1:r}function Vh(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?yr(parseFloat(e)/100*255):yr(parseInt(e,10))}function Yn(r){var e=r;return e.length&&e.charAt(e.length-1)==="%"?Ps(parseFloat(e)/100):Ps(parseFloat(e))}function zh(r,e,t){return t<0?t+=1:t>1&&(t-=1),t*6<1?r+(e-r)*t*6:t*2<1?e:t*3<2?r+(e-r)*(2/3-t)*6:r}function Oa(r,e,t){return r+(e-r)*t}function $e(r,e,t,a,n){return r[0]=e,r[1]=t,r[2]=a,r[3]=n,r}function fp(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}var Sw=new al(20),Ll=null;function gi(r,e){Ll&&fp(Ll,e),Ll=Sw.put(r,Ll||e.slice())}function He(r,e){if(r){e=e||[];var t=Sw.get(r);if(t)return fp(e,t);r=r+"";var a=r.replace(/ /g,"").toLowerCase();if(a in pm)return fp(e,pm[a]),gi(r,e),e;var n=a.length;if(a.charAt(0)==="#"){if(n===4||n===5){var i=parseInt(a.slice(1,4),16);if(!(i>=0&&i<=4095)){$e(e,0,0,0,1);return}return $e(e,(i&3840)>>4|(i&3840)>>8,i&240|(i&240)>>4,i&15|(i&15)<<4,n===5?parseInt(a.slice(4),16)/15:1),gi(r,e),e}else if(n===7||n===9){var i=parseInt(a.slice(1,7),16);if(!(i>=0&&i<=16777215)){$e(e,0,0,0,1);return}return $e(e,(i&16711680)>>16,(i&65280)>>8,i&255,n===9?parseInt(a.slice(7),16)/255:1),gi(r,e),e}return}var o=a.indexOf("("),s=a.indexOf(")");if(o!==-1&&s+1===n){var l=a.substr(0,o),u=a.substr(o+1,s-(o+1)).split(","),f=1;switch(l){case"rgba":if(u.length!==4)return u.length===3?$e(e,+u[0],+u[1],+u[2],1):$e(e,0,0,0,1);f=Yn(u.pop());case"rgb":if(u.length>=3)return $e(e,Vh(u[0]),Vh(u[1]),Vh(u[2]),u.length===3?f:Yn(u[3])),gi(r,e),e;$e(e,0,0,0,1);return;case"hsla":if(u.length!==4){$e(e,0,0,0,1);return}return u[3]=Yn(u[3]),hp(u,e),gi(r,e),e;case"hsl":if(u.length!==3){$e(e,0,0,0,1);return}return hp(u,e),gi(r,e),e;default:return}}$e(e,0,0,0,1)}}function hp(r,e){var t=(parseFloat(r[0])%360+360)%360/360,a=Yn(r[1]),n=Yn(r[2]),i=n<=.5?n*(a+1):n+a-n*a,o=n*2-i;return e=e||[],$e(e,yr(zh(o,i,t+1/3)*255),yr(zh(o,i,t)*255),yr(zh(o,i,t-1/3)*255),1),r.length===4&&(e[3]=r[3]),e}function HL(r){if(r){var e=r[0]/255,t=r[1]/255,a=r[2]/255,n=Math.min(e,t,a),i=Math.max(e,t,a),o=i-n,s=(i+n)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(i+n):u=o/(2-i-n);var f=((i-e)/6+o/2)/o,h=((i-t)/6+o/2)/o,v=((i-a)/6+o/2)/o;e===i?l=v-h:t===i?l=1/3+f-v:a===i&&(l=2/3+h-f),l<0&&(l+=1),l>1&&(l-=1)}var c=[l*360,u,s];return r[3]!=null&&c.push(r[3]),c}}function vp(r,e){var t=He(r);if(t){for(var a=0;a<3;a++)e<0?t[a]=t[a]*(1-e)|0:t[a]=(255-t[a])*e+t[a]|0,t[a]>255?t[a]=255:t[a]<0&&(t[a]=0);return aa(t,t.length===4?"rgba":"rgb")}}function Gh(r,e,t){if(!(!(e&&e.length)||!(r>=0&&r<=1))){t=t||[];var a=r*(e.length-1),n=Math.floor(a),i=Math.ceil(a),o=e[n],s=e[i],l=a-n;return t[0]=yr(Oa(o[0],s[0],l)),t[1]=yr(Oa(o[1],s[1],l)),t[2]=yr(Oa(o[2],s[2],l)),t[3]=Ps(Oa(o[3],s[3],l)),t}}function WL(r,e,t){if(!(!(e&&e.length)||!(r>=0&&r<=1))){var a=r*(e.length-1),n=Math.floor(a),i=Math.ceil(a),o=He(e[n]),s=He(e[i]),l=a-n,u=aa([yr(Oa(o[0],s[0],l)),yr(Oa(o[1],s[1],l)),yr(Oa(o[2],s[2],l)),Ps(Oa(o[3],s[3],l))],"rgba");return t?{color:u,leftIndex:n,rightIndex:i,value:a}:u}}function ps(r,e,t,a){var n=He(r);if(r)return n=HL(n),e!=null&&(n[0]=FL(e)),t!=null&&(n[1]=Yn(t)),a!=null&&(n[2]=Yn(a)),aa(hp(n),"rgba")}function Qu(r,e){var t=He(r);if(t&&e!=null)return t[3]=Ps(e),aa(t,"rgba")}function aa(r,e){if(!(!r||!r.length)){var t=r[0]+","+r[1]+","+r[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(t+=","+r[3]),e+"("+t+")"}}function ju(r,e){var t=He(r);return t?(.299*t[0]+.587*t[1]+.114*t[2])*t[3]/255+(1-t[3])*e:0}var dm=new al(100);function cp(r){if(Y(r)){var e=dm.get(r);return e||(e=vp(r,-.1),dm.put(r,e)),e}else if(Uf(r)){var t=V({},r);return t.colorStops=G(r.colorStops,function(a){return{offset:a.offset,color:vp(a.color,-.1)}}),t}return r}var tf=Math.round;function Rs(r){var e;if(!r||r==="transparent")r="none";else if(typeof r=="string"&&r.indexOf("rgba")>-1){var t=He(r);t&&(r="rgb("+t[0]+","+t[1]+","+t[2]+")",e=t[3])}return{color:r,opacity:e??1}}var UL=1e-4;function Na(r){return r-1e-4}function Pl(r){return tf(r*1e3)/1e3}function pp(r){return tf(r*1e4)/1e4}function YL(r){return"matrix("+Pl(r[0])+","+Pl(r[1])+","+Pl(r[2])+","+Pl(r[3])+","+pp(r[4])+","+pp(r[5])+")"}var XL={left:"start",right:"end",center:"middle",middle:"middle"};function ZL(r,e,t){return t==="top"?r+=e/2:t==="bottom"&&(r-=e/2),r}function $L(r){return r&&(r.shadowBlur||r.shadowOffsetX||r.shadowOffsetY)}function qL(r){var e=r.style,t=r.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),t[0],t[1]].join(",")}function xw(r){return r&&!!r.image}function KL(r){return r&&!!r.svgElement}function tg(r){return xw(r)||KL(r)}function bw(r){return r.type==="linear"}function ww(r){return r.type==="radial"}function Tw(r){return r&&(r.type==="linear"||r.type==="radial")}function Zf(r){return"url(#"+r+")"}function Aw(r){var e=r.getGlobalScale(),t=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(t)/Math.log(10)),1)}function Cw(r){var e=r.x||0,t=r.y||0,a=(r.rotation||0)*Du,n=st(r.scaleX,1),i=st(r.scaleY,1),o=r.skewX||0,s=r.skewY||0,l=[];return(e||t)&&l.push("translate("+e+"px,"+t+"px)"),a&&l.push("rotate("+a+")"),(n!==1||i!==1)&&l.push("scale("+n+","+i+")"),(o||s)&&l.push("skew("+tf(o*Du)+"deg, "+tf(s*Du)+"deg)"),l.join(" ")}var JL=function(){return yt.hasGlobalWindow&&J(window.btoa)?function(r){return window.btoa(unescape(encodeURIComponent(r)))}:typeof Buffer<"u"?function(r){return Buffer.from(r).toString("base64")}:function(r){return null}}(),dp=Array.prototype.slice;function Jr(r,e,t){return(e-r)*t+r}function Fh(r,e,t,a){for(var n=e.length,i=0;ia?e:r,i=Math.min(t,a),o=n[i-1]||{color:[0,0,0,0],offset:0},s=i;so;if(s)a.length=o;else for(var l=i;l=1},r.prototype.getAdditiveTrack=function(){return this._additiveTrack},r.prototype.addKeyframe=function(e,t,a){this._needsSort=!0;var n=this.keyframes,i=n.length,o=!1,s=ym,l=t;if(ye(t)){var u=e2(t);s=u,(u===1&&!wt(t[0])||u===2&&!wt(t[0][0]))&&(o=!0)}else if(wt(t)&&!Ms(t))s=El;else if(Y(t))if(!isNaN(+t))s=El;else{var f=He(t);f&&(l=f,s=es)}else if(Uf(t)){var h=V({},l);h.colorStops=G(t.colorStops,function(c){return{offset:c.offset,color:He(c.color)}}),bw(t)?s=gp:ww(t)&&(s=yp),l=h}i===0?this.valType=s:(s!==this.valType||s===ym)&&(o=!0),this.discrete=this.discrete||o;var v={time:e,value:l,rawValue:t,percent:0};return a&&(v.easing=a,v.easingFunc=J(a)?a:cs[a]||jd(a)),n.push(v),v},r.prototype.prepare=function(e,t){var a=this.keyframes;this._needsSort&&a.sort(function(d,g){return d.time-g.time});for(var n=this.valType,i=a.length,o=a[i-1],s=this.discrete,l=kl(n),u=mm(n),f=0;f=0&&!(o[f].percent<=t);f--);f=v(f,s-2)}else{for(f=h;ft);f++);f=v(f-1,s-2)}p=o[f+1],c=o[f]}if(c&&p){this._lastFr=f,this._lastFrP=t;var g=p.percent-c.percent,y=g===0?1:v((t-c.percent)/g,1);p.easingFunc&&(y=p.easingFunc(y));var m=a?this._additiveValue:u?Io:e[l];if((kl(i)||u)&&!m&&(m=this._additiveValue=[]),this.discrete)e[l]=y<1?c.rawValue:p.rawValue;else if(kl(i))i===Eu?Fh(m,c[n],p[n],y):QL(m,c[n],p[n],y);else if(mm(i)){var _=c[n],S=p[n],b=i===gp;e[l]={type:b?"linear":"radial",x:Jr(_.x,S.x,y),y:Jr(_.y,S.y,y),colorStops:G(_.colorStops,function(w,T){var A=S.colorStops[T];return{offset:Jr(w.offset,A.offset,y),color:Ru(Fh([],w.color,A.color,y))}}),global:S.global},b?(e[l].x2=Jr(_.x2,S.x2,y),e[l].y2=Jr(_.y2,S.y2,y)):e[l].r=Jr(_.r,S.r,y)}else if(u)Fh(m,c[n],p[n],y),a||(e[l]=Ru(m));else{var x=Jr(c[n],p[n],y);a?this._additiveValue=x:e[l]=x}a&&this._addToTarget(e)}}},r.prototype._addToTarget=function(e){var t=this.valType,a=this.propName,n=this._additiveValue;t===El?e[a]=e[a]+n:t===es?(He(e[a],Io),Rl(Io,Io,n,1),e[a]=Ru(Io)):t===Eu?Rl(e[a],e[a],n,1):t===Dw&&gm(e[a],e[a],n,1)},r}(),eg=function(){function r(e,t,a,n){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&n){Xd("Can' use additive animation on looped animation.");return}this._additiveAnimators=n,this._allowDiscrete=a}return r.prototype.getMaxTime=function(){return this._maxTime},r.prototype.getDelay=function(){return this._delay},r.prototype.getLoop=function(){return this._loop},r.prototype.getTarget=function(){return this._target},r.prototype.changeTarget=function(e){this._target=e},r.prototype.when=function(e,t,a){return this.whenWithKeys(e,t,_t(t),a)},r.prototype.whenWithKeys=function(e,t,a,n){for(var i=this._tracks,o=0;o0&&l.addKeyframe(0,ds(u),n),this._trackKeys.push(s)}l.addKeyframe(e,ds(t[s]),n)}return this._maxTime=Math.max(this._maxTime,e),this},r.prototype.pause=function(){this._clip.pause(),this._paused=!0},r.prototype.resume=function(){this._clip.resume(),this._paused=!1},r.prototype.isPaused=function(){return!!this._paused},r.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},r.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,a=0;a0)){this._started=1;for(var t=this,a=[],n=this._maxTime||0,i=0;i1){var s=o.pop();i.addKeyframe(s.time,e[n]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},r}();function Fi(){return new Date().getTime()}var a2=function(r){k(e,r);function e(t){var a=r.call(this)||this;return a._running=!1,a._time=0,a._pausedTime=0,a._pauseStart=0,a._paused=!1,t=t||{},a.stage=t.stage||{},a}return e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var a=t.getClip();a&&this.addClip(a)},e.prototype.removeClip=function(t){if(t.animation){var a=t.prev,n=t.next;a?a.next=n:this._head=n,n?n.prev=a:this._tail=a,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var a=t.getClip();a&&this.removeClip(a),t.animation=null},e.prototype.update=function(t){for(var a=Fi()-this._pausedTime,n=a-this._time,i=this._head;i;){var o=i.next,s=i.step(a,n);s&&(i.ondestroy(),this.removeClip(i)),i=o}this._time=a,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0;function a(){t._running&&(Ku(a),!t._paused&&t.update())}Ku(a)},e.prototype.start=function(){this._running||(this._time=Fi(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=Fi(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=Fi()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var a=t.next;t.prev=t.next=t.animation=null,t=a}this._head=this._tail=null},e.prototype.isFinished=function(){return this._head==null},e.prototype.animate=function(t,a){a=a||{},this.start();var n=new eg(t,a.loop);return this.addAnimator(n),n},e}(or),n2=300,Hh=yt.domSupported,Wh=function(){var r=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],t={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},a=G(r,function(n){var i=n.replace("mouse","pointer");return t.hasOwnProperty(i)?i:n});return{mouse:r,touch:e,pointer:a}}(),_m={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},Sm=!1;function mp(r){var e=r.pointerType;return e==="pen"||e==="touch"}function i2(r){r.touching=!0,r.touchTimer!=null&&(clearTimeout(r.touchTimer),r.touchTimer=null),r.touchTimer=setTimeout(function(){r.touching=!1,r.touchTimer=null},700)}function Uh(r){r&&(r.zrByTouch=!0)}function o2(r,e){return qe(r.dom,new s2(r,e),!0)}function Mw(r,e){for(var t=e,a=!1;t&&t.nodeType!==9&&!(a=t.domBelongToZr||t!==e&&t===r.painterRoot);)t=t.parentNode;return a}var s2=function(){function r(e,t){this.stopPropagation=Xt,this.stopImmediatePropagation=Xt,this.preventDefault=Xt,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return r}(),vr={mousedown:function(r){r=qe(this.dom,r),this.__mayPointerCapture=[r.zrX,r.zrY],this.trigger("mousedown",r)},mousemove:function(r){r=qe(this.dom,r);var e=this.__mayPointerCapture;e&&(r.zrX!==e[0]||r.zrY!==e[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",r)},mouseup:function(r){r=qe(this.dom,r),this.__togglePointerCapture(!1),this.trigger("mouseup",r)},mouseout:function(r){r=qe(this.dom,r);var e=r.toElement||r.relatedTarget;Mw(this,e)||(this.__pointerCapturing&&(r.zrEventControl="no_globalout"),this.trigger("mouseout",r))},wheel:function(r){Sm=!0,r=qe(this.dom,r),this.trigger("mousewheel",r)},mousewheel:function(r){Sm||(r=qe(this.dom,r),this.trigger("mousewheel",r))},touchstart:function(r){r=qe(this.dom,r),Uh(r),this.__lastTouchMoment=new Date,this.handler.processGesture(r,"start"),vr.mousemove.call(this,r),vr.mousedown.call(this,r)},touchmove:function(r){r=qe(this.dom,r),Uh(r),this.handler.processGesture(r,"change"),vr.mousemove.call(this,r)},touchend:function(r){r=qe(this.dom,r),Uh(r),this.handler.processGesture(r,"end"),vr.mouseup.call(this,r),+new Date-+this.__lastTouchMomentv2||r<-5e-5}var sn=[],yi=[],Xh=Fe(),Zh=Math.abs,jr=function(){function r(){}return r.prototype.getLocalTransform=function(e){return r.getLocalTransform(this,e)},r.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},r.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},r.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},r.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},r.prototype.needLocalTransform=function(){return on(this.rotation)||on(this.x)||on(this.y)||on(this.scaleX-1)||on(this.scaleY-1)||on(this.skewX)||on(this.skewY)},r.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),a=this.transform;if(!(t||e)){a&&(bm(a),this.invTransform=null);return}a=a||Fe(),t?this.getLocalTransform(a):bm(a),e&&(t?ra(a,e,a):Jd(a,e)),this.transform=a,this._resolveGlobalScaleRatio(a)},r.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(sn);var a=sn[0]<0?-1:1,n=sn[1]<0?-1:1,i=((sn[0]-a)*t+a)/sn[0]||0,o=((sn[1]-n)*t+n)/sn[1]||0;e[0]*=i,e[1]*=i,e[2]*=o,e[3]*=o}this.invTransform=this.invTransform||Fe(),fo(this.invTransform,e)},r.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},r.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],a=e[2]*e[2]+e[3]*e[3],n=Math.atan2(e[1],e[0]),i=Math.PI/2+n-Math.atan2(e[3],e[2]);a=Math.sqrt(a)*Math.cos(i),t=Math.sqrt(t),this.skewX=i,this.skewY=0,this.rotation=-n,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=a,this.originX=0,this.originY=0}},r.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||Fe(),ra(yi,e.invTransform,t),t=yi);var a=this.originX,n=this.originY;(a||n)&&(Xh[4]=a,Xh[5]=n,ra(yi,t,Xh),yi[4]-=a,yi[5]-=n,t=yi),this.setLocalTransform(t)}},r.prototype.getGlobalScale=function(e){var t=this.transform;return e=e||[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},r.prototype.transformCoordToLocal=function(e,t){var a=[e,t],n=this.invTransform;return n&&fe(a,a,n),a},r.prototype.transformCoordToGlobal=function(e,t){var a=[e,t],n=this.transform;return n&&fe(a,a,n),a},r.prototype.getLineScale=function(){var e=this.transform;return e&&Zh(e[0]-1)>1e-10&&Zh(e[3]-1)>1e-10?Math.sqrt(Zh(e[0]*e[3]-e[2]*e[1])):1},r.prototype.copyTransform=function(e){Lw(this,e)},r.getLocalTransform=function(e,t){t=t||[];var a=e.originX||0,n=e.originY||0,i=e.scaleX,o=e.scaleY,s=e.anchorX,l=e.anchorY,u=e.rotation||0,f=e.x,h=e.y,v=e.skewX?Math.tan(e.skewX):0,c=e.skewY?Math.tan(-e.skewY):0;if(a||n||s||l){var p=a+s,d=n+l;t[4]=-p*i-v*d*o,t[5]=-d*o-c*p*i}else t[4]=t[5]=0;return t[0]=i,t[3]=o,t[1]=c*i,t[2]=v*o,u&&si(t,t,u),t[4]+=a+f,t[5]+=n+h,t},r.initDefaultProps=function(){var e=r.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),r}(),Hr=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function Lw(r,e){for(var t=0;t=0?parseFloat(r)/100*e:parseFloat(r):r}function rf(r,e,t){var a=e.position||"inside",n=e.distance!=null?e.distance:5,i=t.height,o=t.width,s=i/2,l=t.x,u=t.y,f="left",h="top";if(a instanceof Array)l+=_r(a[0],t.width),u+=_r(a[1],t.height),f=null,h=null;else switch(a){case"left":l-=n,u+=s,f="right",h="middle";break;case"right":l+=n+o,u+=s,h="middle";break;case"top":l+=o/2,u-=n,f="center",h="bottom";break;case"bottom":l+=o/2,u+=i+n,f="center";break;case"inside":l+=o/2,u+=s,f="center",h="middle";break;case"insideLeft":l+=n,u+=s,h="middle";break;case"insideRight":l+=o-n,u+=s,f="right",h="middle";break;case"insideTop":l+=o/2,u+=n,f="center";break;case"insideBottom":l+=o/2,u+=i-n,f="center",h="bottom";break;case"insideTopLeft":l+=n,u+=n;break;case"insideTopRight":l+=o-n,u+=n,f="right";break;case"insideBottomLeft":l+=n,u+=i-n,h="bottom";break;case"insideBottomRight":l+=o-n,u+=i-n,f="right",h="bottom";break}return r=r||{},r.x=l,r.y=u,r.align=f,r.verticalAlign=h,r}var $h="__zr_normal__",qh=Hr.concat(["ignore"]),c2=Gr(Hr,function(r,e){return r[e]=!0,r},{ignore:!1}),mi={},p2=new ht(0,0,0,0),qf=function(){function r(e){this.id=aw(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return r.prototype._init=function(e){this.attr(e)},r.prototype.drift=function(e,t,a){switch(this.draggable){case"horizontal":t=0;break;case"vertical":e=0;break}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=e,n[5]+=t,this.decomposeTransform(),this.markRedraw()},r.prototype.beforeUpdate=function(){},r.prototype.afterUpdate=function(){},r.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},r.prototype.updateInnerText=function(e){var t=this._textContent;if(t&&(!t.ignore||e)){this.textConfig||(this.textConfig={});var a=this.textConfig,n=a.local,i=t.innerTransformable,o=void 0,s=void 0,l=!1;i.parent=n?this:null;var u=!1;if(i.copyTransform(t),a.position!=null){var f=p2;a.layoutRect?f.copy(a.layoutRect):f.copy(this.getBoundingRect()),n||f.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(mi,a,f):rf(mi,a,f),i.x=mi.x,i.y=mi.y,o=mi.align,s=mi.verticalAlign;var h=a.origin;if(h&&a.rotation!=null){var v=void 0,c=void 0;h==="center"?(v=f.width*.5,c=f.height*.5):(v=_r(h[0],f.width),c=_r(h[1],f.height)),u=!0,i.originX=-i.x+v+(n?0:f.x),i.originY=-i.y+c+(n?0:f.y)}}a.rotation!=null&&(i.rotation=a.rotation);var p=a.offset;p&&(i.x+=p[0],i.y+=p[1],u||(i.originX=-p[0],i.originY=-p[1]));var d=a.inside==null?typeof a.position=="string"&&a.position.indexOf("inside")>=0:a.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),y=void 0,m=void 0,_=void 0;d&&this.canBeInsideText()?(y=a.insideFill,m=a.insideStroke,(y==null||y==="auto")&&(y=this.getInsideTextFill()),(m==null||m==="auto")&&(m=this.getInsideTextStroke(y),_=!0)):(y=a.outsideFill,m=a.outsideStroke,(y==null||y==="auto")&&(y=this.getOutsideFill()),(m==null||m==="auto")&&(m=this.getOutsideStroke(y),_=!0)),y=y||"#000",(y!==g.fill||m!==g.stroke||_!==g.autoStroke||o!==g.align||s!==g.verticalAlign)&&(l=!0,g.fill=y,g.stroke=m,g.autoStroke=_,g.align=o,g.verticalAlign=s,t.setDefaultTextStyle(g)),t.__dirty|=Vr,l&&t.dirtyStyle(!0)}},r.prototype.canBeInsideText=function(){return!0},r.prototype.getInsideTextFill=function(){return"#fff"},r.prototype.getInsideTextStroke=function(e){return"#000"},r.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?bp:xp},r.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),a=typeof t=="string"&&He(t);a||(a=[255,255,255,1]);for(var n=a[3],i=this.__zr.isDarkMode(),o=0;o<3;o++)a[o]=a[o]*n+(i?0:255)*(1-n);return a[3]=1,aa(a,"rgba")},r.prototype.traverse=function(e,t){},r.prototype.attrKV=function(e,t){e==="textConfig"?this.setTextConfig(t):e==="textContent"?this.setTextContent(t):e==="clipPath"?this.setClipPath(t):e==="extra"?(this.extra=this.extra||{},V(this.extra,t)):this[e]=t},r.prototype.hide=function(){this.ignore=!0,this.markRedraw()},r.prototype.show=function(){this.ignore=!1,this.markRedraw()},r.prototype.attr=function(e,t){if(typeof e=="string")this.attrKV(e,t);else if(et(e))for(var a=e,n=_t(a),i=0;i0},r.prototype.getState=function(e){return this.states[e]},r.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},r.prototype.clearStates=function(e){this.useState($h,!1,e)},r.prototype.useState=function(e,t,a,n){var i=e===$h,o=this.hasState();if(!(!o&&i)){var s=this.currentStates,l=this.stateTransition;if(!(ct(s,e)>=0&&(t||s.length===1))){var u;if(this.stateProxy&&!i&&(u=this.stateProxy(e)),u||(u=this.states&&this.states[e]),!u&&!i){Xd("State "+e+" not exists.");return}i||this.saveCurrentToNormalState(u);var f=!!(u&&u.hoverLayer||n);f&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,u,this._normalState,t,!a&&!this.__inHover&&l&&l.duration>0,l);var h=this._textContent,v=this._textGuide;return h&&h.useState(e,t,a,f),v&&v.useState(e,t,a,f),i?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!f&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2),u}}},r.prototype.useStates=function(e,t,a){if(!e.length)this.clearStates();else{var n=[],i=this.currentStates,o=e.length,s=o===i.length;if(s){for(var l=0;l0,p);var d=this._textContent,g=this._textGuide;d&&d.useStates(e,t,v),g&&g.useStates(e,t,v),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!v&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2)}},r.prototype.isSilent=function(){for(var e=this.silent,t=this.parent;!e&&t;){if(t.silent){e=!0;break}t=t.parent}return e},r.prototype._updateAnimationTargets=function(){for(var e=0;e=0){var a=this.currentStates.slice();a.splice(t,1),this.useStates(a)}},r.prototype.replaceState=function(e,t,a){var n=this.currentStates.slice(),i=ct(n,e),o=ct(n,t)>=0;i>=0?o?n.splice(i,1):n[i]=t:a&&!o&&n.push(t),this.useStates(n)},r.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},r.prototype._mergeStates=function(e){for(var t={},a,n=0;n=0&&i.splice(o,1)}),this.animators.push(e),a&&a.animation.addAnimator(e),a&&a.wakeUp()},r.prototype.updateDuringAnimation=function(e){this.markRedraw()},r.prototype.stopAnimation=function(e,t){for(var a=this.animators,n=a.length,i=[],o=0;o0&&t.during&&i[0].during(function(p,d){t.during(d)});for(var v=0;v0||n.force&&!o.length){var T=void 0,A=void 0,C=void 0;if(s){A={},v&&(T={});for(var S=0;S<_;S++){var y=d[S];A[y]=t[y],v?T[y]=a[y]:t[y]=a[y]}}else if(v){C={};for(var S=0;S<_;S++){var y=d[S];C[y]=ds(t[y]),g2(t,a,y)}}var b=new eg(t,!1,!1,h?Ct(p,function(I){return I.targetName===e}):null);b.targetName=e,n.scope&&(b.scope=n.scope),v&&T&&b.whenWithKeys(0,T,d),C&&b.whenWithKeys(0,C,d),b.whenWithKeys(u??500,s?A:a,d).delay(f||0),r.addAnimator(b,e),o.push(b)}}var at=function(r){k(e,r);function e(t){var a=r.call(this)||this;return a.isGroup=!0,a._children=[],a.attr(t),a}return e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(t){return this._children[t]},e.prototype.childOfName=function(t){for(var a=this._children,n=0;n=0&&(n.splice(i,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,a){var n=ct(this._children,t);return n>=0&&this.replaceAt(a,n),this},e.prototype.replaceAt=function(t,a){var n=this._children,i=n[a];if(t&&t!==this&&t.parent!==this&&t!==i){n[a]=t,i.parent=null;var o=this.__zr;o&&i.removeSelfFromZr(o),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var a=this.__zr;a&&a!==t.__zr&&t.addSelfToZr(a),a&&a.refresh()},e.prototype.remove=function(t){var a=this.__zr,n=this._children,i=ct(n,t);return i<0?this:(n.splice(i,1),t.parent=null,a&&t.removeSelfFromZr(a),a&&a.refresh(),this)},e.prototype.removeAll=function(){for(var t=this._children,a=this.__zr,n=0;n0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},r.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},r.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},r.prototype.refreshHover=function(){this._needsRefreshHover=!0},r.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&this.painter.getType()==="canvas"&&this.painter.refreshHover())},r.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},r.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},r.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},r.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},r.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},r.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},r.prototype.on=function(e,t,a){return this._disposed||this.handler.on(e,t,a),this},r.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},r.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},r.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t0){if(r<=n)return o;if(r>=i)return s}else{if(r>=n)return o;if(r<=i)return s}else{if(r===n)return o;if(r===i)return s}return(r-n)/l*u+o}function W(r,e){switch(r){case"center":case"middle":r="50%";break;case"left":case"top":r="0%";break;case"right":case"bottom":r="100%";break}return Y(r)?C2(r).match(/%$/)?parseFloat(r)/100*e:parseFloat(r):r==null?NaN:+r}function Ut(r,e,t){return e==null&&(e=10),e=Math.min(Math.max(0,e),Ew),r=(+r).toFixed(e),t?r:+r}function ar(r){return r.sort(function(e,t){return e-t}),r}function Er(r){if(r=+r,isNaN(r))return 0;if(r>1e-14){for(var e=1,t=0;t<15;t++,e*=10)if(Math.round(r*e)/e===r)return t}return D2(r)}function D2(r){var e=r.toString().toLowerCase(),t=e.indexOf("e"),a=t>0?+e.slice(t+1):0,n=t>0?t:e.length,i=e.indexOf("."),o=i<0?0:n-1-i;return Math.max(0,o-a)}function kw(r,e){var t=Math.log,a=Math.LN10,n=Math.floor(t(r[1]-r[0])/a),i=Math.round(t(Math.abs(e[1]-e[0]))/a),o=Math.min(Math.max(-n+i,0),20);return isFinite(o)?o:20}function M2(r,e){var t=Gr(r,function(c,p){return c+(isNaN(p)?0:p)},0);if(t===0)return[];for(var a=Math.pow(10,e),n=G(r,function(c){return(isNaN(c)?0:c)/t*a*100}),i=a*100,o=G(n,function(c){return Math.floor(c)}),s=Gr(o,function(c,p){return c+p},0),l=G(n,function(c,p){return c-o[p]});su&&(u=l[h],f=h);++o[f],l[f]=0,++s}return G(o,function(c){return c/a})}function I2(r,e){var t=Math.max(Er(r),Er(e)),a=r+e;return t>Ew?a:Ut(a,t)}var Cm=9007199254740991;function Ow(r){var e=Math.PI*2;return(r%e+e)%e}function Es(r){return r>-1e-4&&r=10&&e++,e}function Nw(r,e){var t=rg(r),a=Math.pow(10,t),n=r/a,i;return n<1.5?i=1:n<2.5?i=2:n<4?i=3:n<7?i=5:i=10,r=i*a,t>=-20?+r.toFixed(t<0?-t:0):r}function Qh(r,e){var t=(r.length-1)*e+1,a=Math.floor(t),n=+r[a-1],i=t-a;return i?n+i*(r[a]-n):n}function Dm(r){r.sort(function(l,u){return s(l,u,0)?-1:1});for(var e=-1/0,t=1,a=0;a=0||i&&ct(i,l)<0)){var u=a.getShallow(l,e);u!=null&&(o[r[s][0]]=u)}}return o}}var eP=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],rP=ei(eP),aP=function(){function r(){}return r.prototype.getAreaStyle=function(e,t){return rP(this,e,t)},r}(),Ap=new al(50);function nP(r){if(typeof r=="string"){var e=Ap.get(r);return e&&e.image}else return r}function og(r,e,t,a,n){if(r)if(typeof r=="string"){if(e&&e.__zrImageSrc===r||!t)return e;var i=Ap.get(r),o={hostEl:t,cb:a,cbPayload:n};return i?(e=i.image,!Jf(e)&&i.pending.push(o)):(e=Ya.loadImage(r,Pm,Pm),e.__zrImageSrc=r,Ap.put(r,e.__cachedImgObj={image:e,pending:[o]})),e}else return r;else return e}function Pm(){var r=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=o;l++)s-=o;var u=We(t,e);return u>s&&(t="",u=0),s=r-u,n.ellipsis=t,n.ellipsisWidth=u,n.contentWidth=s,n.containerWidth=r,n}function qw(r,e,t){var a=t.containerWidth,n=t.font,i=t.contentWidth;if(!a){r.textLine="",r.isTruncated=!1;return}var o=We(e,n);if(o<=a){r.textLine=e,r.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=t.maxIterations){e+=t.ellipsis;break}var l=s===0?oP(e,i,t.ascCharWidth,t.cnCharWidth):o>0?Math.floor(e.length*i/o):0;e=e.substr(0,l),o=We(e,n)}e===""&&(e=t.placeholder),r.textLine=e,r.isTruncated=!0}function oP(r,e,t,a){for(var n=0,i=0,o=r.length;ip&&u){var d=Math.floor(p/s);f=f||v.length>d,v=v.slice(0,d)}if(r&&i&&h!=null)for(var g=$w(h,n,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),y={},m=0;ms&&tv(t,r.substring(s,u),e,o),tv(t,l[2],e,o,l[1]),s=jh.lastIndex}sn){var L=t.lines.length;x>0?(_.tokens=_.tokens.slice(0,x),y(_,b,S),t.lines=t.lines.slice(0,m+1)):t.lines=t.lines.slice(0,m),t.isTruncated=t.isTruncated||t.lines.length0&&p+a.accumWidth>a.width&&(f=e.split(` +`),u=!0),a.accumWidth=p}else{var d=Kw(e,l,a.width,a.breakAll,a.accumWidth);a.accumWidth=d.accumWidth+c,h=d.linesWidths,f=d.lines}}else f=e.split(` +`);for(var g=0;g=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}var vP=Gr(",&?/;] ".split(""),function(r,e){return r[e]=!0,r},{});function cP(r){return hP(r)?!!vP[r]:!0}function Kw(r,e,t,a,n){for(var i=[],o=[],s="",l="",u=0,f=0,h=0;ht:n+f+c>t){f?(s||l)&&(p?(s||(s=l,l="",u=0,f=u),i.push(s),o.push(f-u),l+=v,u+=c,s="",f=u):(l&&(s+=l,l="",u=0),i.push(s),o.push(f),s=v,f=c)):p?(i.push(l),o.push(u),l=v,u=c):(i.push(v),o.push(c));continue}f+=c,p?(l+=v,u+=c):(l&&(s+=l,l="",u=0),s+=v)}return!i.length&&!s&&(s=r,l="",u=0),l&&(s+=l),s&&(i.push(s),o.push(f)),i.length===1&&(f+=n),{accumWidth:f,lines:i,linesWidths:o}}var Cp="__zr_style_"+Math.round(Math.random()*10),Xn={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},Qf={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Xn[Cp]=!0;var Em=["z","z2","invisible"],pP=["invisible"],ir=function(r){k(e,r);function e(t){return r.call(this,t)||this}return e.prototype._init=function(t){for(var a=_t(t),n=0;n1e-4){s[0]=r-t,s[1]=e-a,l[0]=r+t,l[1]=e+a;return}if(Ol[0]=nv(n)*t+r,Ol[1]=av(n)*a+e,Nl[0]=nv(i)*t+r,Nl[1]=av(i)*a+e,u(s,Ol,Nl),f(l,Ol,Nl),n=n%un,n<0&&(n=n+un),i=i%un,i<0&&(i=i+un),n>i&&!o?i+=un:nn&&(Bl[0]=nv(c)*t+r,Bl[1]=av(c)*a+e,u(s,Bl,s),f(l,Bl,l))}var kt={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},fn=[],hn=[],wr=[],ma=[],Tr=[],Ar=[],iv=Math.min,ov=Math.max,vn=Math.cos,cn=Math.sin,$r=Math.abs,Dp=Math.PI,Da=Dp*2,sv=typeof Float32Array<"u",Lo=[];function lv(r){var e=Math.round(r/Dp*1e8)/1e8;return e%2*Dp}function sg(r,e){var t=lv(r[0]);t<0&&(t+=Da);var a=t-r[0],n=r[1];n+=a,!e&&n-t>=Da?n=t+Da:e&&t-n>=Da?n=t-Da:!e&&t>n?n=t+(Da-lv(t-n)):e&&t0&&(this._ux=$r(a/ef/e)||0,this._uy=$r(a/ef/t)||0)},r.prototype.setDPR=function(e){this.dpr=e},r.prototype.setContext=function(e){this._ctx=e},r.prototype.getContext=function(){return this._ctx},r.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},r.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},r.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(kt.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},r.prototype.lineTo=function(e,t){var a=$r(e-this._xi),n=$r(t-this._yi),i=a>this._ux||n>this._uy;if(this.addData(kt.L,e,t),this._ctx&&i&&this._ctx.lineTo(e,t),i)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var o=a*a+n*n;o>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=o)}return this},r.prototype.bezierCurveTo=function(e,t,a,n,i,o){return this._drawPendingPt(),this.addData(kt.C,e,t,a,n,i,o),this._ctx&&this._ctx.bezierCurveTo(e,t,a,n,i,o),this._xi=i,this._yi=o,this},r.prototype.quadraticCurveTo=function(e,t,a,n){return this._drawPendingPt(),this.addData(kt.Q,e,t,a,n),this._ctx&&this._ctx.quadraticCurveTo(e,t,a,n),this._xi=a,this._yi=n,this},r.prototype.arc=function(e,t,a,n,i,o){this._drawPendingPt(),Lo[0]=n,Lo[1]=i,sg(Lo,o),n=Lo[0],i=Lo[1];var s=i-n;return this.addData(kt.A,e,t,a,a,n,s,0,o?0:1),this._ctx&&this._ctx.arc(e,t,a,n,i,o),this._xi=vn(i)*a+e,this._yi=cn(i)*a+t,this},r.prototype.arcTo=function(e,t,a,n,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,a,n,i),this},r.prototype.rect=function(e,t,a,n){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,a,n),this.addData(kt.R,e,t,a,n),this},r.prototype.closePath=function(){this._drawPendingPt(),this.addData(kt.Z);var e=this._ctx,t=this._x0,a=this._y0;return e&&e.closePath(),this._xi=t,this._yi=a,this},r.prototype.fill=function(e){e&&e.fill(),this.toStatic()},r.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},r.prototype.len=function(){return this._len},r.prototype.setData=function(e){var t=e.length;!(this.data&&this.data.length===t)&&sv&&(this.data=new Float32Array(t));for(var a=0;af.length&&(this._expandData(),f=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},r.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t11&&(this.data=new Float32Array(e)))}},r.prototype.getBoundingRect=function(){wr[0]=wr[1]=Tr[0]=Tr[1]=Number.MAX_VALUE,ma[0]=ma[1]=Ar[0]=Ar[1]=-Number.MAX_VALUE;var e=this.data,t=0,a=0,n=0,i=0,o;for(o=0;oa||$r(_)>n||v===t-1)&&(d=Math.sqrt(m*m+_*_),i=g,o=y);break}case kt.C:{var S=e[v++],b=e[v++],g=e[v++],y=e[v++],x=e[v++],w=e[v++];d=OL(i,o,S,b,g,y,x,w,10),i=x,o=w;break}case kt.Q:{var S=e[v++],b=e[v++],g=e[v++],y=e[v++];d=BL(i,o,S,b,g,y,10),i=g,o=y;break}case kt.A:var T=e[v++],A=e[v++],C=e[v++],M=e[v++],I=e[v++],L=e[v++],P=L+I;v+=1,p&&(s=vn(I)*C+T,l=cn(I)*M+A),d=ov(C,M)*iv(Da,Math.abs(L)),i=vn(P)*C+T,o=cn(P)*M+A;break;case kt.R:{s=i=e[v++],l=o=e[v++];var R=e[v++],E=e[v++];d=R*2+E*2;break}case kt.Z:{var m=s-i,_=l-o;d=Math.sqrt(m*m+_*_),i=s,o=l;break}}d>=0&&(u[h++]=d,f+=d)}return this._pathLen=f,f},r.prototype.rebuildPath=function(e,t){var a=this.data,n=this._ux,i=this._uy,o=this._len,s,l,u,f,h,v,c=t<1,p,d,g=0,y=0,m,_=0,S,b;if(!(c&&(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,d=this._pathLen,m=t*d,!m)))t:for(var x=0;x0&&(e.lineTo(S,b),_=0),w){case kt.M:s=u=a[x++],l=f=a[x++],e.moveTo(u,f);break;case kt.L:{h=a[x++],v=a[x++];var A=$r(h-u),C=$r(v-f);if(A>n||C>i){if(c){var M=p[y++];if(g+M>m){var I=(m-g)/M;e.lineTo(u*(1-I)+h*I,f*(1-I)+v*I);break t}g+=M}e.lineTo(h,v),u=h,f=v,_=0}else{var L=A*A+C*C;L>_&&(S=h,b=v,_=L)}break}case kt.C:{var P=a[x++],R=a[x++],E=a[x++],N=a[x++],O=a[x++],B=a[x++];if(c){var M=p[y++];if(g+M>m){var I=(m-g)/M;Xa(u,P,E,O,I,fn),Xa(f,R,N,B,I,hn),e.bezierCurveTo(fn[1],hn[1],fn[2],hn[2],fn[3],hn[3]);break t}g+=M}e.bezierCurveTo(P,R,E,N,O,B),u=O,f=B;break}case kt.Q:{var P=a[x++],R=a[x++],E=a[x++],N=a[x++];if(c){var M=p[y++];if(g+M>m){var I=(m-g)/M;Ls(u,P,E,I,fn),Ls(f,R,N,I,hn),e.quadraticCurveTo(fn[1],hn[1],fn[2],hn[2]);break t}g+=M}e.quadraticCurveTo(P,R,E,N),u=E,f=N;break}case kt.A:var F=a[x++],H=a[x++],U=a[x++],K=a[x++],Q=a[x++],it=a[x++],Lt=a[x++],Wt=!a[x++],vt=U>K?U:K,tt=$r(U-K)>.001,pt=Q+it,q=!1;if(c){var M=p[y++];g+M>m&&(pt=Q+it*(m-g)/M,q=!0),g+=M}if(tt&&e.ellipse?e.ellipse(F,H,U,K,Lt,Q,pt,Wt):e.arc(F,H,vt,Q,pt,Wt),q)break t;T&&(s=vn(Q)*U+F,l=cn(Q)*K+H),u=vn(pt)*U+F,f=cn(pt)*K+H;break;case kt.R:s=u=a[x],l=f=a[x+1],h=a[x++],v=a[x++];var ot=a[x++],Ot=a[x++];if(c){var M=p[y++];if(g+M>m){var It=m-g;e.moveTo(h,v),e.lineTo(h+iv(It,ot),v),It-=ot,It>0&&e.lineTo(h+ot,v+iv(It,Ot)),It-=Ot,It>0&&e.lineTo(h+ov(ot-It,0),v+Ot),It-=ot,It>0&&e.lineTo(h,v+ov(Ot-It,0));break t}g+=M}e.rect(h,v,ot,Ot);break;case kt.Z:if(c){var M=p[y++];if(g+M>m){var I=(m-g)/M;e.lineTo(u*(1-I)+s*I,f*(1-I)+l*I);break t}g+=M}e.closePath(),u=s,f=l}}},r.prototype.clone=function(){var e=new r,t=this.data;return e.data=t.slice?t.slice():Array.prototype.slice.call(t),e._len=this._len,e},r.CMD=kt,r.initDefaultProps=function(){var e=r.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),r}();function Ia(r,e,t,a,n,i,o){if(n===0)return!1;var s=n,l=0,u=r;if(o>e+s&&o>a+s||or+s&&i>t+s||ie+h&&f>a+h&&f>i+h&&f>s+h||fr+h&&u>t+h&&u>n+h&&u>o+h||ue+u&&l>a+u&&l>i+u||lr+u&&s>t+u&&s>n+u||st||f+un&&(n+=Po);var v=Math.atan2(l,s);return v<0&&(v+=Po),v>=a&&v<=n||v+Po>=a&&v+Po<=n}function Qr(r,e,t,a,n,i){if(i>e&&i>a||in?s:0}var _a=Ur.CMD,pn=Math.PI*2,xP=1e-4;function bP(r,e){return Math.abs(r-e)e&&u>a&&u>i&&u>s||u1&&wP(),c=te(e,a,i,s,Je[0]),v>1&&(p=te(e,a,i,s,Je[1]))),v===2?ge&&s>a&&s>i||s=0&&u<=1){for(var f=0,h=oe(e,a,i,u),v=0;vt||s<-t)return 0;var l=Math.sqrt(t*t-s*s);xe[0]=-l,xe[1]=l;var u=Math.abs(a-n);if(u<1e-4)return 0;if(u>=pn-1e-4){a=0,n=pn;var f=i?1:-1;return o>=xe[0]+r&&o<=xe[1]+r?f:0}if(a>n){var h=a;a=n,n=h}a<0&&(a+=pn,n+=pn);for(var v=0,c=0;c<2;c++){var p=xe[c];if(p+r>o){var d=Math.atan2(s,p),f=i?1:-1;d<0&&(d=pn+d),(d>=a&&d<=n||d+pn>=a&&d+pn<=n)&&(d>Math.PI/2&&d1&&(t||(s+=Qr(l,u,f,h,a,n))),g&&(l=i[p],u=i[p+1],f=l,h=u),d){case _a.M:f=i[p++],h=i[p++],l=f,u=h;break;case _a.L:if(t){if(Ia(l,u,i[p],i[p+1],e,a,n))return!0}else s+=Qr(l,u,i[p],i[p+1],a,n)||0;l=i[p++],u=i[p++];break;case _a.C:if(t){if(_P(l,u,i[p++],i[p++],i[p++],i[p++],i[p],i[p+1],e,a,n))return!0}else s+=TP(l,u,i[p++],i[p++],i[p++],i[p++],i[p],i[p+1],a,n)||0;l=i[p++],u=i[p++];break;case _a.Q:if(t){if(Jw(l,u,i[p++],i[p++],i[p],i[p+1],e,a,n))return!0}else s+=AP(l,u,i[p++],i[p++],i[p],i[p+1],a,n)||0;l=i[p++],u=i[p++];break;case _a.A:var y=i[p++],m=i[p++],_=i[p++],S=i[p++],b=i[p++],x=i[p++];p+=1;var w=!!(1-i[p++]);v=Math.cos(b)*_+y,c=Math.sin(b)*S+m,g?(f=v,h=c):s+=Qr(l,u,v,c,a,n);var T=(a-y)*S/_+y;if(t){if(SP(y,m,S,b,b+x,w,e,T,n))return!0}else s+=CP(y,m,S,b,b+x,w,T,n);l=Math.cos(b+x)*_+y,u=Math.sin(b+x)*S+m;break;case _a.R:f=l=i[p++],h=u=i[p++];var A=i[p++],C=i[p++];if(v=f+A,c=h+C,t){if(Ia(f,h,v,h,e,a,n)||Ia(v,h,v,c,e,a,n)||Ia(v,c,f,c,e,a,n)||Ia(f,c,f,h,e,a,n))return!0}else s+=Qr(v,h,v,c,a,n),s+=Qr(f,c,f,h,a,n);break;case _a.Z:if(t){if(Ia(l,u,f,h,e,a,n))return!0}else s+=Qr(l,u,f,h,a,n);l=f,u=h;break}}return!t&&!bP(u,h)&&(s+=Qr(l,u,f,h,a,n)||0),s!==0}function DP(r,e,t){return Qw(r,0,!1,e,t)}function MP(r,e,t,a){return Qw(r,e,!0,t,a)}var af=j({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Xn),IP={style:j({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},Qf.style)},uv=Hr.concat(["invisible","culling","z","z2","zlevel","parent"]),gt=function(r){k(e,r);function e(t){return r.call(this,t)||this}return e.prototype.update=function(){var t=this;r.prototype.update.call(this);var a=this.style;if(a.decal){var n=this._decalEl=this._decalEl||new e;n.buildPath===e.prototype.buildPath&&(n.buildPath=function(l){t.buildPath(l,t.shape)}),n.silent=!0;var i=n.style;for(var o in a)i[o]!==a[o]&&(i[o]=a[o]);i.fill=a.fill?a.decal:null,i.decal=null,i.shadowColor=null,a.strokeFirst&&(i.stroke=null);for(var s=0;s.5?xp:a>.2?h2:bp}else if(t)return bp}return xp},e.prototype.getInsideTextStroke=function(t){var a=this.style.fill;if(Y(a)){var n=this.__zr,i=!!(n&&n.isDarkMode()),o=ju(t,0)0))},e.prototype.hasFill=function(){var t=this.style,a=t.fill;return a!=null&&a!=="none"},e.prototype.getBoundingRect=function(){var t=this._rect,a=this.style,n=!t;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var o=this.path;(i||this.__dirty&ts)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),t=o.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){s.copy(t);var l=a.strokeNoScale?this.getLineScale():1,u=a.lineWidth;if(!this.hasFill()){var f=this.strokeContainThreshold;u=Math.max(u,f??4)}l>1e-10&&(s.width+=u/l,s.height+=u/l,s.x-=u/l/2,s.y-=u/l/2)}return s}return t},e.prototype.contain=function(t,a){var n=this.transformCoordToLocal(t,a),i=this.getBoundingRect(),o=this.style;if(t=n[0],a=n[1],i.contain(t,a)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,u=o.strokeNoScale?this.getLineScale():1;if(u>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),MP(s,l/u,t,a)))return!0}if(this.hasFill())return DP(s,t,a)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=ts,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){t==="style"?this.dirtyStyle():t==="shape"?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(t,a){t==="shape"?this.setShape(a):r.prototype.attrKV.call(this,t,a)},e.prototype.setShape=function(t,a){var n=this.shape;return n||(n=this.shape={}),typeof t=="string"?n[t]=a:V(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&ts)},e.prototype.createStyle=function(t){return Yf(af,t)},e.prototype._innerSaveToNormal=function(t){r.prototype._innerSaveToNormal.call(this,t);var a=this._normalState;t.shape&&!a.shape&&(a.shape=V({},this.shape))},e.prototype._applyStateObj=function(t,a,n,i,o,s){r.prototype._applyStateObj.call(this,t,a,n,i,o,s);var l=!(a&&i),u;if(a&&a.shape?o?i?u=a.shape:(u=V({},n.shape),V(u,a.shape)):(u=V({},i?this.shape:n.shape),V(u,a.shape)):l&&(u=n.shape),u)if(o){this.shape=V({},this.shape);for(var f={},h=_t(u),v=0;v0},e.prototype.hasFill=function(){var t=this.style,a=t.fill;return a!=null&&a!=="none"},e.prototype.createStyle=function(t){return Yf(LP,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var a=t.text;a!=null?a+="":a="";var n=nl(a,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var i=t.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},e.initDefaultProps=function(){var t=e.prototype;t.dirtyRectTolerance=10}(),e}(ir);Qi.prototype.type="tspan";var PP=j({x:0,y:0},Xn),RP={style:j({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},Qf.style)};function EP(r){return!!(r&&typeof r!="string"&&r.width&&r.height)}var le=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.createStyle=function(t){return Yf(PP,t)},e.prototype._getSize=function(t){var a=this.style,n=a[t];if(n!=null)return n;var i=EP(a.image)?a.image:this.__image;if(!i)return 0;var o=t==="width"?"height":"width",s=a[o];return s==null?i[t]:i[t]/i[o]*s},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return RP},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new ht(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(ir);le.prototype.type="image";function kP(r,e){var t=e.x,a=e.y,n=e.width,i=e.height,o=e.r,s,l,u,f;n<0&&(t=t+n,n=-n),i<0&&(a=a+i,i=-i),typeof o=="number"?s=l=u=f=o:o instanceof Array?o.length===1?s=l=u=f=o[0]:o.length===2?(s=u=o[0],l=f=o[1]):o.length===3?(s=o[0],l=f=o[1],u=o[2]):(s=o[0],l=o[1],u=o[2],f=o[3]):s=l=u=f=0;var h;s+l>n&&(h=s+l,s*=n/h,l*=n/h),u+f>n&&(h=u+f,u*=n/h,f*=n/h),l+u>i&&(h=l+u,l*=i/h,u*=i/h),s+f>i&&(h=s+f,s*=i/h,f*=i/h),r.moveTo(t+s,a),r.lineTo(t+n-l,a),l!==0&&r.arc(t+n-l,a+l,l,-Math.PI/2,0),r.lineTo(t+n,a+i-u),u!==0&&r.arc(t+n-u,a+i-u,u,0,Math.PI/2),r.lineTo(t+f,a+i),f!==0&&r.arc(t+f,a+i-f,f,Math.PI/2,Math.PI),r.lineTo(t,a+s),s!==0&&r.arc(t+s,a+s,s,Math.PI,Math.PI*1.5)}var Hi=Math.round;function jw(r,e,t){if(e){var a=e.x1,n=e.x2,i=e.y1,o=e.y2;r.x1=a,r.x2=n,r.y1=i,r.y2=o;var s=t&&t.lineWidth;return s&&(Hi(a*2)===Hi(n*2)&&(r.x1=r.x2=Bn(a,s,!0)),Hi(i*2)===Hi(o*2)&&(r.y1=r.y2=Bn(i,s,!0))),r}}function tT(r,e,t){if(e){var a=e.x,n=e.y,i=e.width,o=e.height;r.x=a,r.y=n,r.width=i,r.height=o;var s=t&&t.lineWidth;return s&&(r.x=Bn(a,s,!0),r.y=Bn(n,s,!0),r.width=Math.max(Bn(a+i,s,!1)-r.x,i===0?0:1),r.height=Math.max(Bn(n+o,s,!1)-r.y,o===0?0:1)),r}}function Bn(r,e,t){if(!e)return r;var a=Hi(r*2);return(a+Hi(e))%2===0?a/2:(a+(t?1:-1))/2}var OP=function(){function r(){this.x=0,this.y=0,this.width=0,this.height=0}return r}(),NP={},St=function(r){k(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new OP},e.prototype.buildPath=function(t,a){var n,i,o,s;if(this.subPixelOptimize){var l=tT(NP,a,this.style);n=l.x,i=l.y,o=l.width,s=l.height,l.r=a.r,a=l}else n=a.x,i=a.y,o=a.width,s=a.height;a.r?kP(t,a):t.rect(n,i,o,s)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(gt);St.prototype.type="rect";var Vm={fill:"#000"},zm=2,BP={style:j({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},Qf.style)},bt=function(r){k(e,r);function e(t){var a=r.call(this)||this;return a.type="text",a._children=[],a._defaultStyle=Vm,a.attr(t),a}return e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){r.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;t0,I=t.width!=null&&(t.overflow==="truncate"||t.overflow==="break"||t.overflow==="breakAll"),L=o.calculatedLineHeight,P=0;P=0&&(P=x[L],P.align==="right");)this._placeToken(P,t,T,y,I,"right",_),A-=P.width,I-=P.width,L--;for(M+=(i-(M-g)-(m-I)-A)/2;C<=L;)P=x[C],this._placeToken(P,t,T,y,M+P.width/2,"center",_),M+=P.width,C++;y+=T}},e.prototype._placeToken=function(t,a,n,i,o,s,l){var u=a.rich[t.styleName]||{};u.text=t.text;var f=t.verticalAlign,h=i+n/2;f==="top"?h=i+t.height/2:f==="bottom"&&(h=i+n-t.height/2);var v=!t.isLineHolder&&fv(u);v&&this._renderBackground(u,a,s==="right"?o-t.width:s==="center"?o-t.width/2:o,h-t.height/2,t.width,t.height);var c=!!u.backgroundColor,p=t.textPadding;p&&(o=Ym(o,s,p),h-=t.height/2-p[0]-t.innerHeight/2);var d=this._getOrCreateChild(Qi),g=d.createStyle();d.useStyle(g);var y=this._defaultStyle,m=!1,_=0,S=Um("fill"in u?u.fill:"fill"in a?a.fill:(m=!0,y.fill)),b=Wm("stroke"in u?u.stroke:"stroke"in a?a.stroke:!c&&!l&&(!y.autoStroke||m)?(_=zm,y.stroke):null),x=u.textShadowBlur>0||a.textShadowBlur>0;g.text=t.text,g.x=o,g.y=h,x&&(g.shadowBlur=u.textShadowBlur||a.textShadowBlur||0,g.shadowColor=u.textShadowColor||a.textShadowColor||"transparent",g.shadowOffsetX=u.textShadowOffsetX||a.textShadowOffsetX||0,g.shadowOffsetY=u.textShadowOffsetY||a.textShadowOffsetY||0),g.textAlign=s,g.textBaseline="middle",g.font=t.font||Ua,g.opacity=Br(u.opacity,a.opacity,1),Fm(g,u),b&&(g.lineWidth=Br(u.lineWidth,a.lineWidth,_),g.lineDash=st(u.lineDash,a.lineDash),g.lineDashOffset=a.lineDashOffset||0,g.stroke=b),S&&(g.fill=S);var w=t.contentWidth,T=t.contentHeight;d.setBoundingRect(new ht(rs(g.x,w,g.textAlign),Bi(g.y,T,g.textBaseline),w,T))},e.prototype._renderBackground=function(t,a,n,i,o,s){var l=t.backgroundColor,u=t.borderWidth,f=t.borderColor,h=l&&l.image,v=l&&!h,c=t.borderRadius,p=this,d,g;if(v||t.lineHeight||u&&f){d=this._getOrCreateChild(St),d.useStyle(d.createStyle()),d.style.fill=null;var y=d.shape;y.x=n,y.y=i,y.width=o,y.height=s,y.r=c,d.dirtyShape()}if(v){var m=d.style;m.fill=l||null,m.fillOpacity=st(t.fillOpacity,1)}else if(h){g=this._getOrCreateChild(le),g.onload=function(){p.dirtyStyle()};var _=g.style;_.image=l.image,_.x=n,_.y=i,_.width=o,_.height=s}if(u&&f){var m=d.style;m.lineWidth=u,m.stroke=f,m.strokeOpacity=st(t.strokeOpacity,1),m.lineDash=t.borderDash,m.lineDashOffset=t.borderDashOffset||0,d.strokeContainThreshold=0,d.hasFill()&&d.hasStroke()&&(m.strokeFirst=!0,m.lineWidth*=2)}var S=(d||g).style;S.shadowBlur=t.shadowBlur||0,S.shadowColor=t.shadowColor||"transparent",S.shadowOffsetX=t.shadowOffsetX||0,S.shadowOffsetY=t.shadowOffsetY||0,S.opacity=Br(t.opacity,a.opacity,1)},e.makeFont=function(t){var a="";return rT(t)&&(a=[t.fontStyle,t.fontWeight,eT(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),a&&dr(a)||t.textFont||t.font},e}(ir),VP={left:!0,right:1,center:1},zP={top:1,bottom:1,middle:1},Gm=["fontStyle","fontWeight","fontSize","fontFamily"];function eT(r){return typeof r=="string"&&(r.indexOf("px")!==-1||r.indexOf("rem")!==-1||r.indexOf("em")!==-1)?r:isNaN(+r)?Wd+"px":r+"px"}function Fm(r,e){for(var t=0;t=0,i=!1;if(r instanceof gt){var o=aT(r),s=n&&o.selectFill||o.normalFill,l=n&&o.selectStroke||o.normalStroke;if(_i(s)||_i(l)){a=a||{};var u=a.style||{};u.fill==="inherit"?(i=!0,a=V({},a),u=V({},u),u.fill=s):!_i(u.fill)&&_i(s)?(i=!0,a=V({},a),u=V({},u),u.fill=cp(s)):!_i(u.stroke)&&_i(l)&&(i||(a=V({},a),u=V({},u)),u.stroke=cp(l)),a.style=u}}if(a&&a.z2==null){i||(a=V({},a));var f=r.z2EmphasisLift;a.z2=r.z2+(f??vo)}return a}function XP(r,e,t){if(t&&t.z2==null){t=V({},t);var a=r.z2SelectLift;t.z2=r.z2+(a??FP)}return t}function ZP(r,e,t){var a=ct(r.currentStates,e)>=0,n=r.style.opacity,i=a?null:UP(r,["opacity"],e,{opacity:1});t=t||{};var o=t.style||{};return o.opacity==null&&(t=V({},t),o=V({opacity:a?n:i.opacity*.1},o),t.style=o),t}function hv(r,e){var t=this.states[r];if(this.style){if(r==="emphasis")return YP(this,r,e,t);if(r==="blur")return ZP(this,r,t);if(r==="select")return XP(this,r,t)}return t}function ri(r){r.stateProxy=hv;var e=r.getTextContent(),t=r.getTextGuideLine();e&&(e.stateProxy=hv),t&&(t.stateProxy=hv)}function Km(r,e){!fT(r,e)&&!r.__highByOuter&&pa(r,nT)}function Jm(r,e){!fT(r,e)&&!r.__highByOuter&&pa(r,iT)}function la(r,e){r.__highByOuter|=1<<(e||0),pa(r,nT)}function ua(r,e){!(r.__highByOuter&=~(1<<(e||0)))&&pa(r,iT)}function sT(r){pa(r,fg)}function hg(r){pa(r,oT)}function lT(r){pa(r,HP)}function uT(r){pa(r,WP)}function fT(r,e){return r.__highDownSilentOnTouch&&e.zrByTouch}function hT(r){var e=r.getModel(),t=[],a=[];e.eachComponent(function(n,i){var o=lg(i),s=n==="series",l=s?r.getViewOfSeriesModel(i):r.getViewOfComponentModel(i);!s&&a.push(l),o.isBlured&&(l.group.traverse(function(u){oT(u)}),s&&t.push(i)),o.isBlured=!1}),D(a,function(n){n&&n.toggleBlurSeries&&n.toggleBlurSeries(t,!1,e)})}function Ip(r,e,t,a){var n=a.getModel();t=t||"coordinateSystem";function i(u,f){for(var h=0;h0){var s={dataIndex:o,seriesIndex:t.seriesIndex};i!=null&&(s.dataType=i),e.push(s)}})}),e}function $n(r,e,t){Vn(r,!0),pa(r,ri),Pp(r,e,t)}function jP(r){Vn(r,!1)}function Ht(r,e,t,a){a?jP(r):$n(r,e,t)}function Pp(r,e,t){var a=nt(r);e!=null?(a.focus=e,a.blurScope=t):a.focus&&(a.focus=null)}var jm=["emphasis","blur","select"],tR={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function he(r,e,t,a){t=t||"itemStyle";for(var n=0;n1&&(o*=vv(p),s*=vv(p));var d=(n===i?-1:1)*vv((o*o*(s*s)-o*o*(c*c)-s*s*(v*v))/(o*o*(c*c)+s*s*(v*v)))||0,g=d*o*c/s,y=d*-s*v/o,m=(r+t)/2+zl(h)*g-Vl(h)*y,_=(e+a)/2+Vl(h)*g+zl(h)*y,S=a0([1,0],[(v-g)/o,(c-y)/s]),b=[(v-g)/o,(c-y)/s],x=[(-1*v-g)/o,(-1*c-y)/s],w=a0(b,x);if(Ep(b,x)<=-1&&(w=Ro),Ep(b,x)>=1&&(w=0),w<0){var T=Math.round(w/Ro*1e6)/1e6;w=Ro*2+T%2*Ro}f.addData(u,m,_,o,s,S,w,h,i)}var oR=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,sR=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function lR(r){var e=new Ur;if(!r)return e;var t=0,a=0,n=t,i=a,o,s=Ur.CMD,l=r.match(oR);if(!l)return e;for(var u=0;uP*P+R*R&&(T=C,A=M),{cx:T,cy:A,x0:-f,y0:-h,x1:T*(n/b-1),y1:A*(n/b-1)}}function dR(r){var e;if(z(r)){var t=r.length;if(!t)return r;t===1?e=[r[0],r[0],0,0]:t===2?e=[r[0],r[0],r[1],r[1]]:t===3?e=r.concat(r[2]):e=r}else e=[r,r,r,r];return e}function gR(r,e){var t,a=as(e.r,0),n=as(e.r0||0,0),i=a>0,o=n>0;if(!(!i&&!o)){if(i||(a=n,n=0),n>a){var s=a;a=n,n=s}var l=e.startAngle,u=e.endAngle;if(!(isNaN(l)||isNaN(u))){var f=e.cx,h=e.cy,v=!!e.clockwise,c=i0(u-l),p=c>cv&&c%cv;if(p>hr&&(c=p),!(a>hr))r.moveTo(f,h);else if(c>cv-hr)r.moveTo(f+a*xi(l),h+a*dn(l)),r.arc(f,h,a,l,u,!v),n>hr&&(r.moveTo(f+n*xi(u),h+n*dn(u)),r.arc(f,h,n,u,l,v));else{var d=void 0,g=void 0,y=void 0,m=void 0,_=void 0,S=void 0,b=void 0,x=void 0,w=void 0,T=void 0,A=void 0,C=void 0,M=void 0,I=void 0,L=void 0,P=void 0,R=a*xi(l),E=a*dn(l),N=n*xi(u),O=n*dn(u),B=c>hr;if(B){var F=e.cornerRadius;F&&(t=dR(F),d=t[0],g=t[1],y=t[2],m=t[3]);var H=i0(a-n)/2;if(_=Cr(H,y),S=Cr(H,m),b=Cr(H,d),x=Cr(H,g),A=w=as(_,S),C=T=as(b,x),(w>hr||T>hr)&&(M=a*xi(u),I=a*dn(u),L=n*xi(l),P=n*dn(l),chr){var tt=Cr(y,A),pt=Cr(m,A),q=Gl(L,P,R,E,a,tt,v),ot=Gl(M,I,N,O,a,pt,v);r.moveTo(f+q.cx+q.x0,h+q.cy+q.y0),A0&&r.arc(f+q.cx,h+q.cy,tt,ce(q.y0,q.x0),ce(q.y1,q.x1),!v),r.arc(f,h,a,ce(q.cy+q.y1,q.cx+q.x1),ce(ot.cy+ot.y1,ot.cx+ot.x1),!v),pt>0&&r.arc(f+ot.cx,h+ot.cy,pt,ce(ot.y1,ot.x1),ce(ot.y0,ot.x0),!v))}else r.moveTo(f+R,h+E),r.arc(f,h,a,l,u,!v);if(!(n>hr)||!B)r.lineTo(f+N,h+O);else if(C>hr){var tt=Cr(d,C),pt=Cr(g,C),q=Gl(N,O,M,I,n,-pt,v),ot=Gl(R,E,L,P,n,-tt,v);r.lineTo(f+q.cx+q.x0,h+q.cy+q.y0),C0&&r.arc(f+q.cx,h+q.cy,pt,ce(q.y0,q.x0),ce(q.y1,q.x1),!v),r.arc(f,h,n,ce(q.cy+q.y1,q.cx+q.x1),ce(ot.cy+ot.y1,ot.cx+ot.x1),v),tt>0&&r.arc(f+ot.cx,h+ot.cy,tt,ce(ot.y1,ot.x1),ce(ot.y0,ot.x0),!v))}else r.lineTo(f+N,h+O),r.arc(f,h,n,u,l,v)}r.closePath()}}}var yR=function(){function r(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return r}(),Me=function(r){k(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new yR},e.prototype.buildPath=function(t,a){gR(t,a)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(gt);Me.prototype.type="sector";var mR=function(){function r(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return r}(),sl=function(r){k(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new mR},e.prototype.buildPath=function(t,a){var n=a.cx,i=a.cy,o=Math.PI*2;t.moveTo(n+a.r,i),t.arc(n,i,a.r,0,o,!1),t.moveTo(n+a.r0,i),t.arc(n,i,a.r0,0,o,!0)},e}(gt);sl.prototype.type="ring";function _R(r,e,t,a){var n=[],i=[],o=[],s=[],l,u,f,h;if(a){f=[1/0,1/0],h=[-1/0,-1/0];for(var v=0,c=r.length;v=2){if(a){var i=_R(n,a,t,e.smoothConstraint);r.moveTo(n[0][0],n[0][1]);for(var o=n.length,s=0;s<(t?o:o-1);s++){var l=i[s*2],u=i[s*2+1],f=n[(s+1)%o];r.bezierCurveTo(l[0],l[1],u[0],u[1],f[0],f[1])}}else{r.moveTo(n[0][0],n[0][1]);for(var s=1,h=n.length;syn[1]){if(s=!1,i)return s;var f=Math.abs(yn[0]-gn[1]),h=Math.abs(gn[0]-yn[1]);Math.min(f,h)>n.len()&&(f0){var h=f.duration,v=f.delay,c=f.easing,p={duration:h,delay:v||0,easing:c,done:i,force:!!i||!!o,setToFinal:!u,scope:r,during:o};s?e.animateFrom(t,p):e.animateTo(t,p)}else e.stopAnimation(),!s&&e.attr(t),o&&o(1),i&&i()}function Tt(r,e,t,a,n,i){dg("update",r,e,t,a,n,i)}function zt(r,e,t,a,n,i){dg("enter",r,e,t,a,n,i)}function Xi(r){if(!r.__zr)return!0;for(var e=0;eMath.abs(i[1])?i[0]>0?"right":"left":i[1]>0?"bottom":"top"}function l0(r){return!r.isGroup}function ER(r){return r.shape!=null}function fl(r,e,t){if(!r||!e)return;function a(o){var s={};return o.traverse(function(l){l0(l)&&l.anid&&(s[l.anid]=l)}),s}function n(o){var s={x:o.x,y:o.y,rotation:o.rotation};return ER(o)&&(s.shape=V({},o.shape)),s}var i=a(r);e.traverse(function(o){if(l0(o)&&o.anid){var s=i[o.anid];if(s){var l=n(o);o.attr(n(s)),Tt(o,l,t,nt(o).dataIndex)}}})}function AT(r,e){return G(r,function(t){var a=t[0];a=sf(a,e.x),a=lf(a,e.x+e.width);var n=t[1];return n=sf(n,e.y),n=lf(n,e.y+e.height),[a,n]})}function kR(r,e){var t=sf(r.x,e.x),a=lf(r.x+r.width,e.x+e.width),n=sf(r.y,e.y),i=lf(r.y+r.height,e.y+e.height);if(a>=t&&i>=n)return{x:t,y:n,width:a-t,height:i-n}}function hl(r,e,t){var a=V({rectHover:!0},e),n=a.style={strokeNoScale:!0};if(t=t||{x:-1,y:-1,width:2,height:2},r)return r.indexOf("image://")===0?(n.image=r.slice(8),j(n,t),new le(a)):nh(r.replace("path://",""),a,t,"center")}function ns(r,e,t,a,n){for(var i=0,o=n[n.length-1];i1)return!1;var g=pv(c,p,f,h)/v;return!(g<0||g>1)}function pv(r,e,t,a){return r*a-t*e}function OR(r){return r<=1e-6&&r>=-1e-6}function li(r){var e=r.itemTooltipOption,t=r.componentModel,a=r.itemName,n=Y(e)?{formatter:e}:e,i=t.mainType,o=t.componentIndex,s={componentType:i,name:a,$vars:["name"]};s[i+"Index"]=o;var l=r.formatterParamsExtra;l&&D(_t(l),function(f){Z(s,f)||(s[f]=l[f],s.$vars.push(f))});var u=nt(r.el);u.componentMainType=i,u.componentIndex=o,u.tooltipConfig={name:a,option:j({content:a,encodeHTMLContent:!0,formatterParams:s},n)}}function u0(r,e){var t;r.isGroup&&(t=e(r)),t||r.traverse(e)}function Qa(r,e){if(r)if(z(r))for(var t=0;t=0&&s.push(l)}),s}}function ja(r,e){return ut(ut({},r,!0),e,!0)}const ZR={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}},$R={time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}};var ff="ZH",mg="EN",Zi=mg,zu={},_g={},RT=yt.domSupported?function(){var r=(document.documentElement.lang||navigator.language||navigator.browserLanguage||Zi).toUpperCase();return r.indexOf(ff)>-1?ff:Zi}():Zi;function ET(r,e){r=r.toUpperCase(),_g[r]=new Mt(e),zu[r]=e}function qR(r){if(Y(r)){var e=zu[r.toUpperCase()]||{};return r===ff||r===mg?rt(e):ut(rt(e),rt(zu[Zi]),!1)}else return ut(rt(r),rt(zu[Zi]),!1)}function Np(r){return _g[r]}function KR(){return _g[Zi]}ET(mg,ZR);ET(ff,$R);var Sg=1e3,xg=Sg*60,xs=xg*60,rr=xs*24,p0=rr*365,is={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},Wl="{yyyy}-{MM}-{dd}",d0={year:"{yyyy}",month:"{yyyy}-{MM}",day:Wl,hour:Wl+" "+is.hour,minute:Wl+" "+is.minute,second:Wl+" "+is.second,millisecond:is.none},yv=["year","month","day","hour","minute","second","millisecond"],kT=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Sa(r,e){return r+="","0000".substr(0,e-r.length)+r}function $i(r){switch(r){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return r}}function JR(r){return r===$i(r)}function QR(r){switch(r){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function sh(r,e,t,a){var n=Wr(r),i=n[bg(t)](),o=n[qi(t)]()+1,s=Math.floor((o-1)/3)+1,l=n[lh(t)](),u=n["get"+(t?"UTC":"")+"Day"](),f=n[Vs(t)](),h=(f-1)%12+1,v=n[uh(t)](),c=n[fh(t)](),p=n[hh(t)](),d=f>=12?"pm":"am",g=d.toUpperCase(),y=a instanceof Mt?a:Np(a||RT)||KR(),m=y.getModel("time"),_=m.get("month"),S=m.get("monthAbbr"),b=m.get("dayOfWeek"),x=m.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,d+"").replace(/{A}/g,g+"").replace(/{yyyy}/g,i+"").replace(/{yy}/g,Sa(i%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,_[o-1]).replace(/{MMM}/g,S[o-1]).replace(/{MM}/g,Sa(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Sa(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,b[u]).replace(/{ee}/g,x[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Sa(f,2)).replace(/{H}/g,f+"").replace(/{hh}/g,Sa(h+"",2)).replace(/{h}/g,h+"").replace(/{mm}/g,Sa(v,2)).replace(/{m}/g,v+"").replace(/{ss}/g,Sa(c,2)).replace(/{s}/g,c+"").replace(/{SSS}/g,Sa(p,3)).replace(/{S}/g,p+"")}function jR(r,e,t,a,n){var i=null;if(Y(t))i=t;else if(J(t))i=t(r.value,e,{level:r.level});else{var o=V({},is);if(r.level>0)for(var s=0;s=0;--s)if(l[u]){i=l[u];break}i=i||o.none}if(z(i)){var h=r.level==null?0:r.level>=0?r.level:i.length+r.level;h=Math.min(h,i.length-1),i=i[h]}}return sh(new Date(r.value),i,n,a)}function OT(r,e){var t=Wr(r),a=t[qi(e)]()+1,n=t[lh(e)](),i=t[Vs(e)](),o=t[uh(e)](),s=t[fh(e)](),l=t[hh(e)](),u=l===0,f=u&&s===0,h=f&&o===0,v=h&&i===0,c=v&&n===1,p=c&&a===1;return p?"year":c?"month":v?"day":h?"hour":f?"minute":u?"second":"millisecond"}function g0(r,e,t){var a=wt(r)?Wr(r):r;switch(e=e||OT(r,t),e){case"year":return a[bg(t)]();case"half-year":return a[qi(t)]()>=6?1:0;case"quarter":return Math.floor((a[qi(t)]()+1)/4);case"month":return a[qi(t)]();case"day":return a[lh(t)]();case"half-day":return a[Vs(t)]()/24;case"hour":return a[Vs(t)]();case"minute":return a[uh(t)]();case"second":return a[fh(t)]();case"millisecond":return a[hh(t)]()}}function bg(r){return r?"getUTCFullYear":"getFullYear"}function qi(r){return r?"getUTCMonth":"getMonth"}function lh(r){return r?"getUTCDate":"getDate"}function Vs(r){return r?"getUTCHours":"getHours"}function uh(r){return r?"getUTCMinutes":"getMinutes"}function fh(r){return r?"getUTCSeconds":"getSeconds"}function hh(r){return r?"getUTCMilliseconds":"getMilliseconds"}function tE(r){return r?"setUTCFullYear":"setFullYear"}function NT(r){return r?"setUTCMonth":"setMonth"}function BT(r){return r?"setUTCDate":"setDate"}function VT(r){return r?"setUTCHours":"setHours"}function zT(r){return r?"setUTCMinutes":"setMinutes"}function GT(r){return r?"setUTCSeconds":"setSeconds"}function FT(r){return r?"setUTCMilliseconds":"setMilliseconds"}function HT(r){if(!Bw(r))return Y(r)?r:"-";var e=(r+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function WT(r,e){return r=(r||"").toLowerCase().replace(/-(.)/g,function(t,a){return a.toUpperCase()}),e&&r&&(r=r.charAt(0).toUpperCase()+r.slice(1)),r}var yo=qd;function Bp(r,e,t){var a="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function n(f){return f&&dr(f)?f:"-"}function i(f){return!!(f!=null&&!isNaN(f)&&isFinite(f))}var o=e==="time",s=r instanceof Date;if(o||s){var l=o?Wr(r):r;if(isNaN(+l)){if(s)return"-"}else return sh(l,a,t)}if(e==="ordinal")return ep(r)?n(r):wt(r)&&i(r)?r+"":"-";var u=sa(r);return i(u)?HT(u):ep(r)?n(r):typeof r=="boolean"?r+"":"-"}var y0=["a","b","c","d","e","f","g"],mv=function(r,e){return"{"+r+(e??"")+"}"};function UT(r,e,t){z(e)||(e=[e]);var a=e.length;if(!a)return"";for(var n=e[0].$vars||[],i=0;i':'';var o=t.markerId||"markerX";return{renderMode:i,content:"{"+o+"|} ",style:n==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:a}:{width:10,height:10,borderRadius:5,backgroundColor:a}}}function ai(r,e){return e=e||"transparent",Y(r)?r:et(r)&&r.colorStops&&(r.colorStops[0]||{}).color||e}function hf(r,e){if(e==="_blank"||e==="blank"){var t=window.open();t.opener=null,t.location.href=r}else window.open(r,e)}var Gu=D,YT=["left","right","top","bottom","width","height"],zn=[["width","left","right"],["height","top","bottom"]];function wg(r,e,t,a,n){var i=0,o=0;a==null&&(a=1/0),n==null&&(n=1/0);var s=0;e.eachChild(function(l,u){var f=l.getBoundingRect(),h=e.childAt(u+1),v=h&&h.getBoundingRect(),c,p;if(r==="horizontal"){var d=f.width+(v?-v.x+f.x:0);c=i+d,c>a||l.newline?(i=0,c=d,o+=s+t,s=f.height):s=Math.max(s,f.height)}else{var g=f.height+(v?-v.y+f.y:0);p=o+g,p>n||l.newline?(i+=s+t,o=0,p=g,s=f.width):s=Math.max(s,f.width)}l.newline||(l.x=i,l.y=o,l.markRedraw(),r==="horizontal"?i=c+t:o=p+t)})}var Kn=wg;lt(wg,"vertical");lt(wg,"horizontal");function aE(r,e,t){var a=e.width,n=e.height,i=W(r.left,a),o=W(r.top,n),s=W(r.right,a),l=W(r.bottom,n);return(isNaN(i)||isNaN(parseFloat(r.left)))&&(i=0),(isNaN(s)||isNaN(parseFloat(r.right)))&&(s=a),(isNaN(o)||isNaN(parseFloat(r.top)))&&(o=0),(isNaN(l)||isNaN(parseFloat(r.bottom)))&&(l=n),t=yo(t||0),{width:Math.max(s-i-t[1]-t[3],0),height:Math.max(l-o-t[0]-t[2],0)}}function Qt(r,e,t){t=yo(t||0);var a=e.width,n=e.height,i=W(r.left,a),o=W(r.top,n),s=W(r.right,a),l=W(r.bottom,n),u=W(r.width,a),f=W(r.height,n),h=t[2]+t[0],v=t[1]+t[3],c=r.aspect;switch(isNaN(u)&&(u=a-s-v-i),isNaN(f)&&(f=n-l-h-o),c!=null&&(isNaN(u)&&isNaN(f)&&(c>a/n?u=a*.8:f=n*.8),isNaN(u)&&(u=c*f),isNaN(f)&&(f=u/c)),isNaN(i)&&(i=a-s-u-v),isNaN(o)&&(o=n-l-f-h),r.left||r.right){case"center":i=a/2-u/2-t[3];break;case"right":i=a-u-v;break}switch(r.top||r.bottom){case"middle":case"center":o=n/2-f/2-t[0];break;case"bottom":o=n-f-h;break}i=i||0,o=o||0,isNaN(u)&&(u=a-v-i-(s||0)),isNaN(f)&&(f=n-h-o-(l||0));var p=new ht(i+t[3],o+t[0],u,f);return p.margin=t,p}function vh(r,e,t,a,n,i){var o=!n||!n.hv||n.hv[0],s=!n||!n.hv||n.hv[1],l=n&&n.boundingMode||"all";if(i=i||r,i.x=r.x,i.y=r.y,!o&&!s)return!1;var u;if(l==="raw")u=r.type==="group"?new ht(0,0,+e.width||0,+e.height||0):r.getBoundingRect();else if(u=r.getBoundingRect(),r.needLocalTransform()){var f=r.getLocalTransform();u=u.clone(),u.applyTransform(f)}var h=Qt(j({width:u.width,height:u.height},e),t,a),v=o?h.x-u.x:0,c=s?h.y-u.y:0;return l==="raw"?(i.x=v,i.y=c):(i.x+=v,i.y+=c),i===r&&r.markRedraw(),!0}function nE(r,e){return r[zn[e][0]]!=null||r[zn[e][1]]!=null&&r[zn[e][2]]!=null}function zs(r){var e=r.layoutMode||r.constructor.layoutMode;return et(e)?e:e?{type:e}:null}function $a(r,e,t){var a=t&&t.ignoreSize;!z(a)&&(a=[a,a]);var n=o(zn[0],0),i=o(zn[1],1);u(zn[0],r,n),u(zn[1],r,i);function o(f,h){var v={},c=0,p={},d=0,g=2;if(Gu(f,function(_){p[_]=r[_]}),Gu(f,function(_){s(e,_)&&(v[_]=p[_]=e[_]),l(v,_)&&c++,l(p,_)&&d++}),a[h])return l(e,f[1])?p[f[2]]=null:l(e,f[2])&&(p[f[1]]=null),p;if(d===g||!c)return p;if(c>=g)return v;for(var y=0;y=0;l--)s=ut(s,n[l],!0);a.defaultOption=s}return a.defaultOption},e.prototype.getReferringComponents=function(t,a){var n=t+"Index",i=t+"Id";return il(this.ecModel,t,{index:this.get(n,!0),id:this.get(i,!0)},a)},e.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=function(){var t=e.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),e}(Mt);Zw(mt,Mt);Kf(mt);YR(mt);XR(mt,oE);function oE(r){var e=[];return D(mt.getClassesByMainType(r),function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])}),e=G(e,function(t){return kr(t).main}),r!=="dataset"&&ct(e,"dataset")<=0&&e.unshift("dataset"),e}var ZT="";typeof navigator<"u"&&(ZT=navigator.platform||"");var bi="rgba(0, 0, 0, 0.2)";const sE={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:bi,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:bi,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:bi,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:bi,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:bi,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:bi,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:ZT.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var $T=$(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),sr="original",me="arrayRows",lr="objectRows",Yr="keyedColumns",Fa="typedArray",qT="unknown",zr="column",_o="row",ue={Must:1,Might:2,Not:3},KT=xt();function lE(r){KT(r).datasetMap=$()}function JT(r,e,t){var a={},n=Ag(e);if(!n||!r)return a;var i=[],o=[],s=e.ecModel,l=KT(s).datasetMap,u=n.uid+"_"+t.seriesLayoutBy,f,h;r=r.slice(),D(r,function(d,g){var y=et(d)?d:r[g]={name:d};y.type==="ordinal"&&f==null&&(f=g,h=p(y)),a[y.name]=[]});var v=l.get(u)||l.set(u,{categoryWayDim:h,valueWayDim:0});D(r,function(d,g){var y=d.name,m=p(d);if(f==null){var _=v.valueWayDim;c(a[y],_,m),c(o,_,m),v.valueWayDim+=m}else if(f===g)c(a[y],0,m),c(i,0,m);else{var _=v.categoryWayDim;c(a[y],_,m),c(o,_,m),v.categoryWayDim+=m}});function c(d,g,y){for(var m=0;me)return r[a];return r[t-1]}function tA(r,e,t,a,n,i,o){i=i||r;var s=e(i),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(n))return u[n];var f=o==null||!a?t:cE(a,o);if(f=f||t,!(!f||!f.length)){var h=f[l];return n&&(u[n]=h),s.paletteIdx=(l+1)%f.length,h}}function pE(r,e){e(r).paletteIdx=0,e(r).paletteNameMap={}}var Ul,Eo,_0,S0="\0_ec_inner",dE=1,Dg=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.init=function(t,a,n,i,o,s){i=i||{},this.option=null,this._theme=new Mt(i),this._locale=new Mt(o),this._optionManager=s},e.prototype.setOption=function(t,a,n){var i=w0(a);this._optionManager.setOption(t,n,i),this._resetOption(null,i)},e.prototype.resetOption=function(t,a){return this._resetOption(t,w0(a))},e.prototype._resetOption=function(t,a){var n=!1,i=this._optionManager;if(!t||t==="recreate"){var o=i.mountOption(t==="recreate");!this.option||t==="recreate"?_0(this,o):(this.restoreData(),this._mergeOption(o,a)),n=!0}if((t==="timeline"||t==="media")&&this.restoreData(),!t||t==="recreate"||t==="timeline"){var s=i.getTimelineOption(this);s&&(n=!0,this._mergeOption(s,a))}if(!t||t==="recreate"||t==="media"){var l=i.getMediaOption(this);l.length&&D(l,function(u){n=!0,this._mergeOption(u,a)},this)}return n},e.prototype.mergeOption=function(t){this._mergeOption(t,null)},e.prototype._mergeOption=function(t,a){var n=this.option,i=this._componentsMap,o=this._componentsCount,s=[],l=$(),u=a&&a.replaceMergeMainTypeMap;lE(this),D(t,function(h,v){h!=null&&(mt.hasClass(v)?v&&(s.push(v),l.set(v,!0)):n[v]=n[v]==null?rt(h):ut(n[v],h,!0))}),u&&u.each(function(h,v){mt.hasClass(v)&&!l.get(v)&&(s.push(v),l.set(v,!0))}),mt.topologicalTravel(s,mt.getAllClassMainTypes(),f,this);function f(h){var v=hE(this,h,Pt(t[h])),c=i.get(h),p=c?u&&u.get(h)?"replaceMerge":"normalMerge":"replaceAll",d=Hw(c,v,p);G2(d,h,mt),n[h]=null,i.set(h,null),o.set(h,0);var g=[],y=[],m=0,_;D(d,function(S,b){var x=S.existing,w=S.newOption;if(!w)x&&(x.mergeOption({},this),x.optionUpdated({},!1));else{var T=h==="series",A=mt.getClass(h,S.keyInfo.subType,!T);if(!A)return;if(h==="tooltip"){if(_)return;_=!0}if(x&&x.constructor===A)x.name=S.keyInfo.name,x.mergeOption(w,this),x.optionUpdated(w,!1);else{var C=V({componentIndex:b},S.keyInfo);x=new A(w,this,this,C),V(x,C),S.brandNew&&(x.__requireNewView=!0),x.init(w,this,this),x.optionUpdated(null,!0)}}x?(g.push(x.option),y.push(x),m++):(g.push(void 0),y.push(void 0))},this),n[h]=g,i.set(h,y),o.set(h,m),h==="series"&&Ul(this)}this._seriesIndices||Ul(this)},e.prototype.getOption=function(){var t=rt(this.option);return D(t,function(a,n){if(mt.hasClass(n)){for(var i=Pt(a),o=i.length,s=!1,l=o-1;l>=0;l--)i[l]&&!ks(i[l])?s=!0:(i[l]=null,!s&&o--);i.length=o,t[n]=i}}),delete t[S0],t},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(t){this._payload=t},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(t,a){var n=this._componentsMap.get(t);if(n){var i=n[a||0];if(i)return i;if(a==null){for(var o=0;o=e:t==="max"?r<=e:r===e}function TE(r,e){return r.join(",")===e.join(",")}var ur=D,Gs=et,T0=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function Sv(r){var e=r&&r.itemStyle;if(e)for(var t=0,a=T0.length;t=0;g--){var y=r[g];if(s||(p=y.data.rawIndexOf(y.stackedByDimension,c)),p>=0){var m=y.data.getByRawIndex(y.stackResultDimension,p);if(l==="all"||l==="positive"&&m>0||l==="negative"&&m<0||l==="samesign"&&v>=0&&m>0||l==="samesign"&&v<=0&&m<0){v=I2(v,m),d=m;break}}}return a[0]=v,a[1]=d,a})})}var ch=function(){function r(e){this.data=e.data||(e.sourceFormat===Yr?{}:[]),this.sourceFormat=e.sourceFormat||qT,this.seriesLayoutBy=e.seriesLayoutBy||zr,this.startIndex=e.startIndex||0,this.dimensionsDetectedCount=e.dimensionsDetectedCount,this.metaRawOption=e.metaRawOption;var t=this.dimensionsDefine=e.dimensionsDefine;if(t)for(var a=0;ad&&(d=_)}c[0]=p,c[1]=d}},n=function(){return this._data?this._data.length/this._dimSize:0};P0=(e={},e[me+"_"+zr]={pure:!0,appendData:i},e[me+"_"+_o]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[lr]={pure:!0,appendData:i},e[Yr]={pure:!0,appendData:function(o){var s=this._data;D(o,function(l,u){for(var f=s[u]||(s[u]=[]),h=0;h<(l||[]).length;h++)f.push(l[h])})}},e[sr]={appendData:i},e[Fa]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},e);function i(o){for(var s=0;s=0&&(d=o.interpolatedValue[g])}return d!=null?d+"":""})}},r.prototype.getRawValue=function(e,t){return to(this.getData(t),e)},r.prototype.formatTooltip=function(e,t,a){},r}();function O0(r){var e,t;return et(r)?r.type&&(t=r):e=r,{text:e,frag:t}}function bs(r){return new FE(r)}var FE=function(){function r(e){e=e||{},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return r.prototype.perform=function(e){var t=this._upstream,a=e&&e.skip;if(this._dirty&&t){var n=this.context;n.data=n.outputData=t.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!a&&(i=this._plan(this.context));var o=f(this._modBy),s=this._modDataCount||0,l=f(e&&e.modBy),u=e&&e.modDataCount||0;(o!==l||s!==u)&&(i="reset");function f(m){return!(m>=1)&&(m=1),m}var h;(this._dirty||i==="reset")&&(this._dirty=!1,h=this._doReset(a)),this._modBy=l,this._modDataCount=u;var v=e&&e.step;if(t?this._dueEnd=t._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var c=this._dueIndex,p=Math.min(v!=null?this._dueIndex+v:1/0,this._dueEnd);if(!a&&(h||c1&&a>0?s:o}};return i;function o(){return e=r?null:le},gte:function(r,e){return r>=e}},WE=function(){function r(e,t){if(!wt(t)){var a="";At(a)}this._opFn=hA[e],this._rvalFloat=sa(t)}return r.prototype.evaluate=function(e){return wt(e)?this._opFn(e,this._rvalFloat):this._opFn(sa(e),this._rvalFloat)},r}(),vA=function(){function r(e,t){var a=e==="desc";this._resultLT=a?1:-1,t==null&&(t=a?"min":"max"),this._incomparable=t==="min"?-1/0:1/0}return r.prototype.evaluate=function(e,t){var a=wt(e)?e:sa(e),n=wt(t)?t:sa(t),i=isNaN(a),o=isNaN(n);if(i&&(a=this._incomparable),o&&(n=this._incomparable),i&&o){var s=Y(e),l=Y(t);s&&(a=l?e:0),l&&(n=s?t:0)}return an?-this._resultLT:0},r}(),UE=function(){function r(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=sa(t)}return r.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var a=typeof e;a!==this._rvalTypeof&&(a==="number"||this._rvalTypeof==="number")&&(t=sa(e)===this._rvalFloat)}return this._isEQ?t:!t},r}();function YE(r,e){return r==="eq"||r==="ne"?new UE(r==="eq",e):Z(hA,r)?new WE(r,e):null}var XE=function(){function r(){}return r.prototype.getRawData=function(){throw new Error("not supported")},r.prototype.getRawDataItem=function(e){throw new Error("not supported")},r.prototype.cloneRawData=function(){},r.prototype.getDimensionInfo=function(e){},r.prototype.cloneAllDimensionInfo=function(){},r.prototype.count=function(){},r.prototype.retrieveValue=function(e,t){},r.prototype.retrieveValueFromItem=function(e,t){},r.prototype.convertValue=function(e,t){return Ha(e,t)},r}();function ZE(r,e){var t=new XE,a=r.data,n=t.sourceFormat=r.sourceFormat,i=r.startIndex,o="";r.seriesLayoutBy!==zr&&At(o);var s=[],l={},u=r.dimensionsDefine;if(u)D(u,function(d,g){var y=d.name,m={index:g,name:y,displayName:d.displayName};if(s.push(m),y!=null){var _="";Z(l,y)&&At(_),l[y]=m}});else for(var f=0;f65535?ek:rk}function Ti(){return[1/0,-1/0]}function ak(r){var e=r.constructor;return e===Array?r.slice():new e(r)}function V0(r,e,t,a,n){var i=dA[t||"float"];if(n){var o=r[e],s=o&&o.length;if(s!==a){for(var l=new i(a),u=0;ug[1]&&(g[1]=d)}return this._rawCount=this._count=l,{start:s,end:l}},r.prototype._initDataFromProvider=function(e,t,a){for(var n=this._provider,i=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=G(o,function(m){return m.property}),f=0;fy[1]&&(y[1]=g)}}!n.persistent&&n.clean&&n.clean(),this._rawCount=this._count=t,this._extent=[]},r.prototype.count=function(){return this._count},r.prototype.get=function(e,t){if(!(t>=0&&t=0&&t=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,a=t[e];if(a!=null&&ae)i=o-1;else return o}return-1},r.prototype.indicesOfNearest=function(e,t,a){var n=this._chunks,i=n[e],o=[];if(!i)return o;a==null&&(a=1/0);for(var s=1/0,l=-1,u=0,f=0,h=this.count();f=0&&l<0)&&(s=p,l=c,u=0),c===l&&(o[u++]=f))}return o.length=u,o},r.prototype.getIndices=function(){var e,t=this._indices;if(t){var a=t.constructor,n=this._count;if(a===Array){e=new a(n);for(var i=0;i=h&&m<=v||isNaN(m))&&(l[u++]=d),d++}p=!0}else if(i===2){for(var g=c[n[0]],_=c[n[1]],S=e[n[1]][0],b=e[n[1]][1],y=0;y=h&&m<=v||isNaN(m))&&(x>=S&&x<=b||isNaN(x))&&(l[u++]=d),d++}p=!0}}if(!p)if(i===1)for(var y=0;y=h&&m<=v||isNaN(m))&&(l[u++]=w)}else for(var y=0;ye[C][1])&&(T=!1)}T&&(l[u++]=t.getRawIndex(y))}return uy[1]&&(y[1]=g)}}}},r.prototype.lttbDownSample=function(e,t){var a=this.clone([e],!0),n=a._chunks,i=n[e],o=this.count(),s=0,l=Math.floor(1/t),u=this.getRawIndex(0),f,h,v,c=new(wi(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));c[s++]=u;for(var p=1;pf&&(f=h,v=S)}M>0&&Ms&&(d=s-f);for(var g=0;gp&&(p=m,c=f+g)}var _=this.getRawIndex(h),S=this.getRawIndex(c);hf-p&&(l=f-p,s.length=l);for(var d=0;dh[1]&&(h[1]=y),v[c++]=m}return i._count=c,i._indices=v,i._updateGetRawIdx(),i},r.prototype.each=function(e,t){if(this._count)for(var a=e.length,n=this._chunks,i=0,o=this.count();il&&(l=h)}return o=[s,l],this._extent[e]=o,o},r.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var a=[],n=this._chunks,i=0;i=0?this._indices[e]:-1},r.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},r.internalField=function(){function e(t,a,n,i){return Ha(t[i],this._dimensions[i])}wv={arrayRows:e,objectRows:function(t,a,n,i){return Ha(t[a],this._dimensions[i])},keyedColumns:e,original:function(t,a,n,i){var o=t&&(t.value==null?t:t.value);return Ha(o instanceof Array?o[i]:o,this._dimensions[i])},typedArray:function(t,a,n,i){return t[i]}}}(),r}(),gA=function(){function r(e){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=e}return r.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},r.prototype._setLocalSource=function(e,t){this._sourceList=e,this._upstreamSignList=t,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},r.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},r.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},r.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,t=this._getUpstreamSourceManagers(),a=!!t.length,n,i;if(Yl(e)){var o=e,s=void 0,l=void 0,u=void 0;if(a){var f=t[0];f.prepareSource(),u=f.getSource(),s=u.data,l=u.sourceFormat,i=[f._getVersionSign()]}else s=o.get("data",!0),l=Be(s)?Fa:sr,i=[];var h=this._getSourceMetaRawOption()||{},v=u&&u.metaRawOption||{},c=st(h.seriesLayoutBy,v.seriesLayoutBy)||null,p=st(h.sourceHeader,v.sourceHeader),d=st(h.dimensions,v.dimensions),g=c!==v.seriesLayoutBy||!!p!=!!v.sourceHeader||d;n=g?[Gp(s,{seriesLayoutBy:c,sourceHeader:p,dimensions:d},l)]:[]}else{var y=e;if(a){var m=this._applyTransform(t);n=m.sourceList,i=m.upstreamSignList}else{var _=y.get("source",!0);n=[Gp(_,this._getSourceMetaRawOption(),null)],i=[]}}this._setLocalSource(n,i)},r.prototype._applyTransform=function(e){var t=this._sourceHost,a=t.get("transform",!0),n=t.get("fromTransformResult",!0);if(n!=null){var i="";e.length!==1&&G0(i)}var o,s=[],l=[];return D(e,function(u){u.prepareSource();var f=u.getSource(n||0),h="";n!=null&&!f&&G0(h),s.push(f),l.push(u._getVersionSign())}),a?o=jE(a,s,{datasetIndex:t.componentIndex}):n!=null&&(o=[kE(s[0])]),{sourceList:o,upstreamSignList:l}},r.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),t=0;t1||t>0&&!r.noHeader;return D(r.blocks,function(n){var i=SA(n);i>=e&&(e=i+ +(a&&(!i||Hp(n)&&!n.noHeader)))}),e}return 0}function sk(r,e,t,a){var n=e.noHeader,i=uk(SA(e)),o=[],s=e.blocks||[];Ce(!s||z(s)),s=s||[];var l=r.orderMode;if(e.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(Z(u,l)){var f=new vA(u[l],null);s.sort(function(d,g){return f.evaluate(d.sortParam,g.sortParam)})}else l==="seriesDesc"&&s.reverse()}D(s,function(d,g){var y=e.valueFormatter,m=_A(d)(y?V(V({},r),{valueFormatter:y}):r,d,g>0?i.html:0,a);m!=null&&o.push(m)});var h=r.renderMode==="richText"?o.join(i.richText):Wp(a,o.join(""),n?t:i.html);if(n)return h;var v=Bp(e.header,"ordinal",r.useUTC),c=mA(a,r.renderMode).nameStyle,p=yA(a);return r.renderMode==="richText"?xA(r,v,c)+i.richText+h:Wp(a,'
'+we(v)+"
"+h,t)}function lk(r,e,t,a){var n=r.renderMode,i=e.noName,o=e.noValue,s=!e.markerType,l=e.name,u=r.useUTC,f=e.valueFormatter||r.valueFormatter||function(S){return S=z(S)?S:[S],G(S,function(b,x){return Bp(b,z(c)?c[x]:c,u)})};if(!(i&&o)){var h=s?"":r.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",n),v=i?"":Bp(l,"ordinal",u),c=e.valueType,p=o?[]:f(e.value,e.dataIndex),d=!s||!i,g=!s&&i,y=mA(a,n),m=y.nameStyle,_=y.valueStyle;return n==="richText"?(s?"":h)+(i?"":xA(r,v,m))+(o?"":vk(r,p,d,g,_)):Wp(a,(s?"":h)+(i?"":fk(v,!s,m))+(o?"":hk(p,d,g,_)),t)}}function F0(r,e,t,a,n,i){if(r){var o=_A(r),s={useUTC:n,renderMode:t,orderMode:a,markupStyleCreator:e,valueFormatter:r.valueFormatter};return o(s,r,0,i)}}function uk(r){return{html:ik[r],richText:ok[r]}}function Wp(r,e,t){var a='
',n="margin: "+t+"px 0 0",i=yA(r);return'
'+e+a+"
"}function fk(r,e,t){var a=e?"margin-left:2px":"";return''+we(r)+""}function hk(r,e,t,a){var n=t?"10px":"20px",i=e?"float:right;margin-left:"+n:"";return r=z(r)?r:[r],''+G(r,function(o){return we(o)}).join("  ")+""}function xA(r,e,t){return r.markupStyleCreator.wrapRichTextStyle(e,t)}function vk(r,e,t,a,n){var i=[n],o=a?10:20;return t&&i.push({padding:[0,0,0,o],align:"right"}),r.markupStyleCreator.wrapRichTextStyle(z(e)?e.join(" "):e,i)}function bA(r,e){var t=r.getData().getItemVisual(e,"style"),a=t[r.visualDrawType];return ai(a)}function wA(r,e){var t=r.get("padding");return t??(e==="richText"?[8,10]:10)}var Tv=function(){function r(){this.richTextStyles={},this._nextStyleNameId=Vw()}return r.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},r.prototype.makeTooltipMarker=function(e,t,a){var n=a==="richText"?this._generateStyleName():null,i=rE({color:t,type:e,renderMode:a,markerId:n});return Y(i)?i:(this.richTextStyles[n]=i.style,i.content)},r.prototype.wrapRichTextStyle=function(e,t){var a={};z(t)?D(t,function(i){return V(a,i)}):V(a,t);var n=this._generateStyleName();return this.richTextStyles[n]=a,"{"+n+"|"+e+"}"},r}();function TA(r){var e=r.series,t=r.dataIndex,a=r.multipleSeries,n=e.getData(),i=n.mapDimensionsAll("defaultedTooltip"),o=i.length,s=e.getRawValue(t),l=z(s),u=bA(e,t),f,h,v,c;if(o>1||l&&!o){var p=ck(s,e,t,i,u);f=p.inlineValues,h=p.inlineValueTypes,v=p.blocks,c=p.inlineValues[0]}else if(o){var d=n.getDimensionInfo(i[0]);c=f=to(n,t,i[0]),h=d.type}else c=f=l?s[0]:s;var g=ag(e),y=g&&e.name||"",m=n.getName(t),_=a?y:m;return ie("section",{header:y,noHeader:a||!g,sortParam:c,blocks:[ie("nameValue",{markerType:"item",markerColor:u,name:_,noName:!dr(_),value:f,valueType:h,dataIndex:t})].concat(v||[])})}function ck(r,e,t,a,n){var i=e.getData(),o=Gr(r,function(h,v,c){var p=i.getDimensionInfo(c);return h=h||p&&p.tooltip!==!1&&p.displayName!=null},!1),s=[],l=[],u=[];a.length?D(a,function(h){f(to(i,t,h),h)}):D(r,f);function f(h,v){var c=i.getDimensionInfo(v);!c||c.otherDims.tooltip===!1||(o?u.push(ie("nameValue",{markerType:"subItem",markerColor:n,name:c.displayName,value:h,valueType:c.type})):(s.push(h),l.push(c.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var xa=xt();function Xl(r,e){return r.getName(e)||r.getId(e)}var Fu="__universalTransitionEnabled",Vt=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return e.prototype.init=function(t,a,n){this.seriesIndex=this.componentIndex,this.dataTask=bs({count:dk,reset:gk}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n);var i=xa(this).sourceManager=new gA(this);i.prepareSource();var o=this.getInitialData(t,n);W0(o,this),this.dataTask.context.data=o,xa(this).dataBeforeProcessed=o,H0(this),this._initSelectedMapFromData(o)},e.prototype.mergeDefaultAndTheme=function(t,a){var n=zs(this),i=n?mo(t):{},o=this.subType;mt.hasClass(o)&&(o+="Series"),ut(t,a.getTheme().get(this.subType)),ut(t,this.getDefaultOption()),jn(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&$a(t,i,n)},e.prototype.mergeOption=function(t,a){t=ut(this.option,t,!0),this.fillDataTextStyle(t.data);var n=zs(this);n&&$a(this.option,t,n);var i=xa(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(t,a);W0(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,xa(this).dataBeforeProcessed=o,H0(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(t){if(t&&!Be(t))for(var a=["show"],n=0;nthis.getShallow("animationThreshold")&&(a=!1),!!a},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,a,n){var i=this.ecModel,o=Cg.prototype.getColorFromPalette.call(this,t,a,n);return o||(o=i.getColorFromPalette(t,a,n)),o},e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(t,a){this._innerSelect(this.getData(a),t)},e.prototype.unselect=function(t,a){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,o=this.getData(a);if(i==="series"||n==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s=0&&n.push(o)}return n},e.prototype.isSelected=function(t,a){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(a);return(n==="all"||n[Xl(i,t)])&&!i.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[Fu])return!0;var t=this.option.universalTransition;return t?t===!0?!0:t&&t.enabled:!1},e.prototype._innerSelect=function(t,a){var n,i,o=this.option,s=o.selectedMode,l=a.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){et(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,f=0;f0&&this._innerSelect(t,a)}},e.registerClass=function(t){return mt.registerClass(t)},e.protoInitialize=function(){var t=e.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),e}(mt);Kt(Vt,ph);Kt(Vt,Cg);Zw(Vt,mt);function H0(r){var e=r.name;ag(r)||(r.name=pk(r)||e)}function pk(r){var e=r.getRawData(),t=e.mapDimensionsAll("seriesName"),a=[];return D(t,function(n){var i=e.getDimensionInfo(n);i.displayName&&a.push(i.displayName)}),a.join(" ")}function dk(r){return r.model.getRawData().count()}function gk(r){var e=r.model;return e.setData(e.getRawData().cloneShallow()),yk}function yk(r,e){e.outputData&&r.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function W0(r,e){D(Is(r.CHANGABLE_METHODS,r.DOWNSAMPLE_METHODS),function(t){r.wrapMethod(t,lt(mk,e))})}function mk(r,e){var t=Up(r);return t&&t.setOutputEnd((e||this).count()),e}function Up(r){var e=(r.ecModel||{}).scheduler,t=e&&e.getPipeline(r.uid);if(t){var a=t.currentTask;if(a){var n=a.agentStubMap;n&&(a=n.get(r.uid))}return a}}var Ft=function(){function r(){this.group=new at,this.uid=go("viewComponent")}return r.prototype.init=function(e,t){},r.prototype.render=function(e,t,a,n){},r.prototype.dispose=function(e,t){},r.prototype.updateView=function(e,t,a,n){},r.prototype.updateLayout=function(e,t,a,n){},r.prototype.updateVisual=function(e,t,a,n){},r.prototype.toggleBlurSeries=function(e,t,a){},r.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},r}();ig(Ft);Kf(Ft);function So(){var r=xt();return function(e){var t=r(e),a=e.pipelineContext,n=!!t.large,i=!!t.progressiveRender,o=t.large=!!(a&&a.large),s=t.progressiveRender=!!(a&&a.progressiveRender);return(n!==o||i!==s)&&"reset"}}var AA=xt(),_k=So(),Rt=function(){function r(){this.group=new at,this.uid=go("viewChart"),this.renderTask=bs({plan:Sk,reset:xk}),this.renderTask.context={view:this}}return r.prototype.init=function(e,t){},r.prototype.render=function(e,t,a,n){},r.prototype.highlight=function(e,t,a,n){var i=e.getData(n&&n.dataType);i&&Y0(i,n,"emphasis")},r.prototype.downplay=function(e,t,a,n){var i=e.getData(n&&n.dataType);i&&Y0(i,n,"normal")},r.prototype.remove=function(e,t){this.group.removeAll()},r.prototype.dispose=function(e,t){},r.prototype.updateView=function(e,t,a,n){this.render(e,t,a,n)},r.prototype.updateLayout=function(e,t,a,n){this.render(e,t,a,n)},r.prototype.updateVisual=function(e,t,a,n){this.render(e,t,a,n)},r.prototype.eachRendered=function(e){Qa(this.group,e)},r.markUpdateMethod=function(e,t){AA(e).updateMethod=t},r.protoInitialize=function(){var e=r.prototype;e.type="chart"}(),r}();function U0(r,e,t){r&&Ns(r)&&(e==="emphasis"?la:ua)(r,t)}function Y0(r,e,t){var a=ti(r,e),n=e&&e.highlightKey!=null?rR(e.highlightKey):null;a!=null?D(Pt(a),function(i){U0(r.getItemGraphicEl(i),t,n)}):r.eachItemGraphicEl(function(i){U0(i,t,n)})}ig(Rt);Kf(Rt);function Sk(r){return _k(r.model)}function xk(r){var e=r.model,t=r.ecModel,a=r.api,n=r.payload,i=e.pipelineContext.progressiveRender,o=r.view,s=n&&AA(n).updateMethod,l=i?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](e,t,a,n),bk[l]}var bk={incrementalPrepareRender:{progress:function(r,e){e.view.incrementalRender(r,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(r,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}},vf="\0__throttleOriginMethod",X0="\0__throttleRate",Z0="\0__throttleType";function Rg(r,e,t){var a,n=0,i=0,o=null,s,l,u,f;e=e||0;function h(){i=new Date().getTime(),o=null,r.apply(l,u||[])}var v=function(){for(var c=[],p=0;p=0?h():o=setTimeout(h,-s),n=a};return v.clear=function(){o&&(clearTimeout(o),o=null)},v.debounceNextCall=function(c){f=c},v}function xo(r,e,t,a){var n=r[e];if(n){var i=n[vf]||n,o=n[Z0],s=n[X0];if(s!==t||o!==a){if(t==null||!a)return r[e]=i;n=r[e]=Rg(i,t,a==="debounce"),n[vf]=i,n[Z0]=a,n[X0]=t}return n}}function Fs(r,e){var t=r[e];t&&t[vf]&&(t.clear&&t.clear(),r[e]=t[vf])}var $0=xt(),q0={itemStyle:ei(PT,!0),lineStyle:ei(LT,!0)},wk={lineStyle:"stroke",itemStyle:"fill"};function CA(r,e){var t=r.visualStyleMapper||q0[e];return t||(console.warn("Unknown style type '"+e+"'."),q0.itemStyle)}function DA(r,e){var t=r.visualDrawType||wk[e];return t||(console.warn("Unknown style type '"+e+"'."),"fill")}var Tk={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){var t=r.getData(),a=r.visualStyleAccessPath||"itemStyle",n=r.getModel(a),i=CA(r,a),o=i(n),s=n.getShallow("decal");s&&(t.setVisual("decal",s),s.dirty=!0);var l=DA(r,a),u=o[l],f=J(u)?u:null,h=o.fill==="auto"||o.stroke==="auto";if(!o[l]||f||h){var v=r.getColorFromPalette(r.name,null,e.getSeriesCount());o[l]||(o[l]=v,t.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||J(o.fill)?v:o.fill,o.stroke=o.stroke==="auto"||J(o.stroke)?v:o.stroke}if(t.setVisual("style",o),t.setVisual("drawType",l),!e.isSeriesFiltered(r)&&f)return t.setVisual("colorFromPalette",!1),{dataEach:function(c,p){var d=r.getDataParams(p),g=V({},o);g[l]=f(d),c.setItemVisual(p,"style",g)}}}},Oo=new Mt,Ak={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){if(!(r.ignoreStyleOnData||e.isSeriesFiltered(r))){var t=r.getData(),a=r.visualStyleAccessPath||"itemStyle",n=CA(r,a),i=t.getVisual("drawType");return{dataEach:t.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[a]){Oo.option=l[a];var u=n(Oo),f=o.ensureUniqueItemVisual(s,"style");V(f,u),Oo.option.decal&&(o.setItemVisual(s,"decal",Oo.option.decal),Oo.option.decal.dirty=!0),i in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},Ck={performRawSeries:!0,overallReset:function(r){var e=$();r.eachSeries(function(t){var a=t.getColorBy();if(!t.isColorBySeries()){var n=t.type+"-"+a,i=e.get(n);i||(i={},e.set(n,i)),$0(t).scope=i}}),r.eachSeries(function(t){if(!(t.isColorBySeries()||r.isSeriesFiltered(t))){var a=t.getRawData(),n={},i=t.getData(),o=$0(t).scope,s=t.visualStyleAccessPath||"itemStyle",l=DA(t,s);i.each(function(u){var f=i.getRawIndex(u);n[f]=u}),a.each(function(u){var f=n[u],h=i.getItemVisual(f,"colorFromPalette");if(h){var v=i.ensureUniqueItemVisual(f,"style"),c=a.getName(u)||u+"",p=a.count();v[l]=t.getColorFromPalette(c,o,p)}})}})}},Zl=Math.PI;function Dk(r,e){e=e||{},j(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var t=new at,a=new St({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});t.add(a);var n=new bt({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),i=new St({style:{fill:"none"},textContent:n,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});t.add(i);var o;return e.showSpinner&&(o=new ah({shape:{startAngle:-Zl/2,endAngle:-Zl/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:Zl*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:Zl*3/2}).delay(300).start("circularInOut"),t.add(o)),t.resize=function(){var s=n.getBoundingRect().width,l=e.showSpinner?e.spinnerRadius:0,u=(r.getWidth()-l*2-(e.showSpinner&&s?10:0)-s)/2-(e.showSpinner&&s?0:5+s/2)+(e.showSpinner?0:s/2)+(s?0:l),f=r.getHeight()/2;e.showSpinner&&o.setShape({cx:u,cy:f}),i.setShape({x:u-l,y:f-l,width:l*2,height:l*2}),a.setShape({x:0,y:0,width:r.getWidth(),height:r.getHeight()})},t.resize(),t}var MA=function(){function r(e,t,a,n){this._stageTaskMap=$(),this.ecInstance=e,this.api=t,a=this._dataProcessorHandlers=a.slice(),n=this._visualHandlers=n.slice(),this._allHandlers=a.concat(n)}return r.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(a){var n=a.overallTask;n&&n.dirty()})},r.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var a=this._pipelineMap.get(e.__pipeline.id),n=a.context,i=!t&&a.progressiveEnabled&&(!n||n.progressiveRender)&&e.__idxInPipeline>a.blockIndex,o=i?a.step:null,s=n&&n.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},r.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},r.prototype.updateStreamModes=function(e,t){var a=this._pipelineMap.get(e.uid),n=e.getData(),i=n.count(),o=a.progressiveEnabled&&t.incrementalPrepareRender&&i>=a.threshold,s=e.get("large")&&i>=e.get("largeThreshold"),l=e.get("progressiveChunkMode")==="mod"?i:null;e.pipelineContext=a.context={progressiveRender:o,modDataCount:l,large:s}},r.prototype.restorePipelines=function(e){var t=this,a=t._pipelineMap=$();e.eachSeries(function(n){var i=n.getProgressive(),o=n.uid;a.set(o,{id:o,head:null,tail:null,threshold:n.getProgressiveThreshold(),progressiveEnabled:i&&!(n.preventIncremental&&n.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),t._pipe(n,n.dataTask)})},r.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),a=this.api;D(this._allHandlers,function(n){var i=e.get(n.uid)||e.set(n.uid,{}),o="";Ce(!(n.reset&&n.overallReset),o),n.reset&&this._createSeriesStageTask(n,i,t,a),n.overallReset&&this._createOverallStageTask(n,i,t,a)},this)},r.prototype.prepareView=function(e,t,a,n){var i=e.renderTask,o=i.context;o.model=t,o.ecModel=a,o.api=n,i.__block=!e.incrementalPrepareRender,this._pipe(t,i)},r.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},r.prototype.performVisualTasks=function(e,t,a){this._performStageTasks(this._visualHandlers,e,t,a)},r.prototype._performStageTasks=function(e,t,a,n){n=n||{};var i=!1,o=this;D(e,function(l,u){if(!(n.visualType&&n.visualType!==l.visualType)){var f=o._stageTaskMap.get(l.uid),h=f.seriesTaskMap,v=f.overallTask;if(v){var c,p=v.agentStubMap;p.each(function(g){s(n,g)&&(g.dirty(),c=!0)}),c&&v.dirty(),o.updatePayload(v,a);var d=o.getPerformArgs(v,n.block);p.each(function(g){g.perform(d)}),v.perform(d)&&(i=!0)}else h&&h.each(function(g,y){s(n,g)&&g.dirty();var m=o.getPerformArgs(g,n.block);m.skip=!l.performRawSeries&&t.isSeriesFiltered(g.context.model),o.updatePayload(g,a),g.perform(m)&&(i=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=i||this.unfinished},r.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(a){t=a.dataTask.perform()||t}),this.unfinished=t||this.unfinished},r.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},r.prototype.updatePayload=function(e,t){t!=="remain"&&(e.context.payload=t)},r.prototype._createSeriesStageTask=function(e,t,a,n){var i=this,o=t.seriesTaskMap,s=t.seriesTaskMap=$(),l=e.seriesType,u=e.getTargetSeries;e.createOnAllSeries?a.eachRawSeries(f):l?a.eachRawSeriesByType(l,f):u&&u(a,n).each(f);function f(h){var v=h.uid,c=s.set(v,o&&o.get(v)||bs({plan:Rk,reset:Ek,count:Ok}));c.context={model:h,ecModel:a,api:n,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(h,c)}},r.prototype._createOverallStageTask=function(e,t,a,n){var i=this,o=t.overallTask=t.overallTask||bs({reset:Mk});o.context={ecModel:a,api:n,overallReset:e.overallReset,scheduler:i};var s=o.agentStubMap,l=o.agentStubMap=$(),u=e.seriesType,f=e.getTargetSeries,h=!0,v=!1,c="";Ce(!e.createOnAllSeries,c),u?a.eachRawSeriesByType(u,p):f?f(a,n).each(p):(h=!1,D(a.getSeries(),p));function p(d){var g=d.uid,y=l.set(g,s&&s.get(g)||(v=!0,bs({reset:Ik,onDirty:Pk})));y.context={model:d,overallProgress:h},y.agent=o,y.__block=h,i._pipe(d,y)}v&&o.dirty()},r.prototype._pipe=function(e,t){var a=e.uid,n=this._pipelineMap.get(a);!n.head&&(n.head=t),n.tail&&n.tail.pipe(t),n.tail=t,t.__idxInPipeline=n.count++,t.__pipeline=n},r.wrapStageHandler=function(e,t){return J(e)&&(e={overallReset:e,seriesType:Nk(e)}),e.uid=go("stageHandler"),t&&(e.visualType=t),e},r}();function Mk(r){r.overallReset(r.ecModel,r.api,r.payload)}function Ik(r){return r.overallProgress&&Lk}function Lk(){this.agent.dirty(),this.getDownstream().dirty()}function Pk(){this.agent&&this.agent.dirty()}function Rk(r){return r.plan?r.plan(r.model,r.ecModel,r.api,r.payload):null}function Ek(r){r.useClearVisual&&r.data.clearAllVisual();var e=r.resetDefines=Pt(r.reset(r.model,r.ecModel,r.api,r.payload));return e.length>1?G(e,function(t,a){return IA(a)}):kk}var kk=IA(0);function IA(r){return function(e,t){var a=t.data,n=t.resetDefines[r];if(n&&n.dataEach)for(var i=e.start;i0&&c===u.length-v.length){var p=u.slice(0,c);p!=="data"&&(t.mainType=p,t[v.toLowerCase()]=l,f=!0)}}s.hasOwnProperty(u)&&(a[u]=l,f=!0),f||(n[u]=l)})}return{cptQuery:t,dataQuery:a,otherQuery:n}},r.prototype.filter=function(e,t){var a=this.eventInfo;if(!a)return!0;var n=a.targetEl,i=a.packedEvent,o=a.model,s=a.view;if(!o||!s)return!0;var l=t.cptQuery,u=t.dataQuery;return f(l,o,"mainType")&&f(l,o,"subType")&&f(l,o,"index","componentIndex")&&f(l,o,"name")&&f(l,o,"id")&&f(u,i,"name")&&f(u,i,"dataIndex")&&f(u,i,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(e,t.otherQuery,n,i));function f(h,v,c,p){return h[c]==null||v[p||c]===h[c]}},r.prototype.afterTrigger=function(){this.eventInfo=null},r}(),Yp=["symbol","symbolSize","symbolRotate","symbolOffset"],j0=Yp.concat(["symbolKeepAspect"]),zk={createOnAllSeries:!0,performRawSeries:!0,reset:function(r,e){var t=r.getData();if(r.legendIcon&&t.setVisual("legendIcon",r.legendIcon),!r.hasSymbolVisual)return;for(var a={},n={},i=!1,o=0;o=0&&Fn(l)?l:.5;var u=r.createRadialGradient(o,s,0,o,s,l);return u}function Xp(r,e,t){for(var a=e.type==="radial"?tO(r,e,t):jk(r,e,t),n=e.colorStops,i=0;i0)?null:r==="dashed"?[4*e,2*e]:r==="dotted"?[e]:wt(r)?[r]:z(r)?r:null}function kg(r){var e=r.style,t=e.lineDash&&e.lineWidth>0&&rO(e.lineDash,e.lineWidth),a=e.lineDashOffset;if(t){var n=e.strokeNoScale&&r.getLineScale?r.getLineScale():1;n&&n!==1&&(t=G(t,function(i){return i/n}),a/=n)}return[t,a]}var aO=new Ur(!0);function df(r){var e=r.stroke;return!(e==null||e==="none"||!(r.lineWidth>0))}function t_(r){return typeof r=="string"&&r!=="none"}function gf(r){var e=r.fill;return e!=null&&e!=="none"}function e_(r,e){if(e.fillOpacity!=null&&e.fillOpacity!==1){var t=r.globalAlpha;r.globalAlpha=e.fillOpacity*e.opacity,r.fill(),r.globalAlpha=t}else r.fill()}function r_(r,e){if(e.strokeOpacity!=null&&e.strokeOpacity!==1){var t=r.globalAlpha;r.globalAlpha=e.strokeOpacity*e.opacity,r.stroke(),r.globalAlpha=t}else r.stroke()}function Zp(r,e,t){var a=og(e.image,e.__image,t);if(Jf(a)){var n=r.createPattern(a,e.repeat||"repeat");if(typeof DOMMatrix=="function"&&n&&n.setTransform){var i=new DOMMatrix;i.translateSelf(e.x||0,e.y||0),i.rotateSelf(0,0,(e.rotation||0)*Du),i.scaleSelf(e.scaleX||1,e.scaleY||1),n.setTransform(i)}return n}}function nO(r,e,t,a){var n,i=df(t),o=gf(t),s=t.strokePercent,l=s<1,u=!e.path;(!e.silent||l)&&u&&e.createPathProxy();var f=e.path||aO,h=e.__dirty;if(!a){var v=t.fill,c=t.stroke,p=o&&!!v.colorStops,d=i&&!!c.colorStops,g=o&&!!v.image,y=i&&!!c.image,m=void 0,_=void 0,S=void 0,b=void 0,x=void 0;(p||d)&&(x=e.getBoundingRect()),p&&(m=h?Xp(r,v,x):e.__canvasFillGradient,e.__canvasFillGradient=m),d&&(_=h?Xp(r,c,x):e.__canvasStrokeGradient,e.__canvasStrokeGradient=_),g&&(S=h||!e.__canvasFillPattern?Zp(r,v,e):e.__canvasFillPattern,e.__canvasFillPattern=S),y&&(b=h||!e.__canvasStrokePattern?Zp(r,c,e):e.__canvasStrokePattern,e.__canvasStrokePattern=S),p?r.fillStyle=m:g&&(S?r.fillStyle=S:o=!1),d?r.strokeStyle=_:y&&(b?r.strokeStyle=b:i=!1)}var w=e.getGlobalScale();f.setScale(w[0],w[1],e.segmentIgnoreThreshold);var T,A;r.setLineDash&&t.lineDash&&(n=kg(e),T=n[0],A=n[1]);var C=!0;(u||h&ts)&&(f.setDPR(r.dpr),l?f.setContext(null):(f.setContext(r),C=!1),f.reset(),e.buildPath(f,e.shape,a),f.toStatic(),e.pathUpdated()),C&&f.rebuildPath(r,l?s:1),T&&(r.setLineDash(T),r.lineDashOffset=A),a||(t.strokeFirst?(i&&r_(r,t),o&&e_(r,t)):(o&&e_(r,t),i&&r_(r,t))),T&&r.setLineDash([])}function iO(r,e,t){var a=e.__image=og(t.image,e.__image,e,e.onload);if(!(!a||!Jf(a))){var n=t.x||0,i=t.y||0,o=e.getWidth(),s=e.getHeight(),l=a.width/a.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=a.width,s=a.height),t.sWidth&&t.sHeight){var u=t.sx||0,f=t.sy||0;r.drawImage(a,u,f,t.sWidth,t.sHeight,n,i,o,s)}else if(t.sx&&t.sy){var u=t.sx,f=t.sy,h=o-u,v=s-f;r.drawImage(a,u,f,h,v,n,i,o,s)}else r.drawImage(a,n,i,o,s)}}function oO(r,e,t){var a,n=t.text;if(n!=null&&(n+=""),n){r.font=t.font||Ua,r.textAlign=t.textAlign,r.textBaseline=t.textBaseline;var i=void 0,o=void 0;r.setLineDash&&t.lineDash&&(a=kg(e),i=a[0],o=a[1]),i&&(r.setLineDash(i),r.lineDashOffset=o),t.strokeFirst?(df(t)&&r.strokeText(n,t.x,t.y),gf(t)&&r.fillText(n,t.x,t.y)):(gf(t)&&r.fillText(n,t.x,t.y),df(t)&&r.strokeText(n,t.x,t.y)),i&&r.setLineDash([])}}var a_=["shadowBlur","shadowOffsetX","shadowOffsetY"],n_=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function OA(r,e,t,a,n){var i=!1;if(!a&&(t=t||{},e===t))return!1;if(a||e.opacity!==t.opacity){Ne(r,n),i=!0;var o=Math.max(Math.min(e.opacity,1),0);r.globalAlpha=isNaN(o)?Xn.opacity:o}(a||e.blend!==t.blend)&&(i||(Ne(r,n),i=!0),r.globalCompositeOperation=e.blend||Xn.blend);for(var s=0;s0&&t.unfinished);t.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(t,a,n){if(!this[pe]){if(this._disposed){this.id;return}var i,o,s;if(et(a)&&(n=a.lazyUpdate,i=a.silent,o=a.replaceMerge,s=a.transition,a=a.notMerge),this[pe]=!0,!this._model||a){var l=new SE(this._api),u=this._theme,f=this._model=new Dg;f.scheduler=this._scheduler,f.ssr=this._ssr,f.init(null,null,null,u,this._locale,l)}this._model.setOption(t,{replaceMerge:o},qp);var h={seriesTransition:s,optionChanged:!0};if(n)this[Ee]={silent:i,updateParams:h},this[pe]=!1,this.getZr().wakeUp();else{try{Ci(this),ba.update.call(this,null,h)}catch(v){throw this[Ee]=null,this[pe]=!1,v}this._ssr||this._zr.flush(),this[Ee]=null,this[pe]=!1,No.call(this,i),Bo.call(this,i)}}},e.prototype.setTheme=function(){},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||yt.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},e.prototype.renderToCanvas=function(t){t=t||{};var a=this._zr.painter;return a.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(t){t=t||{};var a=this._zr.painter;return a.renderToString({useViewBox:t.useViewBox})},e.prototype.getSvgDataURL=function(){if(yt.svgSupported){var t=this._zr,a=t.storage.getDisplayList();return D(a,function(n){n.stopAnimation(null,!0)}),t.painter.toDataURL()}},e.prototype.getDataURL=function(t){if(this._disposed){this.id;return}t=t||{};var a=t.excludeComponents,n=this._model,i=[],o=this;D(a,function(l){n.eachComponent({mainType:l},function(u){var f=o._componentsMap[u.__viewId];f.group.ignore||(i.push(f),f.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return D(i,function(l){l.group.ignore=!1}),s},e.prototype.getConnectedDataURL=function(t){if(this._disposed){this.id;return}var a=t.type==="svg",n=this.group,i=Math.min,o=Math.max,s=1/0;if(__[n]){var l=s,u=s,f=-s,h=-s,v=[],c=t&&t.pixelRatio||this.getDevicePixelRatio();D(Ts,function(_,S){if(_.group===n){var b=a?_.getZr().painter.getSvgDom().innerHTML:_.renderToCanvas(rt(t)),x=_.getDom().getBoundingClientRect();l=i(x.left,l),u=i(x.top,u),f=o(x.right,f),h=o(x.bottom,h),v.push({dom:b,left:x.left,top:x.top})}}),l*=c,u*=c,f*=c,h*=c;var p=f-l,d=h-u,g=Ya.createCanvas(),y=Am(g,{renderer:a?"svg":"canvas"});if(y.resize({width:p,height:d}),a){var m="";return D(v,function(_){var S=_.left-l,b=_.top-u;m+=''+_.dom+""}),y.painter.getSvgRoot().innerHTML=m,t.connectedBackgroundColor&&y.painter.setBackgroundColor(t.connectedBackgroundColor),y.refreshImmediately(),y.painter.toDataURL()}else return t.connectedBackgroundColor&&y.add(new St({shape:{x:0,y:0,width:p,height:d},style:{fill:t.connectedBackgroundColor}})),D(v,function(_){var S=new le({style:{x:_.left*c-l,y:_.top*c-u,image:_.dom}});y.add(S)}),y.refreshImmediately(),g.toDataURL("image/"+(t&&t.type||"png"))}else return this.getDataURL(t)},e.prototype.convertToPixel=function(t,a){return Iv(this,"convertToPixel",t,a)},e.prototype.convertFromPixel=function(t,a){return Iv(this,"convertFromPixel",t,a)},e.prototype.containPixel=function(t,a){if(this._disposed){this.id;return}var n=this._model,i,o=ys(n,t);return D(o,function(s,l){l.indexOf("Models")>=0&&D(s,function(u){var f=u.coordinateSystem;if(f&&f.containPoint)i=i||!!f.containPoint(a);else if(l==="seriesModels"){var h=this._chartsMap[u.__viewId];h&&h.containPoint&&(i=i||h.containPoint(a,u))}},this)},this),!!i},e.prototype.getVisual=function(t,a){var n=this._model,i=ys(n,t,{defaultMainType:"series"}),o=i.seriesModel,s=o.getData(),l=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?s.indexOfRawIndex(i.dataIndex):null;return l!=null?Eg(s,l,a):cl(s,a)},e.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},e.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},e.prototype._initEvents=function(){var t=this;D(PO,function(a){var n=function(i){var o=t.getModel(),s=i.target,l,u=a==="globalout";if(u?l={}:s&&Gn(s,function(p){var d=nt(p);if(d&&d.dataIndex!=null){var g=d.dataModel||o.getSeriesByIndex(d.seriesIndex);return l=g&&g.getDataParams(d.dataIndex,d.dataType,s)||{},!0}else if(d.eventData)return l=V({},d.eventData),!0},!0),l){var f=l.componentType,h=l.componentIndex;(f==="markLine"||f==="markPoint"||f==="markArea")&&(f="series",h=l.seriesIndex);var v=f&&h!=null&&o.getComponent(f,h),c=v&&t[v.mainType==="series"?"_chartsMap":"_componentsMap"][v.__viewId];l.event=i,l.type=a,t._$eventProcessor.eventInfo={targetEl:s,packedEvent:l,model:v,view:c},t.trigger(a,l)}};n.zrEventfulCallAtLast=!0,t._zr.on(a,n,t)}),D(ws,function(a,n){t._messageCenter.on(n,function(i){this.trigger(n,i)},t)}),D(["selectchanged"],function(a){t._messageCenter.on(a,function(n){this.trigger(a,n)},t)}),Fk(this._messageCenter,this,this._api)},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var t=this.getDom();t&&Uw(this.getDom(),Bg,"");var a=this,n=a._api,i=a._model;D(a._componentsViews,function(o){o.dispose(i,n)}),D(a._chartsViews,function(o){o.dispose(i,n)}),a._zr.dispose(),a._dom=a._model=a._chartsMap=a._componentsMap=a._chartsViews=a._componentsViews=a._scheduler=a._api=a._zr=a._throttledZrFlush=a._theme=a._coordSysMgr=a._messageCenter=null,delete Ts[a.id]},e.prototype.resize=function(t){if(!this[pe]){if(this._disposed){this.id;return}this._zr.resize(t);var a=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!a){var n=a.resetOption("media"),i=t&&t.silent;this[Ee]&&(i==null&&(i=this[Ee].silent),n=!0,this[Ee]=null),this[pe]=!0;try{n&&Ci(this),ba.update.call(this,{type:"resize",animation:V({duration:0},t&&t.animation)})}catch(o){throw this[pe]=!1,o}this[pe]=!1,No.call(this,i),Bo.call(this,i)}}},e.prototype.showLoading=function(t,a){if(this._disposed){this.id;return}if(et(t)&&(a=t,t=""),t=t||"default",this.hideLoading(),!!Kp[t]){var n=Kp[t](this._api,a),i=this._zr;this._loadingFX=n,i.add(n)}},e.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},e.prototype.makeActionFromEvent=function(t){var a=V({},t);return a.type=ws[t.type],a},e.prototype.dispatchAction=function(t,a){if(this._disposed){this.id;return}if(et(a)||(a={silent:!!a}),!!yf[t.type]&&this._model){if(this[pe]){this._pendingActions.push(t);return}var n=a.silent;Pv.call(this,t,n);var i=a.flush;i?this._zr.flush():i!==!1&&yt.browser.weChat&&this._throttledZrFlush(),No.call(this,n),Bo.call(this,n)}},e.prototype.updateLabelLayout=function(){cr.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(t){if(this._disposed){this.id;return}var a=t.seriesIndex,n=this.getModel(),i=n.getSeriesByIndex(a);i.appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()},e.internalField=function(){Ci=function(h){var v=h._scheduler;v.restorePipelines(h._model),v.prepareStageTasks(),Mv(h,!0),Mv(h,!1),v.plan()},Mv=function(h,v){for(var c=h._model,p=h._scheduler,d=v?h._componentsViews:h._chartsViews,g=v?h._componentsMap:h._chartsMap,y=h._zr,m=h._api,_=0;_v.get("hoverLayerThreshold")&&!yt.node&&!yt.worker&&v.eachSeries(function(g){if(!g.preventUsingHoverLayer){var y=h._chartsMap[g.__viewId];y.__alive&&y.eachRendered(function(m){m.states.emphasis&&(m.states.emphasis.hoverLayer=!0)})}})}function o(h,v){var c=h.get("blendMode")||null;v.eachRendered(function(p){p.isGroup||(p.style.blend=c)})}function s(h,v){if(!h.preventAutoZ){var c=h.get("z")||0,p=h.get("zlevel")||0;v.eachRendered(function(d){return l(d,c,p,-1/0),!0})}}function l(h,v,c,p){var d=h.getTextContent(),g=h.getTextGuideLine(),y=h.isGroup;if(y)for(var m=h.childrenRef(),_=0;_0?{duration:d,delay:c.get("delay"),easing:c.get("easing")}:null;v.eachRendered(function(y){if(y.states&&y.states.emphasis){if(Xi(y))return;if(y instanceof gt&&aR(y),y.__dirty){var m=y.prevStates;m&&y.useStates(m)}if(p){y.stateTransition=g;var _=y.getTextContent(),S=y.getTextGuideLine();_&&(_.stateTransition=g),S&&(S.stateTransition=g)}y.__dirty&&n(y)}})}y_=function(h){return new(function(v){k(c,v);function c(){return v!==null&&v.apply(this,arguments)||this}return c.prototype.getCoordinateSystems=function(){return h._coordSysMgr.getCoordinateSystems()},c.prototype.getComponentByElement=function(p){for(;p;){var d=p.__ecComponentInfo;if(d!=null)return h._model.getComponent(d.mainType,d.index);p=p.parent}},c.prototype.enterEmphasis=function(p,d){la(p,d),Ue(h)},c.prototype.leaveEmphasis=function(p,d){ua(p,d),Ue(h)},c.prototype.enterBlur=function(p){sT(p),Ue(h)},c.prototype.leaveBlur=function(p){hg(p),Ue(h)},c.prototype.enterSelect=function(p){lT(p),Ue(h)},c.prototype.leaveSelect=function(p){uT(p),Ue(h)},c.prototype.getModel=function(){return h.getModel()},c.prototype.getViewOfComponentModel=function(p){return h.getViewOfComponentModel(p)},c.prototype.getViewOfSeriesModel=function(p){return h.getViewOfSeriesModel(p)},c}(eA))(h)},KA=function(h){function v(c,p){for(var d=0;d=0)){S_.push(t);var i=MA.wrapStageHandler(t,n);i.__prio=e,i.__raw=t,r.push(i)}}function rC(r,e){Kp[r]=e}function zO(r,e,t){var a=gO("registerMap");a&&a(r,e,t)}var GO=QE;hi(Og,Tk);hi(gh,Ak);hi(gh,Ck);hi(Og,zk);hi(gh,Gk);hi(UA,pO);tC(aA);eC(_O,RE);rC("default",Dk);Xr({type:Zn,event:Zn,update:Zn},Xt);Xr({type:Nu,event:Nu,update:Nu},Xt);Xr({type:ms,event:ms,update:ms},Xt);Xr({type:Bu,event:Bu,update:Bu},Xt);Xr({type:_s,event:_s,update:_s},Xt);jA("light",Bk);jA("dark",RA);var x_=[],FO={registerPreprocessor:tC,registerProcessor:eC,registerPostInit:OO,registerPostUpdate:NO,registerUpdateLifecycle:Vg,registerAction:Xr,registerCoordinateSystem:BO,registerLayout:VO,registerVisual:hi,registerTransform:GO,registerLoading:rC,registerMap:zO,registerImpl:dO,PRIORITY:MO,ComponentModel:mt,ComponentView:Ft,SeriesModel:Vt,ChartView:Rt,registerComponentModel:function(r){mt.registerClass(r)},registerComponentView:function(r){Ft.registerClass(r)},registerSeriesModel:function(r){Vt.registerClass(r)},registerChartView:function(r){Rt.registerClass(r)},registerSubTypeDefaulter:function(r,e){mt.registerSubTypeDefaulter(r,e)},registerPainter:function(r,e){b2(r,e)}};function dt(r){if(z(r)){D(r,function(e){dt(e)});return}ct(x_,r)>=0||(x_.push(r),J(r)&&(r={install:r}),r.install(FO))}function Vo(r){return r==null?0:r.length||1}function b_(r){return r}var fa=function(){function r(e,t,a,n,i,o){this._old=e,this._new=t,this._oldKeyGetter=a||b_,this._newKeyGetter=n||b_,this.context=i,this._diffModeMultiple=o==="multiple"}return r.prototype.add=function(e){return this._add=e,this},r.prototype.update=function(e){return this._update=e,this},r.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},r.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},r.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},r.prototype.remove=function(e){return this._remove=e,this},r.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},r.prototype._executeOneToOne=function(){var e=this._old,t=this._new,a={},n=new Array(e.length),i=new Array(t.length);this._initIndexMap(e,null,n,"_oldKeyGetter"),this._initIndexMap(t,a,i,"_newKeyGetter");for(var o=0;o1){var f=l.shift();l.length===1&&(a[s]=l[0]),this._update&&this._update(f,o)}else u===1?(a[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(i,a)},r.prototype._executeMultiple=function(){var e=this._old,t=this._new,a={},n={},i=[],o=[];this._initIndexMap(e,a,i,"_oldKeyGetter"),this._initIndexMap(t,n,o,"_newKeyGetter");for(var s=0;s1&&v===1)this._updateManyToOne&&this._updateManyToOne(f,u),n[l]=null;else if(h===1&&v>1)this._updateOneToMany&&this._updateOneToMany(f,u),n[l]=null;else if(h===1&&v===1)this._update&&this._update(f,u),n[l]=null;else if(h>1&&v>1)this._updateManyToMany&&this._updateManyToMany(f,u),n[l]=null;else if(h>1)for(var c=0;c1)for(var s=0;s30}var zo=et,wa=G,ZO=typeof Int32Array>"u"?Array:Int32Array,$O="e\0\0",w_=-1,qO=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],KO=["_approximateExtent"],T_,Ql,Go,Fo,kv,Ho,Ov,Te=function(){function r(e,t){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var a,n=!1;nC(e)?(a=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(n=!0,a=e),a=a||["x","y"];for(var i={},o=[],s={},l=!1,u={},f=0;f=t)){var a=this._store,n=a.getProvider();this._updateOrdinalMeta();var i=this._nameList,o=this._idList,s=n.getSource().sourceFormat,l=s===sr;if(l&&!n.pure)for(var u=[],f=e;f0},r.prototype.ensureUniqueItemVisual=function(e,t){var a=this._itemVisuals,n=a[e];n||(n=a[e]={});var i=n[t];return i==null&&(i=this.getVisual(t),z(i)?i=i.slice():zo(i)&&(i=V({},i)),n[t]=i),i},r.prototype.setItemVisual=function(e,t,a){var n=this._itemVisuals[e]||{};this._itemVisuals[e]=n,zo(t)?V(n,t):n[t]=a},r.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},r.prototype.setLayout=function(e,t){zo(e)?V(this._layout,e):this._layout[e]=t},r.prototype.getLayout=function(e){return this._layout[e]},r.prototype.getItemLayout=function(e){return this._itemLayouts[e]},r.prototype.setItemLayout=function(e,t,a){this._itemLayouts[e]=a?V(this._itemLayouts[e]||{},t):t},r.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},r.prototype.setItemGraphicEl=function(e,t){var a=this.hostModel&&this.hostModel.seriesIndex;Mp(a,this.dataType,e,t),this._graphicEls[e]=t},r.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},r.prototype.eachItemGraphicEl=function(e,t){D(this._graphicEls,function(a,n){a&&e&&e.call(t,a,n)})},r.prototype.cloneShallow=function(e){return e||(e=new r(this._schema?this._schema:wa(this.dimensions,this._getDimInfo,this),this.hostModel)),kv(e,this),e._store=this._store,e},r.prototype.wrapMethod=function(e,t){var a=this[e];J(a)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var n=a.apply(this,arguments);return t.apply(this,[n].concat($d(arguments)))})},r.internalField=function(){T_=function(e){var t=e._invertedIndicesMap;D(t,function(a,n){var i=e._dimInfos[n],o=i.ordinalMeta,s=e._store;if(o){a=t[n]=new ZO(o.categories.length);for(var l=0;l1&&(l+="__ec__"+f),n[t]=l}}}(),r}();function pl(r,e){Mg(r)||(r=Ig(r)),e=e||{};var t=e.coordDimensions||[],a=e.dimensionsDefine||r.dimensionsDefine||[],n=$(),i=[],o=QO(r,t,a,e.dimensionsCount),s=e.canOmitUnusedDimensions&&sC(o),l=a===r.dimensionsDefine,u=l?oC(r):iC(a),f=e.encodeDefine;!f&&e.encodeDefaulter&&(f=e.encodeDefaulter(r,o));for(var h=$(f),v=new pA(o),c=0;c0&&(a.name=n+(i-1)),i++,e.set(n,i)}}function QO(r,e,t,a){var n=Math.max(r.dimensionsDetectedCount||1,e.length,t.length,a||0);return D(e,function(i){var o;et(i)&&(o=i.dimsDef)&&(n=Math.max(n,o.length))}),n}function jO(r,e,t){if(t||e.hasKey(r)){for(var a=0;e.hasKey(r+a);)a++;r+=a}return e.set(r,!0),r}var tN=function(){function r(e){this.coordSysDims=[],this.axisMap=$(),this.categoryAxisMap=$(),this.coordSysName=e}return r}();function eN(r){var e=r.get("coordinateSystem"),t=new tN(e),a=rN[e];if(a)return a(r,t,t.axisMap,t.categoryAxisMap),t}var rN={cartesian2d:function(r,e,t,a){var n=r.getReferringComponents("xAxis",$t).models[0],i=r.getReferringComponents("yAxis",$t).models[0];e.coordSysDims=["x","y"],t.set("x",n),t.set("y",i),Di(n)&&(a.set("x",n),e.firstCategoryDimIndex=0),Di(i)&&(a.set("y",i),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},singleAxis:function(r,e,t,a){var n=r.getReferringComponents("singleAxis",$t).models[0];e.coordSysDims=["single"],t.set("single",n),Di(n)&&(a.set("single",n),e.firstCategoryDimIndex=0)},polar:function(r,e,t,a){var n=r.getReferringComponents("polar",$t).models[0],i=n.findAxisModel("radiusAxis"),o=n.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],t.set("radius",i),t.set("angle",o),Di(i)&&(a.set("radius",i),e.firstCategoryDimIndex=0),Di(o)&&(a.set("angle",o),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},geo:function(r,e,t,a){e.coordSysDims=["lng","lat"]},parallel:function(r,e,t,a){var n=r.ecModel,i=n.getComponent("parallel",r.get("parallelIndex")),o=e.coordSysDims=i.dimensions.slice();D(i.parallelAxisIndex,function(s,l){var u=n.getComponent("parallelAxis",s),f=o[l];t.set(f,u),Di(u)&&(a.set(f,u),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=l))})}};function Di(r){return r.get("type")==="category"}function aN(r,e,t){t=t||{};var a=t.byIndex,n=t.stackedCoordDimension,i,o,s;nN(e)?i=e:(o=e.schema,i=o.dimensions,s=e.store);var l=!!(r&&r.get("stack")),u,f,h,v;if(D(i,function(m,_){Y(m)&&(i[_]=m={name:m}),l&&!m.isExtraCoord&&(!a&&!u&&m.ordinalMeta&&(u=m),!f&&m.type!=="ordinal"&&m.type!=="time"&&(!n||n===m.coordDim)&&(f=m))}),f&&!a&&!u&&(a=!0),f){h="__\0ecstackresult_"+r.id,v="__\0ecstackedover_"+r.id,u&&(u.createInvertedIndices=!0);var c=f.coordDim,p=f.type,d=0;D(i,function(m){m.coordDim===c&&d++});var g={name:h,coordDim:c,coordDimIndex:d,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},y={name:v,coordDim:v,coordDimIndex:d+1,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};o?(s&&(g.storeDimIndex=s.ensureCalculationDimension(v,p),y.storeDimIndex=s.ensureCalculationDimension(h,p)),o.appendCalculationDimension(g),o.appendCalculationDimension(y)):(i.push(g),i.push(y))}return{stackedDimension:f&&f.name,stackedByDimension:u&&u.name,isStackedByIndex:a,stackedOverDimension:v,stackResultDimension:h}}function nN(r){return!nC(r.schema)}function qa(r,e){return!!e&&e===r.getCalculationInfo("stackedDimension")}function lC(r,e){return qa(r,e)?r.getCalculationInfo("stackResultDimension"):e}function iN(r,e){var t=r.get("coordinateSystem"),a=vl.get(t),n;return e&&e.coordSysDims&&(n=G(e.coordSysDims,function(i){var o={name:i},s=e.axisMap.get(i);if(s){var l=s.get("type");o.type=_f(l)}return o})),n||(n=a&&(a.getDimensionsInfo?a.getDimensionsInfo():a.dimensions.slice())||["x","y"]),n}function oN(r,e,t){var a,n;return t&&D(r,function(i,o){var s=i.coordDim,l=t.categoryAxisMap.get(s);l&&(a==null&&(a=o),i.ordinalMeta=l.getOrdinalMeta(),e&&(i.createInvertedIndices=!0)),i.otherDims.itemName!=null&&(n=!0)}),!n&&a!=null&&(r[a].otherDims.itemName=0),a}function ga(r,e,t){t=t||{};var a=e.getSourceManager(),n,i=!1;r?(i=!0,n=Ig(r)):(n=a.getSource(),i=n.sourceFormat===sr);var o=eN(e),s=iN(e,o),l=t.useEncodeDefaulter,u=J(l)?l:l?lt(JT,s,e):null,f={coordDimensions:s,generateCoord:t.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!i},h=pl(n,f),v=oN(h.dimensions,t.createInvertedIndices,o),c=i?null:a.getSharedDataStore(h),p=aN(e,{schema:h,store:c}),d=new Te(h,e);d.setCalculationInfo(p);var g=v!=null&&sN(n)?function(y,m,_,S){return S===v?_:this.defaultDimValueGetter(y,m,_,S)}:null;return d.hasItemOption=!1,d.initData(i?n:c,null,g),d}function sN(r){if(r.sourceFormat===sr){var e=lN(r.data||[]);return!z(ho(e))}}function lN(r){for(var e=0;et[1]&&(t[1]=e[1])},r.prototype.unionExtentFromData=function(e,t){this.unionExtent(e.getApproximateExtent(t))},r.prototype.getExtent=function(){return this._extent.slice()},r.prototype.setExtent=function(e,t){var a=this._extent;isNaN(e)||(a[0]=e),isNaN(t)||(a[1]=t)},r.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},r.prototype.isBlank=function(){return this._isBlank},r.prototype.setBlank=function(e){this._isBlank=e},r}();Kf(Zr);var uN=0,Jp=function(){function r(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++uN}return r.createByAxisModel=function(e){var t=e.option,a=t.data,n=a&&G(a,fN);return new r({categories:n,needCollect:!n,deduplication:t.dedplication!==!1})},r.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},r.prototype.parseAndCollect=function(e){var t,a=this._needCollect;if(!Y(e)&&!a)return e;if(a&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,t;var n=this._getOrCreateMap();return t=n.get(e),t==null&&(a?(t=this.categories.length,this.categories[t]=e,n.set(e,t)):t=NaN),t},r.prototype._getOrCreateMap=function(){return this._map||(this._map=$(this.categories))},r}();function fN(r){return et(r)&&r.value!=null?r.value:r+""}function Qp(r){return r.type==="interval"||r.type==="log"}function hN(r,e,t,a){var n={},i=r[1]-r[0],o=n.interval=Nw(i/e);t!=null&&oa&&(o=n.interval=a);var s=n.intervalPrecision=uC(o),l=n.niceTickExtent=[Ut(Math.ceil(r[0]/o)*o,s),Ut(Math.floor(r[1]/o)*o,s)];return vN(l,r),n}function Nv(r){var e=Math.pow(10,rg(r)),t=r/e;return t?t===2?t=3:t===3?t=5:t*=2:t=1,Ut(t*e)}function uC(r){return Er(r)+2}function A_(r,e,t){r[e]=Math.max(Math.min(r[e],t[1]),t[0])}function vN(r,e){!isFinite(r[0])&&(r[0]=e[0]),!isFinite(r[1])&&(r[1]=e[1]),A_(r,0,e),A_(r,1,e),r[0]>r[1]&&(r[0]=r[1])}function yh(r,e){return r>=e[0]&&r<=e[1]}function mh(r,e){return e[1]===e[0]?.5:(r-e[0])/(e[1]-e[0])}function _h(r,e){return r*(e[1]-e[0])+e[0]}var Sh=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;a.type="ordinal";var n=a.getSetting("ordinalMeta");return n||(n=new Jp({})),z(n)&&(n=new Jp({categories:G(n,function(i){return et(i)?i.value:i})})),a._ordinalMeta=n,a._extent=a.getSetting("extent")||[0,n.categories.length-1],a}return e.prototype.parse=function(t){return t==null?NaN:Y(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},e.prototype.contain=function(t){return t=this.parse(t),yh(t,this._extent)&&this._ordinalMeta.categories[t]!=null},e.prototype.normalize=function(t){return t=this._getTickNumber(this.parse(t)),mh(t,this._extent)},e.prototype.scale=function(t){return t=Math.round(_h(t,this._extent)),this.getRawOrdinalNumber(t)},e.prototype.getTicks=function(){for(var t=[],a=this._extent,n=a[0];n<=a[1];)t.push({value:n}),n++;return t},e.prototype.getMinorTicks=function(t){},e.prototype.setSortInfo=function(t){if(t==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var a=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Math.min(s,a.length);o=0&&t=0&&t=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(Zr);Zr.registerClass(Sh);var xn=Ut,ha=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="interval",t._interval=0,t._intervalPrecision=2,t}return e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return yh(t,this._extent)},e.prototype.normalize=function(t){return mh(t,this._extent)},e.prototype.scale=function(t){return _h(t,this._extent)},e.prototype.setExtent=function(t,a){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(a)||(n[1]=parseFloat(a))},e.prototype.unionExtent=function(t){var a=this._extent;t[0]a[1]&&(a[1]=t[1]),this.setExtent(a[0],a[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=uC(t)},e.prototype.getTicks=function(t){var a=this._interval,n=this._extent,i=this._niceExtent,o=this._intervalPrecision,s=[];if(!a)return s;var l=1e4;n[0]l)return[];var f=s.length?s[s.length-1].value:i[1];return n[1]>f&&(t?s.push({value:xn(f+a,o)}):s.push({value:n[1]})),s},e.prototype.getMinorTicks=function(t){for(var a=this.getTicks(!0),n=[],i=this.getExtent(),o=1;oi[0]&&c0&&(i=i===null?s:Math.min(i,s))}t[a]=i}}return t}function cC(r){var e=dN(r),t=[];return D(r,function(a){var n=a.coordinateSystem,i=n.getBaseAxis(),o=i.getExtent(),s;if(i.type==="category")s=i.getBandWidth();else if(i.type==="value"||i.type==="time"){var l=i.dim+"_"+i.index,u=e[l],f=Math.abs(o[1]-o[0]),h=i.scale.getExtent(),v=Math.abs(h[1]-h[0]);s=u?f/v*u:f}else{var c=a.getData();s=Math.abs(o[1]-o[0])/c.count()}var p=W(a.get("barWidth"),s),d=W(a.get("barMaxWidth"),s),g=W(a.get("barMinWidth")||(mC(a)?.5:1),s),y=a.get("barGap"),m=a.get("barCategoryGap");t.push({bandWidth:s,barWidth:p,barMaxWidth:d,barMinWidth:g,barGap:y,barCategoryGap:m,axisKey:Gg(i),stackId:hC(a)})}),pC(t)}function pC(r){var e={};D(r,function(a,n){var i=a.axisKey,o=a.bandWidth,s=e[i]||{bandWidth:o,remainedWidth:o,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},l=s.stacks;e[i]=s;var u=a.stackId;l[u]||s.autoWidthCount++,l[u]=l[u]||{width:0,maxWidth:0};var f=a.barWidth;f&&!l[u].width&&(l[u].width=f,f=Math.min(s.remainedWidth,f),s.remainedWidth-=f);var h=a.barMaxWidth;h&&(l[u].maxWidth=h);var v=a.barMinWidth;v&&(l[u].minWidth=v);var c=a.barGap;c!=null&&(s.gap=c);var p=a.barCategoryGap;p!=null&&(s.categoryGap=p)});var t={};return D(e,function(a,n){t[n]={};var i=a.stacks,o=a.bandWidth,s=a.categoryGap;if(s==null){var l=_t(i).length;s=Math.max(35-l*4,15)+"%"}var u=W(s,o),f=W(a.gap,1),h=a.remainedWidth,v=a.autoWidthCount,c=(h-u)/(v+(v-1)*f);c=Math.max(c,0),D(i,function(y){var m=y.maxWidth,_=y.minWidth;if(y.width){var S=y.width;m&&(S=Math.min(S,m)),_&&(S=Math.max(S,_)),y.width=S,h-=S+f*S,v--}else{var S=c;m&&mS&&(S=_),S!==c&&(y.width=S,h-=S+f*S,v--)}}),c=(h-u)/(v+(v-1)*f),c=Math.max(c,0);var p=0,d;D(i,function(y,m){y.width||(y.width=c),d=y,p+=y.width*(1+f)}),d&&(p-=d.width*f);var g=-p/2;D(i,function(y,m){t[n][m]=t[n][m]||{bandWidth:o,offset:g,width:y.width},g+=y.width*(1+f)})}),t}function gN(r,e,t){if(r&&e){var a=r[Gg(e)];return a}}function dC(r,e){var t=vC(r,e),a=cC(t);D(t,function(n){var i=n.getData(),o=n.coordinateSystem,s=o.getBaseAxis(),l=hC(n),u=a[Gg(s)][l],f=u.offset,h=u.width;i.setLayout({bandWidth:u.bandWidth,offset:f,size:h})})}function gC(r){return{seriesType:r,plan:So(),reset:function(e){if(yC(e)){var t=e.getData(),a=e.coordinateSystem,n=a.getBaseAxis(),i=a.getOtherAxis(n),o=t.getDimensionIndex(t.mapDimension(i.dim)),s=t.getDimensionIndex(t.mapDimension(n.dim)),l=e.get("showBackground",!0),u=t.mapDimension(i.dim),f=t.getCalculationInfo("stackResultDimension"),h=qa(t,u)&&!!t.getCalculationInfo("stackedOnSeries"),v=i.isHorizontal(),c=yN(n,i),p=mC(e),d=e.get("barMinHeight")||0,g=f&&t.getDimensionIndex(f),y=t.getLayout("size"),m=t.getLayout("offset");return{progress:function(_,S){for(var b=_.count,x=p&&Or(b*3),w=p&&l&&Or(b*3),T=p&&Or(b),A=a.master.getRect(),C=v?A.width:A.height,M,I=S.getStore(),L=0;(M=_.next())!=null;){var P=I.get(h?g:o,M),R=I.get(s,M),E=c,N=void 0;h&&(N=+P-I.get(o,M));var O=void 0,B=void 0,F=void 0,H=void 0;if(v){var U=a.dataToPoint([P,R]);if(h){var K=a.dataToPoint([N,R]);E=K[0]}O=E,B=U[1]+m,F=U[0]-E,H=y,Math.abs(F)0?t:1:t))}var mN=function(r,e,t,a){for(;t>>1;r[n][1]n&&(this._approxInterval=n);var s=jl.length,l=Math.min(mN(jl,this._approxInterval,0,s),s-1);this._interval=jl[l][1],this._minLevelUnit=jl[Math.max(l-1,0)][0]},e.prototype.parse=function(t){return wt(t)?t:+Wr(t)},e.prototype.contain=function(t){return yh(this.parse(t),this._extent)},e.prototype.normalize=function(t){return mh(this.parse(t),this._extent)},e.prototype.scale=function(t){return _h(t,this._extent)},e.type="time",e}(ha),jl=[["second",Sg],["minute",xg],["hour",xs],["quarter-day",xs*6],["half-day",xs*12],["day",rr*1.2],["half-week",rr*3.5],["week",rr*7],["month",rr*31],["quarter",rr*95],["half-year",p0/2],["year",p0]];function _N(r,e,t,a){var n=Wr(e),i=Wr(t),o=function(p){return g0(n,p,a)===g0(i,p,a)},s=function(){return o("year")},l=function(){return s()&&o("month")},u=function(){return l()&&o("day")},f=function(){return u()&&o("hour")},h=function(){return f()&&o("minute")},v=function(){return h()&&o("second")},c=function(){return v()&&o("millisecond")};switch(r){case"year":return s();case"month":return l();case"day":return u();case"hour":return f();case"minute":return h();case"second":return v();case"millisecond":return c()}}function SN(r,e){return r/=rr,r>16?16:r>7.5?7:r>3.5?4:r>1.5?2:1}function xN(r){var e=30*rr;return r/=e,r>6?6:r>3?3:r>2?2:1}function bN(r){return r/=xs,r>12?12:r>6?6:r>3.5?4:r>2?2:1}function C_(r,e){return r/=e?xg:Sg,r>30?30:r>20?20:r>15?15:r>10?10:r>5?5:r>2?2:1}function wN(r){return Nw(r)}function TN(r,e,t){var a=new Date(r);switch($i(e)){case"year":case"month":a[NT(t)](0);case"day":a[BT(t)](1);case"hour":a[VT(t)](0);case"minute":a[zT(t)](0);case"second":a[GT(t)](0),a[FT(t)](0)}return a.getTime()}function AN(r,e,t,a){var n=1e4,i=kT,o=0;function s(C,M,I,L,P,R,E){for(var N=new Date(M),O=M,B=N[L]();O1&&R===0&&I.unshift({value:I[0].value-O})}}for(var R=0;R=a[0]&&m<=a[1]&&h++)}var _=(a[1]-a[0])/e;if(h>_*1.5&&v>_/1.5||(u.push(g),h>_||r===i[c]))break}f=[]}}}for(var S=Ct(G(u,function(C){return Ct(C,function(M){return M.value>=a[0]&&M.value<=a[1]&&!M.notAdd})}),function(C){return C.length>0}),b=[],x=S.length-1,c=0;c0;)i*=10;var s=[Ut(MN(a[0]/i)*i),Ut(DN(a[1]/i)*i)];this._interval=i,this._niceExtent=s}},e.prototype.calcNiceExtent=function(t){As.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return t=fr(t)/fr(this.base),yh(t,this._extent)},e.prototype.normalize=function(t){return t=fr(t)/fr(this.base),mh(t,this._extent)},e.prototype.scale=function(t){return t=_h(t,this._extent),tu(this.base,t)},e.type="log",e}(Zr),_C=Hg.prototype;_C.getMinorTicks=As.getMinorTicks;_C.getLabel=As.getLabel;function eu(r,e){return CN(r,Er(e))}Zr.registerClass(Hg);var IN=function(){function r(e,t,a){this._prepareParams(e,t,a)}return r.prototype._prepareParams=function(e,t,a){a[1]0&&l>0&&!u&&(s=0),s<0&&l<0&&!f&&(l=0));var v=this._determinedMin,c=this._determinedMax;return v!=null&&(s=v,u=!0),c!=null&&(l=c,f=!0),{min:s,max:l,minFixed:u,maxFixed:f,isBlank:h}},r.prototype.modifyDataMinMax=function(e,t){this[PN[e]]=t},r.prototype.setDeterminedMinMax=function(e,t){var a=LN[e];this[a]=t},r.prototype.freeze=function(){this.frozen=!0},r}(),LN={min:"_determinedMin",max:"_determinedMax"},PN={min:"_dataMin",max:"_dataMax"};function SC(r,e,t){var a=r.rawExtentInfo;return a||(a=new IN(r,e,t),r.rawExtentInfo=a,a)}function ru(r,e){return e==null?null:Ms(e)?NaN:r.parse(e)}function xC(r,e){var t=r.type,a=SC(r,e,r.getExtent()).calculate();r.setBlank(a.isBlank);var n=a.min,i=a.max,o=e.ecModel;if(o&&t==="time"){var s=vC("bar",o),l=!1;if(D(s,function(h){l=l||h.getBaseAxis()===e.axis}),l){var u=cC(s),f=RN(n,i,e,u);n=f.min,i=f.max}}return{extent:[n,i],fixMin:a.minFixed,fixMax:a.maxFixed}}function RN(r,e,t,a){var n=t.axis.getExtent(),i=Math.abs(n[1]-n[0]),o=gN(a,t.axis);if(o===void 0)return{min:r,max:e};var s=1/0;D(o,function(c){s=Math.min(c.offset,s)});var l=-1/0;D(o,function(c){l=Math.max(c.offset+c.width,l)}),s=Math.abs(s),l=Math.abs(l);var u=s+l,f=e-r,h=1-(s+l)/i,v=f/h-f;return e+=v*(l/u),r-=v*(s/u),{min:r,max:e}}function ro(r,e){var t=e,a=xC(r,t),n=a.extent,i=t.get("splitNumber");r instanceof Hg&&(r.base=t.get("logBase"));var o=r.type,s=t.get("interval"),l=o==="interval"||o==="time";r.setExtent(n[0],n[1]),r.calcNiceExtent({splitNumber:i,fixMin:a.fixMin,fixMax:a.fixMax,minInterval:l?t.get("minInterval"):null,maxInterval:l?t.get("maxInterval"):null}),s!=null&&r.setInterval&&r.setInterval(s)}function xh(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new Sh({ordinalMeta:r.getOrdinalMeta?r.getOrdinalMeta():r.getCategories(),extent:[1/0,-1/0]});case"time":return new Fg({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new(Zr.getClass(e)||ha)}}function EN(r){var e=r.scale.getExtent(),t=e[0],a=e[1];return!(t>0&&a>0||t<0&&a<0)}function wo(r){var e=r.getLabelModel().get("formatter"),t=r.type==="category"?r.scale.getExtent()[0]:null;return r.scale.type==="time"?function(a){return function(n,i){return r.scale.getFormattedLabel(n,i,a)}}(e):Y(e)?function(a){return function(n){var i=r.scale.getLabel(n),o=a.replace("{value}",i??"");return o}}(e):J(e)?function(a){return function(n,i){return t!=null&&(i=n.value-t),a(Wg(r,n),i,n.level!=null?{level:n.level}:null)}}(e):function(a){return r.scale.getLabel(a)}}function Wg(r,e){return r.type==="category"?r.scale.getLabel(e):e.value}function kN(r){var e=r.model,t=r.scale;if(!(!e.get(["axisLabel","show"])||t.isBlank())){var a,n,i=t.getExtent();t instanceof Sh?n=t.count():(a=t.getTicks(),n=a.length);var o=r.getLabelModel(),s=wo(r),l,u=1;n>40&&(u=Math.ceil(n/40));for(var f=0;fr[1]&&(r[1]=n[1])})}var dl=function(){function r(){}return r.prototype.getNeedCrossZero=function(){var e=this.option;return!e.scale},r.prototype.getCoordSysModel=function(){},r}(),BN=1e-8;function M_(r,e){return Math.abs(r-e)n&&(a=o,n=l)}if(a)return zN(a.exterior);var u=this.getBoundingRect();return[u.x+u.width/2,u.y+u.height/2]},e.prototype.getBoundingRect=function(t){var a=this._rect;if(a&&!t)return a;var n=[1/0,1/0],i=[-1/0,-1/0],o=this.geometries;return D(o,function(s){s.type==="polygon"?I_(s.exterior,n,i,t):D(s.points,function(l){I_(l,n,i,t)})}),isFinite(n[0])&&isFinite(n[1])&&isFinite(i[0])&&isFinite(i[1])||(n[0]=n[1]=i[0]=i[1]=0),a=new ht(n[0],n[1],i[0]-n[0],i[1]-n[1]),t||(this._rect=a),a},e.prototype.contain=function(t){var a=this.getBoundingRect(),n=this.geometries;if(!a.contain(t[0],t[1]))return!1;t:for(var i=0,o=n.length;i>1^-(s&1),l=l>>1^-(l&1),s+=n,l+=i,n=s,i=l,a.push([s/t,l/t])}return a}function HN(r,e){return r=FN(r),G(Ct(r.features,function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0}),function(t){var a=t.properties,n=t.geometry,i=[];switch(n.type){case"Polygon":var o=n.coordinates;i.push(new L_(o[0],o.slice(1)));break;case"MultiPolygon":D(n.coordinates,function(l){l[0]&&i.push(new L_(l[0],l.slice(1)))});break;case"LineString":i.push(new P_([n.coordinates]));break;case"MultiLineString":i.push(new P_(n.coordinates))}var s=new TC(a[e||"name"],i,a.cp);return s.properties=a,s})}var Us=xt();function CC(r,e){var t=G(e,function(a){return r.scale.parse(a)});return r.type==="time"&&t.length>0&&(t.sort(),t.unshift(t[0]),t.push(t[t.length-1])),t}function WN(r){var e=r.getLabelModel().get("customValues");if(e){var t=wo(r),a=r.scale.getExtent(),n=CC(r,e),i=Ct(n,function(o){return o>=a[0]&&o<=a[1]});return{labels:G(i,function(o){var s={value:o};return{formattedLabel:t(s),rawLabel:r.scale.getLabel(s),tickValue:o}})}}return r.type==="category"?YN(r):ZN(r)}function UN(r,e){var t=r.getTickModel().get("customValues");if(t){var a=r.scale.getExtent(),n=CC(r,t);return{ticks:Ct(n,function(i){return i>=a[0]&&i<=a[1]})}}return r.type==="category"?XN(r,e):{ticks:G(r.scale.getTicks(),function(i){return i.value})}}function YN(r){var e=r.getLabelModel(),t=DC(r,e);return!e.get("show")||r.scale.isBlank()?{labels:[],labelCategoryInterval:t.labelCategoryInterval}:t}function DC(r,e){var t=MC(r,"labels"),a=Ug(e),n=IC(t,a);if(n)return n;var i,o;return J(a)?i=RC(r,a):(o=a==="auto"?$N(r):a,i=PC(r,o)),LC(t,a,{labels:i,labelCategoryInterval:o})}function XN(r,e){var t=MC(r,"ticks"),a=Ug(e),n=IC(t,a);if(n)return n;var i,o;if((!e.get("show")||r.scale.isBlank())&&(i=[]),J(a))i=RC(r,a,!0);else if(a==="auto"){var s=DC(r,r.getLabelModel());o=s.labelCategoryInterval,i=G(s.labels,function(l){return l.tickValue})}else o=a,i=PC(r,o,!0);return LC(t,a,{ticks:i,tickCategoryInterval:o})}function ZN(r){var e=r.scale.getTicks(),t=wo(r);return{labels:G(e,function(a,n){return{level:a.level,formattedLabel:t(a,n),rawLabel:r.scale.getLabel(a),tickValue:a.value}})}}function MC(r,e){return Us(r)[e]||(Us(r)[e]=[])}function IC(r,e){for(var t=0;t40&&(s=Math.max(1,Math.floor(o/40)));for(var l=i[0],u=r.dataToCoord(l+1)-r.dataToCoord(l),f=Math.abs(u*Math.cos(a)),h=Math.abs(u*Math.sin(a)),v=0,c=0;l<=i[1];l+=s){var p=0,d=0,g=nl(t({value:l}),e.font,"center","top");p=g.width*1.3,d=g.height*1.3,v=Math.max(v,p,7),c=Math.max(c,d,7)}var y=v/f,m=c/h;isNaN(y)&&(y=1/0),isNaN(m)&&(m=1/0);var _=Math.max(0,Math.floor(Math.min(y,m))),S=Us(r.model),b=r.getExtent(),x=S.lastAutoInterval,w=S.lastTickCount;return x!=null&&w!=null&&Math.abs(x-_)<=1&&Math.abs(w-o)<=1&&x>_&&S.axisExtent0===b[0]&&S.axisExtent1===b[1]?_=x:(S.lastTickCount=o,S.lastAutoInterval=_,S.axisExtent0=b[0],S.axisExtent1=b[1]),_}function KN(r){var e=r.getLabelModel();return{axisRotate:r.getRotate?r.getRotate():r.isHorizontal&&!r.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function PC(r,e,t){var a=wo(r),n=r.scale,i=n.getExtent(),o=r.getLabelModel(),s=[],l=Math.max((e||0)+1,1),u=i[0],f=n.count();u!==0&&l>1&&f/l>2&&(u=Math.round(Math.ceil(u/l)*l));var h=bC(r),v=o.get("showMinLabel")||h,c=o.get("showMaxLabel")||h;v&&u!==i[0]&&d(i[0]);for(var p=u;p<=i[1];p+=l)d(p);c&&p-l!==i[1]&&d(i[1]);function d(g){var y={value:g};s.push(t?g:{formattedLabel:a(y),rawLabel:n.getLabel(y),tickValue:g})}return s}function RC(r,e,t){var a=r.scale,n=wo(r),i=[];return D(a.getTicks(),function(o){var s=a.getLabel(o),l=o.value;e(o.value,s)&&i.push(t?l:{formattedLabel:n(o),rawLabel:s,tickValue:l})}),i}var R_=[0,1],br=function(){function r(e,t,a){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=a||[0,0]}return r.prototype.contain=function(e){var t=this._extent,a=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]);return e>=a&&e<=n},r.prototype.containData=function(e){return this.scale.contain(e)},r.prototype.getExtent=function(){return this._extent.slice()},r.prototype.getPixelPrecision=function(e){return kw(e||this.scale.getExtent(),this._extent)},r.prototype.setExtent=function(e,t){var a=this._extent;a[0]=e,a[1]=t},r.prototype.dataToCoord=function(e,t){var a=this._extent,n=this.scale;return e=n.normalize(e),this.onBand&&n.type==="ordinal"&&(a=a.slice(),E_(a,n.count())),Dt(e,R_,a,t)},r.prototype.coordToData=function(e,t){var a=this._extent,n=this.scale;this.onBand&&n.type==="ordinal"&&(a=a.slice(),E_(a,n.count()));var i=Dt(e,a,R_,t);return this.scale.scale(i)},r.prototype.pointToData=function(e,t){},r.prototype.getTicksCoords=function(e){e=e||{};var t=e.tickModel||this.getTickModel(),a=UN(this,t),n=a.ticks,i=G(n,function(s){return{coord:this.dataToCoord(this.scale.type==="ordinal"?this.scale.getRawOrdinalNumber(s):s),tickValue:s}},this),o=t.get("alignWithLabel");return JN(this,i,o,e.clamp),i},r.prototype.getMinorTicksCoords=function(){if(this.scale.type==="ordinal")return[];var e=this.model.getModel("minorTick"),t=e.get("splitNumber");t>0&&t<100||(t=5);var a=this.scale.getMinorTicks(t),n=G(a,function(i){return G(i,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return n},r.prototype.getViewLabels=function(){return WN(this).labels},r.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},r.prototype.getTickModel=function(){return this.model.getModel("axisTick")},r.prototype.getBandWidth=function(){var e=this._extent,t=this.scale.getExtent(),a=t[1]-t[0]+(this.onBand?1:0);a===0&&(a=1);var n=Math.abs(e[1]-e[0]);return Math.abs(n)/a},r.prototype.calculateCategoryInterval=function(){return qN(this)},r}();function E_(r,e){var t=r[1]-r[0],a=e,n=t/a/2;r[0]+=n,r[1]-=n}function JN(r,e,t,a){var n=e.length;if(!r.onBand||t||!n)return;var i=r.getExtent(),o,s;if(n===1)e[0].coord=i[0],o=e[1]={coord:i[1],tickValue:e[0].tickValue};else{var l=e[n-1].tickValue-e[0].tickValue,u=(e[n-1].coord-e[0].coord)/l;D(e,function(c){c.coord-=u/2});var f=r.scale.getExtent();s=1+f[1]-e[n-1].tickValue,o={coord:e[n-1].coord+u*s,tickValue:f[1]+1},e.push(o)}var h=i[0]>i[1];v(e[0].coord,i[0])&&(a?e[0].coord=i[0]:e.shift()),a&&v(i[0],e[0].coord)&&e.unshift({coord:i[0]}),v(i[1],o.coord)&&(a?o.coord=i[1]:e.pop()),a&&v(o.coord,i[1])&&e.push({coord:i[1]});function v(c,p){return c=Ut(c),p=Ut(p),h?c>p:cn&&(n+=Wo);var c=Math.atan2(s,o);if(c<0&&(c+=Wo),c>=a&&c<=n||c+Wo>=a&&c+Wo<=n)return l[0]=f,l[1]=h,u-t;var p=t*Math.cos(a)+r,d=t*Math.sin(a)+e,g=t*Math.cos(n)+r,y=t*Math.sin(n)+e,m=(p-o)*(p-o)+(d-s)*(d-s),_=(g-o)*(g-o)+(y-s)*(y-s);return m<_?(l[0]=p,l[1]=d,Math.sqrt(m)):(l[0]=g,l[1]=y,Math.sqrt(_))}function xf(r,e,t,a,n,i,o,s){var l=n-r,u=i-e,f=t-r,h=a-e,v=Math.sqrt(f*f+h*h);f/=v,h/=v;var c=l*f+u*h,p=c/v;s&&(p=Math.min(Math.max(p,0),1)),p*=v;var d=o[0]=r+p*f,g=o[1]=e+p*h;return Math.sqrt((d-n)*(d-n)+(g-i)*(g-i))}function EC(r,e,t,a,n,i,o){t<0&&(r=r+t,t=-t),a<0&&(e=e+a,a=-a);var s=r+t,l=e+a,u=o[0]=Math.min(Math.max(n,r),s),f=o[1]=Math.min(Math.max(i,e),l);return Math.sqrt((u-n)*(u-n)+(f-i)*(f-i))}var pr=[];function eB(r,e,t){var a=EC(e.x,e.y,e.width,e.height,r.x,r.y,pr);return t.set(pr[0],pr[1]),a}function rB(r,e,t){for(var a=0,n=0,i=0,o=0,s,l,u=1/0,f=e.data,h=r.x,v=r.y,c=0;c0){e=e/180*Math.PI,gr.fromArray(r[0]),Nt.fromArray(r[1]),Yt.fromArray(r[2]),ft.sub(Nr,gr,Nt),ft.sub(Rr,Yt,Nt);var t=Nr.len(),a=Rr.len();if(!(t<.001||a<.001)){Nr.scale(1/t),Rr.scale(1/a);var n=Nr.dot(Rr),i=Math.cos(e);if(i1&&ft.copy(be,Yt),be.toArray(r[1])}}}}function aB(r,e,t){if(t<=180&&t>0){t=t/180*Math.PI,gr.fromArray(r[0]),Nt.fromArray(r[1]),Yt.fromArray(r[2]),ft.sub(Nr,Nt,gr),ft.sub(Rr,Yt,Nt);var a=Nr.len(),n=Rr.len();if(!(a<.001||n<.001)){Nr.scale(1/a),Rr.scale(1/n);var i=Nr.dot(e),o=Math.cos(t);if(i=l)ft.copy(be,Yt);else{be.scaleAndAdd(Rr,s/Math.tan(Math.PI/2-f));var h=Yt.x!==Nt.x?(be.x-Nt.x)/(Yt.x-Nt.x):(be.y-Nt.y)/(Yt.y-Nt.y);if(isNaN(h))return;h<0?ft.copy(be,Nt):h>1&&ft.copy(be,Yt)}be.toArray(r[1])}}}}function zv(r,e,t,a){var n=t==="normal",i=n?r:r.ensureState(t);i.ignore=e;var o=a.get("smooth");o&&o===!0&&(o=.3),i.shape=i.shape||{},o>0&&(i.shape.smooth=o);var s=a.getModel("lineStyle").getLineStyle();n?r.useStyle(s):i.style=s}function nB(r,e){var t=e.smooth,a=e.points;if(a)if(r.moveTo(a[0][0],a[0][1]),t>0&&a.length>=3){var n=Pa(a[0],a[1]),i=Pa(a[1],a[2]);if(!n||!i){r.lineTo(a[1][0],a[1][1]),r.lineTo(a[2][0],a[2][1]);return}var o=Math.min(n,i)*t,s=Iu([],a[1],a[0],o/n),l=Iu([],a[1],a[2],o/i),u=Iu([],s,l,.5);r.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),r.bezierCurveTo(l[0],l[1],l[0],l[1],a[2][0],a[2][1])}else for(var f=1;f0){_(A*T,0,o);var C=A+x;C<0&&S(-C*T,1)}else S(-x*T,1)}}function _(x,w,T){x!==0&&(u=!0);for(var A=w;A0)for(var C=0;C0;C--){var P=T[C-1]*L;_(-P,C,o)}}}function b(x){var w=x<0?-1:1;x=Math.abs(x);for(var T=Math.ceil(x/(o-1)),A=0;A0?_(T,0,A+1):_(-T,o-A-1,o),x-=T,x<=0)return}return u}function iB(r,e,t,a){return NC(r,"x","width",e,t)}function BC(r,e,t,a){return NC(r,"y","height",e,t)}function VC(r){var e=[];r.sort(function(d,g){return g.priority-d.priority});var t=new ht(0,0,0,0);function a(d){if(!d.ignore){var g=d.ensureState("emphasis");g.ignore==null&&(g.ignore=!1)}d.ignore=!0}for(var n=0;n=0&&a.attr(i.oldLayoutSelect),ct(v,"emphasis")>=0&&a.attr(i.oldLayoutEmphasis)),Tt(a,u,t,l)}else if(a.attr(u),!po(a).valueAnimation){var h=st(a.style.opacity,1);a.style.opacity=0,zt(a,{style:{opacity:h}},t,l)}if(i.oldLayout=u,a.states.select){var c=i.oldLayoutSelect={};au(c,u,nu),au(c,a.states.select,nu)}if(a.states.emphasis){var p=i.oldLayoutEmphasis={};au(p,u,nu),au(p,a.states.emphasis,nu)}IT(a,l,f,t,t)}if(n&&!n.ignore&&!n.invisible){var i=lB(n),o=i.oldLayout,d={points:n.shape.points};o?(n.attr({shape:o}),Tt(n,{shape:d},t)):(n.setShape(d),n.style.strokePercent=0,zt(n,{style:{strokePercent:1}},t)),i.oldLayout=d}},r}(),Fv=xt();function fB(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,a){var n=Fv(t).labelManager;n||(n=Fv(t).labelManager=new uB),n.clearLabels()}),r.registerUpdateLifecycle("series:layoutlabels",function(e,t,a){var n=Fv(t).labelManager;a.updatedSeries.forEach(function(i){n.addLabelsOfSeries(t.getViewOfSeriesModel(i))}),n.updateLayoutConfig(t),n.layout(t),n.processLabelsOverall()})}var Hv=Math.sin,Wv=Math.cos,zC=Math.PI,wn=Math.PI*2,hB=180/zC,GC=function(){function r(){}return r.prototype.reset=function(e){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,e||4)},r.prototype.moveTo=function(e,t){this._add("M",e,t)},r.prototype.lineTo=function(e,t){this._add("L",e,t)},r.prototype.bezierCurveTo=function(e,t,a,n,i,o){this._add("C",e,t,a,n,i,o)},r.prototype.quadraticCurveTo=function(e,t,a,n){this._add("Q",e,t,a,n)},r.prototype.arc=function(e,t,a,n,i,o){this.ellipse(e,t,a,a,0,n,i,o)},r.prototype.ellipse=function(e,t,a,n,i,o,s,l){var u=s-o,f=!l,h=Math.abs(u),v=Na(h-wn)||(f?u>=wn:-u>=wn),c=u>0?u%wn:u%wn+wn,p=!1;v?p=!0:Na(h)?p=!1:p=c>=zC==!!f;var d=e+a*Wv(o),g=t+n*Hv(o);this._start&&this._add("M",d,g);var y=Math.round(i*hB);if(v){var m=1/this._p,_=(f?1:-1)*(wn-m);this._add("A",a,n,y,1,+f,e+a*Wv(o+_),t+n*Hv(o+_)),m>.01&&this._add("A",a,n,y,0,+f,d,g)}else{var S=e+a*Wv(s),b=t+n*Hv(s);this._add("A",a,n,y,+p,+f,S,b)}},r.prototype.rect=function(e,t,a,n){this._add("M",e,t),this._add("l",a,0),this._add("l",0,n),this._add("l",-a,0),this._add("Z")},r.prototype.closePath=function(){this._d.length>0&&this._add("Z")},r.prototype._add=function(e,t,a,n,i,o,s,l,u){for(var f=[],h=this._p,v=1;v"}function SB(r){return""}function $g(r,e){e=e||{};var t=e.newline?` +`:"";function a(n){var i=n.children,o=n.tag,s=n.attrs,l=n.text;return _B(o,s)+(o!=="style"?we(l):l||"")+(i?""+t+G(i,function(u){return a(u)}).join(t)+t:"")+SB(o)}return a(r)}function xB(r,e,t){t=t||{};var a=t.newline?` +`:"",n=" {"+a,i=a+"}",o=G(_t(r),function(l){return l+n+G(_t(r[l]),function(u){return u+":"+r[l][u]+";"}).join(a)+i}).join(a),s=G(_t(e),function(l){return"@keyframes "+l+n+G(_t(e[l]),function(u){return u+n+G(_t(e[l][u]),function(f){var h=e[l][u][f];return f==="d"&&(h='path("'+h+'")'),f+":"+h+";"}).join(a)+i}).join(a)+i}).join(a);return!o&&!s?"":[""].join(a)}function ed(r){return{zrId:r,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function B_(r,e,t,a){return re("svg","root",{width:r,height:e,xmlns:FC,"xmlns:xlink":HC,version:"1.1",baseProfile:"full",viewBox:a?"0 0 "+r+" "+e:!1},t)}var bB=0;function UC(){return bB++}var V_={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},Cn="transform-origin";function wB(r,e,t){var a=V({},r.shape);V(a,e),r.buildPath(t,a);var n=new GC;return n.reset(Aw(r)),t.rebuildPath(n,1),n.generateStr(),n.getStr()}function TB(r,e){var t=e.originX,a=e.originY;(t||a)&&(r[Cn]=t+"px "+a+"px")}var AB={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function YC(r,e){var t=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[t]=r,t}function CB(r,e,t){var a=r.shape.paths,n={},i,o;if(D(a,function(l){var u=ed(t.zrId);u.animation=!0,bh(l,{},u,!0);var f=u.cssAnims,h=u.cssNodes,v=_t(f),c=v.length;if(c){o=v[c-1];var p=f[o];for(var d in p){var g=p[d];n[d]=n[d]||{d:""},n[d].d+=g.d||""}for(var y in h){var m=h[y].animation;m.indexOf(o)>=0&&(i=m)}}}),!!i){e.d=!1;var s=YC(n,t);return i.replace(o,s)}}function z_(r){return Y(r)?V_[r]?"cubic-bezier("+V_[r]+")":jd(r)?r:"":""}function bh(r,e,t,a){var n=r.animators,i=n.length,o=[];if(r instanceof pg){var s=CB(r,e,t);if(s)o.push(s);else if(!i)return}else if(!i)return;for(var l={},u=0;u0}).length){var Wt=YC(w,t);return Wt+" "+m[0]+" both"}}for(var g in l){var s=d(l[g]);s&&o.push(s)}if(o.length){var y=t.zrId+"-cls-"+UC();t.cssNodes["."+y]={animation:o.join(",")},e.class=y}}function DB(r,e,t){if(!r.ignore)if(r.isSilent()){var a={"pointer-events":"none"};G_(a,e,t)}else{var n=r.states.emphasis&&r.states.emphasis.style?r.states.emphasis.style:{},i=n.fill;if(!i){var o=r.style&&r.style.fill,s=r.states.select&&r.states.select.style&&r.states.select.style.fill,l=r.currentStates.indexOf("select")>=0&&s||o;l&&(i=cp(l))}var u=n.lineWidth;if(u){var f=!n.strokeNoScale&&r.transform?r.transform[0]:1;u=u/f}var a={cursor:"pointer"};i&&(a.fill=i),n.stroke&&(a.stroke=n.stroke),u&&(a["stroke-width"]=u),G_(a,e,t)}}function G_(r,e,t,a){var n=JSON.stringify(r),i=t.cssStyleCache[n];i||(i=t.zrId+"-cls-"+UC(),t.cssStyleCache[n]=i,t.cssNodes["."+i+":hover"]=r),e.class=e.class?e.class+" "+i:i}var Ys=Math.round;function XC(r){return r&&Y(r.src)}function ZC(r){return r&&J(r.toDataURL)}function qg(r,e,t,a){gB(function(n,i){var o=n==="fill"||n==="stroke";o&&Tw(i)?qC(e,r,n,a):o&&tg(i)?KC(t,r,n,a):r[n]=i,o&&a.ssr&&i==="none"&&(r["pointer-events"]="visible")},e,t,!1),kB(t,r,a)}function Kg(r,e){var t=w2(e);t&&(t.each(function(a,n){a!=null&&(r[(N_+n).toLowerCase()]=a+"")}),e.isSilent()&&(r[N_+"silent"]="true"))}function F_(r){return Na(r[0]-1)&&Na(r[1])&&Na(r[2])&&Na(r[3]-1)}function MB(r){return Na(r[4])&&Na(r[5])}function Jg(r,e,t){if(e&&!(MB(e)&&F_(e))){var a=1e4;r.transform=F_(e)?"translate("+Ys(e[4]*a)/a+" "+Ys(e[5]*a)/a+")":YL(e)}}function H_(r,e,t){for(var a=r.points,n=[],i=0;i"u"){var g="Image width/height must been given explictly in svg-ssr renderer.";Ce(v,g),Ce(c,g)}else if(v==null||c==null){var y=function(C,M){if(C){var I=C.elm,L=v||M.width,P=c||M.height;C.tag==="pattern"&&(u?(P=1,L/=i.width):f&&(L=1,P/=i.height)),C.attrs.width=L,C.attrs.height=P,I&&(I.setAttribute("width",L),I.setAttribute("height",P))}},m=og(p,null,r,function(C){l||y(x,C),y(h,C)});m&&m.width&&m.height&&(v=v||m.width,c=c||m.height)}h=re("image","img",{href:p,width:v,height:c}),o.width=v,o.height=c}else n.svgElement&&(h=rt(n.svgElement),o.width=n.svgWidth,o.height=n.svgHeight);if(h){var _,S;l?_=S=1:u?(S=1,_=o.width/i.width):f?(_=1,S=o.height/i.height):o.patternUnits="userSpaceOnUse",_!=null&&!isNaN(_)&&(o.width=_),S!=null&&!isNaN(S)&&(o.height=S);var b=Cw(n);b&&(o.patternTransform=b);var x=re("pattern","",o,[h]),w=$g(x),T=a.patternCache,A=T[w];A||(A=a.zrId+"-p"+a.patternIdx++,T[w]=A,o.id=A,x=a.defs[A]=re("pattern",A,o,[h])),e[t]=Zf(A)}}function OB(r,e,t){var a=t.clipPathCache,n=t.defs,i=a[r.id];if(!i){i=t.zrId+"-c"+t.clipPathIdx++;var o={id:i};a[r.id]=i,n[i]=re("clipPath",i,o,[$C(r,t)])}e["clip-path"]=Zf(i)}function Y_(r){return document.createTextNode(r)}function En(r,e,t){r.insertBefore(e,t)}function X_(r,e){r.removeChild(e)}function Z_(r,e){r.appendChild(e)}function JC(r){return r.parentNode}function QC(r){return r.nextSibling}function Uv(r,e){r.textContent=e}var $_=58,NB=120,BB=re("","");function rd(r){return r===void 0}function Lr(r){return r!==void 0}function VB(r,e,t){for(var a={},n=e;n<=t;++n){var i=r[n].key;i!==void 0&&(a[i]=n)}return a}function ss(r,e){var t=r.key===e.key,a=r.tag===e.tag;return a&&t}function Xs(r){var e,t=r.children,a=r.tag;if(Lr(a)){var n=r.elm=WC(a);if(Qg(BB,r),z(t))for(e=0;ei?(p=t[l+1]==null?null:t[l+1].elm,jC(r,p,t,n,l)):wf(r,e,a,i))}function Vi(r,e){var t=e.elm=r.elm,a=r.children,n=e.children;r!==e&&(Qg(r,e),rd(e.text)?Lr(a)&&Lr(n)?a!==n&&zB(t,a,n):Lr(n)?(Lr(r.text)&&Uv(t,""),jC(t,null,n,0,n.length-1)):Lr(a)?wf(t,a,0,a.length-1):Lr(r.text)&&Uv(t,""):r.text!==e.text&&(Lr(a)&&wf(t,a,0,a.length-1),Uv(t,e.text)))}function GB(r,e){if(ss(r,e))Vi(r,e);else{var t=r.elm,a=JC(t);Xs(e),a!==null&&(En(a,e.elm,QC(t)),wf(a,[r],0,0))}return e}var FB=0,HB=function(){function r(e,t,a){if(this.type="svg",this.refreshHover=q_(),this.configLayer=q_(),this.storage=t,this._opts=a=V({},a),this.root=e,this._id="zr"+FB++,this._oldVNode=B_(a.width,a.height),e&&!a.ssr){var n=this._viewport=document.createElement("div");n.style.cssText="position:relative;overflow:hidden";var i=this._svgDom=this._oldVNode.elm=WC("svg");Qg(null,this._oldVNode),n.appendChild(i),e.appendChild(n)}this.resize(a.width,a.height)}return r.prototype.getType=function(){return this.type},r.prototype.getViewportRoot=function(){return this._viewport},r.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},r.prototype.getSvgDom=function(){return this._svgDom},r.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style="position:absolute;left:0;top:0;user-select:none",GB(this._oldVNode,e),this._oldVNode=e}},r.prototype.renderOneToVNode=function(e){return U_(e,ed(this._id))},r.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),a=this._width,n=this._height,i=ed(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var o=[],s=this._bgVNode=WB(a,n,this._backgroundColor,i);s&&o.push(s);var l=e.compress?null:this._mainVNode=re("g","main",{},[]);this._paintList(t,i,l?l.children:o),l&&o.push(l);var u=G(_t(i.defs),function(v){return i.defs[v]});if(u.length&&o.push(re("defs","defs",{},u)),e.animation){var f=xB(i.cssNodes,i.cssAnims,{newline:!0});if(f){var h=re("style","stl",{},[],f);o.push(h)}}return B_(a,n,o,e.useViewBox)},r.prototype.renderToString=function(e){return e=e||{},$g(this.renderToVNode({animation:st(e.cssAnimation,!0),emphasis:st(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:st(e.useViewBox,!0)}),{newline:!0})},r.prototype.setBackgroundColor=function(e){this._backgroundColor=e},r.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},r.prototype._paintList=function(e,t,a){for(var n=e.length,i=[],o=0,s,l,u=0,f=0;f=0&&!(v&&l&&v[d]===l[d]);d--);for(var g=p-1;g>d;g--)o--,s=i[o-1];for(var y=d+1;y=s)}}for(var h=this.__startIndex;h15)break}}P.prevElClipPaths&&y.restore()};if(m)if(m.length===0)T=g.__endIndex;else for(var C=c.dpr,M=0;M0&&e>n[0]){for(l=0;le);l++);s=a[n[l]]}if(n.splice(l+1,0,e),a[e]=t,!t.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(t.dom,u.nextSibling):o.appendChild(t.dom)}else o.firstChild?o.insertBefore(t.dom,o.firstChild):o.appendChild(t.dom);t.painter||(t.painter=this)}},r.prototype.eachLayer=function(e,t){for(var a=this._zlevelList,n=0;n0?iu:0),this._needsManuallyCompositing),f.__builtin__||Xd("ZLevel "+u+" has been used by unkown layer "+f.id),f!==i&&(f.__used=!0,f.__startIndex!==l&&(f.__dirty=!0),f.__startIndex=l,f.incremental?f.__drawIndex=-1:f.__drawIndex=l,t(l),i=f),n.__dirty&Vr&&!n.__inHover&&(f.__dirty=!0,f.incremental&&f.__drawIndex<0&&(f.__drawIndex=l))}t(l),this.eachBuiltinLayer(function(h,v){!h.__used&&h.getElementCount()>0&&(h.__dirty=!0,h.__startIndex=h.__endIndex=h.__drawIndex=0),h.__dirty&&h.__drawIndex<0&&(h.__drawIndex=h.__startIndex)})},r.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},r.prototype._clearLayer=function(e){e.clear()},r.prototype.setBackgroundColor=function(e){this._backgroundColor=e,D(this._layers,function(t){t.setUnpainted()})},r.prototype.configLayer=function(e,t){if(t){var a=this._layerConfig;a[e]?ut(a[e],t,!0):a[e]=t;for(var n=0;n-1&&(u.style.stroke=u.style.fill,u.style.fill="#fff",u.style.lineWidth=2),a},e.type="series.line",e.dependencies=["grid","polar"],e.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},e}(Vt);function ao(r,e){var t=r.mapDimensionsAll("defaultedLabel"),a=t.length;if(a===1){var n=to(r,e,t[0]);return n!=null?n+"":null}else if(a){for(var i=[],o=0;o=0&&a.push(e[i])}return a.join(" ")}var gl=function(r){k(e,r);function e(t,a,n,i){var o=r.call(this)||this;return o.updateData(t,a,n,i),o}return e.prototype._createSymbol=function(t,a,n,i,o){this.removeAll();var s=qt(t,-1,-1,2,2,null,o);s.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),s.drift=JB,this._symbolType=t,this.add(s)},e.prototype.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(null,t)},e.prototype.getSymbolType=function(){return this._symbolType},e.prototype.getSymbolPath=function(){return this.childAt(0)},e.prototype.highlight=function(){la(this.childAt(0))},e.prototype.downplay=function(){ua(this.childAt(0))},e.prototype.setZ=function(t,a){var n=this.childAt(0);n.zlevel=t,n.z=a},e.prototype.setDraggable=function(t,a){var n=this.childAt(0);n.draggable=t,n.cursor=!a&&t?"move":n.cursor},e.prototype.updateData=function(t,a,n,i){this.silent=!1;var o=t.getItemVisual(a,"symbol")||"circle",s=t.hostModel,l=e.getSymbolSize(t,a),u=o!==this._symbolType,f=i&&i.disableAnimation;if(u){var h=t.getItemVisual(a,"symbolKeepAspect");this._createSymbol(o,t,a,l,h)}else{var v=this.childAt(0);v.silent=!1;var c={scaleX:l[0]/2,scaleY:l[1]/2};f?v.attr(c):Tt(v,c,s,a),Sr(v)}if(this._updateCommon(t,a,l,n,i),u){var v=this.childAt(0);if(!f){var c={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:v.style.opacity}};v.scaleX=v.scaleY=0,v.style.opacity=0,zt(v,c,s,a)}}f&&this.childAt(0).stopAnimation("leave")},e.prototype._updateCommon=function(t,a,n,i,o){var s=this.childAt(0),l=t.hostModel,u,f,h,v,c,p,d,g,y;if(i&&(u=i.emphasisItemStyle,f=i.blurItemStyle,h=i.selectItemStyle,v=i.focus,c=i.blurScope,d=i.labelStatesModels,g=i.hoverScale,y=i.cursorStyle,p=i.emphasisDisabled),!i||t.hasItemOption){var m=i&&i.itemModel?i.itemModel:t.getItemModel(a),_=m.getModel("emphasis");u=_.getModel("itemStyle").getItemStyle(),h=m.getModel(["select","itemStyle"]).getItemStyle(),f=m.getModel(["blur","itemStyle"]).getItemStyle(),v=_.get("focus"),c=_.get("blurScope"),p=_.get("disabled"),d=ne(m),g=_.getShallow("scale"),y=m.getShallow("cursor")}var S=t.getItemVisual(a,"symbolRotate");s.attr("rotation",(S||0)*Math.PI/180||0);var b=fi(t.getItemVisual(a,"symbolOffset"),n);b&&(s.x=b[0],s.y=b[1]),y&&s.attr("cursor",y);var x=t.getItemVisual(a,"style"),w=x.fill;if(s instanceof le){var T=s.style;s.useStyle(V({image:T.image,x:T.x,y:T.y,width:T.width,height:T.height},x))}else s.__isEmptyBrush?s.useStyle(V({},x)):s.useStyle(x),s.style.decal=null,s.setColor(w,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var A=t.getItemVisual(a,"liftZ"),C=this._z2;A!=null?C==null&&(this._z2=s.z2,s.z2+=A):C!=null&&(s.z2=C,this._z2=null);var M=o&&o.useNameLabel;ve(s,d,{labelFetcher:l,labelDataIndex:a,defaultText:I,inheritColor:w,defaultOpacity:x.opacity});function I(R){return M?t.getName(R):ao(t,R)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var L=s.ensureState("emphasis");L.style=u,s.ensureState("select").style=h,s.ensureState("blur").style=f;var P=g==null||g===!0?Math.max(1.1,3/this._sizeY):isFinite(g)&&g>0?+g:1;L.scaleX=this._sizeX*P,L.scaleY=this._sizeY*P,this.setSymbolScale(1),Ht(this,v,c,p)},e.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},e.prototype.fadeOut=function(t,a,n){var i=this.childAt(0),o=nt(this).dataIndex,s=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var l=i.getTextContent();l&&Za(l,{style:{opacity:0}},a,{dataIndex:o,removeOpt:s,cb:function(){i.removeTextContent()}})}else i.removeTextContent();Za(i,{style:{opacity:0},scaleX:0,scaleY:0},a,{dataIndex:o,cb:t,removeOpt:s})},e.getSymbolSize=function(t,a){return bo(t.getItemVisual(a,"symbolSize"))},e}(at);function JB(r,e){this.parent.drift(r,e)}function Xv(r,e,t,a){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(a.isIgnore&&a.isIgnore(t))&&!(a.clipShape&&!a.clipShape.contain(e[0],e[1]))&&r.getItemVisual(t,"symbol")!=="none"}function Q_(r){return r!=null&&!et(r)&&(r={isIgnore:r}),r||{}}function j_(r){var e=r.hostModel,t=e.getModel("emphasis");return{emphasisItemStyle:t.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:t.get("focus"),blurScope:t.get("blurScope"),emphasisDisabled:t.get("disabled"),hoverScale:t.get("scale"),labelStatesModels:ne(e),cursorStyle:e.get("cursor")}}var yl=function(){function r(e){this.group=new at,this._SymbolCtor=e||gl}return r.prototype.updateData=function(e,t){this._progressiveEls=null,t=Q_(t);var a=this.group,n=e.hostModel,i=this._data,o=this._SymbolCtor,s=t.disableAnimation,l=j_(e),u={disableAnimation:s},f=t.getSymbolPoint||function(h){return e.getItemLayout(h)};i||a.removeAll(),e.diff(i).add(function(h){var v=f(h);if(Xv(e,v,h,t)){var c=new o(e,h,l,u);c.setPosition(v),e.setItemGraphicEl(h,c),a.add(c)}}).update(function(h,v){var c=i.getItemGraphicEl(v),p=f(h);if(!Xv(e,p,h,t)){a.remove(c);return}var d=e.getItemVisual(h,"symbol")||"circle",g=c&&c.getSymbolType&&c.getSymbolType();if(!c||g&&g!==d)a.remove(c),c=new o(e,h,l,u),c.setPosition(p);else{c.updateData(e,h,l,u);var y={x:p[0],y:p[1]};s?c.attr(y):Tt(c,y,n)}a.add(c),e.setItemGraphicEl(h,c)}).remove(function(h){var v=i.getItemGraphicEl(h);v&&v.fadeOut(function(){a.remove(v)},n)}).execute(),this._getSymbolPoint=f,this._data=e},r.prototype.updateLayout=function(){var e=this,t=this._data;t&&t.eachItemGraphicEl(function(a,n){var i=e._getSymbolPoint(n);a.setPosition(i),a.markRedraw()})},r.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=j_(e),this._data=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t,a){this._progressiveEls=[],a=Q_(a);function n(l){l.isGroup||(l.incremental=!0,l.ensureState("emphasis").hoverLayer=!0)}for(var i=e.start;i0?t=a[0]:a[1]<0&&(t=a[1]),t}function rD(r,e,t,a){var n=NaN;r.stacked&&(n=t.get(t.getCalculationInfo("stackedOverDimension"),a)),isNaN(n)&&(n=r.valueStart);var i=r.baseDataOffset,o=[];return o[i]=t.get(r.baseDim,a),o[1-i]=n,e.dataToPoint(o)}function jB(r,e){var t=[];return e.diff(r).add(function(a){t.push({cmd:"+",idx:a})}).update(function(a,n){t.push({cmd:"=",idx:n,idx1:a})}).remove(function(a){t.push({cmd:"-",idx:a})}).execute(),t}function tV(r,e,t,a,n,i,o,s){for(var l=jB(r,e),u=[],f=[],h=[],v=[],c=[],p=[],d=[],g=eD(n,e,o),y=r.getLayout("points")||[],m=e.getLayout("points")||[],_=0;_=n||d<0)break;if(Jn(y,m)){if(l){d+=i;continue}break}if(d===t)r[i>0?"moveTo":"lineTo"](y,m),h=y,v=m;else{var _=y-u,S=m-f;if(_*_+S*S<.5){d+=i;continue}if(o>0){for(var b=d+i,x=e[b*2],w=e[b*2+1];x===y&&w===m&&g=a||Jn(x,w))c=y,p=m;else{C=x-u,M=w-f;var P=y-u,R=x-y,E=m-f,N=w-m,O=void 0,B=void 0;if(s==="x"){O=Math.abs(P),B=Math.abs(R);var F=C>0?1:-1;c=y-F*O*o,p=m,I=y+F*B*o,L=m}else if(s==="y"){O=Math.abs(E),B=Math.abs(N);var H=M>0?1:-1;c=y,p=m-H*O*o,I=y,L=m+H*B*o}else O=Math.sqrt(P*P+E*E),B=Math.sqrt(R*R+N*N),A=B/(B+O),c=y-C*o*(1-A),p=m-M*o*(1-A),I=y+C*o*A,L=m+M*o*A,I=Ta(I,Aa(x,y)),L=Ta(L,Aa(w,m)),I=Aa(I,Ta(x,y)),L=Aa(L,Ta(w,m)),C=I-y,M=L-m,c=y-C*O/B,p=m-M*O/B,c=Ta(c,Aa(u,y)),p=Ta(p,Aa(f,m)),c=Aa(c,Ta(u,y)),p=Aa(p,Ta(f,m)),C=y-c,M=m-p,I=y+C*B/O,L=m+M*B/O}r.bezierCurveTo(h,v,c,p,y,m),h=I,v=L}else r.lineTo(y,m)}u=y,f=m,d+=i}return g}var aD=function(){function r(){this.smooth=0,this.smoothConstraint=!0}return r}(),eV=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a.type="ec-polyline",a}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new aD},e.prototype.buildPath=function(t,a){var n=a.points,i=0,o=n.length/2;if(a.connectNulls){for(;o>0&&Jn(n[o*2-2],n[o*2-1]);o--);for(;i=0){var S=u?(p-l)*_+l:(c-s)*_+s;return u?[t,S]:[S,t]}s=c,l=p;break;case o.C:c=i[h++],p=i[h++],d=i[h++],g=i[h++],y=i[h++],m=i[h++];var b=u?Ju(s,c,d,y,t,f):Ju(l,p,g,m,t,f);if(b>0)for(var x=0;x=0){var S=u?te(l,p,g,m,w):te(s,c,d,y,w);return u?[t,S]:[S,t]}}s=y,l=m;break}}},e}(gt),rV=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(aD),nD=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a.type="ec-polygon",a}return e.prototype.getDefaultShape=function(){return new rV},e.prototype.buildPath=function(t,a){var n=a.points,i=a.stackedOnPoints,o=0,s=n.length/2,l=a.smoothMonotone;if(a.connectNulls){for(;s>0&&Jn(n[s*2-2],n[s*2-1]);s--);for(;oe){i?t.push(o(i,l,e)):n&&t.push(o(n,l,0),o(n,l,e));break}else n&&(t.push(o(n,l,0)),n=null),t.push(l),i=l}return t}function iV(r,e,t){var a=r.getVisual("visualMeta");if(!(!a||!a.length||!r.count())&&e.type==="cartesian2d"){for(var n,i,o=a.length-1;o>=0;o--){var s=r.getDimensionInfo(a[o].dimension);if(n=s&&s.coordDim,n==="x"||n==="y"){i=a[o];break}}if(i){var l=e.getAxis(n),u=G(i.stops,function(_){return{coord:l.toGlobalCoord(l.dataToCoord(_.value)),color:_.color}}),f=u.length,h=i.outerColors.slice();f&&u[0].coord>u[f-1].coord&&(u.reverse(),h.reverse());var v=nV(u,n==="x"?t.getWidth():t.getHeight()),c=v.length;if(!c&&f)return u[0].coord<0?h[1]?h[1]:u[f-1].color:h[0]?h[0]:u[0].color;var p=10,d=v[0].coord-p,g=v[c-1].coord+p,y=g-d;if(y<.001)return"transparent";D(v,function(_){_.offset=(_.coord-d)/y}),v.push({offset:c?v[c-1].offset:.5,color:h[1]||"transparent"}),v.unshift({offset:c?v[0].offset:.5,color:h[0]||"transparent"});var m=new ul(0,0,0,0,v,!0);return m[n]=d,m[n+"2"]=g,m}}}function oV(r,e,t){var a=r.get("showAllSymbol"),n=a==="auto";if(!(a&&!n)){var i=t.getAxesByScale("ordinal")[0];if(i&&!(n&&sV(i,e))){var o=e.mapDimension(i.dim),s={};return D(i.getViewLabels(),function(l){var u=i.scale.getRawOrdinalNumber(l.tickValue);s[u]=1}),function(l){return!s.hasOwnProperty(e.get(o,l))}}}}function sV(r,e){var t=r.getExtent(),a=Math.abs(t[1]-t[0])/r.scale.count();isNaN(a)&&(a=0);for(var n=e.count(),i=Math.max(1,Math.round(n/5)),o=0;oa)return!1;return!0}function lV(r,e){return isNaN(r)||isNaN(e)}function uV(r){for(var e=r.length/2;e>0&&lV(r[e*2-2],r[e*2-1]);e--);return e-1}function n1(r,e){return[r[e*2],r[e*2+1]]}function fV(r,e,t){for(var a=r.length/2,n=t==="x"?0:1,i,o,s=0,l=-1,u=0;u=e||i>=e&&o<=e){l=u;break}s=u,i=o}return{range:[s,l],t:(e-i)/(o-i)}}function sD(r){if(r.get(["endLabel","show"]))return!0;for(var e=0;e0&&t.get(["emphasis","lineStyle","width"])==="bolder"){var B=p.getState("emphasis").style;B.lineWidth=+p.style.lineWidth+1}nt(p).seriesIndex=t.seriesIndex,Ht(p,E,N,O);var F=a1(t.get("smooth")),H=t.get("smoothMonotone");if(p.setShape({smooth:F,smoothMonotone:H,connectNulls:w}),d){var U=s.getCalculationInfo("stackedOnSeries"),K=0;d.useStyle(j(u.getAreaStyle(),{fill:I,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),U&&(K=a1(U.get("smooth"))),d.setShape({smooth:F,stackedOnSmooth:K,smoothMonotone:H,connectNulls:w}),he(d,t,"areaStyle"),nt(d).seriesIndex=t.seriesIndex,Ht(d,E,N,O)}var Q=this._changePolyState;s.eachItemGraphicEl(function(it){it&&(it.onHoverStateChange=Q)}),this._polyline.onHoverStateChange=Q,this._data=s,this._coordSys=i,this._stackedOnPoints=b,this._points=f,this._step=C,this._valueOrigin=_,t.get("triggerLineEvent")&&(this.packEventData(t,p),d&&this.packEventData(t,d))},e.prototype.packEventData=function(t,a){nt(a).eventData={componentType:"series",componentSubType:"line",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"line"}},e.prototype.highlight=function(t,a,n,i){var o=t.getData(),s=ti(o,i);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),u=o.getItemGraphicEl(s);if(!u){var f=l[s*2],h=l[s*2+1];if(isNaN(f)||isNaN(h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(f,h))return;var v=t.get("zlevel")||0,c=t.get("z")||0;u=new gl(o,s),u.x=f,u.y=h,u.setZ(v,c);var p=u.getSymbolPath().getTextContent();p&&(p.zlevel=v,p.z=c,p.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else Rt.prototype.highlight.call(this,t,a,n,i)},e.prototype.downplay=function(t,a,n,i){var o=t.getData(),s=ti(o,i);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else Rt.prototype.downplay.call(this,t,a,n,i)},e.prototype._changePolyState=function(t){var a=this._polygon;nf(this._polyline,t),a&&nf(a,t)},e.prototype._newPolyline=function(t){var a=this._polyline;return a&&this._lineGroup.remove(a),a=new eV({shape:{points:t},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(a),this._polyline=a,a},e.prototype._newPolygon=function(t,a){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new nD({shape:{points:t,stackedOnPoints:a},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},e.prototype._initSymbolLabelAnimation=function(t,a,n){var i,o,s=a.getBaseAxis(),l=s.inverse;a.type==="cartesian2d"?(i=s.isHorizontal(),o=!1):a.type==="polar"&&(i=s.dim==="angle",o=!0);var u=t.hostModel,f=u.get("animationDuration");J(f)&&(f=f(null));var h=u.get("animationDelay")||0,v=J(h)?h(null):h;t.eachItemGraphicEl(function(c,p){var d=c;if(d){var g=[c.x,c.y],y=void 0,m=void 0,_=void 0;if(n)if(o){var S=n,b=a.pointToCoord(g);i?(y=S.startAngle,m=S.endAngle,_=-b[1]/180*Math.PI):(y=S.r0,m=S.r,_=b[0])}else{var x=n;i?(y=x.x,m=x.x+x.width,_=c.x):(y=x.y+x.height,m=x.y,_=c.y)}var w=m===y?0:(_-y)/(m-y);l&&(w=1-w);var T=J(h)?h(p):f*w+v,A=d.getSymbolPath(),C=A.getTextContent();d.attr({scaleX:0,scaleY:0}),d.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:T}),C&&C.animateFrom({style:{opacity:0}},{duration:300,delay:T}),A.disableLabelAnimation=!0}})},e.prototype._initOrUpdateEndLabel=function(t,a,n){var i=t.getModel("endLabel");if(sD(t)){var o=t.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var u=this._endLabel;u||(u=this._endLabel=new bt({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var f=uV(l);f>=0&&(ve(s,ne(t,"endLabel"),{inheritColor:n,labelFetcher:t,labelDataIndex:f,defaultText:function(h,v,c){return c!=null?tD(o,c):ao(o,h)},enableTextSetter:!0},hV(i,a)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},e.prototype._endLabelOnDuring=function(t,a,n,i,o,s,l){var u=this._endLabel,f=this._polyline;if(u){t<1&&i.originalX==null&&(i.originalX=u.x,i.originalY=u.y);var h=n.getLayout("points"),v=n.hostModel,c=v.get("connectNulls"),p=s.get("precision"),d=s.get("distance")||0,g=l.getBaseAxis(),y=g.isHorizontal(),m=g.inverse,_=a.shape,S=m?y?_.x:_.y+_.height:y?_.x+_.width:_.y,b=(y?d:0)*(m?-1:1),x=(y?0:-d)*(m?-1:1),w=y?"x":"y",T=fV(h,S,w),A=T.range,C=A[1]-A[0],M=void 0;if(C>=1){if(C>1&&!c){var I=n1(h,A[0]);u.attr({x:I[0]+b,y:I[1]+x}),o&&(M=v.getRawValue(A[0]))}else{var I=f.getPointOn(S,w);I&&u.attr({x:I[0]+b,y:I[1]+x});var L=v.getRawValue(A[0]),P=v.getRawValue(A[1]);o&&(M=Yw(n,p,L,P,T.t))}i.lastFrameIndex=A[0]}else{var R=t===1||i.lastFrameIndex>0?A[0]:0,I=n1(h,R);o&&(M=v.getRawValue(R)),u.attr({x:I[0]+b,y:I[1]+x})}if(o){var E=po(u);typeof E.setLabelText=="function"&&E.setLabelText(M)}}},e.prototype._doUpdateAnimation=function(t,a,n,i,o,s,l){var u=this._polyline,f=this._polygon,h=t.hostModel,v=tV(this._data,t,this._stackedOnPoints,a,this._coordSys,n,this._valueOrigin),c=v.current,p=v.stackedOnCurrent,d=v.next,g=v.stackedOnNext;if(o&&(p=Ca(v.stackedOnCurrent,v.current,n,o,l),c=Ca(v.current,null,n,o,l),g=Ca(v.stackedOnNext,v.next,n,o,l),d=Ca(v.next,null,n,o,l)),r1(c,d)>3e3||f&&r1(p,g)>3e3){u.stopAnimation(),u.setShape({points:d}),f&&(f.stopAnimation(),f.setShape({points:d,stackedOnPoints:g}));return}u.shape.__points=v.current,u.shape.points=c;var y={shape:{points:d}};v.current!==c&&(y.shape.__points=v.next),u.stopAnimation(),Tt(u,y,h),f&&(f.setShape({points:c,stackedOnPoints:p}),f.stopAnimation(),Tt(f,{shape:{stackedOnPoints:g}},h),u.shape.points!==f.shape.points&&(f.shape.points=u.shape.points));for(var m=[],_=v.status,S=0;S<_.length;S++){var b=_[S].cmd;if(b==="="){var x=t.getItemGraphicEl(_[S].idx1);x&&m.push({el:x,ptIdx:S})}}u.animators&&u.animators.length&&u.animators[0].during(function(){f&&f.dirtyShape();for(var w=u.shape.__points,T=0;Te&&(e=r[t]);return isFinite(e)?e:NaN},min:function(r){for(var e=1/0,t=0;t10&&o.type==="cartesian2d"&&i){var l=o.getBaseAxis(),u=o.getOtherAxis(l),f=l.getExtent(),h=a.getDevicePixelRatio(),v=Math.abs(f[1]-f[0])*(h||1),c=Math.round(s/v);if(isFinite(c)&&c>1){i==="lttb"?e.setData(n.lttbDownSample(n.mapDimension(u.dim),1/c)):i==="minmax"&&e.setData(n.minmaxDownSample(n.mapDimension(u.dim),1/c));var p=void 0;Y(i)?p=cV[i]:J(i)&&(p=i),p&&e.setData(n.downSample(n.mapDimension(u.dim),1/c,p,pV))}}}}}function dV(r){r.registerChartView(vV),r.registerSeriesModel(KB),r.registerLayout(_l("line",!0)),r.registerVisual({seriesType:"line",reset:function(e){var t=e.getData(),a=e.getModel("lineStyle").getLineStyle();a&&!a.stroke&&(a.stroke=t.getVisual("style").fill),t.setVisual("legendLineStyle",a)}}),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,lD("line"))}var Zs=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,a){return ga(null,this,{useEncodeDefaulter:!0})},e.prototype.getMarkerPosition=function(t,a,n){var i=this.coordinateSystem;if(i&&i.clampData){var o=i.clampData(t),s=i.dataToPoint(o);if(n)D(i.getAxes(),function(v,c){if(v.type==="category"&&a!=null){var p=v.getTicksCoords(),d=v.getTickModel().get("alignWithLabel"),g=o[c],y=a[c]==="x1"||a[c]==="y1";if(y&&!d&&(g+=1),p.length<2)return;if(p.length===2){s[c]=v.toGlobalCoord(v.getExtent()[y?1:0]);return}for(var m=void 0,_=void 0,S=1,b=0;bg){_=(x+m)/2;break}b===1&&(S=w-p[0].tickValue)}_==null&&(m?m&&(_=p[p.length-1].coord):_=p[0].coord),s[c]=v.toGlobalCoord(_)}});else{var l=this.getData(),u=l.getLayout("offset"),f=l.getLayout("size"),h=i.getBaseAxis().isHorizontal()?0:1;s[h]+=u+f/2}return s}return[NaN,NaN]},e.type="series.__base_bar__",e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod"},e}(Vt);Vt.registerClass(Zs);var gV=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(){return ga(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},e.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},e.prototype.getProgressiveThreshold=function(){var t=this.get("progressiveThreshold"),a=this.get("largeThreshold");return a>t&&(t=a),t},e.prototype.brushSelector=function(t,a,n){return n.rect(a.getItemLayout(t))},e.type="series.bar",e.dependencies=["grid","polar"],e.defaultOption=ja(Zs.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:"#212121"}},realtimeSort:!1}),e}(Zs),yV=function(){function r(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return r}(),Tf=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a.type="sausage",a}return e.prototype.getDefaultShape=function(){return new yV},e.prototype.buildPath=function(t,a){var n=a.cx,i=a.cy,o=Math.max(a.r0||0,0),s=Math.max(a.r,0),l=(s-o)*.5,u=o+l,f=a.startAngle,h=a.endAngle,v=a.clockwise,c=Math.PI*2,p=v?h-fMath.PI/2&&fs)return!0;s=h}return!1},e.prototype._isOrderDifferentInView=function(t,a){for(var n=a.scale,i=n.getExtent(),o=Math.max(0,i[0]),s=Math.min(i[1],n.getOrdinalMeta().categories.length-1);o<=s;++o)if(t.ordinalNumbers[o]!==n.getRawOrdinalNumber(o))return!0},e.prototype._updateSortWithinSameData=function(t,a,n,i){if(this._isOrderChangedWithinSameData(t,a,n)){var o=this._dataSort(t,n,a);this._isOrderDifferentInView(o,n)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:n.dim+"Axis",axisId:n.index,sortInfo:o}))}},e.prototype._dispatchInitSort=function(t,a,n){var i=a.baseAxis,o=this._dataSort(t,i,function(s){return t.get(t.mapDimension(a.otherAxis.dim),s)});n.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:o})},e.prototype.remove=function(t,a){this._clear(this._model),this._removeOnRenderedListener(a)},e.prototype.dispose=function(t,a){this._removeOnRenderedListener(a)},e.prototype._removeOnRenderedListener=function(t){this._onRendered&&(t.getZr().off("rendered",this._onRendered),this._onRendered=null)},e.prototype._clear=function(t){var a=this.group,n=this._data;t&&t.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(i){Bs(i,t,nt(i).dataIndex)})):a.removeAll(),this._data=null,this._isFirstFrame=!0},e.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},e.type="bar",e}(Rt),i1={cartesian2d:function(r,e){var t=e.width<0?-1:1,a=e.height<0?-1:1;t<0&&(e.x+=e.width,e.width=-e.width),a<0&&(e.y+=e.height,e.height=-e.height);var n=r.x+r.width,i=r.y+r.height,o=$v(e.x,r.x),s=qv(e.x+e.width,n),l=$v(e.y,r.y),u=qv(e.y+e.height,i),f=sn?s:o,e.y=h&&l>i?u:l,e.width=f?0:s-o,e.height=h?0:u-l,t<0&&(e.x+=e.width,e.width=-e.width),a<0&&(e.y+=e.height,e.height=-e.height),f||h},polar:function(r,e){var t=e.r0<=e.r?1:-1;if(t<0){var a=e.r;e.r=e.r0,e.r0=a}var n=qv(e.r,r.r),i=$v(e.r0,r.r0);e.r=n,e.r0=i;var o=n-i<0;if(t<0){var a=e.r;e.r=e.r0,e.r0=a}return o}},o1={cartesian2d:function(r,e,t,a,n,i,o,s,l){var u=new St({shape:V({},a),z2:1});if(u.__dataIndex=t,u.name="item",i){var f=u.shape,h=n?"height":"width";f[h]=0}return u},polar:function(r,e,t,a,n,i,o,s,l){var u=!n&&l?Tf:Me,f=new u({shape:a,z2:1});f.name="item";var h=uD(n);if(f.calculateTextPosition=mV(h,{isRoundCap:u===Tf}),i){var v=f.shape,c=n?"r":"endAngle",p={};v[c]=n?a.r0:a.startAngle,p[c]=a[c],(s?Tt:zt)(f,{shape:p},i)}return f}};function bV(r,e){var t=r.get("realtimeSort",!0),a=e.getBaseAxis();if(t&&a.type==="category"&&e.type==="cartesian2d")return{baseAxis:a,otherAxis:e.getOtherAxis(a)}}function s1(r,e,t,a,n,i,o,s){var l,u;i?(u={x:a.x,width:a.width},l={y:a.y,height:a.height}):(u={y:a.y,height:a.height},l={x:a.x,width:a.width}),s||(o?Tt:zt)(t,{shape:l},e,n,null);var f=e?r.baseAxis.model:null;(o?Tt:zt)(t,{shape:u},f,n)}function l1(r,e){for(var t=0;t0?1:-1,o=a.height>0?1:-1;return{x:a.x+i*n/2,y:a.y+o*n/2,width:a.width-i*n,height:a.height-o*n}},polar:function(r,e,t){var a=r.getItemLayout(e);return{cx:a.cx,cy:a.cy,r0:a.r0,r:a.r,startAngle:a.startAngle,endAngle:a.endAngle,clockwise:a.clockwise}}};function AV(r){return r.startAngle!=null&&r.endAngle!=null&&r.startAngle===r.endAngle}function uD(r){return function(e){var t=e?"Arc":"Angle";return function(a){switch(a){case"start":case"insideStart":case"end":case"insideEnd":return a+t;default:return a}}}(r)}function f1(r,e,t,a,n,i,o,s){var l=e.getItemVisual(t,"style");if(s){if(!i.get("roundCap")){var f=r.shape,h=Wn(a.getModel("itemStyle"),f,!0);V(f,h),r.setShape(f)}}else{var u=a.get(["itemStyle","borderRadius"])||0;r.setShape("r",u)}r.useStyle(l);var v=a.getShallow("cursor");v&&r.attr("cursor",v);var c=s?o?n.r>=n.r0?"endArc":"startArc":n.endAngle>=n.startAngle?"endAngle":"startAngle":o?n.height>=0?"bottom":"top":n.width>=0?"right":"left",p=ne(a);ve(r,p,{labelFetcher:i,labelDataIndex:t,defaultText:ao(i.getData(),t),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:c});var d=r.getTextContent();if(s&&d){var g=a.get(["label","position"]);r.textConfig.inside=g==="middle"?!0:null,_V(r,g==="outside"?c:g,uD(o),a.get(["label","rotate"]))}MT(d,p,i.getRawValue(t),function(m){return tD(e,m)});var y=a.getModel(["emphasis"]);Ht(r,y.get("focus"),y.get("blurScope"),y.get("disabled")),he(r,a),AV(n)&&(r.style.fill="none",r.style.stroke="none",D(r.states,function(m){m.style&&(m.style.fill=m.style.stroke="none")}))}function CV(r,e){var t=r.get(["itemStyle","borderColor"]);if(!t||t==="none")return 0;var a=r.get(["itemStyle","borderWidth"])||0,n=isNaN(e.width)?Number.MAX_VALUE:Math.abs(e.width),i=isNaN(e.height)?Number.MAX_VALUE:Math.abs(e.height);return Math.min(a,n,i)}var DV=function(){function r(){}return r}(),h1=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a.type="largeBar",a}return e.prototype.getDefaultShape=function(){return new DV},e.prototype.buildPath=function(t,a){for(var n=a.points,i=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,f=0;f=0?t:null},30,!1);function MV(r,e,t){for(var a=r.baseDimIdx,n=1-a,i=r.shape.points,o=r.largeDataIndices,s=[],l=[],u=r.barWidth,f=0,h=i.length/3;f=s[0]&&e<=s[0]+l[0]&&t>=s[1]&&t<=s[1]+l[1])return o[f]}return-1}function fD(r,e,t){if(vi(t,"cartesian2d")){var a=e,n=t.getArea();return{x:r?a.x:n.x,y:r?n.y:a.y,width:r?a.width:n.width,height:r?n.height:a.height}}else{var n=t.getArea(),i=e;return{cx:n.cx,cy:n.cy,r0:r?n.r0:i.r0,r:r?n.r:i.r,startAngle:r?i.startAngle:0,endAngle:r?i.endAngle:Math.PI*2}}}function IV(r,e,t){var a=r.type==="polar"?Me:St;return new a({shape:fD(e,t,r),silent:!0,z2:0})}function LV(r){r.registerChartView(xV),r.registerSeriesModel(gV),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,lt(dC,"bar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,gC("bar")),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,lD("bar")),r.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(e,t){var a=e.componentType||"series";t.eachComponent({mainType:a,query:e},function(n){e.sortInfo&&n.axis.setCategorySortInfo(e.sortInfo)})})}var p1=Math.PI*2,uu=Math.PI/180;function hD(r,e){return Qt(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function vD(r,e){var t=hD(r,e),a=r.get("center"),n=r.get("radius");z(n)||(n=[0,n]);var i=W(t.width,e.getWidth()),o=W(t.height,e.getHeight()),s=Math.min(i,o),l=W(n[0],s/2),u=W(n[1],s/2),f,h,v=r.coordinateSystem;if(v){var c=v.dataToPoint(a);f=c[0]||0,h=c[1]||0}else z(a)||(a=[a,a]),f=W(a[0],i)+t.x,h=W(a[1],o)+t.y;return{cx:f,cy:h,r0:l,r:u}}function PV(r,e,t){e.eachSeriesByType(r,function(a){var n=a.getData(),i=n.mapDimension("value"),o=hD(a,t),s=vD(a,t),l=s.cx,u=s.cy,f=s.r,h=s.r0,v=-a.get("startAngle")*uu,c=a.get("endAngle"),p=a.get("padAngle")*uu;c=c==="auto"?v-p1:-c*uu;var d=a.get("minAngle")*uu,g=d+p,y=0;n.each(i,function(N){!isNaN(N)&&y++});var m=n.getSum(i),_=Math.PI/(m||y)*2,S=a.get("clockwise"),b=a.get("roseType"),x=a.get("stillShowZeroSum"),w=n.getDataExtent(i);w[0]=0;var T=S?1:-1,A=[v,c],C=T*p/2;sg(A,!S),v=A[0],c=A[1];var M=cD(a);M.startAngle=v,M.endAngle=c,M.clockwise=S;var I=Math.abs(c-v),L=I,P=0,R=v;if(n.setLayout({viewRect:o,r:f}),n.each(i,function(N,O){var B;if(isNaN(N)){n.setItemLayout(O,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:S,cx:l,cy:u,r0:h,r:b?NaN:f});return}b!=="area"?B=m===0&&x?_:N*_:B=I/y,BB?(H=R+T*B/2,U=H):(H=R+C,U=F-C),n.setItemLayout(O,{angle:B,startAngle:H,endAngle:U,clockwise:S,cx:l,cy:u,r0:h,r:b?Dt(N,w,[h,f]):f}),R=F}),Lt?y:g,b=Math.abs(_.label.y-t);if(b>=S.maxY){var x=_.label.x-e-_.len2*n,w=a+_.len,T=Math.abs(x)r.unconstrainedWidth?null:c:null;a.setStyle("width",p)}var d=a.getBoundingRect();i.width=d.width;var g=(a.style.margin||0)+2.1;i.height=d.height+g,i.y-=(i.height-h)/2}}}function Kv(r){return r.position==="center"}function kV(r){var e=r.getData(),t=[],a,n,i=!1,o=(r.get("minShowLabelAngle")||0)*RV,s=e.getLayout("viewRect"),l=e.getLayout("r"),u=s.width,f=s.x,h=s.y,v=s.height;function c(x){x.ignore=!0}function p(x){if(!x.ignore)return!0;for(var w in x.states)if(x.states[w].ignore===!1)return!0;return!1}e.each(function(x){var w=e.getItemGraphicEl(x),T=w.shape,A=w.getTextContent(),C=w.getTextGuideLine(),M=e.getItemModel(x),I=M.getModel("label"),L=I.get("position")||M.get(["emphasis","label","position"]),P=I.get("distanceToLabelLine"),R=I.get("alignTo"),E=W(I.get("edgeDistance"),u),N=I.get("bleedMargin"),O=M.getModel("labelLine"),B=O.get("length");B=W(B,u);var F=O.get("length2");if(F=W(F,u),Math.abs(T.endAngle-T.startAngle)0?"right":"left":U>0?"left":"right"}var Et=Math.PI,Gt=0,jt=I.get("rotate");if(wt(jt))Gt=jt*(Et/180);else if(L==="center")Gt=0;else if(jt==="radial"||jt===!0){var Ve=U<0?-H+Et:-H;Gt=Ve}else if(jt==="tangential"&&L!=="outside"&&L!=="outer"){var Pe=Math.atan2(U,K);Pe<0&&(Pe=Et*2+Pe);var tn=K>0;tn&&(Pe=Et+Pe),Gt=Pe-Et}if(i=!!Gt,A.x=Q,A.y=it,A.rotation=Gt,A.setStyle({verticalAlign:"middle"}),vt){A.setStyle({align:Wt});var Lh=A.states.select;Lh&&(Lh.x+=A.x,Lh.y+=A.y)}else{var ya=A.getBoundingRect().clone();ya.applyTransform(A.getComputedTransform());var Jy=(A.style.margin||0)+2.1;ya.y-=Jy/2,ya.height+=Jy,t.push({label:A,labelLine:C,position:L,len:B,len2:F,minTurnAngle:O.get("minTurnAngle"),maxSurfaceAngle:O.get("maxSurfaceAngle"),surfaceNormal:new ft(U,K),linePoints:Lt,textAlign:Wt,labelDistance:P,labelAlignTo:R,edgeDistance:E,bleedMargin:N,rect:ya,unconstrainedWidth:ya.width,labelStyleWidth:A.style.width})}w.setTextConfig({inside:vt})}}),!i&&r.get("avoidLabelOverlap")&&EV(t,a,n,l,u,v,f,h);for(var d=0;d0){for(var f=o.getItemLayout(0),h=1;isNaN(f&&f.startAngle)&&h=i.r0}},e.type="pie",e}(Rt);function To(r,e,t){e=z(e)&&{coordDimensions:e}||V({encodeDefine:r.getEncode()},e);var a=r.getSource(),n=pl(a,e).dimensions,i=new Te(n,r);return i.initData(a,t),i}var xl=function(){function r(e,t){this._getDataWithEncodedVisual=e,this._getRawData=t}return r.prototype.getAllNames=function(){var e=this._getRawData();return e.mapArray(e.getName)},r.prototype.containName=function(e){var t=this._getRawData();return t.indexOfName(e)>=0},r.prototype.indexOfName=function(e){var t=this._getDataWithEncodedVisual();return t.indexOfName(e)},r.prototype.getItemVisual=function(e,t){var a=this._getDataWithEncodedVisual();return a.getItemVisual(e,t)},r}(),BV=xt(),VV=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new xl(X(this.getData,this),X(this.getRawData,this)),this._defaultLabelLine(t)},e.prototype.mergeOption=function(){r.prototype.mergeOption.apply(this,arguments)},e.prototype.getInitialData=function(){return To(this,{coordDimensions:["value"],encodeDefaulter:lt(Tg,this)})},e.prototype.getDataParams=function(t){var a=this.getData(),n=BV(a),i=n.seats;if(!i){var o=[];a.each(a.mapDimension("value"),function(l){o.push(l)}),i=n.seats=M2(o,a.hostModel.get("percentPrecision"))}var s=r.prototype.getDataParams.call(this,t);return s.percent=i[t]||0,s.$vars.push("percent"),s},e.prototype._defaultLabelLine=function(t){jn(t,"labelLine",["show"]);var a=t.labelLine,n=t.emphasis.labelLine;a.show=a.show&&t.label.show,n.show=n.show&&t.emphasis.label.show},e.type="series.pie",e.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",bleedMargin:10,distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:15,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},e}(Vt);function zV(r){return{seriesType:r,reset:function(e,t){var a=e.getData();a.filterSelf(function(n){var i=a.mapDimension("value"),o=a.get(i,n);return!(wt(o)&&!isNaN(o)&&o<0)})}}}function GV(r){r.registerChartView(NV),r.registerSeriesModel(VV),kA("pie",r.registerAction),r.registerLayout(lt(PV,"pie")),r.registerProcessor(Sl("pie")),r.registerProcessor(zV("pie"))}var FV=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.getInitialData=function(t,a){return ga(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return t??(this.option.large?5e3:this.get("progressive"))},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return t??(this.option.large?1e4:this.get("progressiveThreshold"))},e.prototype.brushSelector=function(t,a,n){return n.point(a.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(Vt),dD=4,HV=function(){function r(){}return r}(),WV=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a._off=0,a.hoverDataIdx=-1,a}return e.prototype.getDefaultShape=function(){return new HV},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,a){var n=a.points,i=a.size,o=this.symbolProxy,s=o.shape,l=t.getContext?t.getContext():t,u=l&&i[0]=0;u--){var f=u*2,h=i[f]-s/2,v=i[f+1]-l/2;if(t>=h&&a>=v&&t<=h+s&&a<=v+l)return u}return-1},e.prototype.contain=function(t,a){var n=this.transformCoordToLocal(t,a),i=this.getBoundingRect();if(t=n[0],a=n[1],i.contain(t,a)){var o=this.hoverDataIdx=this.findDataIndex(t,a);return o>=0}return this.hoverDataIdx=-1,!1},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var a=this.shape,n=a.points,i=a.size,o=i[0],s=i[1],l=1/0,u=1/0,f=-1/0,h=-1/0,v=0;v=0&&(u.dataIndex=h+(e.startIndex||0))})},r.prototype.remove=function(){this._clear()},r.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},r}(),YV=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){var i=t.getData(),o=this._updateSymbolDraw(i,t);o.updateData(i,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,a,n){var i=t.getData(),o=this._updateSymbolDraw(i,t);o.incrementalPrepareUpdate(i),this._finished=!1},e.prototype.incrementalRender=function(t,a,n){this._symbolDraw.incrementalUpdate(t,a.getData(),{clipShape:this._getClipShape(a)}),this._finished=t.end===a.getData().count()},e.prototype.updateTransform=function(t,a,n){var i=t.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var o=_l("").reset(t,a,n);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){if(t.get("clip",!0)){var a=t.coordinateSystem;return a&&a.getArea&&a.getArea(.1)}},e.prototype._updateSymbolDraw=function(t,a){var n=this._symbolDraw,i=a.pipelineContext,o=i.large;return(!n||o!==this._isLargeDraw)&&(n&&n.remove(),n=this._symbolDraw=o?new UV:new yl,this._isLargeDraw=o,this.group.removeAll()),this.group.add(n.group),n},e.prototype.remove=function(t,a){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}(Rt),XV=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(mt),nd=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",$t).models[0]},e.type="cartesian2dAxis",e}(mt);Kt(nd,dl);var gD={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},ZV=ut({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},gD),jg=ut({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},gD),$V=ut({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},jg),qV=j({logBase:10},jg);const yD={category:ZV,value:jg,time:$V,log:qV};var KV={value:1,category:1,time:1,log:1};function no(r,e,t,a){D(KV,function(n,i){var o=ut(ut({},yD[i],!0),a,!0),s=function(l){k(u,l);function u(){var f=l!==null&&l.apply(this,arguments)||this;return f.type=e+"Axis."+i,f}return u.prototype.mergeDefaultAndTheme=function(f,h){var v=zs(this),c=v?mo(f):{},p=h.getTheme();ut(f,p.get(i+"Axis")),ut(f,this.getDefaultOption()),f.type=g1(f),v&&$a(f,c,v)},u.prototype.optionUpdated=function(){var f=this.option;f.type==="category"&&(this.__ordinalMeta=Jp.createByAxisModel(this))},u.prototype.getCategories=function(f){var h=this.option;if(h.type==="category")return f?h.data:this.__ordinalMeta.categories},u.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},u.type=e+"Axis."+i,u.defaultOption=o,u}(t);r.registerComponentModel(s)}),r.registerSubTypeDefaulter(e+"Axis",g1)}function g1(r){return r.type||(r.data?"category":"value")}var JV=function(){function r(e){this.type="cartesian",this._dimList=[],this._axes={},this.name=e||""}return r.prototype.getAxis=function(e){return this._axes[e]},r.prototype.getAxes=function(){return G(this._dimList,function(e){return this._axes[e]},this)},r.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Ct(this.getAxes(),function(t){return t.scale.type===e})},r.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},r}(),id=["x","y"];function y1(r){return r.type==="interval"||r.type==="time"}var QV=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=id,t}return e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,a=this.getAxis("y").scale;if(!(!y1(t)||!y1(a))){var n=t.getExtent(),i=a.getExtent(),o=this.dataToPoint([n[0],i[0]]),s=this.dataToPoint([n[1],i[1]]),l=n[1]-n[0],u=i[1]-i[0];if(!(!l||!u)){var f=(s[0]-o[0])/l,h=(s[1]-o[1])/u,v=o[0]-n[0]*f,c=o[1]-i[0]*h,p=this._transform=[f,0,0,h,v,c];this._invTransform=fo([],p)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(t){var a=this.getAxis("x"),n=this.getAxis("y");return a.contain(a.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},e.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},e.prototype.containZone=function(t,a){var n=this.dataToPoint(t),i=this.dataToPoint(a),o=this.getArea(),s=new ht(n[0],n[1],i[0]-n[0],i[1]-n[1]);return o.intersect(s)},e.prototype.dataToPoint=function(t,a,n){n=n||[];var i=t[0],o=t[1];if(this._transform&&i!=null&&isFinite(i)&&o!=null&&isFinite(o))return fe(n,t,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return n[0]=s.toGlobalCoord(s.dataToCoord(i,a)),n[1]=l.toGlobalCoord(l.dataToCoord(o,a)),n},e.prototype.clampData=function(t,a){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,o=n.getExtent(),s=i.getExtent(),l=n.parse(t[0]),u=i.parse(t[1]);return a=a||[],a[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),a[1]=Math.min(Math.max(Math.min(s[0],s[1]),u),Math.max(s[0],s[1])),a},e.prototype.pointToData=function(t,a){var n=[];if(this._invTransform)return fe(n,t,this._invTransform);var i=this.getAxis("x"),o=this.getAxis("y");return n[0]=i.coordToData(i.toLocalCoord(t[0]),a),n[1]=o.coordToData(o.toLocalCoord(t[1]),a),n},e.prototype.getOtherAxis=function(t){return this.getAxis(t.dim==="x"?"y":"x")},e.prototype.getArea=function(t){t=t||0;var a=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),i=Math.min(a[0],a[1])-t,o=Math.min(n[0],n[1])-t,s=Math.max(a[0],a[1])-i+t,l=Math.max(n[0],n[1])-o+t;return new ht(i,o,s,l)},e}(JV),jV=function(r){k(e,r);function e(t,a,n,i,o){var s=r.call(this,t,a,n)||this;return s.index=0,s.type=i||"value",s.position=o||"bottom",s}return e.prototype.isHorizontal=function(){var t=this.position;return t==="top"||t==="bottom"},e.prototype.getGlobalExtent=function(t){var a=this.getExtent();return a[0]=this.toGlobalCoord(a[0]),a[1]=this.toGlobalCoord(a[1]),t&&a[0]>a[1]&&a.reverse(),a},e.prototype.pointToData=function(t,a){return this.coordToData(this.toLocalCoord(t[this.dim==="x"?0:1]),a)},e.prototype.setCategorySortInfo=function(t){if(this.type!=="category")return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},e}(br);function od(r,e,t){t=t||{};var a=r.coordinateSystem,n=e.axis,i={},o=n.getAxesOnZeroOf()[0],s=n.position,l=o?"onZero":s,u=n.dim,f=a.getRect(),h=[f.x,f.x+f.width,f.y,f.y+f.height],v={left:0,right:1,top:0,bottom:1,onZero:2},c=e.get("offset")||0,p=u==="x"?[h[2]-c,h[3]+c]:[h[0]-c,h[1]+c];if(o){var d=o.toGlobalCoord(o.dataToCoord(0));p[v.onZero]=Math.max(Math.min(d,p[1]),p[0])}i.position=[u==="y"?p[v[l]]:h[0],u==="x"?p[v[l]]:h[3]],i.rotation=Math.PI/2*(u==="x"?0:1);var g={top:-1,bottom:1,left:-1,right:1};i.labelDirection=i.tickDirection=i.nameDirection=g[s],i.labelOffset=o?p[v[s]]-p[v.onZero]:0,e.get(["axisTick","inside"])&&(i.tickDirection=-i.tickDirection),se(t.labelInside,e.get(["axisLabel","inside"]))&&(i.labelDirection=-i.labelDirection);var y=e.get(["axisLabel","rotate"]);return i.labelRotate=l==="top"?-y:y,i.z2=1,i}function m1(r){return r.get("coordinateSystem")==="cartesian2d"}function _1(r){var e={xAxisModel:null,yAxisModel:null};return D(e,function(t,a){var n=a.replace(/Model$/,""),i=r.getReferringComponents(n,$t).models[0];e[a]=i}),e}var Jv=Math.log;function mD(r,e,t){var a=ha.prototype,n=a.getTicks.call(t),i=a.getTicks.call(t,!0),o=n.length-1,s=a.getInterval.call(t),l=xC(r,e),u=l.extent,f=l.fixMin,h=l.fixMax;if(r.type==="log"){var v=Jv(r.base);u=[Jv(u[0])/v,Jv(u[1])/v]}r.setExtent(u[0],u[1]),r.calcNiceExtent({splitNumber:o,fixMin:f,fixMax:h});var c=a.getExtent.call(r);f&&(u[0]=c[0]),h&&(u[1]=c[1]);var p=a.getInterval.call(r),d=u[0],g=u[1];if(f&&h)p=(g-d)/o;else if(f)for(g=u[0]+p*o;gu[0]&&isFinite(d)&&isFinite(u[0]);)p=Nv(p),d=u[1]-p*o;else{var y=r.getTicks().length-1;y>o&&(p=Nv(p));var m=p*o;g=Math.ceil(u[1]/p)*p,d=Ut(g-m),d<0&&u[0]>=0?(d=0,g=Ut(m)):g>0&&u[1]<=0&&(g=0,d=-Ut(m))}var _=(n[0].value-i[0].value)/s,S=(n[o].value-i[o].value)/s;a.setExtent.call(r,d+p*_,g+p*S),a.setInterval.call(r,p),(_||S)&&a.setNiceExtent.call(r,d+p,g-p)}var tz=function(){function r(e,t,a){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=id,this._initCartesian(e,t,a),this.model=e}return r.prototype.getRect=function(){return this._rect},r.prototype.update=function(e,t){var a=this._axesMap;this._updateScale(e,this.model);function n(o){var s,l=_t(o),u=l.length;if(u){for(var f=[],h=u-1;h>=0;h--){var v=+l[h],c=o[v],p=c.model,d=c.scale;Qp(d)&&p.get("alignTicks")&&p.get("interval")==null?f.push(c):(ro(d,p),Qp(d)&&(s=c))}f.length&&(s||(s=f.pop(),ro(s.scale,s.model)),D(f,function(g){mD(g.scale,g.model,s.scale)}))}}n(a.x),n(a.y);var i={};D(a.x,function(o){S1(a,"y",o,i)}),D(a.y,function(o){S1(a,"x",o,i)}),this.resize(this.model,t)},r.prototype.resize=function(e,t,a){var n=e.getBoxLayoutParams(),i=!a&&e.get("containLabel"),o=Qt(n,{width:t.getWidth(),height:t.getHeight()});this._rect=o;var s=this._axesList;l(),i&&(D(s,function(u){if(!u.model.get(["axisLabel","inside"])){var f=kN(u);if(f){var h=u.isHorizontal()?"height":"width",v=u.model.get(["axisLabel","margin"]);o[h]-=f[h]+v,u.position==="top"?o.y+=f.height+v:u.position==="left"&&(o.x+=f.width+v)}}}),l()),D(this._coordsList,function(u){u.calcAffineTransform()});function l(){D(s,function(u){var f=u.isHorizontal(),h=f?[0,o.width]:[0,o.height],v=u.inverse?1:0;u.setExtent(h[v],h[1-v]),ez(u,f?o.x:o.y)})}},r.prototype.getAxis=function(e,t){var a=this._axesMap[e];if(a!=null)return a[t||0]},r.prototype.getAxes=function(){return this._axesList.slice()},r.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var a="x"+e+"y"+t;return this._coordsMap[a]}et(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var n=0,i=this._coordsList;n0?"top":"bottom",i="center"):Es(n-Ba)?(o=a>0?"bottom":"top",i="center"):(o="middle",n>0&&n0?"right":"left":i=a>0?"left":"right"),{rotation:n,textAlign:i,textVerticalAlign:o}},r.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+"Index"]=e.componentIndex,t},r.isLabelSilent=function(e){var t=e.get("tooltip");return e.get("silent")||!(e.get("triggerEvent")||t&&t.show)},r}(),b1={axisLine:function(r,e,t,a){var n=e.get(["axisLine","show"]);if(n==="auto"&&r.handleAutoShown&&(n=r.handleAutoShown("axisLine")),!!n){var i=e.axis.getExtent(),o=a.transform,s=[i[0],0],l=[i[1],0],u=s[0]>l[0];o&&(fe(s,s,o),fe(l,l,o));var f=V({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),h=new ee({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:f,strokeContainThreshold:r.strokeContainThreshold||5,silent:!0,z2:1});ji(h.shape,h.style.lineWidth),h.anid="line",t.add(h);var v=e.get(["axisLine","symbol"]);if(v!=null){var c=e.get(["axisLine","symbolSize"]);Y(v)&&(v=[v,v]),(Y(c)||wt(c))&&(c=[c,c]);var p=fi(e.get(["axisLine","symbolOffset"])||0,c),d=c[0],g=c[1];D([{rotate:r.rotation+Math.PI/2,offset:p[0],r:0},{rotate:r.rotation-Math.PI/2,offset:p[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(y,m){if(v[m]!=="none"&&v[m]!=null){var _=qt(v[m],-d/2,-g/2,d,g,f.stroke,!0),S=y.r+y.offset,b=u?l:s;_.attr({rotation:y.rotate,x:b[0]+S*Math.cos(r.rotation),y:b[1]-S*Math.sin(r.rotation),silent:!0,z2:11}),t.add(_)}})}}},axisTickLabel:function(r,e,t,a){var n=nz(t,a,e,r),i=oz(t,a,e,r);if(az(e,i,n),iz(t,a,e,r.tickDirection),e.get(["axisLabel","hideOverlap"])){var o=OC(G(i,function(s){return{label:s,priority:s.z2,defaultAttr:{ignore:s.ignore}}}));VC(o)}},axisName:function(r,e,t,a){var n=se(r.axisName,e.get("name"));if(n){var i=e.get("nameLocation"),o=r.nameDirection,s=e.getModel("nameTextStyle"),l=e.get("nameGap")||0,u=e.axis.getExtent(),f=u[0]>u[1]?-1:1,h=[i==="start"?u[0]-f*l:i==="end"?u[1]+f*l:(u[0]+u[1])/2,T1(i)?r.labelOffset+o*l:0],v,c=e.get("nameRotate");c!=null&&(c=c*Ba/180);var p;T1(i)?v=Ae.innerTextLayout(r.rotation,c??r.rotation,o):(v=rz(r.rotation,i,c||0,u),p=r.axisNameAvailableWidth,p!=null&&(p=Math.abs(p/Math.sin(v.rotation)),!isFinite(p)&&(p=null)));var d=s.getFont(),g=e.get("nameTruncate",!0)||{},y=g.ellipsis,m=se(r.nameTruncateMaxWidth,g.maxWidth,p),_=new bt({x:h[0],y:h[1],rotation:v.rotation,silent:Ae.isLabelSilent(e),style:Bt(s,{text:n,font:d,overflow:"truncate",width:m,ellipsis:y,fill:s.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:s.get("align")||v.textAlign,verticalAlign:s.get("verticalAlign")||v.textVerticalAlign}),z2:1});if(li({el:_,componentModel:e,itemName:n}),_.__fullText=n,_.anid="name",e.get("triggerEvent")){var S=Ae.makeAxisEventDataBase(e);S.targetType="axisName",S.name=n,nt(_).eventData=S}a.add(_),_.updateTransform(),t.add(_),_.decomposeTransform()}}};function rz(r,e,t,a){var n=Ow(t-r),i,o,s=a[0]>a[1],l=e==="start"&&!s||e!=="start"&&s;return Es(n-Ba/2)?(o=l?"bottom":"top",i="center"):Es(n-Ba*1.5)?(o=l?"top":"bottom",i="center"):(o="middle",nBa/2?i=l?"left":"right":i=l?"right":"left"),{rotation:n,textAlign:i,textVerticalAlign:o}}function az(r,e,t){if(!bC(r.axis)){var a=r.get(["axisLabel","showMinLabel"]),n=r.get(["axisLabel","showMaxLabel"]);e=e||[],t=t||[];var i=e[0],o=e[1],s=e[e.length-1],l=e[e.length-2],u=t[0],f=t[1],h=t[t.length-1],v=t[t.length-2];a===!1?(Ye(i),Ye(u)):w1(i,o)&&(a?(Ye(o),Ye(f)):(Ye(i),Ye(u))),n===!1?(Ye(s),Ye(h)):w1(l,s)&&(n?(Ye(l),Ye(v)):(Ye(s),Ye(h)))}}function Ye(r){r&&(r.ignore=!0)}function w1(r,e){var t=r&&r.getBoundingRect().clone(),a=e&&e.getBoundingRect().clone();if(!(!t||!a)){var n=Xf([]);return si(n,n,-r.rotation),t.applyTransform(ra([],n,r.getLocalTransform())),a.applyTransform(ra([],n,e.getLocalTransform())),t.intersect(a)}}function T1(r){return r==="middle"||r==="center"}function _D(r,e,t,a,n){for(var i=[],o=[],s=[],l=0;l=0||r===e}function vz(r){var e=ty(r);if(e){var t=e.axisPointerModel,a=e.axis.scale,n=t.option,i=t.get("status"),o=t.get("value");o!=null&&(o=a.parse(o));var s=sd(t);i==null&&(n.status=s?"show":"hide");var l=a.getExtent().slice();l[0]>l[1]&&l.reverse(),(o==null||o>l[1])&&(o=l[1]),o0&&!p.min?p.min=0:p.min!=null&&p.min<0&&!p.max&&(p.max=0);var d=l;p.color!=null&&(d=j({color:p.color},l));var g=ut(rt(p),{boundaryGap:t,splitNumber:a,scale:n,axisLine:i,axisTick:o,axisLabel:s,name:p.text,showName:u,nameLocation:"end",nameGap:h,nameTextStyle:d,triggerEvent:v},!1);if(Y(f)){var y=g.name;g.name=f.replace("{value}",y??"")}else J(f)&&(g.name=f(g.name,g));var m=new Mt(g,null,this.ecModel);return Kt(m,dl.prototype),m.mainType="radar",m.componentIndex=this.componentIndex,m},this);this._indicatorModels=c},e.prototype.getIndicatorModels=function(){return this._indicatorModels},e.type="radar",e.defaultOption={z:0,center:["50%","50%"],radius:"75%",startAngle:90,axisName:{show:!0},boundaryGap:[0,0],splitNumber:5,axisNameGap:15,scale:!1,shape:"polygon",axisLine:ut({lineStyle:{color:"#bbb"}},Uo.axisLine),axisLabel:fu(Uo.axisLabel,!1),axisTick:fu(Uo.axisTick,!1),splitLine:fu(Uo.splitLine,!0),splitArea:fu(Uo.splitArea,!0),indicator:[]},e}(mt),Az=["axisLine","axisTickLabel","axisName"],Cz=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){var i=this.group;i.removeAll(),this._buildAxes(t),this._buildSplitLineAndArea(t)},e.prototype._buildAxes=function(t){var a=t.coordinateSystem,n=a.getIndicatorAxes(),i=G(n,function(o){var s=o.model.get("showName")?o.name:"",l=new Ae(o.model,{axisName:s,position:[a.cx,a.cy],rotation:o.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return l});D(i,function(o){D(Az,o.add,o),this.group.add(o.getGroup())},this)},e.prototype._buildSplitLineAndArea=function(t){var a=t.coordinateSystem,n=a.getIndicatorAxes();if(!n.length)return;var i=t.get("shape"),o=t.getModel("splitLine"),s=t.getModel("splitArea"),l=o.getModel("lineStyle"),u=s.getModel("areaStyle"),f=o.get("show"),h=s.get("show"),v=l.get("color"),c=u.get("color"),p=z(v)?v:[v],d=z(c)?c:[c],g=[],y=[];function m(R,E,N){var O=N%E.length;return R[O]=R[O]||[],O}if(i==="circle")for(var _=n[0].getTicksCoords(),S=a.cx,b=a.cy,x=0;x<_.length;x++){if(f){var w=m(g,p,x);g[w].push(new da({shape:{cx:S,cy:b,r:_[x].coord}}))}if(h&&x<_.length-1){var w=m(y,d,x);y[w].push(new sl({shape:{cx:S,cy:b,r0:_[x].coord,r:_[x+1].coord}}))}}else for(var T,A=G(n,function(R,E){var N=R.getTicksCoords();return T=T==null?N.length-1:Math.min(N.length-1,T),G(N,function(O){return a.coordToPoint(O.coord,E)})}),C=[],x=0;x<=T;x++){for(var M=[],I=0;I3?1.4:o>1?1.2:1.1,f=i>0?u:1/u;tc(this,"zoom","zoomOnMouseWheel",t,{scale:f,originX:s,originY:l,isAvailableBehavior:null})}if(n){var h=Math.abs(i),v=(i>0?1:-1)*(h>3?.4:h>1?.15:.05);tc(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:v,originX:s,originY:l,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){if(!L1(this._zr,"globalPan")){var a=t.pinchScale>1?1.1:1/1.1;tc(this,"zoom",null,t,{scale:a,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})}},e}(or);function tc(r,e,t,a,n){r.pointerChecker&&r.pointerChecker(a,n.originX,n.originY)&&(oa(a.event),AD(r,e,t,a,n))}function AD(r,e,t,a,n){n.isAvailableBehavior=X(Wu,null,t,a),r.trigger(e,n)}function Wu(r,e,t){var a=t[r];return!r||a&&(!Y(a)||e.event[a+"Key"])}function ry(r,e,t){var a=r.target;a.x+=e,a.y+=t,a.dirty()}function ay(r,e,t,a){var n=r.target,i=r.zoomLimit,o=r.zoom=r.zoom||1;if(o*=e,i){var s=i.min||0,l=i.max||1/0;o=Math.max(Math.min(l,o),s)}var u=o/r.zoom;r.zoom=o,n.x-=(t-n.x)*(u-1),n.y-=(a-n.y)*(u-1),n.scaleX*=u,n.scaleY*=u,n.dirty()}var Ez={axisPointer:1,tooltip:1,brush:1};function wh(r,e,t){var a=e.getComponentByElement(r.topTarget),n=a&&a.coordinateSystem;return a&&a!==t&&!Ez.hasOwnProperty(a.mainType)&&n&&n.model!==t}function CD(r){if(Y(r)){var e=new DOMParser;r=e.parseFromString(r,"text/xml")}var t=r;for(t.nodeType===9&&(t=t.firstChild);t.nodeName.toLowerCase()!=="svg"||t.nodeType!==1;)t=t.nextSibling;return t}var ec,Af={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-anchor":"textAlign",visibility:"visibility",display:"display"},P1=_t(Af),Cf={"alignment-baseline":"textBaseline","stop-color":"stopColor"},R1=_t(Cf),kz=function(){function r(){this._defs={},this._root=null}return r.prototype.parse=function(e,t){t=t||{};var a=CD(e);this._defsUsePending=[];var n=new at;this._root=n;var i=[],o=a.getAttribute("viewBox")||"",s=parseFloat(a.getAttribute("width")||t.width),l=parseFloat(a.getAttribute("height")||t.height);isNaN(s)&&(s=null),isNaN(l)&&(l=null),ze(a,n,null,!0,!1);for(var u=a.firstChild;u;)this._parseNode(u,n,i,null,!1,!1),u=u.nextSibling;Bz(this._defs,this._defsUsePending),this._defsUsePending=[];var f,h;if(o){var v=Th(o);v.length>=4&&(f={x:parseFloat(v[0]||0),y:parseFloat(v[1]||0),width:parseFloat(v[2]),height:parseFloat(v[3])})}if(f&&s!=null&&l!=null&&(h=MD(f,{x:0,y:0,width:s,height:l}),!t.ignoreViewBox)){var c=n;n=new at,n.add(c),c.scaleX=c.scaleY=h.scale,c.x=h.x,c.y=h.y}return!t.ignoreRootClip&&s!=null&&l!=null&&n.setClipPath(new St({shape:{x:0,y:0,width:s,height:l}})),{root:n,width:s,height:l,viewBoxRect:f,viewBoxTransform:h,named:i}},r.prototype._parseNode=function(e,t,a,n,i,o){var s=e.nodeName.toLowerCase(),l,u=n;if(s==="defs"&&(i=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=t;else{if(!i){var f=ec[s];if(f&&Z(ec,s)){l=f.call(this,e,t);var h=e.getAttribute("name");if(h){var v={name:h,namedFrom:null,svgNodeTagLower:s,el:l};a.push(v),s==="g"&&(u=v)}else n&&a.push({name:n.name,namedFrom:n,svgNodeTagLower:s,el:l});t.add(l)}}var c=E1[s];if(c&&Z(E1,s)){var p=c.call(this,e),d=e.getAttribute("id");d&&(this._defs[d]=p)}}if(l&&l.isGroup)for(var g=e.firstChild;g;)g.nodeType===1?this._parseNode(g,l,a,u,i,o):g.nodeType===3&&o&&this._parseText(g,l),g=g.nextSibling},r.prototype._parseText=function(e,t){var a=new Qi({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});Xe(t,a),ze(e,a,this._defsUsePending,!1,!1),Oz(a,t);var n=a.style,i=n.fontSize;i&&i<9&&(n.fontSize=9,a.scaleX*=i/9,a.scaleY*=i/9);var o=(n.fontSize||n.fontFamily)&&[n.fontStyle,n.fontWeight,(n.fontSize||12)+"px",n.fontFamily||"sans-serif"].join(" ");n.font=o;var s=a.getBoundingRect();return this._textX+=s.width,t.add(a),a},r.internalField=function(){ec={g:function(e,t){var a=new at;return Xe(t,a),ze(e,a,this._defsUsePending,!1,!1),a},rect:function(e,t){var a=new St;return Xe(t,a),ze(e,a,this._defsUsePending,!1,!1),a.setShape({x:parseFloat(e.getAttribute("x")||"0"),y:parseFloat(e.getAttribute("y")||"0"),width:parseFloat(e.getAttribute("width")||"0"),height:parseFloat(e.getAttribute("height")||"0")}),a.silent=!0,a},circle:function(e,t){var a=new da;return Xe(t,a),ze(e,a,this._defsUsePending,!1,!1),a.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),r:parseFloat(e.getAttribute("r")||"0")}),a.silent=!0,a},line:function(e,t){var a=new ee;return Xe(t,a),ze(e,a,this._defsUsePending,!1,!1),a.setShape({x1:parseFloat(e.getAttribute("x1")||"0"),y1:parseFloat(e.getAttribute("y1")||"0"),x2:parseFloat(e.getAttribute("x2")||"0"),y2:parseFloat(e.getAttribute("y2")||"0")}),a.silent=!0,a},ellipse:function(e,t){var a=new rh;return Xe(t,a),ze(e,a,this._defsUsePending,!1,!1),a.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),rx:parseFloat(e.getAttribute("rx")||"0"),ry:parseFloat(e.getAttribute("ry")||"0")}),a.silent=!0,a},polygon:function(e,t){var a=e.getAttribute("points"),n;a&&(n=N1(a));var i=new Ie({shape:{points:n||[]},silent:!0});return Xe(t,i),ze(e,i,this._defsUsePending,!1,!1),i},polyline:function(e,t){var a=e.getAttribute("points"),n;a&&(n=N1(a));var i=new Le({shape:{points:n||[]},silent:!0});return Xe(t,i),ze(e,i,this._defsUsePending,!1,!1),i},image:function(e,t){var a=new le;return Xe(t,a),ze(e,a,this._defsUsePending,!1,!1),a.setStyle({image:e.getAttribute("xlink:href")||e.getAttribute("href"),x:+e.getAttribute("x"),y:+e.getAttribute("y"),width:+e.getAttribute("width"),height:+e.getAttribute("height")}),a.silent=!0,a},text:function(e,t){var a=e.getAttribute("x")||"0",n=e.getAttribute("y")||"0",i=e.getAttribute("dx")||"0",o=e.getAttribute("dy")||"0";this._textX=parseFloat(a)+parseFloat(i),this._textY=parseFloat(n)+parseFloat(o);var s=new at;return Xe(t,s),ze(e,s,this._defsUsePending,!1,!0),s},tspan:function(e,t){var a=e.getAttribute("x"),n=e.getAttribute("y");a!=null&&(this._textX=parseFloat(a)),n!=null&&(this._textY=parseFloat(n));var i=e.getAttribute("dx")||"0",o=e.getAttribute("dy")||"0",s=new at;return Xe(t,s),ze(e,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(i),this._textY+=parseFloat(o),s},path:function(e,t){var a=e.getAttribute("d")||"",n=gT(a);return Xe(t,n),ze(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}}(),r}(),E1={lineargradient:function(r){var e=parseInt(r.getAttribute("x1")||"0",10),t=parseInt(r.getAttribute("y1")||"0",10),a=parseInt(r.getAttribute("x2")||"10",10),n=parseInt(r.getAttribute("y2")||"0",10),i=new ul(e,t,a,n);return k1(r,i),O1(r,i),i},radialgradient:function(r){var e=parseInt(r.getAttribute("cx")||"0",10),t=parseInt(r.getAttribute("cy")||"0",10),a=parseInt(r.getAttribute("r")||"0",10),n=new ST(e,t,a);return k1(r,n),O1(r,n),n}};function k1(r,e){var t=r.getAttribute("gradientUnits");t==="userSpaceOnUse"&&(e.global=!0)}function O1(r,e){for(var t=r.firstChild;t;){if(t.nodeType===1&&t.nodeName.toLocaleLowerCase()==="stop"){var a=t.getAttribute("offset"),n=void 0;a&&a.indexOf("%")>0?n=parseInt(a,10)/100:a?n=parseFloat(a):n=0;var i={};DD(t,i,i);var o=i.stopColor||t.getAttribute("stop-color")||"#000000";e.colorStops.push({offset:n,color:o})}t=t.nextSibling}}function Xe(r,e){r&&r.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),j(e.__inheritedStyle,r.__inheritedStyle))}function N1(r){for(var e=Th(r),t=[],a=0;a0;i-=2){var o=a[i],s=a[i-1],l=Th(o);switch(n=n||Fe(),s){case"translate":Fr(n,n,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Qd(n,n,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":si(n,n,-parseFloat(l[0])*rc,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*rc);ra(n,[1,0,u,1,0,0],n);break;case"skewY":var f=Math.tan(parseFloat(l[0])*rc);ra(n,[1,f,0,1,0,0],n);break;case"matrix":n[0]=parseFloat(l[0]),n[1]=parseFloat(l[1]),n[2]=parseFloat(l[2]),n[3]=parseFloat(l[3]),n[4]=parseFloat(l[4]),n[5]=parseFloat(l[5]);break}}e.setLocalTransform(n)}}var V1=/([^\s:;]+)\s*:\s*([^:;]+)/g;function DD(r,e,t){var a=r.getAttribute("style");if(a){V1.lastIndex=0;for(var n;(n=V1.exec(a))!=null;){var i=n[1],o=Z(Af,i)?Af[i]:null;o&&(e[o]=n[2]);var s=Z(Cf,i)?Cf[i]:null;s&&(t[s]=n[2])}}}function Fz(r,e,t){for(var a=0;a0,g={api:a,geo:l,mapOrGeoModel:e,data:s,isVisualEncodedByVisualMap:d,isGeo:o,transformInfoRaw:v};l.resourceType==="geoJSON"?this._buildGeoJSON(g):l.resourceType==="geoSVG"&&this._buildSVG(g),this._updateController(e,t,a),this._updateMapSelectHandler(e,u,a,n)},r.prototype._buildGeoJSON=function(e){var t=this._regionsGroupByName=$(),a=$(),n=this._regionsGroup,i=e.transformInfoRaw,o=e.mapOrGeoModel,s=e.data,l=e.geo.projection,u=l&&l.stream;function f(c,p){return p&&(c=p(c)),c&&[c[0]*i.scaleX+i.x,c[1]*i.scaleY+i.y]}function h(c){for(var p=[],d=!u&&l&&l.project,g=0;g=0)&&(v=n);var c=o?{normal:{align:"center",verticalAlign:"middle"}}:null;ve(e,ne(a),{labelFetcher:v,labelDataIndex:h,defaultText:t},c);var p=e.getTextContent();if(p&&(ID(p).ignore=p.ignore,e.textConfig&&o)){var d=e.getBoundingRect().clone();e.textConfig.layoutRect=d,e.textConfig.position=[(o[0]-d.x)/d.width*100+"%",(o[1]-d.y)/d.height*100+"%"]}e.disableLabelAnimation=!0}else e.removeTextContent(),e.removeTextConfig(),e.disableLabelAnimation=null}function W1(r,e,t,a,n,i){r.data?r.data.setItemGraphicEl(i,e):nt(e).eventData={componentType:"geo",componentIndex:n.componentIndex,geoIndex:n.componentIndex,name:t,region:a&&a.option||{}}}function U1(r,e,t,a,n){r.data||li({el:e,componentModel:n,itemName:t,itemTooltipOption:a.get("tooltip")})}function Y1(r,e,t,a,n){e.highDownSilentOnTouch=!!n.get("selectedMode");var i=a.getModel("emphasis"),o=i.get("focus");return Ht(e,o,i.get("blurScope"),i.get("disabled")),r.isGeo&&eR(e,n,t),o}function X1(r,e,t){var a=[],n;function i(){n=[]}function o(){n.length&&(a.push(n),n=[])}var s=e({polygonStart:i,polygonEnd:o,lineStart:i,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&n.push([l,u])},sphere:function(){}});return!t&&s.polygonStart(),D(r,function(l){s.lineStart();for(var u=0;u-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n},e.type="series.map",e.dependencies=["geo"],e.layoutMode="box",e.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{areaColor:"rgba(255,215,0,0.8)"}},select:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},nameProperty:"name"},e}(Vt);function s5(r,e){var t={};return D(r,function(a){a.each(a.mapDimension("value"),function(n,i){var o="ec-"+a.getName(i);t[o]=t[o]||[],isNaN(n)||t[o].push(n)})}),r[0].map(r[0].mapDimension("value"),function(a,n){for(var i="ec-"+r[0].getName(n),o=0,s=1/0,l=-1/0,u=t[i].length,f=0;f1?(S.width=_,S.height=_/g):(S.height=_,S.width=_*g),S.y=m[1]-S.height/2,S.x=m[0]-S.width/2;else{var b=r.getBoxLayoutParams();b.aspect=g,S=Qt(b,{width:p,height:d})}this.setViewRect(S.x,S.y,S.width,S.height),this.setCenter(r.get("center"),e),this.setZoom(r.get("zoom"))}function h5(r,e){D(e.get("geoCoord"),function(t,a){r.addGeoCoord(a,t)})}var v5=function(){function r(){this.dimensions=PD}return r.prototype.create=function(e,t){var a=[];function n(o){return{nameProperty:o.get("nameProperty"),aspectScale:o.get("aspectScale"),projection:o.get("projection")}}e.eachComponent("geo",function(o,s){var l=o.get("map"),u=new fd(l+s,l,V({nameMap:o.get("nameMap")},n(o)));u.zoomLimit=o.get("scaleLimit"),a.push(u),o.coordinateSystem=u,u.model=o,u.resize=K1,u.resize(o,t)}),e.eachSeries(function(o){var s=o.get("coordinateSystem");if(s==="geo"){var l=o.get("geoIndex")||0;o.coordinateSystem=a[l]}});var i={};return e.eachSeriesByType("map",function(o){if(!o.getHostGeoModel()){var s=o.getMapType();i[s]=i[s]||[],i[s].push(o)}}),D(i,function(o,s){var l=G(o,function(f){return f.get("nameMap")}),u=new fd(s,s,V({nameMap:Zd(l)},n(o[0])));u.zoomLimit=se.apply(null,G(o,function(f){return f.get("scaleLimit")})),a.push(u),u.resize=K1,u.resize(o[0],t),D(o,function(f){f.coordinateSystem=u,h5(u,f)})}),a},r.prototype.getFilledRegions=function(e,t,a,n){for(var i=(e||[]).slice(),o=$(),s=0;s=0;o--){var s=n[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},t.push(s)}}function m5(r,e){var t=r.isExpand?r.children:[],a=r.parentNode.children,n=r.hierNode.i?a[r.hierNode.i-1]:null;if(t.length){x5(r);var i=(t[0].hierNode.prelim+t[t.length-1].hierNode.prelim)/2;n?(r.hierNode.prelim=n.hierNode.prelim+e(r,n),r.hierNode.modifier=r.hierNode.prelim-i):r.hierNode.prelim=i}else n&&(r.hierNode.prelim=n.hierNode.prelim+e(r,n));r.parentNode.hierNode.defaultAncestor=b5(r,n,r.parentNode.hierNode.defaultAncestor||a[0],e)}function _5(r){var e=r.hierNode.prelim+r.parentNode.hierNode.modifier;r.setLayout({x:e},!0),r.hierNode.modifier+=r.parentNode.hierNode.modifier}function Q1(r){return arguments.length?r:A5}function ls(r,e){return r-=Math.PI/2,{x:e*Math.cos(r),y:e*Math.sin(r)}}function S5(r,e){return Qt(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function x5(r){for(var e=r.children,t=e.length,a=0,n=0;--t>=0;){var i=e[t];i.hierNode.prelim+=a,i.hierNode.modifier+=a,n+=i.hierNode.change,a+=i.hierNode.shift+n}}function b5(r,e,t,a){if(e){for(var n=r,i=r,o=i.parentNode.children[0],s=e,l=n.hierNode.modifier,u=i.hierNode.modifier,f=o.hierNode.modifier,h=s.hierNode.modifier;s=ac(s),i=nc(i),s&&i;){n=ac(n),o=nc(o),n.hierNode.ancestor=r;var v=s.hierNode.prelim+h-i.hierNode.prelim-u+a(s,i);v>0&&(T5(w5(s,r,t),r,v),u+=v,l+=v),h+=s.hierNode.modifier,u+=i.hierNode.modifier,l+=n.hierNode.modifier,f+=o.hierNode.modifier}s&&!ac(n)&&(n.hierNode.thread=s,n.hierNode.modifier+=h-l),i&&!nc(o)&&(o.hierNode.thread=i,o.hierNode.modifier+=u-f,t=r)}return t}function ac(r){var e=r.children;return e.length&&r.isExpand?e[e.length-1]:r.hierNode.thread}function nc(r){var e=r.children;return e.length&&r.isExpand?e[0]:r.hierNode.thread}function w5(r,e,t){return r.hierNode.ancestor.parentNode===e.parentNode?r.hierNode.ancestor:t}function T5(r,e,t){var a=t/(e.hierNode.i-r.hierNode.i);e.hierNode.change-=a,e.hierNode.shift+=t,e.hierNode.modifier+=t,e.hierNode.prelim+=t,r.hierNode.change+=a}function A5(r,e){return r.parentNode===e.parentNode?1:2}var C5=function(){function r(){this.parentPoint=[],this.childPoints=[]}return r}(),D5=function(r){k(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new C5},e.prototype.buildPath=function(t,a){var n=a.childPoints,i=n.length,o=a.parentPoint,s=n[0],l=n[i-1];if(i===1){t.moveTo(o[0],o[1]),t.lineTo(s[0],s[1]);return}var u=a.orient,f=u==="TB"||u==="BT"?0:1,h=1-f,v=W(a.forkPosition,1),c=[];c[f]=o[f],c[h]=o[h]+(l[h]-o[h])*v,t.moveTo(o[0],o[1]),t.lineTo(c[0],c[1]),t.moveTo(s[0],s[1]),c[f]=s[f],t.lineTo(c[0],c[1]),c[f]=l[f],t.lineTo(c[0],c[1]),t.lineTo(l[0],l[1]);for(var p=1;pm.x,b||(S=S-Math.PI));var w=b?"left":"right",T=s.getModel("label"),A=T.get("rotate"),C=A*(Math.PI/180),M=g.getTextContent();M&&(g.setTextConfig({position:T.get("position")||w,rotation:A==null?-S:C,origin:"center"}),M.setStyle("verticalAlign","middle"))}var I=s.get(["emphasis","focus"]),L=I==="relative"?Is(o.getAncestorsIndices(),o.getDescendantIndices()):I==="ancestor"?o.getAncestorsIndices():I==="descendant"?o.getDescendantIndices():null;L&&(nt(t).focus=L),I5(n,o,f,t,p,c,d,a),t.__edge&&(t.onHoverStateChange=function(P){if(P!=="blur"){var R=o.parentNode&&r.getItemGraphicEl(o.parentNode.dataIndex);R&&R.hoverState===ol||nf(t.__edge,P)}})}function I5(r,e,t,a,n,i,o,s){var l=e.getModel(),u=r.get("edgeShape"),f=r.get("layout"),h=r.getOrient(),v=r.get(["lineStyle","curveness"]),c=r.get("edgeForkPosition"),p=l.getModel("lineStyle").getLineStyle(),d=a.__edge;if(u==="curve")e.parentNode&&e.parentNode!==t&&(d||(d=a.__edge=new ll({shape:hd(f,h,v,n,n)})),Tt(d,{shape:hd(f,h,v,i,o)},r));else if(u==="polyline"&&f==="orthogonal"&&e!==t&&e.children&&e.children.length!==0&&e.isExpand===!0){for(var g=e.children,y=[],m=0;mt&&(t=n.height)}this.height=t+1},r.prototype.getNodeById=function(e){if(this.getId()===e)return this;for(var t=0,a=this.children,n=a.length;t=0&&this.hostTree.data.setItemLayout(this.dataIndex,e,t)},r.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},r.prototype.getModel=function(e){if(!(this.dataIndex<0)){var t=this.hostTree,a=t.data.getItemModel(this.dataIndex);return a.getModel(e)}},r.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},r.prototype.setVisual=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,e,t)},r.prototype.getVisual=function(e){return this.hostTree.data.getItemVisual(this.dataIndex,e)},r.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},r.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},r.prototype.getChildIndex=function(){if(this.parentNode){for(var e=this.parentNode.children,t=0;t=0){var a=t.getData().tree.root,n=r.targetNode;if(Y(n)&&(n=a.getNodeById(n)),n&&a.contains(n))return{node:n};var i=r.targetNodeId;if(i!=null&&(n=a.getNodeById(i)))return{node:n}}}function BD(r){for(var e=[];r;)r=r.parentNode,r&&e.push(r);return e.reverse()}function ly(r,e){var t=BD(r);return ct(t,e)>=0}function Ah(r,e){for(var t=[];r;){var a=r.dataIndex;t.push({name:r.name,dataIndex:a,value:e.getRawValue(a)}),r=r.parentNode}return t.reverse(),t}var V5=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.hasSymbolVisual=!0,t.ignoreStyleOnData=!0,t}return e.prototype.getInitialData=function(t){var a={name:t.name,children:t.data},n=t.leaves||{},i=new Mt(n,this,this.ecModel),o=sy.createTree(a,this,s);function s(h){h.wrapMethod("getItemModel",function(v,c){var p=o.getNodeByDataIndex(c);return p&&p.children.length&&p.isExpand||(v.parentModel=i),v})}var l=0;o.eachNode("preorder",function(h){h.depth>l&&(l=h.depth)});var u=t.expandAndCollapse,f=u&&t.initialTreeDepth>=0?t.initialTreeDepth:l;return o.root.eachNode("preorder",function(h){var v=h.hostTree.data.getRawDataItem(h.dataIndex);h.isExpand=v&&v.collapsed!=null?!v.collapsed:h.depth<=f}),o.data},e.prototype.getOrient=function(){var t=this.get("orient");return t==="horizontal"?t="LR":t==="vertical"&&(t="TB"),t},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.formatTooltip=function(t,a,n){for(var i=this.getData().tree,o=i.root.children[0],s=i.getNodeByDataIndex(t),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return ie("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},e.prototype.getDataParams=function(t){var a=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return a.treeAncestors=Ah(n,this),a.collapsed=!n.isExpand,a},e.type="series.tree",e.layoutMode="box",e.defaultOption={z:2,coordinateSystem:"view",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:"#ccc",width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},e}(Vt);function z5(r,e,t){for(var a=[r],n=[],i;i=a.pop();)if(n.push(i),i.isExpand){var o=i.children;if(o.length)for(var s=0;s=0;i--)t.push(n[i])}}function G5(r,e){r.eachSeriesByType("tree",function(t){F5(t,e)})}function F5(r,e){var t=S5(r,e);r.layoutInfo=t;var a=r.get("layout"),n=0,i=0,o=null;a==="radial"?(n=2*Math.PI,i=Math.min(t.height,t.width)/2,o=Q1(function(_,S){return(_.parentNode===S.parentNode?1:2)/_.depth})):(n=t.width,i=t.height,o=Q1());var s=r.getData().tree.root,l=s.children[0];if(l){y5(s),z5(l,m5,o),s.hierNode.modifier=-l.hierNode.prelim,Xo(l,_5);var u=l,f=l,h=l;Xo(l,function(_){var S=_.getLayout().x;Sf.getLayout().x&&(f=_),_.depth>h.depth&&(h=_)});var v=u===f?1:o(u,f)/2,c=v-u.getLayout().x,p=0,d=0,g=0,y=0;if(a==="radial")p=n/(f.getLayout().x+v+c),d=i/(h.depth-1||1),Xo(l,function(_){g=(_.getLayout().x+c)*p,y=(_.depth-1)*d;var S=ls(g,y);_.setLayout({x:S.x,y:S.y,rawX:g,rawY:y},!0)});else{var m=r.getOrient();m==="RL"||m==="LR"?(d=i/(f.getLayout().x+v+c),p=n/(h.depth-1||1),Xo(l,function(_){y=(_.getLayout().x+c)*d,g=m==="LR"?(_.depth-1)*p:n-(_.depth-1)*p,_.setLayout({x:g,y},!0)})):(m==="TB"||m==="BT")&&(p=n/(f.getLayout().x+v+c),d=i/(h.depth-1||1),Xo(l,function(_){g=(_.getLayout().x+c)*p,y=m==="TB"?(_.depth-1)*d:i-(_.depth-1)*d,_.setLayout({x:g,y},!0)}))}}}function H5(r){r.eachSeriesByType("tree",function(e){var t=e.getData(),a=t.tree;a.eachNode(function(n){var i=n.getModel(),o=i.getModel("itemStyle").getItemStyle(),s=t.ensureUniqueItemVisual(n.dataIndex,"style");V(s,o)})})}function W5(r){r.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(e,t){t.eachComponent({mainType:"series",subType:"tree",query:e},function(a){var n=e.dataIndex,i=a.getData().tree,o=i.getNodeByDataIndex(n);o.isExpand=!o.isExpand})}),r.registerAction({type:"treeRoam",event:"treeRoam",update:"none"},function(e,t,a){t.eachComponent({mainType:"series",subType:"tree",query:e},function(n){var i=n.coordinateSystem,o=iy(i,e,void 0,a);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}function U5(r){r.registerChartView(M5),r.registerSeriesModel(V5),r.registerLayout(G5),r.registerVisual(H5),W5(r)}var aS=["treemapZoomToNode","treemapRender","treemapMove"];function Y5(r){for(var e=0;e1;)i=i.parentNode;var o=zp(r.ecModel,i.name||i.dataIndex+"",a);n.setVisual("decal",o)})}var X5=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.preventUsingHoverLayer=!0,t}return e.prototype.getInitialData=function(t,a){var n={name:t.name,children:t.data};zD(n);var i=t.levels||[],o=this.designatedVisualItemStyle={},s=new Mt({itemStyle:o},this,a);i=t.levels=Z5(i,a);var l=G(i||[],function(h){return new Mt(h,s,a)},this),u=sy.createTree(n,this,f);function f(h){h.wrapMethod("getItemModel",function(v,c){var p=u.getNodeByDataIndex(c),d=p?l[p.depth]:null;return v.parentModel=d||s,v})}return u.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.formatTooltip=function(t,a,n){var i=this.getData(),o=this.getRawValue(t),s=i.getName(t);return ie("nameValue",{name:s,value:o})},e.prototype.getDataParams=function(t){var a=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return a.treeAncestors=Ah(n,this),a.treePathInfo=a.treeAncestors,a},e.prototype.setLayoutInfo=function(t){this.layoutInfo=this.layoutInfo||{},V(this.layoutInfo,t)},e.prototype.mapIdToIndex=function(t){var a=this._idIndexMap;a||(a=this._idIndexMap=$(),this._idIndexMapCount=0);var n=a.get(t);return n==null&&a.set(t,n=this._idIndexMapCount++),n},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var a=this.getRawData().tree.root;(!t||t!==a&&!a.contains(t))&&(this._viewRoot=a)},e.prototype.enableAriaDecal=function(){VD(this)},e.type="series.treemap",e.layoutMode="box",e.defaultOption={progressive:0,left:"center",top:"middle",width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.32*.32,scaleLimit:null,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{color:"rgba(0,0,0,0.7)",textStyle:{color:"#fff"}},emphasis:{itemStyle:{color:"rgba(0,0,0,0.9)"}}},label:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},e}(Vt);function zD(r){var e=0;D(r.children,function(a){zD(a);var n=a.value;z(n)&&(n=n[0]),e+=n});var t=r.value;z(t)&&(t=t[0]),(t==null||isNaN(t))&&(t=e),t<0&&(t=0),z(r.value)?r.value[0]=t:r.value=t}function Z5(r,e){var t=Pt(e.get("color")),a=Pt(e.get(["aria","decal","decals"]));if(t){r=r||[];var n,i;D(r,function(s){var l=new Mt(s),u=l.get("color"),f=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(n=!0),(l.get(["itemStyle","decal"])||f&&f!=="none")&&(i=!0)});var o=r[0]||(r[0]={});return n||(o.color=t.slice()),!i&&a&&(o.decal=a.slice()),r}}var $5=8,nS=8,ic=5,q5=function(){function r(e){this.group=new at,e.add(this.group)}return r.prototype.render=function(e,t,a,n){var i=e.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!i.get("show")||!a)){var s=i.getModel("itemStyle"),l=i.getModel("emphasis"),u=s.getModel("textStyle"),f=l.getModel(["itemStyle","textStyle"]),h={pos:{left:i.get("left"),right:i.get("right"),top:i.get("top"),bottom:i.get("bottom")},box:{width:t.getWidth(),height:t.getHeight()},emptyItemWidth:i.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(a,h,u),this._renderContent(e,h,s,l,u,f,n),vh(o,h.pos,h.box)}},r.prototype._prepare=function(e,t,a){for(var n=e;n;n=n.parentNode){var i=Jt(n.getModel().get("name"),""),o=a.getTextRect(i),s=Math.max(o.width+$5*2,t.emptyItemWidth);t.totalWidth+=s+nS,t.renderList.push({node:n,text:i,width:s})}},r.prototype._renderContent=function(e,t,a,n,i,o,s){for(var l=0,u=t.emptyItemWidth,f=e.get(["breadcrumb","height"]),h=aE(t.pos,t.box),v=t.totalWidth,c=t.renderList,p=n.getModel("itemStyle").getItemStyle(),d=c.length-1;d>=0;d--){var g=c[d],y=g.node,m=g.width,_=g.text;v>h.width&&(v-=m-u,m=u,_=null);var S=new Ie({shape:{points:K5(l,0,m,f,d===c.length-1,d===0)},style:j(a.getItemStyle(),{lineJoin:"bevel"}),textContent:new bt({style:Bt(i,{text:_})}),textConfig:{position:"inside"},z2:vo*1e4,onclick:lt(s,y)});S.disableLabelAnimation=!0,S.getTextContent().ensureState("emphasis").style=Bt(o,{text:_}),S.ensureState("emphasis").style=p,Ht(S,n.get("focus"),n.get("blurScope"),n.get("disabled")),this.group.add(S),J5(S,e,y),l+=m+nS}},r.prototype.remove=function(){this.group.removeAll()},r}();function K5(r,e,t,a,n,i){var o=[[n?r:r-ic,e],[r+t,e],[r+t,e+a],[n?r:r-ic,e+a]];return!i&&o.splice(2,0,[r+t+ic,e+a/2]),!n&&o.push([r,e+a/2]),o}function J5(r,e,t){nt(r).eventData={componentType:"series",componentSubType:"treemap",componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:t&&t.dataIndex,name:t&&t.name},treePathInfo:t&&Ah(t,e)}}var Q5=function(){function r(){this._storage=[],this._elExistsMap={}}return r.prototype.add=function(e,t,a,n,i){return this._elExistsMap[e.id]?!1:(this._elExistsMap[e.id]=!0,this._storage.push({el:e,target:t,duration:a,delay:n,easing:i}),!0)},r.prototype.finished=function(e){return this._finishedCallback=e,this},r.prototype.start=function(){for(var e=this,t=this._storage.length,a=function(){t--,t<=0&&(e._storage.length=0,e._elExistsMap={},e._finishedCallback&&e._finishedCallback())},n=0,i=this._storage.length;noS||Math.abs(t.dy)>oS)){var a=this.seriesModel.getData().tree.root;if(!a)return;var n=a.getLayout();if(!n)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+t.dx,y:n.y+t.dy,width:n.width,height:n.height}})}},e.prototype._onZoom=function(t){var a=t.originX,n=t.originY,i=t.scale;if(this._state!=="animating"){var o=this.seriesModel.getData().tree.root;if(!o)return;var s=o.getLayout();if(!s)return;var l=new ht(s.x,s.y,s.width,s.height),u=null,f=this._controllerHost;u=f.zoomLimit;var h=f.zoom=f.zoom||1;if(h*=i,u){var v=u.min||0,c=u.max||1/0;h=Math.max(Math.min(c,h),v)}var p=h/f.zoom;f.zoom=h;var d=this.seriesModel.layoutInfo;a-=d.x,n-=d.y;var g=Fe();Fr(g,g,[-a,-n]),Qd(g,g,[p,p]),Fr(g,g,[a,n]),l.applyTransform(g),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:l.x,y:l.y,width:l.width,height:l.height}})}},e.prototype._initEvents=function(t){var a=this;t.on("click",function(n){if(a._state==="ready"){var i=a.seriesModel.get("nodeClick",!0);if(i){var o=a.findTarget(n.offsetX,n.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)a._rootToNode(o);else if(i==="zoomToNode")a._zoomToNode(o);else if(i==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),f=l.get("target",!0)||"blank";u&&hf(u,f)}}}}},this)},e.prototype._renderBreadcrumb=function(t,a,n){var i=this;n||(n=t.get("leafDepth",!0)!=null?{node:t.getViewRoot()}:this.findTarget(a.getWidth()/2,a.getHeight()/2),n||(n={node:t.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new q5(this.group))).render(t,a,n.node,function(o){i._state!=="animating"&&(ly(t.getViewRoot(),o)?i._rootToNode({node:o}):i._zoomToNode({node:o}))})},e.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=Zo(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},e.prototype.dispose=function(){this._clearController()},e.prototype._zoomToNode=function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},e.prototype._rootToNode=function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},e.prototype.findTarget=function(t,a){var n,i=this.seriesModel.getViewRoot();return i.eachNode({attr:"viewChildren",order:"preorder"},function(o){var s=this._storage.background[o.getRawIndex()];if(s){var l=s.transformCoordToLocal(t,a),u=s.shape;if(u.x<=l[0]&&l[0]<=u.x+u.width&&u.y<=l[1]&&l[1]<=u.y+u.height)n={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),n},e.type="treemap",e}(Rt);function Zo(){return{nodeGroup:[],background:[],content:[]}}function nG(r,e,t,a,n,i,o,s,l,u){if(!o)return;var f=o.getLayout(),h=r.getData(),v=o.getModel();if(h.setItemGraphicEl(o.dataIndex,null),!f||!f.isInView)return;var c=f.width,p=f.height,d=f.borderWidth,g=f.invisible,y=o.getRawIndex(),m=s&&s.getRawIndex(),_=o.viewChildren,S=f.upperHeight,b=_&&_.length,x=v.getModel("itemStyle"),w=v.getModel(["emphasis","itemStyle"]),T=v.getModel(["blur","itemStyle"]),A=v.getModel(["select","itemStyle"]),C=x.get("borderRadius")||0,M=it("nodeGroup",vd);if(!M)return;if(l.add(M),M.x=f.x||0,M.y=f.y||0,M.markRedraw(),Df(M).nodeWidth=c,Df(M).nodeHeight=p,f.isAboveViewRoot)return M;var I=it("background",iS,u,eG);I&&F(M,I,b&&f.upperLabelHeight);var L=v.getModel("emphasis"),P=L.get("focus"),R=L.get("blurScope"),E=L.get("disabled"),N=P==="ancestor"?o.getAncestorsIndices():P==="descendant"?o.getDescendantIndices():P;if(b)Ns(M)&&Vn(M,!1),I&&(Vn(I,!E),h.setItemGraphicEl(o.dataIndex,I),Pp(I,N,R));else{var O=it("content",iS,u,rG);O&&H(M,O),I.disableMorphing=!0,I&&Ns(I)&&Vn(I,!1),Vn(M,!E),h.setItemGraphicEl(o.dataIndex,M);var B=v.getShallow("cursor");B&&O.attr("cursor",B),Pp(M,N,R)}return M;function F(vt,tt,pt){var q=nt(tt);if(q.dataIndex=o.dataIndex,q.seriesIndex=r.seriesIndex,tt.setShape({x:0,y:0,width:c,height:p,r:C}),g)U(tt);else{tt.invisible=!1;var ot=o.getVisual("style"),Ot=ot.stroke,It=uS(x);It.fill=Ot;var Et=Mn(w);Et.fill=w.get("borderColor");var Gt=Mn(T);Gt.fill=T.get("borderColor");var jt=Mn(A);if(jt.fill=A.get("borderColor"),pt){var Ve=c-2*d;K(tt,Ot,ot.opacity,{x:d,y:0,width:Ve,height:S})}else tt.removeTextContent();tt.setStyle(It),tt.ensureState("emphasis").style=Et,tt.ensureState("blur").style=Gt,tt.ensureState("select").style=jt,ri(tt)}vt.add(tt)}function H(vt,tt){var pt=nt(tt);pt.dataIndex=o.dataIndex,pt.seriesIndex=r.seriesIndex;var q=Math.max(c-2*d,0),ot=Math.max(p-2*d,0);if(tt.culling=!0,tt.setShape({x:d,y:d,width:q,height:ot,r:C}),g)U(tt);else{tt.invisible=!1;var Ot=o.getVisual("style"),It=Ot.fill,Et=uS(x);Et.fill=It,Et.decal=Ot.decal;var Gt=Mn(w),jt=Mn(T),Ve=Mn(A);K(tt,It,Ot.opacity,null),tt.setStyle(Et),tt.ensureState("emphasis").style=Gt,tt.ensureState("blur").style=jt,tt.ensureState("select").style=Ve,ri(tt)}vt.add(tt)}function U(vt){!vt.invisible&&i.push(vt)}function K(vt,tt,pt,q){var ot=v.getModel(q?lS:sS),Ot=Jt(v.get("name"),null),It=ot.getShallow("show");ve(vt,ne(v,q?lS:sS),{defaultText:It?Ot:null,inheritColor:tt,defaultOpacity:pt,labelFetcher:r,labelDataIndex:o.dataIndex});var Et=vt.getTextContent();if(Et){var Gt=Et.style,jt=qd(Gt.padding||0);q&&(vt.setTextConfig({layoutRect:q}),Et.disableLabelLayout=!0),Et.beforeUpdate=function(){var Pe=Math.max((q?q.width:vt.shape.width)-jt[1]-jt[3],0),tn=Math.max((q?q.height:vt.shape.height)-jt[0]-jt[2],0);(Gt.width!==Pe||Gt.height!==tn)&&Et.setStyle({width:Pe,height:tn})},Gt.truncateMinChar=2,Gt.lineOverflow="truncate",Q(Gt,q,f);var Ve=Et.getState("emphasis");Q(Ve?Ve.style:null,q,f)}}function Q(vt,tt,pt){var q=vt?vt.text:null;if(!tt&&pt.isLeafRoot&&q!=null){var ot=r.get("drillDownIcon",!0);vt.text=ot?ot+" "+q:q}}function it(vt,tt,pt,q){var ot=m!=null&&t[vt][m],Ot=n[vt];return ot?(t[vt][m]=null,Lt(Ot,ot)):g||(ot=new tt,ot instanceof ir&&(ot.z2=iG(pt,q)),Wt(Ot,ot)),e[vt][y]=ot}function Lt(vt,tt){var pt=vt[y]={};tt instanceof vd?(pt.oldX=tt.x,pt.oldY=tt.y):pt.oldShape=V({},tt.shape)}function Wt(vt,tt){var pt=vt[y]={},q=o.parentNode,ot=tt instanceof at;if(q&&(!a||a.direction==="drillDown")){var Ot=0,It=0,Et=n.background[q.getRawIndex()];!a&&Et&&Et.oldShape&&(Ot=Et.oldShape.width,It=Et.oldShape.height),ot?(pt.oldX=0,pt.oldY=It):pt.oldShape={x:Ot,y:It,width:0,height:0}}pt.fadein=!ot}}function iG(r,e){return r*tG+e}var Ks=D,oG=et,Mf=-1,ae=function(){function r(e){var t=e.mappingMethod,a=e.type,n=this.option=rt(e);this.type=a,this.mappingMethod=t,this._normalizeData=uG[t];var i=r.visualHandlers[a];this.applyVisual=i.applyVisual,this.getColorMapper=i.getColorMapper,this._normalizedToVisual=i._normalizedToVisual[t],t==="piecewise"?(oc(n),sG(n)):t==="category"?n.categories?lG(n):oc(n,!0):(Ce(t!=="linear"||n.dataExtent),oc(n))}return r.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},r.prototype.getNormalizer=function(){return X(this._normalizeData,this)},r.listVisualTypes=function(){return _t(r.visualHandlers)},r.isValidType=function(e){return r.visualHandlers.hasOwnProperty(e)},r.eachVisual=function(e,t,a){et(e)?D(e,t,a):t.call(a,e)},r.mapVisual=function(e,t,a){var n,i=z(e)?[]:et(e)?{}:(n=!0,null);return r.eachVisual(e,function(o,s){var l=t.call(a,o,s);n?i=l:i[s]=l}),i},r.retrieveVisuals=function(e){var t={},a;return e&&Ks(r.visualHandlers,function(n,i){e.hasOwnProperty(i)&&(t[i]=e[i],a=!0)}),a?t:null},r.prepareVisualTypes=function(e){if(z(e))e=e.slice();else if(oG(e)){var t=[];Ks(e,function(a,n){t.push(n)}),e=t}else return[];return e.sort(function(a,n){return n==="color"&&a!=="color"&&a.indexOf("color")===0?1:-1}),e},r.dependsOn=function(e,t){return t==="color"?!!(e&&e.indexOf(t)===0):e===t},r.findPieceIndex=function(e,t,a){for(var n,i=1/0,o=0,s=t.length;o=0;i--)a[i]==null&&(delete t[e[i]],e.pop())}function oc(r,e){var t=r.visual,a=[];et(t)?Ks(t,function(i){a.push(i)}):t!=null&&a.push(t);var n={color:1,symbol:1};!e&&a.length===1&&!n.hasOwnProperty(r.type)&&(a[1]=a[0]),GD(r,a)}function vu(r){return{applyVisual:function(e,t,a){var n=this.mapValueToVisual(e);a("color",r(t("color"),n))},_normalizedToVisual:cd([0,1])}}function fS(r){var e=this.option.visual;return e[Math.round(Dt(r,[0,1],[0,e.length-1],!0))]||{}}function $o(r){return function(e,t,a){a(r,this.mapValueToVisual(e))}}function us(r){var e=this.option.visual;return e[this.option.loop&&r!==Mf?r%e.length:r]}function In(){return this.option.visual[0]}function cd(r){return{linear:function(e){return Dt(e,r,this.option.visual,!0)},category:us,piecewise:function(e,t){var a=pd.call(this,t);return a==null&&(a=Dt(e,r,this.option.visual,!0)),a},fixed:In}}function pd(r){var e=this.option,t=e.pieceList;if(e.hasSpecialVisual){var a=ae.findPieceIndex(r,t),n=t[a];if(n&&n.visual)return n.visual[this.type]}}function GD(r,e){return r.visual=e,r.type==="color"&&(r.parsedVisual=G(e,function(t){var a=He(t);return a||[0,0,0,1]})),e}var uG={linear:function(r){return Dt(r,this.option.dataExtent,[0,1],!0)},piecewise:function(r){var e=this.option.pieceList,t=ae.findPieceIndex(r,e,!0);if(t!=null)return Dt(t,[0,e.length-1],[0,1],!0)},category:function(r){var e=this.option.categories?this.option.categoryMap[r]:r;return e??Mf},fixed:Xt};function cu(r,e,t){return r?e<=t:e=t.length||d===t[d.depth]){var y=dG(n,l,d,g,p,a);HD(d,y,t,a)}})}}}function vG(r,e,t){var a=V({},e),n=t.designatedVisualItemStyle;return D(["color","colorAlpha","colorSaturation"],function(i){n[i]=e[i];var o=r.get(i);n[i]=null,o!=null&&(a[i]=o)}),a}function hS(r){var e=sc(r,"color");if(e){var t=sc(r,"colorAlpha"),a=sc(r,"colorSaturation");return a&&(e=ps(e,null,null,a)),t&&(e=Qu(e,t)),e}}function cG(r,e){return e!=null?ps(e,null,null,r):null}function sc(r,e){var t=r[e];if(t!=null&&t!=="none")return t}function pG(r,e,t,a,n,i){if(!(!i||!i.length)){var o=lc(e,"color")||n.color!=null&&n.color!=="none"&&(lc(e,"colorAlpha")||lc(e,"colorSaturation"));if(o){var s=e.get("visualMin"),l=e.get("visualMax"),u=t.dataExtent.slice();s!=null&&su[1]&&(u[1]=l);var f=e.get("colorMappingBy"),h={type:o.name,dataExtent:u,visual:o.range};h.type==="color"&&(f==="index"||f==="id")?(h.mappingMethod="category",h.loop=!0):h.mappingMethod="linear";var v=new ae(h);return FD(v).drColorMappingBy=f,v}}}function lc(r,e){var t=r.get(e);return z(t)&&t.length?{name:e,range:t}:null}function dG(r,e,t,a,n,i){var o=V({},e);if(n){var s=n.type,l=s==="color"&&FD(n).drColorMappingBy,u=l==="index"?a:l==="id"?i.mapIdToIndex(t.getId()):t.getValue(r.get("visualDimension"));o[s]=n.mapValueToVisual(u)}return o}var Js=Math.max,If=Math.min,vS=se,uy=D,WD=["itemStyle","borderWidth"],gG=["itemStyle","gapWidth"],yG=["upperLabel","show"],mG=["upperLabel","height"];const _G={seriesType:"treemap",reset:function(r,e,t,a){var n=t.getWidth(),i=t.getHeight(),o=r.option,s=Qt(r.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),l=o.size||[],u=W(vS(s.width,l[0]),n),f=W(vS(s.height,l[1]),i),h=a&&a.type,v=["treemapZoomToNode","treemapRootToNode"],c=qs(a,v,r),p=h==="treemapRender"||h==="treemapMove"?a.rootRect:null,d=r.getViewRoot(),g=BD(d);if(h!=="treemapMove"){var y=h==="treemapZoomToNode"?AG(r,c,d,u,f):p?[p.width,p.height]:[u,f],m=o.sort;m&&m!=="asc"&&m!=="desc"&&(m="desc");var _={squareRatio:o.squareRatio,sort:m,leafDepth:o.leafDepth};d.hostTree.clearLayouts();var S={x:0,y:0,width:y[0],height:y[1],area:y[0]*y[1]};d.setLayout(S),UD(d,_,!1,0),S=d.getLayout(),uy(g,function(x,w){var T=(g[w+1]||d).getValue();x.setLayout(V({dataExtent:[T,T],borderWidth:0,upperHeight:0},S))})}var b=r.getData().tree.root;b.setLayout(CG(s,p,c),!0),r.setLayoutInfo(s),YD(b,new ht(-s.x,-s.y,n,i),g,d,0)}};function UD(r,e,t,a){var n,i;if(!r.isRemoved()){var o=r.getLayout();n=o.width,i=o.height;var s=r.getModel(),l=s.get(WD),u=s.get(gG)/2,f=XD(s),h=Math.max(l,f),v=l-u,c=h-u;r.setLayout({borderWidth:l,upperHeight:h,upperLabelHeight:f},!0),n=Js(n-2*v,0),i=Js(i-v-c,0);var p=n*i,d=SG(r,s,p,e,t,a);if(d.length){var g={x:v,y:c,width:n,height:i},y=If(n,i),m=1/0,_=[];_.area=0;for(var S=0,b=d.length;S=0;l--){var u=n[a==="asc"?o-l-1:l].getValue();u/t*es[1]&&(s[1]=u)})),{sum:a,dataExtent:s}}function TG(r,e,t){for(var a=0,n=1/0,i=0,o=void 0,s=r.length;ia&&(a=o));var l=r.area*r.area,u=e*e*t;return l?Js(u*a/l,l/(u*n)):1/0}function cS(r,e,t,a,n){var i=e===t.width?0:1,o=1-i,s=["x","y"],l=["width","height"],u=t[s[i]],f=e?r.area/e:0;(n||f>t[l[o]])&&(f=t[l[o]]);for(var h=0,v=r.length;hCm&&(u=Cm),i=s}ua&&(a=e);var i=a%2?a+2:a+3;n=[];for(var o=0;o0&&(b[0]=-b[0],b[1]=-b[1]);var w=S[0]<0?-1:1;if(i.__position!=="start"&&i.__position!=="end"){var T=-Math.atan2(S[1],S[0]);h[0].8?"left":v[0]<-.8?"right":"center",d=v[1]>.8?"top":v[1]<-.8?"bottom":"middle";break;case"start":i.x=-v[0]*y+f[0],i.y=-v[1]*m+f[1],p=v[0]>.8?"right":v[0]<-.8?"left":"center",d=v[1]>.8?"bottom":v[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=y*w+f[0],i.y=f[1]+A,p=S[0]<0?"right":"left",i.originX=-y*w,i.originY=-A;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=x[0],i.y=x[1]+A,p="center",i.originY=-A;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-y*w+h[0],i.y=h[1]+A,p=S[0]>=0?"right":"left",i.originX=y*w,i.originY=-A;break}i.scaleX=i.scaleY=o,i.setStyle({verticalAlign:i.__verticalAlign||d,align:i.__align||p})}},e}(at),py=function(){function r(e){this.group=new at,this._LineCtor=e||cy}return r.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var a=this,n=a.group,i=a._lineData;a._lineData=e,i||n.removeAll();var o=_S(e);e.diff(i).add(function(s){t._doAdd(e,s,o)}).update(function(s,l){t._doUpdate(i,e,l,s,o)}).remove(function(s){n.remove(i.getItemGraphicEl(s))}).execute()},r.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,a){t.updateLayout(e,a)},this)},r.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=_S(e),this._lineData=null,this.group.removeAll()},r.prototype.incrementalUpdate=function(e,t){this._progressiveEls=[];function a(s){!s.isGroup&&!UG(s)&&(s.incremental=!0,s.ensureState("emphasis").hoverLayer=!0)}for(var n=e.start;n0}function _S(r){var e=r.hostModel,t=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:t.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:t.get("disabled"),blurScope:t.get("blurScope"),focus:t.get("focus"),labelStatesModels:ne(e)}}function SS(r){return isNaN(r[0])||isNaN(r[1])}function cc(r){return r&&!SS(r[0])&&!SS(r[1])}var pc=[],dc=[],gc=[],Li=oe,yc=Un,xS=Math.abs;function bS(r,e,t){for(var a=r[0],n=r[1],i=r[2],o=1/0,s,l=t*t,u=.1,f=.1;f<=.9;f+=.1){pc[0]=Li(a[0],n[0],i[0],f),pc[1]=Li(a[1],n[1],i[1],f);var h=xS(yc(pc,e)-l);h=0?s=s+u:s=s-u:p>=0?s=s-u:s=s+u}return s}function mc(r,e){var t=[],a=Ls,n=[[],[],[]],i=[[],[]],o=[];e/=2,r.eachEdge(function(s,l){var u=s.getLayout(),f=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[ea(u[0]),ea(u[1])],u[2]&&u.__original.push(ea(u[2])));var v=u.__original;if(u[2]!=null){if(Se(n[0],v[0]),Se(n[1],v[2]),Se(n[2],v[1]),f&&f!=="none"){var c=hs(s.node1),p=bS(n,v[0],c*e);a(n[0][0],n[1][0],n[2][0],p,t),n[0][0]=t[3],n[1][0]=t[4],a(n[0][1],n[1][1],n[2][1],p,t),n[0][1]=t[3],n[1][1]=t[4]}if(h&&h!=="none"){var c=hs(s.node2),p=bS(n,v[1],c*e);a(n[0][0],n[1][0],n[2][0],p,t),n[1][0]=t[1],n[2][0]=t[2],a(n[0][1],n[1][1],n[2][1],p,t),n[1][1]=t[1],n[2][1]=t[2]}Se(u[0],n[0]),Se(u[1],n[2]),Se(u[2],n[1])}else{if(Se(i[0],v[0]),Se(i[1],v[1]),Nn(o,i[1],i[0]),uo(o,o),f&&f!=="none"){var c=hs(s.node1);rp(i[0],i[0],o,c*e)}if(h&&h!=="none"){var c=hs(s.node2);rp(i[1],i[1],o,-c*e)}Se(u[0],i[0]),Se(u[1],i[1])}})}function wS(r){return r.type==="view"}var YG=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,a){var n=new yl,i=new py,o=this.group;this._controller=new bl(a.getZr()),this._controllerHost={target:o},o.add(n.group),o.add(i.group),this._symbolDraw=n,this._lineDraw=i,this._firstRender=!0},e.prototype.render=function(t,a,n){var i=this,o=t.coordinateSystem;this._model=t;var s=this._symbolDraw,l=this._lineDraw,u=this.group;if(wS(o)){var f={x:o.x,y:o.y,scaleX:o.scaleX,scaleY:o.scaleY};this._firstRender?u.attr(f):Tt(u,f,t)}mc(t.getGraph(),fs(t));var h=t.getData();s.updateData(h);var v=t.getEdgeData();l.updateData(v),this._updateNodeAndLinkScale(),this._updateController(t,a,n),clearTimeout(this._layoutTimeout);var c=t.forceLayout,p=t.get(["force","layoutAnimation"]);c&&this._startForceLayoutIteration(c,p);var d=t.get("layout");h.graph.eachNode(function(_){var S=_.dataIndex,b=_.getGraphicEl(),x=_.getModel();if(b){b.off("drag").off("dragend");var w=x.get("draggable");w&&b.on("drag",function(A){switch(d){case"force":c.warmUp(),!i._layouting&&i._startForceLayoutIteration(c,p),c.setFixed(S),h.setItemLayout(S,[b.x,b.y]);break;case"circular":h.setItemLayout(S,[b.x,b.y]),_.setLayout({fixed:!0},!0),vy(t,"symbolSize",_,[A.offsetX,A.offsetY]),i.updateLayout(t);break;case"none":default:h.setItemLayout(S,[b.x,b.y]),hy(t.getGraph(),t),i.updateLayout(t);break}}).on("dragend",function(){c&&c.setUnfixed(S)}),b.setDraggable(w,!!x.get("cursor"));var T=x.get(["emphasis","focus"]);T==="adjacency"&&(nt(b).focus=_.getAdjacentDataIndices())}}),h.graph.eachEdge(function(_){var S=_.getGraphicEl(),b=_.getModel().get(["emphasis","focus"]);S&&b==="adjacency"&&(nt(S).focus={edge:[_.dataIndex],node:[_.node1.dataIndex,_.node2.dataIndex]})});var g=t.get("layout")==="circular"&&t.get(["circular","rotateLabel"]),y=h.getLayout("cx"),m=h.getLayout("cy");h.graph.eachNode(function(_){KD(_,g,y,m)}),this._firstRender=!1},e.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype._startForceLayoutIteration=function(t,a){var n=this;(function i(){t.step(function(o){n.updateLayout(n._model),(n._layouting=!o)&&(a?n._layoutTimeout=setTimeout(i,16):i())})})()},e.prototype._updateController=function(t,a,n){var i=this,o=this._controller,s=this._controllerHost,l=this.group;if(o.setPointerChecker(function(u,f,h){var v=l.getBoundingRect();return v.applyTransform(l.transform),v.contain(f,h)&&!wh(u,n,t)}),!wS(t.coordinateSystem)){o.disable();return}o.enable(t.get("roam")),s.zoomLimit=t.get("scaleLimit"),s.zoom=t.coordinateSystem.getZoom(),o.off("pan").off("zoom").on("pan",function(u){ry(s,u.dx,u.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:u.dx,dy:u.dy})}).on("zoom",function(u){ay(s,u.scale,u.originX,u.originY),n.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:u.scale,originX:u.originX,originY:u.originY}),i._updateNodeAndLinkScale(),mc(t.getGraph(),fs(t)),i._lineDraw.updateLayout(),n.updateLabelLayout()})},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,a=t.getData(),n=fs(t);a.eachItemGraphicEl(function(i,o){i&&i.setSymbolScale(n)})},e.prototype.updateLayout=function(t){mc(t.getGraph(),fs(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},e.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},e.type="graph",e}(Rt);function Pi(r){return"_EC_"+r}var XG=function(){function r(e){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=e||!1}return r.prototype.isDirected=function(){return this._directed},r.prototype.addNode=function(e,t){e=e==null?""+t:""+e;var a=this._nodesMap;if(!a[Pi(e)]){var n=new Ln(e,t);return n.hostGraph=this,this.nodes.push(n),a[Pi(e)]=n,n}},r.prototype.getNodeByIndex=function(e){var t=this.data.getRawIndex(e);return this.nodes[t]},r.prototype.getNodeById=function(e){return this._nodesMap[Pi(e)]},r.prototype.addEdge=function(e,t,a){var n=this._nodesMap,i=this._edgesMap;if(wt(e)&&(e=this.nodes[e]),wt(t)&&(t=this.nodes[t]),e instanceof Ln||(e=n[Pi(e)]),t instanceof Ln||(t=n[Pi(t)]),!(!e||!t)){var o=e.id+"-"+t.id,s=new QD(e,t,a);return s.hostGraph=this,this._directed&&(e.outEdges.push(s),t.inEdges.push(s)),e.edges.push(s),e!==t&&t.edges.push(s),this.edges.push(s),i[o]=s,s}},r.prototype.getEdgeByIndex=function(e){var t=this.edgeData.getRawIndex(e);return this.edges[t]},r.prototype.getEdge=function(e,t){e instanceof Ln&&(e=e.id),t instanceof Ln&&(t=t.id);var a=this._edgesMap;return this._directed?a[e+"-"+t]:a[e+"-"+t]||a[t+"-"+e]},r.prototype.eachNode=function(e,t){for(var a=this.nodes,n=a.length,i=0;i=0&&e.call(t,a[i],i)},r.prototype.eachEdge=function(e,t){for(var a=this.edges,n=a.length,i=0;i=0&&a[i].node1.dataIndex>=0&&a[i].node2.dataIndex>=0&&e.call(t,a[i],i)},r.prototype.breadthFirstTraverse=function(e,t,a,n){if(t instanceof Ln||(t=this._nodesMap[Pi(t)]),!!t){for(var i=a==="out"?"outEdges":a==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var i=0,o=n.length;i=0&&this[r][e].setItemVisual(this.dataIndex,t,a)},getVisual:function(t){return this[r][e].getItemVisual(this.dataIndex,t)},setLayout:function(t,a){this.dataIndex>=0&&this[r][e].setItemLayout(this.dataIndex,t,a)},getLayout:function(){return this[r][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[r][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[r][e].getRawIndex(this.dataIndex)}}}Kt(Ln,jD("hostGraph","data"));Kt(QD,jD("hostGraph","edgeData"));function tM(r,e,t,a,n){for(var i=new XG(a),o=0;o "+v)),u++)}var c=t.get("coordinateSystem"),p;if(c==="cartesian2d"||c==="polar")p=ga(r,t);else{var d=vl.get(c),g=d?d.dimensions||[]:[];ct(g,"value")<0&&g.concat(["value"]);var y=pl(r,{coordDimensions:g,encodeDefine:t.getEncode()}).dimensions;p=new Te(y,t),p.initData(r)}var m=new Te(["value"],t);return m.initData(l,s),n&&n(p,m),OD({mainData:p,struct:i,structAttr:"graph",datas:{node:p,edge:m},datasAttr:{node:"data",edge:"edgeData"}}),i.update(),i}var ZG=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments);var a=this;function n(){return a._categoriesData}this.legendVisualProvider=new xl(n,n),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},e.prototype.mergeDefaultAndTheme=function(t){r.prototype.mergeDefaultAndTheme.apply(this,arguments),jn(t,"edgeLabel",["show"])},e.prototype.getInitialData=function(t,a){var n=t.edges||t.links||[],i=t.data||t.nodes||[],o=this;if(i&&n){EG(this);var s=tM(i,n,this,!0,l);return D(s.edges,function(u){kG(u.node1,u.node2,this,u.dataIndex)},this),s.data}function l(u,f){u.wrapMethod("getItemModel",function(p){var d=o._categoriesModels,g=p.getShallow("category"),y=d[g];return y&&(y.parentModel=p.parentModel,p.parentModel=y),p});var h=Mt.prototype.getModel;function v(p,d){var g=h.call(this,p,d);return g.resolveParentPath=c,g}f.wrapMethod("getItemModel",function(p){return p.resolveParentPath=c,p.getModel=v,p});function c(p){if(p&&(p[0]==="label"||p[1]==="label")){var d=p.slice();return p[0]==="label"?d[0]="edgeLabel":p[1]==="label"&&(d[1]="edgeLabel"),d}return p}}},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.getCategoriesData=function(){return this._categoriesData},e.prototype.formatTooltip=function(t,a,n){if(n==="edge"){var i=this.getData(),o=this.getDataParams(t,n),s=i.graph.getEdgeByIndex(t),l=i.getName(s.node1.dataIndex),u=i.getName(s.node2.dataIndex),f=[];return l!=null&&f.push(l),u!=null&&f.push(u),ie("nameValue",{name:f.join(" > "),value:o.value,noValue:o.value==null})}var h=TA({series:this,dataIndex:t,multipleSeries:a});return h},e.prototype._updateCategoriesData=function(){var t=G(this.option.categories||[],function(n){return n.value!=null?n:V({value:0},n)}),a=new Te(["value"],this);a.initData(t),this._categoriesData=a,this._categoriesModels=a.mapArray(function(n){return a.getItemModel(n)})},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.isAnimationEnabled=function(){return r.prototype.isAnimationEnabled.call(this)&&!(this.get("layout")==="force"&&this.get(["force","layoutAnimation"]))},e.type="series.graph",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(Vt),$G={type:"graphRoam",event:"graphRoam",update:"none"};function qG(r){r.registerChartView(YG),r.registerSeriesModel(ZG),r.registerProcessor(MG),r.registerVisual(IG),r.registerVisual(LG),r.registerLayout(OG),r.registerLayout(r.PRIORITY.VISUAL.POST_CHART_LAYOUT,BG),r.registerLayout(zG),r.registerCoordinateSystem("graphView",{dimensions:wl.dimensions,create:FG}),r.registerAction({type:"focusNodeAdjacency",event:"focusNodeAdjacency",update:"series:focusNodeAdjacency"},Xt),r.registerAction({type:"unfocusNodeAdjacency",event:"unfocusNodeAdjacency",update:"series:unfocusNodeAdjacency"},Xt),r.registerAction($G,function(e,t,a){t.eachComponent({mainType:"series",query:e},function(n){var i=n.coordinateSystem,o=iy(i,e,void 0,a);n.setCenter&&n.setCenter(o.center),n.setZoom&&n.setZoom(o.zoom)})})}var KG=function(){function r(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return r}(),JG=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a.type="pointer",a}return e.prototype.getDefaultShape=function(){return new KG},e.prototype.buildPath=function(t,a){var n=Math.cos,i=Math.sin,o=a.r,s=a.width,l=a.angle,u=a.x-n(l)*s*(s>=o/3?1:2),f=a.y-i(l)*s*(s>=o/3?1:2);l=a.angle-Math.PI/2,t.moveTo(u,f),t.lineTo(a.x+n(l)*s,a.y+i(l)*s),t.lineTo(a.x+n(a.angle)*o,a.y+i(a.angle)*o),t.lineTo(a.x-n(l)*s,a.y-i(l)*s),t.lineTo(u,f)},e}(gt);function QG(r,e){var t=r.get("center"),a=e.getWidth(),n=e.getHeight(),i=Math.min(a,n),o=W(t[0],e.getWidth()),s=W(t[1],e.getHeight()),l=W(r.get("radius"),i/2);return{cx:o,cy:s,r:l}}function du(r,e){var t=r==null?"":r+"";return e&&(Y(e)?t=e.replace("{value}",t):J(e)&&(t=e(r))),t}var jG=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){this.group.removeAll();var i=t.get(["axisLine","lineStyle","color"]),o=QG(t,n);this._renderMain(t,a,n,i,o),this._data=t.getData()},e.prototype.dispose=function(){},e.prototype._renderMain=function(t,a,n,i,o){var s=this.group,l=t.get("clockwise"),u=-t.get("startAngle")/180*Math.PI,f=-t.get("endAngle")/180*Math.PI,h=t.getModel("axisLine"),v=h.get("roundCap"),c=v?Tf:Me,p=h.get("show"),d=h.getModel("lineStyle"),g=d.get("width"),y=[u,f];sg(y,!l),u=y[0],f=y[1];for(var m=f-u,_=u,S=[],b=0;p&&b=A&&(C===0?0:i[C-1][0])Math.PI/2&&(Q+=Math.PI)):K==="tangential"?Q=-T-Math.PI/2:wt(K)&&(Q=K*Math.PI/180),Q===0?h.add(new bt({style:Bt(_,{text:B,x:H,y:U,verticalAlign:R<-.8?"top":R>.8?"bottom":"middle",align:P<-.4?"left":P>.4?"right":"center"},{inheritColor:F}),silent:!0})):h.add(new bt({style:Bt(_,{text:B,x:H,y:U,verticalAlign:"middle",align:"center"},{inheritColor:F}),silent:!0,originX:H,originY:U,rotation:Q}))}if(m.get("show")&&E!==S){var N=m.get("distance");N=N?N+f:f;for(var it=0;it<=b;it++){P=Math.cos(T),R=Math.sin(T);var Lt=new ee({shape:{x1:P*(p-N)+v,y1:R*(p-N)+c,x2:P*(p-w-N)+v,y2:R*(p-w-N)+c},silent:!0,style:I});I.stroke==="auto"&&Lt.setStyle({stroke:i((E+it/b)/S)}),h.add(Lt),T+=C}T-=C}else T+=A}},e.prototype._renderPointer=function(t,a,n,i,o,s,l,u,f){var h=this.group,v=this._data,c=this._progressEls,p=[],d=t.get(["pointer","show"]),g=t.getModel("progress"),y=g.get("show"),m=t.getData(),_=m.mapDimension("value"),S=+t.get("min"),b=+t.get("max"),x=[S,b],w=[s,l];function T(C,M){var I=m.getItemModel(C),L=I.getModel("pointer"),P=W(L.get("width"),o.r),R=W(L.get("length"),o.r),E=t.get(["pointer","icon"]),N=L.get("offsetCenter"),O=W(N[0],o.r),B=W(N[1],o.r),F=L.get("keepAspect"),H;return E?H=qt(E,O-P/2,B-R,P,R,null,F):H=new JG({shape:{angle:-Math.PI/2,width:P,r:R,x:O,y:B}}),H.rotation=-(M+Math.PI/2),H.x=o.cx,H.y=o.cy,H}function A(C,M){var I=g.get("roundCap"),L=I?Tf:Me,P=g.get("overlap"),R=P?g.get("width"):f/m.count(),E=P?o.r-R:o.r-(C+1)*R,N=P?o.r:o.r-C*R,O=new L({shape:{startAngle:s,endAngle:M,cx:o.cx,cy:o.cy,clockwise:u,r0:E,r:N}});return P&&(O.z2=Dt(m.get(_,C),[S,b],[100,0],!0)),O}(y||d)&&(m.diff(v).add(function(C){var M=m.get(_,C);if(d){var I=T(C,s);zt(I,{rotation:-((isNaN(+M)?w[0]:Dt(M,x,w,!0))+Math.PI/2)},t),h.add(I),m.setItemGraphicEl(C,I)}if(y){var L=A(C,s),P=g.get("clip");zt(L,{shape:{endAngle:Dt(M,x,w,P)}},t),h.add(L),Mp(t.seriesIndex,m.dataType,C,L),p[C]=L}}).update(function(C,M){var I=m.get(_,C);if(d){var L=v.getItemGraphicEl(M),P=L?L.rotation:s,R=T(C,P);R.rotation=P,Tt(R,{rotation:-((isNaN(+I)?w[0]:Dt(I,x,w,!0))+Math.PI/2)},t),h.add(R),m.setItemGraphicEl(C,R)}if(y){var E=c[M],N=E?E.shape.endAngle:s,O=A(C,N),B=g.get("clip");Tt(O,{shape:{endAngle:Dt(I,x,w,B)}},t),h.add(O),Mp(t.seriesIndex,m.dataType,C,O),p[C]=O}}).execute(),m.each(function(C){var M=m.getItemModel(C),I=M.getModel("emphasis"),L=I.get("focus"),P=I.get("blurScope"),R=I.get("disabled");if(d){var E=m.getItemGraphicEl(C),N=m.getItemVisual(C,"style"),O=N.fill;if(E instanceof le){var B=E.style;E.useStyle(V({image:B.image,x:B.x,y:B.y,width:B.width,height:B.height},N))}else E.useStyle(N),E.type!=="pointer"&&E.setColor(O);E.setStyle(M.getModel(["pointer","itemStyle"]).getItemStyle()),E.style.fill==="auto"&&E.setStyle("fill",i(Dt(m.get(_,C),x,[0,1],!0))),E.z2EmphasisLift=0,he(E,M),Ht(E,L,P,R)}if(y){var F=p[C];F.useStyle(m.getItemVisual(C,"style")),F.setStyle(M.getModel(["progress","itemStyle"]).getItemStyle()),F.z2EmphasisLift=0,he(F,M),Ht(F,L,P,R)}}),this._progressEls=p)},e.prototype._renderAnchor=function(t,a){var n=t.getModel("anchor"),i=n.get("show");if(i){var o=n.get("size"),s=n.get("icon"),l=n.get("offsetCenter"),u=n.get("keepAspect"),f=qt(s,a.cx-o/2+W(l[0],a.r),a.cy-o/2+W(l[1],a.r),o,o,null,u);f.z2=n.get("showAbove")?1:0,f.setStyle(n.getModel("itemStyle").getItemStyle()),this.group.add(f)}},e.prototype._renderTitleAndDetail=function(t,a,n,i,o){var s=this,l=t.getData(),u=l.mapDimension("value"),f=+t.get("min"),h=+t.get("max"),v=new at,c=[],p=[],d=t.isAnimationEnabled(),g=t.get(["pointer","showAbove"]);l.diff(this._data).add(function(y){c[y]=new bt({silent:!0}),p[y]=new bt({silent:!0})}).update(function(y,m){c[y]=s._titleEls[m],p[y]=s._detailEls[m]}).execute(),l.each(function(y){var m=l.getItemModel(y),_=l.get(u,y),S=new at,b=i(Dt(_,[f,h],[0,1],!0)),x=m.getModel("title");if(x.get("show")){var w=x.get("offsetCenter"),T=o.cx+W(w[0],o.r),A=o.cy+W(w[1],o.r),C=c[y];C.attr({z2:g?0:2,style:Bt(x,{x:T,y:A,text:l.getName(y),align:"center",verticalAlign:"middle"},{inheritColor:b})}),S.add(C)}var M=m.getModel("detail");if(M.get("show")){var I=M.get("offsetCenter"),L=o.cx+W(I[0],o.r),P=o.cy+W(I[1],o.r),R=W(M.get("width"),o.r),E=W(M.get("height"),o.r),N=t.get(["progress","show"])?l.getItemVisual(y,"style").fill:b,C=p[y],O=M.get("formatter");C.attr({z2:g?0:2,style:Bt(M,{x:L,y:P,text:du(_,O),width:isNaN(R)?null:R,height:isNaN(E)?null:E,align:"center",verticalAlign:"middle"},{inheritColor:N})}),MT(C,{normal:M},_,function(F){return du(F,O)}),d&&IT(C,y,l,t,{getFormattedLabel:function(F,H,U,K,Q,it){return du(it?it.interpolatedValue:_,O)}}),S.add(C)}v.add(S)}),this.group.add(v),this._titleEls=c,this._detailEls=p},e.type="gauge",e}(Rt),tF=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.visualStyleAccessPath="itemStyle",t}return e.prototype.getInitialData=function(t,a){return To(this,["value"])},e.type="series.gauge",e.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,"#E6EBF8"]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:"#63677A",width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:"#63677A",width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:"#464646",fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:"#fff",borderWidth:0,borderColor:"#5470c6"}},title:{show:!0,offsetCenter:[0,"20%"],color:"#464646",fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:"rgba(0,0,0,0)",borderWidth:0,borderColor:"#ccc",width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:"#464646",fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},e}(Vt);function eF(r){r.registerChartView(jG),r.registerSeriesModel(tF)}var rF=["itemStyle","opacity"],aF=function(r){k(e,r);function e(t,a){var n=r.call(this)||this,i=n,o=new Le,s=new bt;return i.setTextContent(s),n.setTextGuideLine(o),n.updateData(t,a,!0),n}return e.prototype.updateData=function(t,a,n){var i=this,o=t.hostModel,s=t.getItemModel(a),l=t.getItemLayout(a),u=s.getModel("emphasis"),f=s.get(rF);f=f??1,n||Sr(i),i.useStyle(t.getItemVisual(a,"style")),i.style.lineJoin="round",n?(i.setShape({points:l.points}),i.style.opacity=0,zt(i,{style:{opacity:f}},o,a)):Tt(i,{style:{opacity:f},shape:{points:l.points}},o,a),he(i,s),this._updateLabel(t,a),Ht(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},e.prototype._updateLabel=function(t,a){var n=this,i=this.getTextGuideLine(),o=n.getTextContent(),s=t.hostModel,l=t.getItemModel(a),u=t.getItemLayout(a),f=u.label,h=t.getItemVisual(a,"style"),v=h.fill;ve(o,ne(l),{labelFetcher:t.hostModel,labelDataIndex:a,defaultOpacity:h.opacity,defaultText:t.getName(a)},{normal:{align:f.textAlign,verticalAlign:f.verticalAlign}}),n.setTextConfig({local:!0,inside:!!f.inside,insideStroke:v,outsideFill:v});var c=f.linePoints;i.setShape({points:c}),n.textGuideLineConfig={anchor:c?new ft(c[0][0],c[0][1]):null},Tt(o,{style:{x:f.x,y:f.y}},s,a),o.attr({rotation:f.rotation,originX:f.x,originY:f.y,z2:10}),Yg(n,Xg(l),{stroke:v})},e}(Ie),nF=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.ignoreLabelLineUpdate=!0,t}return e.prototype.render=function(t,a,n){var i=t.getData(),o=this._data,s=this.group;i.diff(o).add(function(l){var u=new aF(i,l);i.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var f=o.getItemGraphicEl(u);f.updateData(i,l),s.add(f),i.setItemGraphicEl(l,f)}).remove(function(l){var u=o.getItemGraphicEl(l);Bs(u,t,l)}).execute(),this._data=i},e.prototype.remove=function(){this.group.removeAll(),this._data=null},e.prototype.dispose=function(){},e.type="funnel",e}(Rt),iF=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t){r.prototype.init.apply(this,arguments),this.legendVisualProvider=new xl(X(this.getData,this),X(this.getRawData,this)),this._defaultLabelLine(t)},e.prototype.getInitialData=function(t,a){return To(this,{coordDimensions:["value"],encodeDefaulter:lt(Tg,this)})},e.prototype._defaultLabelLine=function(t){jn(t,"labelLine",["show"]);var a=t.labelLine,n=t.emphasis.labelLine;a.show=a.show&&t.label.show,n.show=n.show&&t.emphasis.label.show},e.prototype.getDataParams=function(t){var a=this.getData(),n=r.prototype.getDataParams.call(this,t),i=a.mapDimension("value"),o=a.getSum(i);return n.percent=o?+(a.get(i,t)/o*100).toFixed(2):0,n.$vars.push("percent"),n},e.type="series.funnel",e.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(Vt);function oF(r,e){return Qt(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function sF(r,e){for(var t=r.mapDimension("value"),a=r.mapArray(t,function(l){return l}),n=[],i=e==="ascending",o=0,s=r.count();owF)return;var n=this._model.coordinateSystem.getSlidedAxisExpandWindow([r.offsetX,r.offsetY]);n.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:n.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(r){if(!(this._mouseDownPoint||!Sc(this,"mousemove"))){var e=this._model,t=e.coordinateSystem.getSlidedAxisExpandWindow([r.offsetX,r.offsetY]),a=t.behavior;a==="jump"&&this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")),this._throttledDispatchExpand(a==="none"?null:{axisExpandWindow:t.axisExpandWindow,animation:a==="jump"?null:{duration:0}})}}};function Sc(r,e){var t=r._model;return t.get("axisExpandable")&&t.get("axisExpandTriggerOn")===e}var CF=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){r.prototype.init.apply(this,arguments),this.mergeOption({})},e.prototype.mergeOption=function(t){var a=this.option;t&&ut(a,t,!0),this._initDimensions()},e.prototype.contains=function(t,a){var n=t.get("parallelIndex");return n!=null&&a.getComponent("parallel",n)===this},e.prototype.setAxisExpand=function(t){D(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(a){t.hasOwnProperty(a)&&(this.option[a]=t[a])},this)},e.prototype._initDimensions=function(){var t=this.dimensions=[],a=this.parallelAxisIndex=[],n=Ct(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(i){return(i.get("parallelIndex")||0)===this.componentIndex},this);D(n,function(i){t.push("dim"+i.get("dim")),a.push(i.componentIndex)})},e.type="parallel",e.dependencies=["parallelAxis"],e.layoutMode="box",e.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},e}(mt),DF=function(r){k(e,r);function e(t,a,n,i,o){var s=r.call(this,t,a,n)||this;return s.type=i||"value",s.axisIndex=o,s}return e.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},e}(br);function pi(r,e,t,a,n,i){r=r||0;var o=t[1]-t[0];if(n!=null&&(n=Ri(n,[0,o])),i!=null&&(i=Math.max(i,n??0)),a==="all"){var s=Math.abs(e[1]-e[0]);s=Ri(s,[0,o]),n=i=Ri(s,[n,i]),a=0}e[0]=Ri(e[0],t),e[1]=Ri(e[1],t);var l=xc(e,a);e[a]+=r;var u=n||0,f=t.slice();l.sign<0?f[0]+=u:f[1]-=u,e[a]=Ri(e[a],f);var h;return h=xc(e,a),n!=null&&(h.sign!==l.sign||h.spani&&(e[1-a]=e[a]+h.sign*i),e}function xc(r,e){var t=r[e]-r[1-e];return{span:Math.abs(t),sign:t>0?-1:t<0?1:e?-1:1}}function Ri(r,e){return Math.min(e[1]!=null?e[1]:1/0,Math.max(e[0]!=null?e[0]:-1/0,r))}var bc=D,rM=Math.min,aM=Math.max,CS=Math.floor,MF=Math.ceil,DS=Ut,IF=Math.PI,LF=function(){function r(e,t,a){this.type="parallel",this._axesMap=$(),this._axesLayout={},this.dimensions=e.dimensions,this._model=e,this._init(e,t,a)}return r.prototype._init=function(e,t,a){var n=e.dimensions,i=e.parallelAxisIndex;bc(n,function(o,s){var l=i[s],u=t.getComponent("parallelAxis",l),f=this._axesMap.set(o,new DF(o,xh(u),[0,0],u.get("type"),l)),h=f.type==="category";f.onBand=h&&u.get("boundaryGap"),f.inverse=u.get("inverse"),u.axis=f,f.model=u,f.coordinateSystem=u.coordinateSystem=this},this)},r.prototype.update=function(e,t){this._updateAxesFromSeries(this._model,e)},r.prototype.containPoint=function(e){var t=this._makeLayoutInfo(),a=t.axisBase,n=t.layoutBase,i=t.pixelDimIndex,o=e[1-i],s=e[i];return o>=a&&o<=a+t.axisLength&&s>=n&&s<=n+t.layoutLength},r.prototype.getModel=function(){return this._model},r.prototype._updateAxesFromSeries=function(e,t){t.eachSeries(function(a){if(e.contains(a,t)){var n=a.getData();bc(this.dimensions,function(i){var o=this._axesMap.get(i);o.scale.unionExtentFromData(n,n.mapDimension(i)),ro(o.scale,o.model)},this)}},this)},r.prototype.resize=function(e,t){this._rect=Qt(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),this._layoutAxes()},r.prototype.getRect=function(){return this._rect},r.prototype._makeLayoutInfo=function(){var e=this._model,t=this._rect,a=["x","y"],n=["width","height"],i=e.get("layout"),o=i==="horizontal"?0:1,s=t[n[o]],l=[0,s],u=this.dimensions.length,f=gu(e.get("axisExpandWidth"),l),h=gu(e.get("axisExpandCount")||0,[0,u]),v=e.get("axisExpandable")&&u>3&&u>h&&h>1&&f>0&&s>0,c=e.get("axisExpandWindow"),p;if(c)p=gu(c[1]-c[0],l),c[1]=c[0]+p;else{p=gu(f*(h-1),l);var d=e.get("axisExpandCenter")||CS(u/2);c=[f*d-p/2],c[1]=c[0]+p}var g=(s-p)/(u-h);g<3&&(g=0);var y=[CS(DS(c[0]/f,1))+1,MF(DS(c[1]/f,1))-1],m=g/f*c[0];return{layout:i,pixelDimIndex:o,layoutBase:t[a[o]],layoutLength:s,axisBase:t[a[1-o]],axisLength:t[n[1-o]],axisExpandable:v,axisExpandWidth:f,axisCollapseWidth:g,axisExpandWindow:c,axisCount:u,winInnerIndices:y,axisExpandWindow0Pos:m}},r.prototype._layoutAxes=function(){var e=this._rect,t=this._axesMap,a=this.dimensions,n=this._makeLayoutInfo(),i=n.layout;t.each(function(o){var s=[0,n.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),bc(a,function(o,s){var l=(n.axisExpandable?RF:PF)(s,n),u={horizontal:{x:l.position,y:n.axisLength},vertical:{x:0,y:l.position}},f={horizontal:IF/2,vertical:0},h=[u[i].x+e.x,u[i].y+e.y],v=f[i],c=Fe();si(c,c,v),Fr(c,c,h),this._axesLayout[o]={position:h,rotation:v,transform:c,axisNameAvailableWidth:l.axisNameAvailableWidth,axisLabelShow:l.axisLabelShow,nameTruncateMaxWidth:l.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},r.prototype.getAxis=function(e){return this._axesMap.get(e)},r.prototype.dataToPoint=function(e,t){return this.axisCoordToPoint(this._axesMap.get(t).dataToCoord(e),t)},r.prototype.eachActiveState=function(e,t,a,n){a==null&&(a=0),n==null&&(n=e.count());var i=this._axesMap,o=this.dimensions,s=[],l=[];D(o,function(g){s.push(e.mapDimension(g)),l.push(i.get(g).model)});for(var u=this.hasAxisBrushed(),f=a;fi*(1-h[0])?(u="jump",l=s-i*(1-h[2])):(l=s-i*h[1])>=0&&(l=s-i*(1-h[1]))<=0&&(l=0),l*=t.axisExpandWidth/f,l?pi(l,n,o,"all"):u="none";else{var c=n[1]-n[0],p=o[1]*s/c;n=[aM(0,p-c/2)],n[1]=rM(o[1],n[0]+c),n[0]=n[1]-c}return{axisExpandWindow:n,behavior:u}},r}();function gu(r,e){return rM(aM(r,e[0]),e[1])}function PF(r,e){var t=e.layoutLength/(e.axisCount-1);return{position:t*r,axisNameAvailableWidth:t,axisLabelShow:!0}}function RF(r,e){var t=e.layoutLength,a=e.axisExpandWidth,n=e.axisCount,i=e.axisCollapseWidth,o=e.winInnerIndices,s,l=i,u=!1,f;return r=0;n--)ar(a[n])},e.prototype.getActiveState=function(t){var a=this.activeIntervals;if(!a.length)return"normal";if(t==null||isNaN(+t))return"inactive";if(a.length===1){var n=a[0];if(n[0]<=t&&t<=n[1])return"active"}else for(var i=0,o=a.length;iBF}function uM(r){var e=r.length-1;return e<0&&(e=0),[r[0],r[e]]}function fM(r,e,t,a){var n=new at;return n.add(new St({name:"main",style:_y(t),silent:!0,draggable:!0,cursor:"move",drift:lt(LS,r,e,n,["n","s","w","e"]),ondragend:lt(ii,e,{isEnd:!0})})),D(a,function(i){n.add(new St({name:i.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:lt(LS,r,e,n,i),ondragend:lt(ii,e,{isEnd:!0})}))}),n}function hM(r,e,t,a){var n=a.brushStyle.lineWidth||0,i=io(n,VF),o=t[0][0],s=t[1][0],l=o-n/2,u=s-n/2,f=t[0][1],h=t[1][1],v=f-i+n/2,c=h-i+n/2,p=f-o,d=h-s,g=p+n,y=d+n;Kr(r,e,"main",o,s,p,d),a.transformable&&(Kr(r,e,"w",l,u,i,y),Kr(r,e,"e",v,u,i,y),Kr(r,e,"n",l,u,g,i),Kr(r,e,"s",l,c,g,i),Kr(r,e,"nw",l,u,i,i),Kr(r,e,"ne",v,u,i,i),Kr(r,e,"sw",l,c,i,i),Kr(r,e,"se",v,c,i,i))}function Sd(r,e){var t=e.__brushOption,a=t.transformable,n=e.childAt(0);n.useStyle(_y(t)),n.attr({silent:!a,cursor:a?"move":"default"}),D([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(i){var o=e.childOfName(i.join("")),s=i.length===1?xd(r,i[0]):UF(r,i);o&&o.attr({silent:!a,invisible:!a,cursor:a?GF[s]+"-resize":null})})}function Kr(r,e,t,a,n,i,o){var s=e.childOfName(t);s&&s.setShape(XF(Sy(r,e,[[a,n],[a+i,n+o]])))}function _y(r){return j({strokeNoScale:!0},r.brushStyle)}function vM(r,e,t,a){var n=[js(r,t),js(e,a)],i=[io(r,t),io(e,a)];return[[n[0],i[0]],[n[1],i[1]]]}function WF(r){return qn(r.group)}function xd(r,e){var t={w:"left",e:"right",n:"top",s:"bottom"},a={left:"w",right:"e",top:"n",bottom:"s"},n=ih(t[e],WF(r));return a[n]}function UF(r,e){var t=[xd(r,e[0]),xd(r,e[1])];return(t[0]==="e"||t[0]==="w")&&t.reverse(),t.join("")}function LS(r,e,t,a,n,i){var o=t.__brushOption,s=r.toRectRange(o.range),l=cM(e,n,i);D(a,function(u){var f=zF[u];s[f[0]][f[1]]+=l[f[0]]}),o.range=r.fromRectRange(vM(s[0][0],s[1][0],s[0][1],s[1][1])),gy(e,t),ii(e,{isEnd:!1})}function YF(r,e,t,a){var n=e.__brushOption.range,i=cM(r,t,a);D(n,function(o){o[0]+=i[0],o[1]+=i[1]}),gy(r,e),ii(r,{isEnd:!1})}function cM(r,e,t){var a=r.group,n=a.transformCoordToLocal(e,t),i=a.transformCoordToLocal(0,0);return[n[0]-i[0],n[1]-i[1]]}function Sy(r,e,t){var a=lM(r,e);return a&&a!==ni?a.clipPath(t,r._transform):rt(t)}function XF(r){var e=js(r[0][0],r[1][0]),t=js(r[0][1],r[1][1]),a=io(r[0][0],r[1][0]),n=io(r[0][1],r[1][1]);return{x:e,y:t,width:a-e,height:n-t}}function ZF(r,e,t){if(!(!r._brushType||qF(r,e.offsetX,e.offsetY))){var a=r._zr,n=r._covers,i=my(r,e,t);if(!r._dragging)for(var o=0;oa.getWidth()||t<0||t>a.getHeight()}var Dh={lineX:ES(0),lineY:ES(1),rect:{createCover:function(r,e){function t(a){return a}return fM({toRectRange:t,fromRectRange:t},r,e,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(r){var e=uM(r);return vM(e[1][0],e[1][1],e[0][0],e[0][1])},updateCoverShape:function(r,e,t,a){hM(r,e,t,a)},updateCommon:Sd,contain:wd},polygon:{createCover:function(r,e){var t=new at;return t.add(new Le({name:"main",style:_y(e),silent:!0})),t},getCreatingRange:function(r){return r},endCreating:function(r,e){e.remove(e.childAt(0)),e.add(new Ie({name:"main",draggable:!0,drift:lt(YF,r,e),ondragend:lt(ii,r,{isEnd:!0})}))},updateCoverShape:function(r,e,t,a){e.childAt(0).setShape({points:Sy(r,e,t)})},updateCommon:Sd,contain:wd}};function ES(r){return{createCover:function(e,t){return fM({toRectRange:function(a){var n=[a,[0,100]];return r&&n.reverse(),n},fromRectRange:function(a){return a[r]}},e,t,[[["w"],["e"]],[["n"],["s"]]][r])},getCreatingRange:function(e){var t=uM(e),a=js(t[0][r],t[1][r]),n=io(t[0][r],t[1][r]);return[a,n]},updateCoverShape:function(e,t,a,n){var i,o=lM(e,t);if(o!==ni&&o.getLinearBrushOtherExtent)i=o.getLinearBrushOtherExtent(r);else{var s=e._zr;i=[0,[s.getWidth(),s.getHeight()][1-r]]}var l=[a,i];r&&l.reverse(),hM(e,t,l,n)},updateCommon:Sd,contain:wd}}function dM(r){return r=xy(r),function(e){return AT(e,r)}}function gM(r,e){return r=xy(r),function(t){var a=e??t,n=a?r.width:r.height,i=a?r.x:r.y;return[i,i+(n||0)]}}function yM(r,e,t){var a=xy(r);return function(n,i){return a.contain(i[0],i[1])&&!wh(n,e,t)}}function xy(r){return ht.create(r)}var KF=["axisLine","axisTickLabel","axisName"],JF=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,a){r.prototype.init.apply(this,arguments),(this._brushController=new dy(a.getZr())).on("brush",X(this._onBrush,this))},e.prototype.render=function(t,a,n,i){if(!QF(t,a,i)){this.axisModel=t,this.api=n,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new at,this.group.add(this._axisGroup),!!t.get("show")){var s=t3(t,a),l=s.coordinateSystem,u=t.getAreaSelectStyle(),f=u.width,h=t.axis.dim,v=l.getAxisLayout(h),c=V({strokeContainThreshold:f},v),p=new Ae(t,c);D(KF,p.add,p),this._axisGroup.add(p.getGroup()),this._refreshBrushController(c,u,t,s,f,n),fl(o,this._axisGroup,t)}}},e.prototype._refreshBrushController=function(t,a,n,i,o,s){var l=n.axis.getExtent(),u=l[1]-l[0],f=Math.min(30,Math.abs(u)*.1),h=ht.create({x:l[0],y:-o/2,width:u,height:o});h.x-=f,h.width+=2*f,this._brushController.mount({enableGlobalPan:!0,rotation:t.rotation,x:t.position[0],y:t.position[1]}).setPanels([{panelId:"pl",clipPath:dM(h),isTargetByCursor:yM(h,s,i),getLinearBrushOtherExtent:gM(h,0)}]).enableBrush({brushType:"lineX",brushStyle:a,removeOnClick:!0}).updateCovers(jF(n))},e.prototype._onBrush=function(t){var a=t.areas,n=this.axisModel,i=n.axis,o=G(a,function(s){return[i.coordToData(s.range[0],!0),i.coordToData(s.range[1],!0)]});(!n.option.realtime===t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:n.id,intervals:o})},e.prototype.dispose=function(){this._brushController.dispose()},e.type="parallelAxis",e}(Ft);function QF(r,e,t){return t&&t.type==="axisAreaSelect"&&e.findComponents({mainType:"parallelAxis",query:t})[0]===r}function jF(r){var e=r.axis;return G(r.activeIntervals,function(t){return{brushType:"lineX",panelId:"pl",range:[e.dataToCoord(t[0],!0),e.dataToCoord(t[1],!0)]}})}function t3(r,e){return e.getComponent("parallel",r.get("parallelIndex"))}var e3={type:"axisAreaSelect",event:"axisAreaSelected"};function r3(r){r.registerAction(e3,function(e,t){t.eachComponent({mainType:"parallelAxis",query:e},function(a){a.axis.model.setActiveIntervals(e.intervals)})}),r.registerAction("parallelAxisExpand",function(e,t){t.eachComponent({mainType:"parallel",query:e},function(a){a.setAxisExpand(e)})})}var a3={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function mM(r){r.registerComponentView(TF),r.registerComponentModel(CF),r.registerCoordinateSystem("parallel",kF),r.registerPreprocessor(SF),r.registerComponentModel(md),r.registerComponentView(JF),no(r,"parallel",md,a3),r3(r)}function n3(r){dt(mM),r.registerChartView(vF),r.registerSeriesModel(dF),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,_F)}var i3=function(){function r(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return r}(),o3=function(r){k(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultShape=function(){return new i3},e.prototype.buildPath=function(t,a){var n=a.extent;t.moveTo(a.x1,a.y1),t.bezierCurveTo(a.cpx1,a.cpy1,a.cpx2,a.cpy2,a.x2,a.y2),a.orient==="vertical"?(t.lineTo(a.x2+n,a.y2),t.bezierCurveTo(a.cpx2+n,a.cpy2,a.cpx1+n,a.cpy1,a.x1+n,a.y1)):(t.lineTo(a.x2,a.y2+n),t.bezierCurveTo(a.cpx2,a.cpy2+n,a.cpx1,a.cpy1+n,a.x1,a.y1+n)),t.closePath()},e.prototype.highlight=function(){la(this)},e.prototype.downplay=function(){ua(this)},e}(gt),s3=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._focusAdjacencyDisabled=!1,t}return e.prototype.render=function(t,a,n){var i=this,o=t.getGraph(),s=this.group,l=t.layoutInfo,u=l.width,f=l.height,h=t.getData(),v=t.getData("edge"),c=t.get("orient");this._model=t,s.removeAll(),s.x=l.x,s.y=l.y,o.eachEdge(function(p){var d=new o3,g=nt(d);g.dataIndex=p.dataIndex,g.seriesIndex=t.seriesIndex,g.dataType="edge";var y=p.getModel(),m=y.getModel("lineStyle"),_=m.get("curveness"),S=p.node1.getLayout(),b=p.node1.getModel(),x=b.get("localX"),w=b.get("localY"),T=p.node2.getLayout(),A=p.node2.getModel(),C=A.get("localX"),M=A.get("localY"),I=p.getLayout(),L,P,R,E,N,O,B,F;d.shape.extent=Math.max(1,I.dy),d.shape.orient=c,c==="vertical"?(L=(x!=null?x*u:S.x)+I.sy,P=(w!=null?w*f:S.y)+S.dy,R=(C!=null?C*u:T.x)+I.ty,E=M!=null?M*f:T.y,N=L,O=P*(1-_)+E*_,B=R,F=P*_+E*(1-_)):(L=(x!=null?x*u:S.x)+S.dx,P=(w!=null?w*f:S.y)+I.sy,R=C!=null?C*u:T.x,E=(M!=null?M*f:T.y)+I.ty,N=L*(1-_)+R*_,O=P,B=L*_+R*(1-_),F=E),d.setShape({x1:L,y1:P,x2:R,y2:E,cpx1:N,cpy1:O,cpx2:B,cpy2:F}),d.useStyle(m.getItemStyle()),kS(d.style,c,p);var H=""+y.get("value"),U=ne(y,"edgeLabel");ve(d,U,{labelFetcher:{getFormattedLabel:function(it,Lt,Wt,vt,tt,pt){return t.getFormattedLabel(it,Lt,"edge",vt,Br(tt,U.normal&&U.normal.get("formatter"),H),pt)}},labelDataIndex:p.dataIndex,defaultText:H}),d.setTextConfig({position:"inside"});var K=y.getModel("emphasis");he(d,y,"lineStyle",function(it){var Lt=it.getItemStyle();return kS(Lt,c,p),Lt}),s.add(d),v.setItemGraphicEl(p.dataIndex,d);var Q=K.get("focus");Ht(d,Q==="adjacency"?p.getAdjacentDataIndices():Q==="trajectory"?p.getTrajectoryDataIndices():Q,K.get("blurScope"),K.get("disabled"))}),o.eachNode(function(p){var d=p.getLayout(),g=p.getModel(),y=g.get("localX"),m=g.get("localY"),_=g.getModel("emphasis"),S=g.get(["itemStyle","borderRadius"])||0,b=new St({shape:{x:y!=null?y*u:d.x,y:m!=null?m*f:d.y,width:d.dx,height:d.dy,r:S},style:g.getModel("itemStyle").getItemStyle(),z2:10});ve(b,ne(g),{labelFetcher:{getFormattedLabel:function(w,T){return t.getFormattedLabel(w,T,"node")}},labelDataIndex:p.dataIndex,defaultText:p.id}),b.disableLabelAnimation=!0,b.setStyle("fill",p.getVisual("color")),b.setStyle("decal",p.getVisual("style").decal),he(b,g),s.add(b),h.setItemGraphicEl(p.dataIndex,b),nt(b).dataType="node";var x=_.get("focus");Ht(b,x==="adjacency"?p.getAdjacentDataIndices():x==="trajectory"?p.getTrajectoryDataIndices():x,_.get("blurScope"),_.get("disabled"))}),h.eachItemGraphicEl(function(p,d){var g=h.getItemModel(d);g.get("draggable")&&(p.drift=function(y,m){i._focusAdjacencyDisabled=!0,this.shape.x+=y,this.shape.y+=m,this.dirty(),n.dispatchAction({type:"dragNode",seriesId:t.id,dataIndex:h.getRawIndex(d),localX:this.shape.x/u,localY:this.shape.y/f})},p.ondragend=function(){i._focusAdjacencyDisabled=!1},p.draggable=!0,p.cursor="move")}),!this._data&&t.isAnimationEnabled()&&s.setClipPath(l3(s.getBoundingRect(),t,function(){s.removeClipPath()})),this._data=t.getData()},e.prototype.dispose=function(){},e.type="sankey",e}(Rt);function kS(r,e,t){switch(r.fill){case"source":r.fill=t.node1.getVisual("color"),r.decal=t.node1.getVisual("style").decal;break;case"target":r.fill=t.node2.getVisual("color"),r.decal=t.node2.getVisual("style").decal;break;case"gradient":var a=t.node1.getVisual("color"),n=t.node2.getVisual("color");Y(a)&&Y(n)&&(r.fill=new ul(0,0,+(e==="horizontal"),+(e==="vertical"),[{color:a,offset:0},{color:n,offset:1}]))}}function l3(r,e,t){var a=new St({shape:{x:r.x-10,y:r.y-10,width:0,height:r.height+20}});return zt(a,{shape:{width:r.width+20}},e,t),a}var u3=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,a){var n=t.edges||t.links||[],i=t.data||t.nodes||[],o=t.levels||[];this.levelModels=[];for(var s=this.levelModels,l=0;l=0&&(s[o[l].depth]=new Mt(o[l],this,a));var u=tM(i,n,this,!0,f);return u.data;function f(h,v){h.wrapMethod("getItemModel",function(c,p){var d=c.parentModel,g=d.getData().getItemLayout(p);if(g){var y=g.depth,m=d.levelModels[y];m&&(c.parentModel=m)}return c}),v.wrapMethod("getItemModel",function(c,p){var d=c.parentModel,g=d.getGraph().getEdgeByIndex(p),y=g.node1.getLayout();if(y){var m=y.depth,_=d.levelModels[m];_&&(c.parentModel=_)}return c})}},e.prototype.setNodePosition=function(t,a){var n=this.option.data||this.option.nodes,i=n[t];i.localX=a[0],i.localY=a[1]},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.formatTooltip=function(t,a,n){function i(c){return isNaN(c)||c==null}if(n==="edge"){var o=this.getDataParams(t,n),s=o.data,l=o.value,u=s.source+" -- "+s.target;return ie("nameValue",{name:u,value:l,noValue:i(l)})}else{var f=this.getGraph().getNodeByIndex(t),h=f.getLayout().value,v=this.getDataParams(t,n).data.name;return ie("nameValue",{name:v!=null?v+"":null,value:h,noValue:i(h)})}},e.prototype.optionUpdated=function(){},e.prototype.getDataParams=function(t,a){var n=r.prototype.getDataParams.call(this,t,a);if(n.value==null&&a==="node"){var i=this.getGraph().getNodeByIndex(t),o=i.getLayout().value;n.value=o}return n},e.type="series.sankey",e.defaultOption={z:2,coordinateSystem:"view",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:"#314656",opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:"#212121"}},animationEasing:"linear",animationDuration:1e3},e}(Vt);function f3(r,e){r.eachSeriesByType("sankey",function(t){var a=t.get("nodeWidth"),n=t.get("nodeGap"),i=h3(t,e);t.layoutInfo=i;var o=i.width,s=i.height,l=t.getGraph(),u=l.nodes,f=l.edges;c3(u);var h=Ct(u,function(d){return d.getLayout().value===0}),v=h.length!==0?0:t.get("layoutIterations"),c=t.get("orient"),p=t.get("nodeAlign");v3(u,f,a,n,o,s,v,c,p)})}function h3(r,e){return Qt(r.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function v3(r,e,t,a,n,i,o,s,l){p3(r,e,t,n,i,s,l),m3(r,e,i,n,a,o,s),D3(r,s)}function c3(r){D(r,function(e){var t=Wa(e.outEdges,Lf),a=Wa(e.inEdges,Lf),n=e.getValue()||0,i=Math.max(t,a,n);e.setLayout({value:i},!0)})}function p3(r,e,t,a,n,i,o){for(var s=[],l=[],u=[],f=[],h=0,v=0;v=0;y&&g.depth>c&&(c=g.depth),d.setLayout({depth:y?g.depth:h},!0),i==="vertical"?d.setLayout({dy:t},!0):d.setLayout({dx:t},!0);for(var m=0;mh-1?c:h-1;o&&o!=="left"&&d3(r,o,i,w);var T=i==="vertical"?(n-t)/w:(a-t)/w;y3(r,T,i)}function _M(r){var e=r.hostGraph.data.getRawDataItem(r.dataIndex);return e.depth!=null&&e.depth>=0}function d3(r,e,t,a){if(e==="right"){for(var n=[],i=r,o=0;i.length;){for(var s=0;s0;i--)l*=.99,x3(s,l,o),wc(s,n,t,a,o),C3(s,l,o),wc(s,n,t,a,o)}function _3(r,e){var t=[],a=e==="vertical"?"y":"x",n=Tp(r,function(i){return i.getLayout()[a]});return n.keys.sort(function(i,o){return i-o}),D(n.keys,function(i){t.push(n.buckets.get(i))}),t}function S3(r,e,t,a,n,i){var o=1/0;D(r,function(s){var l=s.length,u=0;D(s,function(h){u+=h.getLayout().value});var f=i==="vertical"?(a-(l-1)*n)/u:(t-(l-1)*n)/u;f0&&(s=l.getLayout()[i]+u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),f=l.getLayout()[i]+l.getLayout()[v]+e;var p=n==="vertical"?a:t;if(u=f-e-p,u>0){s=l.getLayout()[i]-u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),f=s;for(var c=h-2;c>=0;--c)l=o[c],u=l.getLayout()[i]+l.getLayout()[v]+e-f,u>0&&(s=l.getLayout()[i]-u,n==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),f=l.getLayout()[i]}})}function x3(r,e,t){D(r.slice().reverse(),function(a){D(a,function(n){if(n.outEdges.length){var i=Wa(n.outEdges,b3,t)/Wa(n.outEdges,Lf);if(isNaN(i)){var o=n.outEdges.length;i=o?Wa(n.outEdges,w3,t)/o:0}if(t==="vertical"){var s=n.getLayout().x+(i-Ka(n,t))*e;n.setLayout({x:s},!0)}else{var l=n.getLayout().y+(i-Ka(n,t))*e;n.setLayout({y:l},!0)}}})})}function b3(r,e){return Ka(r.node2,e)*r.getValue()}function w3(r,e){return Ka(r.node2,e)}function T3(r,e){return Ka(r.node1,e)*r.getValue()}function A3(r,e){return Ka(r.node1,e)}function Ka(r,e){return e==="vertical"?r.getLayout().x+r.getLayout().dx/2:r.getLayout().y+r.getLayout().dy/2}function Lf(r){return r.getValue()}function Wa(r,e,t){for(var a=0,n=r.length,i=-1;++io&&(o=l)}),D(a,function(s){var l=new ae({type:"color",mappingMethod:"linear",dataExtent:[i,o],visual:e.get("color")}),u=l.mapValueToVisual(s.getLayout().value),f=s.getModel().get(["itemStyle","color"]);f!=null?(s.setVisual("color",f),s.setVisual("style",{fill:f})):(s.setVisual("color",u),s.setVisual("style",{fill:u}))})}n.length&&D(n,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function I3(r){r.registerChartView(s3),r.registerSeriesModel(u3),r.registerLayout(f3),r.registerVisual(M3),r.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(e,t){t.eachComponent({mainType:"series",subType:"sankey",query:e},function(a){a.setNodePosition(e.dataIndex,[e.localX,e.localY])})})}var SM=function(){function r(){}return r.prototype._hasEncodeRule=function(e){var t=this.getEncode();return t&&t.get(e)!=null},r.prototype.getInitialData=function(e,t){var a,n=t.getComponent("xAxis",this.get("xAxisIndex")),i=t.getComponent("yAxis",this.get("yAxisIndex")),o=n.get("type"),s=i.get("type"),l;o==="category"?(e.layout="horizontal",a=n.getOrdinalMeta(),l=!this._hasEncodeRule("x")):s==="category"?(e.layout="vertical",a=i.getOrdinalMeta(),l=!this._hasEncodeRule("y")):e.layout=e.layout||"horizontal";var u=["x","y"],f=e.layout==="horizontal"?0:1,h=this._baseAxisDim=u[f],v=u[1-f],c=[n,i],p=c[f].get("type"),d=c[1-f].get("type"),g=e.data;if(g&&l){var y=[];D(g,function(S,b){var x;z(S)?(x=S.slice(),S.unshift(b)):z(S.value)?(x=V({},S),x.value=x.value.slice(),S.value.unshift(b)):x=S,y.push(x)}),e.data=y}var m=this.defaultValueDimensions,_=[{name:h,type:_f(p),ordinalMeta:a,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:v,type:_f(d),dimsDef:m.slice()}];return To(this,{coordDimensions:_,dimensionsCount:m.length+1,encodeDefaulter:lt(JT,_,this)})},r.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},r}(),xM=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.defaultValueDimensions=[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],t.visualDrawType="stroke",t}return e.type="series.boxplot",e.dependencies=["xAxis","yAxis","grid"],e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,boxWidth:[7,50],itemStyle:{color:"#fff",borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}},animationDuration:800},e}(Vt);Kt(xM,SM,!0);var L3=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){var i=t.getData(),o=this.group,s=this._data;this._data||o.removeAll();var l=t.get("layout")==="horizontal"?1:0;i.diff(s).add(function(u){if(i.hasValue(u)){var f=i.getItemLayout(u),h=OS(f,i,u,l,!0);i.setItemGraphicEl(u,h),o.add(h)}}).update(function(u,f){var h=s.getItemGraphicEl(f);if(!i.hasValue(u)){o.remove(h);return}var v=i.getItemLayout(u);h?(Sr(h),bM(v,h,i,u)):h=OS(v,i,u,l),o.add(h),i.setItemGraphicEl(u,h)}).remove(function(u){var f=s.getItemGraphicEl(u);f&&o.remove(f)}).execute(),this._data=i},e.prototype.remove=function(t){var a=this.group,n=this._data;this._data=null,n&&n.eachItemGraphicEl(function(i){i&&a.remove(i)})},e.type="boxplot",e}(Rt),P3=function(){function r(){}return r}(),R3=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a.type="boxplotBoxPath",a}return e.prototype.getDefaultShape=function(){return new P3},e.prototype.buildPath=function(t,a){var n=a.points,i=0;for(t.moveTo(n[i][0],n[i][1]),i++;i<4;i++)t.lineTo(n[i][0],n[i][1]);for(t.closePath();id){var S=[y,_];a.push(S)}}}return{boxData:t,outliers:a}}var z3={type:"echarts:boxplot",transform:function(e){var t=e.upstream;if(t.sourceFormat!==me){var a="";At(a)}var n=V3(t.getRawData(),e.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:n.boxData},{data:n.outliers}]}};function G3(r){r.registerSeriesModel(xM),r.registerChartView(L3),r.registerLayout(k3),r.registerTransform(z3)}var F3=["itemStyle","borderColor"],H3=["itemStyle","borderColor0"],W3=["itemStyle","borderColorDoji"],U3=["itemStyle","color"],Y3=["itemStyle","color0"];function by(r,e){return e.get(r>0?U3:Y3)}function wy(r,e){return e.get(r===0?W3:r>0?F3:H3)}var X3={seriesType:"candlestick",plan:So(),performRawSeries:!0,reset:function(r,e){if(!e.isSeriesFiltered(r)){var t=r.pipelineContext.large;return!t&&{progress:function(a,n){for(var i;(i=a.next())!=null;){var o=n.getItemModel(i),s=n.getItemLayout(i).sign,l=o.getItemStyle();l.fill=by(s,o),l.stroke=wy(s,o)||l.fill;var u=n.ensureUniqueItemVisual(i,"style");V(u,l)}}}}}},Z3=["color","borderColor"],$3=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(t),this._isLargeDraw?this._renderLarge(t):this._renderNormal(t)},e.prototype.incrementalPrepareRender=function(t,a,n){this._clear(),this._updateDrawMode(t)},e.prototype.incrementalRender=function(t,a,n,i){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(t,a):this._incrementalRenderNormal(t,a)},e.prototype.eachRendered=function(t){Qa(this._progressiveEls||this.group,t)},e.prototype._updateDrawMode=function(t){var a=t.pipelineContext.large;(this._isLargeDraw==null||a!==this._isLargeDraw)&&(this._isLargeDraw=a,this._clear())},e.prototype._renderNormal=function(t){var a=t.getData(),n=this._data,i=this.group,o=a.getLayout("isSimpleBox"),s=t.get("clip",!0),l=t.coordinateSystem,u=l.getArea&&l.getArea();this._data||i.removeAll(),a.diff(n).add(function(f){if(a.hasValue(f)){var h=a.getItemLayout(f);if(s&&NS(u,h))return;var v=Tc(h,f,!0);zt(v,{shape:{points:h.ends}},t,f),Ac(v,a,f,o),i.add(v),a.setItemGraphicEl(f,v)}}).update(function(f,h){var v=n.getItemGraphicEl(h);if(!a.hasValue(f)){i.remove(v);return}var c=a.getItemLayout(f);if(s&&NS(u,c)){i.remove(v);return}v?(Tt(v,{shape:{points:c.ends}},t,f),Sr(v)):v=Tc(c),Ac(v,a,f,o),i.add(v),a.setItemGraphicEl(f,v)}).remove(function(f){var h=n.getItemGraphicEl(f);h&&i.remove(h)}).execute(),this._data=a},e.prototype._renderLarge=function(t){this._clear(),BS(t,this.group);var a=t.get("clip",!0)?ml(t.coordinateSystem,!1,t):null;a?this.group.setClipPath(a):this.group.removeClipPath()},e.prototype._incrementalRenderNormal=function(t,a){for(var n=a.getData(),i=n.getLayout("isSimpleBox"),o;(o=t.next())!=null;){var s=n.getItemLayout(o),l=Tc(s);Ac(l,n,o,i),l.incremental=!0,this.group.add(l),this._progressiveEls.push(l)}},e.prototype._incrementalRenderLarge=function(t,a){BS(a,this.group,this._progressiveEls,!0)},e.prototype.remove=function(t){this._clear()},e.prototype._clear=function(){this.group.removeAll(),this._data=null},e.type="candlestick",e}(Rt),q3=function(){function r(){}return r}(),K3=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a.type="normalCandlestickBox",a}return e.prototype.getDefaultShape=function(){return new q3},e.prototype.buildPath=function(t,a){var n=a.points;this.__simpleBox?(t.moveTo(n[4][0],n[4][1]),t.lineTo(n[6][0],n[6][1])):(t.moveTo(n[0][0],n[0][1]),t.lineTo(n[1][0],n[1][1]),t.lineTo(n[2][0],n[2][1]),t.lineTo(n[3][0],n[3][1]),t.closePath(),t.moveTo(n[4][0],n[4][1]),t.lineTo(n[5][0],n[5][1]),t.moveTo(n[6][0],n[6][1]),t.lineTo(n[7][0],n[7][1]))},e}(gt);function Tc(r,e,t){var a=r.ends;return new K3({shape:{points:t?J3(a,r):a},z2:100})}function NS(r,e){for(var t=!0,a=0;ab?M[i]:C[i],ends:P,brushRect:B(x,w,_)})}function N(H,U){var K=[];return K[n]=U,K[i]=H,isNaN(U)||isNaN(H)?[NaN,NaN]:e.dataToPoint(K)}function O(H,U,K){var Q=U.slice(),it=U.slice();Q[n]=Vu(Q[n]+a/2,1,!1),it[n]=Vu(it[n]-a/2,1,!0),K?H.push(Q,it):H.push(it,Q)}function B(H,U,K){var Q=N(H,K),it=N(U,K);return Q[n]-=a/2,it[n]-=a/2,{x:Q[0],y:Q[1],width:a,height:it[1]-Q[1]}}function F(H){return H[n]=Vu(H[n],1),H}}function p(d,g){for(var y=Or(d.count*4),m=0,_,S=[],b=[],x,w=g.getStore(),T=!!r.get(["itemStyle","borderColorDoji"]);(x=d.next())!=null;){var A=w.get(s,x),C=w.get(u,x),M=w.get(f,x),I=w.get(h,x),L=w.get(v,x);if(isNaN(A)||isNaN(I)||isNaN(L)){y[m++]=NaN,m+=3;continue}y[m++]=VS(w,x,C,M,f,T),S[n]=A,S[i]=I,_=e.dataToPoint(S,null,b),y[m++]=_?_[0]:NaN,y[m++]=_?_[1]:NaN,S[i]=L,_=e.dataToPoint(S,null,b),y[m++]=_?_[1]:NaN}g.setLayout("largePoints",y)}}};function VS(r,e,t,a,n,i){var o;return t>a?o=-1:t0?r.get(n,e-1)<=a?1:-1:1,o}function eH(r,e){var t=r.getBaseAxis(),a,n=t.type==="category"?t.getBandWidth():(a=t.getExtent(),Math.abs(a[1]-a[0])/e.count()),i=W(st(r.get("barMaxWidth"),n),n),o=W(st(r.get("barMinWidth"),1),n),s=r.get("barWidth");return s!=null?W(s,n):Math.max(Math.min(n/2,i),o)}function rH(r){r.registerChartView($3),r.registerSeriesModel(wM),r.registerPreprocessor(j3),r.registerVisual(X3),r.registerLayout(tH)}function zS(r,e){var t=e.rippleEffectColor||e.color;r.eachChild(function(a){a.attr({z:e.z,zlevel:e.zlevel,style:{stroke:e.brushType==="stroke"?t:null,fill:e.brushType==="fill"?t:null}})})}var aH=function(r){k(e,r);function e(t,a){var n=r.call(this)||this,i=new gl(t,a),o=new at;return n.add(i),n.add(o),n.updateData(t,a),n}return e.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},e.prototype.startEffectAnimation=function(t){for(var a=t.symbolType,n=t.color,i=t.rippleNumber,o=this.childAt(1),s=0;s0&&(s=this._getLineLength(i)/f*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){i.stopAnimation();var v=void 0;J(h)?v=h(n):v=h,i.__t>0&&(v=-s*i.__t),this._animateSymbol(i,s,v,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},e.prototype._animateSymbol=function(t,a,n,i,o){if(a>0){t.__t=0;var s=this,l=t.animate("",i).when(o?a*2:a,{__t:o?2:1}).delay(n).during(function(){s._updateSymbolPosition(t)});i||l.done(function(){s.remove(t)}),l.start()}},e.prototype._getLineLength=function(t){return Pa(t.__p1,t.__cp1)+Pa(t.__cp1,t.__p2)},e.prototype._updateAnimationPoints=function(t,a){t.__p1=a[0],t.__p2=a[1],t.__cp1=a[2]||[(a[0][0]+a[1][0])/2,(a[0][1]+a[1][1])/2]},e.prototype.updateData=function(t,a,n){this.childAt(0).updateData(t,a,n),this._updateEffectSymbol(t,a)},e.prototype._updateSymbolPosition=function(t){var a=t.__p1,n=t.__p2,i=t.__cp1,o=t.__t<1?t.__t:2-t.__t,s=[t.x,t.y],l=s.slice(),u=oe,f=up;s[0]=u(a[0],i[0],n[0],o),s[1]=u(a[1],i[1],n[1],o);var h=t.__t<1?f(a[0],i[0],n[0],o):f(n[0],i[0],a[0],1-o),v=t.__t<1?f(a[1],i[1],n[1],o):f(n[1],i[1],a[1],1-o);t.rotation=-Math.atan2(v,h)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(t.__lastT!==void 0&&t.__lastT=0&&!(i[l]<=a);l--);l=Math.min(l,o-2)}else{for(l=s;la);l++);l=Math.min(l-1,o-2)}var f=(a-i[l])/(i[l+1]-i[l]),h=n[l],v=n[l+1];t.x=h[0]*(1-f)+f*v[0],t.y=h[1]*(1-f)+f*v[1];var c=t.__t<1?v[0]-h[0]:h[0]-v[0],p=t.__t<1?v[1]-h[1]:h[1]-v[1];t.rotation=-Math.atan2(p,c)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=a,t.ignore=!1}},e}(TM),lH=function(){function r(){this.polyline=!1,this.curveness=0,this.segs=[]}return r}(),uH=function(r){k(e,r);function e(t){var a=r.call(this,t)||this;return a._off=0,a.hoverDataIdx=-1,a}return e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new lH},e.prototype.buildPath=function(t,a){var n=a.segs,i=a.curveness,o;if(a.polyline)for(o=this._off;o0){t.moveTo(n[o++],n[o++]);for(var l=1;l0){var c=(u+h)/2-(f-v)*i,p=(f+v)/2-(h-u)*i;t.quadraticCurveTo(c,p,h,v)}else t.lineTo(h,v)}this.incremental&&(this._off=o,this.notClear=!0)},e.prototype.findDataIndex=function(t,a){var n=this.shape,i=n.segs,o=n.curveness,s=this.style.lineWidth;if(n.polyline)for(var l=0,u=0;u0)for(var h=i[u++],v=i[u++],c=1;c0){var g=(h+p)/2-(v-d)*o,y=(v+d)/2-(p-h)*o;if(Jw(h,v,g,y,p,d,s,t,a))return l}else if(Ia(h,v,p,d,s,t,a))return l;l++}return-1},e.prototype.contain=function(t,a){var n=this.transformCoordToLocal(t,a),i=this.getBoundingRect();if(t=n[0],a=n[1],i.contain(t,a)){var o=this.hoverDataIdx=this.findDataIndex(t,a);return o>=0}return this.hoverDataIdx=-1,!1},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var a=this.shape,n=a.segs,i=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u0&&(o.dataIndex=l+e.__startIndex)})},r.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},r}(),CM={seriesType:"lines",plan:So(),reset:function(r){var e=r.coordinateSystem;if(e){var t=r.get("polyline"),a=r.pipelineContext.large;return{progress:function(n,i){var o=[];if(a){var s=void 0,l=n.end-n.start;if(t){for(var u=0,f=n.start;f0&&(f||u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)})),o.updateData(i);var h=t.get("clip",!0)&&ml(t.coordinateSystem,!1,t);h?this.group.setClipPath(h):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},e.prototype.incrementalPrepareRender=function(t,a,n){var i=t.getData(),o=this._updateLineDraw(i,t);o.incrementalPrepareUpdate(i),this._clearLayer(n),this._finished=!1},e.prototype.incrementalRender=function(t,a,n){this._lineDraw.incrementalUpdate(t,a.getData()),this._finished=t.end===a.getData().count()},e.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},e.prototype.updateTransform=function(t,a,n){var i=t.getData(),o=t.pipelineContext;if(!this._finished||o.large||o.progressiveRender)return{update:!0};var s=CM.reset(t,a,n);s.progress&&s.progress({start:0,end:i.count(),count:i.count()},i),this._lineDraw.updateLayout(),this._clearLayer(n)},e.prototype._updateLineDraw=function(t,a){var n=this._lineDraw,i=this._showEffect(a),o=!!a.get("polyline"),s=a.pipelineContext,l=s.large;return(!n||i!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(n&&n.remove(),n=this._lineDraw=l?new fH:new py(o?i?sH:AM:i?TM:cy),this._hasEffet=i,this._isPolyline=o,this._isLargeDraw=l),this.group.add(n.group),n},e.prototype._showEffect=function(t){return!!t.get(["effect","show"])},e.prototype._clearLayer=function(t){var a=t.getZr(),n=a.painter.getType()==="svg";!n&&this._lastZlevel!=null&&a.painter.getLayer(this._lastZlevel).clear(!0)},e.prototype.remove=function(t,a){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(a)},e.prototype.dispose=function(t,a){this.remove(t,a)},e.type="lines",e}(Rt),vH=typeof Uint32Array>"u"?Array:Uint32Array,cH=typeof Float64Array>"u"?Array:Float64Array;function GS(r){var e=r.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(r.data=G(e,function(t){var a=[t[0].coord,t[1].coord],n={coords:a};return t[0].name&&(n.fromName=t[0].name),t[1].name&&(n.toName=t[1].name),Zd([n,t[0],t[1]])}))}var pH=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.visualStyleAccessPath="lineStyle",t.visualDrawType="stroke",t}return e.prototype.init=function(t){t.data=t.data||[],GS(t);var a=this._processFlatCoordsArray(t.data);this._flatCoords=a.flatCoords,this._flatCoordsOffset=a.flatCoordsOffset,a.flatCoords&&(t.data=new Float32Array(a.count)),r.prototype.init.apply(this,arguments)},e.prototype.mergeOption=function(t){if(GS(t),t.data){var a=this._processFlatCoordsArray(t.data);this._flatCoords=a.flatCoords,this._flatCoordsOffset=a.flatCoordsOffset,a.flatCoords&&(t.data=new Float32Array(a.count))}r.prototype.mergeOption.apply(this,arguments)},e.prototype.appendData=function(t){var a=this._processFlatCoordsArray(t.data);a.flatCoords&&(this._flatCoords?(this._flatCoords=Is(this._flatCoords,a.flatCoords),this._flatCoordsOffset=Is(this._flatCoordsOffset,a.flatCoordsOffset)):(this._flatCoords=a.flatCoords,this._flatCoordsOffset=a.flatCoordsOffset),t.data=new Float32Array(a.count)),this.getRawData().appendData(t.data)},e.prototype._getCoordsFromItemModel=function(t){var a=this.getData().getItemModel(t),n=a.option instanceof Array?a.option:a.getShallow("coords");return n},e.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[t*2+1]:this._getCoordsFromItemModel(t).length},e.prototype.getLineCoords=function(t,a){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[t*2],i=this._flatCoordsOffset[t*2+1],o=0;o ")})},e.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},e.prototype.getProgressive=function(){var t=this.option.progressive;return t??(this.option.large?1e4:this.get("progressive"))},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return t??(this.option.large?2e4:this.get("progressiveThreshold"))},e.prototype.getZLevelKey=function(){var t=this.getModel("effect"),a=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&a>0?a+"":""},e.type="series.lines",e.dependencies=["grid","polar","geo","calendar"],e.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},e}(Vt);function yu(r){return r instanceof Array||(r=[r,r]),r}var dH={seriesType:"lines",reset:function(r){var e=yu(r.get("symbol")),t=yu(r.get("symbolSize")),a=r.getData();a.setVisual("fromSymbol",e&&e[0]),a.setVisual("toSymbol",e&&e[1]),a.setVisual("fromSymbolSize",t&&t[0]),a.setVisual("toSymbolSize",t&&t[1]);function n(i,o){var s=i.getItemModel(o),l=yu(s.getShallow("symbol",!0)),u=yu(s.getShallow("symbolSize",!0));l[0]&&i.setItemVisual(o,"fromSymbol",l[0]),l[1]&&i.setItemVisual(o,"toSymbol",l[1]),u[0]&&i.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&i.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:a.hasItemOption?n:null}}};function gH(r){r.registerChartView(hH),r.registerSeriesModel(pH),r.registerLayout(CM),r.registerVisual(dH)}var yH=256,mH=function(){function r(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=Ya.createCanvas();this.canvas=e}return r.prototype.update=function(e,t,a,n,i,o){var s=this._getBrush(),l=this._getGradient(i,"inRange"),u=this._getGradient(i,"outOfRange"),f=this.pointSize+this.blurSize,h=this.canvas,v=h.getContext("2d"),c=e.length;h.width=t,h.height=a;for(var p=0;p0){var I=o(_)?l:u;_>0&&(_=_*C+T),b[x++]=I[M],b[x++]=I[M+1],b[x++]=I[M+2],b[x++]=I[M+3]*_*256}else x+=4}return v.putImageData(S,0,0),h},r.prototype._getBrush=function(){var e=this._brushCanvas||(this._brushCanvas=Ya.createCanvas()),t=this.pointSize+this.blurSize,a=t*2;e.width=a,e.height=a;var n=e.getContext("2d");return n.clearRect(0,0,a,a),n.shadowOffsetX=a,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-t,t,this.pointSize,0,Math.PI*2,!0),n.closePath(),n.fill(),e},r.prototype._getGradient=function(e,t){for(var a=this._gradientPixels,n=a[t]||(a[t]=new Uint8ClampedArray(256*4)),i=[0,0,0,0],o=0,s=0;s<256;s++)e[t](s/255,!0,i),n[o++]=i[0],n[o++]=i[1],n[o++]=i[2],n[o++]=i[3];return n},r}();function _H(r,e,t){var a=r[1]-r[0];e=G(e,function(o){return{interval:[(o.interval[0]-r[0])/a,(o.interval[1]-r[0])/a]}});var n=e.length,i=0;return function(o){var s;for(s=i;s=0;s--){var l=e[s].interval;if(l[0]<=o&&o<=l[1]){i=s;break}}return s>=0&&s=e[0]&&a<=e[1]}}function FS(r){var e=r.dimensions;return e[0]==="lng"&&e[1]==="lat"}var xH=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){var i;a.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===t&&(i=s)})}),this._progressiveEls=null,this.group.removeAll();var o=t.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"?this._renderOnCartesianAndCalendar(t,n,0,t.getData().count()):FS(o)&&this._renderOnGeo(o,t,i,n)},e.prototype.incrementalPrepareRender=function(t,a,n){this.group.removeAll()},e.prototype.incrementalRender=function(t,a,n,i){var o=a.coordinateSystem;o&&(FS(o)?this.render(a,n,i):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(a,i,t.start,t.end,!0)))},e.prototype.eachRendered=function(t){Qa(this._progressiveEls||this.group,t)},e.prototype._renderOnCartesianAndCalendar=function(t,a,n,i,o){var s=t.coordinateSystem,l=vi(s,"cartesian2d"),u,f,h,v;if(l){var c=s.getAxis("x"),p=s.getAxis("y");u=c.getBandWidth()+.5,f=p.getBandWidth()+.5,h=c.scale.getExtent(),v=p.scale.getExtent()}for(var d=this.group,g=t.getData(),y=t.getModel(["emphasis","itemStyle"]).getItemStyle(),m=t.getModel(["blur","itemStyle"]).getItemStyle(),_=t.getModel(["select","itemStyle"]).getItemStyle(),S=t.get(["itemStyle","borderRadius"]),b=ne(t),x=t.getModel("emphasis"),w=x.get("focus"),T=x.get("blurScope"),A=x.get("disabled"),C=l?[g.mapDimension("x"),g.mapDimension("y"),g.mapDimension("value")]:[g.mapDimension("time"),g.mapDimension("value")],M=n;Mh[1]||Rv[1])continue;var E=s.dataToPoint([P,R]);I=new St({shape:{x:E[0]-u/2,y:E[1]-f/2,width:u,height:f},style:L})}else{if(isNaN(g.get(C[1],M)))continue;I=new St({z2:1,shape:s.dataToRect([g.get(C[0],M)]).contentShape,style:L})}if(g.hasItemOption){var N=g.getItemModel(M),O=N.getModel("emphasis");y=O.getModel("itemStyle").getItemStyle(),m=N.getModel(["blur","itemStyle"]).getItemStyle(),_=N.getModel(["select","itemStyle"]).getItemStyle(),S=N.get(["itemStyle","borderRadius"]),w=O.get("focus"),T=O.get("blurScope"),A=O.get("disabled"),b=ne(N)}I.shape.r=S;var B=t.getRawValue(M),F="-";B&&B[2]!=null&&(F=B[2]+""),ve(I,b,{labelFetcher:t,labelDataIndex:M,defaultOpacity:L.opacity,defaultText:F}),I.ensureState("emphasis").style=y,I.ensureState("blur").style=m,I.ensureState("select").style=_,Ht(I,w,T,A),I.incremental=o,o&&(I.states.emphasis.hoverLayer=!0),d.add(I),g.setItemGraphicEl(M,I),this._progressiveEls&&this._progressiveEls.push(I)}},e.prototype._renderOnGeo=function(t,a,n,i){var o=n.targetVisuals.inRange,s=n.targetVisuals.outOfRange,l=a.getData(),u=this._hmLayer||this._hmLayer||new mH;u.blurSize=a.get("blurSize"),u.pointSize=a.get("pointSize"),u.minOpacity=a.get("minOpacity"),u.maxOpacity=a.get("maxOpacity");var f=t.getViewRect().clone(),h=t.getRoamTransform();f.applyTransform(h);var v=Math.max(f.x,0),c=Math.max(f.y,0),p=Math.min(f.width+f.x,i.getWidth()),d=Math.min(f.height+f.y,i.getHeight()),g=p-v,y=d-c,m=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],_=l.mapArray(m,function(w,T,A){var C=t.dataToPoint([w,T]);return C[0]-=v,C[1]-=c,C.push(A),C}),S=n.getExtent(),b=n.type==="visualMap.continuous"?SH(S,n.option.range):_H(S,n.getPieceList(),n.option.selected);u.update(_,g,y,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},b);var x=new le({style:{width:g,height:y,x:v,y:c,image:u.canvas},silent:!0});this.group.add(x)},e.type="heatmap",e}(Rt),bH=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.getInitialData=function(t,a){return ga(null,this,{generateCoord:"value"})},e.prototype.preventIncremental=function(){var t=vl.get(this.get("coordinateSystem"));if(t&&t.dimensions)return t.dimensions[0]==="lng"&&t.dimensions[1]==="lat"},e.type="series.heatmap",e.dependencies=["grid","geo","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:"#212121"}}},e}(Vt);function wH(r){r.registerChartView(xH),r.registerSeriesModel(bH)}var TH=["itemStyle","borderWidth"],HS=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],Mc=new da,AH=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){var i=this.group,o=t.getData(),s=this._data,l=t.coordinateSystem,u=l.getBaseAxis(),f=u.isHorizontal(),h=l.master.getRect(),v={ecSize:{width:n.getWidth(),height:n.getHeight()},seriesModel:t,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:f,valueDim:HS[+f],categoryDim:HS[1-+f]};o.diff(s).add(function(p){if(o.hasValue(p)){var d=US(o,p),g=WS(o,p,d,v),y=YS(o,v,g);o.setItemGraphicEl(p,y),i.add(y),ZS(y,v,g)}}).update(function(p,d){var g=s.getItemGraphicEl(d);if(!o.hasValue(p)){i.remove(g);return}var y=US(o,p),m=WS(o,p,y,v),_=RM(o,m);g&&_!==g.__pictorialShapeStr&&(i.remove(g),o.setItemGraphicEl(p,null),g=null),g?RH(g,v,m):g=YS(o,v,m,!0),o.setItemGraphicEl(p,g),g.__pictorialSymbolMeta=m,i.add(g),ZS(g,v,m)}).remove(function(p){var d=s.getItemGraphicEl(p);d&&XS(s,p,d.__pictorialSymbolMeta.animationModel,d)}).execute();var c=t.get("clip",!0)?ml(t.coordinateSystem,!1,t):null;return c?i.setClipPath(c):i.removeClipPath(),this._data=o,this.group},e.prototype.remove=function(t,a){var n=this.group,i=this._data;t.get("animation")?i&&i.eachItemGraphicEl(function(o){XS(i,nt(o).dataIndex,t,o)}):n.removeAll()},e.type="pictorialBar",e}(Rt);function WS(r,e,t,a){var n=r.getItemLayout(e),i=t.get("symbolRepeat"),o=t.get("symbolClip"),s=t.get("symbolPosition")||"start",l=t.get("symbolRotate"),u=(l||0)*Math.PI/180||0,f=t.get("symbolPatternSize")||2,h=t.isAnimationEnabled(),v={dataIndex:e,layout:n,itemModel:t,symbolType:r.getItemVisual(e,"symbol")||"circle",style:r.getItemVisual(e,"style"),symbolClip:o,symbolRepeat:i,symbolRepeatDirection:t.get("symbolRepeatDirection"),symbolPatternSize:f,rotation:u,animationModel:h?t:null,hoverScale:h&&t.get(["emphasis","scale"]),z2:t.getShallow("z",!0)||0};CH(t,i,n,a,v),DH(r,e,n,i,o,v.boundingLength,v.pxSign,f,a,v),MH(t,v.symbolScale,u,a,v);var c=v.symbolSize,p=fi(t.get("symbolOffset"),c);return IH(t,c,n,i,o,p,s,v.valueLineWidth,v.boundingLength,v.repeatCutLength,a,v),v}function CH(r,e,t,a,n){var i=a.valueDim,o=r.get("symbolBoundingData"),s=a.coordSys.getOtherAxis(a.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(t[i.wh]<=0),f;if(z(o)){var h=[Ic(s,o[0])-l,Ic(s,o[1])-l];h[1]=0?1:-1:f>0?1:-1}function Ic(r,e){return r.toGlobalCoord(r.dataToCoord(r.scale.parse(e)))}function DH(r,e,t,a,n,i,o,s,l,u){var f=l.valueDim,h=l.categoryDim,v=Math.abs(t[h.wh]),c=r.getItemVisual(e,"symbolSize"),p;z(c)?p=c.slice():c==null?p=["100%","100%"]:p=[c,c],p[h.index]=W(p[h.index],v),p[f.index]=W(p[f.index],a?v:Math.abs(i)),u.symbolSize=p;var d=u.symbolScale=[p[0]/s,p[1]/s];d[f.index]*=(l.isHorizontal?-1:1)*o}function MH(r,e,t,a,n){var i=r.get(TH)||0;i&&(Mc.attr({scaleX:e[0],scaleY:e[1],rotation:t}),Mc.updateTransform(),i/=Mc.getLineScale(),i*=e[a.valueDim.index]),n.valueLineWidth=i||0}function IH(r,e,t,a,n,i,o,s,l,u,f,h){var v=f.categoryDim,c=f.valueDim,p=h.pxSign,d=Math.max(e[c.index]+s,0),g=d;if(a){var y=Math.abs(l),m=se(r.get("symbolMargin"),"15%")+"",_=!1;m.lastIndexOf("!")===m.length-1&&(_=!0,m=m.slice(0,m.length-1));var S=W(m,e[c.index]),b=Math.max(d+S*2,0),x=_?0:S*2,w=Bw(a),T=w?a:$S((y+x)/b),A=y-T*d;S=A/2/(_?T:Math.max(T-1,1)),b=d+S*2,x=_?0:S*2,!w&&a!=="fixed"&&(T=u?$S((Math.abs(u)+x)/b):0),g=T*b-x,h.repeatTimes=T,h.symbolMargin=S}var C=p*(g/2),M=h.pathPosition=[];M[v.index]=t[v.wh]/2,M[c.index]=o==="start"?C:o==="end"?l-C:l/2,i&&(M[0]+=i[0],M[1]+=i[1]);var I=h.bundlePosition=[];I[v.index]=t[v.xy],I[c.index]=t[c.xy];var L=h.barRectShape=V({},t);L[c.wh]=p*Math.max(Math.abs(t[c.wh]),Math.abs(M[c.index]+C)),L[v.wh]=t[v.wh];var P=h.clipShape={};P[v.xy]=-t[v.xy],P[v.wh]=f.ecSize[v.wh],P[c.xy]=0,P[c.wh]=t[c.wh]}function DM(r){var e=r.symbolPatternSize,t=qt(r.symbolType,-e/2,-e/2,e,e);return t.attr({culling:!0}),t.type!=="image"&&t.setStyle({strokeNoScale:!0}),t}function MM(r,e,t,a){var n=r.__pictorialBundle,i=t.symbolSize,o=t.valueLineWidth,s=t.pathPosition,l=e.valueDim,u=t.repeatTimes||0,f=0,h=i[e.valueDim.index]+o+t.symbolMargin*2;for(Ty(r,function(d){d.__pictorialAnimationIndex=f,d.__pictorialRepeatTimes=u,f0:y<0)&&(m=u-1-d),g[l.index]=h*(m-u/2+.5)+s[l.index],{x:g[0],y:g[1],scaleX:t.symbolScale[0],scaleY:t.symbolScale[1],rotation:t.rotation}}}function IM(r,e,t,a){var n=r.__pictorialBundle,i=r.__pictorialMainPath;i?Ki(i,null,{x:t.pathPosition[0],y:t.pathPosition[1],scaleX:t.symbolScale[0],scaleY:t.symbolScale[1],rotation:t.rotation},t,a):(i=r.__pictorialMainPath=DM(t),n.add(i),Ki(i,{x:t.pathPosition[0],y:t.pathPosition[1],scaleX:0,scaleY:0,rotation:t.rotation},{scaleX:t.symbolScale[0],scaleY:t.symbolScale[1]},t,a))}function LM(r,e,t){var a=V({},e.barRectShape),n=r.__pictorialBarRect;n?Ki(n,null,{shape:a},e,t):(n=r.__pictorialBarRect=new St({z2:2,shape:a,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),n.disableMorphing=!0,r.add(n))}function PM(r,e,t,a){if(t.symbolClip){var n=r.__pictorialClipPath,i=V({},t.clipShape),o=e.valueDim,s=t.animationModel,l=t.dataIndex;if(n)Tt(n,{shape:i},s,l);else{i[o.wh]=0,n=new St({shape:i}),r.__pictorialBundle.setClipPath(n),r.__pictorialClipPath=n;var u={};u[o.wh]=t.clipShape[o.wh],ui[a?"updateProps":"initProps"](n,{shape:u},s,l)}}}function US(r,e){var t=r.getItemModel(e);return t.getAnimationDelayParams=LH,t.isAnimationEnabled=PH,t}function LH(r){return{index:r.__pictorialAnimationIndex,count:r.__pictorialRepeatTimes}}function PH(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function YS(r,e,t,a){var n=new at,i=new at;return n.add(i),n.__pictorialBundle=i,i.x=t.bundlePosition[0],i.y=t.bundlePosition[1],t.symbolRepeat?MM(n,e,t):IM(n,e,t),LM(n,t,a),PM(n,e,t,a),n.__pictorialShapeStr=RM(r,t),n.__pictorialSymbolMeta=t,n}function RH(r,e,t){var a=t.animationModel,n=t.dataIndex,i=r.__pictorialBundle;Tt(i,{x:t.bundlePosition[0],y:t.bundlePosition[1]},a,n),t.symbolRepeat?MM(r,e,t,!0):IM(r,e,t,!0),LM(r,t,!0),PM(r,e,t,!0)}function XS(r,e,t,a){var n=a.__pictorialBarRect;n&&n.removeTextContent();var i=[];Ty(a,function(o){i.push(o)}),a.__pictorialMainPath&&i.push(a.__pictorialMainPath),a.__pictorialClipPath&&(t=null),D(i,function(o){Za(o,{scaleX:0,scaleY:0},t,e,function(){a.parent&&a.parent.remove(a)})}),r.setItemGraphicEl(e,null)}function RM(r,e){return[r.getItemVisual(e.dataIndex,"symbol")||"none",!!e.symbolRepeat,!!e.symbolClip].join(":")}function Ty(r,e,t){D(r.__pictorialBundle.children(),function(a){a!==r.__pictorialBarRect&&e.call(t,a)})}function Ki(r,e,t,a,n,i){e&&r.attr(e),a.symbolClip&&!n?t&&r.attr(t):t&&ui[n?"updateProps":"initProps"](r,t,a.animationModel,a.dataIndex,i)}function ZS(r,e,t){var a=t.dataIndex,n=t.itemModel,i=n.getModel("emphasis"),o=i.getModel("itemStyle").getItemStyle(),s=n.getModel(["blur","itemStyle"]).getItemStyle(),l=n.getModel(["select","itemStyle"]).getItemStyle(),u=n.getShallow("cursor"),f=i.get("focus"),h=i.get("blurScope"),v=i.get("scale");Ty(r,function(d){if(d instanceof le){var g=d.style;d.useStyle(V({image:g.image,x:g.x,y:g.y,width:g.width,height:g.height},t.style))}else d.useStyle(t.style);var y=d.ensureState("emphasis");y.style=o,v&&(y.scaleX=d.scaleX*1.1,y.scaleY=d.scaleY*1.1),d.ensureState("blur").style=s,d.ensureState("select").style=l,u&&(d.cursor=u),d.z2=t.z2});var c=e.valueDim.posDesc[+(t.boundingLength>0)],p=r.__pictorialBarRect;p.ignoreClip=!0,ve(p,ne(n),{labelFetcher:e.seriesModel,labelDataIndex:a,defaultText:ao(e.seriesModel.getData(),a),inheritColor:t.style.fill,defaultOpacity:t.style.opacity,defaultOutsidePosition:c}),Ht(r,f,h,i.get("disabled"))}function $S(r){var e=Math.round(r);return Math.abs(r-e)<1e-4?e:Math.ceil(r)}var EH=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t.defaultSymbol="roundRect",t}return e.prototype.getInitialData=function(t){return t.stack=null,r.prototype.getInitialData.apply(this,arguments)},e.type="series.pictorialBar",e.dependencies=["grid"],e.defaultOption=ja(Zs.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:"#212121"}}}),e}(Zs);function kH(r){r.registerChartView(AH),r.registerSeriesModel(EH),r.registerLayout(r.PRIORITY.VISUAL.LAYOUT,lt(dC,"pictorialBar")),r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,gC("pictorialBar"))}var OH=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._layers=[],t}return e.prototype.render=function(t,a,n){var i=t.getData(),o=this,s=this.group,l=t.getLayerSeries(),u=i.getLayout("layoutInfo"),f=u.rect,h=u.boundaryGap;s.x=0,s.y=f.y+h[0];function v(g){return g.name}var c=new fa(this._layersSeries||[],l,v,v),p=[];c.add(X(d,this,"add")).update(X(d,this,"update")).remove(X(d,this,"remove")).execute();function d(g,y,m){var _=o._layers;if(g==="remove"){s.remove(_[y]);return}for(var S=[],b=[],x,w=l[y].indices,T=0;Ti&&(i=s),a.push(s)}for(var u=0;ui&&(i=h)}return{y0:n,max:i}}function GH(r){r.registerChartView(OH),r.registerSeriesModel(BH),r.registerLayout(VH),r.registerProcessor(Sl("themeRiver"))}var FH=2,HH=4,KS=function(r){k(e,r);function e(t,a,n,i){var o=r.call(this)||this;o.z2=FH,o.textConfig={inside:!0},nt(o).seriesIndex=a.seriesIndex;var s=new bt({z2:HH,silent:t.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,t,a,n,i),o}return e.prototype.updateData=function(t,a,n,i,o){this.node=a,a.piece=this,n=n||this._seriesModel,i=i||this._ecModel;var s=this;nt(s).dataIndex=a.dataIndex;var l=a.getModel(),u=l.getModel("emphasis"),f=a.getLayout(),h=V({},f);h.label=null;var v=a.getVisual("style");v.lineJoin="bevel";var c=a.getVisual("decal");c&&(v.decal=eo(c,o));var p=Wn(l.getModel("itemStyle"),h,!0);V(h,p),D(De,function(m){var _=s.ensureState(m),S=l.getModel([m,"itemStyle"]);_.style=S.getItemStyle();var b=Wn(S,h);b&&(_.shape=b)}),t?(s.setShape(h),s.shape.r=f.r0,zt(s,{shape:{r:f.r}},n,a.dataIndex)):(Tt(s,{shape:h},n),Sr(s)),s.useStyle(v),this._updateLabel(n);var d=l.getShallow("cursor");d&&s.attr("cursor",d),this._seriesModel=n||this._seriesModel,this._ecModel=i||this._ecModel;var g=u.get("focus"),y=g==="relative"?Is(a.getAncestorsIndices(),a.getDescendantIndices()):g==="ancestor"?a.getAncestorsIndices():g==="descendant"?a.getDescendantIndices():g;Ht(this,y,u.get("blurScope"),u.get("disabled"))},e.prototype._updateLabel=function(t){var a=this,n=this.node.getModel(),i=n.getModel("label"),o=this.node.getLayout(),s=o.endAngle-o.startAngle,l=(o.startAngle+o.endAngle)/2,u=Math.cos(l),f=Math.sin(l),h=this,v=h.getTextContent(),c=this.node.dataIndex,p=i.get("minAngle")/180*Math.PI,d=i.get("show")&&!(p!=null&&Math.abs(s)P&&!Es(E-P)&&E0?(o.virtualPiece?o.virtualPiece.updateData(!1,m,t,a,n):(o.virtualPiece=new KS(m,t,a,n),f.add(o.virtualPiece)),_.piece.off("click"),o.virtualPiece.on("click",function(S){o._rootToNode(_.parentNode)})):o.virtualPiece&&(f.remove(o.virtualPiece),o.virtualPiece=null)}},e.prototype._initEvents=function(){var t=this;this.group.off("click"),this.group.on("click",function(a){var n=!1,i=t.seriesModel.getViewRoot();i.eachNode(function(o){if(!n&&o.piece&&o.piece===a.target){var s=o.getModel().get("nodeClick");if(s==="rootToNode")t._rootToNode(o);else if(s==="link"){var l=o.getModel(),u=l.get("link");if(u){var f=l.get("target",!0)||"_blank";hf(u,f)}}n=!0}})})},e.prototype._rootToNode=function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:Td,from:this.uid,seriesId:this.seriesModel.id,targetNode:t})},e.prototype.containPoint=function(t,a){var n=a.getData(),i=n.getItemLayout(0);if(i){var o=t[0]-i.cx,s=t[1]-i.cy,l=Math.sqrt(o*o+s*s);return l<=i.r&&l>=i.r0}},e.type="sunburst",e}(Rt),XH=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.ignoreStyleOnData=!0,t}return e.prototype.getInitialData=function(t,a){var n={name:t.name,children:t.data};EM(n);var i=this._levelModels=G(t.levels||[],function(l){return new Mt(l,this,a)},this),o=sy.createTree(n,this,s);function s(l){l.wrapMethod("getItemModel",function(u,f){var h=o.getNodeByDataIndex(f),v=i[h.depth];return v&&(u.parentModel=v),u})}return o.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.getDataParams=function(t){var a=r.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(t);return a.treePathInfo=Ah(n,this),a},e.prototype.getLevelModel=function(t){return this._levelModels&&this._levelModels[t.depth]},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var a=this.getRawData().tree.root;(!t||t!==a&&!a.contains(t))&&(this._viewRoot=a)},e.prototype.enableAriaDecal=function(){VD(this)},e.type="series.sunburst",e.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"},e}(Vt);function EM(r){var e=0;D(r.children,function(a){EM(a);var n=a.value;z(n)&&(n=n[0]),e+=n});var t=r.value;z(t)&&(t=t[0]),(t==null||isNaN(t))&&(t=e),t<0&&(t=0),z(r.value)?r.value[0]=t:r.value=t}var QS=Math.PI/180;function ZH(r,e,t){e.eachSeriesByType(r,function(a){var n=a.get("center"),i=a.get("radius");z(i)||(i=[0,i]),z(n)||(n=[n,n]);var o=t.getWidth(),s=t.getHeight(),l=Math.min(o,s),u=W(n[0],o),f=W(n[1],s),h=W(i[0],l/2),v=W(i[1],l/2),c=-a.get("startAngle")*QS,p=a.get("minAngle")*QS,d=a.getData().tree.root,g=a.getViewRoot(),y=g.depth,m=a.get("sort");m!=null&&kM(g,m);var _=0;D(g.children,function(E){!isNaN(E.getValue())&&_++});var S=g.getValue(),b=Math.PI/(S||_)*2,x=g.depth>0,w=g.height-(x?-1:1),T=(v-h)/(w||1),A=a.get("clockwise"),C=a.get("stillShowZeroSum"),M=A?1:-1,I=function(E,N){if(E){var O=N;if(E!==d){var B=E.getValue(),F=S===0&&C?b:B*b;F1;)o=o.parentNode;var s=n.getColorFromPalette(o.name||o.dataIndex+"",e);return a.depth>1&&Y(s)&&(s=vp(s,(a.depth-1)/(i-1)*.5)),s}r.eachSeriesByType("sunburst",function(a){var n=a.getData(),i=n.tree;i.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=t(o,a,i.root.height));var u=n.ensureUniqueItemVisual(o.dataIndex,"style");V(u,l)})})}function KH(r){r.registerChartView(YH),r.registerSeriesModel(XH),r.registerLayout(lt(ZH,"sunburst")),r.registerProcessor(lt(Sl,"sunburst")),r.registerVisual(qH),UH(r)}var jS={color:"fill",borderColor:"stroke"},JH={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},na=xt(),QH=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},e.prototype.getInitialData=function(t,a){return ga(null,this)},e.prototype.getDataParams=function(t,a,n){var i=r.prototype.getDataParams.call(this,t,a);return n&&(i.info=na(n).info),i},e.type="series.custom",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,clip:!1},e}(Vt);function jH(r,e){return e=e||[0,0],G(["x","y"],function(t,a){var n=this.getAxis(t),i=e[a],o=r[a]/2;return n.type==="category"?n.getBandWidth():Math.abs(n.dataToCoord(i-o)-n.dataToCoord(i+o))},this)}function t4(r){var e=r.master.getRect();return{coordSys:{type:"cartesian2d",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:function(t){return r.dataToPoint(t)},size:X(jH,r)}}}function e4(r,e){return e=e||[0,0],G([0,1],function(t){var a=e[t],n=r[t]/2,i=[],o=[];return i[t]=a-n,o[t]=a+n,i[1-t]=o[1-t]=e[1-t],Math.abs(this.dataToPoint(i)[t]-this.dataToPoint(o)[t])},this)}function r4(r){var e=r.getBoundingRect();return{coordSys:{type:"geo",x:e.x,y:e.y,width:e.width,height:e.height,zoom:r.getZoom()},api:{coord:function(t){return r.dataToPoint(t)},size:X(e4,r)}}}function a4(r,e){var t=this.getAxis(),a=e instanceof Array?e[0]:e,n=(r instanceof Array?r[0]:r)/2;return t.type==="category"?t.getBandWidth():Math.abs(t.dataToCoord(a-n)-t.dataToCoord(a+n))}function n4(r){var e=r.getRect();return{coordSys:{type:"singleAxis",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:function(t){return r.dataToPoint(t)},size:X(a4,r)}}}function i4(r,e){return e=e||[0,0],G(["Radius","Angle"],function(t,a){var n="get"+t+"Axis",i=this[n](),o=e[a],s=r[a]/2,l=i.type==="category"?i.getBandWidth():Math.abs(i.dataToCoord(o-s)-i.dataToCoord(o+s));return t==="Angle"&&(l=l*Math.PI/180),l},this)}function o4(r){var e=r.getRadiusAxis(),t=r.getAngleAxis(),a=e.getExtent();return a[0]>a[1]&&a.reverse(),{coordSys:{type:"polar",cx:r.cx,cy:r.cy,r:a[1],r0:a[0]},api:{coord:function(n){var i=e.dataToRadius(n[0]),o=t.dataToAngle(n[1]),s=r.coordToPoint([i,o]);return s.push(i,o*Math.PI/180),s},size:X(i4,r)}}}function s4(r){var e=r.getRect(),t=r.getRangeInfo();return{coordSys:{type:"calendar",x:e.x,y:e.y,width:e.width,height:e.height,cellWidth:r.getCellWidth(),cellHeight:r.getCellHeight(),rangeInfo:{start:t.start,end:t.end,weeks:t.weeks,dayCount:t.allDay}},api:{coord:function(a,n){return r.dataToPoint(a,n)}}}}function OM(r,e,t,a){return r&&(r.legacy||r.legacy!==!1&&!t&&!a&&e!=="tspan"&&(e==="text"||Z(r,"text")))}function NM(r,e,t){var a=r,n,i,o;if(e==="text")o=a;else{o={},Z(a,"text")&&(o.text=a.text),Z(a,"rich")&&(o.rich=a.rich),Z(a,"textFill")&&(o.fill=a.textFill),Z(a,"textStroke")&&(o.stroke=a.textStroke),Z(a,"fontFamily")&&(o.fontFamily=a.fontFamily),Z(a,"fontSize")&&(o.fontSize=a.fontSize),Z(a,"fontStyle")&&(o.fontStyle=a.fontStyle),Z(a,"fontWeight")&&(o.fontWeight=a.fontWeight),i={type:"text",style:o,silent:!0},n={};var s=Z(a,"textPosition");t?n.position=s?a.textPosition:"inside":s&&(n.position=a.textPosition),Z(a,"textPosition")&&(n.position=a.textPosition),Z(a,"textOffset")&&(n.offset=a.textOffset),Z(a,"textRotation")&&(n.rotation=a.textRotation),Z(a,"textDistance")&&(n.distance=a.textDistance)}return tx(o,r),D(o.rich,function(l){tx(l,l)}),{textConfig:n,textContent:i}}function tx(r,e){e&&(e.font=e.textFont||e.font,Z(e,"textStrokeWidth")&&(r.lineWidth=e.textStrokeWidth),Z(e,"textAlign")&&(r.align=e.textAlign),Z(e,"textVerticalAlign")&&(r.verticalAlign=e.textVerticalAlign),Z(e,"textLineHeight")&&(r.lineHeight=e.textLineHeight),Z(e,"textWidth")&&(r.width=e.textWidth),Z(e,"textHeight")&&(r.height=e.textHeight),Z(e,"textBackgroundColor")&&(r.backgroundColor=e.textBackgroundColor),Z(e,"textPadding")&&(r.padding=e.textPadding),Z(e,"textBorderColor")&&(r.borderColor=e.textBorderColor),Z(e,"textBorderWidth")&&(r.borderWidth=e.textBorderWidth),Z(e,"textBorderRadius")&&(r.borderRadius=e.textBorderRadius),Z(e,"textBoxShadowColor")&&(r.shadowColor=e.textBoxShadowColor),Z(e,"textBoxShadowBlur")&&(r.shadowBlur=e.textBoxShadowBlur),Z(e,"textBoxShadowOffsetX")&&(r.shadowOffsetX=e.textBoxShadowOffsetX),Z(e,"textBoxShadowOffsetY")&&(r.shadowOffsetY=e.textBoxShadowOffsetY))}function ex(r,e,t){var a=r;a.textPosition=a.textPosition||t.position||"inside",t.offset!=null&&(a.textOffset=t.offset),t.rotation!=null&&(a.textRotation=t.rotation),t.distance!=null&&(a.textDistance=t.distance);var n=a.textPosition.indexOf("inside")>=0,i=r.fill||"#000";rx(a,e);var o=a.textFill==null;return n?o&&(a.textFill=t.insideFill||"#fff",!a.textStroke&&t.insideStroke&&(a.textStroke=t.insideStroke),!a.textStroke&&(a.textStroke=i),a.textStrokeWidth==null&&(a.textStrokeWidth=2)):(o&&(a.textFill=r.fill||t.outsideFill||"#000"),!a.textStroke&&t.outsideStroke&&(a.textStroke=t.outsideStroke)),a.text=e.text,a.rich=e.rich,D(e.rich,function(s){rx(s,s)}),a}function rx(r,e){e&&(Z(e,"fill")&&(r.textFill=e.fill),Z(e,"stroke")&&(r.textStroke=e.fill),Z(e,"lineWidth")&&(r.textStrokeWidth=e.lineWidth),Z(e,"font")&&(r.font=e.font),Z(e,"fontStyle")&&(r.fontStyle=e.fontStyle),Z(e,"fontWeight")&&(r.fontWeight=e.fontWeight),Z(e,"fontSize")&&(r.fontSize=e.fontSize),Z(e,"fontFamily")&&(r.fontFamily=e.fontFamily),Z(e,"align")&&(r.textAlign=e.align),Z(e,"verticalAlign")&&(r.textVerticalAlign=e.verticalAlign),Z(e,"lineHeight")&&(r.textLineHeight=e.lineHeight),Z(e,"width")&&(r.textWidth=e.width),Z(e,"height")&&(r.textHeight=e.height),Z(e,"backgroundColor")&&(r.textBackgroundColor=e.backgroundColor),Z(e,"padding")&&(r.textPadding=e.padding),Z(e,"borderColor")&&(r.textBorderColor=e.borderColor),Z(e,"borderWidth")&&(r.textBorderWidth=e.borderWidth),Z(e,"borderRadius")&&(r.textBorderRadius=e.borderRadius),Z(e,"shadowColor")&&(r.textBoxShadowColor=e.shadowColor),Z(e,"shadowBlur")&&(r.textBoxShadowBlur=e.shadowBlur),Z(e,"shadowOffsetX")&&(r.textBoxShadowOffsetX=e.shadowOffsetX),Z(e,"shadowOffsetY")&&(r.textBoxShadowOffsetY=e.shadowOffsetY),Z(e,"textShadowColor")&&(r.textShadowColor=e.textShadowColor),Z(e,"textShadowBlur")&&(r.textShadowBlur=e.textShadowBlur),Z(e,"textShadowOffsetX")&&(r.textShadowOffsetX=e.textShadowOffsetX),Z(e,"textShadowOffsetY")&&(r.textShadowOffsetY=e.textShadowOffsetY))}var BM={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},ax=_t(BM);Gr(Hr,function(r,e){return r[e]=1,r},{});Hr.join(", ");var Pf=["","style","shape","extra"],oo=xt();function Ay(r,e,t,a,n){var i=r+"Animation",o=co(r,a,n)||{},s=oo(e).userDuring;return o.duration>0&&(o.during=s?X(v4,{el:e,userDuring:s}):null,o.setToFinal=!0,o.scope=r),V(o,t[i]),o}function Uu(r,e,t,a){a=a||{};var n=a.dataIndex,i=a.isInit,o=a.clearStyle,s=t.isAnimationEnabled(),l=oo(r),u=e.style;l.userDuring=e.during;var f={},h={};if(p4(r,e,h),ix("shape",e,h),ix("extra",e,h),!i&&s&&(c4(r,e,f),nx("shape",r,e,f),nx("extra",r,e,f),d4(r,e,u,f)),h.style=u,l4(r,h,o),f4(r,e),s)if(i){var v={};D(Pf,function(p){var d=p?e[p]:e;d&&d.enterFrom&&(p&&(v[p]=v[p]||{}),V(p?v[p]:v,d.enterFrom))});var c=Ay("enter",r,e,t,n);c.duration>0&&r.animateFrom(v,c)}else u4(r,e,n||0,t,f);VM(r,e),u?r.dirty():r.markRedraw()}function VM(r,e){for(var t=oo(r).leaveToProps,a=0;a0&&r.animateFrom(n,i)}}function f4(r,e){Z(e,"silent")&&(r.silent=e.silent),Z(e,"ignore")&&(r.ignore=e.ignore),r instanceof ir&&Z(e,"invisible")&&(r.invisible=e.invisible),r instanceof gt&&Z(e,"autoBatch")&&(r.autoBatch=e.autoBatch)}var Mr={},h4={setTransform:function(r,e){return Mr.el[r]=e,this},getTransform:function(r){return Mr.el[r]},setShape:function(r,e){var t=Mr.el,a=t.shape||(t.shape={});return a[r]=e,t.dirtyShape&&t.dirtyShape(),this},getShape:function(r){var e=Mr.el.shape;if(e)return e[r]},setStyle:function(r,e){var t=Mr.el,a=t.style;return a&&(a[r]=e,t.dirtyStyle&&t.dirtyStyle()),this},getStyle:function(r){var e=Mr.el.style;if(e)return e[r]},setExtra:function(r,e){var t=Mr.el.extra||(Mr.el.extra={});return t[r]=e,this},getExtra:function(r){var e=Mr.el.extra;if(e)return e[r]}};function v4(){var r=this,e=r.el;if(e){var t=oo(e).userDuring,a=r.userDuring;if(t!==a){r.el=r.userDuring=null;return}Mr.el=e,a(h4)}}function nx(r,e,t,a){var n=t[r];if(n){var i=e[r],o;if(i){var s=t.transition,l=n.transition;if(l)if(!o&&(o=a[r]={}),Qn(l))V(o,i);else for(var u=Pt(l),f=0;f=0){!o&&(o=a[r]={});for(var c=_t(i),f=0;f=0)){var v=r.getAnimationStyleProps(),c=v?v.style:null;if(c){!i&&(i=a.style={});for(var p=_t(t),u=0;u=0?e.getStore().get(N,R):void 0}var O=e.get(E.name,R),B=E&&E.ordinalMeta;return B?B.categories[O]:O}function x(P,R){R==null&&(R=u);var E=e.getItemVisual(R,"style"),N=E&&E.fill,O=E&&E.opacity,B=m(R,Va).getItemStyle();N!=null&&(B.fill=N),O!=null&&(B.opacity=O);var F={inheritColor:Y(N)?N:"#000"},H=_(R,Va),U=Bt(H,null,F,!1,!0);U.text=H.getShallow("show")?st(r.getFormattedLabel(R,Va),ao(e,R)):null;var K=uf(H,F,!1);return A(P,B),B=ex(B,U,K),P&&T(B,P),B.legacy=!0,B}function w(P,R){R==null&&(R=u);var E=m(R,ia).getItemStyle(),N=_(R,ia),O=Bt(N,null,null,!0,!0);O.text=N.getShallow("show")?Br(r.getFormattedLabel(R,ia),r.getFormattedLabel(R,Va),ao(e,R)):null;var B=uf(N,null,!0);return A(P,E),E=ex(E,O,B),P&&T(E,P),E.legacy=!0,E}function T(P,R){for(var E in R)Z(R,E)&&(P[E]=R[E])}function A(P,R){P&&(P.textFill&&(R.textFill=P.textFill),P.textPosition&&(R.textPosition=P.textPosition))}function C(P,R){if(R==null&&(R=u),Z(jS,P)){var E=e.getItemVisual(R,"style");return E?E[jS[P]]:null}if(Z(JH,P))return e.getItemVisual(R,P)}function M(P){if(i.type==="cartesian2d"){var R=i.getBaseAxis();return pN(j({axis:R},P))}}function I(){return t.getCurrentSeriesIndices()}function L(P){return yg(P,t)}}function A4(r){var e={};return D(r.dimensions,function(t){var a=r.getDimensionInfo(t);if(!a.isExtraCoord){var n=a.coordDim,i=e[n]=e[n]||[];i[a.coordDimIndex]=r.getDimensionIndex(t)}}),e}function Ec(r,e,t,a,n,i,o){if(!a){i.remove(e);return}var s=Ly(r,e,t,a,n,i);return s&&o.setItemGraphicEl(t,s),s&&Ht(s,a.focus,a.blurScope,a.emphasisDisabled),s}function Ly(r,e,t,a,n,i){var o=-1,s=e;e&&HM(e,a,n)&&(o=ct(i.childrenRef(),e),e=null);var l=!e,u=e;u?u.clearStates():(u=My(a),s&&x4(s,u)),a.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),Ze.normal.cfg=Ze.normal.conOpt=Ze.emphasis.cfg=Ze.emphasis.conOpt=Ze.blur.cfg=Ze.blur.conOpt=Ze.select.cfg=Ze.select.conOpt=null,Ze.isLegacy=!1,D4(u,t,a,n,l,Ze),C4(u,t,a,n,l),Iy(r,u,t,a,Ze,n,l),Z(a,"info")&&(na(u).info=a.info);for(var f=0;f=0?i.replaceAt(u,o):i.add(u),u}function HM(r,e,t){var a=na(r),n=e.type,i=e.shape,o=e.style;return t.isUniversalTransitionEnabled()||n!=null&&n!==a.customGraphicType||n==="path"&&R4(i)&&WM(i)!==a.customPathData||n==="image"&&Z(o,"image")&&o.image!==a.customImagePath}function C4(r,e,t,a,n){var i=t.clipPath;if(i===!1)r&&r.getClipPath()&&r.removeClipPath();else if(i){var o=r.getClipPath();o&&HM(o,i,a)&&(o=null),o||(o=My(i),r.setClipPath(o)),Iy(null,o,e,i,null,a,n)}}function D4(r,e,t,a,n,i){if(!r.isGroup){sx(t,null,i),sx(t,ia,i);var o=i.normal.conOpt,s=i.emphasis.conOpt,l=i.blur.conOpt,u=i.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var f=r.getTextContent();if(o===!1)f&&r.removeTextContent();else{o=i.normal.conOpt=o||{type:"text"},f?f.clearStates():(f=My(o),r.setTextContent(f)),Iy(null,f,e,o,null,a,n);for(var h=o&&o.style,v=0;v=f;c--){var p=e.childAt(c);I4(e,p,n)}}}function I4(r,e,t){e&&Mh(e,na(r).option,t)}function L4(r){new fa(r.oldChildren,r.newChildren,lx,lx,r).add(ux).update(ux).remove(P4).execute()}function lx(r,e){var t=r&&r.name;return t??_4+e}function ux(r,e){var t=this.context,a=r!=null?t.newChildren[r]:null,n=e!=null?t.oldChildren[e]:null;Ly(t.api,n,t.dataIndex,a,t.seriesModel,t.group)}function P4(r){var e=this.context,t=e.oldChildren[r];t&&Mh(t,na(t).option,e.seriesModel)}function WM(r){return r&&(r.pathData||r.d)}function R4(r){return r&&(Z(r,"pathData")||Z(r,"d"))}function E4(r){r.registerChartView(b4),r.registerSeriesModel(QH)}var kn=xt(),fx=rt,kc=X,Ry=function(){function r(){this._dragging=!1,this.animationThreshold=15}return r.prototype.render=function(e,t,a,n){var i=t.get("value"),o=t.get("status");if(this._axisModel=e,this._axisPointerModel=t,this._api=a,!(!n&&this._lastValue===i&&this._lastStatus===o)){this._lastValue=i,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,i,e,t,a);var f=u.graphicKey;f!==this._lastGraphicKey&&this.clear(a),this._lastGraphicKey=f;var h=this._moveAnimation=this.determineAnimation(e,t);if(!s)s=this._group=new at,this.createPointerEl(s,u,e,t),this.createLabelEl(s,u,e,t),a.getZr().add(s);else{var v=lt(hx,t,h);this.updatePointerEl(s,u,v),this.updateLabelEl(s,u,v,t)}cx(s,t,!0),this._renderHandle(i)}},r.prototype.remove=function(e){this.clear(e)},r.prototype.dispose=function(e){this.clear(e)},r.prototype.determineAnimation=function(e,t){var a=t.get("animation"),n=e.axis,i=n.type==="category",o=t.get("snap");if(!o&&!i)return!1;if(a==="auto"||a==null){var s=this.animationThreshold;if(i&&n.getBandWidth()>s)return!0;if(o){var l=ty(e).seriesDataCount,u=n.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return a===!0},r.prototype.makeElOption=function(e,t,a,n,i){},r.prototype.createPointerEl=function(e,t,a,n){var i=t.pointer;if(i){var o=kn(e).pointerEl=new ui[i.type](fx(t.pointer));e.add(o)}},r.prototype.createLabelEl=function(e,t,a,n){if(t.label){var i=kn(e).labelEl=new bt(fx(t.label));e.add(i),vx(i,n)}},r.prototype.updatePointerEl=function(e,t,a){var n=kn(e).pointerEl;n&&t.pointer&&(n.setStyle(t.pointer.style),a(n,{shape:t.pointer.shape}))},r.prototype.updateLabelEl=function(e,t,a,n){var i=kn(e).labelEl;i&&(i.setStyle(t.label.style),a(i,{x:t.label.x,y:t.label.y}),vx(i,n))},r.prototype._renderHandle=function(e){if(!(this._dragging||!this.updateHandleTransform)){var t=this._axisPointerModel,a=this._api.getZr(),n=this._handle,i=t.getModel("handle"),o=t.get("status");if(!i.get("show")||!o||o==="hide"){n&&a.remove(n),this._handle=null;return}var s;this._handle||(s=!0,n=this._handle=hl(i.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){oa(u.event)},onmousedown:kc(this._onHandleDragMove,this,0,0),drift:kc(this._onHandleDragMove,this),ondragend:kc(this._onHandleDragEnd,this)}),a.add(n)),cx(n,t,!1),n.setStyle(i.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=i.get("size");z(l)||(l=[l,l]),n.scaleX=l[0]/2,n.scaleY=l[1]/2,xo(this,"_doDispatchAxisPointer",i.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,s)}},r.prototype._moveHandleToValue=function(e,t){hx(this._axisPointerModel,!t&&this._moveAnimation,this._handle,Oc(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},r.prototype._onHandleDragMove=function(e,t){var a=this._handle;if(a){this._dragging=!0;var n=this.updateHandleTransform(Oc(a),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=n,a.stopAnimation(),a.attr(Oc(n)),kn(a).lastProp=null,this._doDispatchAxisPointer()}},r.prototype._doDispatchAxisPointer=function(){var e=this._handle;if(e){var t=this._payloadInfo,a=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:a.axis.dim,axisIndex:a.componentIndex}]})}},r.prototype._onHandleDragEnd=function(){this._dragging=!1;var e=this._handle;if(e){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},r.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),a=this._group,n=this._handle;t&&a&&(this._lastGraphicKey=null,a&&t.remove(a),n&&t.remove(n),this._group=null,this._handle=null,this._payloadInfo=null),Fs(this,"_doDispatchAxisPointer")},r.prototype.doClear=function(){},r.prototype.buildLabel=function(e,t,a){return a=a||0,{x:e[a],y:e[1-a],width:t[a],height:t[1-a]}},r}();function hx(r,e,t,a){UM(kn(t).lastProp,a)||(kn(t).lastProp=a,e?Tt(t,a,r):(t.stopAnimation(),t.attr(a)))}function UM(r,e){if(et(r)&&et(e)){var t=!0;return D(e,function(a,n){t=t&&UM(r[n],a)}),!!t}else return r===e}function vx(r,e){r[e.get(["label","show"])?"show":"hide"]()}function Oc(r){return{x:r.x||0,y:r.y||0,rotation:r.rotation||0}}function cx(r,e,t){var a=e.get("z"),n=e.get("zlevel");r&&r.traverse(function(i){i.type!=="group"&&(a!=null&&(i.z=a),n!=null&&(i.zlevel=n),i.silent=t)})}function Ey(r){var e=r.get("type"),t=r.getModel(e+"Style"),a;return e==="line"?(a=t.getLineStyle(),a.fill=null):e==="shadow"&&(a=t.getAreaStyle(),a.stroke=null),a}function YM(r,e,t,a,n){var i=t.get("value"),o=XM(i,e.axis,e.ecModel,t.get("seriesDataIndices"),{precision:t.get(["label","precision"]),formatter:t.get(["label","formatter"])}),s=t.getModel("label"),l=yo(s.get("padding")||0),u=s.getFont(),f=nl(o,u),h=n.position,v=f.width+l[1]+l[3],c=f.height+l[0]+l[2],p=n.align;p==="right"&&(h[0]-=v),p==="center"&&(h[0]-=v/2);var d=n.verticalAlign;d==="bottom"&&(h[1]-=c),d==="middle"&&(h[1]-=c/2),k4(h,v,c,a);var g=s.get("backgroundColor");(!g||g==="auto")&&(g=e.get(["axisLine","lineStyle","color"])),r.label={x:h[0],y:h[1],style:Bt(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:g}),z2:10}}function k4(r,e,t,a){var n=a.getWidth(),i=a.getHeight();r[0]=Math.min(r[0]+e,n)-e,r[1]=Math.min(r[1]+t,i)-t,r[0]=Math.max(r[0],0),r[1]=Math.max(r[1],0)}function XM(r,e,t,a,n){r=e.scale.parse(r);var i=e.scale.getLabel({value:r},{precision:n.precision}),o=n.formatter;if(o){var s={value:Wg(e,{value:r}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};D(a,function(l){var u=t.getSeriesByIndex(l.seriesIndex),f=l.dataIndexInside,h=u&&u.getDataParams(f);h&&s.seriesData.push(h)}),Y(o)?i=o.replace("{value}",i):J(o)&&(i=o(s))}return i}function ky(r,e,t){var a=Fe();return si(a,a,t.rotation),Fr(a,a,t.position),mr([r.dataToCoord(e),(t.labelOffset||0)+(t.labelDirection||1)*(t.labelMargin||0)],a)}function ZM(r,e,t,a,n,i){var o=Ae.innerTextLayout(t.rotation,0,t.labelDirection);t.labelMargin=n.get(["label","margin"]),YM(e,a,n,i,{position:ky(a.axis,r,t),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function Oy(r,e,t){return t=t||0,{x1:r[t],y1:r[1-t],x2:e[t],y2:e[1-t]}}function $M(r,e,t){return t=t||0,{x:r[t],y:r[1-t],width:e[t],height:e[1-t]}}function px(r,e,t,a,n,i){return{cx:r,cy:e,r0:t,r:a,startAngle:n,endAngle:i,clockwise:!0}}var O4=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,a,n,i,o){var s=n.axis,l=s.grid,u=i.get("type"),f=dx(l,s).getOtherAxis(s).getGlobalExtent(),h=s.toGlobalCoord(s.dataToCoord(a,!0));if(u&&u!=="none"){var v=Ey(i),c=N4[u](s,h,f);c.style=v,t.graphicKey=c.type,t.pointer=c}var p=od(l.model,n);ZM(a,t,p,n,i,o)},e.prototype.getHandleTransform=function(t,a,n){var i=od(a.axis.grid.model,a,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var o=ky(a.axis,t,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,a,n,i){var o=n.axis,s=o.grid,l=o.getGlobalExtent(!0),u=dx(s,o).getOtherAxis(o).getGlobalExtent(),f=o.dim==="x"?0:1,h=[t.x,t.y];h[f]+=a[f],h[f]=Math.min(l[1],h[f]),h[f]=Math.max(l[0],h[f]);var v=(u[1]+u[0])/2,c=[v,v];c[f]=h[f];var p=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:t.rotation,cursorPoint:c,tooltipOption:p[f]}},e}(Ry);function dx(r,e){var t={};return t[e.dim+"AxisIndex"]=e.index,r.getCartesian(t)}var N4={line:function(r,e,t){var a=Oy([e,t[0]],[e,t[1]],gx(r));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(r,e,t){var a=Math.max(1,r.getBandWidth()),n=t[1]-t[0];return{type:"Rect",shape:$M([e-a/2,t[0]],[a,n],gx(r))}}};function gx(r){return r.dim==="x"?0:1}var B4=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(mt),ta=xt(),V4=D;function qM(r,e,t){if(!yt.node){var a=e.getZr();ta(a).records||(ta(a).records={}),z4(a,e);var n=ta(a).records[r]||(ta(a).records[r]={});n.handler=t}}function z4(r,e){if(ta(r).initialized)return;ta(r).initialized=!0,t("click",lt(yx,"click")),t("mousemove",lt(yx,"mousemove")),t("globalout",F4);function t(a,n){r.on(a,function(i){var o=H4(e);V4(ta(r).records,function(s){s&&n(s,i,o.dispatchAction)}),G4(o.pendings,e)})}}function G4(r,e){var t=r.showTip.length,a=r.hideTip.length,n;t?n=r.showTip[t-1]:a&&(n=r.hideTip[a-1]),n&&(n.dispatchAction=null,e.dispatchAction(n))}function F4(r,e,t){r.handler("leave",null,t)}function yx(r,e,t,a){e.handler(r,t,a)}function H4(r){var e={showTip:[],hideTip:[]},t=function(a){var n=e[a.type];n?n.push(a):(a.dispatchAction=t,r.dispatchAction(a))};return{dispatchAction:t,pendings:e}}function Dd(r,e){if(!yt.node){var t=e.getZr(),a=(ta(t).records||{})[r];a&&(ta(t).records[r]=null)}}var W4=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){var i=a.getComponent("tooltip"),o=t.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";qM("axisPointer",n,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},e.prototype.remove=function(t,a){Dd("axisPointer",a)},e.prototype.dispose=function(t,a){Dd("axisPointer",a)},e.type="axisPointer",e}(Ft);function KM(r,e){var t=[],a=r.seriesIndex,n;if(a==null||!(n=e.getSeriesByIndex(a)))return{point:[]};var i=n.getData(),o=ti(i,r);if(o==null||o<0||z(o))return{point:[]};var s=i.getItemGraphicEl(o),l=n.coordinateSystem;if(n.getTooltipPosition)t=n.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(r.isStacked){var u=l.getBaseAxis(),f=l.getOtherAxis(u),h=f.dim,v=u.dim,c=h==="x"||h==="radius"?1:0,p=i.mapDimension(v),d=[];d[c]=i.get(p,o),d[1-c]=i.get(i.getCalculationInfo("stackResultDimension"),o),t=l.dataToPoint(d)||[]}else t=l.dataToPoint(i.getValues(G(l.dimensions,function(y){return i.mapDimension(y)}),o))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),t=[g.x+g.width/2,g.y+g.height/2]}return{point:t,el:s}}var mx=xt();function U4(r,e,t){var a=r.currTrigger,n=[r.x,r.y],i=r,o=r.dispatchAction||X(t.dispatchAction,t),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){Yu(n)&&(n=KM({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},e).point);var l=Yu(n),u=i.axesInfo,f=s.axesInfo,h=a==="leave"||Yu(n),v={},c={},p={list:[],map:{}},d={showPointer:lt(X4,c),showTooltip:lt(Z4,p)};D(s.coordSysMap,function(y,m){var _=l||y.containPoint(n);D(s.coordSysAxesInfo[m],function(S,b){var x=S.axis,w=J4(u,S);if(!h&&_&&(!u||w)){var T=w&&w.value;T==null&&!l&&(T=x.pointToData(n)),T!=null&&_x(S,T,d,!1,v)}})});var g={};return D(f,function(y,m){var _=y.linkGroup;_&&!c[m]&&D(_.axesInfo,function(S,b){var x=c[b];if(S!==y&&x){var w=x.value;_.mapper&&(w=y.axis.scale.parse(_.mapper(w,Sx(S),Sx(y)))),g[y.key]=w}})}),D(g,function(y,m){_x(f[m],y,d,!0,v)}),$4(c,f,v),q4(p,n,r,o),K4(f,o,t),v}}function _x(r,e,t,a,n){var i=r.axis;if(!(i.scale.isBlank()||!i.containData(e))){if(!r.involveSeries){t.showPointer(r,e);return}var o=Y4(e,r),s=o.payloadBatch,l=o.snapToValue;s[0]&&n.seriesIndex==null&&V(n,s[0]),!a&&r.snap&&i.containData(l)&&l!=null&&(e=l),t.showPointer(r,e,s),t.showTooltip(r,o,l)}}function Y4(r,e){var t=e.axis,a=t.dim,n=r,i=[],o=Number.MAX_VALUE,s=-1;return D(e.seriesModels,function(l,u){var f=l.getData().mapDimensionsAll(a),h,v;if(l.getAxisTooltipData){var c=l.getAxisTooltipData(f,r,t);v=c.dataIndices,h=c.nestestValue}else{if(v=l.getData().indicesOfNearest(f[0],r,t.type==="category"?.5:null),!v.length)return;h=l.getData().get(f[0],v[0])}if(!(h==null||!isFinite(h))){var p=r-h,d=Math.abs(p);d<=o&&((d=0&&s<0)&&(o=d,s=p,n=h,i.length=0),D(v,function(g){i.push({seriesIndex:l.seriesIndex,dataIndexInside:g,dataIndex:l.getData().getRawIndex(g)})}))}}),{payloadBatch:i,snapToValue:n}}function X4(r,e,t,a){r[e.key]={value:t,payloadBatch:a}}function Z4(r,e,t,a){var n=t.payloadBatch,i=e.axis,o=i.model,s=e.axisPointerModel;if(!(!e.triggerTooltip||!n.length)){var l=e.coordSys.model,u=$s(l),f=r.map[u];f||(f=r.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},r.list.push(f)),f.dataByAxis.push({axisDim:i.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:a,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:n.slice()})}}function $4(r,e,t){var a=t.axesInfo=[];D(e,function(n,i){var o=n.axisPointerModel.option,s=r[i];s?(!n.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!n.useHandle&&(o.status="hide"),o.status==="show"&&a.push({axisDim:n.axis.dim,axisIndex:n.axis.model.componentIndex,value:o.value})})}function q4(r,e,t,a){if(Yu(e)||!r.list.length){a({type:"hideTip"});return}var n=((r.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};a({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:t.tooltipOption,position:t.position,dataIndexInside:n.dataIndexInside,dataIndex:n.dataIndex,seriesIndex:n.seriesIndex,dataByCoordSys:r.list})}function K4(r,e,t){var a=t.getZr(),n="axisPointerLastHighlights",i=mx(a)[n]||{},o=mx(a)[n]={};D(r,function(u,f){var h=u.axisPointerModel.option;h.status==="show"&&u.triggerEmphasis&&D(h.seriesDataIndices,function(v){var c=v.seriesIndex+" | "+v.dataIndex;o[c]=v})});var s=[],l=[];D(i,function(u,f){!o[f]&&l.push(u)}),D(o,function(u,f){!i[f]&&s.push(u)}),l.length&&t.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&t.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function J4(r,e){for(var t=0;t<(r||[]).length;t++){var a=r[t];if(e.axis.dim===a.axisDim&&e.axis.model.componentIndex===a.axisIndex)return a}}function Sx(r){var e=r.axis.model,t={},a=t.axisDim=r.axis.dim;return t.axisIndex=t[a+"AxisIndex"]=e.componentIndex,t.axisName=t[a+"AxisName"]=e.name,t.axisId=t[a+"AxisId"]=e.id,t}function Yu(r){return!r||r[0]==null||isNaN(r[0])||r[1]==null||isNaN(r[1])}function Tl(r){ci.registerAxisPointerClass("CartesianAxisPointer",O4),r.registerComponentModel(B4),r.registerComponentView(W4),r.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!z(t)&&(e.axisPointer.link=[t])}}),r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC,function(e,t){e.getComponent("axisPointer").coordSysAxesInfo=sz(e,t)}),r.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},U4)}function Q4(r){dt(TD),dt(Tl)}var j4=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,a,n,i,o){var s=n.axis;s.dim==="angle"&&(this.animationThreshold=Math.PI/18);var l=s.polar,u=l.getOtherAxis(s),f=u.getExtent(),h=s.dataToCoord(a),v=i.get("type");if(v&&v!=="none"){var c=Ey(i),p=eW[v](s,l,h,f);p.style=c,t.graphicKey=p.type,t.pointer=p}var d=i.get(["label","margin"]),g=tW(a,n,i,l,d);YM(t,n,i,o,g)},e}(Ry);function tW(r,e,t,a,n){var i=e.axis,o=i.dataToCoord(r),s=a.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=a.getRadiusAxis().getExtent(),u,f,h;if(i.dim==="radius"){var v=Fe();si(v,v,s),Fr(v,v,[a.cx,a.cy]),u=mr([o,-n],v);var c=e.getModel("axisLabel").get("rotate")||0,p=Ae.innerTextLayout(s,c*Math.PI/180,-1);f=p.textAlign,h=p.textVerticalAlign}else{var d=l[1];u=a.coordToPoint([d+n,o]);var g=a.cx,y=a.cy;f=Math.abs(u[0]-g)/d<.3?"center":u[0]>g?"left":"right",h=Math.abs(u[1]-y)/d<.3?"middle":u[1]>y?"top":"bottom"}return{position:u,align:f,verticalAlign:h}}var eW={line:function(r,e,t,a){return r.dim==="angle"?{type:"Line",shape:Oy(e.coordToPoint([a[0],t]),e.coordToPoint([a[1],t]))}:{type:"Circle",shape:{cx:e.cx,cy:e.cy,r:t}}},shadow:function(r,e,t,a){var n=Math.max(1,r.getBandWidth()),i=Math.PI/180;return r.dim==="angle"?{type:"Sector",shape:px(e.cx,e.cy,a[0],a[1],(-t-n/2)*i,(-t+n/2)*i)}:{type:"Sector",shape:px(e.cx,e.cy,t-n/2,t+n/2,0,Math.PI*2)}}},rW=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.findAxisModel=function(t){var a,n=this.ecModel;return n.eachComponent(t,function(i){i.getCoordSysModel()===this&&(a=i)},this),a},e.type="polar",e.dependencies=["radiusAxis","angleAxis"],e.defaultOption={z:0,center:["50%","50%"],radius:"80%"},e}(mt),Ny=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",$t).models[0]},e.type="polarAxis",e}(mt);Kt(Ny,dl);var aW=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="angleAxis",e}(Ny),nW=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="radiusAxis",e}(Ny),By=function(r){k(e,r);function e(t,a){return r.call(this,"radius",t,a)||this}return e.prototype.pointToData=function(t,a){return this.polar.pointToData(t,a)[this.dim==="radius"?0:1]},e}(br);By.prototype.dataToRadius=br.prototype.dataToCoord;By.prototype.radiusToData=br.prototype.coordToData;var iW=xt(),Vy=function(r){k(e,r);function e(t,a){return r.call(this,"angle",t,a||[0,360])||this}return e.prototype.pointToData=function(t,a){return this.polar.pointToData(t,a)[this.dim==="radius"?0:1]},e.prototype.calculateCategoryInterval=function(){var t=this,a=t.getLabelModel(),n=t.scale,i=n.getExtent(),o=n.count();if(i[1]-i[0]<1)return 0;var s=i[0],l=t.dataToCoord(s+1)-t.dataToCoord(s),u=Math.abs(l),f=nl(s==null?"":s+"",a.getFont(),"center","top"),h=Math.max(f.height,7),v=h/u;isNaN(v)&&(v=1/0);var c=Math.max(0,Math.floor(v)),p=iW(t.model),d=p.lastAutoInterval,g=p.lastTickCount;return d!=null&&g!=null&&Math.abs(d-c)<=1&&Math.abs(g-o)<=1&&d>c?c=d:(p.lastTickCount=o,p.lastAutoInterval=c),c},e}(br);Vy.prototype.dataToAngle=br.prototype.dataToCoord;Vy.prototype.angleToData=br.prototype.coordToData;var JM=["radius","angle"],oW=function(){function r(e){this.dimensions=JM,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new By,this._angleAxis=new Vy,this.axisPointerEnabled=!0,this.name=e||"",this._radiusAxis.polar=this._angleAxis.polar=this}return r.prototype.containPoint=function(e){var t=this.pointToCoord(e);return this._radiusAxis.contain(t[0])&&this._angleAxis.contain(t[1])},r.prototype.containData=function(e){return this._radiusAxis.containData(e[0])&&this._angleAxis.containData(e[1])},r.prototype.getAxis=function(e){var t="_"+e+"Axis";return this[t]},r.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},r.prototype.getAxesByScale=function(e){var t=[],a=this._angleAxis,n=this._radiusAxis;return a.scale.type===e&&t.push(a),n.scale.type===e&&t.push(n),t},r.prototype.getAngleAxis=function(){return this._angleAxis},r.prototype.getRadiusAxis=function(){return this._radiusAxis},r.prototype.getOtherAxis=function(e){var t=this._angleAxis;return e===t?this._radiusAxis:t},r.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},r.prototype.getTooltipAxes=function(e){var t=e!=null&&e!=="auto"?this.getAxis(e):this.getBaseAxis();return{baseAxes:[t],otherAxes:[this.getOtherAxis(t)]}},r.prototype.dataToPoint=function(e,t){return this.coordToPoint([this._radiusAxis.dataToRadius(e[0],t),this._angleAxis.dataToAngle(e[1],t)])},r.prototype.pointToData=function(e,t){var a=this.pointToCoord(e);return[this._radiusAxis.radiusToData(a[0],t),this._angleAxis.angleToData(a[1],t)]},r.prototype.pointToCoord=function(e){var t=e[0]-this.cx,a=e[1]-this.cy,n=this.getAngleAxis(),i=n.getExtent(),o=Math.min(i[0],i[1]),s=Math.max(i[0],i[1]);n.inverse?o=s-360:s=o+360;var l=Math.sqrt(t*t+a*a);t/=l,a/=l;for(var u=Math.atan2(-a,t)/Math.PI*180,f=us;)u+=f*360;return[l,u]},r.prototype.coordToPoint=function(e){var t=e[0],a=e[1]/180*Math.PI,n=Math.cos(a)*t+this.cx,i=-Math.sin(a)*t+this.cy;return[n,i]},r.prototype.getArea=function(){var e=this.getAngleAxis(),t=this.getRadiusAxis(),a=t.getExtent().slice();a[0]>a[1]&&a.reverse();var n=e.getExtent(),i=Math.PI/180,o=1e-4;return{cx:this.cx,cy:this.cy,r0:a[0],r:a[1],startAngle:-n[0]*i,endAngle:-n[1]*i,clockwise:e.inverse,contain:function(s,l){var u=s-this.cx,f=l-this.cy,h=u*u+f*f,v=this.r,c=this.r0;return v!==c&&h-o<=v*v&&h+o>=c*c}}},r.prototype.convertToPixel=function(e,t,a){var n=xx(t);return n===this?this.dataToPoint(a):null},r.prototype.convertFromPixel=function(e,t,a){var n=xx(t);return n===this?this.pointToData(a):null},r}();function xx(r){var e=r.seriesModel,t=r.polarModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}function sW(r,e,t){var a=e.get("center"),n=t.getWidth(),i=t.getHeight();r.cx=W(a[0],n),r.cy=W(a[1],i);var o=r.getRadiusAxis(),s=Math.min(n,i)/2,l=e.get("radius");l==null?l=[0,"100%"]:z(l)||(l=[0,l]);var u=[W(l[0],s),W(l[1],s)];o.inverse?o.setExtent(u[1],u[0]):o.setExtent(u[0],u[1])}function lW(r,e){var t=this,a=t.getAngleAxis(),n=t.getRadiusAxis();if(a.scale.setExtent(1/0,-1/0),n.scale.setExtent(1/0,-1/0),r.eachSeries(function(s){if(s.coordinateSystem===t){var l=s.getData();D(Sf(l,"radius"),function(u){n.scale.unionExtentFromData(l,u)}),D(Sf(l,"angle"),function(u){a.scale.unionExtentFromData(l,u)})}}),ro(a.scale,a.model),ro(n.scale,n.model),a.type==="category"&&!a.onBand){var i=a.getExtent(),o=360/a.scale.count();a.inverse?i[1]+=o:i[1]-=o,a.setExtent(i[0],i[1])}}function uW(r){return r.mainType==="angleAxis"}function bx(r,e){var t;if(r.type=e.get("type"),r.scale=xh(e),r.onBand=e.get("boundaryGap")&&r.type==="category",r.inverse=e.get("inverse"),uW(e)){r.inverse=r.inverse!==e.get("clockwise");var a=e.get("startAngle"),n=(t=e.get("endAngle"))!==null&&t!==void 0?t:a+(r.inverse?-360:360);r.setExtent(a,n)}e.axis=r,r.model=e}var fW={dimensions:JM,create:function(r,e){var t=[];return r.eachComponent("polar",function(a,n){var i=new oW(n+"");i.update=lW;var o=i.getRadiusAxis(),s=i.getAngleAxis(),l=a.findAxisModel("radiusAxis"),u=a.findAxisModel("angleAxis");bx(o,l),bx(s,u),sW(i,a,e),t.push(i),a.coordinateSystem=i,i.model=a}),r.eachSeries(function(a){if(a.get("coordinateSystem")==="polar"){var n=a.getReferringComponents("polar",$t).models[0];a.coordinateSystem=n.coordinateSystem}}),t}},hW=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function mu(r,e,t){e[1]>e[0]&&(e=e.slice().reverse());var a=r.coordToPoint([e[0],t]),n=r.coordToPoint([e[1],t]);return{x1:a[0],y1:a[1],x2:n[0],y2:n[1]}}function _u(r){var e=r.getRadiusAxis();return e.inverse?0:1}function Tx(r){var e=r[0],t=r[r.length-1];e&&t&&Math.abs(Math.abs(e.coord-t.coord)-360)<1e-4&&r.pop()}var vW=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.axisPointerClass="PolarAxisPointer",t}return e.prototype.render=function(t,a){if(this.group.removeAll(),!!t.get("show")){var n=t.axis,i=n.polar,o=i.getRadiusAxis().getExtent(),s=n.getTicksCoords(),l=n.getMinorTicksCoords(),u=G(n.getViewLabels(),function(f){f=rt(f);var h=n.scale,v=h.type==="ordinal"?h.getRawOrdinalNumber(f.tickValue):f.tickValue;return f.coord=n.dataToCoord(v),f});Tx(u),Tx(s),D(hW,function(f){t.get([f,"show"])&&(!n.scale.isBlank()||f==="axisLine")&&cW[f](this.group,t,i,s,l,o,u)},this)}},e.type="angleAxis",e}(ci),cW={axisLine:function(r,e,t,a,n,i){var o=e.getModel(["axisLine","lineStyle"]),s=t.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),f=_u(t),h=f?0:1,v,c=Math.abs(u[1]-u[0])===360?"Circle":"Arc";i[h]===0?v=new ui[c]({shape:{cx:t.cx,cy:t.cy,r:i[f],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):v=new sl({shape:{cx:t.cx,cy:t.cy,r:i[f],r0:i[h]},style:o.getLineStyle(),z2:1,silent:!0}),v.style.fill=null,r.add(v)},axisTick:function(r,e,t,a,n,i){var o=e.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=i[_u(t)],u=G(a,function(f){return new ee({shape:mu(t,[l,l+s],f.coord)})});r.add(er(u,{style:j(o.getModel("lineStyle").getLineStyle(),{stroke:e.get(["axisLine","lineStyle","color"])})}))},minorTick:function(r,e,t,a,n,i){if(n.length){for(var o=e.getModel("axisTick"),s=e.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=i[_u(t)],f=[],h=0;hy?"left":"right",S=Math.abs(g[1]-m)/d<.3?"middle":g[1]>m?"top":"bottom";if(s&&s[p]){var b=s[p];et(b)&&b.textStyle&&(c=new Mt(b.textStyle,l,l.ecModel))}var x=new bt({silent:Ae.isLabelSilent(e),style:Bt(c,{x:g[0],y:g[1],fill:c.getTextColor()||e.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:_,verticalAlign:S})});if(r.add(x),f){var w=Ae.makeAxisEventDataBase(e);w.targetType="axisLabel",w.value=h.rawLabel,nt(x).eventData=w}},this)},splitLine:function(r,e,t,a,n,i){var o=e.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var f=[],h=0;h=0?"p":"n",R=A;b&&(a[f][L]||(a[f][L]={p:A,n:A}),R=a[f][L][P]);var E=void 0,N=void 0,O=void 0,B=void 0;if(p.dim==="radius"){var F=p.dataToCoord(I)-A,H=l.dataToCoord(L);Math.abs(F)=B})}}})}function SW(r){var e={};D(r,function(a,n){var i=a.getData(),o=a.coordinateSystem,s=o.getBaseAxis(),l=jM(o,s),u=s.getExtent(),f=s.type==="category"?s.getBandWidth():Math.abs(u[1]-u[0])/i.count(),h=e[l]||{bandWidth:f,remainedWidth:f,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},v=h.stacks;e[l]=h;var c=QM(a);v[c]||h.autoWidthCount++,v[c]=v[c]||{width:0,maxWidth:0};var p=W(a.get("barWidth"),f),d=W(a.get("barMaxWidth"),f),g=a.get("barGap"),y=a.get("barCategoryGap");p&&!v[c].width&&(p=Math.min(h.remainedWidth,p),v[c].width=p,h.remainedWidth-=p),d&&(v[c].maxWidth=d),g!=null&&(h.gap=g),y!=null&&(h.categoryGap=y)});var t={};return D(e,function(a,n){t[n]={};var i=a.stacks,o=a.bandWidth,s=W(a.categoryGap,o),l=W(a.gap,1),u=a.remainedWidth,f=a.autoWidthCount,h=(u-s)/(f+(f-1)*l);h=Math.max(h,0),D(i,function(d,g){var y=d.maxWidth;y&&y=t.y&&e[1]<=t.y+t.height:a.contain(a.toLocalCoord(e[1]))&&e[0]>=t.y&&e[0]<=t.y+t.height},r.prototype.pointToData=function(e){var t=this.getAxis();return[t.coordToData(t.toLocalCoord(e[t.orient==="horizontal"?0:1]))]},r.prototype.dataToPoint=function(e){var t=this.getAxis(),a=this.getRect(),n=[],i=t.orient==="horizontal"?0:1;return e instanceof Array&&(e=e[0]),n[i]=t.toGlobalCoord(t.dataToCoord(+e)),n[1-i]=i===0?a.y+a.height/2:a.x+a.width/2,n},r.prototype.convertToPixel=function(e,t,a){var n=Ax(t);return n===this?this.dataToPoint(a):null},r.prototype.convertFromPixel=function(e,t,a){var n=Ax(t);return n===this?this.pointToData(a):null},r}();function Ax(r){var e=r.seriesModel,t=r.singleAxisModel;return t&&t.coordinateSystem||e&&e.coordinateSystem}function PW(r,e){var t=[];return r.eachComponent("singleAxis",function(a,n){var i=new LW(a,r,e);i.name="single_"+n,i.resize(a,e),a.coordinateSystem=i,t.push(i)}),r.eachSeries(function(a){if(a.get("coordinateSystem")==="singleAxis"){var n=a.getReferringComponents("singleAxis",$t).models[0];a.coordinateSystem=n&&n.coordinateSystem}}),t}var RW={create:PW,dimensions:tI},Cx=["x","y"],EW=["width","height"],kW=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.makeElOption=function(t,a,n,i,o){var s=n.axis,l=s.coordinateSystem,u=Nc(l,1-kf(s)),f=l.dataToPoint(a)[0],h=i.get("type");if(h&&h!=="none"){var v=Ey(i),c=OW[h](s,f,u);c.style=v,t.graphicKey=c.type,t.pointer=c}var p=Md(n);ZM(a,t,p,n,i,o)},e.prototype.getHandleTransform=function(t,a,n){var i=Md(a,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var o=ky(a.axis,t,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,a,n,i){var o=n.axis,s=o.coordinateSystem,l=kf(o),u=Nc(s,l),f=[t.x,t.y];f[l]+=a[l],f[l]=Math.min(u[1],f[l]),f[l]=Math.max(u[0],f[l]);var h=Nc(s,1-l),v=(h[1]+h[0])/2,c=[v,v];return c[l]=f[l],{x:f[0],y:f[1],rotation:t.rotation,cursorPoint:c,tooltipOption:{verticalAlign:"middle"}}},e}(Ry),OW={line:function(r,e,t){var a=Oy([e,t[0]],[e,t[1]],kf(r));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(r,e,t){var a=r.getBandWidth(),n=t[1]-t[0];return{type:"Rect",shape:$M([e-a/2,t[0]],[a,n],kf(r))}}};function kf(r){return r.isHorizontal()?0:1}function Nc(r,e){var t=r.getRect();return[t[Cx[e]],t[Cx[e]]+t[EW[e]]]}var NW=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="single",e}(Ft);function BW(r){dt(Tl),ci.registerAxisPointerClass("SingleAxisPointer",kW),r.registerComponentView(NW),r.registerComponentView(DW),r.registerComponentModel(Xu),no(r,"single",Xu,Xu.defaultOption),r.registerCoordinateSystem("single",RW)}var VW=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,a,n){var i=mo(t);r.prototype.init.apply(this,arguments),Dx(t,i)},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),Dx(this.option,t)},e.prototype.getCellSize=function(){return this.option.cellSize},e.type="calendar",e.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{color:"#fff",borderWidth:1,borderColor:"#ccc"},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},e}(mt);function Dx(r,e){var t=r.cellSize,a;z(t)?a=t:a=r.cellSize=[t,t],a.length===1&&(a[1]=a[0]);var n=G([0,1],function(i){return nE(e,i)&&(a[i]="auto"),a[i]!=null&&a[i]!=="auto"});$a(r,e,{type:"box",ignoreSize:n})}var zW=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){var i=this.group;i.removeAll();var o=t.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=a.getLocaleModel();this._renderDayRect(t,s,i),this._renderLines(t,s,l,i),this._renderYearText(t,s,l,i),this._renderMonthText(t,u,l,i),this._renderWeekText(t,u,s,l,i)},e.prototype._renderDayRect=function(t,a,n){for(var i=t.coordinateSystem,o=t.getModel("itemStyle").getItemStyle(),s=i.getCellWidth(),l=i.getCellHeight(),u=a.start.time;u<=a.end.time;u=i.getNextNDay(u,1).time){var f=i.dataToRect([u],!1).tl,h=new St({shape:{x:f[0],y:f[1],width:s,height:l},cursor:"default",style:o});n.add(h)}},e.prototype._renderLines=function(t,a,n,i){var o=this,s=t.coordinateSystem,l=t.getModel(["splitLine","lineStyle"]).getLineStyle(),u=t.get(["splitLine","show"]),f=l.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=a.start,v=0;h.time<=a.end.time;v++){p(h.formatedDate),v===0&&(h=s.getDateInfo(a.start.y+"-"+a.start.m));var c=h.date;c.setMonth(c.getMonth()+1),h=s.getDateInfo(c)}p(s.getNextNDay(a.end.time,1).formatedDate);function p(d){o._firstDayOfMonth.push(s.getDateInfo(d)),o._firstDayPoints.push(s.dataToRect([d],!1).tl);var g=o._getLinePointsOfOneWeek(t,d,n);o._tlpoints.push(g[0]),o._blpoints.push(g[g.length-1]),u&&o._drawSplitline(g,l,i)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,f,n),l,i),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,f,n),l,i)},e.prototype._getEdgesPoints=function(t,a,n){var i=[t[0].slice(),t[t.length-1].slice()],o=n==="horizontal"?0:1;return i[0][o]=i[0][o]-a/2,i[1][o]=i[1][o]+a/2,i},e.prototype._drawSplitline=function(t,a,n){var i=new Le({z2:20,shape:{points:t},style:a});n.add(i)},e.prototype._getLinePointsOfOneWeek=function(t,a,n){for(var i=t.coordinateSystem,o=i.getDateInfo(a),s=[],l=0;l<7;l++){var u=i.getNextNDay(o.time,l),f=i.dataToRect([u.time],!1);s[2*u.day]=f.tl,s[2*u.day+1]=f[n==="horizontal"?"bl":"tr"]}return s},e.prototype._formatterLabel=function(t,a){return Y(t)&&t?eE(t,a):J(t)?t(a):a.nameMap},e.prototype._yearTextPositionControl=function(t,a,n,i,o){var s=a[0],l=a[1],u=["center","bottom"];i==="bottom"?(l+=o,u=["center","top"]):i==="left"?s-=o:i==="right"?(s+=o,u=["center","top"]):l-=o;var f=0;return(i==="left"||i==="right")&&(f=Math.PI/2),{rotation:f,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},e.prototype._renderYearText=function(t,a,n,i){var o=t.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=n!=="horizontal"?"top":"left");var u=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],f=(u[0][0]+u[1][0])/2,h=(u[0][1]+u[1][1])/2,v=n==="horizontal"?0:1,c={top:[f,u[v][1]],bottom:[f,u[1-v][1]],left:[u[1-v][0],h],right:[u[v][0],h]},p=a.start.y;+a.end.y>+a.start.y&&(p=p+"-"+a.end.y);var d=o.get("formatter"),g={start:a.start.y,end:a.end.y,nameMap:p},y=this._formatterLabel(d,g),m=new bt({z2:30,style:Bt(o,{text:y}),silent:o.get("silent")});m.attr(this._yearTextPositionControl(m,c[l],n,l,s)),i.add(m)}},e.prototype._monthTextPositionControl=function(t,a,n,i,o){var s="left",l="top",u=t[0],f=t[1];return n==="horizontal"?(f=f+o,a&&(s="center"),i==="start"&&(l="bottom")):(u=u+o,a&&(l="middle"),i==="start"&&(s="right")),{x:u,y:f,align:s,verticalAlign:l}},e.prototype._renderMonthText=function(t,a,n,i){var o=t.getModel("monthLabel");if(o.get("show")){var s=o.get("nameMap"),l=o.get("margin"),u=o.get("position"),f=o.get("align"),h=[this._tlpoints,this._blpoints];(!s||Y(s))&&(s&&(a=Np(s)||a),s=a.get(["time","monthAbbr"])||[]);var v=u==="start"?0:1,c=n==="horizontal"?0:1;l=u==="start"?-l:l;for(var p=f==="center",d=o.get("silent"),g=0;g=n.start.time&&a.times.end.time&&t.reverse(),t},r.prototype._getRangeInfo=function(e){var t=[this.getDateInfo(e[0]),this.getDateInfo(e[1])],a;t[0].time>t[1].time&&(a=!0,t.reverse());var n=Math.floor(t[1].time/Bc)-Math.floor(t[0].time/Bc)+1,i=new Date(t[0].time),o=i.getDate(),s=t[1].date.getDate();i.setDate(o+n-1);var l=i.getDate();if(l!==s)for(var u=i.getTime()-t[1].time>0?1:-1;(l=i.getDate())!==s&&(i.getTime()-t[1].time)*u>0;)n-=u,i.setDate(l-u);var f=Math.floor((n+t[0].day+6)/7),h=a?-f+1:f-1;return a&&t.reverse(),{range:[t[0].formatedDate,t[1].formatedDate],start:t[0],end:t[1],allDay:n,weeks:f,nthWeek:h,fweek:t[0].day,lweek:t[1].day}},r.prototype._getDateByWeeksAndDay=function(e,t,a){var n=this._getRangeInfo(a);if(e>n.weeks||e===0&&tn.lweek)return null;var i=(e-1)*7-n.fweek+t,o=new Date(n.start.time);return o.setDate(+n.start.d+i),this.getDateInfo(o)},r.create=function(e,t){var a=[];return e.eachComponent("calendar",function(n){var i=new r(n);a.push(i),n.coordinateSystem=i}),e.eachSeries(function(n){n.get("coordinateSystem")==="calendar"&&(n.coordinateSystem=a[n.get("calendarIndex")||0])}),a},r.dimensions=["time","value"],r}();function Mx(r){var e=r.calendarModel,t=r.seriesModel,a=e?e.coordinateSystem:t?t.coordinateSystem:null;return a}function FW(r){r.registerComponentModel(VW),r.registerComponentView(zW),r.registerCoordinateSystem("calendar",GW)}function HW(r,e){var t=r.existing;if(e.id=r.keyInfo.id,!e.type&&t&&(e.type=t.type),e.parentId==null){var a=e.parentOption;a?e.parentId=a.id:t&&(e.parentId=t.parentId)}e.parentOption=null}function Ix(r,e){var t;return D(e,function(a){r[a]!=null&&r[a]!=="auto"&&(t=!0)}),t}function WW(r,e,t){var a=V({},t),n=r[e],i=t.$action||"merge";i==="merge"?n?(ut(n,a,!0),$a(n,a,{ignoreSize:!0}),XT(t,n),Su(t,n),Su(t,n,"shape"),Su(t,n,"style"),Su(t,n,"extra"),t.clipPath=n.clipPath):r[e]=a:i==="replace"?r[e]=a:i==="remove"&&n&&(r[e]=null)}var eI=["transition","enterFrom","leaveTo"],UW=eI.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function Su(r,e,t){if(t&&(!r[t]&&e[t]&&(r[t]={}),r=r[t],e=e[t]),!(!r||!e))for(var a=t?eI:UW,n=0;n=0;f--){var h=n[f],v=Jt(h.id,null),c=v!=null?o.get(v):null;if(c){var p=c.parent,y=Qe(p),m=p===i?{width:s,height:l}:{width:y.width,height:y.height},_={},S=vh(c,h,m,null,{hv:h.hv,boundingMode:h.bounding},_);if(!Qe(c).isNew&&S){for(var b=h.transition,x={},w=0;w=0)?x[T]=A:c[T]=A}Tt(c,x,t,0)}else c.attr(_)}}},e.prototype._clear=function(){var t=this,a=this._elMap;a.each(function(n){Zu(n,Qe(n).option,a,t._lastGraphicModel)}),this._elMap=$()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(Ft);function Id(r){var e=Z(Lx,r)?Lx[r]:gg(r),t=new e({});return Qe(t).type=r,t}function Px(r,e,t,a){var n=Id(t);return e.add(n),a.set(r,n),Qe(n).id=r,Qe(n).isNew=!0,n}function Zu(r,e,t,a){var n=r&&r.parent;n&&(r.type==="group"&&r.traverse(function(i){Zu(i,e,t,a)}),Mh(r,e,a),t.removeKey(Qe(r).id))}function Rx(r,e,t,a){r.isGroup||D([["cursor",ir.prototype.cursor],["zlevel",a||0],["z",t||0],["z2",0]],function(n){var i=n[0];Z(e,i)?r[i]=st(e[i],n[1]):r[i]==null&&(r[i]=n[1])}),D(_t(e),function(n){if(n.indexOf("on")===0){var i=e[n];r[n]=J(i)?i:null}}),Z(e,"draggable")&&(r.draggable=e.draggable),e.name!=null&&(r.name=e.name),e.id!=null&&(r.id=e.id)}function $W(r){return r=V({},r),D(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(YT),function(e){delete r[e]}),r}function qW(r,e,t){var a=nt(r).eventData;!r.silent&&!r.ignore&&!a&&(a=nt(r).eventData={componentType:"graphic",componentIndex:e.componentIndex,name:r.name}),a&&(a.info=t.info)}function KW(r){r.registerComponentModel(XW),r.registerComponentView(ZW),r.registerPreprocessor(function(e){var t=e.graphic;z(t)?!t[0]||!t[0].elements?e.graphic=[{elements:t}]:e.graphic=[e.graphic[0]]:t&&!t.elements&&(e.graphic=[{elements:[t]}])})}var Ex=["x","y","radius","angle","single"],JW=["cartesian2d","polar","singleAxis"];function QW(r){var e=r.get("coordinateSystem");return ct(JW,e)>=0}function za(r){return r+"Axis"}function jW(r,e){var t=$(),a=[],n=$();r.eachComponent({mainType:"dataZoom",query:e},function(f){n.get(f.uid)||s(f)});var i;do i=!1,r.eachComponent("dataZoom",o);while(i);function o(f){!n.get(f.uid)&&l(f)&&(s(f),i=!0)}function s(f){n.set(f.uid,!0),a.push(f),u(f)}function l(f){var h=!1;return f.eachTargetAxis(function(v,c){var p=t.get(v);p&&p[c]&&(h=!0)}),h}function u(f){f.eachTargetAxis(function(h,v){(t.get(h)||t.set(h,[]))[v]=!0})}return a}function rI(r){var e=r.ecModel,t={infoList:[],infoMap:$()};return r.eachTargetAxis(function(a,n){var i=e.getComponent(za(a),n);if(i){var o=i.getCoordSysModel();if(o){var s=o.uid,l=t.infoMap.get(s);l||(l={model:o,axisModels:[]},t.infoList.push(l),t.infoMap.set(s,l)),l.axisModels.push(i)}}}),t}var Vc=function(){function r(){this.indexList=[],this.indexMap=[]}return r.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},r}(),tl=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._autoThrottle=!0,t._noTarget=!0,t._rangePropMode=["percent","percent"],t}return e.prototype.init=function(t,a,n){var i=kx(t);this.settledOption=i,this.mergeDefaultAndTheme(t,n),this._doInit(i)},e.prototype.mergeOption=function(t){var a=kx(t);ut(this.option,t,!0),ut(this.settledOption,a,!0),this._doInit(a)},e.prototype._doInit=function(t){var a=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var n=this.settledOption;D([["start","startValue"],["end","endValue"]],function(i,o){this._rangePropMode[o]==="value"&&(a[i[0]]=n[i[0]]=null)},this),this._resetTarget()},e.prototype._resetTarget=function(){var t=this.get("orient",!0),a=this._targetAxisInfoMap=$(),n=this._fillSpecifiedTargetAxis(a);n?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(a,this._orient)),this._noTarget=!0,a.each(function(i){i.indexList.length&&(this._noTarget=!1)},this)},e.prototype._fillSpecifiedTargetAxis=function(t){var a=!1;return D(Ex,function(n){var i=this.getReferringComponents(za(n),U2);if(i.specified){a=!0;var o=new Vc;D(i.models,function(s){o.add(s.componentIndex)}),t.set(n,o)}},this),a},e.prototype._fillAutoTargetAxisByOrient=function(t,a){var n=this.ecModel,i=!0;if(i){var o=a==="vertical"?"y":"x",s=n.findComponents({mainType:o+"Axis"});l(s,o)}if(i){var s=n.findComponents({mainType:"singleAxis",filter:function(f){return f.get("orient",!0)===a}});l(s,"single")}function l(u,f){var h=u[0];if(h){var v=new Vc;if(v.add(h.componentIndex),t.set(f,v),i=!1,f==="x"||f==="y"){var c=h.getReferringComponents("grid",$t).models[0];c&&D(u,function(p){h.componentIndex!==p.componentIndex&&c===p.getReferringComponents("grid",$t).models[0]&&v.add(p.componentIndex)})}}}i&&D(Ex,function(u){if(i){var f=n.findComponents({mainType:za(u),filter:function(v){return v.get("type",!0)==="category"}});if(f[0]){var h=new Vc;h.add(f[0].componentIndex),t.set(u,h),i=!1}}},this)},e.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis(function(a){!t&&(t=a)},this),t==="y"?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var a=this.ecModel.option;this.option.throttle=a.animation&&a.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(t){var a=this._rangePropMode,n=this.get("rangeMode");D([["start","startValue"],["end","endValue"]],function(i,o){var s=t[i[0]]!=null,l=t[i[1]]!=null;s&&!l?a[o]="percent":!s&&l?a[o]="value":n?a[o]=n[o]:s&&(a[o]="percent")})},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis(function(a,n){t==null&&(t=this.ecModel.getComponent(za(a),n))},this),t},e.prototype.eachTargetAxis=function(t,a){this._targetAxisInfoMap.each(function(n,i){D(n.indexList,function(o){t.call(a,i,o)})})},e.prototype.getAxisProxy=function(t,a){var n=this.getAxisModel(t,a);if(n)return n.__dzAxisProxy},e.prototype.getAxisModel=function(t,a){var n=this._targetAxisInfoMap.get(t);if(n&&n.indexMap[a])return this.ecModel.getComponent(za(t),a)},e.prototype.setRawRange=function(t){var a=this.option,n=this.settledOption;D([["start","startValue"],["end","endValue"]],function(i){(t[i[0]]!=null||t[i[1]]!=null)&&(a[i[0]]=n[i[0]]=t[i[0]],a[i[1]]=n[i[1]]=t[i[1]])},this),this._updateRangeUse(t)},e.prototype.setCalculatedRange=function(t){var a=this.option;D(["start","startValue","end","endValue"],function(n){a[n]=t[n]})},e.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},e.prototype.getValueRange=function(t,a){if(t==null&&a==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getDataValueWindow()}else return this.getAxisProxy(t,a).getDataValueWindow()},e.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var a,n=this._targetAxisInfoMap.keys(),i=0;io[1];if(_&&!S&&!b)return!0;_&&(g=!0),S&&(p=!0),b&&(d=!0)}return g&&p&&d})}else zi(f,function(c){if(i==="empty")l.setData(u=u.map(c,function(d){return s(d)?d:NaN}));else{var p={};p[c]=o,u.selectRange(p)}});zi(f,function(c){u.setApproximateExtent(o,c)})}});function s(l){return l>=o[0]&&l<=o[1]}},r.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,a=this._dataExtent;zi(["min","max"],function(n){var i=t.get(n+"Span"),o=t.get(n+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?i=Dt(a[0]+o,a,[0,100],!0):i!=null&&(o=Dt(i,[0,100],a,!0)-a[0]),e[n+"Span"]=i,e[n+"ValueSpan"]=o},this)},r.prototype._setAxisModel=function(){var e=this.getAxisModel(),t=this._percentWindow,a=this._valueWindow;if(t){var n=kw(a,[0,500]);n=Math.min(n,20);var i=e.axis.scale.rawExtentInfo;t[0]!==0&&i.setDeterminedMinMax("min",+a[0].toFixed(n)),t[1]!==100&&i.setDeterminedMinMax("max",+a[1].toFixed(n)),i.freeze()}},r}();function a6(r,e,t){var a=[1/0,-1/0];zi(t,function(o){NN(a,o.getData(),e)});var n=r.getAxisModel(),i=SC(n.axis.scale,n,a).calculate();return[i.min,i.max]}var n6={getTargetSeries:function(r){function e(n){r.eachComponent("dataZoom",function(i){i.eachTargetAxis(function(o,s){var l=r.getComponent(za(o),s);n(o,s,l,i)})})}e(function(n,i,o,s){o.__dzAxisProxy=null});var t=[];e(function(n,i,o,s){o.__dzAxisProxy||(o.__dzAxisProxy=new r6(n,i,s,r),t.push(o.__dzAxisProxy))});var a=$();return D(t,function(n){D(n.getTargetSeriesModels(),function(i){a.set(i.uid,i)})}),a},overallReset:function(r,e){r.eachComponent("dataZoom",function(t){t.eachTargetAxis(function(a,n){t.getAxisProxy(a,n).reset(t)}),t.eachTargetAxis(function(a,n){t.getAxisProxy(a,n).filterData(t,e)})}),r.eachComponent("dataZoom",function(t){var a=t.findRepresentativeAxisProxy();if(a){var n=a.getDataPercentWindow(),i=a.getDataValueWindow();t.setCalculatedRange({start:n[0],end:n[1],startValue:i[0],endValue:i[1]})}})}};function i6(r){r.registerAction("dataZoom",function(e,t){var a=jW(t,e);D(a,function(n){n.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var Nx=!1;function Gy(r){Nx||(Nx=!0,r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,n6),i6(r),r.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function o6(r){r.registerComponentModel(t6),r.registerComponentView(e6),Gy(r)}var tr=function(){function r(){}return r}(),aI={};function Gi(r,e){aI[r]=e}function nI(r){return aI[r]}var s6=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(){r.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;D(this.option.feature,function(a,n){var i=nI(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(t)),ut(a,i.defaultOption))})},e.type="toolbox",e.layoutMode={type:"box",ignoreSize:!0},e.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},e}(mt);function l6(r,e,t){var a=e.getBoxLayoutParams(),n=e.get("padding"),i={width:t.getWidth(),height:t.getHeight()},o=Qt(a,i,n);Kn(e.get("orient"),r,e.get("itemGap"),o.width,o.height),vh(r,a,i,n)}function iI(r,e){var t=yo(e.get("padding")),a=e.getItemStyle(["color","opacity"]);return a.fill=e.get("backgroundColor"),r=new St({shape:{x:r.x-t[3],y:r.y-t[0],width:r.width+t[1]+t[3],height:r.height+t[0]+t[2],r:e.get("borderRadius")},style:a,silent:!0,z2:-1}),r}var u6=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,a,n,i){var o=this.group;if(o.removeAll(),!t.get("show"))return;var s=+t.get("itemSize"),l=t.get("orient")==="vertical",u=t.get("feature")||{},f=this._features||(this._features={}),h=[];D(u,function(p,d){h.push(d)}),new fa(this._featureNames||[],h).add(v).update(v).remove(lt(v,null)).execute(),this._featureNames=h;function v(p,d){var g=h[p],y=h[d],m=u[g],_=new Mt(m,t,t.ecModel),S;if(i&&i.newTitle!=null&&i.featureName===g&&(m.title=i.newTitle),g&&!y){if(f6(g))S={onclick:_.option.onclick,featureName:g};else{var b=nI(g);if(!b)return;S=new b}f[g]=S}else if(S=f[y],!S)return;S.uid=go("toolbox-feature"),S.model=_,S.ecModel=a,S.api=n;var x=S instanceof tr;if(!g&&y){x&&S.dispose&&S.dispose(a,n);return}if(!_.get("show")||x&&S.unusable){x&&S.remove&&S.remove(a,n);return}c(_,S,g),_.setIconStatus=function(w,T){var A=this.option,C=this.iconPaths;A.iconStatus=A.iconStatus||{},A.iconStatus[w]=T,C[w]&&(T==="emphasis"?la:ua)(C[w])},S instanceof tr&&S.render&&S.render(_,a,n,i)}function c(p,d,g){var y=p.getModel("iconStyle"),m=p.getModel(["emphasis","iconStyle"]),_=d instanceof tr&&d.getIcons?d.getIcons():p.get("icon"),S=p.get("title")||{},b,x;Y(_)?(b={},b[g]=_):b=_,Y(S)?(x={},x[g]=S):x=S;var w=p.iconPaths={};D(b,function(T,A){var C=hl(T,{},{x:-s/2,y:-s/2,width:s,height:s});C.setStyle(y.getItemStyle());var M=C.ensureState("emphasis");M.style=m.getItemStyle();var I=new bt({style:{text:x[A],align:m.get("textAlign"),borderRadius:m.get("textBorderRadius"),padding:m.get("textPadding"),fill:null,font:yg({fontStyle:m.get("textFontStyle"),fontFamily:m.get("textFontFamily"),fontSize:m.get("textFontSize"),fontWeight:m.get("textFontWeight")},a)},ignore:!0});C.setTextContent(I),li({el:C,componentModel:t,itemName:A,formatterParamsExtra:{title:x[A]}}),C.__title=x[A],C.on("mouseover",function(){var L=m.getItemStyle(),P=l?t.get("right")==null&&t.get("left")!=="right"?"right":"left":t.get("bottom")==null&&t.get("top")!=="bottom"?"bottom":"top";I.setStyle({fill:m.get("textFill")||L.fill||L.stroke||"#000",backgroundColor:m.get("textBackgroundColor")}),C.setTextConfig({position:m.get("textPosition")||P}),I.ignore=!t.get("showTitle"),n.enterEmphasis(this)}).on("mouseout",function(){p.get(["iconStatus",A])!=="emphasis"&&n.leaveEmphasis(this),I.hide()}),(p.get(["iconStatus",A])==="emphasis"?la:ua)(C),o.add(C),C.on("click",X(d.onclick,d,a,n,A)),w[A]=C})}l6(o,t,n),o.add(iI(o.getBoundingRect(),t)),l||o.eachChild(function(p){var d=p.__title,g=p.ensureState("emphasis"),y=g.textConfig||(g.textConfig={}),m=p.getTextContent(),_=m&&m.ensureState("emphasis");if(_&&!J(_)&&d){var S=_.style||(_.style={}),b=nl(d,bt.makeFont(S)),x=p.x+o.x,w=p.y+o.y+s,T=!1;w+b.height>n.getHeight()&&(y.position="top",T=!0);var A=T?-5-b.height:s+10;x+b.width/2>n.getWidth()?(y.position=["100%",A],S.align="right"):x-b.width/2<0&&(y.position=[0,A],S.align="left")}})},e.prototype.updateView=function(t,a,n,i){D(this._features,function(o){o instanceof tr&&o.updateView&&o.updateView(o.model,a,n,i)})},e.prototype.remove=function(t,a){D(this._features,function(n){n instanceof tr&&n.remove&&n.remove(t,a)}),this.group.removeAll()},e.prototype.dispose=function(t,a){D(this._features,function(n){n instanceof tr&&n.dispose&&n.dispose(t,a)})},e.type="toolbox",e}(Ft);function f6(r){return r.indexOf("my")===0}var h6=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,a){var n=this.model,i=n.get("name")||t.get("title.0.text")||"echarts",o=a.getZr().painter.getType()==="svg",s=o?"svg":n.get("type",!0)||"png",l=a.getConnectedDataURL({type:s,backgroundColor:n.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),u=yt.browser;if(typeof MouseEvent=="function"&&(u.newEdge||!u.ie&&!u.edge)){var f=document.createElement("a");f.download=i+"."+s,f.target="_blank",f.href=l;var h=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});f.dispatchEvent(h)}else if(window.navigator.msSaveOrOpenBlob||o){var v=l.split(","),c=v[0].indexOf("base64")>-1,p=o?decodeURIComponent(v[1]):v[1];c&&(p=window.atob(p));var d=i+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var g=p.length,y=new Uint8Array(g);g--;)y[g]=p.charCodeAt(g);var m=new Blob([y]);window.navigator.msSaveOrOpenBlob(m,d)}else{var _=document.createElement("iframe");document.body.appendChild(_);var S=_.contentWindow,b=S.document;b.open("image/svg+xml","replace"),b.write(p),b.close(),S.focus(),b.execCommand("SaveAs",!0,d),document.body.removeChild(_)}}else{var x=n.get("lang"),w='',T=window.open();T.document.write(w),T.document.title=i}},e.getDefaultOption=function(t){var a={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return a},e}(tr),Bx="__ec_magicType_stack__",v6=[["line","bar"],["stack"]],c6=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getIcons=function(){var t=this.model,a=t.get("icon"),n={};return D(t.get("type"),function(i){a[i]&&(n[i]=a[i])}),n},e.getDefaultOption=function(t){var a={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return a},e.prototype.onclick=function(t,a,n){var i=this.model,o=i.get(["seriesIndex",n]);if(Vx[n]){var s={series:[]},l=function(h){var v=h.subType,c=h.id,p=Vx[n](v,c,h,i);p&&(j(p,h.option),s.series.push(p));var d=h.coordinateSystem;if(d&&d.type==="cartesian2d"&&(n==="line"||n==="bar")){var g=d.getAxesByScale("ordinal")[0];if(g){var y=g.dim,m=y+"Axis",_=h.getReferringComponents(m,$t).models[0],S=_.componentIndex;s[m]=s[m]||[];for(var b=0;b<=S;b++)s[m][S]=s[m][S]||{};s[m][S].boundaryGap=n==="bar"}}};D(v6,function(h){ct(h,n)>=0&&D(h,function(v){i.setIconStatus(v,"normal")})}),i.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,f=n;n==="stack"&&(u=ut({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),i.get(["iconStatus",n])!=="emphasis"&&(f="tiled")),a.dispatchAction({type:"changeMagicType",currentType:f,newOption:s,newTitle:u,featureName:"magicType"})}},e}(tr),Vx={line:function(r,e,t,a){if(r==="bar")return ut({id:e,type:"line",data:t.get("data"),stack:t.get("stack"),markPoint:t.get("markPoint"),markLine:t.get("markLine")},a.get(["option","line"])||{},!0)},bar:function(r,e,t,a){if(r==="line")return ut({id:e,type:"bar",data:t.get("data"),stack:t.get("stack"),markPoint:t.get("markPoint"),markLine:t.get("markLine")},a.get(["option","bar"])||{},!0)},stack:function(r,e,t,a){var n=t.get("stack")===Bx;if(r==="line"||r==="bar")return a.setIconStatus("stack",n?"normal":"emphasis"),ut({id:e,stack:n?"":Bx},a.get(["option","stack"])||{},!0)}};Xr({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(r,e){e.mergeOption(r.newOption)});var Ih=new Array(60).join("-"),so=" ";function p6(r){var e={},t=[],a=[];return r.eachRawSeries(function(n){var i=n.coordinateSystem;if(i&&(i.type==="cartesian2d"||i.type==="polar")){var o=i.getBaseAxis();if(o.type==="category"){var s=o.dim+"_"+o.index;e[s]||(e[s]={categoryAxis:o,valueAxis:i.getOtherAxis(o),series:[]},a.push({axisDim:o.dim,axisIndex:o.index})),e[s].series.push(n)}else t.push(n)}else t.push(n)}),{seriesGroupByCategoryAxis:e,other:t,meta:a}}function d6(r){var e=[];return D(r,function(t,a){var n=t.categoryAxis,i=t.valueAxis,o=i.dim,s=[" "].concat(G(t.series,function(c){return c.name})),l=[n.model.getCategories()];D(t.series,function(c){var p=c.getRawData();l.push(c.getRawData().mapArray(p.mapDimension(o),function(d){return d}))});for(var u=[s.join(so)],f=0;f=0)return!0}var Ld=new RegExp("["+so+"]+","g");function _6(r){for(var e=r.split(/\n+/g),t=Of(e.shift()).split(Ld),a=[],n=G(t,function(l){return{name:l,data:[]}}),i=0;i=0;i--){var o=t[i];if(o[n])break}if(i<0){var s=r.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(s){var l=s.getPercentRange();t[0][n]={dataZoomId:n,start:l[0],end:l[1]}}}}),t.push(e)}function A6(r){var e=Fy(r),t=e[e.length-1];e.length>1&&e.pop();var a={};return oI(t,function(n,i){for(var o=e.length-1;o>=0;o--)if(n=e[o][i],n){a[i]=n;break}}),a}function C6(r){sI(r).snapshots=null}function D6(r){return Fy(r).length}function Fy(r){var e=sI(r);return e.snapshots||(e.snapshots=[{}]),e.snapshots}var M6=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onclick=function(t,a){C6(t),a.dispatchAction({type:"restore",from:this.uid})},e.getDefaultOption=function(t){var a={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:t.getLocaleModel().get(["toolbox","restore","title"])};return a},e}(tr);Xr({type:"restore",event:"restore",update:"prepareAndUpdate"},function(r,e){e.resetOption("recreate")});var I6=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],Hy=function(){function r(e,t,a){var n=this;this._targetInfoList=[];var i=zx(t,e);D(L6,function(o,s){(!a||!a.include||ct(a.include,s)>=0)&&o(i,n._targetInfoList)})}return r.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,function(a,n,i){if((a.coordRanges||(a.coordRanges=[])).push(n),!a.coordRange){a.coordRange=n;var o=zc[a.brushType](0,i,n);a.__rangeOffset={offset:Wx[a.brushType](o.values,a.range,[1,1]),xyMinMax:o.xyMinMax}}}),e},r.prototype.matchOutputRanges=function(e,t,a){D(e,function(n){var i=this.findTargetInfo(n,t);i&&i!==!0&&D(i.coordSyses,function(o){var s=zc[n.brushType](1,o,n.range,!0);a(n,s.values,o,t)})},this)},r.prototype.setInputRanges=function(e,t){D(e,function(a){var n=this.findTargetInfo(a,t);if(a.range=a.range||[],n&&n!==!0){a.panelId=n.panelId;var i=zc[a.brushType](0,n.coordSys,a.coordRange),o=a.__rangeOffset;a.range=o?Wx[a.brushType](i.values,o.offset,P6(i.xyMinMax,o.xyMinMax)):i.values}},this)},r.prototype.makePanelOpts=function(e,t){return G(this._targetInfoList,function(a){var n=a.getPanelRect();return{panelId:a.panelId,defaultBrushType:t?t(a):null,clipPath:dM(n),isTargetByCursor:yM(n,e,a.coordSysModel),getLinearBrushOtherExtent:gM(n)}})},r.prototype.controlSeries=function(e,t,a){var n=this.findTargetInfo(e,a);return n===!0||n&&ct(n.coordSyses,t.coordinateSystem)>=0},r.prototype.findTargetInfo=function(e,t){for(var a=this._targetInfoList,n=zx(t,e),i=0;ir[1]&&r.reverse(),r}function zx(r,e){return ys(r,e,{includeMainTypes:I6})}var L6={grid:function(r,e){var t=r.xAxisModels,a=r.yAxisModels,n=r.gridModels,i=$(),o={},s={};!t&&!a&&!n||(D(t,function(l){var u=l.axis.grid.model;i.set(u.id,u),o[u.id]=!0}),D(a,function(l){var u=l.axis.grid.model;i.set(u.id,u),s[u.id]=!0}),D(n,function(l){i.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),i.each(function(l){var u=l.coordinateSystem,f=[];D(u.getCartesians(),function(h,v){(ct(t,h.getAxis("x").model)>=0||ct(a,h.getAxis("y").model)>=0)&&f.push(h)}),e.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:f[0],coordSyses:f,getPanelRect:Fx.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(r,e){D(r.geoModels,function(t){var a=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:a,coordSyses:[a],getPanelRect:Fx.geo})})}},Gx=[function(r,e){var t=r.xAxisModel,a=r.yAxisModel,n=r.gridModel;return!n&&t&&(n=t.axis.grid.model),!n&&a&&(n=a.axis.grid.model),n&&n===e.gridModel},function(r,e){var t=r.geoModel;return t&&t===e.geoModel}],Fx={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var r=this.coordSys,e=r.getBoundingRect().clone();return e.applyTransform(qn(r)),e}},zc={lineX:lt(Hx,0),lineY:lt(Hx,1),rect:function(r,e,t,a){var n=r?e.pointToData([t[0][0],t[1][0]],a):e.dataToPoint([t[0][0],t[1][0]],a),i=r?e.pointToData([t[0][1],t[1][1]],a):e.dataToPoint([t[0][1],t[1][1]],a),o=[Pd([n[0],i[0]]),Pd([n[1],i[1]])];return{values:o,xyMinMax:o}},polygon:function(r,e,t,a){var n=[[1/0,-1/0],[1/0,-1/0]],i=G(t,function(o){var s=r?e.pointToData(o,a):e.dataToPoint(o,a);return n[0][0]=Math.min(n[0][0],s[0]),n[1][0]=Math.min(n[1][0],s[1]),n[0][1]=Math.max(n[0][1],s[0]),n[1][1]=Math.max(n[1][1],s[1]),s});return{values:i,xyMinMax:n}}};function Hx(r,e,t,a){var n=t.getAxis(["x","y"][r]),i=Pd(G([0,1],function(s){return e?n.coordToData(n.toLocalCoord(a[s]),!0):n.toGlobalCoord(n.dataToCoord(a[s]))})),o=[];return o[r]=i,o[1-r]=[NaN,NaN],{values:i,xyMinMax:o}}var Wx={lineX:lt(Ux,0),lineY:lt(Ux,1),rect:function(r,e,t){return[[r[0][0]-t[0]*e[0][0],r[0][1]-t[0]*e[0][1]],[r[1][0]-t[1]*e[1][0],r[1][1]-t[1]*e[1][1]]]},polygon:function(r,e,t){return G(r,function(a,n){return[a[0]-t[0]*e[n][0],a[1]-t[1]*e[n][1]]})}};function Ux(r,e,t,a){return[e[0]-a[r]*t[0],e[1]-a[r]*t[1]]}function P6(r,e){var t=Yx(r),a=Yx(e),n=[t[0]/a[0],t[1]/a[1]];return isNaN(n[0])&&(n[0]=1),isNaN(n[1])&&(n[1]=1),n}function Yx(r){return r?[r[0][1]-r[0][0],r[1][1]-r[1][0]]:[NaN,NaN]}var Rd=D,R6=z2("toolbox-dataZoom_"),E6=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,a,n,i){this._brushController||(this._brushController=new dy(n.getZr()),this._brushController.on("brush",X(this._onBrush,this)).mount()),N6(t,a,this,i,n),O6(t,a)},e.prototype.onclick=function(t,a,n){k6[n].call(this)},e.prototype.remove=function(t,a){this._brushController&&this._brushController.unmount()},e.prototype.dispose=function(t,a){this._brushController&&this._brushController.dispose()},e.prototype._onBrush=function(t){var a=t.areas;if(!t.isEnd||!a.length)return;var n={},i=this.ecModel;this._brushController.updateCovers([]);var o=new Hy(Wy(this.model),i,{include:["grid"]});o.matchOutputRanges(a,i,function(u,f,h){if(h.type==="cartesian2d"){var v=u.brushType;v==="rect"?(s("x",h,f[0]),s("y",h,f[1])):s({lineX:"x",lineY:"y"}[v],h,f)}}),T6(i,n),this._dispatchZoomAction(n);function s(u,f,h){var v=f.getAxis(u),c=v.model,p=l(u,c,i),d=p.findRepresentativeAxisProxy(c).getMinMaxSpan();(d.minValueSpan!=null||d.maxValueSpan!=null)&&(h=pi(0,h.slice(),v.scale.getExtent(),0,d.minValueSpan,d.maxValueSpan)),p&&(n[p.id]={dataZoomId:p.id,startValue:h[0],endValue:h[1]})}function l(u,f,h){var v;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(c){var p=c.getAxisModel(u,f.componentIndex);p&&(v=c)}),v}},e.prototype._dispatchZoomAction=function(t){var a=[];Rd(t,function(n,i){a.push(rt(n))}),a.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:a})},e.getDefaultOption=function(t){var a={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}};return a},e}(tr),k6={zoom:function(){var r=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:r})},back:function(){this._dispatchZoomAction(A6(this.ecModel))}};function Wy(r){var e={xAxisIndex:r.get("xAxisIndex",!0),yAxisIndex:r.get("yAxisIndex",!0),xAxisId:r.get("xAxisId",!0),yAxisId:r.get("yAxisId",!0)};return e.xAxisIndex==null&&e.xAxisId==null&&(e.xAxisIndex="all"),e.yAxisIndex==null&&e.yAxisId==null&&(e.yAxisIndex="all"),e}function O6(r,e){r.setIconStatus("back",D6(e)>1?"emphasis":"normal")}function N6(r,e,t,a,n){var i=t._isZoomActive;a&&a.type==="takeGlobalCursor"&&(i=a.key==="dataZoomSelect"?a.dataZoomSelectActive:!1),t._isZoomActive=i,r.setIconStatus("zoom",i?"emphasis":"normal");var o=new Hy(Wy(r),e,{include:["grid"]}),s=o.makePanelOpts(n,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});t._brushController.setPanels(s).enableBrush(i&&s.length?{brushType:"auto",brushStyle:r.getModel("brushStyle").getItemStyle()}:!1)}fE("dataZoom",function(r){var e=r.getComponent("toolbox",0),t=["feature","dataZoom"];if(!e||e.get(t)==null)return;var a=e.getModel(t),n=[],i=Wy(a),o=ys(r,i);Rd(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),Rd(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,f){var h=l.componentIndex,v={type:"select",$fromToolbox:!0,filterMode:a.get("filterMode",!0)||"filter",id:R6+u+h};v[f]=h,n.push(v)}return n});function B6(r){r.registerComponentModel(s6),r.registerComponentView(u6),Gi("saveAsImage",h6),Gi("magicType",c6),Gi("dataView",b6),Gi("dataZoom",E6),Gi("restore",M6),dt(o6)}var V6=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(mt);function lI(r){var e=r.get("confine");return e!=null?!!e:r.get("renderMode")==="richText"}function uI(r){if(yt.domSupported){for(var e=document.documentElement.style,t=0,a=r.length;t-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=i==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=i==="top"?225:45)+"deg)");var f=u*Math.PI/180,h=o+n,v=h*Math.abs(Math.cos(f))+h*Math.abs(Math.sin(f)),c=Math.round(((v-Math.SQRT2*n)/2+Math.SQRT2*n-(v-h)/2)*100)/100;s+=";"+i+":-"+c+"px";var p=e+" solid "+n+"px;",d=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+p,"border-right:"+p,"background-color:"+a+";"];return'
'}function Y6(r,e){var t="cubic-bezier(0.23,1,0.32,1)",a=" "+r/2+"s "+t,n="opacity"+a+",visibility"+a;return e||(a=" "+r+"s "+t,n+=yt.transformSupported?","+Uy+a:",left"+a+",top"+a),F6+":"+n}function Xx(r,e,t){var a=r.toFixed(0)+"px",n=e.toFixed(0)+"px";if(!yt.transformSupported)return t?"top:"+n+";left:"+a+";":[["top",n],["left",a]];var i=yt.transform3dSupported,o="translate"+(i?"3d":"")+"("+a+","+n+(i?",0":"")+")";return t?"top:0;left:0;"+Uy+":"+o+";":[["top",0],["left",0],[fI,o]]}function X6(r){var e=[],t=r.get("fontSize"),a=r.getTextColor();a&&e.push("color:"+a),e.push("font:"+r.getFont());var n=st(r.get("lineHeight"),Math.round(t*3/2));t&&e.push("line-height:"+n+"px");var i=r.get("textShadowColor"),o=r.get("textShadowBlur")||0,s=r.get("textShadowOffsetX")||0,l=r.get("textShadowOffsetY")||0;return i&&o&&e.push("text-shadow:"+s+"px "+l+"px "+o+"px "+i),D(["decoration","align"],function(u){var f=r.get(u);f&&e.push("text-"+u+":"+f)}),e.join(";")}function Z6(r,e,t){var a=[],n=r.get("transitionDuration"),i=r.get("backgroundColor"),o=r.get("shadowBlur"),s=r.get("shadowColor"),l=r.get("shadowOffsetX"),u=r.get("shadowOffsetY"),f=r.getModel("textStyle"),h=wA(r,"html"),v=l+"px "+u+"px "+o+"px "+s;return a.push("box-shadow:"+v),e&&n&&a.push(Y6(n,t)),i&&a.push("background-color:"+i),D(["width","color","radius"],function(c){var p="border-"+c,d=WT(p),g=r.get(d);g!=null&&a.push(p+":"+g+(c==="color"?"":"px"))}),a.push(X6(f)),h!=null&&a.push("padding:"+yo(h).join("px ")+"px"),a.join(";")+";"}function Zx(r,e,t,a,n){var i=e&&e.painter;if(t){var o=i&&i.getViewportRoot();o&&pL(r,o,t,a,n)}else{r[0]=a,r[1]=n;var s=i&&i.getViewportRootOffset();s&&(r[0]+=s.offsetLeft,r[1]+=s.offsetTop)}r[2]=r[0]/e.getWidth(),r[3]=r[1]/e.getHeight()}var $6=function(){function r(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,yt.wxa)return null;var a=document.createElement("div");a.domBelongToZr=!0,this.el=a;var n=this._zr=e.getZr(),i=t.appendTo,o=i&&(Y(i)?document.querySelector(i):Ji(i)?i:J(i)&&i(e.getDom()));Zx(this._styleCoord,n,o,e.getWidth()/2,e.getHeight()/2),(o||e.getDom()).appendChild(a),this._api=e,this._container=o;var s=this;a.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},a.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=n.handler,f=n.painter.getViewportRoot();qe(f,l,!0),u.dispatch("mousemove",l)}},a.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return r.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),a=G6(t,"position"),n=t.style;n.position!=="absolute"&&a!=="absolute"&&(n.position="relative")}var i=e.get("alwaysShowContent");i&&this._moveIfResized(),this._alwaysShowContent=i,this.el.className=e.get("className")||""},r.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var a=this.el,n=a.style,i=this._styleCoord;a.innerHTML?n.cssText=H6+Z6(e,!this._firstShow,this._longHide)+Xx(i[0],i[1],!0)+("border-color:"+ai(t)+";")+(e.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):n.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},r.prototype.setContent=function(e,t,a,n,i){var o=this.el;if(e==null){o.innerHTML="";return}var s="";if(Y(i)&&a.get("trigger")==="item"&&!lI(a)&&(s=U6(a,n,i)),Y(e))o.innerHTML=e+s;else if(e){o.innerHTML="",z(e)||(e=[e]);for(var l=0;l=0?this._tryShow(i,o):n==="leave"&&this._hide(o))},this))},e.prototype._keepShow=function(){var t=this._tooltipModel,a=this._ecModel,n=this._api,i=t.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&i!=="none"&&i!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&o.manuallyShowTip(t,a,n,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},e.prototype.manuallyShowTip=function(t,a,n,i){if(!(i.from===this.uid||yt.node||!n.getDom())){var o=Kx(i,n);this._ticket="";var s=i.dataByCoordSys,l=eU(i,a,n);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:i.position,positionDefault:"bottom"},o)}else if(i.tooltip&&i.x!=null&&i.y!=null){var f=K6;f.x=i.x,f.y=i.y,f.update(),nt(f).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:f},o)}else if(s)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:s,tooltipOption:i.tooltipOption},o);else if(i.seriesIndex!=null){if(this._manuallyAxisShowTip(t,a,n,i))return;var h=KM(i,a),v=h.point[0],c=h.point[1];v!=null&&c!=null&&this._tryShow({offsetX:v,offsetY:c,target:h.el,position:i.position,positionDefault:"bottom"},o)}else i.x!=null&&i.y!=null&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},o))}},e.prototype.manuallyHideTip=function(t,a,n,i){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(Kx(i,n))},e.prototype._manuallyAxisShowTip=function(t,a,n,i){var o=i.seriesIndex,s=i.dataIndex,l=a.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=a.getSeriesByIndex(o);if(u){var f=u.getData(),h=qo([f.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return n.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:i.position}),!0}}},e.prototype._tryShow=function(t,a){var n=t.target,i=this._tooltipModel;if(i){this._lastX=t.offsetX,this._lastY=t.offsetY;var o=t.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,t);else if(n){var s=nt(n);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,u;Gn(n,function(f){if(nt(f).dataIndex!=null)return l=f,!0;if(nt(f).tooltipConfig!=null)return u=f,!0},!0),l?this._showSeriesItemTooltip(t,l,a):u?this._showComponentItemTooltip(t,u,a):this._hide(a)}else this._lastDataByCoordSys=null,this._hide(a)}},e.prototype._showOrMove=function(t,a){var n=t.get("showDelay");a=X(a,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(a,n):a()},e.prototype._showAxisTooltip=function(t,a){var n=this._ecModel,i=this._tooltipModel,o=[a.offsetX,a.offsetY],s=qo([a.tooltipOption],i),l=this._renderMode,u=[],f=ie("section",{blocks:[],noHeader:!0}),h=[],v=new Tv;D(t,function(m){D(m.dataByAxis,function(_){var S=n.getComponent(_.axisDim+"Axis",_.axisIndex),b=_.value;if(!(!S||b==null)){var x=XM(b,S.axis,n,_.seriesDataIndices,_.valueLabelOpt),w=ie("section",{header:x,noHeader:!dr(x),sortBlocks:!0,blocks:[]});f.blocks.push(w),D(_.seriesDataIndices,function(T){var A=n.getSeriesByIndex(T.seriesIndex),C=T.dataIndexInside,M=A.getDataParams(C);if(!(M.dataIndex<0)){M.axisDim=_.axisDim,M.axisIndex=_.axisIndex,M.axisType=_.axisType,M.axisId=_.axisId,M.axisValue=Wg(S.axis,{value:b}),M.axisValueLabel=x,M.marker=v.makeTooltipMarker("item",ai(M.color),l);var I=O0(A.formatTooltip(C,!0,null)),L=I.frag;if(L){var P=qo([A],i).get("valueFormatter");w.blocks.push(P?V({valueFormatter:P},L):L)}I.text&&h.push(I.text),u.push(M)}})}})}),f.blocks.reverse(),h.reverse();var c=a.position,p=s.get("order"),d=F0(f,v,l,p,n.get("useUTC"),s.get("textStyle"));d&&h.unshift(d);var g=l==="richText"?` + +`:"
",y=h.join(g);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(t,u)?this._updatePosition(s,c,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,y,u,Math.random()+"",o[0],o[1],c,null,v)})},e.prototype._showSeriesItemTooltip=function(t,a,n){var i=this._ecModel,o=nt(a),s=o.seriesIndex,l=i.getSeriesByIndex(s),u=o.dataModel||l,f=o.dataIndex,h=o.dataType,v=u.getData(h),c=this._renderMode,p=t.positionDefault,d=qo([v.getItemModel(f),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,p?{position:p}:null),g=d.get("trigger");if(!(g!=null&&g!=="item")){var y=u.getDataParams(f,h),m=new Tv;y.marker=m.makeTooltipMarker("item",ai(y.color),c);var _=O0(u.formatTooltip(f,!1,h)),S=d.get("order"),b=d.get("valueFormatter"),x=_.frag,w=x?F0(b?V({valueFormatter:b},x):x,m,c,S,i.get("useUTC"),d.get("textStyle")):_.text,T="item_"+u.name+"_"+f;this._showOrMove(d,function(){this._showTooltipContent(d,w,y,T,t.offsetX,t.offsetY,t.position,t.target,m)}),n({type:"showTip",dataIndexInside:f,dataIndex:v.getRawIndex(f),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,a,n){var i=this._renderMode==="html",o=nt(a),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(Y(l)){var f=l;l={content:f,formatter:f},u=!0}u&&i&&l.content&&(l=rt(l),l.content=we(l.content));var h=[l],v=this._ecModel.getComponent(o.componentMainType,o.componentIndex);v&&h.push(v),h.push({formatter:l.content});var c=t.positionDefault,p=qo(h,this._tooltipModel,c?{position:c}:null),d=p.get("content"),g=Math.random()+"",y=new Tv;this._showOrMove(p,function(){var m=rt(p.get("formatterParams")||{});this._showTooltipContent(p,d,m,g,t.offsetX,t.offsetY,t.position,a,y)}),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,a,n,i,o,s,l,u,f){if(this._ticket="",!(!t.get("showContent")||!t.get("show"))){var h=this._tooltipContent;h.setEnterable(t.get("enterable"));var v=t.get("formatter");l=l||t.get("position");var c=a,p=this._getNearestPoint([o,s],n,t.get("trigger"),t.get("borderColor")),d=p.color;if(v)if(Y(v)){var g=t.ecModel.get("useUTC"),y=z(n)?n[0]:n,m=y&&y.axisType&&y.axisType.indexOf("time")>=0;c=v,m&&(c=sh(y.axisValue,c,g)),c=UT(c,n,!0)}else if(J(v)){var _=X(function(S,b){S===this._ticket&&(h.setContent(b,f,t,d,l),this._updatePosition(t,l,o,s,h,n,u))},this);this._ticket=i,c=v(n,i,_)}else c=v;h.setContent(c,f,t,d,l),h.show(t,d),this._updatePosition(t,l,o,s,h,n,u)}},e.prototype._getNearestPoint=function(t,a,n,i){if(n==="axis"||z(a))return{color:i||(this._renderMode==="html"?"#fff":"none")};if(!z(a))return{color:i||a.color||a.borderColor}},e.prototype._updatePosition=function(t,a,n,i,o,s,l){var u=this._api.getWidth(),f=this._api.getHeight();a=a||t.get("position");var h=o.getSize(),v=t.get("align"),c=t.get("verticalAlign"),p=l&&l.getBoundingRect().clone();if(l&&p.applyTransform(l.transform),J(a)&&(a=a([n,i],s,o.el,p,{viewSize:[u,f],contentSize:h.slice()})),z(a))n=W(a[0],u),i=W(a[1],f);else if(et(a)){var d=a;d.width=h[0],d.height=h[1];var g=Qt(d,{width:u,height:f});n=g.x,i=g.y,v=null,c=null}else if(Y(a)&&l){var y=tU(a,p,h,t.get("borderWidth"));n=y[0],i=y[1]}else{var y=Q6(n,i,o,u,f,v?null:20,c?null:20);n=y[0],i=y[1]}if(v&&(n-=Jx(v)?h[0]/2:v==="right"?h[0]:0),c&&(i-=Jx(c)?h[1]/2:c==="bottom"?h[1]:0),lI(t)){var y=j6(n,i,o,u,f);n=y[0],i=y[1]}o.moveTo(n,i)},e.prototype._updateContentNotChangedOnAxis=function(t,a){var n=this._lastDataByCoordSys,i=this._cbParamsList,o=!!n&&n.length===t.length;return o&&D(n,function(s,l){var u=s.dataByAxis||[],f=t[l]||{},h=f.dataByAxis||[];o=o&&u.length===h.length,o&&D(u,function(v,c){var p=h[c]||{},d=v.seriesDataIndices||[],g=p.seriesDataIndices||[];o=o&&v.value===p.value&&v.axisType===p.axisType&&v.axisId===p.axisId&&d.length===g.length,o&&D(d,function(y,m){var _=g[m];o=o&&y.seriesIndex===_.seriesIndex&&y.dataIndex===_.dataIndex}),i&&D(v.seriesDataIndices,function(y){var m=y.seriesIndex,_=a[m],S=i[m];_&&S&&S.data!==_.data&&(o=!1)})})}),this._lastDataByCoordSys=t,this._cbParamsList=a,!!o},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,a){yt.node||!a.getDom()||(Fs(this,"_updatePosition"),this._tooltipContent.dispose(),Dd("itemTooltip",a))},e.type="tooltip",e}(Ft);function qo(r,e,t){var a=e.ecModel,n;t?(n=new Mt(t,a,a),n=new Mt(e.option,n,a)):n=e;for(var i=r.length-1;i>=0;i--){var o=r[i];o&&(o instanceof Mt&&(o=o.get("tooltip",!0)),Y(o)&&(o={formatter:o}),o&&(n=new Mt(o,n,a)))}return n}function Kx(r,e){return r.dispatchAction||X(e.dispatchAction,e)}function Q6(r,e,t,a,n,i,o){var s=t.getSize(),l=s[0],u=s[1];return i!=null&&(r+l+i+2>a?r-=l+i:r+=i),o!=null&&(e+u+o>n?e-=u+o:e+=o),[r,e]}function j6(r,e,t,a,n){var i=t.getSize(),o=i[0],s=i[1];return r=Math.min(r+o,a)-o,e=Math.min(e+s,n)-s,r=Math.max(r,0),e=Math.max(e,0),[r,e]}function tU(r,e,t,a){var n=t[0],i=t[1],o=Math.ceil(Math.SQRT2*a)+8,s=0,l=0,u=e.width,f=e.height;switch(r){case"inside":s=e.x+u/2-n/2,l=e.y+f/2-i/2;break;case"top":s=e.x+u/2-n/2,l=e.y-i-o;break;case"bottom":s=e.x+u/2-n/2,l=e.y+f+o;break;case"left":s=e.x-n-o,l=e.y+f/2-i/2;break;case"right":s=e.x+u+o,l=e.y+f/2-i/2}return[s,l]}function Jx(r){return r==="center"||r==="middle"}function eU(r,e,t){var a=ng(r).queryOptionMap,n=a.keys()[0];if(!(!n||n==="series")){var i=il(e,n,a.get(n),{useDefault:!1,enableAll:!1,enableNone:!1}),o=i.models[0];if(o){var s=t.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var f=nt(u).tooltipConfig;if(f&&f.name===r.name)return l=u,!0}),l)return{componentMainType:n,componentIndex:o.componentIndex,el:l}}}}function rU(r){dt(Tl),r.registerComponentModel(V6),r.registerComponentView(J6),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Xt),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Xt)}var aU=["rect","polygon","keep","clear"];function nU(r,e){var t=Pt(r?r.brush:[]);if(t.length){var a=[];D(t,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(a=a.concat(u))});var n=r&&r.toolbox;z(n)&&(n=n[0]),n||(n={feature:{}},r.toolbox=[n]);var i=n.feature||(n.feature={}),o=i.brush||(i.brush={}),s=o.type||(o.type=[]);s.push.apply(s,a),iU(s),e&&!s.length&&s.push.apply(s,aU)}}function iU(r){var e={};D(r,function(t){e[t]=1}),r.length=0,D(e,function(t,a){r.push(a)})}var Qx=D;function jx(r){if(r){for(var e in r)if(r.hasOwnProperty(e))return!0}}function Ed(r,e,t){var a={};return Qx(e,function(i){var o=a[i]=n();Qx(r[i],function(s,l){if(ae.isValidType(l)){var u={type:l,visual:s};t&&t(u,i),o[l]=new ae(u),l==="opacity"&&(u=rt(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new ae(u))}})}),a;function n(){var i=function(){};i.prototype.__hidden=i.prototype;var o=new i;return o}}function vI(r,e,t){var a;D(t,function(n){e.hasOwnProperty(n)&&jx(e[n])&&(a=!0)}),a&&D(t,function(n){e.hasOwnProperty(n)&&jx(e[n])?r[n]=rt(e[n]):delete r[n]})}function oU(r,e,t,a,n,i){var o={};D(r,function(h){var v=ae.prepareVisualTypes(e[h]);o[h]=v});var s;function l(h){return Eg(t,s,h)}function u(h,v){EA(t,s,h,v)}t.each(f);function f(h,v){s=h;var c=t.getRawDataItem(s);if(!(c&&c.visualMap===!1))for(var p=a.call(n,h),d=e[p],g=o[p],y=0,m=g.length;ye[0][1]&&(e[0][1]=i[0]),i[1]e[1][1]&&(e[1][1]=i[1])}return e&&nb(e)}};function nb(r){return new ht(r[0][0],r[1][0],r[0][1]-r[0][0],r[1][1]-r[1][0])}var pU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,a){this.ecModel=t,this.api=a,this.model,(this._brushController=new dy(a.getZr())).on("brush",X(this._onBrush,this)).mount()},e.prototype.render=function(t,a,n,i){this.model=t,this._updateController(t,a,n,i)},e.prototype.updateTransform=function(t,a,n,i){cI(a),this._updateController(t,a,n,i)},e.prototype.updateVisual=function(t,a,n,i){this.updateTransform(t,a,n,i)},e.prototype.updateView=function(t,a,n,i){this._updateController(t,a,n,i)},e.prototype._updateController=function(t,a,n,i){(!i||i.$from!==t.id)&&this._brushController.setPanels(t.brushTargetManager.makePanelOpts(n)).enableBrush(t.brushOption).updateCovers(t.areas.slice())},e.prototype.dispose=function(){this._brushController.dispose()},e.prototype._onBrush=function(t){var a=this.model.id,n=this.model.brushTargetManager.setOutputRanges(t.areas,this.ecModel);(!t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:a,areas:rt(n),$from:a}),t.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:a,areas:rt(n),$from:a})},e.type="brush",e}(Ft),dU="#ddd",gU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.areas=[],t.brushOption={},t}return e.prototype.optionUpdated=function(t,a){var n=this.option;!a&&vI(n,t,["inBrush","outOfBrush"]);var i=n.inBrush=n.inBrush||{};n.outOfBrush=n.outOfBrush||{color:dU},i.hasOwnProperty("liftZ")||(i.liftZ=5)},e.prototype.setAreas=function(t){t&&(this.areas=G(t,function(a){return ib(this.option,a)},this))},e.prototype.setBrushOption=function(t){this.brushOption=ib(this.option,t),this.brushType=this.brushOption.brushType},e.type="brush",e.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],e.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(210,219,238,0.3)",borderColor:"#D2DBEE"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},e}(mt);function ib(r,e){return ut({brushType:r.brushType,brushMode:r.brushMode,transformable:r.transformable,brushStyle:new Mt(r.brushStyle).getItemStyle(),removeOnClick:r.removeOnClick,z:r.z},e,!0)}var yU=["rect","polygon","lineX","lineY","keep","clear"],mU=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,a,n){var i,o,s;a.eachComponent({mainType:"brush"},function(l){i=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=i,this._brushMode=o,D(t.get("type",!0),function(l){t.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===i)?"emphasis":"normal")})},e.prototype.updateView=function(t,a,n){this.render(t,a,n)},e.prototype.getIcons=function(){var t=this.model,a=t.get("icon",!0),n={};return D(t.get("type",!0),function(i){a[i]&&(n[i]=a[i])}),n},e.prototype.onclick=function(t,a,n){var i=this._brushType,o=this._brushMode;n==="clear"?(a.dispatchAction({type:"axisAreaSelect",intervals:[]}),a.dispatchAction({type:"brush",command:"clear",areas:[]})):a.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:n==="keep"?i:i===n?!1:n,brushMode:n==="keep"?o==="multiple"?"single":"multiple":o}})},e.getDefaultOption=function(t){var a={show:!0,type:yU.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:t.getLocaleModel().get(["toolbox","brush","title"])};return a},e}(tr);function _U(r){r.registerComponentView(pU),r.registerComponentModel(gU),r.registerPreprocessor(nU),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,uU),r.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(e,t){t.eachComponent({mainType:"brush",query:e},function(a){a.setAreas(e.areas)})}),r.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},Xt),r.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},Xt),Gi("brush",mU)}var SU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(mt),xU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,a,n){if(this.group.removeAll(),!!t.get("show")){var i=this.group,o=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),u=st(t.get("textBaseline"),t.get("textVerticalAlign")),f=new bt({style:Bt(o,{text:t.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=f.getBoundingRect(),v=t.get("subtext"),c=new bt({style:Bt(s,{text:v,fill:s.getTextColor(),y:h.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),p=t.get("link"),d=t.get("sublink"),g=t.get("triggerEvent",!0);f.silent=!p&&!g,c.silent=!d&&!g,p&&f.on("click",function(){hf(p,"_"+t.get("target"))}),d&&c.on("click",function(){hf(d,"_"+t.get("subtarget"))}),nt(f).eventData=nt(c).eventData=g?{componentType:"title",componentIndex:t.componentIndex}:null,i.add(f),v&&i.add(c);var y=i.getBoundingRect(),m=t.getBoxLayoutParams();m.width=y.width,m.height=y.height;var _=Qt(m,{width:n.getWidth(),height:n.getHeight()},t.get("padding"));l||(l=t.get("left")||t.get("right"),l==="middle"&&(l="center"),l==="right"?_.x+=_.width:l==="center"&&(_.x+=_.width/2)),u||(u=t.get("top")||t.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?_.y+=_.height:u==="middle"&&(_.y+=_.height/2),u=u||"top"),i.x=_.x,i.y=_.y,i.markRedraw();var S={align:l,verticalAlign:u};f.setStyle(S),c.setStyle(S),y=i.getBoundingRect();var b=_.margin,x=t.getItemStyle(["color","opacity"]);x.fill=t.get("backgroundColor");var w=new St({shape:{x:y.x-b[3],y:y.y-b[0],width:y.width+b[1]+b[3],height:y.height+b[0]+b[2],r:t.get("borderRadius")},style:x,subPixelOptimize:!0,silent:!0});i.add(w)}},e.type="title",e}(Ft);function bU(r){r.registerComponentModel(SU),r.registerComponentView(xU)}var ob=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode="box",t}return e.prototype.init=function(t,a,n){this.mergeDefaultAndTheme(t,n),this._initData()},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),this._initData()},e.prototype.setCurrentIndex=function(t){t==null&&(t=this.option.currentIndex);var a=this._data.count();this.option.loop?t=(t%a+a)%a:(t>=a&&(t=a-1),t<0&&(t=0)),this.option.currentIndex=t},e.prototype.getCurrentIndex=function(){return this.option.currentIndex},e.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},e.prototype.setPlayState=function(t){this.option.autoPlay=!!t},e.prototype.getPlayState=function(){return!!this.option.autoPlay},e.prototype._initData=function(){var t=this.option,a=t.data||[],n=t.axisType,i=this._names=[],o;n==="category"?(o=[],D(a,function(u,f){var h=Jt(ho(u),""),v;et(u)?(v=rt(u),v.value=f):v=f,o.push(v),i.push(h)})):o=a;var s={category:"ordinal",time:"time",value:"number"}[n]||"number",l=this._data=new Te([{name:"value",type:s}],this);l.initData(o,i)},e.prototype.getData=function(){return this._data},e.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},e.type="timeline",e.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},e}(mt),pI=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline.slider",e.defaultOption=ja(ob.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),e}(ob);Kt(pI,ph.prototype);var wU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline",e}(Ft),TU=function(r){k(e,r);function e(t,a,n,i){var o=r.call(this,t,a,n)||this;return o.type=i||"value",o}return e.prototype.getLabelModel=function(){return this.model.getModel("label")},e.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},e}(br),Fc=Math.PI,sb=xt(),AU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,a){this.api=a},e.prototype.render=function(t,a,n){if(this.model=t,this.api=n,this.ecModel=a,this.group.removeAll(),t.get("show",!0)){var i=this._layout(t,n),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(i,t);t.formatTooltip=function(u){var f=l.scale.getLabel({value:u});return ie("nameValue",{noName:!0,value:f})},D(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](i,o,l,t)},this),this._renderAxisLabel(i,s,l,t),this._position(i,t)}this._doPlayStop(),this._updateTicksStatus()},e.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},e.prototype.dispose=function(){this._clearTimer()},e.prototype._layout=function(t,a){var n=t.get(["label","position"]),i=t.get("orient"),o=DU(t,a),s;n==null||n==="auto"?s=i==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},f={horizontal:0,vertical:Fc/2},h=i==="vertical"?o.height:o.width,v=t.getModel("controlStyle"),c=v.get("show",!0),p=c?v.get("itemSize"):0,d=c?v.get("itemGap"):0,g=p+d,y=t.get(["label","rotate"])||0;y=y*Fc/180;var m,_,S,b=v.get("position",!0),x=c&&v.get("showPlayBtn",!0),w=c&&v.get("showPrevBtn",!0),T=c&&v.get("showNextBtn",!0),A=0,C=h;b==="left"||b==="bottom"?(x&&(m=[0,0],A+=g),w&&(_=[A,0],A+=g),T&&(S=[C-p,0],C-=g)):(x&&(m=[C-p,0],C-=g),w&&(_=[0,0],A+=g),T&&(S=[C-p,0],C-=g));var M=[A,C];return t.get("inverse")&&M.reverse(),{viewRect:o,mainLength:h,orient:i,rotation:f[i],labelRotation:y,labelPosOpt:s,labelAlign:t.get(["label","align"])||l[i],labelBaseline:t.get(["label","verticalAlign"])||t.get(["label","baseline"])||u[i],playPosition:m,prevBtnPosition:_,nextBtnPosition:S,axisExtent:M,controlSize:p,controlGap:d}},e.prototype._position=function(t,a){var n=this._mainGroup,i=this._labelGroup,o=t.viewRect;if(t.orient==="vertical"){var s=Fe(),l=o.x,u=o.y+o.height;Fr(s,s,[-l,-u]),si(s,s,-Fc/2),Fr(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var f=m(o),h=m(n.getBoundingRect()),v=m(i.getBoundingRect()),c=[n.x,n.y],p=[i.x,i.y];p[0]=c[0]=f[0][0];var d=t.labelPosOpt;if(d==null||Y(d)){var g=d==="+"?0:1;_(c,h,f,1,g),_(p,v,f,1,1-g)}else{var g=d>=0?0:1;_(c,h,f,1,g),p[1]=c[1]+d}n.setPosition(c),i.setPosition(p),n.rotation=i.rotation=t.rotation,y(n),y(i);function y(S){S.originX=f[0][0]-S.x,S.originY=f[1][0]-S.y}function m(S){return[[S.x,S.x+S.width],[S.y,S.y+S.height]]}function _(S,b,x,w,T){S[w]+=x[w][T]-b[w][T]}},e.prototype._createAxis=function(t,a){var n=a.getData(),i=a.get("axisType"),o=CU(a,i);o.getTicks=function(){return n.mapArray(["value"],function(u){return{value:u}})};var s=n.getDataExtent("value");o.setExtent(s[0],s[1]),o.calcNiceTicks();var l=new TU("value",o,t.axisExtent,i);return l.model=a,l},e.prototype._createGroup=function(t){var a=this[t]=new at;return this.group.add(a),a},e.prototype._renderAxisLine=function(t,a,n,i){var o=n.getExtent();if(i.get(["lineStyle","show"])){var s=new ee({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:V({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});a.add(s);var l=this._progressLine=new ee({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:j({lineCap:"round",lineWidth:s.style.lineWidth},i.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});a.add(l)}},e.prototype._renderAxisTick=function(t,a,n,i){var o=this,s=i.getData(),l=n.scale.getTicks();this._tickSymbols=[],D(l,function(u){var f=n.dataToCoord(u.value),h=s.getItemModel(u.value),v=h.getModel("itemStyle"),c=h.getModel(["emphasis","itemStyle"]),p=h.getModel(["progress","itemStyle"]),d={x:f,y:0,onclick:X(o._changeTimeline,o,u.value)},g=lb(h,v,a,d);g.ensureState("emphasis").style=c.getItemStyle(),g.ensureState("progress").style=p.getItemStyle(),$n(g);var y=nt(g);h.get("tooltip")?(y.dataIndex=u.value,y.dataModel=i):y.dataIndex=y.dataModel=null,o._tickSymbols.push(g)})},e.prototype._renderAxisLabel=function(t,a,n,i){var o=this,s=n.getLabelModel();if(s.get("show")){var l=i.getData(),u=n.getViewLabels();this._tickLabels=[],D(u,function(f){var h=f.tickValue,v=l.getItemModel(h),c=v.getModel("label"),p=v.getModel(["emphasis","label"]),d=v.getModel(["progress","label"]),g=n.dataToCoord(f.tickValue),y=new bt({x:g,y:0,rotation:t.labelRotation-t.rotation,onclick:X(o._changeTimeline,o,h),silent:!1,style:Bt(c,{text:f.formattedLabel,align:t.labelAlign,verticalAlign:t.labelBaseline})});y.ensureState("emphasis").style=Bt(p),y.ensureState("progress").style=Bt(d),a.add(y),$n(y),sb(y).dataIndex=h,o._tickLabels.push(y)})}},e.prototype._renderControl=function(t,a,n,i){var o=t.controlSize,s=t.rotation,l=i.getModel("controlStyle").getItemStyle(),u=i.getModel(["emphasis","controlStyle"]).getItemStyle(),f=i.getPlayState(),h=i.get("inverse",!0);v(t.nextBtnPosition,"next",X(this._changeTimeline,this,h?"-":"+")),v(t.prevBtnPosition,"prev",X(this._changeTimeline,this,h?"+":"-")),v(t.playPosition,f?"stop":"play",X(this._handlePlayClick,this,!f),!0);function v(c,p,d,g){if(c){var y=_r(st(i.get(["controlStyle",p+"BtnSize"]),o),o),m=[0,-y/2,y,y],_=MU(i,p+"Icon",m,{x:c[0],y:c[1],originX:o/2,originY:0,rotation:g?-s:0,rectHover:!0,style:l,onclick:d});_.ensureState("emphasis").style=u,a.add(_),$n(_)}}},e.prototype._renderCurrentPointer=function(t,a,n,i){var o=i.getData(),s=i.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,f={onCreate:function(h){h.draggable=!0,h.drift=X(u._handlePointerDrag,u),h.ondragend=X(u._handlePointerDragend,u),ub(h,u._progressLine,s,n,i,!0)},onUpdate:function(h){ub(h,u._progressLine,s,n,i)}};this._currentPointer=lb(l,l,this._mainGroup,{},this._currentPointer,f)},e.prototype._handlePlayClick=function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},e.prototype._handlePointerDrag=function(t,a,n){this._clearTimer(),this._pointerChangeTimeline([n.offsetX,n.offsetY])},e.prototype._handlePointerDragend=function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},e.prototype._pointerChangeTimeline=function(t,a){var n=this._toAxisCoord(t)[0],i=this._axis,o=ar(i.getExtent().slice());n>o[1]&&(n=o[1]),n=0&&(o[i]=+o[i].toFixed(v)),[o,h]}var Hc={min:lt(wu,"min"),max:lt(wu,"max"),average:lt(wu,"average"),median:lt(wu,"median")};function el(r,e){if(e){var t=r.getData(),a=r.coordinateSystem,n=a&&a.dimensions;if(!kU(e)&&!z(e.coord)&&z(n)){var i=dI(e,t,a,r);if(e=rt(e),e.type&&Hc[e.type]&&i.baseAxis&&i.valueAxis){var o=ct(n,i.baseAxis.dim),s=ct(n,i.valueAxis.dim),l=Hc[e.type](t,i.baseDataDim,i.valueDataDim,o,s);e.coord=l[0],e.value=l[1]}else e.coord=[e.xAxis!=null?e.xAxis:e.radiusAxis,e.yAxis!=null?e.yAxis:e.angleAxis]}if(e.coord==null||!z(n))e.coord=[];else for(var u=e.coord,f=0;f<2;f++)Hc[u[f]]&&(u[f]=Xy(t,t.mapDimension(n[f]),u[f]));return e}}function dI(r,e,t,a){var n={};return r.valueIndex!=null||r.valueDim!=null?(n.valueDataDim=r.valueIndex!=null?e.getDimension(r.valueIndex):r.valueDim,n.valueAxis=t.getAxis(OU(a,n.valueDataDim)),n.baseAxis=t.getOtherAxis(n.valueAxis),n.baseDataDim=e.mapDimension(n.baseAxis.dim)):(n.baseAxis=a.getBaseAxis(),n.valueAxis=t.getOtherAxis(n.baseAxis),n.baseDataDim=e.mapDimension(n.baseAxis.dim),n.valueDataDim=e.mapDimension(n.valueAxis.dim)),n}function OU(r,e){var t=r.getData().getDimensionInfo(e);return t&&t.coordDim}function rl(r,e){return r&&r.containData&&e.coord&&!Od(e)?r.containData(e.coord):!0}function NU(r,e,t){return r&&r.containZone&&e.coord&&t.coord&&!Od(e)&&!Od(t)?r.containZone(e.coord,t.coord):!0}function gI(r,e){return r?function(t,a,n,i){var o=i<2?t.coord&&t.coord[i]:t.value;return Ha(o,e[i])}:function(t,a,n,i){return Ha(t.value,e[i])}}function Xy(r,e,t){if(t==="average"){var a=0,n=0;return r.each(e,function(i,o){isNaN(i)||(a+=i,n++)}),a/n}else return t==="median"?r.getMedian(e):r.getDataExtent(e)[t==="max"?1:0]}var Wc=xt(),Zy=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this.markerGroupMap=$()},e.prototype.render=function(t,a,n){var i=this,o=this.markerGroupMap;o.each(function(s){Wc(s).keep=!1}),a.eachSeries(function(s){var l=ca.getMarkerModelFromSeries(s,i.type);l&&i.renderSeries(s,l,a,n)}),o.each(function(s){!Wc(s).keep&&i.group.remove(s.group)})},e.prototype.markKeep=function(t){Wc(t).keep=!0},e.prototype.toggleBlurSeries=function(t,a){var n=this;D(t,function(i){var o=ca.getMarkerModelFromSeries(i,n.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(a?sT(l):hg(l))})}})},e.type="marker",e}(Ft);function hb(r,e,t){var a=e.coordinateSystem;r.each(function(n){var i=r.getItemModel(n),o,s=W(i.get("x"),t.getWidth()),l=W(i.get("y"),t.getHeight());if(!isNaN(s)&&!isNaN(l))o=[s,l];else if(e.getMarkerPosition)o=e.getMarkerPosition(r.getValues(r.dimensions,n));else if(a){var u=r.get(a.dimensions[0],n),f=r.get(a.dimensions[1],n);o=a.dataToPoint([u,f])}isNaN(s)||(o[0]=s),isNaN(l)||(o[1]=l),r.setItemLayout(n,o)})}var BU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,a,n){a.eachSeries(function(i){var o=ca.getMarkerModelFromSeries(i,"markPoint");o&&(hb(o.getData(),i,n),this.markerGroupMap.get(i.id).updateLayout())},this)},e.prototype.renderSeries=function(t,a,n,i){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,f=u.get(s)||u.set(s,new yl),h=VU(o,t,a);a.setData(h),hb(a.getData(),t,i),h.each(function(v){var c=h.getItemModel(v),p=c.getShallow("symbol"),d=c.getShallow("symbolSize"),g=c.getShallow("symbolRotate"),y=c.getShallow("symbolOffset"),m=c.getShallow("symbolKeepAspect");if(J(p)||J(d)||J(g)||J(y)){var _=a.getRawValue(v),S=a.getDataParams(v);J(p)&&(p=p(_,S)),J(d)&&(d=d(_,S)),J(g)&&(g=g(_,S)),J(y)&&(y=y(_,S))}var b=c.getModel("itemStyle").getItemStyle(),x=cl(l,"color");b.fill||(b.fill=x),h.setItemVisual(v,{symbol:p,symbolSize:d,symbolRotate:g,symbolOffset:y,symbolKeepAspect:m,style:b})}),f.updateData(h),this.group.add(f.group),h.eachItemGraphicEl(function(v){v.traverse(function(c){nt(c).dataModel=a})}),this.markKeep(f),f.group.silent=a.get("silent")||t.get("silent")},e.type="markPoint",e}(Zy);function VU(r,e,t){var a;r?a=G(r&&r.dimensions,function(s){var l=e.getData().getDimensionInfo(e.getData().mapDimension(s))||{};return V(V({},l),{name:s,ordinalMeta:null})}):a=[{name:"value",type:"float"}];var n=new Te(a,t),i=G(t.get("data"),lt(el,e));r&&(i=Ct(i,lt(rl,r)));var o=gI(!!r,a);return n.initData(i,null,o),n}function zU(r){r.registerComponentModel(EU),r.registerComponentView(BU),r.registerPreprocessor(function(e){Yy(e.series,"markPoint")&&(e.markPoint=e.markPoint||{})})}var GU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,a,n){return new e(t,a,n)},e.type="markLine",e.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},e}(ca),Tu=xt(),FU=function(r,e,t,a){var n=r.getData(),i;if(z(a))i=a;else{var o=a.type;if(o==="min"||o==="max"||o==="average"||o==="median"||a.xAxis!=null||a.yAxis!=null){var s=void 0,l=void 0;if(a.yAxis!=null||a.xAxis!=null)s=e.getAxis(a.yAxis!=null?"y":"x"),l=se(a.yAxis,a.xAxis);else{var u=dI(a,n,e,r);s=u.valueAxis;var f=lC(n,u.valueDataDim);l=Xy(n,f,o)}var h=s.dim==="x"?0:1,v=1-h,c=rt(a),p={coord:[]};c.type=null,c.coord=[],c.coord[v]=-1/0,p.coord[v]=1/0;var d=t.get("precision");d>=0&&wt(l)&&(l=+l.toFixed(Math.min(d,20))),c.coord[h]=p.coord[h]=l,i=[c,p,{type:o,valueIndex:a.valueIndex,value:l}]}else i=[]}var g=[el(r,i[0]),el(r,i[1]),V({},i[2])];return g[2].type=g[2].type||null,ut(g[2],g[0]),ut(g[2],g[1]),g};function Nf(r){return!isNaN(r)&&!isFinite(r)}function vb(r,e,t,a){var n=1-r,i=a.dimensions[r];return Nf(e[n])&&Nf(t[n])&&e[r]===t[r]&&a.getAxis(i).containData(e[r])}function HU(r,e){if(r.type==="cartesian2d"){var t=e[0].coord,a=e[1].coord;if(t&&a&&(vb(1,t,a,r)||vb(0,t,a,r)))return!0}return rl(r,e[0])&&rl(r,e[1])}function Uc(r,e,t,a,n){var i=a.coordinateSystem,o=r.getItemModel(e),s,l=W(o.get("x"),n.getWidth()),u=W(o.get("y"),n.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(a.getMarkerPosition)s=a.getMarkerPosition(r.getValues(r.dimensions,e));else{var f=i.dimensions,h=r.get(f[0],e),v=r.get(f[1],e);s=i.dataToPoint([h,v])}if(vi(i,"cartesian2d")){var c=i.getAxis("x"),p=i.getAxis("y"),f=i.dimensions;Nf(r.get(f[0],e))?s[0]=c.toGlobalCoord(c.getExtent()[t?0:1]):Nf(r.get(f[1],e))&&(s[1]=p.toGlobalCoord(p.getExtent()[t?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}r.setItemLayout(e,s)}var WU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,a,n){a.eachSeries(function(i){var o=ca.getMarkerModelFromSeries(i,"markLine");if(o){var s=o.getData(),l=Tu(o).from,u=Tu(o).to;l.each(function(f){Uc(l,f,!0,i,n),Uc(u,f,!1,i,n)}),s.each(function(f){s.setItemLayout(f,[l.getItemLayout(f),u.getItemLayout(f)])}),this.markerGroupMap.get(i.id).updateLayout()}},this)},e.prototype.renderSeries=function(t,a,n,i){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,f=u.get(s)||u.set(s,new py);this.group.add(f.group);var h=UU(o,t,a),v=h.from,c=h.to,p=h.line;Tu(a).from=v,Tu(a).to=c,a.setData(p);var d=a.get("symbol"),g=a.get("symbolSize"),y=a.get("symbolRotate"),m=a.get("symbolOffset");z(d)||(d=[d,d]),z(g)||(g=[g,g]),z(y)||(y=[y,y]),z(m)||(m=[m,m]),h.from.each(function(S){_(v,S,!0),_(c,S,!1)}),p.each(function(S){var b=p.getItemModel(S).getModel("lineStyle").getLineStyle();p.setItemLayout(S,[v.getItemLayout(S),c.getItemLayout(S)]),b.stroke==null&&(b.stroke=v.getItemVisual(S,"style").fill),p.setItemVisual(S,{fromSymbolKeepAspect:v.getItemVisual(S,"symbolKeepAspect"),fromSymbolOffset:v.getItemVisual(S,"symbolOffset"),fromSymbolRotate:v.getItemVisual(S,"symbolRotate"),fromSymbolSize:v.getItemVisual(S,"symbolSize"),fromSymbol:v.getItemVisual(S,"symbol"),toSymbolKeepAspect:c.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:c.getItemVisual(S,"symbolOffset"),toSymbolRotate:c.getItemVisual(S,"symbolRotate"),toSymbolSize:c.getItemVisual(S,"symbolSize"),toSymbol:c.getItemVisual(S,"symbol"),style:b})}),f.updateData(p),h.line.eachItemGraphicEl(function(S){nt(S).dataModel=a,S.traverse(function(b){nt(b).dataModel=a})});function _(S,b,x){var w=S.getItemModel(b);Uc(S,b,x,t,i);var T=w.getModel("itemStyle").getItemStyle();T.fill==null&&(T.fill=cl(l,"color")),S.setItemVisual(b,{symbolKeepAspect:w.get("symbolKeepAspect"),symbolOffset:st(w.get("symbolOffset",!0),m[x?0:1]),symbolRotate:st(w.get("symbolRotate",!0),y[x?0:1]),symbolSize:st(w.get("symbolSize"),g[x?0:1]),symbol:st(w.get("symbol",!0),d[x?0:1]),style:T})}this.markKeep(f),f.group.silent=a.get("silent")||t.get("silent")},e.type="markLine",e}(Zy);function UU(r,e,t){var a;r?a=G(r&&r.dimensions,function(u){var f=e.getData().getDimensionInfo(e.getData().mapDimension(u))||{};return V(V({},f),{name:u,ordinalMeta:null})}):a=[{name:"value",type:"float"}];var n=new Te(a,t),i=new Te(a,t),o=new Te([],t),s=G(t.get("data"),lt(FU,e,r,t));r&&(s=Ct(s,lt(HU,r)));var l=gI(!!r,a);return n.initData(G(s,function(u){return u[0]}),null,l),i.initData(G(s,function(u){return u[1]}),null,l),o.initData(G(s,function(u){return u[2]})),o.hasItemOption=!0,{from:n,to:i,line:o}}function YU(r){r.registerComponentModel(GU),r.registerComponentView(WU),r.registerPreprocessor(function(e){Yy(e.series,"markLine")&&(e.markLine=e.markLine||{})})}var XU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,a,n){return new e(t,a,n)},e.type="markArea",e.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},e}(ca),Au=xt(),ZU=function(r,e,t,a){var n=a[0],i=a[1];if(!(!n||!i)){var o=el(r,n),s=el(r,i),l=o.coord,u=s.coord;l[0]=se(l[0],-1/0),l[1]=se(l[1],-1/0),u[0]=se(u[0],1/0),u[1]=se(u[1],1/0);var f=Zd([{},o,s]);return f.coord=[o.coord,s.coord],f.x0=o.x,f.y0=o.y,f.x1=s.x,f.y1=s.y,f}};function Bf(r){return!isNaN(r)&&!isFinite(r)}function cb(r,e,t,a){var n=1-r;return Bf(e[n])&&Bf(t[n])}function $U(r,e){var t=e.coord[0],a=e.coord[1],n={coord:t,x:e.x0,y:e.y0},i={coord:a,x:e.x1,y:e.y1};return vi(r,"cartesian2d")?t&&a&&(cb(1,t,a)||cb(0,t,a))?!0:NU(r,n,i):rl(r,n)||rl(r,i)}function pb(r,e,t,a,n){var i=a.coordinateSystem,o=r.getItemModel(e),s,l=W(o.get(t[0]),n.getWidth()),u=W(o.get(t[1]),n.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(a.getMarkerPosition){var f=r.getValues(["x0","y0"],e),h=r.getValues(["x1","y1"],e),v=i.clampData(f),c=i.clampData(h),p=[];t[0]==="x0"?p[0]=v[0]>c[0]?h[0]:f[0]:p[0]=v[0]>c[0]?f[0]:h[0],t[1]==="y0"?p[1]=v[1]>c[1]?h[1]:f[1]:p[1]=v[1]>c[1]?f[1]:h[1],s=a.getMarkerPosition(p,t,!0)}else{var d=r.get(t[0],e),g=r.get(t[1],e),y=[d,g];i.clampData&&i.clampData(y,y),s=i.dataToPoint(y,!0)}if(vi(i,"cartesian2d")){var m=i.getAxis("x"),_=i.getAxis("y"),d=r.get(t[0],e),g=r.get(t[1],e);Bf(d)?s[0]=m.toGlobalCoord(m.getExtent()[t[0]==="x0"?0:1]):Bf(g)&&(s[1]=_.toGlobalCoord(_.getExtent()[t[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var db=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],qU=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,a,n){a.eachSeries(function(i){var o=ca.getMarkerModelFromSeries(i,"markArea");if(o){var s=o.getData();s.each(function(l){var u=G(db,function(h){return pb(s,l,h,i,n)});s.setItemLayout(l,u);var f=s.getItemGraphicEl(l);f.setShape("points",u)})}},this)},e.prototype.renderSeries=function(t,a,n,i){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,f=u.get(s)||u.set(s,{group:new at});this.group.add(f.group),this.markKeep(f);var h=KU(o,t,a);a.setData(h),h.each(function(v){var c=G(db,function(T){return pb(h,v,T,t,i)}),p=o.getAxis("x").scale,d=o.getAxis("y").scale,g=p.getExtent(),y=d.getExtent(),m=[p.parse(h.get("x0",v)),p.parse(h.get("x1",v))],_=[d.parse(h.get("y0",v)),d.parse(h.get("y1",v))];ar(m),ar(_);var S=!(g[0]>m[1]||g[1]_[1]||y[1]<_[0]),b=!S;h.setItemLayout(v,{points:c,allClipped:b});var x=h.getItemModel(v).getModel("itemStyle").getItemStyle(),w=cl(l,"color");x.fill||(x.fill=w,Y(x.fill)&&(x.fill=Qu(x.fill,.4))),x.stroke||(x.stroke=w),h.setItemVisual(v,"style",x)}),h.diff(Au(f).data).add(function(v){var c=h.getItemLayout(v);if(!c.allClipped){var p=new Ie({shape:{points:c.points}});h.setItemGraphicEl(v,p),f.group.add(p)}}).update(function(v,c){var p=Au(f).data.getItemGraphicEl(c),d=h.getItemLayout(v);d.allClipped?p&&f.group.remove(p):(p?Tt(p,{shape:{points:d.points}},a,v):p=new Ie({shape:{points:d.points}}),h.setItemGraphicEl(v,p),f.group.add(p))}).remove(function(v){var c=Au(f).data.getItemGraphicEl(v);f.group.remove(c)}).execute(),h.eachItemGraphicEl(function(v,c){var p=h.getItemModel(c),d=h.getItemVisual(c,"style");v.useStyle(h.getItemVisual(c,"style")),ve(v,ne(p),{labelFetcher:a,labelDataIndex:c,defaultText:h.getName(c)||"",inheritColor:Y(d.fill)?Qu(d.fill,1):"#000"}),he(v,p),Ht(v,null,null,p.get(["emphasis","disabled"])),nt(v).dataModel=a}),Au(f).data=h,f.group.silent=a.get("silent")||t.get("silent")},e.type="markArea",e}(Zy);function KU(r,e,t){var a,n,i=["x0","y0","x1","y1"];if(r){var o=G(r&&r.dimensions,function(u){var f=e.getData(),h=f.getDimensionInfo(f.mapDimension(u))||{};return V(V({},h),{name:u,ordinalMeta:null})});n=G(i,function(u,f){return{name:u,type:o[f%2].type}}),a=new Te(n,t)}else n=[{name:"value",type:"float"}],a=new Te(n,t);var s=G(t.get("data"),lt(ZU,e,r,t));r&&(s=Ct(s,lt($U,r)));var l=r?function(u,f,h,v){var c=u.coord[Math.floor(v/2)][v%2];return Ha(c,n[v])}:function(u,f,h,v){return Ha(u.value,n[v])};return a.initData(s,null,l),a.hasItemOption=!0,a}function JU(r){r.registerComponentModel(XU),r.registerComponentView(qU),r.registerPreprocessor(function(e){Yy(e.series,"markArea")&&(e.markArea=e.markArea||{})})}var QU=function(r,e){if(e==="all")return{type:"all",title:r.getLocaleModel().get(["legend","selector","all"])};if(e==="inverse")return{type:"inverse",title:r.getLocaleModel().get(["legend","selector","inverse"])}},Nd=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.prototype.init=function(t,a,n){this.mergeDefaultAndTheme(t,n),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(t,a){r.prototype.mergeOption.call(this,t,a),this._updateSelector(t)},e.prototype._updateSelector=function(t){var a=t.selector,n=this.ecModel;a===!0&&(a=t.selector=["all","inverse"]),z(a)&&D(a,function(i,o){Y(i)&&(i={type:i}),a[o]=ut(i,QU(n,i.type))})},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&this.get("selectedMode")==="single"){for(var a=!1,n=0;n=0},e.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(mt),Ei=lt,Bd=D,Cu=at,yI=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!1,t}return e.prototype.init=function(){this.group.add(this._contentGroup=new Cu),this.group.add(this._selectorGroup=new Cu),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,a,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!t.get("show",!0)){var o=t.get("align"),s=t.get("orient");(!o||o==="auto")&&(o=t.get("left")==="right"&&s==="vertical"?"right":"left");var l=t.get("selector",!0),u=t.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,t,a,n,l,s,u);var f=t.getBoxLayoutParams(),h={width:n.getWidth(),height:n.getHeight()},v=t.get("padding"),c=Qt(f,h,v),p=this.layoutInner(t,o,c,i,l,u),d=Qt(j({width:p.width,height:p.height},f),h,v);this.group.x=d.x-p.x,this.group.y=d.y-p.y,this.group.markRedraw(),this.group.add(this._backgroundEl=iI(p,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,a,n,i,o,s,l){var u=this.getContentGroup(),f=$(),h=a.get("selectedMode"),v=[];n.eachRawSeries(function(c){!c.get("legendHoverLink")&&v.push(c.id)}),Bd(a.getData(),function(c,p){var d=c.get("name");if(!this.newlineDisabled&&(d===""||d===` +`)){var g=new Cu;g.newline=!0,u.add(g);return}var y=n.getSeriesByName(d)[0];if(!f.get(d))if(y){var m=y.getData(),_=m.getVisual("legendLineStyle")||{},S=m.getVisual("legendIcon"),b=m.getVisual("style"),x=this._createItem(y,d,p,c,a,t,_,b,S,h,i);x.on("click",Ei(gb,d,null,i,v)).on("mouseover",Ei(Vd,y.name,null,i,v)).on("mouseout",Ei(zd,y.name,null,i,v)),n.ssr&&x.eachChild(function(w){var T=nt(w);T.seriesIndex=y.seriesIndex,T.dataIndex=p,T.ssrType="legend"}),f.set(d,!0)}else n.eachRawSeries(function(w){if(!f.get(d)&&w.legendVisualProvider){var T=w.legendVisualProvider;if(!T.containName(d))return;var A=T.indexOfName(d),C=T.getItemVisual(A,"style"),M=T.getItemVisual(A,"legendIcon"),I=He(C.fill);I&&I[3]===0&&(I[3]=.2,C=V(V({},C),{fill:aa(I,"rgba")}));var L=this._createItem(w,d,p,c,a,t,{},C,M,h,i);L.on("click",Ei(gb,null,d,i,v)).on("mouseover",Ei(Vd,null,d,i,v)).on("mouseout",Ei(zd,null,d,i,v)),n.ssr&&L.eachChild(function(P){var R=nt(P);R.seriesIndex=w.seriesIndex,R.dataIndex=p,R.ssrType="legend"}),f.set(d,!0)}},this)},this),o&&this._createSelector(o,a,i,s,l)},e.prototype._createSelector=function(t,a,n,i,o){var s=this.getSelectorGroup();Bd(t,function(u){var f=u.type,h=new bt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:f==="all"?"legendAllSelect":"legendInverseSelect",legendId:a.id})}});s.add(h);var v=a.getModel("selectorLabel"),c=a.getModel(["emphasis","selectorLabel"]);ve(h,{normal:v,emphasis:c},{defaultText:u.title}),$n(h)})},e.prototype._createItem=function(t,a,n,i,o,s,l,u,f,h,v){var c=t.visualDrawType,p=o.get("itemWidth"),d=o.get("itemHeight"),g=o.isSelected(a),y=i.get("symbolRotate"),m=i.get("symbolKeepAspect"),_=i.get("icon");f=_||f||"roundRect";var S=jU(f,i,l,u,c,g,v),b=new Cu,x=i.getModel("textStyle");if(J(t.getLegendIcon)&&(!_||_==="inherit"))b.add(t.getLegendIcon({itemWidth:p,itemHeight:d,icon:f,iconRotate:y,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:m}));else{var w=_==="inherit"&&t.getData().getVisual("symbol")?y==="inherit"?t.getData().getVisual("symbolRotate"):y:0;b.add(t8({itemWidth:p,itemHeight:d,icon:f,iconRotate:w,itemStyle:S.itemStyle,symbolKeepAspect:m}))}var T=s==="left"?p+5:-5,A=s,C=o.get("formatter"),M=a;Y(C)&&C?M=C.replace("{name}",a??""):J(C)&&(M=C(a));var I=g?x.getTextColor():i.get("inactiveColor");b.add(new bt({style:Bt(x,{text:M,x:T,y:d/2,fill:I,align:A,verticalAlign:"middle"},{inheritColor:I})}));var L=new St({shape:b.getBoundingRect(),style:{fill:"transparent"}}),P=i.getModel("tooltip");return P.get("show")&&li({el:L,componentModel:o,itemName:a,itemTooltipOption:P.option}),b.add(L),b.eachChild(function(R){R.silent=!0}),L.silent=!h,this.getContentGroup().add(b),$n(b),b.__legendDataIndex=n,b},e.prototype.layoutInner=function(t,a,n,i,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Kn(t.get("orient"),l,t.get("itemGap"),n.width,n.height);var f=l.getBoundingRect(),h=[-f.x,-f.y];if(u.markRedraw(),l.markRedraw(),o){Kn("horizontal",u,t.get("selectorItemGap",!0));var v=u.getBoundingRect(),c=[-v.x,-v.y],p=t.get("selectorButtonGap",!0),d=t.getOrient().index,g=d===0?"width":"height",y=d===0?"height":"width",m=d===0?"y":"x";s==="end"?c[d]+=f[g]+p:h[d]+=v[g]+p,c[1-d]+=f[y]/2-v[y]/2,u.x=c[0],u.y=c[1],l.x=h[0],l.y=h[1];var _={x:0,y:0};return _[g]=f[g]+p+v[g],_[y]=Math.max(f[y],v[y]),_[m]=Math.min(0,v[m]+c[1-d]),_}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(Ft);function jU(r,e,t,a,n,i,o){function s(g,y){g.lineWidth==="auto"&&(g.lineWidth=y.lineWidth>0?2:0),Bd(g,function(m,_){g[_]==="inherit"&&(g[_]=y[_])})}var l=e.getModel("itemStyle"),u=l.getItemStyle(),f=r.lastIndexOf("empty",0)===0?"fill":"stroke",h=l.getShallow("decal");u.decal=!h||h==="inherit"?a.decal:eo(h,o),u.fill==="inherit"&&(u.fill=a[n]),u.stroke==="inherit"&&(u.stroke=a[f]),u.opacity==="inherit"&&(u.opacity=(n==="fill"?a:t).opacity),s(u,a);var v=e.getModel("lineStyle"),c=v.getLineStyle();if(s(c,t),u.fill==="auto"&&(u.fill=a.fill),u.stroke==="auto"&&(u.stroke=a.fill),c.stroke==="auto"&&(c.stroke=a.fill),!i){var p=e.get("inactiveBorderWidth"),d=u[f];u.lineWidth=p==="auto"?a.lineWidth>0&&d?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),c.stroke=v.get("inactiveColor"),c.lineWidth=v.get("inactiveWidth")}return{itemStyle:u,lineStyle:c}}function t8(r){var e=r.icon||"roundRect",t=qt(e,0,0,r.itemWidth,r.itemHeight,r.itemStyle.fill,r.symbolKeepAspect);return t.setStyle(r.itemStyle),t.rotation=(r.iconRotate||0)*Math.PI/180,t.setOrigin([r.itemWidth/2,r.itemHeight/2]),e.indexOf("empty")>-1&&(t.style.stroke=t.style.fill,t.style.fill="#fff",t.style.lineWidth=2),t}function gb(r,e,t,a){zd(r,e,t,a),t.dispatchAction({type:"legendToggleSelect",name:r??e}),Vd(r,e,t,a)}function mI(r){for(var e=r.getZr().storage.getDisplayList(),t,a=0,n=e.length;an[o],g=[-c.x,-c.y];a||(g[i]=f[u]);var y=[0,0],m=[-p.x,-p.y],_=st(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(d){var S=t.get("pageButtonPosition",!0);S==="end"?m[i]+=n[o]-p[o]:y[i]+=p[o]+_}m[1-i]+=c[s]/2-p[s]/2,f.setPosition(g),h.setPosition(y),v.setPosition(m);var b={x:0,y:0};if(b[o]=d?n[o]:c[o],b[s]=Math.max(c[s],p[s]),b[l]=Math.min(0,p[l]+m[1-i]),h.__rectSize=n[o],d){var x={x:0,y:0};x[o]=Math.max(n[o]-p[o]-_,0),x[s]=b[s],h.setClipPath(new St({shape:x})),h.__rectSize=x[o]}else v.eachChild(function(T){T.attr({invisible:!0,silent:!0})});var w=this._getPageInfo(t);return w.pageIndex!=null&&Tt(f,{x:w.contentPosition[0],y:w.contentPosition[1]},d?t:null),this._updatePageInfoView(t,w),b},e.prototype._pageGo=function(t,a,n){var i=this._getPageInfo(a)[t];i!=null&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:a.id})},e.prototype._updatePageInfoView=function(t,a){var n=this._controllerGroup;D(["pagePrev","pageNext"],function(f){var h=f+"DataIndex",v=a[h]!=null,c=n.childOfName(f);c&&(c.setStyle("fill",v?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),c.cursor=v?"pointer":"default")});var i=n.childOfName("pageText"),o=t.get("pageFormatter"),s=a.pageIndex,l=s!=null?s+1:0,u=a.pageCount;i&&o&&i.setStyle("text",Y(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},e.prototype._getPageInfo=function(t){var a=t.get("scrollDataIndex",!0),n=this.getContentGroup(),i=this._containerGroup.__rectSize,o=t.getOrient().index,s=Yc[o],l=Xc[o],u=this._findTargetItemIndex(a),f=n.children(),h=f[u],v=f.length,c=v?1:0,p={contentPosition:[n.x,n.y],pageCount:c,pageIndex:c-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return p;var d=S(h);p.contentPosition[o]=-d.s;for(var g=u+1,y=d,m=d,_=null;g<=v;++g)_=S(f[g]),(!_&&m.e>y.s+i||_&&!b(_,y.s))&&(m.i>y.i?y=m:y=_,y&&(p.pageNextDataIndex==null&&(p.pageNextDataIndex=y.i),++p.pageCount)),m=_;for(var g=u-1,y=d,m=d,_=null;g>=-1;--g)_=S(f[g]),(!_||!b(m,_.s))&&y.i=w&&x.s<=w+i}},e.prototype._findTargetItemIndex=function(t){if(!this._showController)return 0;var a,n=this.getContentGroup(),i;return n.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===t&&(a=s)}),a??i},e.type="legend.scroll",e}(yI);function i8(r){r.registerAction("legendScroll","legendscroll",function(e,t){var a=e.scrollDataIndex;a!=null&&t.eachComponent({mainType:"legend",subType:"scroll",query:e},function(n){n.setScrollDataIndex(a)})})}function o8(r){dt(_I),r.registerComponentModel(a8),r.registerComponentView(n8),i8(r)}function s8(r){dt(_I),dt(o8)}var l8=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.inside",e.defaultOption=ja(tl.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e}(tl),$y=xt();function u8(r,e,t){$y(r).coordSysRecordMap.each(function(a){var n=a.dataZoomInfoMap.get(e.uid);n&&(n.getRange=t)})}function f8(r,e){for(var t=$y(r).coordSysRecordMap,a=t.keys(),n=0;na[t+e]&&(e=s),n=n&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!n}}}function d8(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var a=$y(t),n=a.coordSysRecordMap||(a.coordSysRecordMap=$());n.each(function(i){i.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=rI(i);D(o.infoList,function(s){var l=s.model.uid,u=n.get(l)||n.set(l,h8(t,s.model)),f=u.dataZoomInfoMap||(u.dataZoomInfoMap=$());f.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),n.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){SI(n,i);return}var f=p8(l);o.enable(f.controlType,f.opt),o.setPointerChecker(i.containsPoint),xo(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var g8=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return e.prototype.render=function(t,a,n){if(r.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),u8(n,t,{pan:X(Zc.pan,this),zoom:X(Zc.zoom,this),scrollMove:X(Zc.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){f8(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e}(zy),Zc={zoom:function(r,e,t,a){var n=this.range,i=n.slice(),o=r.axisModels[0];if(o){var s=$c[e](null,[a.originX,a.originY],o,t,r),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(i[1]-i[0])+i[0],u=Math.max(1/a.scale,0);i[0]=(i[0]-l)*u+l,i[1]=(i[1]-l)*u+l;var f=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(pi(0,i,[0,100],0,f.minSpan,f.maxSpan),this.range=i,n[0]!==i[0]||n[1]!==i[1])return i}},pan:Sb(function(r,e,t,a,n,i){var o=$c[a]([i.oldX,i.oldY],[i.newX,i.newY],e,n,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:Sb(function(r,e,t,a,n,i){var o=$c[a]([0,0],[i.scrollDelta,i.scrollDelta],e,n,t);return o.signal*(r[1]-r[0])*i.scrollDelta})};function Sb(r){return function(e,t,a,n){var i=this.range,o=i.slice(),s=e.axisModels[0];if(s){var l=r(o,s,e,t,a,n);if(pi(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var $c={grid:function(r,e,t,a,n){var i=t.axis,o={},s=n.model.coordinateSystem.getRect();return r=r||[0,0],i.dim==="x"?(o.pixel=e[0]-r[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(r,e,t,a,n){var i=t.axis,o={},s=n.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return r=r?s.pointToCoord(r):[0,0],e=s.pointToCoord(e),t.mainType==="radiusAxis"?(o.pixel=e[0]-r[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=i.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=i.inverse?-1:1),o},singleAxis:function(r,e,t,a,n){var i=t.axis,o=n.model.coordinateSystem.getRect(),s={};return r=r||[0,0],i.orient==="horizontal"?(s.pixel=e[0]-r[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=e[1]-r[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function xI(r){Gy(r),r.registerComponentModel(l8),r.registerComponentView(g8),d8(r)}var y8=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=ja(tl.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),e}(tl),Qo=St,xb=7,m8=1,qc=30,_8=7,jo="horizontal",bb="vertical",S8=5,x8=["line","bar","candlestick","scatter"],b8={easing:"cubicOut",duration:100,delay:0},w8=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._displayables={},t}return e.prototype.init=function(t,a){this.api=a,this._onBrush=X(this._onBrush,this),this._onBrushEnd=X(this._onBrushEnd,this)},e.prototype.render=function(t,a,n,i){if(r.prototype.render.apply(this,arguments),xo(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),t.get("show")===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!=="dataZoom"||i.from!==this.uid)&&this._buildView(),this._updateView()},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Fs(this,"_dispatchZoomAction");var t=this.api.getZr();t.off("mousemove",this._onBrush),t.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var t=this.group;t.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var a=this._displayables.sliderGroup=new at;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(a),this._positionGroup()},e.prototype._resetLocation=function(){var t=this.dataZoomModel,a=this.api,n=t.get("brushSelect"),i=n?_8:0,o=this._findCoordRect(),s={width:a.getWidth(),height:a.getHeight()},l=this._orient===jo?{right:s.width-o.x-o.width,top:s.height-qc-xb-i,width:o.width,height:qc}:{right:xb,top:o.y,width:qc,height:o.height},u=mo(t.option);D(["right","top","width","height"],function(h){u[h]==="ph"&&(u[h]=l[h])});var f=Qt(u,s);this._location={x:f.x,y:f.y},this._size=[f.width,f.height],this._orient===bb&&this._size.reverse()},e.prototype._positionGroup=function(){var t=this.group,a=this._location,n=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),o=i&&i.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(n===jo&&!o?{scaleY:l?1:-1,scaleX:1}:n===jo&&o?{scaleY:l?1:-1,scaleX:-1}:n===bb&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=t.getBoundingRect([s]);t.x=a.x-u.x,t.y=a.y-u.y,t.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var t=this.dataZoomModel,a=this._size,n=this._displayables.sliderGroup,i=t.get("brushSelect");n.add(new Qo({silent:!0,shape:{x:0,y:0,width:a[0],height:a[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var o=new Qo({shape:{x:0,y:0,width:a[0],height:a[1]},style:{fill:"transparent"},z2:0,onclick:X(this._onClickPanel,this)}),s=this.api.getZr();i?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),n.add(o)},e.prototype._renderDataShadow=function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!t)return;var a=this._size,n=this._shadowSize||[],i=t.series,o=i.getRawData(),s=i.getShadowDim&&i.getShadowDim(),l=s&&o.getDimensionInfo(s)?i.getShadowDim():t.otherDim;if(l==null)return;var u=this._shadowPolygonPts,f=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||a[0]!==n[0]||a[1]!==n[1]){var h=o.getDataExtent(l),v=(h[1]-h[0])*.3;h=[h[0]-v,h[1]+v];var c=[0,a[1]],p=[0,a[0]],d=[[a[0],0],[0,0]],g=[],y=p[1]/(o.count()-1),m=0,_=Math.round(o.count()/a[0]),S;o.each([l],function(A,C){if(_>0&&C%_){m+=y;return}var M=A==null||isNaN(A)||A==="",I=M?0:Dt(A,h,c,!0);M&&!S&&C?(d.push([d[d.length-1][0],0]),g.push([g[g.length-1][0],0])):!M&&S&&(d.push([m,0]),g.push([m,0])),d.push([m,I]),g.push([m,I]),m+=y,S=M}),u=this._shadowPolygonPts=d,f=this._shadowPolylinePts=g}this._shadowData=o,this._shadowDim=l,this._shadowSize=[a[0],a[1]];var b=this.dataZoomModel;function x(A){var C=b.getModel(A?"selectedDataBackground":"dataBackground"),M=new at,I=new Ie({shape:{points:u},segmentIgnoreThreshold:1,style:C.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),L=new Le({shape:{points:f},segmentIgnoreThreshold:1,style:C.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return M.add(I),M.add(L),M}for(var w=0;w<3;w++){var T=x(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},e.prototype._prepareDataShadowInfo=function(){var t=this.dataZoomModel,a=t.get("showDataShadow");if(a!==!1){var n,i=this.ecModel;return t.eachTargetAxis(function(o,s){var l=t.getAxisProxy(o,s).getTargetSeriesModels();D(l,function(u){if(!n&&!(a!==!0&&ct(x8,u.get("type"))<0)){var f=i.getComponent(za(o),s).axis,h=T8(o),v,c=u.coordinateSystem;h!=null&&c.getOtherAxis&&(v=c.getOtherAxis(f).inverse),h=u.getData().mapDimension(h),n={thisAxis:f,series:u,thisDim:o,otherDim:h,otherAxisInverse:v}}},this)},this),n}},e.prototype._renderHandle=function(){var t=this.group,a=this._displayables,n=a.handles=[null,null],i=a.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,f=l.get("borderRadius")||0,h=l.get("brushSelect"),v=a.filler=new Qo({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(v),o.add(new Qo({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:f},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:m8,fill:"rgba(0,0,0,0)"}})),D([0,1],function(_){var S=l.get("handleIcon");!pf[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var b=qt(S,-1,0,2,2,null,!0);b.attr({cursor:wb(this._orient),draggable:!0,drift:X(this._onDragMove,this,_),ondragend:X(this._onDragEnd,this),onmouseover:X(this._showDataInfo,this,!0),onmouseout:X(this._showDataInfo,this,!1),z2:5});var x=b.getBoundingRect(),w=l.get("handleSize");this._handleHeight=W(w,this._size[1]),this._handleWidth=x.width/x.height*this._handleHeight,b.setStyle(l.getModel("handleStyle").getItemStyle()),b.style.strokeNoScale=!0,b.rectHover=!0,b.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),$n(b);var T=l.get("handleColor");T!=null&&(b.style.fill=T),o.add(n[_]=b);var A=l.getModel("textStyle"),C=l.get("handleLabel")||{},M=C.show||!1;t.add(i[_]=new bt({silent:!0,invisible:!M,style:Bt(A,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:A.getTextColor(),font:A.getFont()}),z2:10}))},this);var c=v;if(h){var p=W(l.get("moveHandleSize"),s[1]),d=a.moveHandle=new St({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:p}}),g=p*.8,y=a.moveHandleIcon=qt(l.get("moveHandleIcon"),-g/2,-g/2,g,g,"#fff",!0);y.silent=!0,y.y=s[1]+p/2-.5,d.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var m=Math.min(s[1]/2,Math.max(p,10));c=a.moveZone=new St({invisible:!0,shape:{y:s[1]-m,height:p+m}}),c.on("mouseover",function(){u.enterEmphasis(d)}).on("mouseout",function(){u.leaveEmphasis(d)}),o.add(d),o.add(y),o.add(c)}c.attr({draggable:!0,cursor:wb(this._orient),drift:X(this._onDragMove,this,"all"),ondragstart:X(this._showDataInfo,this,!0),ondragend:X(this._onDragEnd,this),onmouseover:X(this._showDataInfo,this,!0),onmouseout:X(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var t=this._range=this.dataZoomModel.getPercentRange(),a=this._getViewExtent();this._handleEnds=[Dt(t[0],[0,100],a,!0),Dt(t[1],[0,100],a,!0)]},e.prototype._updateInterval=function(t,a){var n=this.dataZoomModel,i=this._handleEnds,o=this._getViewExtent(),s=n.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];pi(a,i,o,n.get("zoomLock")?"all":t,s.minSpan!=null?Dt(s.minSpan,l,o,!0):null,s.maxSpan!=null?Dt(s.maxSpan,l,o,!0):null);var u=this._range,f=this._range=ar([Dt(i[0],o,l,!0),Dt(i[1],o,l,!0)]);return!u||u[0]!==f[0]||u[1]!==f[1]},e.prototype._updateView=function(t){var a=this._displayables,n=this._handleEnds,i=ar(n.slice()),o=this._size;D([0,1],function(c){var p=a.handles[c],d=this._handleHeight;p.attr({scaleX:d/2,scaleY:d/2,x:n[c]+(c?-1:1),y:o[1]/2-d/2})},this),a.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:o[1]});var s={x:i[0],width:i[1]-i[0]};a.moveHandle&&(a.moveHandle.setShape(s),a.moveZone.setShape(s),a.moveZone.getBoundingRect(),a.moveHandleIcon&&a.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=a.dataShadowSegs,u=[0,i[0],i[1],o[0]],f=0;fa[0]||n[1]<0||n[1]>a[1])){var i=this._handleEnds,o=(i[0]+i[1])/2,s=this._updateInterval("all",n[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(t){var a=t.offsetX,n=t.offsetY;this._brushStart=new ft(a,n),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(t){if(this._brushing){var a=this._displayables.brushRect;if(this._brushing=!1,!!a){a.attr("ignore",!0);var n=a.shape,i=+new Date;if(!(i-this._brushStartTime<200&&Math.abs(n.width)<5)){var o=this._getViewExtent(),s=[0,100];this._range=ar([Dt(n.x,o,s,!0),Dt(n.x+n.width,o,s,!0)]),this._handleEnds=[n.x,n.x+n.width],this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(t){this._brushing&&(oa(t.event),this._updateBrushRect(t.offsetX,t.offsetY))},e.prototype._updateBrushRect=function(t,a){var n=this._displayables,i=this.dataZoomModel,o=n.brushRect;o||(o=n.brushRect=new Qo({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),n.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(t,a),f=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:f[0],y:0,width:u[0]-f[0],height:h[1]})},e.prototype._dispatchZoomAction=function(t){var a=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?b8:null,start:a[0],end:a[1]})},e.prototype._findCoordRect=function(){var t,a=rI(this.dataZoomModel).infoList;if(!t&&a.length){var n=a[0].model.coordinateSystem;t=n.getRect&&n.getRect()}if(!t){var i=this.api.getWidth(),o=this.api.getHeight();t={x:i*.2,y:o*.2,width:i*.6,height:o*.6}}return t},e.type="dataZoom.slider",e}(zy);function T8(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function wb(r){return r==="vertical"?"ns-resize":"ew-resize"}function bI(r){r.registerComponentModel(y8),r.registerComponentView(w8),Gy(r)}function A8(r){dt(xI),dt(bI)}var wI={get:function(r,e,t){var a=rt((C8[r]||{})[e]);return t&&z(a)?a[a.length-1]:a}},C8={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},Tb=ae.mapVisual,D8=ae.eachVisual,M8=z,Ab=D,I8=ar,L8=Dt,Vf=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.stateList=["inRange","outOfRange"],t.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],t.layoutMode={type:"box",ignoreSize:!0},t.dataBound=[-1/0,1/0],t.targetVisuals={},t.controllerVisuals={},t}return e.prototype.init=function(t,a,n){this.mergeDefaultAndTheme(t,n)},e.prototype.optionUpdated=function(t,a){var n=this.option;!a&&vI(n,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(t){var a=this.stateList;t=X(t,this),this.controllerVisuals=Ed(this.option.controller,a,t),this.targetVisuals=Ed(this.option.target,a,t)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var t=this.option.seriesIndex,a=[];return t==null||t==="all"?this.ecModel.eachSeries(function(n,i){a.push(i)}):a=Pt(t),a},e.prototype.eachTargetSeries=function(t,a){D(this.getTargetSeriesIndices(),function(n){var i=this.ecModel.getSeriesByIndex(n);i&&t.call(a,i)},this)},e.prototype.isTargetSeries=function(t){var a=!1;return this.eachTargetSeries(function(n){n===t&&(a=!0)}),a},e.prototype.formatValueText=function(t,a,n){var i=this.option,o=i.precision,s=this.dataBound,l=i.formatter,u;n=n||["<",">"],z(t)&&(t=t.slice(),u=!0);var f=a?t:u?[h(t[0]),h(t[1])]:h(t);if(Y(l))return l.replace("{value}",u?f[0]:f).replace("{value2}",u?f[1]:f);if(J(l))return u?l(t[0],t[1]):l(t);if(u)return t[0]===s[0]?n[0]+" "+f[1]:t[1]===s[1]?n[1]+" "+f[0]:f[0]+" - "+f[1];return f;function h(v){return v===s[0]?"min":v===s[1]?"max":(+v).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,a=I8([t.min,t.max]);this._dataExtent=a},e.prototype.getDataDimensionIndex=function(t){var a=this.option.dimension;if(a!=null)return t.getDimensionIndex(a);for(var n=t.dimensions,i=n.length-1;i>=0;i--){var o=n[i],s=t.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var t=this.ecModel,a=this.option,n={inRange:a.inRange,outOfRange:a.outOfRange},i=a.target||(a.target={}),o=a.controller||(a.controller={});ut(i,n),ut(o,n);var s=this.isCategory();l.call(this,i),l.call(this,o),u.call(this,i,"inRange","outOfRange"),f.call(this,o);function l(h){M8(a.color)&&!h.inRange&&(h.inRange={color:a.color.slice().reverse()}),h.inRange=h.inRange||{color:t.get("gradientColor")}}function u(h,v,c){var p=h[v],d=h[c];p&&!d&&(d=h[c]={},Ab(p,function(g,y){if(ae.isValidType(y)){var m=wI.get(y,"inactive",s);m!=null&&(d[y]=m,y==="color"&&!d.hasOwnProperty("opacity")&&!d.hasOwnProperty("colorAlpha")&&(d.opacity=[0,0]))}}))}function f(h){var v=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,c=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,p=this.get("inactiveColor"),d=this.getItemSymbol(),g=d||"roundRect";Ab(this.stateList,function(y){var m=this.itemSize,_=h[y];_||(_=h[y]={color:s?p:[p]}),_.symbol==null&&(_.symbol=v&&rt(v)||(s?g:[g])),_.symbolSize==null&&(_.symbolSize=c&&rt(c)||(s?m[0]:[m[0],m[0]])),_.symbol=Tb(_.symbol,function(x){return x==="none"?g:x});var S=_.symbolSize;if(S!=null){var b=-1/0;D8(S,function(x){x>b&&(b=x)}),_.symbolSize=Tb(S,function(x){return L8(x,[0,b],[0,m[0]],!0)})}},this)}},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(t){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(t){return null},e.prototype.getVisualMeta=function(t){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},e}(mt),Cb=[20,140],P8=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(t,a){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(n){n.mappingMethod="linear",n.dataExtent=this.getExtent()}),this._resetRange()},e.prototype.resetItemSize=function(){r.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=Cb[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=Cb[1])},e.prototype._resetRange=function(){var t=this.getExtent(),a=this.option.range;!a||a.auto?(t.auto=1,this.option.range=t):z(a)&&(a[0]>a[1]&&a.reverse(),a[0]=Math.max(a[0],t[0]),a[1]=Math.min(a[1],t[1]))},e.prototype.completeVisualOption=function(){r.prototype.completeVisualOption.apply(this,arguments),D(this.stateList,function(t){var a=this.option.controller[t].symbolSize;a&&a[0]!==a[1]&&(a[0]=a[1]/3)},this)},e.prototype.setSelected=function(t){this.option.range=t.slice(),this._resetRange()},e.prototype.getSelected=function(){var t=this.getExtent(),a=ar((this.get("range")||[]).slice());return a[0]>t[1]&&(a[0]=t[1]),a[1]>t[1]&&(a[1]=t[1]),a[0]=n[1]||t<=a[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var a=[];return this.eachTargetSeries(function(n){var i=[],o=n.getData();o.each(this.getDataDimensionIndex(o),function(s,l){t[0]<=s&&s<=t[1]&&i.push(l)},this),a.push({seriesId:n.id,dataIndex:i})},this),a},e.prototype.getVisualMeta=function(t){var a=Db(this,"outOfRange",this.getExtent()),n=Db(this,"inRange",this.option.range.slice()),i=[];function o(c,p){i.push({value:c,color:t(c,p)})}for(var s=0,l=0,u=n.length,f=a.length;lt[1])break;i.push({color:this.getControllerVisual(l,"color",a),offset:s/n})}return i.push({color:this.getControllerVisual(t[1],"color",a),offset:1}),i},e.prototype._createBarPoints=function(t,a){var n=this.visualMapModel.itemSize;return[[n[0]-a[0],t[0]],[n[0],t[0]],[n[0],t[1]],[n[0]-a[1],t[1]]]},e.prototype._createBarGroup=function(t){var a=this._orient,n=this.visualMapModel.get("inverse");return new at(a==="horizontal"&&!n?{scaleX:t==="bottom"?1:-1,rotation:Math.PI/2}:a==="horizontal"&&n?{scaleX:t==="bottom"?-1:1,rotation:-Math.PI/2}:a==="vertical"&&!n?{scaleX:t==="left"?1:-1,scaleY:-1}:{scaleX:t==="left"?1:-1})},e.prototype._updateHandle=function(t,a){if(this._useHandle){var n=this._shapes,i=this.visualMapModel,o=n.handleThumbs,s=n.handleLabels,l=i.itemSize,u=i.getExtent(),f=this._applyTransform("left",n.mainGroup);R8([0,1],function(h){var v=o[h];v.setStyle("fill",a.handlesColor[h]),v.y=t[h];var c=Ir(t[h],[0,l[1]],u,!0),p=this.getControllerVisual(c,"symbolSize");v.scaleX=v.scaleY=p/l[0],v.x=l[0]-p/2;var d=mr(n.handleLabelPoints[h],qn(v,this.group));if(this._orient==="horizontal"){var g=f==="left"||f==="top"?(l[0]-p)/2:(l[0]-p)/-2;d[1]+=g}s[h].setStyle({x:d[0],y:d[1],text:i.formatValueText(this._dataInterval[h]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",n.mainGroup):"center"})},this)}},e.prototype._showIndicator=function(t,a,n,i){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],f=this._shapes,h=f.indicator;if(h){h.attr("invisible",!1);var v={convertOpacityToAlpha:!0},c=this.getControllerVisual(t,"color",v),p=this.getControllerVisual(t,"symbolSize"),d=Ir(t,s,u,!0),g=l[0]-p/2,y={x:h.x,y:h.y};h.y=d,h.x=g;var m=mr(f.indicatorLabelPoint,qn(h,this.group)),_=f.indicatorLabel;_.attr("invisible",!1);var S=this._applyTransform("left",f.mainGroup),b=this._orient,x=b==="horizontal";_.setStyle({text:(n||"")+o.formatValueText(a),verticalAlign:x?S:"middle",align:x?"center":S});var w={x:g,y:d,style:{fill:c}},T={style:{x:m[0],y:m[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var A={duration:100,easing:"cubicInOut",additive:!0};h.x=y.x,h.y=y.y,h.animateTo(w,A),_.animateTo(T,A)}else h.attr(w),_.attr(T);this._firstShowIndicator=!1;var C=this._shapes.handleLabels;if(C)for(var M=0;Mo[1]&&(h[1]=1/0),a&&(h[0]===-1/0?this._showIndicator(f,h[1],"< ",l):h[1]===1/0?this._showIndicator(f,h[0],"> ",l):this._showIndicator(f,f,"≈ ",l));var v=this._hoverLinkDataIndices,c=[];(a||Pb(n))&&(c=this._hoverLinkDataIndices=n.findTargetDataIndices(h));var p=H2(v,c);this._dispatchHighDown("downplay",$u(p[0],n)),this._dispatchHighDown("highlight",$u(p[1],n))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var a;if(Gn(t.target,function(l){var u=nt(l);if(u.dataIndex!=null)return a=u,!0},!0),!!a){var n=this.ecModel.getSeriesByIndex(a.seriesIndex),i=this.visualMapModel;if(i.isTargetSeries(n)){var o=n.getData(a.dataType),s=o.getStore().get(i.getDataDimensionIndex(o),a.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},e.prototype._hideIndicator=function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0);var a=this._shapes.handleLabels;if(a)for(var n=0;n=0&&(i.dimension=o,a.push(i))}}),r.getData().setVisual("visualMeta",a)}}];function G8(r,e,t,a){for(var n=e.targetVisuals[a],i=ae.prepareVisualTypes(n),o={color:cl(r.getData(),"color")},s=0,l=i.length;s0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(B8,V8),D(z8,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor(F8))}function DI(r){r.registerComponentModel(P8),r.registerComponentView(O8),CI(r)}var H8=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._pieceList=[],t}return e.prototype.optionUpdated=function(t,a){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var n=this._mode=this._determineMode();this._pieceList=[],W8[this._mode].call(this,this._pieceList),this._resetSelected(t,a);var i=this.option.categories;this.resetVisual(function(o,s){n==="categories"?(o.mappingMethod="category",o.categories=rt(i)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=G(this._pieceList,function(l){return l=rt(l),s!=="inRange"&&(l.visual=null),l}))})},e.prototype.completeVisualOption=function(){var t=this.option,a={},n=ae.listVisualTypes(),i=this.isCategory();D(t.pieces,function(s){D(n,function(l){s.hasOwnProperty(l)&&(a[l]=1)})}),D(a,function(s,l){var u=!1;D(this.stateList,function(f){u=u||o(t,f,l)||o(t.target,f,l)},this),!u&&D(this.stateList,function(f){(t[f]||(t[f]={}))[l]=wI.get(l,f==="inRange"?"active":"inactive",i)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}r.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(t,a){var n=this.option,i=this._pieceList,o=(a?n:t).selected||{};if(n.selected=o,D(i,function(l,u){var f=this.getSelectedMapKey(l);o.hasOwnProperty(f)||(o[f]=!0)},this),n.selectedMode==="single"){var s=!1;D(i,function(l,u){var f=this.getSelectedMapKey(l);o[f]&&(s?o[f]=!1:s=!0)},this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(t){return this._mode==="categories"?t.value+"":t.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(t){this.option.selected=rt(t)},e.prototype.getValueState=function(t){var a=ae.findPieceIndex(t,this._pieceList);return a!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[a])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var a=[],n=this._pieceList;return this.eachTargetSeries(function(i){var o=[],s=i.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var f=ae.findPieceIndex(l,n);f===t&&o.push(u)},this),a.push({seriesId:i.id,dataIndex:o})},this),a},e.prototype.getRepresentValue=function(t){var a;if(this.isCategory())a=t.value;else if(t.value!=null)a=t.value;else{var n=t.interval||[];a=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return a},e.prototype.getVisualMeta=function(t){if(this.isCategory())return;var a=[],n=["",""],i=this;function o(f,h){var v=i.getRepresentValue({interval:f});h||(h=i.getValueState(v));var c=t(v,h);f[0]===-1/0?n[0]=c:f[1]===1/0?n[1]=c:a.push({value:f[0],color:c},{value:f[1],color:c})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return D(s,function(f){var h=f.interval;h&&(h[0]>u&&o([u,h[0]],"outOfRange"),o(h.slice()),u=h[1])},this),{stops:a,outerColors:n}},e.type="visualMap.piecewise",e.defaultOption=ja(Vf.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),e}(Vf),W8={splitNumber:function(r){var e=this.option,t=Math.min(e.precision,20),a=this.getExtent(),n=e.splitNumber;n=Math.max(parseInt(n,10),1),e.splitNumber=n;for(var i=(a[1]-a[0])/n;+i.toFixed(t)!==i&&t<5;)t++;e.precision=t,i=+i.toFixed(t),e.minOpen&&r.push({interval:[-1/0,a[0]],close:[0,0]});for(var o=0,s=a[0];o","≥"][a[0]]];t.text=t.text||this.formatValueText(t.value!=null?t.value:t.interval,!1,n)},this)}};function Ob(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var U8=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.doRender=function(){var t=this.group;t.removeAll();var a=this.visualMapModel,n=a.get("textGap"),i=a.textStyleModel,o=i.getFont(),s=i.getTextColor(),l=this._getItemAlign(),u=a.itemSize,f=this._getViewData(),h=f.endsText,v=se(a.get("showLabel",!0),!h),c=!a.get("selectedMode");h&&this._renderEndsText(t,h[0],u,v,l),D(f.viewPieceList,function(p){var d=p.piece,g=new at;g.onclick=X(this._onItemClick,this,d),this._enableHoverLink(g,p.indexInModelPieceList);var y=a.getRepresentValue(d);if(this._createItemSymbol(g,y,[0,0,u[0],u[1]],c),v){var m=this.visualMapModel.getValueState(y);g.add(new bt({style:{x:l==="right"?-n:u[0]+n,y:u[1]/2,text:d.text,verticalAlign:"middle",align:l,font:o,fill:s,opacity:m==="outOfRange"?.5:1},silent:c}))}t.add(g)},this),h&&this._renderEndsText(t,h[1],u,v,l),Kn(a.get("orient"),t,a.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},e.prototype._enableHoverLink=function(t,a){var n=this;t.on("mouseover",function(){return i("highlight")}).on("mouseout",function(){return i("downplay")});var i=function(o){var s=n.visualMapModel;s.option.hoverLink&&n.api.dispatchAction({type:o,batch:$u(s.findTargetDataIndices(a),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,a=t.option;if(a.orient==="vertical")return AI(t,this.api,t.itemSize);var n=a.align;return(!n||n==="auto")&&(n="left"),n},e.prototype._renderEndsText=function(t,a,n,i,o){if(a){var s=new at,l=this.visualMapModel.textStyleModel;s.add(new bt({style:Bt(l,{x:i?o==="right"?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:"middle",align:i?o:"center",text:a})})),t.add(s)}},e.prototype._getViewData=function(){var t=this.visualMapModel,a=G(t.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),n=t.get("text"),i=t.get("orient"),o=t.get("inverse");return(i==="horizontal"?o:!o)?a.reverse():n&&(n=n.slice().reverse()),{viewPieceList:a,endsText:n}},e.prototype._createItemSymbol=function(t,a,n,i){var o=qt(this.getControllerVisual(a,"symbol"),n[0],n[1],n[2],n[3],this.getControllerVisual(a,"color"));o.silent=i,t.add(o)},e.prototype._onItemClick=function(t){var a=this.visualMapModel,n=a.option,i=n.selectedMode;if(i){var o=rt(n.selected),s=a.getSelectedMapKey(t);i==="single"||i===!0?(o[s]=!0,D(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},e.type="visualMap.piecewise",e}(TI);function MI(r){r.registerComponentModel(H8),r.registerComponentView(U8),CI(r)}function Y8(r){dt(DI),dt(MI)}var X8={label:{enabled:!0},decal:{show:!1}},Nb=xt(),Z8={};function $8(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var a=rt(X8);ut(a.label,r.getLocaleModel().get("aria"),!1),ut(t.option,a,!1),n(),i();function n(){var u=t.getModel("decal"),f=u.get("show");if(f){var h=$();r.eachSeries(function(v){if(!v.isColorBySeries()){var c=h.get(v.type);c||(c={},h.set(v.type,c)),Nb(v).scope=c}}),r.eachRawSeries(function(v){if(r.isSeriesFiltered(v))return;if(J(v.enableAriaDecal)){v.enableAriaDecal();return}var c=v.getData();if(v.isColorBySeries()){var m=zp(v.ecModel,v.name,Z8,r.getSeriesCount()),_=c.getVisual("decal");c.setVisual("decal",S(_,m))}else{var p=v.getRawData(),d={},g=Nb(v).scope;c.each(function(b){var x=c.getRawIndex(b);d[x]=b});var y=p.count();p.each(function(b){var x=d[b],w=p.getName(b)||b+"",T=zp(v.ecModel,w,g,y),A=c.getItemVisual(x,"decal");c.setItemVisual(x,"decal",S(A,T))})}function S(b,x){var w=b?V(V({},x),b):x;return w.dirty=!0,w}})}}function i(){var u=e.getZr().dom;if(u){var f=r.getLocaleModel().get("aria"),h=t.getModel("label");if(h.option=j(h.option,f),!!h.get("enabled")){if(u.setAttribute("role","img"),h.get("description")){u.setAttribute("aria-label",h.get("description"));return}var v=r.getSeriesCount(),c=h.get(["data","maxCount"])||10,p=h.get(["series","maxCount"])||10,d=Math.min(v,p),g;if(!(v<1)){var y=s();if(y){var m=h.get(["general","withTitle"]);g=o(m,{title:y})}else g=h.get(["general","withoutTitle"]);var _=[],S=v>1?h.get(["series","multiple","prefix"]):h.get(["series","single","prefix"]);g+=o(S,{seriesCount:v}),r.eachSeries(function(T,A){if(A1?h.get(["series","multiple",I]):h.get(["series","single",I]),C=o(C,{seriesId:T.seriesIndex,seriesName:T.get("name"),seriesType:l(T.subType)});var L=T.getData();if(L.count()>c){var P=h.get(["data","partialData"]);C+=o(P,{displayCnt:c})}else C+=h.get(["data","allData"]);for(var R=h.get(["data","separator","middle"]),E=h.get(["data","separator","end"]),N=h.get(["data","excludeDimensionId"]),O=[],B=0;B":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},J8=function(){function r(e){var t=this._condVal=Y(e)?new RegExp(e):iL(e)?e:null;if(t==null){var a="";At(a)}}return r.prototype.evaluate=function(e){var t=typeof e;return Y(t)?this._condVal.test(e):wt(t)?this._condVal.test(e+""):!1},r}(),Q8=function(){function r(){}return r.prototype.evaluate=function(){return this.value},r}(),j8=function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t2&&a.push(n),n=[L,P]}function f(L,P,R,E){Ui(L,R)&&Ui(P,E)||n.push(L,P,R,E,R,E)}function h(L,P,R,E,N,O){var B=Math.abs(P-L),F=Math.tan(B/4)*4/3,H=PT:M2&&a.push(n),a}function Fd(r,e,t,a,n,i,o,s,l,u){if(Ui(r,t)&&Ui(e,a)&&Ui(n,o)&&Ui(i,s)){l.push(o,s);return}var f=2/u,h=f*f,v=o-r,c=s-e,p=Math.sqrt(v*v+c*c);v/=p,c/=p;var d=t-r,g=a-e,y=n-o,m=i-s,_=d*d+g*g,S=y*y+m*m;if(_=0&&T=0){l.push(o,s);return}var A=[],C=[];Xa(r,t,n,o,.5,A),Xa(e,a,i,s,.5,C),Fd(A[0],C[0],A[1],C[1],A[2],C[2],A[3],C[3],l,u),Fd(A[4],C[4],A[5],C[5],A[6],C[6],A[7],C[7],l,u)}function cY(r,e){var t=Gd(r),a=[];e=e||1;for(var n=0;n0)for(var u=0;uMath.abs(u),h=LI([l,u],f?0:1,e),v=(f?s:u)/h.length,c=0;cn,o=LI([a,n],i?0:1,e),s=i?"width":"height",l=i?"height":"width",u=i?"x":"y",f=i?"y":"x",h=r[s]/o.length,v=0;v1?null:new ft(d*l+r,d*u+e)}function gY(r,e,t){var a=new ft;ft.sub(a,t,e),a.normalize();var n=new ft;ft.sub(n,r,e);var i=n.dot(a);return i}function Oi(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function yY(r,e,t){for(var a=r.length,n=[],i=0;io?(u.x=f.x=s+i/2,u.y=l,f.y=l+o):(u.y=f.y=l+o/2,u.x=s,f.x=s+i),yY(e,u,f)}function zf(r,e,t,a){if(t===1)a.push(e);else{var n=Math.floor(t/2),i=r(e);zf(r,i[0],n,a),zf(r,i[1],t-n,a)}return a}function mY(r,e){for(var t=[],a=0;a0;u/=2){var f=0,h=0;(r&u)>0&&(f=1),(e&u)>0&&(h=1),s+=u*u*(3*f^h),h===0&&(f===1&&(r=u-1-r,e=u-1-e),l=r,r=e,e=l)}return s}function Hf(r){var e=1/0,t=1/0,a=-1/0,n=-1/0,i=G(r,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),f=l.x+l.width/2+(u?u[4]:0),h=l.y+l.height/2+(u?u[5]:0);return e=Math.min(f,e),t=Math.min(h,t),a=Math.max(f,a),n=Math.max(h,n),[f,h]}),o=G(i,function(s,l){return{cp:s,z:DY(s[0],s[1],e,t,a,n),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function EI(r){return xY(r.path,r.count)}function Hd(){return{fromIndividuals:[],toIndividuals:[],count:0}}function MY(r,e,t){var a=[];function n(b){for(var x=0;x=0;n--)if(!t[n].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var i=l.length,u=Math.ceil(i/2);t[n].many=l.slice(u,i),t[s].many=l.slice(0,u),s++}return t}var LY={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),a=0;a0))return;var s=a.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,f;Yb(r)&&(u=r,f=e),Yb(e)&&(u=e,f=r);function h(y,m,_,S,b){var x=y.many,w=y.one;if(x.length===1&&!b){var T=m?x[0]:w,A=m?w:x[0];if(Gf(T))h({many:[T],one:A},!0,_,S,!0);else{var C=s?j({delay:s(_,S)},l):l;Ky(T,A,C),i(T,A,T,A,C)}}else for(var M=j({dividePath:LY[t],individualDelay:s&&function(N,O,B,F){return s(N+_,S)}},l),I=m?MY(x,w,M):IY(w,x,M),L=I.fromIndividuals,P=I.toIndividuals,R=L.length,E=0;Ee.length,c=u?Xb(f,u):Xb(v?e:r,[v?r:e]),p=0,d=0;dkI))for(var i=a.getIndices(),o=0;o0&&x.group.traverse(function(T){T instanceof gt&&!T.animators.length&&T.animateFrom({style:{opacity:0}},w)})})}function Jb(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function Qb(r){return z(r)?r.sort().join(","):r}function La(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function BY(r,e){var t=$(),a=$(),n=$();return D(r.oldSeries,function(i,o){var s=r.oldDataGroupIds[o],l=r.oldData[o],u=Jb(i),f=Qb(u);a.set(f,{dataGroupId:s,data:l}),z(u)&&D(u,function(h){n.set(h,{key:f,dataGroupId:s,data:l})})}),D(e.updatedSeries,function(i){if(i.isUniversalTransitionEnabled()&&i.isAnimationEnabled()){var o=i.get("dataGroupId"),s=i.getData(),l=Jb(i),u=Qb(l),f=a.get(u);if(f)t.set(u,{oldSeries:[{dataGroupId:f.dataGroupId,divide:La(f.data),data:f.data}],newSeries:[{dataGroupId:o,divide:La(s),data:s}]});else if(z(l)){var h=[];D(l,function(p){var d=a.get(p);d.data&&h.push({dataGroupId:d.dataGroupId,divide:La(d.data),data:d.data})}),h.length&&t.set(u,{oldSeries:h,newSeries:[{dataGroupId:o,data:s,divide:La(s)}]})}else{var v=n.get(l);if(v){var c=t.get(v.key);c||(c={oldSeries:[{dataGroupId:v.dataGroupId,data:v.data,divide:La(v.data)}],newSeries:[]},t.set(v.key,c)),c.newSeries.push({dataGroupId:o,data:s,divide:La(s)})}}}}),t}function jb(r,e){for(var t=0;t=0&&n.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:La(e.oldData[s]),groupIdDim:o.dimension})}),D(Pt(r.to),function(o){var s=jb(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();i.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:La(l),groupIdDim:o.dimension})}}),n.length>0&&i.length>0&&OI(n,i,a)}function zY(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,a){D(Pt(a.seriesTransition),function(n){D(Pt(n.to),function(i){for(var o=a.updatedSeries,s=0;s{o(),i=new ResizeObserver(()=>n&&n.resize()),i.observe(t.value)}),zI(()=>{i==null||i.disconnect(),n==null||n.dispose(),n=null}),Qy(()=>e.option,s=>{n&&n.setOption(s,!0)},{deep:!0}),Qy(()=>a.theme,()=>o()),(s,l)=>(FI(),GI("div",{ref_key:"el",ref:t,style:HI({height:r.height,width:"100%"})},null,4))}};export{FY as _}; diff --git a/view/admin-dist/assets/EmptyHint-2CB843hO.js b/view/admin-dist/assets/EmptyHint-2CB843hO.js new file mode 100644 index 0000000..e88ebff --- /dev/null +++ b/view/admin-dist/assets/EmptyHint-2CB843hO.js @@ -0,0 +1 @@ +import{g as o,b as m,o as n,c as p,w as a,x as l,y as d,k as x,D as y}from"./index-C0Houbmd.js";const _={class:"py-10 text-center"},g={__name:"EmptyHint",props:{text:{type:String,default:"暂无数据"},actionText:{type:String,default:""}},emits:["action"],setup(t,{emit:c}){const i=c;return(u,e)=>{const s=o("a-button"),r=o("a-empty");return n(),m("div",_,[p(r,{description:t.text},{default:a(()=>[t.actionText?(n(),l(s,{key:0,type:"primary",onClick:e[0]||(e[0]=f=>i("action"))},{default:a(()=>[x(y(t.actionText),1)]),_:1})):d("",!0)]),_:1},8,["description"])])}}};export{g as _}; diff --git a/view/admin-dist/assets/GlassCard-CqhSlns9.js b/view/admin-dist/assets/GlassCard-CqhSlns9.js new file mode 100644 index 0000000..76d3886 --- /dev/null +++ b/view/admin-dist/assets/GlassCard-CqhSlns9.js @@ -0,0 +1 @@ +import{b as s,o as a,y as n,a6 as l,d as o,D as r,n as i}from"./index-C0Houbmd.js";const c={key:0,class:"flex items-center justify-between mb-3"},d={class:"text-sm font-medium",style:{color:"var(--text-1)"}},m={class:"flex items-center gap-1"},u={__name:"GlassCard",props:{title:{type:String,default:""},pad:{type:String,default:"p-4"}},setup(e){return(t,p)=>(a(),s("div",{class:i(["glass",e.pad])},[e.title||t.$slots.extra?(a(),s("div",c,[o("span",d,r(e.title),1),o("span",m,[l(t.$slots,"extra")])])):n("",!0),l(t.$slots,"default")],2))}};export{u as _}; diff --git a/view/admin-dist/assets/HelpTip-C9tfcO7G.js b/view/admin-dist/assets/HelpTip-C9tfcO7G.js new file mode 100644 index 0000000..c3aa995 --- /dev/null +++ b/view/admin-dist/assets/HelpTip-C9tfcO7G.js @@ -0,0 +1 @@ +import{a as r,g as n,x as c,y as l,o as p}from"./index-C0Houbmd.js";const g={__name:"HelpTip",props:{id:{type:String,required:!0},text:{type:String,required:!0}},setup(e){const t=`agent_tip_closed_${e.id}`,o=r(localStorage.getItem(t)!=="1");function s(){o.value=!1,localStorage.setItem(t,"1")}return(m,u)=>{const a=n("a-alert");return o.value?(p(),c(a,{key:0,message:e.text,type:"info","show-icon":"",closable:"",class:"!mb-4",onClose:s},null,8,["message"])):l("",!0)}}};export{g as _}; diff --git a/view/admin-dist/assets/KvGrid-B8WhLf5u.js b/view/admin-dist/assets/KvGrid-B8WhLf5u.js new file mode 100644 index 0000000..cefa2a7 --- /dev/null +++ b/view/admin-dist/assets/KvGrid-B8WhLf5u.js @@ -0,0 +1 @@ +import{b as s,o as a,F as r,C as m,d as t,D as o,a6 as y,k as l,E as d,n as p}from"./index-C0Houbmd.js";const _={class:"grid grid-cols-2 gap-y-2 text-xs"},k={style:{color:"var(--text-3)"}},x={__name:"KvGrid",props:{items:{type:Array,default:()=>[]}},setup(n){return(c,u)=>(a(),s("div",_,[(a(!0),s(r,null,m(n.items,e=>(a(),s(r,{key:e.key||e.label},[t("span",k,o(e.label),1),t("span",{class:p(["text-right",{mono:e.mono!==!1}]),style:d({color:e.color||"var(--text-2)"})},[e.key?y(c.$slots,e.key,{key:0,item:e},()=>[l(o(e.value??"-"),1)]):(a(),s(r,{key:1},[l(o(e.value??"-"),1)],64))],6)],64))),128))]))}};export{x as _}; diff --git a/view/admin-dist/assets/PageHeader-BlIlnAwG.js b/view/admin-dist/assets/PageHeader-BlIlnAwG.js new file mode 100644 index 0000000..399d8a9 --- /dev/null +++ b/view/admin-dist/assets/PageHeader-BlIlnAwG.js @@ -0,0 +1 @@ +import{b as s,o as a,d as t,y as c,D as o,a6 as l}from"./index-C0Houbmd.js";const i={class:"flex items-start justify-between mb-4 gap-4 flex-wrap"},n={class:"text-lg font-semibold m-0",style:{color:"var(--text-1)"}},d={key:0,class:"text-xs mt-1 mb-0",style:{color:"var(--text-3)"}},m={class:"flex items-center gap-2"},u={__name:"PageHeader",props:{title:{type:String,required:!0},desc:{type:String,default:""}},setup(e){return(r,_)=>(a(),s("div",i,[t("div",null,[t("h2",n,o(e.title),1),e.desc?(a(),s("p",d,o(e.desc),1)):c("",!0)]),t("div",m,[l(r.$slots,"actions")])]))}};export{u as _}; diff --git a/view/admin-dist/assets/SafetyOutlined-CY7qTfTh.js b/view/admin-dist/assets/SafetyOutlined-CY7qTfTh.js new file mode 100644 index 0000000..76122cb --- /dev/null +++ b/view/admin-dist/assets/SafetyOutlined-CY7qTfTh.js @@ -0,0 +1 @@ +import{c,I as f}from"./index-C0Houbmd.js";var u={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64L128 192v384c0 212.1 171.9 384 384 384s384-171.9 384-384V192L512 64zm312 512c0 172.3-139.7 312-312 312S200 748.3 200 576V246l312-110 312 110v330z"}},{tag:"path",attrs:{d:"M378.4 475.1a35.91 35.91 0 00-50.9 0 35.91 35.91 0 000 50.9l129.4 129.4 2.1 2.1a33.98 33.98 0 0048.1 0L730.6 434a33.98 33.98 0 000-48.1l-2.8-2.8a33.98 33.98 0 00-48.1 0L483 579.7 378.4 475.1z"}}]},name:"safety",theme:"outlined"};function l(r){for(var t=1;t{const n=s("a-tag");return i(),l(n,{color:a[e.scene]||"default",style:k(e.clickable?"cursor:pointer":""),onClick:m(c,["stop"])},{default:u(()=>[p(d(g(f)(e.scene)),1)]),_:1},8,["color","style"])}}};export{x as _}; diff --git a/view/admin-dist/assets/StatCard--WvCkpAN.js b/view/admin-dist/assets/StatCard--WvCkpAN.js new file mode 100644 index 0000000..e47cf5c --- /dev/null +++ b/view/admin-dist/assets/StatCard--WvCkpAN.js @@ -0,0 +1 @@ +import{g as m,b as a,o as t,d as o,x as v,y as s,a6 as y,D as l,E as k,n as f}from"./index-C0Houbmd.js";const x={class:"text-xs mb-2",style:{color:"var(--text-3)"}},g={key:1,class:"flex items-baseline gap-1"},b={key:0,class:"text-xs",style:{color:"var(--text-3)"}},h={key:2,class:"text-xs mt-1",style:{color:"var(--text-3)"}},C={__name:"StatCard",props:{label:{type:String,required:!0},value:{type:[Number,String],default:"-"},unit:{type:String,default:""},precision:{type:Number,default:0},tone:{type:String,default:""},hint:{type:String,default:""},clickable:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["click"],setup(e,{emit:i}){const r=i,c={ok:"var(--ok)",err:"var(--err)",warn:"var(--warn)",run:"var(--run)"};return(d,n)=>{const u=m("a-skeleton");return t(),a("div",{class:f(["glass p-4 select-none",{"glass-hover":e.clickable}]),onClick:n[0]||(n[0]=S=>e.clickable&&r("click"))},[o("div",x,l(e.label),1),e.loading?(t(),v(u,{key:0,paragraph:!1,active:"",title:{width:80}})):(t(),a("div",g,[o("span",{class:"text-2xl font-semibold mono",style:k({color:c[e.tone]||"var(--text-1)"})},l(typeof e.value=="number"?e.value.toFixed(e.precision):e.value),5),e.unit?(t(),a("span",b,l(e.unit),1)):s("",!0)])),e.hint?(t(),a("div",h,l(e.hint),1)):s("",!0),y(d.$slots,"footer")],2)}}};export{C as _}; diff --git a/view/admin-dist/assets/index-9-ZULY9z.js b/view/admin-dist/assets/index-9-ZULY9z.js new file mode 100644 index 0000000..3962169 --- /dev/null +++ b/view/admin-dist/assets/index-9-ZULY9z.js @@ -0,0 +1 @@ +import{c as o,I as H,aa as T,m as U,a as K,r as M,p as $,P as R,O as G,b as _,d as i,x as w,g as y,w as f,F as L,y as S,D as b,j as v,z as J,i as Q,C as W,h as X,l as E,o as d,k as h,aq as Y}from"./index-C0Houbmd.js";import{d as Z,k as ee}from"./kb-DlfA6vCV.js";import{_ as te}from"./PageHeader-BlIlnAwG.js";import{_ as re}from"./HelpTip-C9tfcO7G.js";import{_ as C}from"./EmptyHint-2CB843hO.js";var ae={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"};function z(c){for(var a=1;am.id===e)?t.libraryId=e:u.value.length&&!t.libraryId&&(t.libraryId=u.value[0].id),a.query.q&&(t.query=String(a.query.q),t.libraryId&&k())}async function k(){if(!t.libraryId){E.warning("请先选择知识库");return}if(!t.query.trim()){E.warning("请输入检索词");return}l.loading=!0;const s=Date.now();try{const e=await ee({library_id:t.libraryId,query:t.query.trim(),top_k:t.topK});l.results=e.data||[],l.durationMs=Date.now()-s,l.searched=!0,n.replace({query:{...a.query,lib:t.libraryId,q:t.query.trim()}})}finally{l.loading=!1}}function j(s){const e=t.query.trim().split(/\s+/).filter(x=>x.length>=1);let m=s.replace(/&/g,"&").replace(//g,">");for(const x of e){const q=x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");m=m.replace(new RegExp(q,"gi"),g=>`${g}`)}return m}const A=$(()=>Math.max(...l.results.map(s=>s.score),1e-4));function B(s){p.setInject({query:t.query.trim(),content:s.content}),n.push("/debug")}const P=$(()=>l.results.some(s=>s.source_type==="fulltext-natural"));return R(N),G(()=>a.query.q,s=>{if(s==null)return;const e=String(s);e!==t.query.trim()&&(t.query=e,t.libraryId&&k())}),(s,e)=>{const m=y("a-select"),x=y("a-input"),q=y("a-slider"),g=y("a-button"),I=y("a-tag"),D=y("a-progress");return d(),_("div",null,[o(te,{title:"知识库检索",desc:"模拟 Agent 的实际检索效果;BOOLEAN 精确优先,零命中自动切自然语言分词"}),o(re,{id:"kb-search",text:"短词(如「脾胃虚寒」)走精确匹配;整句自然语言会自动分词回退,结果带「分词回退」标签。命中结果可一键注入调试台验证生成效果。"}),i("div",ne,[i("div",le,[o(m,{value:t.libraryId,"onUpdate:value":e[0]||(e[0]=r=>t.libraryId=r),style:{width:"220px"},placeholder:"选择知识库",options:u.value.map(r=>({label:`${r.name}(${r.chunk_count} 分段)`,value:r.id}))},null,8,["value","options"]),o(x,{value:t.query,"onUpdate:value":e[1]||(e[1]=r=>t.query=r),placeholder:"如:脾胃虚寒 温中健脾 / 胃疼吃什么中药?",style:{width:"320px"},"allow-clear":"",onPressEnter:k},null,8,["value"]),e[5]||(e[5]=i("span",{class:"text-xs",style:{color:"var(--text-3)"}},"TopK",-1)),o(q,{value:t.topK,"onUpdate:value":e[2]||(e[2]=r=>t.topK=r),min:1,max:10,style:{width:"140px"}},null,8,["value"]),o(g,{type:"primary",loading:l.loading,onClick:k},{icon:f(()=>[o(v(Y))]),default:f(()=>[e[4]||(e[4]=h("检索 "))]),_:1},8,["loading"])])]),l.searched?(d(),_(L,{key:0},[i("div",oe,[i("span",null,"命中 "+b(l.results.length)+" 条 · "+b(v(J)(l.durationMs)),1),P.value?(d(),w(I,{key:0,color:"warning",bordered:!1},{default:f(()=>e[6]||(e[6]=[h("分词回退(BOOLEAN 零命中,已切自然语言模式)")])),_:1})):S("",!0)]),l.results.length?(d(),_("div",ie,[(d(!0),_(L,null,W(l.results,(r,V)=>(d(),_("div",{key:r.chunk_id,class:"glass p-4"},[i("div",ue,[i("span",ce,"#"+b(V+1),1),i("span",de,b(r.title||"(无标题分段)"),1),r.source_type==="fulltext-natural"?(d(),w(I,{key:0,color:"warning",bordered:!1,class:"!text-[10px]"},{default:f(()=>e[7]||(e[7]=[h("分词回退")])),_:1})):S("",!0),i("span",pe,"score "+b(r.score.toFixed(3)),1)]),o(D,{percent:Math.round(r.score/A.value*100),"show-info":!1,size:"small","stroke-color":"var(--primary)",class:"!mb-2"},null,8,["percent"]),i("div",{class:"text-xs kb-content",style:{color:"var(--text-2)","white-space":"pre-wrap"},innerHTML:j(r.content)},null,8,me),i("div",fe,[o(g,{size:"small",onClick:F=>B(r)},{icon:f(()=>[o(v(O))]),default:f(()=>[e[8]||(e[8]=h("注入调试台"))]),_:2},1032,["onClick"]),o(g,{size:"small",type:"text",onClick:F=>v(n).push({path:"/kb",query:{lib:r.library_id}})},{default:f(()=>e[9]||(e[9]=[h("所属库 →")])),_:2},1032,["onClick"])])]))),128))])):(d(),w(C,{key:0,text:"未命中任何分段。试试:① 换更短的核心词(如「温中健脾」)② 检查该库是否已导入相关文档 ③ 分段可能被禁用。","action-text":"去管理知识库",onAction:e[3]||(e[3]=r=>v(n).push({path:"/kb",query:{lib:t.libraryId}}))}))],64)):(d(),w(C,{key:1,text:"输入检索词试试 Agent 能查到什么。短词精确匹配,长句自动分词。","action-text":""}))])}}},he=T(ye,[["__scopeId","data-v-3963b792"]]);export{he as default}; diff --git a/view/admin-dist/assets/index-BJrl7dSL.js b/view/admin-dist/assets/index-BJrl7dSL.js new file mode 100644 index 0000000..0040080 --- /dev/null +++ b/view/admin-dist/assets/index-BJrl7dSL.js @@ -0,0 +1,2 @@ +import{m as N,a as f,t as R,p as l,Y as j,s as P,b as L,c as n,d as s,x as V,w as q,j as w,z,q as E,F as H,g as I,o as h,K as J,J as K}from"./index-C0Houbmd.js";import{_ as T}from"./PageHeader-BlIlnAwG.js";import{_ as x}from"./StatCard--WvCkpAN.js";import{_ as y}from"./EChart-BGQ5HH9D.js";import{_ as U}from"./EmptyHint-2CB843hO.js";const W={class:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-4"},Y={class:"glass p-4 mb-4"},G={class:"grid grid-cols-1 lg:grid-cols-2 gap-4"},Q={class:"glass p-4"},X={class:"glass p-4"},nt={__name:"index",setup(Z){const A=N(),v=f("6h"),g=f([]),_=f(null),i=f(!0);async function C(){const[t,e]=await Promise.allSettled([J({limit:200},{silent:!0}),K({silent:!0})]);t.status==="fulfilled"&&(g.value=t.value.data||[]),e.status==="fulfilled"&&(_.value=e.value.data),i.value=!1}R(C,3e4);const b=l(()=>{const t=A.theme==="dark";return{text:t?"#bfae8d":"#5a6478",line:t?"rgba(245,158,11,0.15)":"rgba(67,97,238,0.12)",primary:t?"#f59e0b":"#4361ee",accent:t?"#fb923c":"#7c3aed",ok:"#22c55e",err:"#ef4444",palette:t?["#f59e0b","#fb923c","#22c55e","#3b82f6","#a855f7","#ef4444"]:["#4361ee","#7c3aed","#16a34a","#2563eb","#d97706","#dc2626"]}}),d=l(()=>{const t=Math.floor(Date.now()/1e3),e={"1h":[3600,300],"6h":[21600,1800],"24h":[86400,7200]}[v.value],[a,o]=e,p=t-a,M=Math.ceil(a/o),m=Array.from({length:M},(u,c)=>({t:p+c*o,total:0,ok:0,prompt:0,completion:0}));for(const u of g.value){if(u.started_atd.value.map(t=>{const e=new Date(t.t*1e3);return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`})),$=l(()=>{const t=b.value;return{backgroundColor:"transparent",tooltip:{trigger:"axis"},legend:{textStyle:{color:t.text},top:0},grid:{left:40,right:44,top:34,bottom:24},xAxis:{type:"category",data:k.value,axisLabel:{color:t.text},axisLine:{lineStyle:{color:t.line}}},yAxis:[{type:"value",name:"请求量",axisLabel:{color:t.text},splitLine:{lineStyle:{color:t.line}}},{type:"value",name:"成功率%",max:100,axisLabel:{color:t.text},splitLine:{show:!1}}],series:[{name:"请求量",type:"bar",data:d.value.map(e=>e.total),itemStyle:{color:t.primary,borderRadius:[3,3,0,0]},barMaxWidth:18},{name:"成功率",type:"line",yAxisIndex:1,smooth:!0,data:d.value.map(e=>e.total?Math.round(e.ok/e.total*100):null),itemStyle:{color:t.ok},connectNulls:!0}]}}),B=l(()=>{var a;const t=b.value,e=Object.entries(((a=_.value)==null?void 0:a.scene_counts)||{});return{backgroundColor:"transparent",color:t.palette,tooltip:{trigger:"item"},legend:{bottom:0,textStyle:{color:t.text}},series:[{type:"pie",radius:["42%","68%"],center:["50%","44%"],label:{color:t.text,formatter:`{b} +{c} 次`},data:e.map(([o,p])=>({name:j(o),value:p}))}]}}),O=l(()=>{const t=b.value;return{backgroundColor:"transparent",tooltip:{trigger:"axis"},legend:{textStyle:{color:t.text},top:0},grid:{left:52,right:20,top:34,bottom:24},xAxis:{type:"category",data:k.value,axisLabel:{color:t.text},axisLine:{lineStyle:{color:t.line}}},yAxis:{type:"value",axisLabel:{color:t.text},splitLine:{lineStyle:{color:t.line}}},series:[{name:"prompt(估)",type:"line",stack:"tok",areaStyle:{opacity:.35},smooth:!0,itemStyle:{color:t.primary},data:d.value.map(e=>e.prompt)},{name:"completion(估)",type:"line",stack:"tok",areaStyle:{opacity:.35},smooth:!0,itemStyle:{color:t.accent},data:d.value.map(e=>e.completion)}]}}),r=l(()=>{const t=Math.floor(Date.now()/1e3),e={"1h":3600,"6h":21600,"24h":86400}[v.value];return g.value.filter(a=>a.started_at>=t-e)}),D=l(()=>r.value.reduce((t,e)=>t+(e.total_tokens||0),0)),F=l(()=>r.value.reduce((t,e)=>t+P(e.provider,(e.total_tokens||0)*.7,(e.total_tokens||0)*.3),0)),S=l(()=>{const t=r.value.filter(e=>e.status===1);return t.length?Math.round(t.reduce((e,a)=>e+a.total_ms,0)/t.length):null});return(t,e)=>{const a=I("a-segmented");return h(),L("div",null,[n(T,{title:"统计分析",desc:"基于内存缓冲(最近 200 次运行)的前端聚合;重启后清零,长期趋势看历史记录页"},{actions:q(()=>[n(a,{value:v.value,"onUpdate:value":e[0]||(e[0]=o=>v.value=o),options:[{label:"1 小时",value:"1h"},{label:"6 小时",value:"6h"},{label:"24 小时",value:"24h"}]},null,8,["value"])]),_:1}),s("div",W,[n(x,{label:"区间运行数",value:r.value.length,loading:i.value},null,8,["value","loading"]),n(x,{label:"区间成功率",loading:i.value,value:r.value.length?(r.value.filter(o=>o.status===1).length/r.value.length*100).toFixed(1):"-",unit:"%"},null,8,["loading","value"]),n(x,{label:"区间平均耗时",value:S.value!=null?w(z)(S.value):"-",loading:i.value},null,8,["value","loading"]),n(x,{label:"区间 token / 成本",value:D.value,hint:`估算 ${w(E)(F.value)}`,loading:i.value},null,8,["value","hint","loading"])]),!i.value&&!g.value.length?(h(),V(U,{key:0,text:"缓冲内没有运行数据,图表无从画起","action-text":"去调试工具发一条测试请求",onAction:e[1]||(e[1]=o=>t.$router.push("/debug"))})):(h(),L(H,{key:1},[s("div",Y,[e[2]||(e[2]=s("div",{class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},"请求量 × 成功率",-1)),n(y,{option:$.value,height:"280px"},null,8,["option"])]),s("div",G,[s("div",Q,[e[3]||(e[3]=s("div",{class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},"场景分布(全缓冲)",-1)),n(y,{option:B.value,height:"300px"},null,8,["option"])]),s("div",X,[e[4]||(e[4]=s("div",{class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},"token 用量(堆叠,按 7:3 估拆输入/输出)",-1)),n(y,{option:O.value,height:"300px"},null,8,["option"])])])],64))])}}};export{nt as default}; diff --git a/view/admin-dist/assets/index-BpsYeRRg.js b/view/admin-dist/assets/index-BpsYeRRg.js new file mode 100644 index 0000000..3bfd336 --- /dev/null +++ b/view/admin-dist/assets/index-BpsYeRRg.js @@ -0,0 +1 @@ +import{m as se,a as p,h as oe,t as le,O as V,p as ae,P as ne,b as u,c as n,d as s,w as v,j as l,S as re,g as d,k as D,x as O,F as f,C as k,i as ie,o as r,D as o,Q as ue,V as ce,W as pe,A as de,E as w,G as A,z as b,q as B,s as E,X as I,_ as P,y as me,Y as ve,K as _e,Z as xe,$ as ye,l as j}from"./index-C0Houbmd.js";import{_ as fe}from"./PageHeader-BlIlnAwG.js";import{_ as ke}from"./SceneTag-B1Rekn1Q.js";import{_ as ge}from"./EmptyHint-2CB843hO.js";const he={class:"glass p-3 mb-4 flex items-center gap-3 flex-wrap"},we={class:"ml-auto flex items-center gap-2 text-xs",style:{color:"var(--text-3)"}},be={class:"glass overflow-hidden"},Ce={class:"grid items-center px-3 py-2 text-xs font-medium",style:{"grid-template-columns":"36px 60px 110px 100px minmax(120px,1.2fr) 80px 90px 80px minmax(90px,1fr) 80px",color:"var(--text-3)","border-bottom":"1px solid var(--glass-border)"}},$e={key:2,class:"max-h-[62vh] overflow-auto"},Se=["onClick"],Ne={class:"mono",style:{color:"var(--text-3)"}},qe={style:{color:"var(--text-2)"}},De=["title"],Oe={class:"mono",style:{color:"var(--text-3)"}},Re={class:"mono",style:{color:"var(--text-3)"}},Le={class:"flex gap-1 items-center"},Me={class:"grid grid-cols-2 gap-4"},Te={class:"flex items-center gap-2 mb-2 flex-wrap"},Ue={class:"mono font-medium",style:{color:"var(--primary)"}},Ve={class:"text-xs"},Ae={class:"mono text-xs",style:{color:"var(--text-3)"}},Be={class:"grid grid-cols-2 gap-y-1 text-xs mb-3"},Ee={class:"mono"},Ie={class:"mono"},Pe={class:"flex justify-between text-xs",style:{color:"var(--text-3)"}},je={class:"mono"},ze={class:"h-1.5 rounded-full overflow-hidden",style:{background:"rgba(0,0,0,0.2)"}},Fe={key:0,class:"text-xs mt-2",style:{color:"var(--err)"}},Xe={__name:"index",setup(Je){const R=se(),m=oe(),L=ie(),x=p(m.query.scene?String(m.query.scene):""),y=p(m.query.status?Number(m.query.status):0),C=p(""),$=p(!0),g=p([]),S=p(!1);async function M(){S.value=g.value.length===0;try{const a=await _e({limit:200,scene:x.value,status:y.value},{silent:!0});g.value=a.data||[]}finally{S.value=!1}}const T=le(M,5e3);V($,a=>a?T.resume():T.pause()),V([x,y],()=>{M(),L.replace({query:{...m.query,scene:x.value||void 0,status:y.value||void 0,run:void 0}})});const h=ae(()=>{const a=C.value.trim().toLowerCase();return a?g.value.filter(t=>`${t.provider}/${t.model}`.toLowerCase().includes(a)||(t.error||"").toLowerCase().includes(a)||String(t.id)===a):g.value});ne(()=>{m.query.run&&R.openRun(Number(m.query.run))});const c=p([]);function z(a,t){if(t){if(c.value.length>=2){j.warning("最多选 2 条做对比");return}c.value.push(a)}else c.value=c.value.filter(_=>_!==a)}const N=p(!1),U=p([]);async function F(){if(c.value.length!==2)return;const[a,t]=await Promise.all(c.value.map(_=>xe(_,{silent:!0})));U.value=[a.data,t.data],N.value=!0}function J(){ye(h.value,`agent-runs-${Date.now()}.json`),j.success(`已导出 ${h.value.length} 条`)}const G=[{title:"",key:"select",width:36},{title:"ID",key:"id",width:60},{title:"时间",key:"time",width:110},{title:"场景",key:"scene",width:100},{title:"provider/model",key:"pm",width:150},{title:"耗时",key:"ms",width:80},{title:"tokens",key:"tokens",width:90},{title:"成本",key:"cost",width:80},{title:"步骤",key:"steps",width:110},{title:"状态",key:"status",width:80}],K={1:"var(--ok)",2:"var(--err)",0:"var(--run)"};return(a,t)=>{const _=d("a-button"),Q=d("a-select"),W=d("a-segmented"),X=d("a-input"),Y=d("a-switch"),Z=d("a-skeleton"),H=d("a-checkbox"),ee=d("a-tooltip"),te=d("a-modal");return r(),u("div",null,[n(fe,{title:"运行记录",desc:"内存环形缓冲最近 200 次运行(重启清零);长期数据请看「历史记录」页"},{actions:v(()=>[n(_,{disabled:c.value.length!==2,onClick:F},{icon:v(()=>[n(l(ue))]),default:v(()=>[D("对比("+o(c.value.length)+"/2) ",1)]),_:1},8,["disabled"]),n(_,{onClick:J},{icon:v(()=>[n(l(ce))]),default:v(()=>[t[7]||(t[7]=D("导出 JSON"))]),_:1})]),_:1}),s("div",he,[n(Q,{value:x.value,"onUpdate:value":t[0]||(t[0]=e=>x.value=e),style:{width:"140px"},placeholder:"全部场景","allow-clear":"",options:[{label:"全部场景",value:""},...l(re)]},null,8,["value","options"]),n(W,{value:y.value,"onUpdate:value":t[1]||(t[1]=e=>y.value=e),options:[{label:"全部",value:0},{label:"成功",value:1},{label:"失败",value:2},{label:"拦截",value:3}]},null,8,["value"]),n(X,{value:C.value,"onUpdate:value":t[2]||(t[2]=e=>C.value=e),placeholder:"搜 provider / 错误信息 / ID",style:{width:"210px"},"allow-clear":""},null,8,["value"]),s("div",we,[t[8]||(t[8]=D(" 自动刷新 ")),n(Y,{checked:$.value,"onUpdate:checked":t[3]||(t[3]=e=>$.value=e),size:"small"},null,8,["checked"])])]),s("div",be,[s("div",Ce,[(r(),u(f,null,k(G,e=>s("span",{key:e.key},o(e.title),1)),64))]),S.value?(r(),O(Z,{key:0,active:"",class:"p-4"})):h.value.length?(r(),u("div",$e,[(r(!0),u(f,null,k(h.value,e=>(r(),u("div",{key:e.id,class:"grid items-center px-3 py-2 text-xs cursor-pointer glass-hover",style:{"grid-template-columns":"36px 60px 110px 100px minmax(120px,1.2fr) 80px 90px 80px minmax(90px,1fr) 80px","border-bottom":"1px solid var(--glass-border)"},onClick:i=>l(R).openRun(e.id)},[s("span",{onClick:t[5]||(t[5]=pe(()=>{},["stop"]))},[n(H,{checked:c.value.includes(e.id),onChange:i=>z(e.id,i.target.checked)},null,8,["checked","onChange"])]),s("span",Ne,"#"+o(e.id),1),s("span",qe,o(l(de)(e.started_at)),1),s("span",null,[n(ke,{scene:e.scene,clickable:!1},null,8,["scene"])]),s("span",{class:"mono truncate pr-2",style:{color:"var(--text-2)"},title:e.error||""},o(e.provider)+"/"+o(e.model),9,De),s("span",{class:"mono",style:w({color:l(A)(e.total_ms)})},o(l(b)(e.total_ms)),5),s("span",Oe,o(e.total_tokens),1),s("span",Re,o(l(B)(l(E)(e.provider,e.total_tokens*.7,e.total_tokens*.3))),1),s("span",Le,[(r(!0),u(f,null,k(e.step_briefs||[],(i,q)=>(r(),O(ee,{key:q,title:`${l(I)(i.step_type)} ${l(b)(i.duration_ms)}`},{default:v(()=>[s("span",{class:"w-2 h-2 rounded-full inline-block",style:w({background:K[i.status]||"var(--text-3)"})},null,4)]),_:2},1032,["title"]))),128))]),s("span",null,[n(P,{status:e.status},null,8,["status"])])],8,Se))),128))])):(r(),O(ge,{key:1,text:"没有符合条件的运行记录","action-text":"去调试工具发一条测试请求",onAction:t[4]||(t[4]=e=>l(L).push("/debug"))}))]),n(te,{open:N.value,"onUpdate:open":t[6]||(t[6]=e=>N.value=e),title:"运行对比",width:960,footer:null},{default:v(()=>[s("div",Me,[(r(!0),u(f,null,k(U.value,e=>(r(),u("div",{key:e.id,class:"glass p-3"},[s("div",Te,[s("span",Ue,"#"+o(e.id),1),n(P,{status:e.status},null,8,["status"]),s("span",Ve,o(l(ve)(e.scene)),1),s("span",Ae,o(e.provider)+"/"+o(e.model),1)]),s("div",Be,[t[9]||(t[9]=s("span",{style:{color:"var(--text-3)"}},"总耗时",-1)),s("span",{class:"mono",style:w({color:l(A)(e.total_ms)})},o(l(b)(e.total_ms)),5),t[10]||(t[10]=s("span",{style:{color:"var(--text-3)"}},"tokens",-1)),s("span",Ee,o(e.prompt_tokens)+"+"+o(e.completion_tokens)+"="+o(e.total_tokens),1),t[11]||(t[11]=s("span",{style:{color:"var(--text-3)"}},"成本估算",-1)),s("span",Ie,o(l(B)(l(E)(e.provider,e.prompt_tokens,e.completion_tokens))),1),t[12]||(t[12]=s("span",{style:{color:"var(--text-3)"}},"配置来源",-1)),s("span",null,o(e.cfg_source||"-"),1)]),t[13]||(t[13]=s("div",{class:"mb-2 text-xs font-medium",style:{color:"var(--text-2)"}},"步骤耗时",-1)),(r(!0),u(f,null,k(e.steps||[],(i,q)=>(r(),u("div",{key:q,class:"mb-1.5"},[s("div",Pe,[s("span",null,o(l(I)(i.step_type)),1),s("span",je,o(l(b)(i.duration_ms)),1)]),s("div",ze,[s("div",{class:"h-full rounded-full",style:w({width:Math.max(2,i.duration_ms/Math.max(e.total_ms,1)*100)+"%",background:i.status===2?"var(--err)":"var(--primary)"})},null,4)])]))),128)),e.error?(r(),u("div",Fe,o(e.error),1)):me("",!0)]))),128))])]),_:1},8,["open"])])}}};export{Xe as default}; diff --git a/view/admin-dist/assets/index-Bvt6jXQo.css b/view/admin-dist/assets/index-Bvt6jXQo.css new file mode 100644 index 0000000..b9e0c1c --- /dev/null +++ b/view/admin-dist/assets/index-Bvt6jXQo.css @@ -0,0 +1 @@ +[data-v-b5090fa0] .ant-collapse{background:transparent}[data-v-b5090fa0] .ant-collapse-item{border-color:var(--glass-border)!important} diff --git a/view/admin-dist/assets/index-C0Houbmd.js b/view/admin-dist/assets/index-C0Houbmd.js new file mode 100644 index 0000000..90caa6c --- /dev/null +++ b/view/admin-dist/assets/index-C0Houbmd.js @@ -0,0 +1,507 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D_jM3jWS.js","assets/SafetyOutlined-CY7qTfTh.js","assets/index-CEBsoH6M.js","assets/PageHeader-BlIlnAwG.js","assets/StatCard--WvCkpAN.js","assets/SceneTag-B1Rekn1Q.js","assets/EmptyHint-2CB843hO.js","assets/GlassCard-CqhSlns9.js","assets/KvGrid-B8WhLf5u.js","assets/index-BpsYeRRg.js","assets/index-_NPq9xvG.js","assets/HelpTip-C9tfcO7G.js","assets/index-BJrl7dSL.js","assets/EChart-BGQ5HH9D.js","assets/index-DTdNJDlS.js","assets/ClearOutlined-n8aZ-G2p.js","assets/index-CZFMEA6j.js","assets/index-CIfwmCYV.js","assets/index-Bvt6jXQo.css","assets/index-Cu6gPumw.js","assets/index-hxBpkaUb.js","assets/index-DTh94Lw7.js","assets/kb-DlfA6vCV.js","assets/index-9-ZULY9z.js","assets/index-uTmFjKcv.css","assets/index-Din2I8-x.js"])))=>i.map(i=>d[i]); +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();/** +* @vue/shared v3.5.13 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**//*! #__NO_SIDE_EFFECTS__ */function lb(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const _t={},Ta=[],Ir=()=>{},bM=()=>!1,Cp=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),ab=e=>e.startsWith("onUpdate:"),pn=Object.assign,sb=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},yM=Object.prototype.hasOwnProperty,Rt=(e,t)=>yM.call(e,t),at=Array.isArray,Ea=e=>xp(e)==="[object Map]",R8=e=>xp(e)==="[object Set]",ut=e=>typeof e=="function",Kt=e=>typeof e=="string",ii=e=>typeof e=="symbol",Ht=e=>e!==null&&typeof e=="object",D8=e=>(Ht(e)||ut(e))&&ut(e.then)&&ut(e.catch),B8=Object.prototype.toString,xp=e=>B8.call(e),SM=e=>xp(e).slice(8,-1),N8=e=>xp(e)==="[object Object]",cb=e=>Kt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Vs=lb(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),wp=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},$M=/-(\w)/g,Oo=wp(e=>e.replace($M,(t,n)=>n?n.toUpperCase():"")),CM=/\B([A-Z])/g,li=wp(e=>e.replace(CM,"-$1").toLowerCase()),Op=wp(e=>e.charAt(0).toUpperCase()+e.slice(1)),Tg=wp(e=>e?`on${Op(e)}`:""),so=(e,t)=>!Object.is(e,t),Eg=(e,...t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},xM=e=>{const t=parseFloat(e);return isNaN(t)?e:t},wM=e=>{const t=Kt(e)?Number(e):NaN;return isNaN(t)?e:t};let n$;const Pp=()=>n$||(n$=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Bi(e){if(at(e)){const t={};for(let n=0;n{if(n){const o=n.split(PM);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function Uc(e){let t="";if(Kt(e))t=e;else if(at(e))for(let n=0;n!!(e&&e.__v_isRef===!0),Tt=e=>Kt(e)?e:e==null?"":at(e)||Ht(e)&&(e.toString===B8||!ut(e.toString))?L8(e)?Tt(e.value):JSON.stringify(e,z8,2):String(e),z8=(e,t)=>L8(t)?z8(e,t.value):Ea(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],i)=>(n[_g(o,i)+" =>"]=r,n),{})}:R8(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>_g(n))}:ii(t)?_g(t):Ht(t)&&!at(t)&&!N8(t)?String(t):t,_g=(e,t="")=>{var n;return ii(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/** +* @vue/reactivity v3.5.13 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let Un;class H8{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Un,!t&&Un&&(this.index=(Un.scopes||(Un.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t0)return;if(Ks){let t=Ks;for(Ks=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Ws;){let t=Ws;for(Ws=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(o){e||(e=o)}t=n}}if(e)throw e}function U8(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function X8(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),pb(o),MM(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function um(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Y8(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Y8(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===gc))return;e.globalVersion=gc;const t=e.dep;if(e.flags|=2,t.version>0&&!e.isSSR&&e.deps&&!um(e)){e.flags&=-3;return}const n=zt,o=tr;zt=e,tr=!0;try{U8(e);const r=e.fn(e._value);(t.version===0||so(r,e._value))&&(e._value=r,t.version++)}catch(r){throw t.version++,r}finally{zt=n,tr=o,X8(e),e.flags&=-3}}function pb(e,t=!1){const{dep:n,prevSub:o,nextSub:r}=e;if(o&&(o.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)pb(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function MM(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let tr=!0;const q8=[];function Vi(){q8.push(tr),tr=!1}function Wi(){const e=q8.pop();tr=e===void 0?!0:e}function o$(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=zt;zt=void 0;try{t()}finally{zt=n}}}let gc=0,AM=class{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class Ip{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0}track(t){if(!zt||!tr||zt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==zt)n=this.activeLink=new AM(zt,this),zt.deps?(n.prevDep=zt.depsTail,zt.depsTail.nextDep=n,zt.depsTail=n):zt.deps=zt.depsTail=n,J8(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const o=n.nextDep;o.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=o),n.prevDep=zt.depsTail,n.nextDep=void 0,zt.depsTail.nextDep=n,zt.depsTail=n,zt.deps===n&&(zt.deps=o)}return n}trigger(t){this.version++,gc++,this.notify(t)}notify(t){db();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{fb()}}}function J8(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let o=t.deps;o;o=o.nextDep)J8(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const ff=new WeakMap,xl=Symbol(""),dm=Symbol(""),vc=Symbol("");function Dn(e,t,n){if(tr&&zt){let o=ff.get(e);o||ff.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new Ip),r.map=o,r.key=n),r.track()}}function Gr(e,t,n,o,r,i){const l=ff.get(e);if(!l){gc++;return}const a=s=>{s&&s.trigger()};if(db(),t==="clear")l.forEach(a);else{const s=at(e),c=s&&cb(n);if(s&&n==="length"){const u=Number(o);l.forEach((d,f)=>{(f==="length"||f===vc||!ii(f)&&f>=u)&&a(d)})}else switch((n!==void 0||l.has(void 0))&&a(l.get(n)),c&&a(l.get(vc)),t){case"add":s?c&&a(l.get("length")):(a(l.get(xl)),Ea(e)&&a(l.get(dm)));break;case"delete":s||(a(l.get(xl)),Ea(e)&&a(l.get(dm)));break;case"set":Ea(e)&&a(l.get(xl));break}}fb()}function RM(e,t){const n=ff.get(e);return n&&n.get(t)}function ia(e){const t=tt(e);return t===e?t:(Dn(t,"iterate",vc),zo(e)?t:t.map(Bn))}function Tp(e){return Dn(e=tt(e),"iterate",vc),e}const DM={__proto__:null,[Symbol.iterator](){return Ag(this,Symbol.iterator,Bn)},concat(...e){return ia(this).concat(...e.map(t=>at(t)?ia(t):t))},entries(){return Ag(this,"entries",e=>(e[1]=Bn(e[1]),e))},every(e,t){return kr(this,"every",e,t,void 0,arguments)},filter(e,t){return kr(this,"filter",e,t,n=>n.map(Bn),arguments)},find(e,t){return kr(this,"find",e,t,Bn,arguments)},findIndex(e,t){return kr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return kr(this,"findLast",e,t,Bn,arguments)},findLastIndex(e,t){return kr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return kr(this,"forEach",e,t,void 0,arguments)},includes(...e){return Rg(this,"includes",e)},indexOf(...e){return Rg(this,"indexOf",e)},join(e){return ia(this).join(e)},lastIndexOf(...e){return Rg(this,"lastIndexOf",e)},map(e,t){return kr(this,"map",e,t,void 0,arguments)},pop(){return Os(this,"pop")},push(...e){return Os(this,"push",e)},reduce(e,...t){return r$(this,"reduce",e,t)},reduceRight(e,...t){return r$(this,"reduceRight",e,t)},shift(){return Os(this,"shift")},some(e,t){return kr(this,"some",e,t,void 0,arguments)},splice(...e){return Os(this,"splice",e)},toReversed(){return ia(this).toReversed()},toSorted(e){return ia(this).toSorted(e)},toSpliced(...e){return ia(this).toSpliced(...e)},unshift(...e){return Os(this,"unshift",e)},values(){return Ag(this,"values",Bn)}};function Ag(e,t,n){const o=Tp(e),r=o[t]();return o!==e&&!zo(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.value&&(i.value=n(i.value)),i}),r}const BM=Array.prototype;function kr(e,t,n,o,r,i){const l=Tp(e),a=l!==e&&!zo(e),s=l[t];if(s!==BM[t]){const d=s.apply(e,i);return a?Bn(d):d}let c=n;l!==e&&(a?c=function(d,f){return n.call(this,Bn(d),f,e)}:n.length>2&&(c=function(d,f){return n.call(this,d,f,e)}));const u=s.call(l,c,o);return a&&r?r(u):u}function r$(e,t,n,o){const r=Tp(e);let i=n;return r!==e&&(zo(e)?n.length>3&&(i=function(l,a,s){return n.call(this,l,a,s,e)}):i=function(l,a,s){return n.call(this,l,Bn(a),s,e)}),r[t](i,...o)}function Rg(e,t,n){const o=tt(e);Dn(o,"iterate",vc);const r=o[t](...n);return(r===-1||r===!1)&&vb(n[0])?(n[0]=tt(n[0]),o[t](...n)):r}function Os(e,t,n=[]){Vi(),db();const o=tt(e)[t].apply(e,n);return fb(),Wi(),o}const NM=lb("__proto__,__v_isRef,__isVue"),Z8=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ii));function kM(e){ii(e)||(e=String(e));const t=tt(this);return Dn(t,"has",e),t.hasOwnProperty(e)}class Q8{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,o){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return i;if(n==="__v_raw")return o===(r?i?UM:o6:i?n6:t6).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const l=at(t);if(!r){let s;if(l&&(s=DM[n]))return s;if(n==="hasOwnProperty")return kM}const a=Reflect.get(t,n,Vt(t)?t:o);return(ii(n)?Z8.has(n):NM(n))||(r||Dn(t,"get",n),i)?a:Vt(a)?l&&cb(n)?a:a.value:Ht(a)?r?i6(a):ft(a):a}}class e6 extends Q8{constructor(t=!1){super(!1,t)}set(t,n,o,r){let i=t[n];if(!this._isShallow){const s=Dl(i);if(!zo(o)&&!Dl(o)&&(i=tt(i),o=tt(o)),!at(t)&&Vt(i)&&!Vt(o))return s?!1:(i.value=o,!0)}const l=at(t)&&cb(n)?Number(n)e,wu=e=>Reflect.getPrototypeOf(e);function jM(e,t,n){return function(...o){const r=this.__v_raw,i=tt(r),l=Ea(i),a=e==="entries"||e===Symbol.iterator&&l,s=e==="keys"&&l,c=r[e](...o),u=n?fm:t?pm:Bn;return!t&&Dn(i,"iterate",s?dm:xl),{next(){const{value:d,done:f}=c.next();return f?{value:d,done:f}:{value:a?[u(d[0]),u(d[1])]:u(d),done:f}},[Symbol.iterator](){return this}}}}function Ou(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function VM(e,t){const n={get(r){const i=this.__v_raw,l=tt(i),a=tt(r);e||(so(r,a)&&Dn(l,"get",r),Dn(l,"get",a));const{has:s}=wu(l),c=t?fm:e?pm:Bn;if(s.call(l,r))return c(i.get(r));if(s.call(l,a))return c(i.get(a));i!==l&&i.get(r)},get size(){const r=this.__v_raw;return!e&&Dn(tt(r),"iterate",xl),Reflect.get(r,"size",r)},has(r){const i=this.__v_raw,l=tt(i),a=tt(r);return e||(so(r,a)&&Dn(l,"has",r),Dn(l,"has",a)),r===a?i.has(r):i.has(r)||i.has(a)},forEach(r,i){const l=this,a=l.__v_raw,s=tt(a),c=t?fm:e?pm:Bn;return!e&&Dn(s,"iterate",xl),a.forEach((u,d)=>r.call(i,c(u),c(d),l))}};return pn(n,e?{add:Ou("add"),set:Ou("set"),delete:Ou("delete"),clear:Ou("clear")}:{add(r){!t&&!zo(r)&&!Dl(r)&&(r=tt(r));const i=tt(this);return wu(i).has.call(i,r)||(i.add(r),Gr(i,"add",r,r)),this},set(r,i){!t&&!zo(i)&&!Dl(i)&&(i=tt(i));const l=tt(this),{has:a,get:s}=wu(l);let c=a.call(l,r);c||(r=tt(r),c=a.call(l,r));const u=s.call(l,r);return l.set(r,i),c?so(i,u)&&Gr(l,"set",r,i):Gr(l,"add",r,i),this},delete(r){const i=tt(this),{has:l,get:a}=wu(i);let s=l.call(i,r);s||(r=tt(r),s=l.call(i,r)),a&&a.call(i,r);const c=i.delete(r);return s&&Gr(i,"delete",r,void 0),c},clear(){const r=tt(this),i=r.size!==0,l=r.clear();return i&&Gr(r,"clear",void 0,void 0),l}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=jM(r,e,t)}),n}function hb(e,t){const n=VM(e,t);return(o,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(Rt(n,r)&&r in o?n:o,r,i)}const WM={get:hb(!1,!1)},KM={get:hb(!1,!0)},GM={get:hb(!0,!1)};const t6=new WeakMap,n6=new WeakMap,o6=new WeakMap,UM=new WeakMap;function XM(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function YM(e){return e.__v_skip||!Object.isExtensible(e)?0:XM(SM(e))}function ft(e){return Dl(e)?e:gb(e,!1,LM,WM,t6)}function r6(e){return gb(e,!1,HM,KM,n6)}function i6(e){return gb(e,!0,zM,GM,o6)}function gb(e,t,n,o,r){if(!Ht(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=r.get(e);if(i)return i;const l=YM(e);if(l===0)return e;const a=new Proxy(e,l===2?o:n);return r.set(e,a),a}function Ni(e){return Dl(e)?Ni(e.__v_raw):!!(e&&e.__v_isReactive)}function Dl(e){return!!(e&&e.__v_isReadonly)}function zo(e){return!!(e&&e.__v_isShallow)}function vb(e){return e?!!e.__v_raw:!1}function tt(e){const t=e&&e.__v_raw;return t?tt(t):e}function mb(e){return!Rt(e,"__v_skip")&&Object.isExtensible(e)&&k8(e,"__v_skip",!0),e}const Bn=e=>Ht(e)?ft(e):e,pm=e=>Ht(e)?i6(e):e;function Vt(e){return e?e.__v_isRef===!0:!1}function ne(e){return l6(e,!1)}function oe(e){return l6(e,!0)}function l6(e,t){return Vt(e)?e:new qM(e,t)}class qM{constructor(t,n){this.dep=new Ip,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:tt(t),this._value=n?t:Bn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||zo(t)||Dl(t);t=o?t:tt(t),so(t,n)&&(this._rawValue=t,this._value=o?t:Bn(t),this.dep.trigger())}}function a6(e){e.dep&&e.dep.trigger()}function je(e){return Vt(e)?e.value:e}const JM={get:(e,t,n)=>t==="__v_raw"?e:je(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return Vt(r)&&!Vt(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function s6(e){return Ni(e)?e:new Proxy(e,JM)}class ZM{constructor(t){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new Ip,{get:o,set:r}=t(n.track.bind(n),n.trigger.bind(n));this._get=o,this._set=r}get value(){return this._value=this._get()}set value(t){this._set(t)}}function QM(e){return new ZM(e)}function nr(e){const t=at(e)?new Array(e.length):{};for(const n in e)t[n]=c6(e,n);return t}class eA{constructor(t,n,o){this._object=t,this._key=n,this._defaultValue=o,this.__v_isRef=!0,this._value=void 0}get value(){const t=this._object[this._key];return this._value=t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return RM(tt(this._object),this._key)}}class tA{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function We(e,t,n){return Vt(e)?e:ut(e)?new tA(e):Ht(e)&&arguments.length>1?c6(e,t,n):ne(e)}function c6(e,t,n){const o=e[t];return Vt(o)?o:new eA(e,t,n)}class nA{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Ip(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=gc-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&zt!==this)return G8(this,!0),!0}get value(){const t=this.dep.track();return Y8(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function oA(e,t,n=!1){let o,r;return ut(e)?o=e:(o=e.get,r=e.set),new nA(o,r,n)}const Pu={},pf=new WeakMap;let ul;function rA(e,t=!1,n=ul){if(n){let o=pf.get(n);o||pf.set(n,o=[]),o.push(e)}}function iA(e,t,n=_t){const{immediate:o,deep:r,once:i,scheduler:l,augmentJob:a,call:s}=n,c=w=>r?w:zo(w)||r===!1||r===0?Ur(w,1):Ur(w);let u,d,f,h,v=!1,g=!1;if(Vt(e)?(d=()=>e.value,v=zo(e)):Ni(e)?(d=()=>c(e),v=!0):at(e)?(g=!0,v=e.some(w=>Ni(w)||zo(w)),d=()=>e.map(w=>{if(Vt(w))return w.value;if(Ni(w))return c(w);if(ut(w))return s?s(w,2):w()})):ut(e)?t?d=s?()=>s(e,2):e:d=()=>{if(f){Vi();try{f()}finally{Wi()}}const w=ul;ul=u;try{return s?s(e,3,[h]):e(h)}finally{ul=w}}:d=Ir,t&&r){const w=d,C=r===!0?1/0:r;d=()=>Ur(w(),C)}const b=ub(),y=()=>{u.stop(),b&&b.active&&sb(b.effects,u)};if(i&&t){const w=t;t=(...C)=>{w(...C),y()}}let S=g?new Array(e.length).fill(Pu):Pu;const $=w=>{if(!(!(u.flags&1)||!u.dirty&&!w))if(t){const C=u.run();if(r||v||(g?C.some((O,x)=>so(O,S[x])):so(C,S))){f&&f();const O=ul;ul=u;try{const x=[C,S===Pu?void 0:g&&S[0]===Pu?[]:S,h];s?s(t,3,x):t(...x),S=C}finally{ul=O}}}else u.run()};return a&&a($),u=new W8(d),u.scheduler=l?()=>l($,!1):$,h=w=>rA(w,!1,u),f=u.onStop=()=>{const w=pf.get(u);if(w){if(s)s(w,4);else for(const C of w)C();pf.delete(u)}},t?o?$(!0):S=u.run():l?l($.bind(null,!0),!0):u.run(),y.pause=u.pause.bind(u),y.resume=u.resume.bind(u),y.stop=y,y}function Ur(e,t=1/0,n){if(t<=0||!Ht(e)||e.__v_skip||(n=n||new Set,n.has(e)))return e;if(n.add(e),t--,Vt(e))Ur(e.value,t,n);else if(at(e))for(let o=0;o{Ur(o,t,n)});else if(N8(e)){for(const o in e)Ur(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&Ur(e[o],t,n)}return e}/** +* @vue/runtime-core v3.5.13 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function Xc(e,t,n,o){try{return o?e(...o):e()}catch(r){Ep(r,t,n)}}function ir(e,t,n,o){if(ut(e)){const r=Xc(e,t,n,o);return r&&D8(r)&&r.catch(i=>{Ep(i,t,n)}),r}if(at(e)){const r=[];for(let i=0;i>>1,r=Yn[o],i=mc(r);i=mc(n)?Yn.push(e):Yn.splice(aA(t),0,e),e.flags|=1,d6()}}function d6(){hf||(hf=u6.then(p6))}function sA(e){at(e)?_a.push(...e):xi&&e.id===-1?xi.splice(ga+1,0,e):e.flags&1||(_a.push(e),e.flags|=1),d6()}function i$(e,t,n=Cr+1){for(;nmc(n)-mc(o));if(_a.length=0,xi){xi.push(...t);return}for(xi=t,ga=0;gae.id==null?e.flags&2?-1:1/0:e.id;function p6(e){try{for(Cr=0;Cr{o._d&&b$(-1);const i=gf(t);let l;try{l=e(...r)}finally{gf(i),o._d&&b$(1)}return l};return o._n=!0,o._c=!0,o._d=!0,o}function Ln(e,t){if(vn===null)return e;const n=kp(vn),o=e.dirs||(e.dirs=[]);for(let r=0;re.__isTeleport,Gs=e=>e&&(e.disabled||e.disabled===""),l$=e=>e&&(e.defer||e.defer===""),a$=e=>typeof SVGElement<"u"&&e instanceof SVGElement,s$=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,hm=(e,t)=>{const n=e&&e.to;return Kt(n)?t?t(n):null:n},m6={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,i,l,a,s,c){const{mc:u,pc:d,pbc:f,o:{insert:h,querySelector:v,createText:g,createComment:b}}=c,y=Gs(t.props);let{shapeFlag:S,children:$,dynamicChildren:w}=t;if(e==null){const C=t.el=g(""),O=t.anchor=g("");h(C,n,o),h(O,n,o);const x=(T,M)=>{S&16&&(r&&r.isCE&&(r.ce._teleportTarget=T),u($,T,M,r,i,l,a,s))},I=()=>{const T=t.target=hm(t.props,v),M=b6(T,t,g,h);T&&(l!=="svg"&&a$(T)?l="svg":l!=="mathml"&&s$(T)&&(l="mathml"),y||(x(T,M),dd(t,!1)))};y&&(x(n,O),dd(t,!0)),l$(t.props)?Gn(()=>{I(),t.el.__isMounted=!0},i):I()}else{if(l$(t.props)&&!e.el.__isMounted){Gn(()=>{m6.process(e,t,n,o,r,i,l,a,s,c),delete e.el.__isMounted},i);return}t.el=e.el,t.targetStart=e.targetStart;const C=t.anchor=e.anchor,O=t.target=e.target,x=t.targetAnchor=e.targetAnchor,I=Gs(e.props),T=I?n:O,M=I?C:x;if(l==="svg"||a$(O)?l="svg":(l==="mathml"||s$(O))&&(l="mathml"),w?(f(e.dynamicChildren,w,T,r,i,l,a),Ob(e,t,!0)):s||d(e,t,T,M,r,i,l,a,!1),y)I?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Iu(t,n,C,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const E=t.target=hm(t.props,v);E&&Iu(t,E,null,c,0)}else I&&Iu(t,O,x,c,1);dd(t,y)}},remove(e,t,n,{um:o,o:{remove:r}},i){const{shapeFlag:l,children:a,anchor:s,targetStart:c,targetAnchor:u,target:d,props:f}=e;if(d&&(r(c),r(u)),i&&r(s),l&16){const h=i||!Gs(f);for(let v=0;v{e.isMounted=!0}),et(()=>{e.isUnmounting=!0}),e}const Ro=[Function,Array],S6={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ro,onEnter:Ro,onAfterEnter:Ro,onEnterCancelled:Ro,onBeforeLeave:Ro,onLeave:Ro,onAfterLeave:Ro,onLeaveCancelled:Ro,onBeforeAppear:Ro,onAppear:Ro,onAfterAppear:Ro,onAppearCancelled:Ro},$6=e=>{const t=e.subTree;return t.component?$6(t.component):t},uA={name:"BaseTransition",props:S6,setup(e,{slots:t}){const n=On(),o=y6();return()=>{const r=t.default&&Sb(t.default(),!0);if(!r||!r.length)return;const i=C6(r),l=tt(e),{mode:a}=l;if(o.isLeaving)return Dg(i);const s=c$(i);if(!s)return Dg(i);let c=bc(s,l,o,n,d=>c=d);s.type!==Tn&&Bl(s,c);let u=n.subTree&&c$(n.subTree);if(u&&u.type!==Tn&&!fl(s,u)&&$6(n).type!==Tn){let d=bc(u,l,o,n);if(Bl(u,d),a==="out-in"&&s.type!==Tn)return o.isLeaving=!0,d.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete d.afterLeave,u=void 0},Dg(i);a==="in-out"&&s.type!==Tn?d.delayLeave=(f,h,v)=>{const g=x6(o,u);g[String(u.key)]=u,f[wi]=()=>{h(),f[wi]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{v(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function C6(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Tn){t=n;break}}return t}const dA=uA;function x6(e,t){const{leavingVNodes:n}=e;let o=n.get(t.type);return o||(o=Object.create(null),n.set(t.type,o)),o}function bc(e,t,n,o,r){const{appear:i,mode:l,persisted:a=!1,onBeforeEnter:s,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:h,onAfterLeave:v,onLeaveCancelled:g,onBeforeAppear:b,onAppear:y,onAfterAppear:S,onAppearCancelled:$}=t,w=String(e.key),C=x6(n,e),O=(T,M)=>{T&&ir(T,o,9,M)},x=(T,M)=>{const E=M[1];O(T,M),at(T)?T.every(A=>A.length<=1)&&E():T.length<=1&&E()},I={mode:l,persisted:a,beforeEnter(T){let M=s;if(!n.isMounted)if(i)M=b||s;else return;T[wi]&&T[wi](!0);const E=C[w];E&&fl(e,E)&&E.el[wi]&&E.el[wi](),O(M,[T])},enter(T){let M=c,E=u,A=d;if(!n.isMounted)if(i)M=y||c,E=S||u,A=$||d;else return;let R=!1;const z=T[Tu]=_=>{R||(R=!0,_?O(A,[T]):O(E,[T]),I.delayedLeave&&I.delayedLeave(),T[Tu]=void 0)};M?x(M,[T,z]):z()},leave(T,M){const E=String(e.key);if(T[Tu]&&T[Tu](!0),n.isUnmounting)return M();O(f,[T]);let A=!1;const R=T[wi]=z=>{A||(A=!0,M(),z?O(g,[T]):O(v,[T]),T[wi]=void 0,C[E]===e&&delete C[E])};C[E]=e,h?x(h,[T,R]):R()},clone(T){const M=bc(T,t,n,o,r);return r&&r(M),M}};return I}function Dg(e){if(_p(e))return e=mn(e),e.children=null,e}function c$(e){if(!_p(e))return v6(e.type)&&e.children?C6(e.children):e;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&ut(n.default))return n.default()}}function Bl(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Bl(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Sb(e,t=!1,n){let o=[],r=0;for(let i=0;i1)for(let i=0;ivf(v,t&&(at(t)?t[g]:t),n,o,r));return}if(Ma(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&vf(e,t,n,o.component.subTree);return}const i=o.shapeFlag&4?kp(o.component):o.el,l=r?null:i,{i:a,r:s}=e,c=t&&t.r,u=a.refs===_t?a.refs={}:a.refs,d=a.setupState,f=tt(d),h=d===_t?()=>!1:v=>Rt(f,v);if(c!=null&&c!==s&&(Kt(c)?(u[c]=null,h(c)&&(d[c]=null)):Vt(c)&&(c.value=null)),ut(s))Xc(s,a,12,[l,u]);else{const v=Kt(s),g=Vt(s);if(v||g){const b=()=>{if(e.f){const y=v?h(s)?d[s]:u[s]:s.value;r?at(y)&&sb(y,i):at(y)?y.includes(i)||y.push(i):v?(u[s]=[i],h(s)&&(d[s]=u[s])):(s.value=[i],e.k&&(u[e.k]=s.value))}else v?(u[s]=l,h(s)&&(d[s]=l)):g&&(s.value=l,e.k&&(u[e.k]=l))};l?(b.id=-1,Gn(b,n)):b()}}}Pp().requestIdleCallback;Pp().cancelIdleCallback;const Ma=e=>!!e.type.__asyncLoader,_p=e=>e.type.__isKeepAlive;function Mp(e,t){P6(e,"a",t)}function O6(e,t){P6(e,"da",t)}function P6(e,t,n=xn){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(Ap(t,o,n),n){let r=n.parent;for(;r&&r.parent;)_p(r.parent.vnode)&&fA(o,t,n,r),r=r.parent}}function fA(e,t,n,o){const r=Ap(t,e,o,!0);wn(()=>{sb(o[t],r)},n)}function Ap(e,t,n=xn,o=!1){if(n){const r=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...l)=>{Vi();const a=Yc(n),s=ir(t,n,e,l);return a(),Wi(),s});return o?r.unshift(i):r.push(i),i}}const ai=e=>(t,n=xn)=>{(!Sc||e==="sp")&&Ap(e,(...o)=>t(...o),n)},Rp=ai("bm"),Ke=ai("m"),Dp=ai("bu"),jn=ai("u"),et=ai("bum"),wn=ai("um"),pA=ai("sp"),hA=ai("rtg"),gA=ai("rtc");function vA(e,t=xn){Ap("ec",e,t)}const $b="components",mA="directives";function Ot(e,t){return Cb($b,e,!0,t)||e}const I6=Symbol.for("v-ndc");function bA(e){return Kt(e)?Cb($b,e,!1)||e:e||I6}function yA(e){return Cb(mA,e)}function Cb(e,t,n=!0,o=!1){const r=vn||xn;if(r){const i=r.type;if(e===$b){const a=a9(i,!1);if(a&&(a===t||a===Oo(t)||a===Op(Oo(t))))return i}const l=u$(r[e]||i[e],t)||u$(r.appContext[e],t);return!l&&o?i:l}}function u$(e,t){return e&&(e[t]||e[Oo(t)]||e[Op(Oo(t))])}function xb(e,t,n,o){let r;const i=n,l=at(e);if(l||Kt(e)){const a=l&&Ni(e);let s=!1;a&&(s=!zo(e),e=Tp(e)),r=new Array(e.length);for(let c=0,u=e.length;ct(a,s,void 0,i));else{const a=Object.keys(e);r=new Array(a.length);for(let s=0,c=a.length;sYt(t)?!(t.type===Tn||t.type===Le&&!T6(t.children)):!0)?e:null}const gm=e=>e?X6(e)?kp(e):gm(e.parent):null,Us=pn(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>gm(e.parent),$root:e=>gm(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>_6(e),$forceUpdate:e=>e.f||(e.f=()=>{bb(e.update)}),$nextTick:e=>e.n||(e.n=rt.bind(e.proxy)),$watch:e=>WA.bind(e)}),Bg=(e,t)=>e!==_t&&!e.__isScriptSetup&&Rt(e,t),SA={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,props:i,accessCache:l,type:a,appContext:s}=e;let c;if(t[0]!=="$"){const h=l[t];if(h!==void 0)switch(h){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return i[t]}else{if(Bg(o,t))return l[t]=1,o[t];if(r!==_t&&Rt(r,t))return l[t]=2,r[t];if((c=e.propsOptions[0])&&Rt(c,t))return l[t]=3,i[t];if(n!==_t&&Rt(n,t))return l[t]=4,n[t];vm&&(l[t]=0)}}const u=Us[t];let d,f;if(u)return t==="$attrs"&&Dn(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==_t&&Rt(n,t))return l[t]=4,n[t];if(f=s.config.globalProperties,Rt(f,t))return f[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:i}=e;return Bg(r,t)?(r[t]=n,!0):o!==_t&&Rt(o,t)?(o[t]=n,!0):Rt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,propsOptions:i}},l){let a;return!!n[l]||e!==_t&&Rt(e,l)||Bg(t,l)||(a=i[0])&&Rt(a,l)||Rt(o,l)||Rt(Us,l)||Rt(r.config.globalProperties,l)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Rt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function $A(){return CA().attrs}function CA(){const e=On();return e.setupContext||(e.setupContext=q6(e))}function mf(e){return at(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function f0e(e,t){return!e||!t?e||t:at(e)&&at(t)?e.concat(t):pn({},mf(e),mf(t))}let vm=!0;function xA(e){const t=_6(e),n=e.proxy,o=e.ctx;vm=!1,t.beforeCreate&&d$(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:l,watch:a,provide:s,inject:c,created:u,beforeMount:d,mounted:f,beforeUpdate:h,updated:v,activated:g,deactivated:b,beforeDestroy:y,beforeUnmount:S,destroyed:$,unmounted:w,render:C,renderTracked:O,renderTriggered:x,errorCaptured:I,serverPrefetch:T,expose:M,inheritAttrs:E,components:A,directives:R,filters:z}=t;if(c&&wA(c,o,null),l)for(const N in l){const k=l[N];ut(k)&&(o[N]=k.bind(n))}if(r){const N=r.call(n,n);Ht(N)&&(e.data=ft(N))}if(vm=!0,i)for(const N in i){const k=i[N],F=ut(k)?k.bind(n,n):ut(k.get)?k.get.bind(n,n):Ir,L=!ut(k)&&ut(k.set)?k.set.bind(n):Ir,H=P({get:F,set:L});Object.defineProperty(o,N,{enumerable:!0,configurable:!0,get:()=>H.value,set:j=>H.value=j})}if(a)for(const N in a)E6(a[N],o,n,N);if(s){const N=ut(s)?s.call(n):s;Reflect.ownKeys(N).forEach(k=>{Ye(k,N[k])})}u&&d$(u,e,"c");function D(N,k){at(k)?k.forEach(F=>N(F.bind(n))):k&&N(k.bind(n))}if(D(Rp,d),D(Ke,f),D(Dp,h),D(jn,v),D(Mp,g),D(O6,b),D(vA,I),D(gA,O),D(hA,x),D(et,S),D(wn,w),D(pA,T),at(M))if(M.length){const N=e.exposed||(e.exposed={});M.forEach(k=>{Object.defineProperty(N,k,{get:()=>n[k],set:F=>n[k]=F})})}else e.exposed||(e.exposed={});C&&e.render===Ir&&(e.render=C),E!=null&&(e.inheritAttrs=E),A&&(e.components=A),R&&(e.directives=R),T&&w6(e)}function wA(e,t,n=Ir){at(e)&&(e=mm(e));for(const o in e){const r=e[o];let i;Ht(r)?"default"in r?i=Ge(r.from||o,r.default,!0):i=Ge(r.from||o):i=Ge(r),Vt(i)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>i.value,set:l=>i.value=l}):t[o]=i}}function d$(e,t,n){ir(at(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function E6(e,t,n,o){let r=o.includes(".")?j6(n,o):()=>n[o];if(Kt(e)){const i=t[e];ut(i)&&ye(r,i)}else if(ut(e))ye(r,e.bind(n));else if(Ht(e))if(at(e))e.forEach(i=>E6(i,t,n,o));else{const i=ut(e.handler)?e.handler.bind(n):t[e.handler];ut(i)&&ye(r,i,e)}}function _6(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:l}}=e.appContext,a=i.get(t);let s;return a?s=a:!r.length&&!n&&!o?s=t:(s={},r.length&&r.forEach(c=>bf(s,c,l,!0)),bf(s,t,l)),Ht(t)&&i.set(t,s),s}function bf(e,t,n,o=!1){const{mixins:r,extends:i}=t;i&&bf(e,i,n,!0),r&&r.forEach(l=>bf(e,l,n,!0));for(const l in t)if(!(o&&l==="expose")){const a=OA[l]||n&&n[l];e[l]=a?a(e[l],t[l]):t[l]}return e}const OA={data:f$,props:p$,emits:p$,methods:ks,computed:ks,beforeCreate:Kn,created:Kn,beforeMount:Kn,mounted:Kn,beforeUpdate:Kn,updated:Kn,beforeDestroy:Kn,beforeUnmount:Kn,destroyed:Kn,unmounted:Kn,activated:Kn,deactivated:Kn,errorCaptured:Kn,serverPrefetch:Kn,components:ks,directives:ks,watch:IA,provide:f$,inject:PA};function f$(e,t){return t?e?function(){return pn(ut(e)?e.call(this,this):e,ut(t)?t.call(this,this):t)}:t:e}function PA(e,t){return ks(mm(e),mm(t))}function mm(e){if(at(e)){const t={};for(let n=0;n1)return n&&ut(t)?t.call(o&&o.proxy):t}}function _A(){return!!(xn||vn||wl)}const A6={},R6=()=>Object.create(A6),D6=e=>Object.getPrototypeOf(e)===A6;function MA(e,t,n,o=!1){const r={},i=R6();e.propsDefaults=Object.create(null),B6(e,t,r,i);for(const l in e.propsOptions[0])l in r||(r[l]=void 0);n?e.props=o?r:r6(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function AA(e,t,n,o){const{props:r,attrs:i,vnode:{patchFlag:l}}=e,a=tt(r),[s]=e.propsOptions;let c=!1;if((o||l>0)&&!(l&16)){if(l&8){const u=e.vnode.dynamicProps;for(let d=0;d{s=!0;const[f,h]=N6(d,t,!0);pn(l,f),h&&a.push(...h)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!s)return Ht(e)&&o.set(e,Ta),Ta;if(at(i))for(let u=0;ue[0]==="_"||e==="$stable",wb=e=>at(e)?e.map(Or):[Or(e)],DA=(e,t,n)=>{if(t._n)return t;const o=nt((...r)=>wb(t(...r)),n);return o._c=!1,o},F6=(e,t,n)=>{const o=e._ctx;for(const r in e){if(k6(r))continue;const i=e[r];if(ut(i))t[r]=DA(r,i,o);else if(i!=null){const l=wb(i);t[r]=()=>l}}},L6=(e,t)=>{const n=wb(t);e.slots.default=()=>n},z6=(e,t,n)=>{for(const o in t)(n||o!=="_")&&(e[o]=t[o])},BA=(e,t,n)=>{const o=e.slots=R6();if(e.vnode.shapeFlag&32){const r=t._;r?(z6(o,t,n),n&&k8(o,"_",r,!0)):F6(t,o)}else t&&L6(e,t)},NA=(e,t,n)=>{const{vnode:o,slots:r}=e;let i=!0,l=_t;if(o.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:z6(r,t,n):(i=!t.$stable,F6(t,r)),l=t}else t&&(L6(e,t),l={default:1});if(i)for(const a in r)!k6(a)&&l[a]==null&&delete r[a]},Gn=qA;function kA(e){return FA(e)}function FA(e,t){const n=Pp();n.__VUE__=!0;const{insert:o,remove:r,patchProp:i,createElement:l,createText:a,createComment:s,setText:c,setElementText:u,parentNode:d,nextSibling:f,setScopeId:h=Ir,insertStaticContent:v}=e,g=(V,W,te,ue=null,ie=null,ae=null,ce=void 0,se=null,pe=!!W.dynamicChildren)=>{if(V===W)return;V&&!fl(V,W)&&(ue=U(V),j(V,ie,ae,!0),V=null),W.patchFlag===-2&&(pe=!1,W.dynamicChildren=null);const{type:he,ref:ge,shapeFlag:me}=W;switch(he){case Ki:b(V,W,te,ue);break;case Tn:y(V,W,te,ue);break;case fd:V==null&&S(W,te,ue,ce);break;case Le:A(V,W,te,ue,ie,ae,ce,se,pe);break;default:me&1?C(V,W,te,ue,ie,ae,ce,se,pe):me&6?R(V,W,te,ue,ie,ae,ce,se,pe):(me&64||me&128)&&he.process(V,W,te,ue,ie,ae,ce,se,pe,G)}ge!=null&&ie&&vf(ge,V&&V.ref,ae,W||V,!W)},b=(V,W,te,ue)=>{if(V==null)o(W.el=a(W.children),te,ue);else{const ie=W.el=V.el;W.children!==V.children&&c(ie,W.children)}},y=(V,W,te,ue)=>{V==null?o(W.el=s(W.children||""),te,ue):W.el=V.el},S=(V,W,te,ue)=>{[V.el,V.anchor]=v(V.children,W,te,ue,V.el,V.anchor)},$=({el:V,anchor:W},te,ue)=>{let ie;for(;V&&V!==W;)ie=f(V),o(V,te,ue),V=ie;o(W,te,ue)},w=({el:V,anchor:W})=>{let te;for(;V&&V!==W;)te=f(V),r(V),V=te;r(W)},C=(V,W,te,ue,ie,ae,ce,se,pe)=>{W.type==="svg"?ce="svg":W.type==="math"&&(ce="mathml"),V==null?O(W,te,ue,ie,ae,ce,se,pe):T(V,W,ie,ae,ce,se,pe)},O=(V,W,te,ue,ie,ae,ce,se)=>{let pe,he;const{props:ge,shapeFlag:me,transition:xe,dirs:fe}=V;if(pe=V.el=l(V.type,ae,ge&&ge.is,ge),me&8?u(pe,V.children):me&16&&I(V.children,pe,null,ue,ie,Ng(V,ae),ce,se),fe&&tl(V,null,ue,"created"),x(pe,V,V.scopeId,ce,ue),ge){for(const be in ge)be!=="value"&&!Vs(be)&&i(pe,be,null,ge[be],ae,ue);"value"in ge&&i(pe,"value",null,ge.value,ae),(he=ge.onVnodeBeforeMount)&&mr(he,ue,V)}fe&&tl(V,null,ue,"beforeMount");const de=LA(ie,xe);de&&xe.beforeEnter(pe),o(pe,W,te),((he=ge&&ge.onVnodeMounted)||de||fe)&&Gn(()=>{he&&mr(he,ue,V),de&&xe.enter(pe),fe&&tl(V,null,ue,"mounted")},ie)},x=(V,W,te,ue,ie)=>{if(te&&h(V,te),ue)for(let ae=0;ae{for(let he=pe;he{const se=W.el=V.el;let{patchFlag:pe,dynamicChildren:he,dirs:ge}=W;pe|=V.patchFlag&16;const me=V.props||_t,xe=W.props||_t;let fe;if(te&&nl(te,!1),(fe=xe.onVnodeBeforeUpdate)&&mr(fe,te,W,V),ge&&tl(W,V,te,"beforeUpdate"),te&&nl(te,!0),(me.innerHTML&&xe.innerHTML==null||me.textContent&&xe.textContent==null)&&u(se,""),he?M(V.dynamicChildren,he,se,te,ue,Ng(W,ie),ae):ce||k(V,W,se,null,te,ue,Ng(W,ie),ae,!1),pe>0){if(pe&16)E(se,me,xe,te,ie);else if(pe&2&&me.class!==xe.class&&i(se,"class",null,xe.class,ie),pe&4&&i(se,"style",me.style,xe.style,ie),pe&8){const de=W.dynamicProps;for(let be=0;be{fe&&mr(fe,te,W,V),ge&&tl(W,V,te,"updated")},ue)},M=(V,W,te,ue,ie,ae,ce)=>{for(let se=0;se{if(W!==te){if(W!==_t)for(const ae in W)!Vs(ae)&&!(ae in te)&&i(V,ae,W[ae],null,ie,ue);for(const ae in te){if(Vs(ae))continue;const ce=te[ae],se=W[ae];ce!==se&&ae!=="value"&&i(V,ae,se,ce,ie,ue)}"value"in te&&i(V,"value",W.value,te.value,ie)}},A=(V,W,te,ue,ie,ae,ce,se,pe)=>{const he=W.el=V?V.el:a(""),ge=W.anchor=V?V.anchor:a("");let{patchFlag:me,dynamicChildren:xe,slotScopeIds:fe}=W;fe&&(se=se?se.concat(fe):fe),V==null?(o(he,te,ue),o(ge,te,ue),I(W.children||[],te,ge,ie,ae,ce,se,pe)):me>0&&me&64&&xe&&V.dynamicChildren?(M(V.dynamicChildren,xe,te,ie,ae,ce,se),(W.key!=null||ie&&W===ie.subTree)&&Ob(V,W,!0)):k(V,W,te,ge,ie,ae,ce,se,pe)},R=(V,W,te,ue,ie,ae,ce,se,pe)=>{W.slotScopeIds=se,V==null?W.shapeFlag&512?ie.ctx.activate(W,te,ue,ce,pe):z(W,te,ue,ie,ae,ce,pe):_(V,W,pe)},z=(V,W,te,ue,ie,ae,ce)=>{const se=V.component=o9(V,ue,ie);if(_p(V)&&(se.ctx.renderer=G),r9(se,!1,ce),se.asyncDep){if(ie&&ie.registerDep(se,D,ce),!V.el){const pe=se.subTree=p(Tn);y(null,pe,W,te)}}else D(se,V,W,te,ie,ae,ce)},_=(V,W,te)=>{const ue=W.component=V.component;if(XA(V,W,te))if(ue.asyncDep&&!ue.asyncResolved){N(ue,W,te);return}else ue.next=W,ue.update();else W.el=V.el,ue.vnode=W},D=(V,W,te,ue,ie,ae,ce)=>{const se=()=>{if(V.isMounted){let{next:me,bu:xe,u:fe,parent:de,vnode:be}=V;{const Ce=H6(V);if(Ce){me&&(me.el=be.el,N(V,me,ce)),Ce.asyncDep.then(()=>{V.isUnmounted||se()});return}}let we=me,Te;nl(V,!1),me?(me.el=be.el,N(V,me,ce)):me=be,xe&&Eg(xe),(Te=me.props&&me.props.onVnodeBeforeUpdate)&&mr(Te,de,me,be),nl(V,!0);const Re=v$(V),Se=V.subTree;V.subTree=Re,g(Se,Re,d(Se.el),U(Se),V,ie,ae),me.el=Re.el,we===null&&YA(V,Re.el),fe&&Gn(fe,ie),(Te=me.props&&me.props.onVnodeUpdated)&&Gn(()=>mr(Te,de,me,be),ie)}else{let me;const{el:xe,props:fe}=W,{bm:de,m:be,parent:we,root:Te,type:Re}=V,Se=Ma(W);nl(V,!1),de&&Eg(de),!Se&&(me=fe&&fe.onVnodeBeforeMount)&&mr(me,we,W),nl(V,!0);{Te.ce&&Te.ce._injectChildStyle(Re);const Ce=V.subTree=v$(V);g(null,Ce,te,ue,V,ie,ae),W.el=Ce.el}if(be&&Gn(be,ie),!Se&&(me=fe&&fe.onVnodeMounted)){const Ce=W;Gn(()=>mr(me,we,Ce),ie)}(W.shapeFlag&256||we&&Ma(we.vnode)&&we.vnode.shapeFlag&256)&&V.a&&Gn(V.a,ie),V.isMounted=!0,W=te=ue=null}};V.scope.on();const pe=V.effect=new W8(se);V.scope.off();const he=V.update=pe.run.bind(pe),ge=V.job=pe.runIfDirty.bind(pe);ge.i=V,ge.id=V.uid,pe.scheduler=()=>bb(ge),nl(V,!0),he()},N=(V,W,te)=>{W.component=V;const ue=V.vnode.props;V.vnode=W,V.next=null,AA(V,W.props,ue,te),NA(V,W.children,te),Vi(),i$(V),Wi()},k=(V,W,te,ue,ie,ae,ce,se,pe=!1)=>{const he=V&&V.children,ge=V?V.shapeFlag:0,me=W.children,{patchFlag:xe,shapeFlag:fe}=W;if(xe>0){if(xe&128){L(he,me,te,ue,ie,ae,ce,se,pe);return}else if(xe&256){F(he,me,te,ue,ie,ae,ce,se,pe);return}}fe&8?(ge&16&&ee(he,ie,ae),me!==he&&u(te,me)):ge&16?fe&16?L(he,me,te,ue,ie,ae,ce,se,pe):ee(he,ie,ae,!0):(ge&8&&u(te,""),fe&16&&I(me,te,ue,ie,ae,ce,se,pe))},F=(V,W,te,ue,ie,ae,ce,se,pe)=>{V=V||Ta,W=W||Ta;const he=V.length,ge=W.length,me=Math.min(he,ge);let xe;for(xe=0;xege?ee(V,ie,ae,!0,!1,me):I(W,te,ue,ie,ae,ce,se,pe,me)},L=(V,W,te,ue,ie,ae,ce,se,pe)=>{let he=0;const ge=W.length;let me=V.length-1,xe=ge-1;for(;he<=me&&he<=xe;){const fe=V[he],de=W[he]=pe?Oi(W[he]):Or(W[he]);if(fl(fe,de))g(fe,de,te,null,ie,ae,ce,se,pe);else break;he++}for(;he<=me&&he<=xe;){const fe=V[me],de=W[xe]=pe?Oi(W[xe]):Or(W[xe]);if(fl(fe,de))g(fe,de,te,null,ie,ae,ce,se,pe);else break;me--,xe--}if(he>me){if(he<=xe){const fe=xe+1,de=fexe)for(;he<=me;)j(V[he],ie,ae,!0),he++;else{const fe=he,de=he,be=new Map;for(he=de;he<=xe;he++){const De=W[he]=pe?Oi(W[he]):Or(W[he]);De.key!=null&&be.set(De.key,he)}let we,Te=0;const Re=xe-de+1;let Se=!1,Ce=0;const Pe=new Array(Re);for(he=0;he=Re){j(De,ie,ae,!0);continue}let Ae;if(De.key!=null)Ae=be.get(De.key);else for(we=de;we<=xe;we++)if(Pe[we-de]===0&&fl(De,W[we])){Ae=we;break}Ae===void 0?j(De,ie,ae,!0):(Pe[Ae-de]=he+1,Ae>=Ce?Ce=Ae:Se=!0,g(De,W[Ae],te,null,ie,ae,ce,se,pe),Te++)}const Me=Se?zA(Pe):Ta;for(we=Me.length-1,he=Re-1;he>=0;he--){const De=de+he,Ae=W[De],Fe=De+1{const{el:ae,type:ce,transition:se,children:pe,shapeFlag:he}=V;if(he&6){H(V.component.subTree,W,te,ue);return}if(he&128){V.suspense.move(W,te,ue);return}if(he&64){ce.move(V,W,te,G);return}if(ce===Le){o(ae,W,te);for(let me=0;mese.enter(ae),ie);else{const{leave:me,delayLeave:xe,afterLeave:fe}=se,de=()=>o(ae,W,te),be=()=>{me(ae,()=>{de(),fe&&fe()})};xe?xe(ae,de,be):be()}else o(ae,W,te)},j=(V,W,te,ue=!1,ie=!1)=>{const{type:ae,props:ce,ref:se,children:pe,dynamicChildren:he,shapeFlag:ge,patchFlag:me,dirs:xe,cacheIndex:fe}=V;if(me===-2&&(ie=!1),se!=null&&vf(se,null,te,V,!0),fe!=null&&(W.renderCache[fe]=void 0),ge&256){W.ctx.deactivate(V);return}const de=ge&1&&xe,be=!Ma(V);let we;if(be&&(we=ce&&ce.onVnodeBeforeUnmount)&&mr(we,W,V),ge&6)X(V.component,te,ue);else{if(ge&128){V.suspense.unmount(te,ue);return}de&&tl(V,null,W,"beforeUnmount"),ge&64?V.type.remove(V,W,te,G,ue):he&&!he.hasOnce&&(ae!==Le||me>0&&me&64)?ee(he,W,te,!1,!0):(ae===Le&&me&384||!ie&&ge&16)&&ee(pe,W,te),ue&&Y(V)}(be&&(we=ce&&ce.onVnodeUnmounted)||de)&&Gn(()=>{we&&mr(we,W,V),de&&tl(V,null,W,"unmounted")},te)},Y=V=>{const{type:W,el:te,anchor:ue,transition:ie}=V;if(W===Le){Z(te,ue);return}if(W===fd){w(V);return}const ae=()=>{r(te),ie&&!ie.persisted&&ie.afterLeave&&ie.afterLeave()};if(V.shapeFlag&1&&ie&&!ie.persisted){const{leave:ce,delayLeave:se}=ie,pe=()=>ce(te,ae);se?se(V.el,ae,pe):pe()}else ae()},Z=(V,W)=>{let te;for(;V!==W;)te=f(V),r(V),V=te;r(W)},X=(V,W,te)=>{const{bum:ue,scope:ie,job:ae,subTree:ce,um:se,m:pe,a:he}=V;g$(pe),g$(he),ue&&Eg(ue),ie.stop(),ae&&(ae.flags|=8,j(ce,V,W,te)),se&&Gn(se,W),Gn(()=>{V.isUnmounted=!0},W),W&&W.pendingBranch&&!W.isUnmounted&&V.asyncDep&&!V.asyncResolved&&V.suspenseId===W.pendingId&&(W.deps--,W.deps===0&&W.resolve())},ee=(V,W,te,ue=!1,ie=!1,ae=0)=>{for(let ce=ae;ce{if(V.shapeFlag&6)return U(V.component.subTree);if(V.shapeFlag&128)return V.suspense.next();const W=f(V.anchor||V.el),te=W&&W[g6];return te?f(te):W};let Q=!1;const J=(V,W,te)=>{V==null?W._vnode&&j(W._vnode,null,null,!0):g(W._vnode||null,V,W,null,null,null,te),W._vnode=V,Q||(Q=!0,i$(),f6(),Q=!1)},G={p:g,um:j,m:H,r:Y,mt:z,mc:I,pc:k,pbc:M,n:U,o:e};return{render:J,hydrate:void 0,createApp:EA(J)}}function Ng({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function nl({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function LA(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ob(e,t,n=!1){const o=e.children,r=t.children;if(at(o)&&at(r))for(let i=0;i>1,e[n[a]]0&&(t[o]=n[i-1]),n[i]=o)}}for(i=n.length,l=n[i-1];i-- >0;)n[i]=l,l=t[l];return n}function H6(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:H6(t)}function g$(e){if(e)for(let t=0;tGe(HA);function Ve(e,t){return Bp(e,null,t)}function VA(e,t){return Bp(e,null,{flush:"sync"})}function ye(e,t,n){return Bp(e,t,n)}function Bp(e,t,n=_t){const{immediate:o,deep:r,flush:i,once:l}=n,a=pn({},n),s=t&&o||!t&&i!=="post";let c;if(Sc){if(i==="sync"){const h=jA();c=h.__watcherHandles||(h.__watcherHandles=[])}else if(!s){const h=()=>{};return h.stop=Ir,h.resume=Ir,h.pause=Ir,h}}const u=xn;a.call=(h,v,g)=>ir(h,u,v,g);let d=!1;i==="post"?a.scheduler=h=>{Gn(h,u&&u.suspense)}:i!=="sync"&&(d=!0,a.scheduler=(h,v)=>{v?h():bb(h)}),a.augmentJob=h=>{t&&(h.flags|=4),d&&(h.flags|=2,u&&(h.id=u.uid,h.i=u))};const f=iA(e,t,a);return Sc&&(c?c.push(f):s&&f()),f}function WA(e,t,n){const o=this.proxy,r=Kt(e)?e.includes(".")?j6(o,e):()=>o[e]:e.bind(o,o);let i;ut(t)?i=t:(i=t.handler,n=t);const l=Yc(this),a=Bp(r,i.bind(o),n);return l(),a}function j6(e,t){const n=t.split(".");return()=>{let o=e;for(let r=0;r{let u,d=_t,f;return VA(()=>{const h=e[r];so(u,h)&&(u=h,c())}),{get(){return s(),n.get?n.get(u):u},set(h){const v=n.set?n.set(h):h;if(!so(v,u)&&!(d!==_t&&so(h,d)))return;const g=o.vnode.props;g&&(t in g||r in g||i in g)&&(`onUpdate:${t}`in g||`onUpdate:${r}`in g||`onUpdate:${i}`in g)||(u=h,c()),o.emit(`update:${t}`,v),so(h,v)&&so(h,d)&&!so(v,f)&&c(),d=h,f=v}}});return a[Symbol.iterator]=()=>{let s=0;return{next(){return s<2?{value:s++?l||_t:a,done:!1}:{done:!0}}}},a}const V6=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Oo(t)}Modifiers`]||e[`${li(t)}Modifiers`];function KA(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||_t;let r=n;const i=t.startsWith("update:"),l=i&&V6(o,t.slice(7));l&&(l.trim&&(r=n.map(u=>Kt(u)?u.trim():u)),l.number&&(r=n.map(xM)));let a,s=o[a=Tg(t)]||o[a=Tg(Oo(t))];!s&&i&&(s=o[a=Tg(li(t))]),s&&ir(s,e,6,r);const c=o[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,ir(c,e,6,r)}}function W6(e,t,n=!1){const o=t.emitsCache,r=o.get(e);if(r!==void 0)return r;const i=e.emits;let l={},a=!1;if(!ut(e)){const s=c=>{const u=W6(c,t,!0);u&&(a=!0,pn(l,u))};!n&&t.mixins.length&&t.mixins.forEach(s),e.extends&&s(e.extends),e.mixins&&e.mixins.forEach(s)}return!i&&!a?(Ht(e)&&o.set(e,null),null):(at(i)?i.forEach(s=>l[s]=null):pn(l,i),Ht(e)&&o.set(e,l),l)}function Np(e,t){return!e||!Cp(t)?!1:(t=t.slice(2).replace(/Once$/,""),Rt(e,t[0].toLowerCase()+t.slice(1))||Rt(e,li(t))||Rt(e,t))}function v$(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[i],slots:l,attrs:a,emit:s,render:c,renderCache:u,props:d,data:f,setupState:h,ctx:v,inheritAttrs:g}=e,b=gf(e);let y,S;try{if(n.shapeFlag&4){const w=r||o,C=w;y=Or(c.call(C,w,u,d,h,f,v)),S=a}else{const w=t;y=Or(w.length>1?w(d,{attrs:a,slots:l,emit:s}):w(d,null)),S=t.props?a:GA(a)}}catch(w){Xs.length=0,Ep(w,e,1),y=p(Tn)}let $=y;if(S&&g!==!1){const w=Object.keys(S),{shapeFlag:C}=$;w.length&&C&7&&(i&&w.some(ab)&&(S=UA(S,i)),$=mn($,S,!1,!0))}return n.dirs&&($=mn($,null,!1,!0),$.dirs=$.dirs?$.dirs.concat(n.dirs):n.dirs),n.transition&&Bl($,n.transition),y=$,gf(b),y}const GA=e=>{let t;for(const n in e)(n==="class"||n==="style"||Cp(n))&&((t||(t={}))[n]=e[n]);return t},UA=(e,t)=>{const n={};for(const o in e)(!ab(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function XA(e,t,n){const{props:o,children:r,component:i}=e,{props:l,children:a,patchFlag:s}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&s>=0){if(s&1024)return!0;if(s&16)return o?m$(o,l,c):!!l;if(s&8){const u=t.dynamicProps;for(let d=0;de.__isSuspense;function qA(e,t){t&&t.pendingBranch?at(e)?t.effects.push(...e):t.effects.push(e):sA(e)}const Le=Symbol.for("v-fgt"),Ki=Symbol.for("v-txt"),Tn=Symbol.for("v-cmt"),fd=Symbol.for("v-stc"),Xs=[];let Co=null;function bt(e=!1){Xs.push(Co=e?null:[])}function JA(){Xs.pop(),Co=Xs[Xs.length-1]||null}let yc=1;function b$(e,t=!1){yc+=e,e<0&&Co&&t&&(Co.hasOnce=!0)}function G6(e){return e.dynamicChildren=yc>0?Co||Ta:null,JA(),yc>0&&Co&&Co.push(e),e}function nn(e,t,n,o,r,i){return G6(Ct(e,t,n,o,r,i,!0))}function dn(e,t,n,o,r){return G6(p(e,t,n,o,r,!0))}function Yt(e){return e?e.__v_isVNode===!0:!1}function fl(e,t){return e.type===t.type&&e.key===t.key}const U6=({key:e})=>e??null,pd=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Kt(e)||Vt(e)||ut(e)?{i:vn,r:e,k:t,f:!!n}:e:null);function Ct(e,t=null,n=null,o=0,r=null,i=e===Le?0:1,l=!1,a=!1){const s={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&U6(t),ref:t&&pd(t),scopeId:h6,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:vn};return a?(Pb(s,n),i&128&&e.normalize(s)):n&&(s.shapeFlag|=Kt(n)?8:16),yc>0&&!l&&Co&&(s.patchFlag>0||i&6)&&s.patchFlag!==32&&Co.push(s),s}const p=ZA;function ZA(e,t=null,n=null,o=0,r=null,i=!1){if((!e||e===I6)&&(e=Tn),Yt(e)){const a=mn(e,t,!0);return n&&Pb(a,n),yc>0&&!i&&Co&&(a.shapeFlag&6?Co[Co.indexOf(e)]=a:Co.push(a)),a.patchFlag=-2,a}if(s9(e)&&(e=e.__vccOpts),t){t=QA(t);let{class:a,style:s}=t;a&&!Kt(a)&&(t.class=Uc(a)),Ht(s)&&(vb(s)&&!at(s)&&(s=pn({},s)),t.style=Bi(s))}const l=Kt(e)?1:K6(e)?128:v6(e)?64:Ht(e)?4:ut(e)?2:0;return Ct(e,t,n,o,r,l,i,!0)}function QA(e){return e?vb(e)||D6(e)?pn({},e):e:null}function mn(e,t,n=!1,o=!1){const{props:r,ref:i,patchFlag:l,children:a,transition:s}=e,c=t?e9(r||{},t):r,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&U6(c),ref:t&&t.ref?n&&i?at(i)?i.concat(pd(t)):[i,pd(t)]:pd(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Le?l===-1?16:l|16:l,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:s,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&mn(e.ssContent),ssFallback:e.ssFallback&&mn(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return s&&o&&Bl(u,s.clone(u)),u}function Pt(e=" ",t=0){return p(Ki,null,e,t)}function h0e(e,t){const n=p(fd,null,e);return n.staticCount=t,n}function $n(e="",t=!1){return t?(bt(),dn(Tn,null,e)):p(Tn,null,e)}function Or(e){return e==null||typeof e=="boolean"?p(Tn):at(e)?p(Le,null,e.slice()):Yt(e)?Oi(e):p(Ki,null,String(e))}function Oi(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:mn(e)}function Pb(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(at(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),Pb(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!D6(t)?t._ctx=vn:r===3&&vn&&(vn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else ut(t)?(t={default:t,_ctx:vn},n=32):(t=String(t),o&64?(n=16,t=[Pt(t)]):n=8);e.children=t,e.shapeFlag|=n}function e9(...e){const t={};for(let n=0;nxn||vn;let yf,ym;{const e=Pp(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),i=>{r.length>1?r.forEach(l=>l(i)):r[0](i)}};yf=t("__VUE_INSTANCE_SETTERS__",n=>xn=n),ym=t("__VUE_SSR_SETTERS__",n=>Sc=n)}const Yc=e=>{const t=xn;return yf(e),e.scope.on(),()=>{e.scope.off(),yf(t)}},y$=()=>{xn&&xn.scope.off(),yf(null)};function X6(e){return e.vnode.shapeFlag&4}let Sc=!1;function r9(e,t=!1,n=!1){t&&ym(t);const{props:o,children:r}=e.vnode,i=X6(e);MA(e,o,i,t),BA(e,r,n);const l=i?i9(e,t):void 0;return t&&ym(!1),l}function i9(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,SA);const{setup:o}=n;if(o){Vi();const r=e.setupContext=o.length>1?q6(e):null,i=Yc(e),l=Xc(o,e,0,[e.props,r]),a=D8(l);if(Wi(),i(),(a||e.sp)&&!Ma(e)&&w6(e),a){if(l.then(y$,y$),t)return l.then(s=>{S$(e,s)}).catch(s=>{Ep(s,e,0)});e.asyncDep=l}else S$(e,l)}else Y6(e)}function S$(e,t,n){ut(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ht(t)&&(e.setupState=s6(t)),Y6(e)}function Y6(e,t,n){const o=e.type;e.render||(e.render=o.render||Ir);{const r=Yc(e);Vi();try{xA(e)}finally{Wi(),r()}}}const l9={get(e,t){return Dn(e,"get",""),e[t]}};function q6(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,l9),slots:e.slots,emit:e.emit,expose:t}}function kp(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(s6(mb(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Us)return Us[n](e)},has(t,n){return n in t||n in Us}})):e.proxy}function a9(e,t=!0){return ut(e)?e.displayName||e.name:e.name||t&&e.__name}function s9(e){return ut(e)&&"__vccOpts"in e}const P=(e,t)=>oA(e,t,Sc);function tn(e,t,n){const o=arguments.length;return o===2?Ht(t)&&!at(t)?Yt(t)?p(e,null,[t]):p(e,t):p(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&Yt(n)&&(n=[n]),p(e,t,n))}const c9="3.5.13";/** +* @vue/runtime-dom v3.5.13 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let Sm;const $$=typeof window<"u"&&window.trustedTypes;if($$)try{Sm=$$.createPolicy("vue",{createHTML:e=>e})}catch{}const J6=Sm?e=>Sm.createHTML(e):e=>e,u9="http://www.w3.org/2000/svg",d9="http://www.w3.org/1998/Math/MathML",Vr=typeof document<"u"?document:null,C$=Vr&&Vr.createElement("template"),f9={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const r=t==="svg"?Vr.createElementNS(u9,e):t==="mathml"?Vr.createElementNS(d9,e):n?Vr.createElement(e,{is:n}):Vr.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>Vr.createTextNode(e),createComment:e=>Vr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Vr.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,i){const l=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===i||!(r=r.nextSibling)););else{C$.innerHTML=J6(o==="svg"?`${e}`:o==="mathml"?`${e}`:e);const a=C$.content;if(o==="svg"||o==="mathml"){const s=a.firstChild;for(;s.firstChild;)a.appendChild(s.firstChild);a.removeChild(s)}t.insertBefore(a,n)}return[l?l.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},vi="transition",Ps="animation",Ka=Symbol("_vtc"),Z6={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Q6=pn({},S6,Z6),p9=e=>(e.displayName="Transition",e.props=Q6,e),bn=p9((e,{slots:t})=>tn(dA,eO(e),t)),ol=(e,t=[])=>{at(e)?e.forEach(n=>n(...t)):e&&e(...t)},x$=e=>e?at(e)?e.some(t=>t.length>1):e.length>1:!1;function eO(e){const t={};for(const A in e)A in Z6||(t[A]=e[A]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,enterFromClass:i=`${n}-enter-from`,enterActiveClass:l=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:s=i,appearActiveClass:c=l,appearToClass:u=a,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:h=`${n}-leave-to`}=e,v=h9(r),g=v&&v[0],b=v&&v[1],{onBeforeEnter:y,onEnter:S,onEnterCancelled:$,onLeave:w,onLeaveCancelled:C,onBeforeAppear:O=y,onAppear:x=S,onAppearCancelled:I=$}=t,T=(A,R,z,_)=>{A._enterCancelled=_,Si(A,R?u:a),Si(A,R?c:l),z&&z()},M=(A,R)=>{A._isLeaving=!1,Si(A,d),Si(A,h),Si(A,f),R&&R()},E=A=>(R,z)=>{const _=A?x:S,D=()=>T(R,A,z);ol(_,[R,D]),w$(()=>{Si(R,A?s:i),yr(R,A?u:a),x$(_)||O$(R,o,g,D)})};return pn(t,{onBeforeEnter(A){ol(y,[A]),yr(A,i),yr(A,l)},onBeforeAppear(A){ol(O,[A]),yr(A,s),yr(A,c)},onEnter:E(!1),onAppear:E(!0),onLeave(A,R){A._isLeaving=!0;const z=()=>M(A,R);yr(A,d),A._enterCancelled?(yr(A,f),$m()):($m(),yr(A,f)),w$(()=>{A._isLeaving&&(Si(A,d),yr(A,h),x$(w)||O$(A,o,b,z))}),ol(w,[A,z])},onEnterCancelled(A){T(A,!1,void 0,!0),ol($,[A])},onAppearCancelled(A){T(A,!0,void 0,!0),ol(I,[A])},onLeaveCancelled(A){M(A),ol(C,[A])}})}function h9(e){if(e==null)return null;if(Ht(e))return[kg(e.enter),kg(e.leave)];{const t=kg(e);return[t,t]}}function kg(e){return wM(e)}function yr(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ka]||(e[Ka]=new Set)).add(t)}function Si(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[Ka];n&&(n.delete(t),n.size||(e[Ka]=void 0))}function w$(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let g9=0;function O$(e,t,n,o){const r=e._endId=++g9,i=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(i,n);const{type:l,timeout:a,propCount:s}=tO(e,t);if(!l)return o();const c=l+"end";let u=0;const d=()=>{e.removeEventListener(c,f),i()},f=h=>{h.target===e&&++u>=s&&d()};setTimeout(()=>{u(n[v]||"").split(", "),r=o(`${vi}Delay`),i=o(`${vi}Duration`),l=P$(r,i),a=o(`${Ps}Delay`),s=o(`${Ps}Duration`),c=P$(a,s);let u=null,d=0,f=0;t===vi?l>0&&(u=vi,d=l,f=i.length):t===Ps?c>0&&(u=Ps,d=c,f=s.length):(d=Math.max(l,c),u=d>0?l>c?vi:Ps:null,f=u?u===vi?i.length:s.length:0);const h=u===vi&&/\b(transform|all)(,|$)/.test(o(`${vi}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:h}}function P$(e,t){for(;e.lengthI$(n)+I$(e[o])))}function I$(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function $m(){return document.body.offsetHeight}function v9(e,t,n){const o=e[Ka];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Sf=Symbol("_vod"),nO=Symbol("_vsh"),Qn={beforeMount(e,{value:t},{transition:n}){e[Sf]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Is(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:o}){!t!=!n&&(o?t?(o.beforeEnter(e),Is(e,!0),o.enter(e)):o.leave(e,()=>{Is(e,!1)}):Is(e,t))},beforeUnmount(e,{value:t}){Is(e,t)}};function Is(e,t){e.style.display=t?e[Sf]:"none",e[nO]=!t}const m9=Symbol(""),b9=/(^|;)\s*display\s*:/;function y9(e,t,n){const o=e.style,r=Kt(n);let i=!1;if(n&&!r){if(t)if(Kt(t))for(const l of t.split(";")){const a=l.slice(0,l.indexOf(":")).trim();n[a]==null&&hd(o,a,"")}else for(const l in t)n[l]==null&&hd(o,l,"");for(const l in n)l==="display"&&(i=!0),hd(o,l,n[l])}else if(r){if(t!==n){const l=o[m9];l&&(n+=";"+l),o.cssText=n,i=b9.test(n)}}else t&&e.removeAttribute("style");Sf in e&&(e[Sf]=i?o.display:"",e[nO]&&(o.display="none"))}const T$=/\s*!important$/;function hd(e,t,n){if(at(n))n.forEach(o=>hd(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=S9(e,t);T$.test(n)?e.setProperty(li(o),n.replace(T$,""),"important"):e[o]=n}}const E$=["Webkit","Moz","ms"],Fg={};function S9(e,t){const n=Fg[t];if(n)return n;let o=Oo(t);if(o!=="filter"&&o in e)return Fg[t]=o;o=Op(o);for(let r=0;rLg||(O9.then(()=>Lg=0),Lg=Date.now());function I9(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;ir(T9(o,n.value),t,5,[o])};return n.value=e,n.attached=P9(),n}function T9(e,t){if(at(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(o=>r=>!r._stopped&&o&&o(r))}else return t}const B$=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,E9=(e,t,n,o,r,i)=>{const l=r==="svg";t==="class"?v9(e,o,l):t==="style"?y9(e,n,o):Cp(t)?ab(t)||x9(e,t,n,o,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):_9(e,t,o,l))?(A$(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&M$(e,t,o,l,i,t!=="value")):e._isVueCE&&(/[A-Z]/.test(t)||!Kt(o))?A$(e,Oo(t),o,i,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),M$(e,t,o,l))};function _9(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&B$(t)&&ut(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return B$(t)&&Kt(n)?!1:t in e}const oO=new WeakMap,rO=new WeakMap,$f=Symbol("_moveCb"),N$=Symbol("_enterCb"),M9=e=>(delete e.props.mode,e),A9=M9({name:"TransitionGroup",props:pn({},Q6,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=On(),o=y6();let r,i;return jn(()=>{if(!r.length)return;const l=e.moveClass||`${e.name||"v"}-move`;if(!N9(r[0].el,n.vnode.el,l))return;r.forEach(R9),r.forEach(D9);const a=r.filter(B9);$m(),a.forEach(s=>{const c=s.el,u=c.style;yr(c,l),u.transform=u.webkitTransform=u.transitionDuration="";const d=c[$f]=f=>{f&&f.target!==c||(!f||/transform$/.test(f.propertyName))&&(c.removeEventListener("transitionend",d),c[$f]=null,Si(c,l))};c.addEventListener("transitionend",d)})}),()=>{const l=tt(e),a=eO(l);let s=l.tag||Le;if(r=[],i)for(let c=0;c{a.split(/\s+/).forEach(s=>s&&o.classList.remove(s))}),n.split(/\s+/).forEach(a=>a&&o.classList.add(a)),o.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(o);const{hasTransform:l}=tO(o);return i.removeChild(o),l}const k9=["ctrl","shift","alt","meta"],F9={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>k9.some(n=>e[`${n}Key`]&&!t.includes(n))},k$=(e,t)=>{const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...i)=>{for(let l=0;l{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const i=li(r.key);if(t.some(l=>l===i||L9[l]===i))return e(r)})},z9=pn({patchProp:E9},f9);let F$;function iO(){return F$||(F$=kA(z9))}const Hi=(...e)=>{iO().render(...e)},lO=(...e)=>{const t=iO().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=j9(o);if(!r)return;const i=t._component;!ut(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const l=n(r,!1,H9(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),l},t};function H9(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function j9(e){return Kt(e)?document.querySelector(e):e}/*! + * pinia v2.3.1 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */let aO;const Lp=e=>aO=e,sO=Symbol();function Cm(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Ys;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Ys||(Ys={}));function V9(){const e=j8(!0),t=e.run(()=>ne({}));let n=[],o=[];const r=mb({install(i){Lp(r),r._a=i,i.provide(sO,r),i.config.globalProperties.$pinia=r,o.forEach(l=>n.push(l)),o=[]},use(i){return this._a?n.push(i):o.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return r}const cO=()=>{};function L$(e,t,n,o=cO){e.push(t);const r=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),o())};return!n&&ub()&&V8(r),r}function la(e,...t){e.slice().forEach(n=>{n(...t)})}const W9=e=>e(),z$=Symbol(),zg=Symbol();function xm(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,o)=>e.set(o,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const o=t[n],r=e[n];Cm(r)&&Cm(o)&&e.hasOwnProperty(n)&&!Vt(o)&&!Ni(o)?e[n]=xm(r,o):e[n]=o}return e}const K9=Symbol();function G9(e){return!Cm(e)||!e.hasOwnProperty(K9)}const{assign:$i}=Object;function U9(e){return!!(Vt(e)&&e.effect)}function X9(e,t,n,o){const{state:r,actions:i,getters:l}=t,a=n.state.value[e];let s;function c(){a||(n.state.value[e]=r?r():{});const u=nr(n.state.value[e]);return $i(u,i,Object.keys(l||{}).reduce((d,f)=>(d[f]=mb(P(()=>{Lp(n);const h=n._s.get(e);return l[f].call(h,h)})),d),{}))}return s=uO(e,c,t,n,o,!0),s}function uO(e,t,n={},o,r,i){let l;const a=$i({actions:{}},n),s={deep:!0};let c,u,d=[],f=[],h;const v=o.state.value[e];!i&&!v&&(o.state.value[e]={}),ne({});let g;function b(I){let T;c=u=!1,typeof I=="function"?(I(o.state.value[e]),T={type:Ys.patchFunction,storeId:e,events:h}):(xm(o.state.value[e],I),T={type:Ys.patchObject,payload:I,storeId:e,events:h});const M=g=Symbol();rt().then(()=>{g===M&&(c=!0)}),u=!0,la(d,T,o.state.value[e])}const y=i?function(){const{state:T}=n,M=T?T():{};this.$patch(E=>{$i(E,M)})}:cO;function S(){l.stop(),d=[],f=[],o._s.delete(e)}const $=(I,T="")=>{if(z$ in I)return I[zg]=T,I;const M=function(){Lp(o);const E=Array.from(arguments),A=[],R=[];function z(N){A.push(N)}function _(N){R.push(N)}la(f,{args:E,name:M[zg],store:C,after:z,onError:_});let D;try{D=I.apply(this&&this.$id===e?this:C,E)}catch(N){throw la(R,N),N}return D instanceof Promise?D.then(N=>(la(A,N),N)).catch(N=>(la(R,N),Promise.reject(N))):(la(A,D),D)};return M[z$]=!0,M[zg]=T,M},w={_p:o,$id:e,$onAction:L$.bind(null,f),$patch:b,$reset:y,$subscribe(I,T={}){const M=L$(d,I,T.detached,()=>E()),E=l.run(()=>ye(()=>o.state.value[e],A=>{(T.flush==="sync"?u:c)&&I({storeId:e,type:Ys.direct,events:h},A)},$i({},s,T)));return M},$dispose:S},C=ft(w);o._s.set(e,C);const x=(o._a&&o._a.runWithContext||W9)(()=>o._e.run(()=>(l=j8()).run(()=>t({action:$}))));for(const I in x){const T=x[I];if(Vt(T)&&!U9(T)||Ni(T))i||(v&&G9(T)&&(Vt(T)?T.value=v[I]:xm(T,v[I])),o.state.value[e][I]=T);else if(typeof T=="function"){const M=$(T,I);x[I]=M,a.actions[I]=T}}return $i(C,x),$i(tt(C),x),Object.defineProperty(C,"$state",{get:()=>o.state.value[e],set:I=>{b(T=>{$i(T,I)})}}),o._p.forEach(I=>{$i(C,l.run(()=>I({store:C,app:o._a,pinia:o,options:a})))}),v&&i&&n.hydrate&&n.hydrate(C.$state,v),c=!0,u=!0,C}/*! #__NO_SIDE_EFFECTS__ */function dO(e,t,n){let o,r;const i=typeof t=="function";typeof e=="string"?(o=e,r=i?n:t):(r=e,o=e.id);function l(a,s){const c=_A();return a=a||(c?Ge(sO,null):null),a&&Lp(a),a=aO,a._s.has(o)||(i?uO(o,t,r,a):X9(o,r,a)),a._s.get(o)}return l.$id=o,l}function $c(e){"@babel/helpers - typeof";return $c=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},$c(e)}function Y9(e,t){if($c(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if($c(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function q9(e){var t=Y9(e,"string");return $c(t)=="symbol"?t:t+""}function J9(e,t,n){return(t=q9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function B(e){for(var t=1;ttypeof e=="function",Z9=Array.isArray,Q9=e=>typeof e=="string",eR=e=>e!==null&&typeof e=="object",tR=/^on[^a-z]/,nR=e=>tR.test(e),Ib=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},oR=/-(\w)/g,rs=Ib(e=>e.replace(oR,(t,n)=>n?n.toUpperCase():"")),rR=/\B([A-Z])/g,iR=Ib(e=>e.replace(rR,"-$1").toLowerCase()),lR=Ib(e=>e.charAt(0).toUpperCase()+e.slice(1)),aR=Object.prototype.hasOwnProperty,j$=(e,t)=>aR.call(e,t);function sR(e,t,n,o){const r=e[n];if(r!=null){const i=j$(r,"default");if(i&&o===void 0){const l=r.default;o=r.type!==Function&&wm(l)?l():l}r.type===Boolean&&(!j$(t,n)&&!i?o=!1:o===""&&(o=!0))}return o}function cR(e){return Object.keys(e).reduce((t,n)=>((n.startsWith("data-")||n.startsWith("aria-"))&&(t[n]=e[n]),t),{})}function pl(e){return typeof e=="number"?`${e}px`:e}function $a(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return typeof e=="function"?e(t):e??n}function uR(e){let t;const n=new Promise(r=>{t=e(()=>{r(!0)})}),o=()=>{t==null||t()};return o.then=(r,i)=>n.then(r,i),o.promise=n,o}function le(){const e=[];for(let t=0;t0},e.prototype.connect_=function(){!Om||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),vR?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Om||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,o=n===void 0?"":n,r=gR.some(function(i){return!!~o.indexOf(i)});r&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),pO=function(e,t){for(var n=0,o=Object.keys(t);n"u"||!(Element instanceof Object))){if(!(t instanceof Ga(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new OR(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof Ga(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(o){return new PR(o.target,o.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),gO=typeof WeakMap<"u"?new WeakMap:new fO,vO=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=mR.getInstance(),o=new IR(t,n,this);gO.set(this,o)}return e}();["observe","unobserve","disconnect"].forEach(function(e){vO.prototype[e]=function(){var t;return(t=gO.get(this))[e].apply(t,arguments)}});var Tb=function(){return typeof Cf.ResizeObserver<"u"?Cf.ResizeObserver:vO}();const Pm=e=>e!=null&&e!=="",Qe=(e,t)=>{const n=m({},e);return Object.keys(t).forEach(o=>{const r=n[o];if(r)r.type||r.default?r.default=t[o]:r.def?r.def(t[o]):n[o]={type:r,default:t[o]};else throw new Error(`not have ${o} prop`)}),n},Eb=e=>{const t=Object.keys(e),n={},o={},r={};for(let i=0,l=t.length;i0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n={},o=/;(?![^(]*\))/g,r=/:(.+)/;return typeof e=="object"?e:(e.split(o).forEach(function(i){if(i){const l=i.split(r);if(l.length>1){const a=t?rs(l[0].trim()):l[0].trim();n[a]=l[1].trim()}}}),n)},Xr=(e,t)=>e[t]!==void 0,mO=Symbol("skipFlatten"),wt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const n=Array.isArray(e)?e:[e],o=[];return n.forEach(r=>{Array.isArray(r)?o.push(...wt(r,t)):r&&r.type===Le?r.key===mO?o.push(r):o.push(...wt(r.children,t)):r&&Yt(r)?t&&!qc(r)?o.push(r):t||o.push(r):Pm(r)&&o.push(r)}),o},Hp=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"default",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Yt(e))return e.type===Le?t==="default"?wt(e.children):[]:e.children&&e.children[t]?wt(e.children[t](n)):[];{const o=e.$slots[t]&&e.$slots[t](n);return wt(o)}},Jn=e=>{var t;let n=((t=e==null?void 0:e.vnode)===null||t===void 0?void 0:t.el)||e&&(e.$el||e);for(;n&&!n.tagName;)n=n.nextSibling;return n},bO=e=>{const t={};if(e.$&&e.$.vnode){const n=e.$.vnode.props||{};Object.keys(e.$props).forEach(o=>{const r=e.$props[o],i=iR(o);(r!==void 0||i in n)&&(t[o]=r)})}else if(Yt(e)&&typeof e.type=="object"){const n=e.props||{},o={};Object.keys(n).forEach(i=>{o[rs(i)]=n[i]});const r=e.type.props||{};Object.keys(r).forEach(i=>{const l=sR(r,o,i,o[i]);(l!==void 0||i in o)&&(t[i]=l)})}return t},yO=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"default",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,r;if(e.$){const i=e[t];if(i!==void 0)return typeof i=="function"&&o?i(n):i;r=e.$slots[t],r=o&&r?r(n):r}else if(Yt(e)){const i=e.props&&e.props[t];if(i!==void 0&&e.props!==null)return typeof i=="function"&&o?i(n):i;e.type===Le?r=e.children:e.children&&e.children[t]&&(r=e.children[t],r=o&&r?r(n):r)}return Array.isArray(r)&&(r=wt(r),r=r.length===1?r[0]:r,r=r.length===0?void 0:r),r};function W$(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n={};return e.$?n=m(m({},n),e.$attrs):n=m(m({},n),e.props),Eb(n)[t?"onEvents":"events"]}function ER(e){const n=((Yt(e)?e.props:e.$attrs)||{}).class||{};let o={};return typeof n=="string"?n.split(" ").forEach(r=>{o[r.trim()]=!0}):Array.isArray(n)?le(n).split(" ").forEach(r=>{o[r.trim()]=!0}):o=m(m({},o),n),o}function SO(e,t){let o=((Yt(e)?e.props:e.$attrs)||{}).style||{};return typeof o=="string"&&(o=TR(o,t)),o}function _R(e){return e.length===1&&e[0].type===Le}function MR(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function qc(e){return e&&(e.type===Tn||e.type===Le&&e.children.length===0||e.type===Ki&&e.children.trim()==="")}function AR(e){return e&&e.type===Ki}function kt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const t=[];return e.forEach(n=>{Array.isArray(n)?t.push(...n):(n==null?void 0:n.type)===Le?t.push(...kt(n.children)):t.push(n)}),t.filter(n=>!qc(n))}function Ts(e){if(e){const t=kt(e);return t.length?t:void 0}else return e}function qt(e){return Array.isArray(e)&&e.length===1&&(e=e[0]),e&&e.__v_isVNode&&typeof e.type!="symbol"}function ln(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"default";var o,r;return(o=t[n])!==null&&o!==void 0?o:(r=e[n])===null||r===void 0?void 0:r.call(e)}const Vo=re({compatConfig:{MODE:3},name:"ResizeObserver",props:{disabled:Boolean,onResize:Function},emits:["resize"],setup(e,t){let{slots:n}=t;const o=ft({width:0,height:0,offsetHeight:0,offsetWidth:0});let r=null,i=null;const l=()=>{i&&(i.disconnect(),i=null)},a=u=>{const{onResize:d}=e,f=u[0].target,{width:h,height:v}=f.getBoundingClientRect(),{offsetWidth:g,offsetHeight:b}=f,y=Math.floor(h),S=Math.floor(v);if(o.width!==y||o.height!==S||o.offsetWidth!==g||o.offsetHeight!==b){const $={width:y,height:S,offsetWidth:g,offsetHeight:b};m(o,$),d&&Promise.resolve().then(()=>{d(m(m({},$),{offsetWidth:g,offsetHeight:b}),f)})}},s=On(),c=()=>{const{disabled:u}=e;if(u){l();return}const d=Jn(s);d!==r&&(l(),r=d),!i&&d&&(i=new Tb(a),i.observe(d))};return Ke(()=>{c()}),jn(()=>{c()}),wn(()=>{l()}),ye(()=>e.disabled,()=>{c()},{flush:"post"}),()=>{var u;return(u=n.default)===null||u===void 0?void 0:u.call(n)[0]}}});let $O=e=>setTimeout(e,16),CO=e=>clearTimeout(e);typeof window<"u"&&"requestAnimationFrame"in window&&($O=e=>window.requestAnimationFrame(e),CO=e=>window.cancelAnimationFrame(e));let K$=0;const _b=new Map;function xO(e){_b.delete(e)}function Ze(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;K$+=1;const n=K$;function o(r){if(r===0)xO(n),e();else{const i=$O(()=>{o(r-1)});_b.set(n,i)}}return o(t),n}Ze.cancel=e=>{const t=_b.get(e);return xO(t),CO(t)};function Im(e){let t;const n=r=>()=>{t=null,e(...r)},o=function(){if(t==null){for(var r=arguments.length,i=new Array(r),l=0;l{Ze.cancel(t),t=null},o}const Mn=function(){for(var e=arguments.length,t=new Array(e),n=0;n{const t=e;return t.install=function(n){n.component(t.displayName||t.name,e)},e};function Nl(){return{type:[Function,Array]}}function Be(e){return{type:Object,default:e}}function $e(e){return{type:Boolean,default:e}}function ve(e){return{type:Function,default:e}}function It(e,t){return{validator:()=>!0,default:e}}function Nn(){return{validator:()=>!0}}function ct(e){return{type:Array,default:e}}function Ne(e){return{type:String,default:e}}function He(e,t){return e?{type:e,default:t}:It(t)}let on=!1;try{const e=Object.defineProperty({},"passive",{get(){on=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch{}function Nt(e,t,n,o){if(e&&e.addEventListener){let r=o;r===void 0&&on&&(t==="touchstart"||t==="touchmove"||t==="wheel")&&(r={passive:!1}),e.addEventListener(t,n,r)}return{remove:()=>{e&&e.removeEventListener&&e.removeEventListener(t,n)}}}function Eu(e){return e!==window?e.getBoundingClientRect():{top:0,bottom:window.innerHeight}}function G$(e,t,n){if(n!==void 0&&t.top>e.top-n)return`${n+t.top}px`}function U$(e,t,n){if(n!==void 0&&t.bottomo.target===e);n?n.affixList.push(t):(n={target:e,affixList:[t],eventHandlers:{}},qs.push(n),wO.forEach(o=>{n.eventHandlers[o]=Nt(e,o,()=>{n.affixList.forEach(r=>{const{lazyUpdatePosition:i}=r.exposed;i()},(o==="touchstart"||o==="touchmove")&&on?{passive:!0}:!1)})}))}function Y$(e){const t=qs.find(n=>{const o=n.affixList.some(r=>r===e);return o&&(n.affixList=n.affixList.filter(r=>r!==e)),o});t&&t.affixList.length===0&&(qs=qs.filter(n=>n!==t),wO.forEach(n=>{const o=t.eventHandlers[n];o&&o.remove&&o.remove()}))}const Mb="anticon",OO=Symbol("GlobalFormContextKey"),DR=e=>{Ye(OO,e)},BR=()=>Ge(OO,{validateMessages:P(()=>{})}),NR=()=>({iconPrefixCls:String,getTargetContainer:{type:Function},getPopupContainer:{type:Function},prefixCls:String,getPrefixCls:{type:Function},renderEmpty:{type:Function},transformCellText:{type:Function},csp:Be(),input:Be(),autoInsertSpaceInButton:{type:Boolean,default:void 0},locale:Be(),pageHeader:Be(),componentSize:{type:String},componentDisabled:{type:Boolean,default:void 0},direction:{type:String,default:"ltr"},space:Be(),virtual:{type:Boolean,default:void 0},dropdownMatchSelectWidth:{type:[Number,Boolean],default:!0},form:Be(),pagination:Be(),theme:Be(),select:Be(),wave:Be()}),Ab=Symbol("configProvider"),PO={getPrefixCls:(e,t)=>t||(e?`ant-${e}`:"ant"),iconPrefixCls:P(()=>Mb),getPopupContainer:P(()=>()=>document.body),direction:P(()=>"ltr")},jp=()=>Ge(Ab,PO),kR=e=>Ye(Ab,e),IO=Symbol("DisabledContextKey"),po=()=>Ge(IO,ne(void 0)),TO=e=>{const t=po();return Ye(IO,P(()=>{var n;return(n=e.value)!==null&&n!==void 0?n:t.value})),e},EO={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages"},FR={locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"Ok",clear:"Clear",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",yearFormat:"YYYY",dateFormat:"M/D/YYYY",dayFormat:"D",dateTimeFormat:"M/D/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"},_O={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},Cc={lang:m({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},FR),timePickerLocale:m({},_O)},go="${label} is not a valid ${type}",eo={locale:"en",Pagination:EO,DatePicker:Cc,TimePicker:_O,Calendar:Cc,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckall:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand"},PageHeader:{back:"Back"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:go,method:go,array:go,object:go,number:go,date:go,boolean:go,integer:go,float:go,regexp:go,email:go,url:go,hex:go},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"}},Wl=re({compatConfig:{MODE:3},name:"LocaleReceiver",props:{componentName:String,defaultLocale:{type:[Object,Function]},children:{type:Function}},setup(e,t){let{slots:n}=t;const o=Ge("localeData",{}),r=P(()=>{const{componentName:l="global",defaultLocale:a}=e,s=a||eo[l||"global"],{antLocale:c}=o,u=l&&c?c[l]:{};return m(m({},typeof s=="function"?s():s),u||{})}),i=P(()=>{const{antLocale:l}=o,a=l&&l.locale;return l&&l.exist&&!a?eo.locale:a});return()=>{const l=e.children||n.default,{antLocale:a}=o;return l==null?void 0:l(r.value,i.value,a)}}});function Uo(e,t,n){const o=Ge("localeData",{});return[P(()=>{const{antLocale:i}=o,l=je(t)||eo[e||"global"],a=e&&i?i[e]:{};return m(m(m({},typeof l=="function"?l():l),a||{}),je(n)||{})})]}function Rb(e){for(var t=0,n,o=0,r=e.length;r>=4;++o,r-=4)n=e.charCodeAt(o)&255|(e.charCodeAt(++o)&255)<<8|(e.charCodeAt(++o)&255)<<16|(e.charCodeAt(++o)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(r){case 3:t^=(e.charCodeAt(o+2)&255)<<16;case 2:t^=(e.charCodeAt(o+1)&255)<<8;case 1:t^=e.charCodeAt(o)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}const q$="%";class LR{constructor(t){this.cache=new Map,this.instanceId=t}get(t){return this.cache.get(Array.isArray(t)?t.join(q$):t)||null}update(t,n){const o=Array.isArray(t)?t.join(q$):t,r=this.cache.get(o),i=n(r);i===null?this.cache.delete(o):this.cache.set(o,i)}}const MO="data-token-hash",Ol="data-css-hash",Ca="__cssinjs_instance__";function xc(){const e=Math.random().toString(12).slice(2);if(typeof document<"u"&&document.head&&document.body){const t=document.body.querySelectorAll(`style[${Ol}]`)||[],{firstChild:n}=document.head;Array.from(t).forEach(r=>{r[Ca]=r[Ca]||e,r[Ca]===e&&document.head.insertBefore(r,n)});const o={};Array.from(document.querySelectorAll(`style[${Ol}]`)).forEach(r=>{var i;const l=r.getAttribute(Ol);o[l]?r[Ca]===e&&((i=r.parentNode)===null||i===void 0||i.removeChild(r)):o[l]=!0})}return new LR(e)}const AO=Symbol("StyleContextKey"),zR=()=>{var e,t,n;const o=On();let r;if(o&&o.appContext){const i=(n=(t=(e=o.appContext)===null||e===void 0?void 0:e.config)===null||t===void 0?void 0:t.globalProperties)===null||n===void 0?void 0:n.__ANTDV_CSSINJS_CACHE__;i?r=i:(r=xc(),o.appContext.config.globalProperties&&(o.appContext.config.globalProperties.__ANTDV_CSSINJS_CACHE__=r))}else r=xc();return r},RO={cache:xc(),defaultCache:!0,hashPriority:"low"},Vp=()=>{const e=zR();return Ge(AO,oe(m(m({},RO),{cache:e})))},HR=e=>{const t=Vp(),n=oe(m(m({},RO),{cache:xc()}));return ye([()=>je(e),t],()=>{const o=m({},t.value),r=je(e);Object.keys(r).forEach(l=>{const a=r[l];r[l]!==void 0&&(o[l]=a)});const{cache:i}=r;o.cache=o.cache||xc(),o.defaultCache=!i&&t.value.defaultCache,n.value=o},{immediate:!0}),Ye(AO,n),n},jR=()=>({autoClear:$e(),mock:Ne(),cache:Be(),defaultCache:$e(),hashPriority:Ne(),container:He(),ssrInline:$e(),transformers:ct(),linters:ct()}),VR=Bt(re({name:"AStyleProvider",inheritAttrs:!1,props:jR(),setup(e,t){let{slots:n}=t;return HR(e),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}}));function DO(e,t,n,o){const r=Vp(),i=oe(""),l=oe();Ve(()=>{i.value=[e,...t.value].join("%")});const a=s=>{r.value.cache.update(s,c=>{const[u=0,d]=c||[];return u-1===0?(o==null||o(d,!1),null):[u-1,d]})};return ye(i,(s,c)=>{c&&a(c),r.value.cache.update(s,u=>{const[d=0,f]=u||[],v=f||n();return[d+1,v]}),l.value=r.value.cache.get(i.value)[1]},{immediate:!0}),et(()=>{a(i.value)}),l}function zn(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Ti(e,t){return e&&e.contains?e.contains(t):!1}const J$="data-vc-order",WR="vc-util-key",Tm=new Map;function BO(){let{mark:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e?e.startsWith("data-")?e:`data-${e}`:WR}function Wp(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function KR(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function NO(e){return Array.from((Tm.get(e)||e).children).filter(t=>t.tagName==="STYLE")}function kO(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!zn())return null;const{csp:n,prepend:o}=t,r=document.createElement("style");r.setAttribute(J$,KR(o)),n!=null&&n.nonce&&(r.nonce=n==null?void 0:n.nonce),r.innerHTML=e;const i=Wp(t),{firstChild:l}=i;if(o){if(o==="queue"){const a=NO(i).filter(s=>["prepend","prependQueue"].includes(s.getAttribute(J$)));if(a.length)return i.insertBefore(r,a[a.length-1].nextSibling),r}i.insertBefore(r,l)}else i.appendChild(r);return r}function FO(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const n=Wp(t);return NO(n).find(o=>o.getAttribute(BO(t))===e)}function wf(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const n=FO(e,t);n&&Wp(t).removeChild(n)}function GR(e,t){const n=Tm.get(e);if(!n||!Ti(document,n)){const o=kO("",t),{parentNode:r}=o;Tm.set(e,r),e.removeChild(o)}}function wc(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var o,r,i;const l=Wp(n);GR(l,n);const a=FO(t,n);if(a)return!((o=n.csp)===null||o===void 0)&&o.nonce&&a.nonce!==((r=n.csp)===null||r===void 0?void 0:r.nonce)&&(a.nonce=(i=n.csp)===null||i===void 0?void 0:i.nonce),a.innerHTML!==e&&(a.innerHTML=e),a;const s=kO(e,n);return s.setAttribute(BO(n),t),s}function UR(e,t){if(e.length!==t.length)return!1;for(let n=0;n1&&arguments[1]!==void 0?arguments[1]:!1,o={map:this.cache};return t.forEach(r=>{var i;o?o=(i=o==null?void 0:o.map)===null||i===void 0?void 0:i.get(r):o=void 0}),o!=null&&o.value&&n&&(o.value[1]=this.cacheCallTimes++),o==null?void 0:o.value}get(t){var n;return(n=this.internalGet(t,!0))===null||n===void 0?void 0:n[0]}has(t){return!!this.internalGet(t)}set(t,n){if(!this.has(t)){if(this.size()+1>Ua.MAX_CACHE_SIZE+Ua.MAX_CACHE_OFFSET){const[r]=this.keys.reduce((i,l)=>{const[,a]=i;return this.internalGet(l)[1]{if(i===t.length-1)o.set(r,{value:[n,this.cacheCallTimes++]});else{const l=o.get(r);l?l.map||(l.map=new Map):o.set(r,{map:new Map}),o=o.get(r).map}})}deleteByPath(t,n){var o;const r=t.get(n[0]);if(n.length===1)return r.map?t.set(n[0],{map:r.map}):t.delete(n[0]),(o=r.value)===null||o===void 0?void 0:o[0];const i=this.deleteByPath(r.map,n.slice(1));return(!r.map||r.map.size===0)&&!r.value&&t.delete(n[0]),i}delete(t){if(this.has(t))return this.keys=this.keys.filter(n=>!UR(n,t)),this.deleteByPath(this.cache,t)}}Ua.MAX_CACHE_SIZE=20;Ua.MAX_CACHE_OFFSET=5;let Z$={};function XR(e,t){}function YR(e,t){}function LO(e,t,n){!t&&!Z$[n]&&(e(!1,n),Z$[n]=!0)}function Db(e,t){LO(XR,e,t)}function qR(e,t){LO(YR,e,t)}function JR(){}let Po=JR,Q$=0;class zO{constructor(t){this.derivatives=Array.isArray(t)?t:[t],this.id=Q$,t.length===0&&Po(t.length>0),Q$+=1}getDerivativeToken(t){return this.derivatives.reduce((n,o)=>o(t,n),void 0)}}const Hg=new Ua;function HO(e){const t=Array.isArray(e)?e:[e];return Hg.has(t)||Hg.set(t,new zO(t)),Hg.get(t)}const eC=new WeakMap;function Of(e){let t=eC.get(e)||"";return t||(Object.keys(e).forEach(n=>{const o=e[n];t+=n,o instanceof zO?t+=o.id:o&&typeof o=="object"?t+=Of(o):t+=o}),eC.set(e,t)),t}function ZR(e,t){return Rb(`${t}_${Of(e)}`)}const Js=`random-${Date.now()}-${Math.random()}`.replace(/\./g,""),jO="_bAmBoO_";function QR(e,t,n){var o,r;if(zn()){wc(e,Js);const i=document.createElement("div");i.style.position="fixed",i.style.left="0",i.style.top="0",t==null||t(i),document.body.appendChild(i);const l=n?n(i):(o=getComputedStyle(i).content)===null||o===void 0?void 0:o.includes(jO);return(r=i.parentNode)===null||r===void 0||r.removeChild(i),wf(Js),l}return!1}let jg;function eD(){return jg===void 0&&(jg=QR(`@layer ${Js} { .${Js} { content: "${jO}"!important; } }`,e=>{e.className=Js})),jg}const tC={},tD="css",hl=new Map;function nD(e){hl.set(e,(hl.get(e)||0)+1)}function oD(e,t){typeof document<"u"&&document.querySelectorAll(`style[${MO}="${e}"]`).forEach(o=>{var r;o[Ca]===t&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))})}const rD=0;function iD(e,t){hl.set(e,(hl.get(e)||0)-1);const n=Array.from(hl.keys()),o=n.filter(r=>(hl.get(r)||0)<=0);n.length-o.length>rD&&o.forEach(r=>{oD(r,t),hl.delete(r)})}const lD=(e,t,n,o)=>{const r=n.getDerivativeToken(e);let i=m(m({},r),t);return o&&(i=o(i)),i};function aD(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ne({});const o=Vp(),r=P(()=>m({},...t.value)),i=P(()=>Of(r.value)),l=P(()=>Of(n.value.override||tC));return DO("token",P(()=>[n.value.salt||"",e.value.id,i.value,l.value]),()=>{const{salt:s="",override:c=tC,formatToken:u,getComputedToken:d}=n.value,f=d?d(r.value,c,e.value):lD(r.value,c,e.value,u),h=ZR(f,s);f._tokenKey=h,nD(h);const v=`${tD}-${Rb(h)}`;return f._hashId=v,[f,v]},s=>{var c;iD(s[0]._tokenKey,(c=o.value)===null||c===void 0?void 0:c.cache.instanceId)})}var sD={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},VO="comm",WO="rule",KO="decl",cD="@import",uD="@namespace",dD="@keyframes",fD="@layer",GO=Math.abs,Bb=String.fromCharCode;function UO(e){return e.trim()}function gd(e,t,n){return e.replace(t,n)}function pD(e,t,n){return e.indexOf(t,n)}function Aa(e,t){return e.charCodeAt(t)|0}function Xa(e,t,n){return e.slice(t,n)}function wr(e){return e.length}function hD(e){return e.length}function _u(e,t){return t.push(e),e}var Kp=1,Ya=1,XO=0,Wo=0,fn=0,is="";function Nb(e,t,n,o,r,i,l,a){return{value:e,root:t,parent:n,type:o,props:r,children:i,line:Kp,column:Ya,length:l,return:"",siblings:a}}function gD(){return fn}function vD(){return fn=Wo>0?Aa(is,--Wo):0,Ya--,fn===10&&(Ya=1,Kp--),fn}function or(){return fn=Wo2||Oc(fn)>3?"":" "}function SD(e,t){for(;--t&&or()&&!(fn<48||fn>102||fn>57&&fn<65||fn>70&&fn<97););return Gp(e,vd()+(t<6&&Mi()==32&&or()==32))}function Em(e){for(;or();)switch(fn){case e:return Wo;case 34:case 39:e!==34&&e!==39&&Em(fn);break;case 40:e===41&&Em(e);break;case 92:or();break}return Wo}function $D(e,t){for(;or()&&e+fn!==57;)if(e+fn===84&&Mi()===47)break;return"/*"+Gp(t,Wo-1)+"*"+Bb(e===47?e:or())}function CD(e){for(;!Oc(Mi());)or();return Gp(e,Wo)}function xD(e){return bD(md("",null,null,null,[""],e=mD(e),0,[0],e))}function md(e,t,n,o,r,i,l,a,s){for(var c=0,u=0,d=l,f=0,h=0,v=0,g=1,b=1,y=1,S=0,$="",w=r,C=i,O=o,x=$;b;)switch(v=S,S=or()){case 40:if(v!=108&&Aa(x,d-1)==58){pD(x+=gd(Vg(S),"&","&\f"),"&\f",GO(c?a[c-1]:0))!=-1&&(y=-1);break}case 34:case 39:case 91:x+=Vg(S);break;case 9:case 10:case 13:case 32:x+=yD(v);break;case 92:x+=SD(vd()-1,7);continue;case 47:switch(Mi()){case 42:case 47:_u(wD($D(or(),vd()),t,n,s),s),(Oc(v||1)==5||Oc(Mi()||1)==5)&&wr(x)&&Xa(x,-1,void 0)!==" "&&(x+=" ");break;default:x+="/"}break;case 123*g:a[c++]=wr(x)*y;case 125*g:case 59:case 0:switch(S){case 0:case 125:b=0;case 59+u:y==-1&&(x=gd(x,/\f/g,"")),h>0&&(wr(x)-d||g===0&&v===47)&&_u(h>32?oC(x+";",o,n,d-1,s):oC(gd(x," ","")+";",o,n,d-2,s),s);break;case 59:x+=";";default:if(_u(O=nC(x,t,n,c,u,r,a,$,w=[],C=[],d,i),i),S===123)if(u===0)md(x,t,O,O,w,i,d,a,C);else{switch(f){case 99:if(Aa(x,3)===110)break;case 108:if(Aa(x,2)===97)break;default:u=0;case 100:case 109:case 115:}u?md(e,O,O,o&&_u(nC(e,O,O,0,0,r,a,$,r,w=[],d,C),C),r,C,d,a,o?w:C):md(x,O,O,O,[""],C,0,a,C)}}c=u=h=0,g=y=1,$=x="",d=l;break;case 58:d=1+wr(x),h=v;default:if(g<1){if(S==123)--g;else if(S==125&&g++==0&&vD()==125)continue}switch(x+=Bb(S),S*g){case 38:y=u>0?1:(x+="\f",-1);break;case 44:a[c++]=(wr(x)-1)*y,y=1;break;case 64:Mi()===45&&(x+=Vg(or())),f=Mi(),u=d=wr($=x+=CD(vd())),S++;break;case 45:v===45&&wr(x)==2&&(g=0)}}return i}function nC(e,t,n,o,r,i,l,a,s,c,u,d){for(var f=r-1,h=r===0?i:[""],v=hD(h),g=0,b=0,y=0;g0?h[S]+" "+$:gd($,/&\f/g,h[S])))&&(s[y++]=w);return Nb(e,t,n,r===0?WO:a,s,c,u,d)}function wD(e,t,n,o){return Nb(e,t,n,VO,Bb(gD()),Xa(e,2,-2),0,o)}function oC(e,t,n,o,r){return Nb(e,t,n,KO,Xa(e,0,o),Xa(e,o+1,-1),o,r)}function _m(e,t){for(var n="",o=0;o{const[i,l]=r.split(":");Pl[i]=l});const o=document.querySelector(`style[${rC}]`);o&&(YO=!1,(e=o.parentNode)===null||e===void 0||e.removeChild(o)),document.body.removeChild(t)}}function TD(e){return ID(),!!Pl[e]}function ED(e){const t=Pl[e];let n=null;if(t&&zn())if(YO)n=PD;else{const o=document.querySelector(`style[${Ol}="${Pl[e]}"]`);o?n=o.innerHTML:delete Pl[e]}return[n,t]}const iC=zn(),_D="_skip_check_",qO="_multi_value_";function lC(e){return _m(xD(e),OD).replace(/\{%%%\:[^;];}/g,";")}function MD(e){return typeof e=="object"&&e&&(_D in e||qO in e)}function AD(e,t,n){if(!t)return e;const o=`.${t}`,r=n==="low"?`:where(${o})`:o;return e.split(",").map(l=>{var a;const s=l.trim().split(/\s+/);let c=s[0]||"";const u=((a=c.match(/^\w+/))===null||a===void 0?void 0:a[0])||"";return c=`${u}${r}${c.slice(u.length)}`,[c,...s.slice(1)].join(" ")}).join(",")}const aC=new Set,Mm=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{root:n,injectHash:o,parentSelectors:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{root:!0,parentSelectors:[]};const{hashId:i,layer:l,path:a,hashPriority:s,transformers:c=[],linters:u=[]}=t;let d="",f={};function h(b){const y=b.getName(i);if(!f[y]){const[S]=Mm(b.style,t,{root:!1,parentSelectors:r});f[y]=`@keyframes ${b.getName(i)}${S}`}}function v(b){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return b.forEach(S=>{Array.isArray(S)?v(S,y):S&&y.push(S)}),y}if(v(Array.isArray(e)?e:[e]).forEach(b=>{const y=typeof b=="string"&&!n?{}:b;if(typeof y=="string")d+=`${y} +`;else if(y._keyframe)h(y);else{const S=c.reduce(($,w)=>{var C;return((C=w==null?void 0:w.visit)===null||C===void 0?void 0:C.call(w,$))||$},y);Object.keys(S).forEach($=>{var w;const C=S[$];if(typeof C=="object"&&C&&($!=="animationName"||!C._keyframe)&&!MD(C)){let O=!1,x=$.trim(),I=!1;(n||o)&&i?x.startsWith("@")?O=!0:x=AD($,i,s):n&&!i&&(x==="&"||x==="")&&(x="",I=!0);const[T,M]=Mm(C,t,{root:I,injectHash:O,parentSelectors:[...r,x]});f=m(m({},f),M),d+=`${x}${T}`}else{let O=function(I,T){const M=I.replace(/[A-Z]/g,A=>`-${A.toLowerCase()}`);let E=T;!sD[I]&&typeof E=="number"&&E!==0&&(E=`${E}px`),I==="animationName"&&(T!=null&&T._keyframe)&&(h(T),E=T.getName(i)),d+=`${M}:${E};`};const x=(w=C==null?void 0:C.value)!==null&&w!==void 0?w:C;typeof C=="object"&&(C!=null&&C[qO])&&Array.isArray(x)?x.forEach(I=>{O($,I)}):O($,x)}})}}),!n)d=`{${d}}`;else if(l&&eD()){const b=l.split(",");d=`@layer ${b[b.length-1].trim()} {${d}}`,b.length>1&&(d=`@layer ${l}{%%%:%}${d}`)}return[d,f]};function RD(e,t){return Rb(`${e.join("%")}${t}`)}function Am(e,t){const n=Vp(),o=P(()=>e.value.token._tokenKey),r=P(()=>[o.value,...e.value.path]);let i=iC;return DO("style",r,()=>{const{path:l,hashId:a,layer:s,nonce:c,clientOnly:u,order:d=0}=e.value,f=r.value.join("|");if(TD(f)){const[x,I]=ED(f);if(x)return[x,o.value,I,{},u,d]}const h=t(),{hashPriority:v,container:g,transformers:b,linters:y,cache:S}=n.value,[$,w]=Mm(h,{hashId:a,hashPriority:v,layer:s,path:l.join("-"),transformers:b,linters:y}),C=lC($),O=RD(r.value,C);if(i){const x={mark:Ol,prepend:"queue",attachTo:g,priority:d},I=typeof c=="function"?c():c;I&&(x.csp={nonce:I});const T=wc(C,O,x);T[Ca]=S.instanceId,T.setAttribute(MO,o.value),Object.keys(w).forEach(M=>{aC.has(M)||(aC.add(M),wc(lC(w[M]),`_effect-${M}`,{mark:Ol,prepend:"queue",attachTo:g}))})}return[C,o.value,O,w,u,d]},(l,a)=>{let[,,s]=l;(a||n.value.autoClear)&&iC&&wf(s,{mark:Ol})}),l=>l}class it{constructor(t,n){this._keyframe=!0,this.name=t,this.style=n}getName(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return t?`${t}-${this.name}`:this.name}}const DD={StyleProvider:VR},JO="4.2.6",Pc=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"];function _n(e,t){BD(e)&&(e="100%");var n=ND(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function Mu(e){return Math.min(1,Math.max(0,e))}function BD(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function ND(e){return typeof e=="string"&&e.indexOf("%")!==-1}function ZO(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Au(e){return e<=1?"".concat(Number(e)*100,"%"):e}function yl(e){return e.length===1?"0"+e:String(e)}function kD(e,t,n){return{r:_n(e,255)*255,g:_n(t,255)*255,b:_n(n,255)*255}}function sC(e,t,n){e=_n(e,255),t=_n(t,255),n=_n(n,255);var o=Math.max(e,t,n),r=Math.min(e,t,n),i=0,l=0,a=(o+r)/2;if(o===r)l=0,i=0;else{var s=o-r;switch(l=a>.5?s/(2-o-r):s/(o+r),o){case e:i=(t-n)/s+(t1&&(n-=1),n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function FD(e,t,n){var o,r,i;if(e=_n(e,360),t=_n(t,100),n=_n(n,100),t===0)r=n,i=n,o=n;else{var l=n<.5?n*(1+t):n+t-n*t,a=2*n-l;o=Wg(a,l,e+1/3),r=Wg(a,l,e),i=Wg(a,l,e-1/3)}return{r:o*255,g:r*255,b:i*255}}function Rm(e,t,n){e=_n(e,255),t=_n(t,255),n=_n(n,255);var o=Math.max(e,t,n),r=Math.min(e,t,n),i=0,l=o,a=o-r,s=o===0?0:a/o;if(o===r)i=0;else{switch(o){case e:i=(t-n)/a+(t>16,g:(e&65280)>>8,b:e&255}}var Bm={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function va(e){var t={r:0,g:0,b:0},n=1,o=null,r=null,i=null,l=!1,a=!1;return typeof e=="string"&&(e=KD(e)),typeof e=="object"&&(Fr(e.r)&&Fr(e.g)&&Fr(e.b)?(t=kD(e.r,e.g,e.b),l=!0,a=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Fr(e.h)&&Fr(e.s)&&Fr(e.v)?(o=Au(e.s),r=Au(e.v),t=LD(e.h,o,r),l=!0,a="hsv"):Fr(e.h)&&Fr(e.s)&&Fr(e.l)&&(o=Au(e.s),i=Au(e.l),t=FD(e.h,o,i),l=!0,a="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=ZO(n),{ok:l,format:e.format||a,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var VD="[-\\+]?\\d+%?",WD="[-\\+]?\\d*\\.\\d+%?",Ai="(?:".concat(WD,")|(?:").concat(VD,")"),Kg="[\\s|\\(]+(".concat(Ai,")[,|\\s]+(").concat(Ai,")[,|\\s]+(").concat(Ai,")\\s*\\)?"),Gg="[\\s|\\(]+(".concat(Ai,")[,|\\s]+(").concat(Ai,")[,|\\s]+(").concat(Ai,")[,|\\s]+(").concat(Ai,")\\s*\\)?"),Qo={CSS_UNIT:new RegExp(Ai),rgb:new RegExp("rgb"+Kg),rgba:new RegExp("rgba"+Gg),hsl:new RegExp("hsl"+Kg),hsla:new RegExp("hsla"+Gg),hsv:new RegExp("hsv"+Kg),hsva:new RegExp("hsva"+Gg),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function KD(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(Bm[e])e=Bm[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n=Qo.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=Qo.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Qo.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=Qo.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Qo.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=Qo.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Qo.hex8.exec(e),n?{r:So(n[1]),g:So(n[2]),b:So(n[3]),a:cC(n[4]),format:t?"name":"hex8"}:(n=Qo.hex6.exec(e),n?{r:So(n[1]),g:So(n[2]),b:So(n[3]),format:t?"name":"hex"}:(n=Qo.hex4.exec(e),n?{r:So(n[1]+n[1]),g:So(n[2]+n[2]),b:So(n[3]+n[3]),a:cC(n[4]+n[4]),format:t?"name":"hex8"}:(n=Qo.hex3.exec(e),n?{r:So(n[1]+n[1]),g:So(n[2]+n[2]),b:So(n[3]+n[3]),format:t?"name":"hex"}:!1)))))))))}function Fr(e){return!!Qo.CSS_UNIT.exec(String(e))}var vt=function(){function e(t,n){t===void 0&&(t=""),n===void 0&&(n={});var o;if(t instanceof e)return t;typeof t=="number"&&(t=jD(t)),this.originalInput=t;var r=va(t);this.originalInput=t,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=(o=n.format)!==null&&o!==void 0?o:r.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},e.prototype.getLuminance=function(){var t=this.toRgb(),n,o,r,i=t.r/255,l=t.g/255,a=t.b/255;return i<=.03928?n=i/12.92:n=Math.pow((i+.055)/1.055,2.4),l<=.03928?o=l/12.92:o=Math.pow((l+.055)/1.055,2.4),a<=.03928?r=a/12.92:r=Math.pow((a+.055)/1.055,2.4),.2126*n+.7152*o+.0722*r},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(t){return this.a=ZO(t),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var t=this.toHsl().s;return t===0},e.prototype.toHsv=function(){var t=Rm(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}},e.prototype.toHsvString=function(){var t=Rm(this.r,this.g,this.b),n=Math.round(t.h*360),o=Math.round(t.s*100),r=Math.round(t.v*100);return this.a===1?"hsv(".concat(n,", ").concat(o,"%, ").concat(r,"%)"):"hsva(".concat(n,", ").concat(o,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var t=sC(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}},e.prototype.toHslString=function(){var t=sC(this.r,this.g,this.b),n=Math.round(t.h*360),o=Math.round(t.s*100),r=Math.round(t.l*100);return this.a===1?"hsl(".concat(n,", ").concat(o,"%, ").concat(r,"%)"):"hsla(".concat(n,", ").concat(o,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(t){return t===void 0&&(t=!1),Dm(this.r,this.g,this.b,t)},e.prototype.toHexString=function(t){return t===void 0&&(t=!1),"#"+this.toHex(t)},e.prototype.toHex8=function(t){return t===void 0&&(t=!1),zD(this.r,this.g,this.b,this.a,t)},e.prototype.toHex8String=function(t){return t===void 0&&(t=!1),"#"+this.toHex8(t)},e.prototype.toHexShortString=function(t){return t===void 0&&(t=!1),this.a===1?this.toHexString(t):this.toHex8String(t)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var t=Math.round(this.r),n=Math.round(this.g),o=Math.round(this.b);return this.a===1?"rgb(".concat(t,", ").concat(n,", ").concat(o,")"):"rgba(".concat(t,", ").concat(n,", ").concat(o,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var t=function(n){return"".concat(Math.round(_n(n,255)*100),"%")};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var t=function(n){return Math.round(_n(n,255)*100)};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return!1;for(var t="#"+Dm(this.r,this.g,this.b,!1),n=0,o=Object.entries(Bm);n=0,i=!n&&r&&(t.startsWith("hex")||t==="name");return i?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(o=this.toRgbString()),t==="prgb"&&(o=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(o=this.toHexString()),t==="hex3"&&(o=this.toHexString(!0)),t==="hex4"&&(o=this.toHex8String(!0)),t==="hex8"&&(o=this.toHex8String()),t==="name"&&(o=this.toName()),t==="hsl"&&(o=this.toHslString()),t==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=Mu(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=Mu(n.l),new e(n)},e.prototype.tint=function(t){return t===void 0&&(t=10),this.mix("white",t)},e.prototype.shade=function(t){return t===void 0&&(t=10),this.mix("black",t)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=Mu(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=Mu(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),o=(n.h+t)%360;return n.h=o<0?360+o:o,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var o=this.toRgb(),r=new e(t).toRgb(),i=n/100,l={r:(r.r-o.r)*i+o.r,g:(r.g-o.g)*i+o.g,b:(r.b-o.b)*i+o.b,a:(r.a-o.a)*i+o.a};return new e(l)},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var o=this.toHsl(),r=360/n,i=[this];for(o.h=(o.h-(r*t>>1)+720)%360;--t;)o.h=(o.h+r)%360,i.push(new e(o));return i},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),o=n.h,r=n.s,i=n.v,l=[],a=1/t;t--;)l.push(new e({h:o,s:r,v:i})),i=(i+a)%1;return l},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),o=new e(t).toRgb(),r=n.a+o.a*(1-n.a);return new e({r:(n.r*n.a+o.r*o.a*(1-n.a))/r,g:(n.g*n.a+o.g*o.a*(1-n.a))/r,b:(n.b*n.a+o.b*o.a*(1-n.a))/r,a:r})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),o=n.h,r=[this],i=360/t,l=1;l=60&&Math.round(e.h)<=240?o=n?Math.round(e.h)-Ru*t:Math.round(e.h)+Ru*t:o=n?Math.round(e.h)+Ru*t:Math.round(e.h)-Ru*t,o<0?o+=360:o>=360&&(o-=360),o}function pC(e,t,n){if(e.h===0&&e.s===0)return e.s;var o;return n?o=e.s-uC*t:t===eP?o=e.s+uC:o=e.s+GD*t,o>1&&(o=1),n&&t===QO&&o>.1&&(o=.1),o<.06&&(o=.06),Number(o.toFixed(2))}function hC(e,t,n){var o;return n?o=e.v+UD*t:o=e.v-XD*t,o>1&&(o=1),Number(o.toFixed(2))}function ti(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],o=va(e),r=QO;r>0;r-=1){var i=dC(o),l=Du(va({h:fC(i,r,!0),s:pC(i,r,!0),v:hC(i,r,!0)}));n.push(l)}n.push(Du(o));for(var a=1;a<=eP;a+=1){var s=dC(o),c=Du(va({h:fC(s,a),s:pC(s,a),v:hC(s,a)}));n.push(c)}return t.theme==="dark"?YD.map(function(u){var d=u.index,f=u.opacity,h=Du(qD(va(t.backgroundColor||"#141414"),va(n[d]),f*100));return h}):n}var Ra={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Zs={},Ug={};Object.keys(Ra).forEach(function(e){Zs[e]=ti(Ra[e]),Zs[e].primary=Zs[e][5],Ug[e]=ti(Ra[e],{theme:"dark",backgroundColor:"#141414"}),Ug[e].primary=Ug[e][5]});var JD=Zs.gold,ZD=Zs.blue;const QD=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function eB(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const kb={blue:"#1677ff",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#eb2f96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},Up=m(m({},kb),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, +'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', +'Noto Color Emoji'`,fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1});function tP(e,t){let{generateColorPalettes:n,generateNeutralColorPalettes:o}=t;const{colorSuccess:r,colorWarning:i,colorError:l,colorInfo:a,colorPrimary:s,colorBgBase:c,colorTextBase:u}=e,d=n(s),f=n(r),h=n(i),v=n(l),g=n(a),b=o(c,u);return m(m({},b),{colorPrimaryBg:d[1],colorPrimaryBgHover:d[2],colorPrimaryBorder:d[3],colorPrimaryBorderHover:d[4],colorPrimaryHover:d[5],colorPrimary:d[6],colorPrimaryActive:d[7],colorPrimaryTextHover:d[8],colorPrimaryText:d[9],colorPrimaryTextActive:d[10],colorSuccessBg:f[1],colorSuccessBgHover:f[2],colorSuccessBorder:f[3],colorSuccessBorderHover:f[4],colorSuccessHover:f[4],colorSuccess:f[6],colorSuccessActive:f[7],colorSuccessTextHover:f[8],colorSuccessText:f[9],colorSuccessTextActive:f[10],colorErrorBg:v[1],colorErrorBgHover:v[2],colorErrorBorder:v[3],colorErrorBorderHover:v[4],colorErrorHover:v[5],colorError:v[6],colorErrorActive:v[7],colorErrorTextHover:v[8],colorErrorText:v[9],colorErrorTextActive:v[10],colorWarningBg:h[1],colorWarningBgHover:h[2],colorWarningBorder:h[3],colorWarningBorderHover:h[4],colorWarningHover:h[4],colorWarning:h[6],colorWarningActive:h[7],colorWarningTextHover:h[8],colorWarningText:h[9],colorWarningTextActive:h[10],colorInfoBg:g[1],colorInfoBgHover:g[2],colorInfoBorder:g[3],colorInfoBorderHover:g[4],colorInfoHover:g[4],colorInfo:g[6],colorInfoActive:g[7],colorInfoTextHover:g[8],colorInfoText:g[9],colorInfoTextActive:g[10],colorBgMask:new vt("#000").setAlpha(.45).toRgbString(),colorWhite:"#fff"})}const tB=e=>{let t=e,n=e,o=e,r=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?o=1:e>=6&&(o=2),e>4&&e<8?r=4:e>=8&&(r=6),{borderRadius:e>16?16:e,borderRadiusXS:o,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:r}};function nB(e){const{motionUnit:t,motionBase:n,borderRadius:o,lineWidth:r}=e;return m({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:r+1},tB(o))}const Lr=(e,t)=>new vt(e).setAlpha(t).toRgbString(),Es=(e,t)=>new vt(e).darken(t).toHexString(),oB=e=>{const t=ti(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},rB=(e,t)=>{const n=e||"#fff",o=t||"#000";return{colorBgBase:n,colorTextBase:o,colorText:Lr(o,.88),colorTextSecondary:Lr(o,.65),colorTextTertiary:Lr(o,.45),colorTextQuaternary:Lr(o,.25),colorFill:Lr(o,.15),colorFillSecondary:Lr(o,.06),colorFillTertiary:Lr(o,.04),colorFillQuaternary:Lr(o,.02),colorBgLayout:Es(n,4),colorBgContainer:Es(n,0),colorBgElevated:Es(n,0),colorBgSpotlight:Lr(o,.85),colorBorder:Es(n,15),colorBorderSecondary:Es(n,6)}};function iB(e){const t=new Array(10).fill(null).map((n,o)=>{const r=o-1,i=e*Math.pow(2.71828,r/5),l=o>1?Math.floor(i):Math.ceil(i);return Math.floor(l/2)*2});return t[1]=e,t.map(n=>{const o=n+8;return{size:n,lineHeight:o/n}})}const lB=e=>{const t=iB(e),n=t.map(r=>r.size),o=t.map(r=>r.lineHeight);return{fontSizeSM:n[0],fontSize:n[1],fontSizeLG:n[2],fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:o[1],lineHeightLG:o[2],lineHeightSM:o[0],lineHeightHeading1:o[6],lineHeightHeading2:o[5],lineHeightHeading3:o[4],lineHeightHeading4:o[3],lineHeightHeading5:o[2]}};function Fb(e){const t=Object.keys(kb).map(n=>{const o=ti(e[n]);return new Array(10).fill(1).reduce((r,i,l)=>(r[`${n}-${l+1}`]=o[l],r),{})}).reduce((n,o)=>(n=m(m({},n),o),n),{});return m(m(m(m(m(m(m({},e),t),tP(e,{generateColorPalettes:oB,generateNeutralColorPalettes:rB})),lB(e.fontSize)),eB(e)),QD(e)),nB(e))}function Xg(e){return e>=0&&e<=255}function Bu(e,t){const{r:n,g:o,b:r,a:i}=new vt(e).toRgb();if(i<1)return e;const{r:l,g:a,b:s}=new vt(t).toRgb();for(let c=.01;c<=1;c+=.01){const u=Math.round((n-l*(1-c))/c),d=Math.round((o-a*(1-c))/c),f=Math.round((r-s*(1-c))/c);if(Xg(u)&&Xg(d)&&Xg(f))return new vt({r:u,g:d,b:f,a:Math.round(c*100)/100}).toRgbString()}return new vt({r:n,g:o,b:r,a:1}).toRgbString()}var aB=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{delete o[h]});const r=m(m({},n),o),i=480,l=576,a=768,s=992,c=1200,u=1600,d=2e3;return m(m(m({},r),{colorLink:r.colorInfoText,colorLinkHover:r.colorInfoHover,colorLinkActive:r.colorInfoActive,colorFillContent:r.colorFillSecondary,colorFillContentHover:r.colorFill,colorFillAlter:r.colorFillQuaternary,colorBgContainerDisabled:r.colorFillTertiary,colorBorderBg:r.colorBgContainer,colorSplit:Bu(r.colorBorderSecondary,r.colorBgContainer),colorTextPlaceholder:r.colorTextQuaternary,colorTextDisabled:r.colorTextQuaternary,colorTextHeading:r.colorText,colorTextLabel:r.colorTextSecondary,colorTextDescription:r.colorTextTertiary,colorTextLightSolid:r.colorWhite,colorHighlight:r.colorError,colorBgTextHover:r.colorFillSecondary,colorBgTextActive:r.colorFill,colorIcon:r.colorTextTertiary,colorIconHover:r.colorText,colorErrorOutline:Bu(r.colorErrorBg,r.colorBgContainer),colorWarningOutline:Bu(r.colorWarningBg,r.colorBgContainer),fontSizeIcon:r.fontSizeSM,lineWidth:r.lineWidth,controlOutlineWidth:r.lineWidth*2,controlInteractiveSize:r.controlHeight/2,controlItemBgHover:r.colorFillTertiary,controlItemBgActive:r.colorPrimaryBg,controlItemBgActiveHover:r.colorPrimaryBgHover,controlItemBgActiveDisabled:r.colorFill,controlTmpOutline:r.colorFillQuaternary,controlOutline:Bu(r.colorPrimaryBg,r.colorBgContainer),lineType:r.lineType,borderRadius:r.borderRadius,borderRadiusXS:r.borderRadiusXS,borderRadiusSM:r.borderRadiusSM,borderRadiusLG:r.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:r.sizeXXS,paddingXS:r.sizeXS,paddingSM:r.sizeSM,padding:r.size,paddingMD:r.sizeMD,paddingLG:r.sizeLG,paddingXL:r.sizeXL,paddingContentHorizontalLG:r.sizeLG,paddingContentVerticalLG:r.sizeMS,paddingContentHorizontal:r.sizeMS,paddingContentVertical:r.sizeSM,paddingContentHorizontalSM:r.size,paddingContentVerticalSM:r.sizeXS,marginXXS:r.sizeXXS,marginXS:r.sizeXS,marginSM:r.sizeSM,margin:r.size,marginMD:r.sizeMD,marginLG:r.sizeLG,marginXL:r.sizeXL,marginXXL:r.sizeXXL,boxShadow:` + 0 1px 2px 0 rgba(0, 0, 0, 0.03), + 0 1px 6px -1px rgba(0, 0, 0, 0.02), + 0 2px 4px 0 rgba(0, 0, 0, 0.02) + `,boxShadowSecondary:` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowTertiary:` + 0 1px 2px 0 rgba(0, 0, 0, 0.03), + 0 1px 6px -1px rgba(0, 0, 0, 0.02), + 0 2px 4px 0 rgba(0, 0, 0, 0.02) + `,screenXS:i,screenXSMin:i,screenXSMax:l-1,screenSM:l,screenSMMin:l,screenSMMax:a-1,screenMD:a,screenMDMin:a,screenMDMax:s-1,screenLG:s,screenLGMin:s,screenLGMax:c-1,screenXL:c,screenXLMin:c,screenXLMax:u-1,screenXXL:u,screenXXLMin:u,screenXXLMax:d-1,screenXXXL:d,screenXXXLMin:d,boxShadowPopoverArrow:"3px 3px 7px rgba(0, 0, 0, 0.1)",boxShadowCard:` + 0 1px 2px -2px ${new vt("rgba(0, 0, 0, 0.16)").toRgbString()}, + 0 3px 6px 0 ${new vt("rgba(0, 0, 0, 0.12)").toRgbString()}, + 0 5px 12px 4px ${new vt("rgba(0, 0, 0, 0.09)").toRgbString()} + `,boxShadowDrawerRight:` + -6px 0 16px 0 rgba(0, 0, 0, 0.08), + -3px 0 6px -4px rgba(0, 0, 0, 0.12), + -9px 0 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerLeft:` + 6px 0 16px 0 rgba(0, 0, 0, 0.08), + 3px 0 6px -4px rgba(0, 0, 0, 0.12), + 9px 0 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerUp:` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerDown:` + 0 -6px 16px 0 rgba(0, 0, 0, 0.08), + 0 -3px 6px -4px rgba(0, 0, 0, 0.12), + 0 -9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),o)}const Xp=e=>({color:e.colorLink,textDecoration:"none",outline:"none",cursor:"pointer",transition:`color ${e.motionDurationSlow}`,"&:focus, &:hover":{color:e.colorLinkHover},"&:active":{color:e.colorLinkActive}}),Lb=(e,t,n,o,r)=>{const i=e/2,l=0,a=i,s=n*1/Math.sqrt(2),c=i-n*(1-1/Math.sqrt(2)),u=i-t*(1/Math.sqrt(2)),d=n*(Math.sqrt(2)-1)+t*(1/Math.sqrt(2)),f=2*i-u,h=d,v=2*i-s,g=c,b=2*i-l,y=a,S=i*Math.sqrt(2)+n*(Math.sqrt(2)-2),$=n*(Math.sqrt(2)-1);return{pointerEvents:"none",width:e,height:e,overflow:"hidden","&::after":{content:'""',position:"absolute",width:S,height:S,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${t}px 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:r,zIndex:0,background:"transparent"},"&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:e,height:e/2,background:o,clipPath:{_multi_value_:!0,value:[`polygon(${$}px 100%, 50% ${$}px, ${2*i-$}px 100%, ${$}px 100%)`,`path('M ${l} ${a} A ${n} ${n} 0 0 0 ${s} ${c} L ${u} ${d} A ${t} ${t} 0 0 1 ${f} ${h} L ${v} ${g} A ${n} ${n} 0 0 0 ${b} ${y} Z')`]},content:'""'}}};function Pf(e,t){return Pc.reduce((n,o)=>{const r=e[`${o}-1`],i=e[`${o}-3`],l=e[`${o}-6`],a=e[`${o}-7`];return m(m({},n),t(o,{lightColor:r,lightBorderColor:i,darkColor:l,textColor:a}))},{})}const Jt={overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},qe=e=>({boxSizing:"border-box",margin:0,padding:0,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,listStyle:"none",fontFamily:e.fontFamily}),Kl=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),lr=()=>({"&::before":{display:"table",content:'""'},"&::after":{display:"table",clear:"both",content:'""'}}),cB=e=>({a:{color:e.colorLink,textDecoration:e.linkDecoration,backgroundColor:"transparent",outline:"none",cursor:"pointer",transition:`color ${e.motionDurationSlow}`,"-webkit-text-decoration-skip":"objects","&:hover":{color:e.colorLinkHover},"&:active":{color:e.colorLinkActive},"&:active,\n &:hover":{textDecoration:e.linkHoverDecoration,outline:0},"&:focus":{textDecoration:e.linkFocusDecoration,outline:0},"&[disabled]":{color:e.colorTextDisabled,cursor:"not-allowed"}}}),uB=(e,t)=>{const{fontFamily:n,fontSize:o}=e,r=`[class^="${t}"], [class*=" ${t}"]`;return{[r]:{fontFamily:n,fontSize:o,boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"},[r]:{boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}}}}},ni=e=>({outline:`${e.lineWidthBold}px solid ${e.colorPrimaryBorder}`,outlineOffset:1,transition:"outline-offset 0s, outline 0s"}),oi=e=>({"&:focus-visible":m({},ni(e))});function Ue(e,t,n){return o=>{const r=P(()=>o==null?void 0:o.value),[i,l,a]=si(),{getPrefixCls:s,iconPrefixCls:c}=jp(),u=P(()=>s()),d=P(()=>({theme:i.value,token:l.value,hashId:a.value,path:["Shared",u.value]}));Am(d,()=>[{"&":cB(l.value)}]);const f=P(()=>({theme:i.value,token:l.value,hashId:a.value,path:[e,r.value,c.value]}));return[Am(f,()=>{const{token:h,flush:v}=fB(l.value),g=typeof n=="function"?n(h):n,b=m(m({},g),l.value[e]),y=`.${r.value}`,S=ze(h,{componentCls:y,prefixCls:r.value,iconCls:`.${c.value}`,antCls:`.${u.value}`},b),$=t(S,{hashId:a.value,prefixCls:r.value,rootPrefixCls:u.value,iconPrefixCls:c.value,overrideComponentToken:l.value[e]});return v(e,b),[uB(l.value,r.value),$]}),a]}}const nP=typeof CSSINJS_STATISTIC<"u";let Nm=!0;function ze(){for(var e=arguments.length,t=new Array(e),n=0;n{Object.keys(r).forEach(l=>{Object.defineProperty(o,l,{configurable:!0,enumerable:!0,get:()=>r[l]})})}),Nm=!0,o}function dB(){}function fB(e){let t,n=e,o=dB;return nP&&(t=new Set,n=new Proxy(e,{get(r,i){return Nm&&t.add(i),r[i]}}),o=(r,i)=>{Array.from(t)}),{token:n,keys:t,flush:o}}const pB=HO(Fb),zb={token:Up,hashed:!0},oP=Symbol("DesignTokenContext"),km=oe(),hB=e=>{Ye(oP,e),ye(e,()=>{km.value=je(e),a6(km)},{immediate:!0,deep:!0})},gB=re({props:{value:Be()},setup(e,t){let{slots:n}=t;return hB(P(()=>e.value)),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}});function si(){const e=Ge(oP,P(()=>km.value||zb)),t=P(()=>`${JO}-${e.value.hashed||""}`),n=P(()=>e.value.theme||pB),o=aD(n,P(()=>[Up,e.value.token]),P(()=>({salt:t.value,override:m({override:e.value.token},e.value.components),formatToken:sB})));return[n,P(()=>o.value[0]),P(()=>e.value.hashed?o.value[1]:"")]}const Hb=re({compatConfig:{MODE:3},setup(){const[,e]=si(),t=P(()=>new vt(e.value.colorBgBase).toHsl().l<.5?{opacity:.65}:{});return()=>p("svg",{style:t.value,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},[p("g",{fill:"none","fill-rule":"evenodd"},[p("g",{transform:"translate(24 31.67)"},[p("ellipse",{"fill-opacity":".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"},null),p("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"},null),p("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"},null),p("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"},null),p("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"},null)]),p("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"},null),p("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},[p("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"},null),p("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"},null)])])])}});Hb.PRESENTED_IMAGE_DEFAULT=!0;const rP=re({compatConfig:{MODE:3},setup(){const[,e]=si(),t=P(()=>{const{colorFill:n,colorFillTertiary:o,colorFillQuaternary:r,colorBgContainer:i}=e.value;return{borderColor:new vt(n).onBackground(i).toHexString(),shadowColor:new vt(o).onBackground(i).toHexString(),contentColor:new vt(r).onBackground(i).toHexString()}});return()=>p("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},[p("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd"},[p("ellipse",{fill:t.value.shadowColor,cx:"32",cy:"33",rx:"32",ry:"7"},null),p("g",{"fill-rule":"nonzero",stroke:t.value.borderColor},[p("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"},null),p("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:t.value.contentColor},null)])])])}});rP.PRESENTED_IMAGE_SIMPLE=!0;const vB=e=>{const{componentCls:t,margin:n,marginXS:o,marginXL:r,fontSize:i,lineHeight:l}=e;return{[t]:{marginInline:o,fontSize:i,lineHeight:l,textAlign:"center",[`${t}-image`]:{height:e.emptyImgHeight,marginBottom:o,opacity:e.opacityImage,img:{height:"100%"},svg:{height:"100%",margin:"auto"}},[`${t}-footer`]:{marginTop:n},"&-normal":{marginBlock:r,color:e.colorTextDisabled,[`${t}-image`]:{height:e.emptyImgHeightMD}},"&-small":{marginBlock:o,color:e.colorTextDisabled,[`${t}-image`]:{height:e.emptyImgHeightSM}}}}},mB=Ue("Empty",e=>{const{componentCls:t,controlHeightLG:n}=e,o=ze(e,{emptyImgCls:`${t}-img`,emptyImgHeight:n*2.5,emptyImgHeightMD:n,emptyImgHeightSM:n*.875});return[vB(o)]});var bB=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefixCls:String,imageStyle:Be(),image:It(),description:It()}),jb=re({name:"AEmpty",compatConfig:{MODE:3},inheritAttrs:!1,props:yB(),setup(e,t){let{slots:n={},attrs:o}=t;const{direction:r,prefixCls:i}=Ee("empty",e),[l,a]=mB(i);return()=>{var s,c;const u=i.value,d=m(m({},e),o),{image:f=((s=n.image)===null||s===void 0?void 0:s.call(n))||tn(Hb),description:h=((c=n.description)===null||c===void 0?void 0:c.call(n))||void 0,imageStyle:v,class:g=""}=d,b=bB(d,["image","description","imageStyle","class"]),y=typeof f=="function"?f():f,S=typeof y=="object"&&"type"in y&&y.type.PRESENTED_IMAGE_SIMPLE;return l(p(Wl,{componentName:"Empty",children:$=>{const w=typeof h<"u"?h:$.description,C=typeof w=="string"?w:"empty";let O=null;return typeof y=="string"?O=p("img",{alt:C,src:y},null):O=y,p("div",B({class:le(u,g,a.value,{[`${u}-normal`]:S,[`${u}-rtl`]:r.value==="rtl"})},b),[p("div",{class:`${u}-image`,style:v},[O]),w&&p("p",{class:`${u}-description`},[w]),n.default&&p("div",{class:`${u}-footer`},[kt(n.default())])])}},null))}}});jb.PRESENTED_IMAGE_DEFAULT=()=>tn(Hb);jb.PRESENTED_IMAGE_SIMPLE=()=>tn(rP);const Ei=Bt(jb),Vb=e=>{const{prefixCls:t}=Ee("empty",e);return(o=>{switch(o){case"Table":case"List":return p(Ei,{image:Ei.PRESENTED_IMAGE_SIMPLE},null);case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return p(Ei,{image:Ei.PRESENTED_IMAGE_SIMPLE,class:`${t.value}-small`},null);default:return p(Ei,null,null)}})(e.componentName)};function SB(e){return p(Vb,{componentName:e},null)}const iP=Symbol("SizeContextKey"),lP=()=>Ge(iP,ne(void 0)),aP=e=>{const t=lP();return Ye(iP,P(()=>e.value||t.value)),e},Ee=(e,t)=>{const n=lP(),o=po(),r=Ge(Ab,m(m({},PO),{renderEmpty:x=>tn(Vb,{componentName:x})})),i=P(()=>r.getPrefixCls(e,t.prefixCls)),l=P(()=>{var x,I;return(x=t.direction)!==null&&x!==void 0?x:(I=r.direction)===null||I===void 0?void 0:I.value}),a=P(()=>{var x;return(x=t.iconPrefixCls)!==null&&x!==void 0?x:r.iconPrefixCls.value}),s=P(()=>r.getPrefixCls()),c=P(()=>{var x;return(x=r.autoInsertSpaceInButton)===null||x===void 0?void 0:x.value}),u=r.renderEmpty,d=r.space,f=r.pageHeader,h=r.form,v=P(()=>{var x,I;return(x=t.getTargetContainer)!==null&&x!==void 0?x:(I=r.getTargetContainer)===null||I===void 0?void 0:I.value}),g=P(()=>{var x,I,T;return(I=(x=t.getContainer)!==null&&x!==void 0?x:t.getPopupContainer)!==null&&I!==void 0?I:(T=r.getPopupContainer)===null||T===void 0?void 0:T.value}),b=P(()=>{var x,I;return(x=t.dropdownMatchSelectWidth)!==null&&x!==void 0?x:(I=r.dropdownMatchSelectWidth)===null||I===void 0?void 0:I.value}),y=P(()=>{var x;return(t.virtual===void 0?((x=r.virtual)===null||x===void 0?void 0:x.value)!==!1:t.virtual!==!1)&&b.value!==!1}),S=P(()=>t.size||n.value),$=P(()=>{var x,I,T;return(x=t.autocomplete)!==null&&x!==void 0?x:(T=(I=r.input)===null||I===void 0?void 0:I.value)===null||T===void 0?void 0:T.autocomplete}),w=P(()=>{var x;return(x=t.disabled)!==null&&x!==void 0?x:o.value}),C=P(()=>{var x;return(x=t.csp)!==null&&x!==void 0?x:r.csp}),O=P(()=>{var x,I;return(x=t.wave)!==null&&x!==void 0?x:(I=r.wave)===null||I===void 0?void 0:I.value});return{configProvider:r,prefixCls:i,direction:l,size:S,getTargetContainer:v,getPopupContainer:g,space:d,pageHeader:f,form:h,autoInsertSpaceInButton:c,renderEmpty:u,virtual:y,dropdownMatchSelectWidth:b,rootPrefixCls:s,getPrefixCls:r.getPrefixCls,autocomplete:$,csp:C,iconPrefixCls:a,disabled:w,select:r.select,wave:O}};function ot(e,t){const n=m({},e);for(let o=0;o{const{componentCls:t}=e;return{[t]:{position:"fixed",zIndex:e.zIndexPopup}}},CB=Ue("Affix",e=>{const t=ze(e,{zIndexPopup:e.zIndexBase+10});return[$B(t)]});function xB(){return typeof window<"u"?window:null}var xa;(function(e){e[e.None=0]="None",e[e.Prepare=1]="Prepare"})(xa||(xa={}));const wB=()=>({offsetTop:Number,offsetBottom:Number,target:{type:Function,default:xB},prefixCls:String,onChange:Function,onTestUpdatePosition:Function}),OB=re({compatConfig:{MODE:3},name:"AAffix",inheritAttrs:!1,props:wB(),setup(e,t){let{slots:n,emit:o,expose:r,attrs:i}=t;const l=oe(),a=oe(),s=ft({affixStyle:void 0,placeholderStyle:void 0,status:xa.None,lastAffix:!1,prevTarget:null,timeout:null}),c=On(),u=P(()=>e.offsetBottom===void 0&&e.offsetTop===void 0?0:e.offsetTop),d=P(()=>e.offsetBottom),f=()=>{const{status:$,lastAffix:w}=s,{target:C}=e;if($!==xa.Prepare||!a.value||!l.value||!C)return;const O=C();if(!O)return;const x={status:xa.None},I=Eu(l.value);if(I.top===0&&I.left===0&&I.width===0&&I.height===0)return;const T=Eu(O),M=G$(I,T,u.value),E=U$(I,T,d.value);if(!(I.top===0&&I.left===0&&I.width===0&&I.height===0)){if(M!==void 0){const A=`${I.width}px`,R=`${I.height}px`;x.affixStyle={position:"fixed",top:M,width:A,height:R},x.placeholderStyle={width:A,height:R}}else if(E!==void 0){const A=`${I.width}px`,R=`${I.height}px`;x.affixStyle={position:"fixed",bottom:E,width:A,height:R},x.placeholderStyle={width:A,height:R}}x.lastAffix=!!x.affixStyle,w!==x.lastAffix&&o("change",x.lastAffix),m(s,x)}},h=()=>{m(s,{status:xa.Prepare,affixStyle:void 0,placeholderStyle:void 0})},v=Im(()=>{h()}),g=Im(()=>{const{target:$}=e,{affixStyle:w}=s;if($&&w){const C=$();if(C&&l.value){const O=Eu(C),x=Eu(l.value),I=G$(x,O,u.value),T=U$(x,O,d.value);if(I!==void 0&&w.top===I||T!==void 0&&w.bottom===T)return}}h()});r({updatePosition:v,lazyUpdatePosition:g}),ye(()=>e.target,$=>{const w=($==null?void 0:$())||null;s.prevTarget!==w&&(Y$(c),w&&(X$(w,c),v()),s.prevTarget=w)}),ye(()=>[e.offsetTop,e.offsetBottom],v),Ke(()=>{const{target:$}=e;$&&(s.timeout=setTimeout(()=>{X$($(),c),v()}))}),jn(()=>{f()}),wn(()=>{clearTimeout(s.timeout),Y$(c),v.cancel(),g.cancel()});const{prefixCls:b}=Ee("affix",e),[y,S]=CB(b);return()=>{var $;const{affixStyle:w,placeholderStyle:C,status:O}=s,x=le({[b.value]:w,[S.value]:!0}),I=ot(e,["prefixCls","offsetTop","offsetBottom","target","onChange","onTestUpdatePosition"]);return y(p(Vo,{onResize:v},{default:()=>[p("div",B(B(B({},I),i),{},{ref:l,"data-measure-status":O}),[w&&p("div",{style:C,"aria-hidden":"true"},null),p("div",{class:x,ref:a,style:w},[($=n.default)===null||$===void 0?void 0:$.call(n)])])]}))}}}),sP=Bt(OB);function gC(e){return typeof e=="object"&&e!=null&&e.nodeType===1}function vC(e,t){return(!t||e!=="hidden")&&e!=="visible"&&e!=="clip"}function Yg(e,t){if(e.clientHeightt||i>e&&l=t&&a>=n?i-e-o:l>t&&an?l-t+r:0}var mC=function(e,t){var n=window,o=t.scrollMode,r=t.block,i=t.inline,l=t.boundary,a=t.skipOverflowHiddenElements,s=typeof l=="function"?l:function(te){return te!==l};if(!gC(e))throw new TypeError("Invalid target");for(var c,u,d=document.scrollingElement||document.documentElement,f=[],h=e;gC(h)&&s(h);){if((h=(u=(c=h).parentElement)==null?c.getRootNode().host||null:u)===d){f.push(h);break}h!=null&&h===document.body&&Yg(h)&&!Yg(document.documentElement)||h!=null&&Yg(h,a)&&f.push(h)}for(var v=n.visualViewport?n.visualViewport.width:innerWidth,g=n.visualViewport?n.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,y=window.scrollY||pageYOffset,S=e.getBoundingClientRect(),$=S.height,w=S.width,C=S.top,O=S.right,x=S.bottom,I=S.left,T=r==="start"||r==="nearest"?C:r==="end"?x:C+$/2,M=i==="center"?I+w/2:i==="end"?O:I,E=[],A=0;A=0&&I>=0&&x<=g&&O<=v&&C>=N&&x<=F&&I>=L&&O<=k)return E;var H=getComputedStyle(R),j=parseInt(H.borderLeftWidth,10),Y=parseInt(H.borderTopWidth,10),Z=parseInt(H.borderRightWidth,10),X=parseInt(H.borderBottomWidth,10),ee=0,U=0,Q="offsetWidth"in R?R.offsetWidth-R.clientWidth-j-Z:0,J="offsetHeight"in R?R.offsetHeight-R.clientHeight-Y-X:0,G="offsetWidth"in R?R.offsetWidth===0?0:D/R.offsetWidth:0,q="offsetHeight"in R?R.offsetHeight===0?0:_/R.offsetHeight:0;if(d===R)ee=r==="start"?T:r==="end"?T-g:r==="nearest"?Nu(y,y+g,g,Y,X,y+T,y+T+$,$):T-g/2,U=i==="start"?M:i==="center"?M-v/2:i==="end"?M-v:Nu(b,b+v,v,j,Z,b+M,b+M+w,w),ee=Math.max(0,ee+y),U=Math.max(0,U+b);else{ee=r==="start"?T-N-Y:r==="end"?T-F+X+J:r==="nearest"?Nu(N,F,_,Y,X+J,T,T+$,$):T-(N+_/2)+J/2,U=i==="start"?M-L-j:i==="center"?M-(L+D/2)+Q/2:i==="end"?M-k+Z+Q:Nu(L,k,D,j,Z+Q,M,M+w,w);var V=R.scrollLeft,W=R.scrollTop;T+=W-(ee=Math.max(0,Math.min(W+ee/q,R.scrollHeight-_/q+J))),M+=V-(U=Math.max(0,Math.min(V+U/G,R.scrollWidth-D/G+Q)))}E.push({el:R,top:ee,left:U})}return E};function cP(e){return e===Object(e)&&Object.keys(e).length!==0}function PB(e,t){t===void 0&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(o){var r=o.el,i=o.top,l=o.left;r.scroll&&n?r.scroll({top:i,left:l,behavior:t}):(r.scrollTop=i,r.scrollLeft=l)})}function IB(e){return e===!1?{block:"end",inline:"nearest"}:cP(e)?e:{block:"start",inline:"nearest"}}function uP(e,t){var n=e.isConnected||e.ownerDocument.documentElement.contains(e);if(cP(t)&&typeof t.behavior=="function")return t.behavior(n?mC(e,t):[]);if(n){var o=IB(t);return PB(mC(e,o),o.behavior)}}function TB(e,t,n,o){const r=n-t;return e/=o/2,e<1?r/2*e*e*e+t:r/2*((e-=2)*e*e+2)+t}function Fm(e){return e!=null&&e===e.window}function Wb(e,t){var n,o;if(typeof window>"u")return 0;const r="scrollTop";let i=0;return Fm(e)?i=e.scrollY:e instanceof Document?i=e.documentElement[r]:(e instanceof HTMLElement||e)&&(i=e[r]),e&&!Fm(e)&&typeof i!="number"&&(i=(o=((n=e.ownerDocument)!==null&&n!==void 0?n:e).documentElement)===null||o===void 0?void 0:o[r]),i}function Kb(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{getContainer:n=()=>window,callback:o,duration:r=450}=t,i=n(),l=Wb(i),a=Date.now(),s=()=>{const u=Date.now()-a,d=TB(u>r?r:u,l,e,r);Fm(i)?i.scrollTo(window.scrollX,d):i instanceof Document?i.documentElement.scrollTop=d:i.scrollTop=d,u{Ye(dP,e)},_B=()=>Ge(dP,{registerLink:ku,unregisterLink:ku,scrollTo:ku,activeLink:P(()=>""),handleClick:ku,direction:P(()=>"vertical")}),MB=e=>{const{componentCls:t,holderOffsetBlock:n,motionDurationSlow:o,lineWidthBold:r,colorPrimary:i,lineType:l,colorSplit:a}=e;return{[`${t}-wrapper`]:{marginBlockStart:-n,paddingBlockStart:n,backgroundColor:"transparent",[t]:m(m({},qe(e)),{position:"relative",paddingInlineStart:r,[`${t}-link`]:{paddingBlock:e.anchorPaddingBlock,paddingInline:`${e.anchorPaddingInline}px 0`,"&-title":m(m({},Jt),{position:"relative",display:"block",marginBlockEnd:e.anchorTitleBlock,color:e.colorText,transition:`all ${e.motionDurationSlow}`,"&:only-child":{marginBlockEnd:0}}),[`&-active > ${t}-link-title`]:{color:e.colorPrimary},[`${t}-link`]:{paddingBlock:e.anchorPaddingBlockSecondary}}}),[`&:not(${t}-wrapper-horizontal)`]:{[t]:{"&::before":{position:"absolute",left:{_skip_check_:!0,value:0},top:0,height:"100%",borderInlineStart:`${r}px ${l} ${a}`,content:'" "'},[`${t}-ink`]:{position:"absolute",left:{_skip_check_:!0,value:0},display:"none",transform:"translateY(-50%)",transition:`top ${o} ease-in-out`,width:r,backgroundColor:i,[`&${t}-ink-visible`]:{display:"inline-block"}}}},[`${t}-fixed ${t}-ink ${t}-ink`]:{display:"none"}}}},AB=e=>{const{componentCls:t,motionDurationSlow:n,lineWidthBold:o,colorPrimary:r}=e;return{[`${t}-wrapper-horizontal`]:{position:"relative","&::before":{position:"absolute",left:{_skip_check_:!0,value:0},right:{_skip_check_:!0,value:0},bottom:0,borderBottom:`1px ${e.lineType} ${e.colorSplit}`,content:'" "'},[t]:{overflowX:"scroll",position:"relative",display:"flex",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},[`${t}-link:first-of-type`]:{paddingInline:0},[`${t}-ink`]:{position:"absolute",bottom:0,transition:`left ${n} ease-in-out, width ${n} ease-in-out`,height:o,backgroundColor:r}}}}},RB=Ue("Anchor",e=>{const{fontSize:t,fontSizeLG:n,padding:o,paddingXXS:r}=e,i=ze(e,{holderOffsetBlock:r,anchorPaddingBlock:r,anchorPaddingBlockSecondary:r/2,anchorPaddingInline:o,anchorTitleBlock:t/14*3,anchorBallSize:n/2});return[MB(i),AB(i)]}),DB=()=>({prefixCls:String,href:String,title:It(),target:String,customTitleProps:Be()}),Gb=re({compatConfig:{MODE:3},name:"AAnchorLink",inheritAttrs:!1,props:Qe(DB(),{href:"#"}),slots:Object,setup(e,t){let{slots:n,attrs:o}=t,r=null;const{handleClick:i,scrollTo:l,unregisterLink:a,registerLink:s,activeLink:c}=_B(),{prefixCls:u}=Ee("anchor",e),d=f=>{const{href:h}=e;i(f,{title:r,href:h}),l(h)};return ye(()=>e.href,(f,h)=>{rt(()=>{a(h),s(f)})}),Ke(()=>{s(e.href)}),et(()=>{a(e.href)}),()=>{var f;const{href:h,target:v,title:g=n.title,customTitleProps:b={}}=e,y=u.value;r=typeof g=="function"?g(b):g;const S=c.value===h,$=le(`${y}-link`,{[`${y}-link-active`]:S},o.class),w=le(`${y}-link-title`,{[`${y}-link-title-active`]:S});return p("div",B(B({},o),{},{class:$}),[p("a",{class:w,href:h,title:typeof r=="string"?r:"",target:v,onClick:d},[n.customTitle?n.customTitle(b):r]),(f=n.default)===null||f===void 0?void 0:f.call(n)])}}});function BB(e,t){for(var n=0;n=0||(r[n]=e[n]);return r}function bC(e){return((t=e)!=null&&typeof t=="object"&&Array.isArray(t)===!1)==1&&Object.prototype.toString.call(e)==="[object Object]";var t}var gP=Object.prototype,vP=gP.toString,NB=gP.hasOwnProperty,mP=/^\s*function (\w+)/;function yC(e){var t,n=(t=e==null?void 0:e.type)!==null&&t!==void 0?t:e;if(n){var o=n.toString().match(mP);return o?o[1]:""}return""}var kl=function(e){var t,n;return bC(e)!==!1&&typeof(t=e.constructor)=="function"&&bC(n=t.prototype)!==!1&&n.hasOwnProperty("isPrototypeOf")!==!1},kB=function(e){return e},wo=kB,Ic=function(e,t){return NB.call(e,t)},FB=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e},qa=Array.isArray||function(e){return vP.call(e)==="[object Array]"},Ja=function(e){return vP.call(e)==="[object Function]"},If=function(e){return kl(e)&&Ic(e,"_vueTypes_name")},bP=function(e){return kl(e)&&(Ic(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return Ic(e,t)}))};function Ub(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function Gl(e,t,n){var o,r=!0,i="";o=kl(e)?e:{type:e};var l=If(o)?o._vueTypes_name+" - ":"";if(bP(o)&&o.type!==null){if(o.type===void 0||o.type===!0||!o.required&&t===void 0)return r;qa(o.type)?(r=o.type.some(function(d){return Gl(d,t)===!0}),i=o.type.map(function(d){return yC(d)}).join(" or ")):r=(i=yC(o))==="Array"?qa(t):i==="Object"?kl(t):i==="String"||i==="Number"||i==="Boolean"||i==="Function"?function(d){if(d==null)return"";var f=d.constructor.toString().match(mP);return f?f[1]:""}(t)===i:t instanceof o.type}if(!r){var a=l+'value "'+t+'" should be of type "'+i+'"';return a}if(Ic(o,"validator")&&Ja(o.validator)){var s=wo,c=[];if(wo=function(d){c.push(d)},r=o.validator(t),wo=s,!r){var u=(c.length>1?"* ":"")+c.join(` +* `);return c.length=0,u}}return r}function Io(e,t){var n=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(r){return r!==void 0||this.default?Ja(r)||Gl(this,r)===!0?(this.default=qa(r)?function(){return[].concat(r)}:kl(r)?function(){return Object.assign({},r)}:r,this):(wo(this._vueTypes_name+' - invalid default value: "'+r+'"'),this):this}}}),o=n.validator;return Ja(o)&&(n.validator=Ub(o,n)),n}function Mr(e,t){var n=Io(e,t);return Object.defineProperty(n,"validate",{value:function(o){return Ja(this.validator)&&wo(this._vueTypes_name+` - calling .validate() will overwrite the current custom validator function. Validator info: +`+JSON.stringify(this)),this.validator=Ub(o,this),this}})}function SC(e,t,n){var o,r,i=(o=t,r={},Object.getOwnPropertyNames(o).forEach(function(d){r[d]=Object.getOwnPropertyDescriptor(o,d)}),Object.defineProperties({},r));if(i._vueTypes_name=e,!kl(n))return i;var l,a,s=n.validator,c=hP(n,["validator"]);if(Ja(s)){var u=i.validator;u&&(u=(a=(l=u).__original)!==null&&a!==void 0?a:l),i.validator=Ub(u?function(d){return u.call(this,d)&&s.call(this,d)}:s,i)}return Object.assign(i,c)}function Yp(e){return e.replace(/^(?!\s*$)/gm," ")}var LB=function(){return Mr("any",{})},zB=function(){return Mr("function",{type:Function})},HB=function(){return Mr("boolean",{type:Boolean})},jB=function(){return Mr("string",{type:String})},VB=function(){return Mr("number",{type:Number})},WB=function(){return Mr("array",{type:Array})},KB=function(){return Mr("object",{type:Object})},GB=function(){return Io("integer",{type:Number,validator:function(e){return FB(e)}})},UB=function(){return Io("symbol",{validator:function(e){return typeof e=="symbol"}})};function XB(e,t){if(t===void 0&&(t="custom validation failed"),typeof e!="function")throw new TypeError("[VueTypes error]: You must provide a function as argument");return Io(e.name||"<>",{validator:function(n){var o=e(n);return o||wo(this._vueTypes_name+" - "+t),o}})}function YB(e){if(!qa(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'".',n=e.reduce(function(o,r){if(r!=null){var i=r.constructor;o.indexOf(i)===-1&&o.push(i)}return o},[]);return Io("oneOf",{type:n.length>0?n:void 0,validator:function(o){var r=e.indexOf(o)!==-1;return r||wo(t),r}})}function qB(e){if(!qa(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,n=[],o=0;o0&&n.some(function(s){return l.indexOf(s)===-1})){var a=n.filter(function(s){return l.indexOf(s)===-1});return wo(a.length===1?'shape - required property "'+a[0]+'" is not defined.':'shape - required properties "'+a.join('", "')+'" are not defined.'),!1}return l.every(function(s){if(t.indexOf(s)===-1)return i._vueTypes_isLoose===!0||(wo('shape - shape definition does not include a "'+s+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var c=Gl(e[s],r[s]);return typeof c=="string"&&wo('shape - "'+s+`" property validation error: + `+Yp(c)),c===!0})}});return Object.defineProperty(o,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(o,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),o}var Sr=function(){function e(){}return e.extend=function(t){var n=this;if(qa(t))return t.forEach(function(d){return n.extend(d)}),this;var o=t.name,r=t.validate,i=r!==void 0&&r,l=t.getter,a=l!==void 0&&l,s=hP(t,["name","validate","getter"]);if(Ic(this,o))throw new TypeError('[VueTypes error]: Type "'+o+'" already defined');var c,u=s.type;return If(u)?(delete s.type,Object.defineProperty(this,o,a?{get:function(){return SC(o,u,s)}}:{value:function(){var d,f=SC(o,u,s);return f.validator&&(f.validator=(d=f.validator).bind.apply(d,[f].concat([].slice.call(arguments)))),f}})):(c=a?{get:function(){var d=Object.assign({},s);return i?Mr(o,d):Io(o,d)},enumerable:!0}:{value:function(){var d,f,h=Object.assign({},s);return d=i?Mr(o,h):Io(o,h),h.validator&&(d.validator=(f=h.validator).bind.apply(f,[d].concat([].slice.call(arguments)))),d},enumerable:!0},Object.defineProperty(this,o,c))},fP(e,null,[{key:"any",get:function(){return LB()}},{key:"func",get:function(){return zB().def(this.defaults.func)}},{key:"bool",get:function(){return HB().def(this.defaults.bool)}},{key:"string",get:function(){return jB().def(this.defaults.string)}},{key:"number",get:function(){return VB().def(this.defaults.number)}},{key:"array",get:function(){return WB().def(this.defaults.array)}},{key:"object",get:function(){return KB().def(this.defaults.object)}},{key:"integer",get:function(){return GB().def(this.defaults.integer)}},{key:"symbol",get:function(){return UB()}}]),e}();function yP(e){var t;return e===void 0&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(t=function(n){function o(){return n.apply(this,arguments)||this}return pP(o,n),fP(o,null,[{key:"sensibleDefaults",get:function(){return bd({},this.defaults)},set:function(r){this.defaults=r!==!1?bd({},r!==!0?r:e):{}}}]),o}(Sr)).defaults=bd({},e),t}Sr.defaults={},Sr.custom=XB,Sr.oneOf=YB,Sr.instanceOf=ZB,Sr.oneOfType=qB,Sr.arrayOf=JB,Sr.objectOf=QB,Sr.shape=eN,Sr.utils={validate:function(e,t){return Gl(t,e)===!0},toType:function(e,t,n){return n===void 0&&(n=!1),n?Mr(e,t):Io(e,t)}};(function(e){function t(){return e.apply(this,arguments)||this}return pP(t,e),t})(yP());const K=yP({func:void 0,bool:void 0,string:void 0,number:void 0,array:void 0,object:void 0,integer:void 0});K.extend([{name:"looseBool",getter:!0,type:Boolean,default:void 0},{name:"style",getter:!0,type:[String,Object],default:void 0},{name:"VueNode",getter:!0,type:null}]);function SP(e){return e.default=void 0,e}const Mt=(e,t,n)=>{Db(e,`[ant-design-vue: ${t}] ${n}`)};function tN(){return window}function $C(e,t){if(!e.getClientRects().length)return 0;const n=e.getBoundingClientRect();return n.width||n.height?t===window?(t=e.ownerDocument.documentElement,n.top-t.clientTop):n.top-t.getBoundingClientRect().top:n.top}const CC=/#([\S ]+)$/,nN=()=>({prefixCls:String,offsetTop:Number,bounds:Number,affix:{type:Boolean,default:!0},showInkInFixed:{type:Boolean,default:!1},getContainer:Function,wrapperClass:String,wrapperStyle:{type:Object,default:void 0},getCurrentAnchor:Function,targetOffset:Number,items:ct(),direction:K.oneOf(["vertical","horizontal"]).def("vertical"),onChange:Function,onClick:Function}),gl=re({compatConfig:{MODE:3},name:"AAnchor",inheritAttrs:!1,props:nN(),setup(e,t){let{emit:n,attrs:o,slots:r,expose:i}=t;const{prefixCls:l,getTargetContainer:a,direction:s}=Ee("anchor",e),c=P(()=>{var x;return(x=e.direction)!==null&&x!==void 0?x:"vertical"}),u=ne(null),d=ne(),f=ft({links:[],scrollContainer:null,scrollEvent:null,animating:!1}),h=ne(null),v=P(()=>{const{getContainer:x}=e;return x||(a==null?void 0:a.value)||tN}),g=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;const T=[],M=v.value();return f.links.forEach(E=>{const A=CC.exec(E.toString());if(!A)return;const R=document.getElementById(A[1]);if(R){const z=$C(R,M);zR.top>A.top?R:A).link:""},b=x=>{const{getCurrentAnchor:I}=e;h.value!==x&&(h.value=typeof I=="function"?I(x):x,n("change",x))},y=x=>{const{offsetTop:I,targetOffset:T}=e;b(x);const M=CC.exec(x);if(!M)return;const E=document.getElementById(M[1]);if(!E)return;const A=v.value(),R=Wb(A),z=$C(E,A);let _=R+z;_-=T!==void 0?T:I||0,f.animating=!0,Kb(_,{callback:()=>{f.animating=!1},getContainer:v.value})};i({scrollTo:y});const S=()=>{if(f.animating)return;const{offsetTop:x,bounds:I,targetOffset:T}=e,M=g(T!==void 0?T:x||0,I);b(M)},$=()=>{const x=d.value.querySelector(`.${l.value}-link-title-active`);if(x&&u.value){const I=c.value==="horizontal";u.value.style.top=I?"":`${x.offsetTop+x.clientHeight/2}px`,u.value.style.height=I?"":`${x.clientHeight}px`,u.value.style.left=I?`${x.offsetLeft}px`:"",u.value.style.width=I?`${x.clientWidth}px`:"",I&&uP(x,{scrollMode:"if-needed",block:"nearest"})}};EB({registerLink:x=>{f.links.includes(x)||f.links.push(x)},unregisterLink:x=>{const I=f.links.indexOf(x);I!==-1&&f.links.splice(I,1)},activeLink:h,scrollTo:y,handleClick:(x,I)=>{n("click",x,I)},direction:c}),Ke(()=>{rt(()=>{const x=v.value();f.scrollContainer=x,f.scrollEvent=Nt(f.scrollContainer,"scroll",S),S()})}),et(()=>{f.scrollEvent&&f.scrollEvent.remove()}),jn(()=>{if(f.scrollEvent){const x=v.value();f.scrollContainer!==x&&(f.scrollContainer=x,f.scrollEvent.remove(),f.scrollEvent=Nt(f.scrollContainer,"scroll",S),S())}$()});const w=x=>Array.isArray(x)?x.map(I=>{const{children:T,key:M,href:E,target:A,class:R,style:z,title:_}=I;return p(Gb,{key:M,href:E,target:A,class:R,style:z,title:_,customTitleProps:I},{default:()=>[c.value==="vertical"?w(T):null],customTitle:r.customTitle})}):null,[C,O]=RB(l);return()=>{var x;const{offsetTop:I,affix:T,showInkInFixed:M}=e,E=l.value,A=le(`${E}-ink`,{[`${E}-ink-visible`]:h.value}),R=le(O.value,e.wrapperClass,`${E}-wrapper`,{[`${E}-wrapper-horizontal`]:c.value==="horizontal",[`${E}-rtl`]:s.value==="rtl"}),z=le(E,{[`${E}-fixed`]:!T&&!M}),_=m({maxHeight:I?`calc(100vh - ${I}px)`:"100vh"},e.wrapperStyle),D=p("div",{class:R,style:_,ref:d},[p("div",{class:z},[p("span",{class:A,ref:u},null),Array.isArray(e.items)?w(e.items):(x=r.default)===null||x===void 0?void 0:x.call(r)])]);return C(T?p(sP,B(B({},o),{},{offsetTop:I,target:v.value}),{default:()=>[D]}):D)}}});gl.Link=Gb;gl.install=function(e){return e.component(gl.name,gl),e.component(gl.Link.name,gl.Link),e};function xC(e,t){const{key:n}=e;let o;return"value"in e&&({value:o}=e),n??(o!==void 0?o:`rc-index-key-${t}`)}function $P(e,t){const{label:n,value:o,options:r}=e||{};return{label:n||(t?"children":"label"),value:o||"value",options:r||"options"}}function oN(e){let{fieldNames:t,childrenAsData:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=[],{label:r,value:i,options:l}=$P(t,!1);function a(s,c){s.forEach(u=>{const d=u[r];if(c||!(l in u)){const f=u[i];o.push({key:xC(u,o.length),groupOption:c,data:u,label:d,value:f})}else{let f=d;f===void 0&&n&&(f=u.label),o.push({key:xC(u,o.length),group:!0,data:u,label:f}),a(u[l],!0)}})}return a(e,!1),o}function Lm(e){const t=m({},e);return"props"in t||Object.defineProperty(t,"props",{get(){return t}}),t}function rN(e,t){if(!t||!t.length)return null;let n=!1;function o(i,l){let[a,...s]=l;if(!a)return[i];const c=i.split(a);return n=n||c.length>1,c.reduce((u,d)=>[...u,...o(d,s)],[]).filter(u=>u)}const r=o(e,t);return n?r:null}function iN(){return""}function lN(e){return e?e.ownerDocument:window.document}function CP(){}const xP=()=>({action:K.oneOfType([K.string,K.arrayOf(K.string)]).def([]),showAction:K.any.def([]),hideAction:K.any.def([]),getPopupClassNameFromAlign:K.any.def(iN),onPopupVisibleChange:Function,afterPopupVisibleChange:K.func.def(CP),popup:K.any,arrow:K.bool.def(!0),popupStyle:{type:Object,default:void 0},prefixCls:K.string.def("rc-trigger-popup"),popupClassName:K.string.def(""),popupPlacement:String,builtinPlacements:K.object,popupTransitionName:String,popupAnimation:K.any,mouseEnterDelay:K.number.def(0),mouseLeaveDelay:K.number.def(.1),zIndex:Number,focusDelay:K.number.def(0),blurDelay:K.number.def(.15),getPopupContainer:Function,getDocument:K.func.def(lN),forceRender:{type:Boolean,default:void 0},destroyPopupOnHide:{type:Boolean,default:!1},mask:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!0},popupAlign:K.object.def(()=>({})),popupVisible:{type:Boolean,default:void 0},defaultPopupVisible:{type:Boolean,default:!1},maskTransitionName:String,maskAnimation:String,stretch:String,alignPoint:{type:Boolean,default:void 0},autoDestroy:{type:Boolean,default:!1},mobile:Object,getTriggerDOMNode:Function}),Xb={visible:Boolean,prefixCls:String,zIndex:Number,destroyPopupOnHide:Boolean,forceRender:Boolean,arrow:{type:Boolean,default:!0},animation:[String,Object],transitionName:String,stretch:{type:String},align:{type:Object},point:{type:Object},getRootDomNode:{type:Function},getClassNameFromAlign:{type:Function},onAlign:{type:Function},onMouseenter:{type:Function},onMouseleave:{type:Function},onMousedown:{type:Function},onTouchstart:{type:Function}},aN=m(m({},Xb),{mobile:{type:Object}}),sN=m(m({},Xb),{mask:Boolean,mobile:{type:Object},maskAnimation:String,maskTransitionName:String});function Yb(e){let{prefixCls:t,animation:n,transitionName:o}=e;return n?{name:`${t}-${n}`}:o?{name:o}:{}}function wP(e){const{prefixCls:t,visible:n,zIndex:o,mask:r,maskAnimation:i,maskTransitionName:l}=e;if(!r)return null;let a={};return(l||i)&&(a=Yb({prefixCls:t,transitionName:l,animation:i})),p(bn,B({appear:!0},a),{default:()=>[Ln(p("div",{style:{zIndex:o},class:`${t}-mask`},null),[[yA("if"),n]])]})}wP.displayName="Mask";const cN=re({compatConfig:{MODE:3},name:"MobilePopupInner",inheritAttrs:!1,props:aN,emits:["mouseenter","mouseleave","mousedown","touchstart","align"],setup(e,t){let{expose:n,slots:o}=t;const r=ne();return n({forceAlign:()=>{},getElement:()=>r.value}),()=>{var i;const{zIndex:l,visible:a,prefixCls:s,mobile:{popupClassName:c,popupStyle:u,popupMotion:d={},popupRender:f}={}}=e,h=m({zIndex:l},u);let v=wt((i=o.default)===null||i===void 0?void 0:i.call(o));v.length>1&&(v=p("div",{class:`${s}-content`},[v])),f&&(v=f(v));const g=le(s,c);return p(bn,B({ref:r},d),{default:()=>[a?p("div",{class:g,style:h},[v]):null]})}}});var uN=function(e,t,n,o){function r(i){return i instanceof n?i:new n(function(l){l(i)})}return new(n||(n=Promise))(function(i,l){function a(u){try{c(o.next(u))}catch(d){l(d)}}function s(u){try{c(o.throw(u))}catch(d){l(d)}}function c(u){u.done?i(u.value):r(u.value).then(a,s)}c((o=o.apply(e,t||[])).next())})};const wC=["measure","align",null,"motion"],dN=(e,t)=>{const n=oe(null),o=oe(),r=oe(!1);function i(s){r.value||(n.value=s)}function l(){Ze.cancel(o.value)}function a(s){l(),o.value=Ze(()=>{let c=n.value;switch(n.value){case"align":c="motion";break;case"motion":c="stable";break}i(c),s==null||s()})}return ye(e,()=>{i("measure")},{immediate:!0,flush:"post"}),Ke(()=>{ye(n,()=>{switch(n.value){case"measure":t();break}n.value&&(o.value=Ze(()=>uN(void 0,void 0,void 0,function*(){const s=wC.indexOf(n.value),c=wC[s+1];c&&s!==-1&&i(c)})))},{immediate:!0,flush:"post"})}),et(()=>{r.value=!0,l()}),[n,a]},fN=e=>{const t=oe({width:0,height:0});function n(r){t.value={width:r.offsetWidth,height:r.offsetHeight}}return[P(()=>{const r={};if(e.value){const{width:i,height:l}=t.value;e.value.indexOf("height")!==-1&&l?r.height=`${l}px`:e.value.indexOf("minHeight")!==-1&&l&&(r.minHeight=`${l}px`),e.value.indexOf("width")!==-1&&i?r.width=`${i}px`:e.value.indexOf("minWidth")!==-1&&i&&(r.minWidth=`${i}px`)}return r}),n]};function OC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function PC(e){for(var t=1;t=0&&n.left>=0&&n.bottom>n.top&&n.right>n.left?n:null}function BN(e,t,n,o){var r=dt.clone(e),i={width:t.width,height:t.height};return o.adjustX&&r.left=n.left&&r.left+i.width>n.right&&(i.width-=r.left+i.width-n.right),o.adjustX&&r.left+i.width>n.right&&(r.left=Math.max(n.right-i.width,n.left)),o.adjustY&&r.top=n.top&&r.top+i.height>n.bottom&&(i.height-=r.top+i.height-n.bottom),o.adjustY&&r.top+i.height>n.bottom&&(r.top=Math.max(n.bottom-i.height,n.top)),dt.mix(r,i)}function Qb(e){var t,n,o;if(!dt.isWindow(e)&&e.nodeType!==9)t=dt.offset(e),n=dt.outerWidth(e),o=dt.outerHeight(e);else{var r=dt.getWindow(e);t={left:dt.getWindowScrollLeft(r),top:dt.getWindowScrollTop(r)},n=dt.viewportWidth(r),o=dt.viewportHeight(r)}return t.width=n,t.height=o,t}function DC(e,t){var n=t.charAt(0),o=t.charAt(1),r=e.width,i=e.height,l=e.left,a=e.top;return n==="c"?a+=i/2:n==="b"&&(a+=i),o==="c"?l+=r/2:o==="r"&&(l+=r),{left:l,top:a}}function Lu(e,t,n,o,r){var i=DC(t,n[1]),l=DC(e,n[0]),a=[l.left-i.left,l.top-i.top];return{left:Math.round(e.left-a[0]+o[0]-r[0]),top:Math.round(e.top-a[1]+o[1]-r[1])}}function BC(e,t,n){return e.leftn.right}function NC(e,t,n){return e.topn.bottom}function NN(e,t,n){return e.left>n.right||e.left+t.widthn.bottom||e.top+t.height=n.right||o.top>=n.bottom}function ey(e,t,n){var o=n.target||t,r=Qb(o),i=!FN(o,n.overflow&&n.overflow.alwaysByViewport);return AP(e,r,n,i)}ey.__getOffsetParent=Vm;ey.__getVisibleRectForElement=Zb;function LN(e,t,n){var o,r,i=dt.getDocument(e),l=i.defaultView||i.parentWindow,a=dt.getWindowScrollLeft(l),s=dt.getWindowScrollTop(l),c=dt.viewportWidth(l),u=dt.viewportHeight(l);"pageX"in t?o=t.pageX:o=a+t.clientX,"pageY"in t?r=t.pageY:r=s+t.clientY;var d={left:o,top:r,width:0,height:0},f=o>=0&&o<=a+c&&r>=0&&r<=s+u,h=[n.points[0],"cc"];return AP(e,d,PC(PC({},n),{},{points:h}),f)}function pt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=e;if(Array.isArray(e)&&(r=kt(e)[0]),!r)return null;const i=mn(r,t,o);return i.props=n?m(m({},i.props),t):i.props,Po(typeof i.props.class!="object"),i}function zN(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e.map(o=>pt(o,t,n))}function Qs(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(Array.isArray(e))return e.map(r=>Qs(r,t,n,o));{if(!Yt(e))return e;const r=pt(e,t,n,o);return Array.isArray(r.children)&&(r.children=Qs(r.children)),r}}function HN(e,t,n){Hi(mn(e,m({},t)),n)}const RP=e=>(e||[]).some(t=>Yt(t)?!(t.type===Tn||t.type===Le&&!RP(t.children)):!0)?e:null;function Jp(e,t,n,o){var r;const i=(r=e[t])===null||r===void 0?void 0:r.call(e,n);return RP(i)?i:o==null?void 0:o()}const Zp=e=>{if(!e)return!1;if(e.offsetParent)return!0;if(e.getBBox){const t=e.getBBox();if(t.width||t.height)return!0}if(e.getBoundingClientRect){const t=e.getBoundingClientRect();if(t.width||t.height)return!0}return!1};function jN(e,t){return e===t?!0:!e||!t?!1:"pageX"in t&&"pageY"in t?e.pageX===t.pageX&&e.pageY===t.pageY:"clientX"in t&&"clientY"in t?e.clientX===t.clientX&&e.clientY===t.clientY:!1}function VN(e,t){e!==document.activeElement&&Ti(t,e)&&typeof e.focus=="function"&&e.focus()}function LC(e,t){let n=null,o=null;function r(l){let[{target:a}]=l;if(!document.documentElement.contains(a))return;const{width:s,height:c}=a.getBoundingClientRect(),u=Math.floor(s),d=Math.floor(c);(n!==u||o!==d)&&Promise.resolve().then(()=>{t({width:u,height:d})}),n=u,o=d}const i=new Tb(r);return e&&i.observe(e),()=>{i.disconnect()}}const WN=(e,t)=>{let n=!1,o=null;function r(){clearTimeout(o)}function i(l){if(!n||l===!0){if(e()===!1)return;n=!0,r(),o=setTimeout(()=>{n=!1},t.value)}else r(),o=setTimeout(()=>{n=!1,i()},t.value)}return[i,()=>{n=!1,r()}]};function KN(){this.__data__=[],this.size=0}function ty(e,t){return e===t||e!==e&&t!==t}function Qp(e,t){for(var n=e.length;n--;)if(ty(e[n][0],t))return n;return-1}var GN=Array.prototype,UN=GN.splice;function XN(e){var t=this.__data__,n=Qp(t,e);if(n<0)return!1;var o=t.length-1;return n==o?t.pop():UN.call(t,n,1),--this.size,!0}function YN(e){var t=this.__data__,n=Qp(t,e);return n<0?void 0:t[n][1]}function qN(e){return Qp(this.__data__,e)>-1}function JN(e,t){var n=this.__data__,o=Qp(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}function ci(e){var t=-1,n=e==null?0:e.length;for(this.clear();++ta))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var d=-1,f=!0,h=n&Jk?new Za:void 0;for(i.set(e,t),i.set(t,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=OF}var PF="[object Arguments]",IF="[object Array]",TF="[object Boolean]",EF="[object Date]",_F="[object Error]",MF="[object Function]",AF="[object Map]",RF="[object Number]",DF="[object Object]",BF="[object RegExp]",NF="[object Set]",kF="[object String]",FF="[object WeakMap]",LF="[object ArrayBuffer]",zF="[object DataView]",HF="[object Float32Array]",jF="[object Float64Array]",VF="[object Int8Array]",WF="[object Int16Array]",KF="[object Int32Array]",GF="[object Uint8Array]",UF="[object Uint8ClampedArray]",XF="[object Uint16Array]",YF="[object Uint32Array]",jt={};jt[HF]=jt[jF]=jt[VF]=jt[WF]=jt[KF]=jt[GF]=jt[UF]=jt[XF]=jt[YF]=!0;jt[PF]=jt[IF]=jt[LF]=jt[TF]=jt[zF]=jt[EF]=jt[_F]=jt[MF]=jt[AF]=jt[RF]=jt[DF]=jt[BF]=jt[NF]=jt[kF]=jt[FF]=!1;function qF(e){return sr(e)&&ly(e.length)&&!!jt[Gi(e)]}function ay(e){return function(t){return e(t)}}var jP=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ec=jP&&typeof module=="object"&&module&&!module.nodeType&&module,JF=ec&&ec.exports===jP,nv=JF&&DP.process,Qa=function(){try{var e=ec&&ec.require&&ec.require("util").types;return e||nv&&nv.binding&&nv.binding("util")}catch{}}(),UC=Qa&&Qa.isTypedArray,sy=UC?ay(UC):qF,ZF=Object.prototype,QF=ZF.hasOwnProperty;function VP(e,t){var n=To(e),o=!n&&th(e),r=!n&&!o&&Mc(e),i=!n&&!o&&!r&&sy(e),l=n||o||r||i,a=l?vF(e.length,String):[],s=a.length;for(var c in e)(t||QF.call(e,c))&&!(l&&(c=="length"||r&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||iy(c,s)))&&a.push(c);return a}var eL=Object.prototype;function nh(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||eL;return e===n}function WP(e,t){return function(n){return e(t(n))}}var tL=WP(Object.keys,Object),nL=Object.prototype,oL=nL.hasOwnProperty;function KP(e){if(!nh(e))return tL(e);var t=[];for(var n in Object(e))oL.call(e,n)&&n!="constructor"&&t.push(n);return t}function ls(e){return e!=null&&ly(e.length)&&!NP(e)}function as(e){return ls(e)?VP(e):KP(e)}function Wm(e){return FP(e,as,ry)}var rL=1,iL=Object.prototype,lL=iL.hasOwnProperty;function aL(e,t,n,o,r,i){var l=n&rL,a=Wm(e),s=a.length,c=Wm(t),u=c.length;if(s!=u&&!l)return!1;for(var d=s;d--;){var f=a[d];if(!(l?f in t:lL.call(t,f)))return!1}var h=i.get(e),v=i.get(t);if(h&&v)return h==t&&v==e;var g=!0;i.set(e,t),i.set(t,e);for(var b=l;++d{const{disabled:f,target:h,align:v,onAlign:g}=e;if(!f&&h&&i.value){const b=i.value;let y;const S=nx(h),$=ox(h);r.value.element=S,r.value.point=$,r.value.align=v;const{activeElement:w}=document;return S&&Zp(S)?y=ey(b,S,v):$&&(y=LN(b,$,v)),VN(w,b),g&&y&&g(b,y),!0}return!1},P(()=>e.monitorBufferTime)),s=ne({cancel:()=>{}}),c=ne({cancel:()=>{}}),u=()=>{const f=e.target,h=nx(f),v=ox(f);i.value!==c.value.element&&(c.value.cancel(),c.value.element=i.value,c.value.cancel=LC(i.value,l)),(r.value.element!==h||!jN(r.value.point,v)||!cy(r.value.align,e.align))&&(l(),s.value.element!==h&&(s.value.cancel(),s.value.element=h,s.value.cancel=LC(h,l)))};Ke(()=>{rt(()=>{u()})}),jn(()=>{rt(()=>{u()})}),ye(()=>e.disabled,f=>{f?a():l()},{immediate:!0,flush:"post"});const d=ne(null);return ye(()=>e.monitorWindowResize,f=>{f?d.value||(d.value=Nt(window,"resize",l)):d.value&&(d.value.remove(),d.value=null)},{flush:"post"}),wn(()=>{s.value.cancel(),c.value.cancel(),d.value&&d.value.remove(),a()}),n({forceAlign:()=>l(!0)}),()=>{const f=o==null?void 0:o.default();return f?pt(f[0],{ref:i},!0,!0):null}}});Mn("bottomLeft","bottomRight","topLeft","topRight");const uy=e=>e!==void 0&&(e==="topLeft"||e==="topRight")?"slide-down":"slide-up",Go=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return m(e?{name:e,appear:!0,enterFromClass:`${e}-enter ${e}-enter-prepare ${e}-enter-start`,enterActiveClass:`${e}-enter ${e}-enter-prepare`,enterToClass:`${e}-enter ${e}-enter-active`,leaveFromClass:` ${e}-leave`,leaveActiveClass:`${e}-leave ${e}-leave-active`,leaveToClass:`${e}-leave ${e}-leave-active`}:{css:!1},t)},rh=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return m(e?{name:e,appear:!0,appearActiveClass:`${e}`,appearToClass:`${e}-appear ${e}-appear-active`,enterFromClass:`${e}-appear ${e}-enter ${e}-appear-prepare ${e}-enter-prepare`,enterActiveClass:`${e}`,enterToClass:`${e}-enter ${e}-appear ${e}-appear-active ${e}-enter-active`,leaveActiveClass:`${e} ${e}-leave`,leaveToClass:`${e}-leave-active`}:{css:!1},t)},Hn=(e,t,n)=>n!==void 0?n:`${e}-${t}`,yL=re({compatConfig:{MODE:3},name:"PopupInner",inheritAttrs:!1,props:Xb,emits:["mouseenter","mouseleave","mousedown","touchstart","align"],setup(e,t){let{expose:n,attrs:o,slots:r}=t;const i=oe(),l=oe(),a=oe(),[s,c]=fN(We(e,"stretch")),u=()=>{e.stretch&&c(e.getRootDomNode())},d=oe(!1);let f;ye(()=>e.visible,O=>{clearTimeout(f),O?f=setTimeout(()=>{d.value=e.visible}):d.value=!1},{immediate:!0});const[h,v]=dN(d,u),g=oe(),b=()=>e.point?e.point:e.getRootDomNode,y=()=>{var O;(O=i.value)===null||O===void 0||O.forceAlign()},S=(O,x)=>{var I;const T=e.getClassNameFromAlign(x),M=a.value;a.value!==T&&(a.value=T),h.value==="align"&&(M!==T?Promise.resolve().then(()=>{y()}):v(()=>{var E;(E=g.value)===null||E===void 0||E.call(g)}),(I=e.onAlign)===null||I===void 0||I.call(e,O,x))},$=P(()=>{const O=typeof e.animation=="object"?e.animation:Yb(e);return["onAfterEnter","onAfterLeave"].forEach(x=>{const I=O[x];O[x]=T=>{v(),h.value="stable",I==null||I(T)}}),O}),w=()=>new Promise(O=>{g.value=O});ye([$,h],()=>{!$.value&&h.value==="motion"&&v()},{immediate:!0}),n({forceAlign:y,getElement:()=>l.value.$el||l.value});const C=P(()=>{var O;return!(!((O=e.align)===null||O===void 0)&&O.points&&(h.value==="align"||h.value==="stable"))});return()=>{var O;const{zIndex:x,align:I,prefixCls:T,destroyPopupOnHide:M,onMouseenter:E,onMouseleave:A,onTouchstart:R=()=>{},onMousedown:z}=e,_=h.value,D=[m(m({},s.value),{zIndex:x,opacity:_==="motion"||_==="stable"||!d.value?null:0,pointerEvents:!d.value&&_!=="stable"?"none":null}),o.style];let N=wt((O=r.default)===null||O===void 0?void 0:O.call(r,{visible:e.visible}));N.length>1&&(N=p("div",{class:`${T}-content`},[N]));const k=le(T,o.class,a.value,!e.arrow&&`${T}-arrow-hidden`),L=d.value||!e.visible?Go($.value.name,$.value):{};return p(bn,B(B({ref:l},L),{},{onBeforeEnter:w}),{default:()=>!M||e.visible?Ln(p(bL,{target:b(),key:"popup",ref:i,monitorWindowResize:!0,disabled:C.value,align:I,onAlign:S},{default:()=>p("div",{class:k,onMouseenter:E,onMouseleave:A,onMousedown:k$(z,["capture"]),[on?"onTouchstartPassive":"onTouchstart"]:k$(R,["capture"]),style:D},[N])}),[[Qn,d.value]]):null})}}}),SL=re({compatConfig:{MODE:3},name:"Popup",inheritAttrs:!1,props:sN,setup(e,t){let{attrs:n,slots:o,expose:r}=t;const i=oe(!1),l=oe(!1),a=oe(),s=oe();return ye([()=>e.visible,()=>e.mobile],()=>{i.value=e.visible,e.visible&&e.mobile&&(l.value=!0)},{immediate:!0,flush:"post"}),r({forceAlign:()=>{var c;(c=a.value)===null||c===void 0||c.forceAlign()},getElement:()=>{var c;return(c=a.value)===null||c===void 0?void 0:c.getElement()}}),()=>{const c=m(m(m({},e),n),{visible:i.value}),u=l.value?p(cN,B(B({},c),{},{mobile:e.mobile,ref:a}),{default:o.default}):p(yL,B(B({},c),{},{ref:a}),{default:o.default});return p("div",{ref:s},[p(wP,c,null),u])}}});function $L(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}function rx(e,t,n){const o=e[t]||{};return m(m({},o),n)}function CL(e,t,n,o){const{points:r}=n,i=Object.keys(e);for(let l=0;l0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=typeof e=="function"?e(this.$data,this.$props):e;if(this.getDerivedStateFromProps){const o=this.getDerivedStateFromProps(bO(this),m(m({},this.$data),n));if(o===null)return;n=m(m({},n),o||{})}m(this.$data,n),this._.isMounted&&this.$forceUpdate(),rt(()=>{t&&t()})},__emit(){const e=[].slice.call(arguments,0);let t=e[0];t=`on${t[0].toUpperCase()}${t.substring(1)}`;const n=this.$props[t]||this.$attrs[t];if(e.length&&n)if(Array.isArray(n))for(let o=0,r=n.length;o1&&arguments[1]!==void 0?arguments[1]:{inTriggerContext:!0};Ye(GP,{inTriggerContext:t.inTriggerContext,shouldRender:P(()=>{const{sPopupVisible:n,popupRef:o,forceRender:r,autoDestroy:i}=e||{};let l=!1;return(n||o||r)&&(l=!0),!n&&i&&(l=!1),l})})},xL=()=>{dy({},{inTriggerContext:!1});const e=Ge(GP,{shouldRender:P(()=>!1),inTriggerContext:!1});return{shouldRender:P(()=>e.shouldRender.value||e.inTriggerContext===!1)}},UP=re({compatConfig:{MODE:3},name:"Portal",inheritAttrs:!1,props:{getContainer:K.func.isRequired,didUpdate:Function},setup(e,t){let{slots:n}=t,o=!0,r;const{shouldRender:i}=xL();function l(){i.value&&(r=e.getContainer())}Rp(()=>{o=!1,l()}),Ke(()=>{r||l()});const a=ye(i,()=>{i.value&&!r&&(r=e.getContainer()),r&&a()});return jn(()=>{rt(()=>{var s;i.value&&((s=e.didUpdate)===null||s===void 0||s.call(e,e))})}),()=>{var s;return i.value?o?(s=n.default)===null||s===void 0?void 0:s.call(n):r?p(yb,{to:r},n):null:null}}});let ov;function Mf(e){if(typeof document>"u")return 0;if(ov===void 0){const t=document.createElement("div");t.style.width="100%",t.style.height="200px";const n=document.createElement("div"),o=n.style;o.position="absolute",o.top="0",o.left="0",o.pointerEvents="none",o.visibility="hidden",o.width="200px",o.height="150px",o.overflow="hidden",n.appendChild(t),document.body.appendChild(n);const r=t.offsetWidth;n.style.overflow="scroll";let i=t.offsetWidth;r===i&&(i=n.clientWidth),document.body.removeChild(n),ov=r-i}return ov}function ix(e){const t=e.match(/^(.*)px$/),n=Number(t==null?void 0:t[1]);return Number.isNaN(n)?Mf():n}function wL(e){if(typeof document>"u"||!e||!(e instanceof Element))return{width:0,height:0};const{width:t,height:n}=getComputedStyle(e,"::-webkit-scrollbar");return{width:ix(t),height:ix(n)}}const OL=`vc-util-locker-${Date.now()}`;let lx=0;function PL(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}function IL(e){const t=P(()=>!!e&&!!e.value);lx+=1;const n=`${OL}_${lx}`;Ve(o=>{if(zn()){if(t.value){const r=Mf(),i=PL();wc(` +html body { + overflow-y: hidden; + ${i?`width: calc(100% - ${r}px);`:""} +}`,n)}else wf(n);o(()=>{wf(n)})}},{flush:"post"})}let il=0;const yd=zn(),ax=e=>{if(!yd)return null;if(e){if(typeof e=="string")return document.querySelectorAll(e)[0];if(typeof e=="function")return e();if(typeof e=="object"&&e instanceof window.HTMLElement)return e}return document.body},Zc=re({compatConfig:{MODE:3},name:"PortalWrapper",inheritAttrs:!1,props:{wrapperClassName:String,forceRender:{type:Boolean,default:void 0},getContainer:K.any,visible:{type:Boolean,default:void 0},autoLock:$e(),didUpdate:Function},setup(e,t){let{slots:n}=t;const o=oe(),r=oe(),i=oe(),l=oe(1),a=zn()&&document.createElement("div"),s=()=>{var h,v;o.value===a&&((v=(h=o.value)===null||h===void 0?void 0:h.parentNode)===null||v===void 0||v.removeChild(o.value)),o.value=null};let c=null;const u=function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1)||o.value&&!o.value.parentNode?(c=ax(e.getContainer),c?(c.appendChild(o.value),!0):!1):!0},d=()=>yd?(o.value||(o.value=a,u(!0)),f(),o.value):null,f=()=>{const{wrapperClassName:h}=e;o.value&&h&&h!==o.value.className&&(o.value.className=h)};return jn(()=>{f(),u()}),IL(P(()=>e.autoLock&&e.visible&&zn()&&(o.value===document.body||o.value===a))),Ke(()=>{let h=!1;ye([()=>e.visible,()=>e.getContainer],(v,g)=>{let[b,y]=v,[S,$]=g;yd&&(c=ax(e.getContainer),c===document.body&&(b&&!S?il+=1:h&&(il-=1))),h&&(typeof y=="function"&&typeof $=="function"?y.toString()!==$.toString():y!==$)&&s(),h=!0},{immediate:!0,flush:"post"}),rt(()=>{u()||(i.value=Ze(()=>{l.value+=1}))})}),et(()=>{const{visible:h}=e;yd&&c===document.body&&(il=h&&il?il-1:il),s(),Ze.cancel(i.value)}),()=>{const{forceRender:h,visible:v}=e;let g=null;const b={getOpenCount:()=>il,getContainer:d};return l.value&&(h||v||r.value)&&(g=p(UP,{getContainer:d,ref:r,didUpdate:e.didUpdate},{default:()=>{var y;return(y=n.default)===null||y===void 0?void 0:y.call(n,b)}})),g}}}),TL=["onClick","onMousedown","onTouchstart","onMouseenter","onMouseleave","onFocus","onBlur","onContextmenu"],ql=re({compatConfig:{MODE:3},name:"Trigger",mixins:[Yl],inheritAttrs:!1,props:xP(),setup(e){const t=P(()=>{const{popupPlacement:r,popupAlign:i,builtinPlacements:l}=e;return r&&l?rx(l,r,i):i}),n=oe(null),o=r=>{n.value=r};return{vcTriggerContext:Ge("vcTriggerContext",{}),popupRef:n,setPopupRef:o,triggerRef:oe(null),align:t,focusTime:null,clickOutsideHandler:null,contextmenuOutsideHandler1:null,contextmenuOutsideHandler2:null,touchOutsideHandler:null,attachId:null,delayTimer:null,hasPopupMouseDown:!1,preClickTime:null,preTouchTime:null,mouseDownTimeout:null,childOriginEvents:{}}},data(){const e=this.$props;let t;return this.popupVisible!==void 0?t=!!e.popupVisible:t=!!e.defaultPopupVisible,TL.forEach(n=>{this[`fire${n}`]=o=>{this.fireEvents(n,o)}}),{prevPopupVisible:t,sPopupVisible:t,point:null}},watch:{popupVisible(e){e!==void 0&&(this.prevPopupVisible=this.sPopupVisible,this.sPopupVisible=e)}},created(){Ye("vcTriggerContext",{onPopupMouseDown:this.onPopupMouseDown,onPopupMouseenter:this.onPopupMouseenter,onPopupMouseleave:this.onPopupMouseleave}),dy(this)},deactivated(){this.setPopupVisible(!1)},mounted(){this.$nextTick(()=>{this.updatedCal()})},updated(){this.$nextTick(()=>{this.updatedCal()})},beforeUnmount(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),Ze.cancel(this.attachId)},methods:{updatedCal(){const e=this.$props;if(this.$data.sPopupVisible){let n;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextmenuToShow())&&(n=e.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Nt(n,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(n=n||e.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Nt(n,"touchstart",this.onDocumentClick,on?{passive:!1}:!1)),!this.contextmenuOutsideHandler1&&this.isContextmenuToShow()&&(n=n||e.getDocument(this.getRootDomNode()),this.contextmenuOutsideHandler1=Nt(n,"scroll",this.onContextmenuClose)),!this.contextmenuOutsideHandler2&&this.isContextmenuToShow()&&(this.contextmenuOutsideHandler2=Nt(window,"blur",this.onContextmenuClose))}else this.clearOutsideHandler()},onMouseenter(e){const{mouseEnterDelay:t}=this.$props;this.fireEvents("onMouseenter",e),this.delaySetPopupVisible(!0,t,t?null:e)},onMouseMove(e){this.fireEvents("onMousemove",e),this.setPoint(e)},onMouseleave(e){this.fireEvents("onMouseleave",e),this.delaySetPopupVisible(!1,this.$props.mouseLeaveDelay)},onPopupMouseenter(){const{vcTriggerContext:e={}}=this;e.onPopupMouseenter&&e.onPopupMouseenter(),this.clearDelayTimer()},onPopupMouseleave(e){var t;if(e&&e.relatedTarget&&!e.relatedTarget.setTimeout&&Ti((t=this.popupRef)===null||t===void 0?void 0:t.getElement(),e.relatedTarget))return;this.isMouseLeaveToHide()&&this.delaySetPopupVisible(!1,this.$props.mouseLeaveDelay);const{vcTriggerContext:n={}}=this;n.onPopupMouseleave&&n.onPopupMouseleave(e)},onFocus(e){this.fireEvents("onFocus",e),this.clearDelayTimer(),this.isFocusToShow()&&(this.focusTime=Date.now(),this.delaySetPopupVisible(!0,this.$props.focusDelay))},onMousedown(e){this.fireEvents("onMousedown",e),this.preClickTime=Date.now()},onTouchstart(e){this.fireEvents("onTouchstart",e),this.preTouchTime=Date.now()},onBlur(e){Ti(e.target,e.relatedTarget||document.activeElement)||(this.fireEvents("onBlur",e),this.clearDelayTimer(),this.isBlurToHide()&&this.delaySetPopupVisible(!1,this.$props.blurDelay))},onContextmenu(e){e.preventDefault(),this.fireEvents("onContextmenu",e),this.setPopupVisible(!0,e)},onContextmenuClose(){this.isContextmenuToShow()&&this.close()},onClick(e){if(this.fireEvents("onClick",e),this.focusTime){let n;if(this.preClickTime&&this.preTouchTime?n=Math.min(this.preClickTime,this.preTouchTime):this.preClickTime?n=this.preClickTime:this.preTouchTime&&(n=this.preTouchTime),Math.abs(n-this.focusTime)<20)return;this.focusTime=0}this.preClickTime=0,this.preTouchTime=0,this.isClickToShow()&&(this.isClickToHide()||this.isBlurToHide())&&e&&e.preventDefault&&e.preventDefault(),e&&e.domEvent&&e.domEvent.preventDefault();const t=!this.$data.sPopupVisible;(this.isClickToHide()&&!t||t&&this.isClickToShow())&&this.setPopupVisible(!this.$data.sPopupVisible,e)},onPopupMouseDown(){const{vcTriggerContext:e={}}=this;this.hasPopupMouseDown=!0,clearTimeout(this.mouseDownTimeout),this.mouseDownTimeout=setTimeout(()=>{this.hasPopupMouseDown=!1},0),e.onPopupMouseDown&&e.onPopupMouseDown(...arguments)},onDocumentClick(e){if(this.$props.mask&&!this.$props.maskClosable)return;const t=e.target,n=this.getRootDomNode(),o=this.getPopupDomNode();(!Ti(n,t)||this.isContextMenuOnly())&&!Ti(o,t)&&!this.hasPopupMouseDown&&this.delaySetPopupVisible(!1,.1)},getPopupDomNode(){var e;return((e=this.popupRef)===null||e===void 0?void 0:e.getElement())||null},getRootDomNode(){var e,t,n,o;const{getTriggerDOMNode:r}=this.$props;if(r){const i=((t=(e=this.triggerRef)===null||e===void 0?void 0:e.$el)===null||t===void 0?void 0:t.nodeName)==="#comment"?null:Jn(this.triggerRef);return Jn(r(i))}try{const i=((o=(n=this.triggerRef)===null||n===void 0?void 0:n.$el)===null||o===void 0?void 0:o.nodeName)==="#comment"?null:Jn(this.triggerRef);if(i)return i}catch{}return Jn(this)},handleGetPopupClassFromAlign(e){const t=[],n=this.$props,{popupPlacement:o,builtinPlacements:r,prefixCls:i,alignPoint:l,getPopupClassNameFromAlign:a}=n;return o&&r&&t.push(CL(r,i,e,l)),a&&t.push(a(e)),t.join(" ")},getPopupAlign(){const e=this.$props,{popupPlacement:t,popupAlign:n,builtinPlacements:o}=e;return t&&o?rx(o,t,n):n},getComponent(){const e={};this.isMouseEnterToShow()&&(e.onMouseenter=this.onPopupMouseenter),this.isMouseLeaveToHide()&&(e.onMouseleave=this.onPopupMouseleave),e.onMousedown=this.onPopupMouseDown,e[on?"onTouchstartPassive":"onTouchstart"]=this.onPopupMouseDown;const{handleGetPopupClassFromAlign:t,getRootDomNode:n,$attrs:o}=this,{prefixCls:r,destroyPopupOnHide:i,popupClassName:l,popupAnimation:a,popupTransitionName:s,popupStyle:c,mask:u,maskAnimation:d,maskTransitionName:f,zIndex:h,stretch:v,alignPoint:g,mobile:b,arrow:y,forceRender:S}=this.$props,{sPopupVisible:$,point:w}=this.$data,C=m(m({prefixCls:r,arrow:y,destroyPopupOnHide:i,visible:$,point:g?w:null,align:this.align,animation:a,getClassNameFromAlign:t,stretch:v,getRootDomNode:n,mask:u,zIndex:h,transitionName:s,maskAnimation:d,maskTransitionName:f,class:l,style:c,onAlign:o.onPopupAlign||CP},e),{ref:this.setPopupRef,mobile:b,forceRender:S});return p(SL,C,{default:this.$slots.popup||(()=>yO(this,"popup"))})},attachParent(e){Ze.cancel(this.attachId);const{getPopupContainer:t,getDocument:n}=this.$props,o=this.getRootDomNode();let r;t?(o||t.length===0)&&(r=t(o)):r=n(this.getRootDomNode()).body,r?r.appendChild(e):this.attachId=Ze(()=>{this.attachParent(e)})},getContainer(){const{$props:e}=this,{getDocument:t}=e,n=t(this.getRootDomNode()).createElement("div");return n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%",this.attachParent(n),n},setPopupVisible(e,t){const{alignPoint:n,sPopupVisible:o,onPopupVisibleChange:r}=this;this.clearDelayTimer(),o!==e&&(Xr(this,"popupVisible")||this.setState({sPopupVisible:e,prevPopupVisible:o}),r&&r(e)),n&&t&&e&&this.setPoint(t)},setPoint(e){const{alignPoint:t}=this.$props;!t||!e||this.setState({point:{pageX:e.pageX,pageY:e.pageY}})},handlePortalUpdate(){this.prevPopupVisible!==this.sPopupVisible&&this.afterPopupVisibleChange(this.sPopupVisible)},delaySetPopupVisible(e,t,n){const o=t*1e3;if(this.clearDelayTimer(),o){const r=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=setTimeout(()=>{this.setPopupVisible(e,r),this.clearDelayTimer()},o)}else this.setPopupVisible(e,n)},clearDelayTimer(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)},clearOutsideHandler(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextmenuOutsideHandler1&&(this.contextmenuOutsideHandler1.remove(),this.contextmenuOutsideHandler1=null),this.contextmenuOutsideHandler2&&(this.contextmenuOutsideHandler2.remove(),this.contextmenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)},createTwoChains(e){let t=()=>{};const n=W$(this);return this.childOriginEvents[e]&&n[e]?this[`fire${e}`]:(t=this.childOriginEvents[e]||n[e]||t,t)},isClickToShow(){const{action:e,showAction:t}=this.$props;return e.indexOf("click")!==-1||t.indexOf("click")!==-1},isContextMenuOnly(){const{action:e}=this.$props;return e==="contextmenu"||e.length===1&&e[0]==="contextmenu"},isContextmenuToShow(){const{action:e,showAction:t}=this.$props;return e.indexOf("contextmenu")!==-1||t.indexOf("contextmenu")!==-1},isClickToHide(){const{action:e,hideAction:t}=this.$props;return e.indexOf("click")!==-1||t.indexOf("click")!==-1},isMouseEnterToShow(){const{action:e,showAction:t}=this.$props;return e.indexOf("hover")!==-1||t.indexOf("mouseenter")!==-1},isMouseLeaveToHide(){const{action:e,hideAction:t}=this.$props;return e.indexOf("hover")!==-1||t.indexOf("mouseleave")!==-1},isFocusToShow(){const{action:e,showAction:t}=this.$props;return e.indexOf("focus")!==-1||t.indexOf("focus")!==-1},isBlurToHide(){const{action:e,hideAction:t}=this.$props;return e.indexOf("focus")!==-1||t.indexOf("blur")!==-1},forcePopupAlign(){var e;this.$data.sPopupVisible&&((e=this.popupRef)===null||e===void 0||e.forceAlign())},fireEvents(e,t){this.childOriginEvents[e]&&this.childOriginEvents[e](t);const n=this.$props[e]||this.$attrs[e];n&&n(t)},close(){this.setPopupVisible(!1)}},render(){const{$attrs:e}=this,t=kt(Hp(this)),{alignPoint:n,getPopupContainer:o}=this.$props,r=t[0];this.childOriginEvents=W$(r);const i={key:"trigger"};this.isContextmenuToShow()?i.onContextmenu=this.onContextmenu:i.onContextmenu=this.createTwoChains("onContextmenu"),this.isClickToHide()||this.isClickToShow()?(i.onClick=this.onClick,i.onMousedown=this.onMousedown,i[on?"onTouchstartPassive":"onTouchstart"]=this.onTouchstart):(i.onClick=this.createTwoChains("onClick"),i.onMousedown=this.createTwoChains("onMousedown"),i[on?"onTouchstartPassive":"onTouchstart"]=this.createTwoChains("onTouchstart")),this.isMouseEnterToShow()?(i.onMouseenter=this.onMouseenter,n&&(i.onMousemove=this.onMouseMove)):i.onMouseenter=this.createTwoChains("onMouseenter"),this.isMouseLeaveToHide()?i.onMouseleave=this.onMouseleave:i.onMouseleave=this.createTwoChains("onMouseleave"),this.isFocusToShow()||this.isBlurToHide()?(i.onFocus=this.onFocus,i.onBlur=this.onBlur):(i.onFocus=this.createTwoChains("onFocus"),i.onBlur=c=>{c&&(!c.relatedTarget||!Ti(c.target,c.relatedTarget))&&this.createTwoChains("onBlur")(c)});const l=le(r&&r.props&&r.props.class,e.class);l&&(i.class=l);const a=pt(r,m(m({},i),{ref:"triggerRef"}),!0,!0),s=p(Zc,{key:"portal",getContainer:o&&(()=>o(this.getRootDomNode())),didUpdate:this.handlePortalUpdate,visible:this.$data.sPopupVisible},{default:this.getComponent});return p(Le,null,[a,s])}});var EL=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const t=e===!0?0:1;return{bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:t,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:t,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:t,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:t,adjustY:1}}}},ML=re({name:"SelectTrigger",inheritAttrs:!1,props:{dropdownAlign:Object,visible:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},dropdownClassName:String,dropdownStyle:K.object,placement:String,empty:{type:Boolean,default:void 0},prefixCls:String,popupClassName:String,animation:String,transitionName:String,getPopupContainer:Function,dropdownRender:Function,containerWidth:Number,dropdownMatchSelectWidth:K.oneOfType([Number,Boolean]).def(!0),popupElement:K.any,direction:String,getTriggerDOMNode:Function,onPopupVisibleChange:Function,onPopupMouseEnter:Function,onPopupFocusin:Function,onPopupFocusout:Function},setup(e,t){let{slots:n,attrs:o,expose:r}=t;const i=P(()=>{const{dropdownMatchSelectWidth:a}=e;return _L(a)}),l=ne();return r({getPopupElement:()=>l.value}),()=>{const a=m(m({},e),o),{empty:s=!1}=a,c=EL(a,["empty"]),{visible:u,dropdownAlign:d,prefixCls:f,popupElement:h,dropdownClassName:v,dropdownStyle:g,direction:b="ltr",placement:y,dropdownMatchSelectWidth:S,containerWidth:$,dropdownRender:w,animation:C,transitionName:O,getPopupContainer:x,getTriggerDOMNode:I,onPopupVisibleChange:T,onPopupMouseEnter:M,onPopupFocusin:E,onPopupFocusout:A}=c,R=`${f}-dropdown`;let z=h;w&&(z=w({menuNode:h,props:e}));const _=C?`${R}-${C}`:O,D=m({minWidth:`${$}px`},g);return typeof S=="number"?D.width=`${S}px`:S&&(D.width=`${$}px`),p(ql,B(B({},e),{},{showAction:T?["click"]:[],hideAction:T?["click"]:[],popupPlacement:y||(b==="rtl"?"bottomRight":"bottomLeft"),builtinPlacements:i.value,prefixCls:R,popupTransitionName:_,popupAlign:d,popupVisible:u,getPopupContainer:x,popupClassName:le(v,{[`${R}-empty`]:s}),popupStyle:D,getTriggerDOMNode:I,onPopupVisibleChange:T}),{default:n.default,popup:()=>p("div",{ref:l,onMouseenter:M,onFocusin:E,onFocusout:A},[z])})}}}),Ie={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,N:78,P:80,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,EQUALS:187,WIN_KEY:224},Ll=(e,t)=>{let{slots:n}=t;var o;const{class:r,customizeIcon:i,customizeIconProps:l,onMousedown:a,onClick:s}=e;let c;return typeof i=="function"?c=i(l):c=Yt(i)?mn(i):i,p("span",{class:r,onMousedown:u=>{u.preventDefault(),a&&a(u)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:s,"aria-hidden":!0},[c!==void 0?c:p("span",{class:r.split(/\s+/).map(u=>`${u}-icon`)},[(o=n.default)===null||o===void 0?void 0:o.call(n)])])};Ll.inheritAttrs=!1;Ll.displayName="TransBtn";Ll.props={class:String,customizeIcon:K.any,customizeIconProps:K.any,onMousedown:Function,onClick:Function};var AL=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{o.value&&o.value.focus()},blur:()=>{o.value&&o.value.blur()},input:o,setSelectionRange:(s,c,u)=>{var d;(d=o.value)===null||d===void 0||d.setSelectionRange(s,c,u)},select:()=>{var s;(s=o.value)===null||s===void 0||s.select()},getSelectionStart:()=>{var s;return(s=o.value)===null||s===void 0?void 0:s.selectionStart},getSelectionEnd:()=>{var s;return(s=o.value)===null||s===void 0?void 0:s.selectionEnd},getScrollTop:()=>{var s;return(s=o.value)===null||s===void 0?void 0:s.scrollTop}}),()=>{const{tag:s,value:c}=e,u=AL(e,["tag","value"]);return p(s,B(B({},u),{},{ref:o,value:c}),null)}}});function DL(){const e=document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{width:e,height:t}}function Af(e){const t=e.getBoundingClientRect(),n=document.documentElement;return{left:t.left+(window.scrollX||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:t.top+(window.scrollY||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}function BL(e){return Array.prototype.slice.apply(e).map(n=>`${n}: ${e.getPropertyValue(n)};`).join("")}function NL(e){return Object.keys(e).reduce((t,n)=>{const o=e[n];return typeof o>"u"||o===null||(t+=`${n}: ${e[n]};`),t},"")}var kL=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);re.value,a],()=>{a.value||(l.value=e.value)},{immediate:!0});const s=x=>{n("change",x)},c=x=>{a.value=!0,x.target.composing=!0,n("compositionstart",x)},u=x=>{a.value=!1,x.target.composing=!1,n("compositionend",x);const I=document.createEvent("HTMLEvents");I.initEvent("input",!0,!0),x.target.dispatchEvent(I),s(x)},d=x=>{if(a.value&&e.lazy){l.value=x.target.value;return}n("input",x)},f=x=>{n("blur",x)},h=x=>{n("focus",x)},v=()=>{i.value&&i.value.focus()},g=()=>{i.value&&i.value.blur()},b=x=>{n("keydown",x)},y=x=>{n("keyup",x)},S=(x,I,T)=>{var M;(M=i.value)===null||M===void 0||M.setSelectionRange(x,I,T)},$=()=>{var x;(x=i.value)===null||x===void 0||x.select()};r({focus:v,blur:g,input:P(()=>{var x;return(x=i.value)===null||x===void 0?void 0:x.input}),setSelectionRange:S,select:$,getSelectionStart:()=>{var x;return(x=i.value)===null||x===void 0?void 0:x.getSelectionStart()},getSelectionEnd:()=>{var x;return(x=i.value)===null||x===void 0?void 0:x.getSelectionEnd()},getScrollTop:()=>{var x;return(x=i.value)===null||x===void 0?void 0:x.getScrollTop()}});const w=x=>{n("mousedown",x)},C=x=>{n("paste",x)},O=P(()=>e.style&&typeof e.style!="string"?NL(e.style):e.style);return()=>{const{style:x,lazy:I}=e,T=kL(e,["style","lazy"]);return p(RL,B(B(B({},T),o),{},{style:O.value,onInput:d,onChange:s,onBlur:f,onFocus:h,ref:i,value:l.value,onCompositionstart:c,onCompositionend:u,onKeyup:y,onKeydown:b,onPaste:C,onMousedown:w}),null)}}}),FL={inputRef:K.any,prefixCls:String,id:String,inputElement:K.VueNode,disabled:{type:Boolean,default:void 0},autofocus:{type:Boolean,default:void 0},autocomplete:String,editable:{type:Boolean,default:void 0},activeDescendantId:String,value:String,open:{type:Boolean,default:void 0},tabindex:K.oneOfType([K.number,K.string]),attrs:K.object,onKeydown:{type:Function},onMousedown:{type:Function},onChange:{type:Function},onPaste:{type:Function},onCompositionstart:{type:Function},onCompositionend:{type:Function},onFocus:{type:Function},onBlur:{type:Function}},XP=re({compatConfig:{MODE:3},name:"SelectInput",inheritAttrs:!1,props:FL,setup(e){let t=null;const n=Ge("VCSelectContainerEvent");return()=>{var o;const{prefixCls:r,id:i,inputElement:l,disabled:a,tabindex:s,autofocus:c,autocomplete:u,editable:d,activeDescendantId:f,value:h,onKeydown:v,onMousedown:g,onChange:b,onPaste:y,onCompositionstart:S,onCompositionend:$,onFocus:w,onBlur:C,open:O,inputRef:x,attrs:I}=e;let T=l||p(ss,null,null);const M=T.props||{},{onKeydown:E,onInput:A,onFocus:R,onBlur:z,onMousedown:_,onCompositionstart:D,onCompositionend:N,style:k}=M;return T=pt(T,m(m(m(m(m({type:"search"},M),{id:i,ref:x,disabled:a,tabindex:s,lazy:!1,autocomplete:u||"off",autofocus:c,class:le(`${r}-selection-search-input`,(o=T==null?void 0:T.props)===null||o===void 0?void 0:o.class),role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-owns":`${i}_list`,"aria-autocomplete":"list","aria-controls":`${i}_list`,"aria-activedescendant":f}),I),{value:d?h:"",readonly:!d,unselectable:d?null:"on",style:m(m({},k),{opacity:d?null:0}),onKeydown:F=>{v(F),E&&E(F)},onMousedown:F=>{g(F),_&&_(F)},onInput:F=>{b(F),A&&A(F)},onCompositionstart(F){S(F),D&&D(F)},onCompositionend(F){$(F),N&&N(F)},onPaste:y,onFocus:function(){clearTimeout(t),R&&R(arguments.length<=0?void 0:arguments[0]),w&&w(arguments.length<=0?void 0:arguments[0]),n==null||n.focus(arguments.length<=0?void 0:arguments[0])},onBlur:function(){for(var F=arguments.length,L=new Array(F),H=0;H{z&&z(L[0]),C&&C(L[0]),n==null||n.blur(L[0])},100)}}),T.type==="textarea"?{}:{type:"search"}),!0,!0),T}}}),LL=`accept acceptcharset accesskey action allowfullscreen allowtransparency +alt async autocomplete autofocus autoplay capture cellpadding cellspacing challenge +charset checked classid classname colspan cols content contenteditable contextmenu +controls coords crossorigin data datetime default defer dir disabled download draggable +enctype form formaction formenctype formmethod formnovalidate formtarget frameborder +headers height hidden high href hreflang htmlfor for httpequiv icon id inputmode integrity +is keyparams keytype kind label lang list loop low manifest marginheight marginwidth max maxlength media +mediagroup method min minlength multiple muted name novalidate nonce open +optimum pattern placeholder poster preload radiogroup readonly rel required +reversed role rowspan rows sandbox scope scoped scrolling seamless selected +shape size sizes span spellcheck src srcdoc srclang srcset start step style +summary tabindex target title type usemap value width wmode wrap`,zL=`onCopy onCut onPaste onCompositionend onCompositionstart onCompositionupdate onKeydown + onKeypress onKeyup onFocus onBlur onChange onInput onSubmit onClick onContextmenu onDoubleclick onDblclick + onDrag onDragend onDragenter onDragexit onDragleave onDragover onDragstart onDrop onMousedown + onMouseenter onMouseleave onMousemove onMouseout onMouseover onMouseup onSelect onTouchcancel + onTouchend onTouchmove onTouchstart onTouchstartPassive onTouchmovePassive onScroll onWheel onAbort onCanplay onCanplaythrough + onDurationchange onEmptied onEncrypted onEnded onError onLoadeddata onLoadedmetadata + onLoadstart onPause onPlay onPlaying onProgress onRatechange onSeeked onSeeking onStalled onSuspend onTimeupdate onVolumechange onWaiting onLoad onError`,sx=`${LL} ${zL}`.split(/[\s\n]+/),HL="aria-",jL="data-";function cx(e,t){return e.indexOf(t)===0}function Ui(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;t===!1?n={aria:!0,data:!0,attr:!0}:t===!0?n={aria:!0}:n=m({},t);const o={};return Object.keys(e).forEach(r=>{(n.aria&&(r==="role"||cx(r,HL))||n.data&&cx(r,jL)||n.attr&&(sx.includes(r)||sx.includes(r.toLowerCase())))&&(o[r]=e[r])}),o}const YP=Symbol("OverflowContextProviderKey"),Xm=re({compatConfig:{MODE:3},name:"OverflowContextProvider",inheritAttrs:!1,props:{value:{type:Object}},setup(e,t){let{slots:n}=t;return Ye(YP,P(()=>e.value)),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}}),VL=()=>Ge(YP,P(()=>null));var WL=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);re.responsive&&!e.display),i=ne();o({itemNodeRef:i});function l(a){e.registerSize(e.itemKey,a)}return wn(()=>{l(null)}),()=>{var a;const{prefixCls:s,invalidate:c,item:u,renderItem:d,responsive:f,registerSize:h,itemKey:v,display:g,order:b,component:y="div"}=e,S=WL(e,["prefixCls","invalidate","item","renderItem","responsive","registerSize","itemKey","display","order","component"]),$=(a=n.default)===null||a===void 0?void 0:a.call(n),w=d&&u!==aa?d(u):$;let C;c||(C={opacity:r.value?0:1,height:r.value?0:aa,overflowY:r.value?"hidden":aa,order:f?b:aa,pointerEvents:r.value?"none":aa,position:r.value?"absolute":aa});const O={};return r.value&&(O["aria-hidden"]=!0),p(Vo,{disabled:!f,onResize:x=>{let{offsetWidth:I}=x;l(I)}},{default:()=>p(y,B(B(B({class:le(!c&&s),style:C},O),S),{},{ref:i}),{default:()=>[w]})})}}});var rv=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{var i;if(!r.value){const{component:d="div"}=e,f=rv(e,["component"]);return p(d,B(B({},f),o),{default:()=>[(i=n.default)===null||i===void 0?void 0:i.call(n)]})}const l=r.value,{className:a}=l,s=rv(l,["className"]),{class:c}=o,u=rv(o,["class"]);return p(Xm,{value:null},{default:()=>[p(Sd,B(B(B({class:le(a,c)},s),u),e),n)]})}}});var GL=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({id:String,prefixCls:String,data:Array,itemKey:[String,Number,Function],itemWidth:{type:Number,default:10},renderItem:Function,renderRawItem:Function,maxCount:[Number,String],renderRest:Function,renderRawRest:Function,suffix:K.any,component:String,itemComponent:K.any,onVisibleChange:Function,ssr:String,onMousedown:Function,role:String}),ei=re({name:"Overflow",inheritAttrs:!1,props:XL(),emits:["visibleChange"],setup(e,t){let{attrs:n,emit:o,slots:r}=t;const i=P(()=>e.ssr==="full"),l=oe(null),a=P(()=>l.value||0),s=oe(new Map),c=oe(0),u=oe(0),d=oe(0),f=oe(null),h=oe(null),v=P(()=>h.value===null&&i.value?Number.MAX_SAFE_INTEGER:h.value||0),g=oe(!1),b=P(()=>`${e.prefixCls}-item`),y=P(()=>Math.max(c.value,u.value)),S=P(()=>!!(e.data.length&&e.maxCount===qP)),$=P(()=>e.maxCount===JP),w=P(()=>S.value||typeof e.maxCount=="number"&&e.data.length>e.maxCount),C=P(()=>{let _=e.data;return S.value?l.value===null&&i.value?_=e.data:_=e.data.slice(0,Math.min(e.data.length,a.value/e.itemWidth)):typeof e.maxCount=="number"&&(_=e.data.slice(0,e.maxCount)),_}),O=P(()=>S.value?e.data.slice(v.value+1):e.data.slice(C.value.length)),x=(_,D)=>{var N;return typeof e.itemKey=="function"?e.itemKey(_):(N=e.itemKey&&(_==null?void 0:_[e.itemKey]))!==null&&N!==void 0?N:D},I=P(()=>e.renderItem||(_=>_)),T=(_,D)=>{h.value=_,D||(g.value=_{l.value=D.clientWidth},E=(_,D)=>{const N=new Map(s.value);D===null?N.delete(_):N.set(_,D),s.value=N},A=(_,D)=>{c.value=u.value,u.value=D},R=(_,D)=>{d.value=D},z=_=>s.value.get(x(C.value[_],_));return ye([a,s,u,d,()=>e.itemKey,C],()=>{if(a.value&&y.value&&C.value){let _=d.value;const D=C.value.length,N=D-1;if(!D){T(0),f.value=null;return}for(let k=0;ka.value){T(k-1),f.value=_-F-d.value+u.value;break}}e.suffix&&z(0)+d.value>a.value&&(f.value=null)}}),()=>{const _=g.value&&!!O.value.length,{itemComponent:D,renderRawItem:N,renderRawRest:k,renderRest:F,prefixCls:L="rc-overflow",suffix:H,component:j="div",id:Y,onMousedown:Z}=e,{class:X,style:ee}=n,U=GL(n,["class","style"]);let Q={};f.value!==null&&S.value&&(Q={position:"absolute",left:`${f.value}px`,top:0});const J={prefixCls:b.value,responsive:S.value,component:D,invalidate:$.value},G=N?(te,ue)=>{const ie=x(te,ue);return p(Xm,{key:ie,value:m(m({},J),{order:ue,item:te,itemKey:ie,registerSize:E,display:ue<=v.value})},{default:()=>[N(te,ue)]})}:(te,ue)=>{const ie=x(te,ue);return p(Sd,B(B({},J),{},{order:ue,key:ie,item:te,renderItem:I.value,itemKey:ie,registerSize:E,display:ue<=v.value}),null)};let q=()=>null;const V={order:_?v.value:Number.MAX_SAFE_INTEGER,className:`${b.value} ${b.value}-rest`,registerSize:A,display:_};if(k)k&&(q=()=>p(Xm,{value:m(m({},J),V)},{default:()=>[k(O.value)]}));else{const te=F||UL;q=()=>p(Sd,B(B({},J),V),{default:()=>typeof te=="function"?te(O.value):te})}const W=()=>{var te;return p(j,B({id:Y,class:le(!$.value&&L,X),style:ee,onMousedown:Z,role:e.role},U),{default:()=>[C.value.map(G),w.value?q():null,H&&p(Sd,B(B({},J),{},{order:v.value,class:`${b.value}-suffix`,registerSize:R,display:!0,style:Q}),{default:()=>H}),(te=r.default)===null||te===void 0?void 0:te.call(r)]})};return p(Vo,{disabled:!S.value,onResize:M},{default:W})}}});ei.Item=KL;ei.RESPONSIVE=qP;ei.INVALIDATE=JP;const ZP=Symbol("TreeSelectLegacyContextPropsKey");function YL(e){return Ye(ZP,e)}function ih(){return Ge(ZP,{})}const qL={id:String,prefixCls:String,values:K.array,open:{type:Boolean,default:void 0},searchValue:String,inputRef:K.any,placeholder:K.any,disabled:{type:Boolean,default:void 0},mode:String,showSearch:{type:Boolean,default:void 0},autofocus:{type:Boolean,default:void 0},autocomplete:String,activeDescendantId:String,tabindex:K.oneOfType([K.number,K.string]),compositionStatus:Boolean,removeIcon:K.any,choiceTransitionName:String,maxTagCount:K.oneOfType([K.number,K.string]),maxTagTextLength:Number,maxTagPlaceholder:K.any.def(()=>e=>`+ ${e.length} ...`),tagRender:Function,onToggleOpen:{type:Function},onRemove:Function,onInputChange:Function,onInputPaste:Function,onInputKeyDown:Function,onInputMouseDown:Function,onInputCompositionStart:Function,onInputCompositionEnd:Function},ux=e=>{e.preventDefault(),e.stopPropagation()},JL=re({name:"MultipleSelectSelector",inheritAttrs:!1,props:qL,setup(e){const t=oe(),n=oe(0),o=oe(!1),r=ih(),i=P(()=>`${e.prefixCls}-selection`),l=P(()=>e.open||e.mode==="tags"?e.searchValue:""),a=P(()=>e.mode==="tags"||e.showSearch&&(e.open||o.value)),s=ne("");Ve(()=>{s.value=l.value}),Ke(()=>{ye(s,()=>{n.value=t.value.scrollWidth},{flush:"post",immediate:!0})});function c(v,g,b,y,S){return p("span",{class:le(`${i.value}-item`,{[`${i.value}-item-disabled`]:b}),title:typeof v=="string"||typeof v=="number"?v.toString():void 0},[p("span",{class:`${i.value}-item-content`},[g]),y&&p(Ll,{class:`${i.value}-item-remove`,onMousedown:ux,onClick:S,customizeIcon:e.removeIcon},{default:()=>[Pt("×")]})])}function u(v,g,b,y,S,$){var w;const C=x=>{ux(x),e.onToggleOpen(!open)};let O=$;return r.keyEntities&&(O=((w=r.keyEntities[v])===null||w===void 0?void 0:w.node)||{}),p("span",{key:v,onMousedown:C},[e.tagRender({label:g,value:v,disabled:b,closable:y,onClose:S,option:O})])}function d(v){const{disabled:g,label:b,value:y,option:S}=v,$=!e.disabled&&!g;let w=b;if(typeof e.maxTagTextLength=="number"&&(typeof b=="string"||typeof b=="number")){const O=String(w);O.length>e.maxTagTextLength&&(w=`${O.slice(0,e.maxTagTextLength)}...`)}const C=O=>{var x;O&&O.stopPropagation(),(x=e.onRemove)===null||x===void 0||x.call(e,v)};return typeof e.tagRender=="function"?u(y,w,g,$,C,S):c(b,w,g,$,C)}function f(v){const{maxTagPlaceholder:g=y=>`+ ${y.length} ...`}=e,b=typeof g=="function"?g(v):g;return c(b,b,!1)}const h=v=>{const g=v.target.composing;s.value=v.target.value,g||e.onInputChange(v)};return()=>{const{id:v,prefixCls:g,values:b,open:y,inputRef:S,placeholder:$,disabled:w,autofocus:C,autocomplete:O,activeDescendantId:x,tabindex:I,compositionStatus:T,onInputPaste:M,onInputKeyDown:E,onInputMouseDown:A,onInputCompositionStart:R,onInputCompositionEnd:z}=e,_=p("div",{class:`${i.value}-search`,style:{width:n.value+"px"},key:"input"},[p(XP,{inputRef:S,open:y,prefixCls:g,id:v,inputElement:null,disabled:w,autofocus:C,autocomplete:O,editable:a.value,activeDescendantId:x,value:s.value,onKeydown:E,onMousedown:A,onChange:h,onPaste:M,onCompositionstart:R,onCompositionend:z,tabindex:I,attrs:Ui(e,!0),onFocus:()=>o.value=!0,onBlur:()=>o.value=!1},null),p("span",{ref:t,class:`${i.value}-search-mirror`,"aria-hidden":!0},[s.value,Pt(" ")])]),D=p(ei,{prefixCls:`${i.value}-overflow`,data:b,renderItem:d,renderRest:f,suffix:_,itemKey:"key",maxCount:e.maxTagCount,key:"overflow"},null);return p(Le,null,[D,!b.length&&!l.value&&!T&&p("span",{class:`${i.value}-placeholder`},[$])])}}}),ZL={inputElement:K.any,id:String,prefixCls:String,values:K.array,open:{type:Boolean,default:void 0},searchValue:String,inputRef:K.any,placeholder:K.any,compositionStatus:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},mode:String,showSearch:{type:Boolean,default:void 0},autofocus:{type:Boolean,default:void 0},autocomplete:String,activeDescendantId:String,tabindex:K.oneOfType([K.number,K.string]),activeValue:String,backfill:{type:Boolean,default:void 0},optionLabelRender:Function,onInputChange:Function,onInputPaste:Function,onInputKeyDown:Function,onInputMouseDown:Function,onInputCompositionStart:Function,onInputCompositionEnd:Function},fy=re({name:"SingleSelector",setup(e){const t=oe(!1),n=P(()=>e.mode==="combobox"),o=P(()=>n.value||e.showSearch),r=P(()=>{let u=e.searchValue||"";return n.value&&e.activeValue&&!t.value&&(u=e.activeValue),u}),i=ih();ye([n,()=>e.activeValue],()=>{n.value&&(t.value=!1)},{immediate:!0});const l=P(()=>e.mode!=="combobox"&&!e.open&&!e.showSearch?!1:!!r.value||e.compositionStatus),a=P(()=>{const u=e.values[0];return u&&(typeof u.label=="string"||typeof u.label=="number")?u.label.toString():void 0}),s=()=>{if(e.values[0])return null;const u=l.value?{visibility:"hidden"}:void 0;return p("span",{class:`${e.prefixCls}-selection-placeholder`,style:u},[e.placeholder])},c=u=>{u.target.composing||(t.value=!0,e.onInputChange(u))};return()=>{var u,d,f,h;const{inputElement:v,prefixCls:g,id:b,values:y,inputRef:S,disabled:$,autofocus:w,autocomplete:C,activeDescendantId:O,open:x,tabindex:I,optionLabelRender:T,onInputKeyDown:M,onInputMouseDown:E,onInputPaste:A,onInputCompositionStart:R,onInputCompositionEnd:z}=e,_=y[0];let D=null;if(_&&i.customSlots){const N=(u=_.key)!==null&&u!==void 0?u:_.value,k=((d=i.keyEntities[N])===null||d===void 0?void 0:d.node)||{};D=i.customSlots[(f=k.slots)===null||f===void 0?void 0:f.title]||i.customSlots.title||_.label,typeof D=="function"&&(D=D(k))}else D=T&&_?T(_.option):_==null?void 0:_.label;return p(Le,null,[p("span",{class:`${g}-selection-search`},[p(XP,{inputRef:S,prefixCls:g,id:b,open:x,inputElement:v,disabled:$,autofocus:w,autocomplete:C,editable:o.value,activeDescendantId:O,value:r.value,onKeydown:M,onMousedown:E,onChange:c,onPaste:A,onCompositionstart:R,onCompositionend:z,tabindex:I,attrs:Ui(e,!0)},null)]),!n.value&&_&&!l.value&&p("span",{class:`${g}-selection-item`,title:a.value},[p(Le,{key:(h=_.key)!==null&&h!==void 0?h:_.value},[D])]),s()])}}});fy.props=ZL;fy.inheritAttrs=!1;function QL(e){return![Ie.ESC,Ie.SHIFT,Ie.BACKSPACE,Ie.TAB,Ie.WIN_KEY,Ie.ALT,Ie.META,Ie.WIN_KEY_RIGHT,Ie.CTRL,Ie.SEMICOLON,Ie.EQUALS,Ie.CAPS_LOCK,Ie.CONTEXT_MENU,Ie.F1,Ie.F2,Ie.F3,Ie.F4,Ie.F5,Ie.F6,Ie.F7,Ie.F8,Ie.F9,Ie.F10,Ie.F11,Ie.F12].includes(e)}function QP(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,t=null,n;et(()=>{clearTimeout(n)});function o(r){(r||t===null)&&(t=r),clearTimeout(n),n=setTimeout(()=>{t=null},e)}return[()=>t,o]}function Ac(){const e=t=>{e.current=t};return e}const ez=re({name:"Selector",inheritAttrs:!1,props:{id:String,prefixCls:String,showSearch:{type:Boolean,default:void 0},open:{type:Boolean,default:void 0},values:K.array,multiple:{type:Boolean,default:void 0},mode:String,searchValue:String,activeValue:String,inputElement:K.any,autofocus:{type:Boolean,default:void 0},activeDescendantId:String,tabindex:K.oneOfType([K.number,K.string]),disabled:{type:Boolean,default:void 0},placeholder:K.any,removeIcon:K.any,maxTagCount:K.oneOfType([K.number,K.string]),maxTagTextLength:Number,maxTagPlaceholder:K.any,tagRender:Function,optionLabelRender:Function,tokenWithEnter:{type:Boolean,default:void 0},choiceTransitionName:String,onToggleOpen:{type:Function},onSearch:Function,onSearchSubmit:Function,onRemove:Function,onInputKeyDown:{type:Function},domRef:Function},setup(e,t){let{expose:n}=t;const o=Ac(),r=ne(!1),[i,l]=QP(0),a=y=>{const{which:S}=y;(S===Ie.UP||S===Ie.DOWN)&&y.preventDefault(),e.onInputKeyDown&&e.onInputKeyDown(y),S===Ie.ENTER&&e.mode==="tags"&&!r.value&&!e.open&&e.onSearchSubmit(y.target.value),QL(S)&&e.onToggleOpen(!0)},s=()=>{l(!0)};let c=null;const u=y=>{e.onSearch(y,!0,r.value)!==!1&&e.onToggleOpen(!0)},d=()=>{r.value=!0},f=y=>{r.value=!1,e.mode!=="combobox"&&u(y.target.value)},h=y=>{let{target:{value:S}}=y;if(e.tokenWithEnter&&c&&/[\r\n]/.test(c)){const $=c.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");S=S.replace($,c)}c=null,u(S)},v=y=>{const{clipboardData:S}=y;c=S.getData("text")},g=y=>{let{target:S}=y;S!==o.current&&(document.body.style.msTouchAction!==void 0?setTimeout(()=>{o.current.focus()}):o.current.focus())},b=y=>{const S=i();y.target!==o.current&&!S&&y.preventDefault(),(e.mode!=="combobox"&&(!e.showSearch||!S)||!e.open)&&(e.open&&e.onSearch("",!0,!1),e.onToggleOpen())};return n({focus:()=>{o.current.focus()},blur:()=>{o.current.blur()}}),()=>{const{prefixCls:y,domRef:S,mode:$}=e,w={inputRef:o,onInputKeyDown:a,onInputMouseDown:s,onInputChange:h,onInputPaste:v,compositionStatus:r.value,onInputCompositionStart:d,onInputCompositionEnd:f},C=$==="multiple"||$==="tags"?p(JL,B(B({},e),w),null):p(fy,B(B({},e),w),null);return p("div",{ref:S,class:`${y}-selector`,onClick:g,onMousedown:b},[C])}}});function tz(e,t,n){function o(r){var i,l,a;let s=r.target;s.shadowRoot&&r.composed&&(s=r.composedPath()[0]||s);const c=[(i=e[0])===null||i===void 0?void 0:i.value,(a=(l=e[1])===null||l===void 0?void 0:l.value)===null||a===void 0?void 0:a.getPopupElement()];t.value&&c.every(u=>u&&!u.contains(s)&&u!==s)&&n(!1)}Ke(()=>{window.addEventListener("mousedown",o)}),et(()=>{window.removeEventListener("mousedown",o)})}function nz(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10;const t=oe(!1);let n;const o=()=>{clearTimeout(n)};return Ke(()=>{o()}),[t,(i,l)=>{o(),n=setTimeout(()=>{t.value=i,l&&l()},e)},o]}const e5=Symbol("BaseSelectContextKey");function oz(e){return Ye(e5,e)}function Qc(){return Ge(e5,{})}const py=()=>{if(typeof navigator>"u"||typeof window>"u")return!1;const e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e==null?void 0:e.substring(0,4))};function Rf(e){if(!Vt(e))return ft(e);const t=new Proxy({},{get(n,o,r){return Reflect.get(e.value,o,r)},set(n,o,r){return e.value[o]=r,!0},deleteProperty(n,o){return Reflect.deleteProperty(e.value,o)},has(n,o){return Reflect.has(e.value,o)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return ft(t)}var rz=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefixCls:String,id:String,omitDomProps:Array,displayValues:Array,onDisplayValuesChange:Function,activeValue:String,activeDescendantId:String,onActiveValueChange:Function,searchValue:String,onSearch:Function,onSearchSplit:Function,maxLength:Number,OptionList:K.any,emptyOptions:Boolean}),lh=()=>({showSearch:{type:Boolean,default:void 0},tagRender:{type:Function},optionLabelRender:{type:Function},direction:{type:String},tabindex:Number,autofocus:Boolean,notFoundContent:K.any,placeholder:K.any,onClear:Function,choiceTransitionName:String,mode:String,disabled:{type:Boolean,default:void 0},loading:{type:Boolean,default:void 0},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},onDropdownVisibleChange:{type:Function},getInputElement:{type:Function},getRawInputElement:{type:Function},maxTagTextLength:Number,maxTagCount:{type:[String,Number]},maxTagPlaceholder:K.any,tokenSeparators:{type:Array},allowClear:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:void 0},inputIcon:K.any,clearIcon:K.any,removeIcon:K.any,animation:String,transitionName:String,dropdownStyle:{type:Object},dropdownClassName:String,dropdownMatchSelectWidth:{type:[Boolean,Number],default:void 0},dropdownRender:{type:Function},dropdownAlign:Object,placement:{type:String},getPopupContainer:{type:Function},showAction:{type:Array},onBlur:{type:Function},onFocus:{type:Function},onKeyup:Function,onKeydown:Function,onMousedown:Function,onPopupScroll:Function,onInputKeyDown:Function,onMouseenter:Function,onMouseleave:Function,onClick:Function}),az=()=>m(m({},lz()),lh());function t5(e){return e==="tags"||e==="multiple"}const hy=re({compatConfig:{MODE:3},name:"BaseSelect",inheritAttrs:!1,props:Qe(az(),{showAction:[],notFoundContent:"Not Found"}),setup(e,t){let{attrs:n,expose:o,slots:r}=t;const i=P(()=>t5(e.mode)),l=P(()=>e.showSearch!==void 0?e.showSearch:i.value||e.mode==="combobox"),a=oe(!1);Ke(()=>{a.value=py()});const s=ih(),c=oe(null),u=Ac(),d=oe(null),f=oe(null),h=oe(null),v=ne(!1),[g,b,y]=nz();o({focus:()=>{var G;(G=f.value)===null||G===void 0||G.focus()},blur:()=>{var G;(G=f.value)===null||G===void 0||G.blur()},scrollTo:G=>{var q;return(q=h.value)===null||q===void 0?void 0:q.scrollTo(G)}});const w=P(()=>{var G;if(e.mode!=="combobox")return e.searchValue;const q=(G=e.displayValues[0])===null||G===void 0?void 0:G.value;return typeof q=="string"||typeof q=="number"?String(q):""}),C=e.open!==void 0?e.open:e.defaultOpen,O=oe(C),x=oe(C),I=G=>{O.value=e.open!==void 0?e.open:G,x.value=O.value};ye(()=>e.open,()=>{I(e.open)});const T=P(()=>!e.notFoundContent&&e.emptyOptions);Ve(()=>{x.value=O.value,(e.disabled||T.value&&x.value&&e.mode==="combobox")&&(x.value=!1)});const M=P(()=>T.value?!1:x.value),E=G=>{const q=G!==void 0?G:!x.value;x.value!==q&&!e.disabled&&(I(q),e.onDropdownVisibleChange&&e.onDropdownVisibleChange(q),!q&&j.value&&(j.value=!1,b(!1,()=>{L.value=!1,v.value=!1})))},A=P(()=>(e.tokenSeparators||[]).some(G=>[` +`,`\r +`].includes(G))),R=(G,q,V)=>{var W,te;let ue=!0,ie=G;(W=e.onActiveValueChange)===null||W===void 0||W.call(e,null);const ae=V?null:rN(G,e.tokenSeparators);return e.mode!=="combobox"&&ae&&(ie="",(te=e.onSearchSplit)===null||te===void 0||te.call(e,ae),E(!1),ue=!1),e.onSearch&&w.value!==ie&&e.onSearch(ie,{source:q?"typing":"effect"}),ue},z=G=>{var q;!G||!G.trim()||(q=e.onSearch)===null||q===void 0||q.call(e,G,{source:"submit"})};ye(x,()=>{!x.value&&!i.value&&e.mode!=="combobox"&&R("",!1,!1)},{immediate:!0,flush:"post"}),ye(()=>e.disabled,()=>{O.value&&e.disabled&&I(!1),e.disabled&&!v.value&&b(!1)},{immediate:!0});const[_,D]=QP(),N=function(G){var q;const V=_(),{which:W}=G;if(W===Ie.ENTER&&(e.mode!=="combobox"&&G.preventDefault(),x.value||E(!0)),D(!!w.value),W===Ie.BACKSPACE&&!V&&i.value&&!w.value&&e.displayValues.length){const ae=[...e.displayValues];let ce=null;for(let se=ae.length-1;se>=0;se-=1){const pe=ae[se];if(!pe.disabled){ae.splice(se,1),ce=pe;break}}ce&&e.onDisplayValuesChange(ae,{type:"remove",values:[ce]})}for(var te=arguments.length,ue=new Array(te>1?te-1:0),ie=1;ie1?q-1:0),W=1;W{const q=e.displayValues.filter(V=>V!==G);e.onDisplayValuesChange(q,{type:"remove",values:[G]})},L=oe(!1),H=function(){b(!0),e.disabled||(e.onFocus&&!L.value&&e.onFocus(...arguments),e.showAction&&e.showAction.includes("focus")&&E(!0)),L.value=!0},j=ne(!1),Y=function(){if(j.value||(v.value=!0,b(!1,()=>{L.value=!1,v.value=!1,E(!1)}),e.disabled))return;const G=w.value;G&&(e.mode==="tags"?e.onSearch(G,{source:"submit"}):e.mode==="multiple"&&e.onSearch("",{source:"blur"})),e.onBlur&&e.onBlur(...arguments)},Z=()=>{j.value=!0},X=()=>{j.value=!1};Ye("VCSelectContainerEvent",{focus:H,blur:Y});const ee=[];Ke(()=>{ee.forEach(G=>clearTimeout(G)),ee.splice(0,ee.length)}),et(()=>{ee.forEach(G=>clearTimeout(G)),ee.splice(0,ee.length)});const U=function(G){var q,V;const{target:W}=G,te=(q=d.value)===null||q===void 0?void 0:q.getPopupElement();if(te&&te.contains(W)){const ce=setTimeout(()=>{var se;const pe=ee.indexOf(ce);pe!==-1&&ee.splice(pe,1),y(),!a.value&&!te.contains(document.activeElement)&&((se=f.value)===null||se===void 0||se.focus())});ee.push(ce)}for(var ue=arguments.length,ie=new Array(ue>1?ue-1:0),ae=1;ae{};return Ke(()=>{ye(M,()=>{var G;if(M.value){const q=Math.ceil((G=c.value)===null||G===void 0?void 0:G.offsetWidth);Q.value!==q&&!Number.isNaN(q)&&(Q.value=q)}},{immediate:!0,flush:"post"})}),tz([c,d],M,E),oz(Rf(m(m({},nr(e)),{open:x,triggerOpen:M,showSearch:l,multiple:i,toggleOpen:E}))),()=>{const G=m(m({},e),n),{prefixCls:q,id:V,open:W,defaultOpen:te,mode:ue,showSearch:ie,searchValue:ae,onSearch:ce,allowClear:se,clearIcon:pe,showArrow:he,inputIcon:ge,disabled:me,loading:xe,getInputElement:fe,getPopupContainer:de,placement:be,animation:we,transitionName:Te,dropdownStyle:Re,dropdownClassName:Se,dropdownMatchSelectWidth:Ce,dropdownRender:Pe,dropdownAlign:Me,showAction:De,direction:Ae,tokenSeparators:Fe,tagRender:lt,optionLabelRender:ht,onPopupScroll:st,onDropdownVisibleChange:gt,onFocus:yt,onBlur:en,onKeyup:sn,onKeydown:hn,onMousedown:Gt,onClear:An,omitDomProps:no,getRawInputElement:_o,displayValues:Yo,onDisplayValuesChange:oo,emptyOptions:el,activeDescendantId:_e,activeValue:Je,OptionList:Xe}=G,Et=rz(G,["prefixCls","id","open","defaultOpen","mode","showSearch","searchValue","onSearch","allowClear","clearIcon","showArrow","inputIcon","disabled","loading","getInputElement","getPopupContainer","placement","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","showAction","direction","tokenSeparators","tagRender","optionLabelRender","onPopupScroll","onDropdownVisibleChange","onFocus","onBlur","onKeyup","onKeydown","onMousedown","onClear","omitDomProps","getRawInputElement","displayValues","onDisplayValuesChange","emptyOptions","activeDescendantId","activeValue","OptionList"]),cn=ue==="combobox"&&fe&&fe()||null,Ut=typeof _o=="function"&&_o(),ro=m({},Et);let Pn;Ut&&(Pn=Jo=>{E(Jo)}),iz.forEach(Jo=>{delete ro[Jo]}),no==null||no.forEach(Jo=>{delete ro[Jo]});const vr=he!==void 0?he:xe||!i.value&&ue!=="combobox";let ho;vr&&(ho=p(Ll,{class:le(`${q}-arrow`,{[`${q}-arrow-loading`]:xe}),customizeIcon:ge,customizeIconProps:{loading:xe,searchValue:w.value,open:x.value,focused:g.value,showSearch:l.value}},null));let Mo;const Ft=()=>{An==null||An(),oo([],{type:"clear",values:Yo}),R("",!1,!1)};!me&&se&&(Yo.length||w.value)&&(Mo=p(Ll,{class:`${q}-clear`,onMousedown:Ft,customizeIcon:pe},{default:()=>[Pt("×")]}));const qo=p(Xe,{ref:h},m(m({},s.customSlots),{option:r.option})),Ao=le(q,n.class,{[`${q}-focused`]:g.value,[`${q}-multiple`]:i.value,[`${q}-single`]:!i.value,[`${q}-allow-clear`]:se,[`${q}-show-arrow`]:vr,[`${q}-disabled`]:me,[`${q}-loading`]:xe,[`${q}-open`]:x.value,[`${q}-customize-input`]:cn,[`${q}-show-search`]:l.value}),fi=p(ML,{ref:d,disabled:me,prefixCls:q,visible:M.value,popupElement:qo,containerWidth:Q.value,animation:we,transitionName:Te,dropdownStyle:Re,dropdownClassName:Se,direction:Ae,dropdownMatchSelectWidth:Ce,dropdownRender:Pe,dropdownAlign:Me,placement:be,getPopupContainer:de,empty:el,getTriggerDOMNode:()=>u.current,onPopupVisibleChange:Pn,onPopupMouseEnter:J,onPopupFocusin:Z,onPopupFocusout:X},{default:()=>Ut?qt(Ut)&&pt(Ut,{ref:u},!1,!0):p(ez,B(B({},e),{},{domRef:u,prefixCls:q,inputElement:cn,ref:f,id:V,showSearch:l.value,mode:ue,activeDescendantId:_e,tagRender:lt,optionLabelRender:ht,values:Yo,open:x.value,onToggleOpen:E,activeValue:Je,searchValue:w.value,onSearch:R,onSearchSubmit:z,onRemove:F,tokenWithEnter:A.value}),null)});let pi;return Ut?pi=fi:pi=p("div",B(B({},ro),{},{class:Ao,ref:c,onMousedown:U,onKeydown:N,onKeyup:k}),[g.value&&!x.value&&p("span",{style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0},"aria-live":"polite"},[`${Yo.map(Jo=>{let{label:ra,value:Zo}=Jo;return["number","string"].includes(typeof ra)?ra:Zo}).join(", ")}`]),fi,ho,Mo]),pi}}}),ah=(e,t)=>{let{height:n,offset:o,prefixCls:r,onInnerResize:i}=e,{slots:l}=t;var a;let s={},c={display:"flex",flexDirection:"column"};return o!==void 0&&(s={height:`${n}px`,position:"relative",overflow:"hidden"},c=m(m({},c),{transform:`translateY(${o}px)`,position:"absolute",left:0,right:0,top:0})),p("div",{style:s},[p(Vo,{onResize:u=>{let{offsetHeight:d}=u;d&&i&&i()}},{default:()=>[p("div",{style:c,class:le({[`${r}-holder-inner`]:r})},[(a=l.default)===null||a===void 0?void 0:a.call(l)])]})])};ah.displayName="Filter";ah.inheritAttrs=!1;ah.props={prefixCls:String,height:Number,offset:Number,onInnerResize:Function};const n5=(e,t)=>{let{setRef:n}=e,{slots:o}=t;var r;const i=wt((r=o.default)===null||r===void 0?void 0:r.call(o));return i&&i.length?mn(i[0],{ref:n}):i};n5.props={setRef:{type:Function,default:()=>{}}};const sz=20;function dx(e){return"touches"in e?e.touches[0].pageY:e.pageY}const cz=re({compatConfig:{MODE:3},name:"ScrollBar",inheritAttrs:!1,props:{prefixCls:String,scrollTop:Number,scrollHeight:Number,height:Number,count:Number,onScroll:{type:Function},onStartMove:{type:Function},onStopMove:{type:Function}},setup(){return{moveRaf:null,scrollbarRef:Ac(),thumbRef:Ac(),visibleTimeout:null,state:ft({dragging:!1,pageY:null,startTop:null,visible:!1})}},watch:{scrollTop:{handler(){this.delayHidden()},flush:"post"}},mounted(){var e,t;(e=this.scrollbarRef.current)===null||e===void 0||e.addEventListener("touchstart",this.onScrollbarTouchStart,on?{passive:!1}:!1),(t=this.thumbRef.current)===null||t===void 0||t.addEventListener("touchstart",this.onMouseDown,on?{passive:!1}:!1)},beforeUnmount(){this.removeEvents(),clearTimeout(this.visibleTimeout)},methods:{delayHidden(){clearTimeout(this.visibleTimeout),this.state.visible=!0,this.visibleTimeout=setTimeout(()=>{this.state.visible=!1},2e3)},onScrollbarTouchStart(e){e.preventDefault()},onContainerMouseDown(e){e.stopPropagation(),e.preventDefault()},patchEvents(){window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),this.thumbRef.current.addEventListener("touchmove",this.onMouseMove,on?{passive:!1}:!1),this.thumbRef.current.addEventListener("touchend",this.onMouseUp)},removeEvents(){window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),this.scrollbarRef.current.removeEventListener("touchstart",this.onScrollbarTouchStart,on?{passive:!1}:!1),this.thumbRef.current&&(this.thumbRef.current.removeEventListener("touchstart",this.onMouseDown,on?{passive:!1}:!1),this.thumbRef.current.removeEventListener("touchmove",this.onMouseMove,on?{passive:!1}:!1),this.thumbRef.current.removeEventListener("touchend",this.onMouseUp)),Ze.cancel(this.moveRaf)},onMouseDown(e){const{onStartMove:t}=this.$props;m(this.state,{dragging:!0,pageY:dx(e),startTop:this.getTop()}),t(),this.patchEvents(),e.stopPropagation(),e.preventDefault()},onMouseMove(e){const{dragging:t,pageY:n,startTop:o}=this.state,{onScroll:r}=this.$props;if(Ze.cancel(this.moveRaf),t){const i=dx(e)-n,l=o+i,a=this.getEnableScrollRange(),s=this.getEnableHeightRange(),c=s?l/s:0,u=Math.ceil(c*a);this.moveRaf=Ze(()=>{r(u)})}},onMouseUp(){const{onStopMove:e}=this.$props;this.state.dragging=!1,e(),this.removeEvents()},getSpinHeight(){const{height:e,scrollHeight:t}=this.$props;let n=e/t*100;return n=Math.max(n,sz),n=Math.min(n,e/2),Math.floor(n)},getEnableScrollRange(){const{scrollHeight:e,height:t}=this.$props;return e-t||0},getEnableHeightRange(){const{height:e}=this.$props,t=this.getSpinHeight();return e-t||0},getTop(){const{scrollTop:e}=this.$props,t=this.getEnableScrollRange(),n=this.getEnableHeightRange();return e===0||t===0?0:e/t*n},showScroll(){const{height:e,scrollHeight:t}=this.$props;return t>e}},render(){const{dragging:e,visible:t}=this.state,{prefixCls:n}=this.$props,o=this.getSpinHeight()+"px",r=this.getTop()+"px",i=this.showScroll(),l=i&&t;return p("div",{ref:this.scrollbarRef,class:le(`${n}-scrollbar`,{[`${n}-scrollbar-show`]:i}),style:{width:"8px",top:0,bottom:0,right:0,position:"absolute",display:l?void 0:"none"},onMousedown:this.onContainerMouseDown,onMousemove:this.delayHidden},[p("div",{ref:this.thumbRef,class:le(`${n}-scrollbar-thumb`,{[`${n}-scrollbar-thumb-moving`]:e}),style:{width:"100%",height:o,top:r,left:0,position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:"99px",cursor:"pointer",userSelect:"none"},onMousedown:this.onMouseDown},null)])}});function uz(e,t,n,o){const r=new Map,i=new Map,l=ne(Symbol("update"));ye(e,()=>{l.value=Symbol("update")});let a;function s(){Ze.cancel(a)}function c(){s(),a=Ze(()=>{r.forEach((d,f)=>{if(d&&d.offsetParent){const{offsetHeight:h}=d;i.get(f)!==h&&(l.value=Symbol("update"),i.set(f,d.offsetHeight))}})})}function u(d,f){const h=t(d);r.get(h),f?(r.set(h,f.$el||f),c()):r.delete(h)}return wn(()=>{s()}),[u,c,i,l]}function dz(e,t,n,o,r,i,l,a){let s;return c=>{if(c==null){a();return}Ze.cancel(s);const u=t.value,d=o.itemHeight;if(typeof c=="number")l(c);else if(c&&typeof c=="object"){let f;const{align:h}=c;"index"in c?{index:f}=c:f=u.findIndex(b=>r(b)===c.key);const{offset:v=0}=c,g=(b,y)=>{if(b<0||!e.value)return;const S=e.value.clientHeight;let $=!1,w=y;if(S){const C=y||h;let O=0,x=0,I=0;const T=Math.min(u.length,f);for(let A=0;A<=T;A+=1){const R=r(u[A]);x=O;const z=n.get(R);I=x+(z===void 0?d:z),O=I,A===f&&z===void 0&&($=!0)}const M=e.value.scrollTop;let E=null;switch(C){case"top":E=x-v;break;case"bottom":E=I-S+v;break;default:{const A=M+S;xA&&(w="bottom")}}E!==null&&E!==M&&l(E)}s=Ze(()=>{$&&i(),g(b-1,w)},2)};g(5)}}}const fz=typeof navigator=="object"&&/Firefox/i.test(navigator.userAgent),o5=(e,t)=>{let n=!1,o=null;function r(){clearTimeout(o),n=!0,o=setTimeout(()=>{n=!1},50)}return function(i){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const a=i<0&&e.value||i>0&&t.value;return l&&a?(clearTimeout(o),n=!1):(!a||n)&&r(),!n&&a}};function pz(e,t,n,o){let r=0,i=null,l=null,a=!1;const s=o5(t,n);function c(d){if(!e.value)return;Ze.cancel(i);const{deltaY:f}=d;r+=f,l=f,!s(f)&&(fz||d.preventDefault(),i=Ze(()=>{o(r*(a?10:1)),r=0}))}function u(d){e.value&&(a=d.detail===l)}return[c,u]}const hz=14/15;function gz(e,t,n){let o=!1,r=0,i=null,l=null;const a=()=>{i&&(i.removeEventListener("touchmove",s),i.removeEventListener("touchend",c))},s=f=>{if(o){const h=Math.ceil(f.touches[0].pageY);let v=r-h;r=h,n(v)&&f.preventDefault(),clearInterval(l),l=setInterval(()=>{v*=hz,(!n(v,!0)||Math.abs(v)<=.1)&&clearInterval(l)},16)}},c=()=>{o=!1,a()},u=f=>{a(),f.touches.length===1&&!o&&(o=!0,r=Math.ceil(f.touches[0].pageY),i=f.target,i.addEventListener("touchmove",s,{passive:!1}),i.addEventListener("touchend",c))},d=()=>{};Ke(()=>{document.addEventListener("touchmove",d,{passive:!1}),ye(e,f=>{t.value.removeEventListener("touchstart",u),a(),clearInterval(l),f&&t.value.addEventListener("touchstart",u,{passive:!1})},{immediate:!0})}),et(()=>{document.removeEventListener("touchmove",d)})}var vz=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const c=t+s,u=r(a,c,{}),d=l(a);return p(n5,{key:d,setRef:f=>o(a,f)},{default:()=>[u]})})}const r5=re({compatConfig:{MODE:3},name:"List",inheritAttrs:!1,props:{prefixCls:String,data:K.array,height:Number,itemHeight:Number,fullHeight:{type:Boolean,default:void 0},itemKey:{type:[String,Number,Function],required:!0},component:{type:[String,Object]},virtual:{type:Boolean,default:void 0},children:Function,onScroll:Function,onMousedown:Function,onMouseenter:Function,onVisibleChange:Function},setup(e,t){let{expose:n}=t;const o=P(()=>{const{height:F,itemHeight:L,virtual:H}=e;return!!(H!==!1&&F&&L)}),r=P(()=>{const{height:F,itemHeight:L,data:H}=e;return o.value&&H&&L*H.length>F}),i=ft({scrollTop:0,scrollMoving:!1}),l=P(()=>e.data||mz),a=oe([]);ye(l,()=>{a.value=tt(l.value).slice()},{immediate:!0});const s=oe(F=>{});ye(()=>e.itemKey,F=>{typeof F=="function"?s.value=F:s.value=L=>L==null?void 0:L[F]},{immediate:!0});const c=oe(),u=oe(),d=oe(),f=F=>s.value(F),h={getKey:f};function v(F){let L;typeof F=="function"?L=F(i.scrollTop):L=F;const H=O(L);c.value&&(c.value.scrollTop=H),i.scrollTop=H}const[g,b,y,S]=uz(a,f),$=ft({scrollHeight:void 0,start:0,end:0,offset:void 0}),w=oe(0);Ke(()=>{rt(()=>{var F;w.value=((F=u.value)===null||F===void 0?void 0:F.offsetHeight)||0})}),jn(()=>{rt(()=>{var F;w.value=((F=u.value)===null||F===void 0?void 0:F.offsetHeight)||0})}),ye([o,a],()=>{o.value||m($,{scrollHeight:void 0,start:0,end:a.value.length-1,offset:void 0})},{immediate:!0}),ye([o,a,w,r],()=>{o.value&&!r.value&&m($,{scrollHeight:w.value,start:0,end:a.value.length-1,offset:void 0}),c.value&&(i.scrollTop=c.value.scrollTop)},{immediate:!0}),ye([r,o,()=>i.scrollTop,a,S,()=>e.height,w],()=>{if(!o.value||!r.value)return;let F=0,L,H,j;const Y=a.value.length,Z=a.value,X=i.scrollTop,{itemHeight:ee,height:U}=e,Q=X+U;for(let J=0;J=X&&(L=J,H=F),j===void 0&&W>Q&&(j=J),F=W}L===void 0&&(L=0,H=0,j=Math.ceil(U/ee)),j===void 0&&(j=Y-1),j=Math.min(j+1,Y),m($,{scrollHeight:F,start:L,end:j,offset:H})},{immediate:!0});const C=P(()=>$.scrollHeight-e.height);function O(F){let L=F;return Number.isNaN(C.value)||(L=Math.min(L,C.value)),L=Math.max(L,0),L}const x=P(()=>i.scrollTop<=0),I=P(()=>i.scrollTop>=C.value),T=o5(x,I);function M(F){v(F)}function E(F){var L;const{scrollTop:H}=F.currentTarget;H!==i.scrollTop&&v(H),(L=e.onScroll)===null||L===void 0||L.call(e,F)}const[A,R]=pz(o,x,I,F=>{v(L=>L+F)});gz(o,c,(F,L)=>T(F,L)?!1:(A({preventDefault(){},deltaY:F}),!0));function z(F){o.value&&F.preventDefault()}const _=()=>{c.value&&(c.value.removeEventListener("wheel",A,on?{passive:!1}:!1),c.value.removeEventListener("DOMMouseScroll",R),c.value.removeEventListener("MozMousePixelScroll",z))};Ve(()=>{rt(()=>{c.value&&(_(),c.value.addEventListener("wheel",A,on?{passive:!1}:!1),c.value.addEventListener("DOMMouseScroll",R),c.value.addEventListener("MozMousePixelScroll",z))})}),et(()=>{_()});const D=dz(c,a,y,e,f,b,v,()=>{var F;(F=d.value)===null||F===void 0||F.delayHidden()});n({scrollTo:D});const N=P(()=>{let F=null;return e.height&&(F=m({[e.fullHeight?"height":"maxHeight"]:e.height+"px"},bz),o.value&&(F.overflowY="hidden",i.scrollMoving&&(F.pointerEvents="none"))),F});return ye([()=>$.start,()=>$.end,a],()=>{if(e.onVisibleChange){const F=a.value.slice($.start,$.end+1);e.onVisibleChange(F,a.value)}},{flush:"post"}),{state:i,mergedData:a,componentStyle:N,onFallbackScroll:E,onScrollBar:M,componentRef:c,useVirtual:o,calRes:$,collectHeight:b,setInstance:g,sharedConfig:h,scrollBarRef:d,fillerInnerRef:u,delayHideScrollBar:()=>{var F;(F=d.value)===null||F===void 0||F.delayHidden()}}},render(){const e=m(m({},this.$props),this.$attrs),{prefixCls:t="rc-virtual-list",height:n,itemHeight:o,fullHeight:r,data:i,itemKey:l,virtual:a,component:s="div",onScroll:c,children:u=this.$slots.default,style:d,class:f}=e,h=vz(e,["prefixCls","height","itemHeight","fullHeight","data","itemKey","virtual","component","onScroll","children","style","class"]),v=le(t,f),{scrollTop:g}=this.state,{scrollHeight:b,offset:y,start:S,end:$}=this.calRes,{componentStyle:w,onFallbackScroll:C,onScrollBar:O,useVirtual:x,collectHeight:I,sharedConfig:T,setInstance:M,mergedData:E,delayHideScrollBar:A}=this;return p("div",B({style:m(m({},d),{position:"relative"}),class:v},h),[p(s,{class:`${t}-holder`,style:w,ref:"componentRef",onScroll:C,onMouseenter:A},{default:()=>[p(ah,{prefixCls:t,height:b,offset:y,onInnerResize:I,ref:"fillerInnerRef"},{default:()=>yz(E,S,$,M,u,T)})]}),x&&p(cz,{ref:"scrollBarRef",prefixCls:t,scrollTop:g,height:n,scrollHeight:b,count:E.length,onScroll:O,onStartMove:()=>{this.state.scrollMoving=!0},onStopMove:()=>{this.state.scrollMoving=!1}},null)])}});function gy(e,t,n){const o=ne(e());return ye(t,(r,i)=>{n?n(r,i)&&(o.value=e()):o.value=e()}),o}function Sz(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}const i5=Symbol("SelectContextKey");function $z(e){return Ye(i5,e)}function Cz(){return Ge(i5,{})}var xz=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r`${r.prefixCls}-item`),a=gy(()=>i.flattenOptions,[()=>r.open,()=>i.flattenOptions],C=>C[0]),s=Ac(),c=C=>{C.preventDefault()},u=C=>{s.current&&s.current.scrollTo(typeof C=="number"?{index:C}:C)},d=function(C){let O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const x=a.value.length;for(let I=0;I1&&arguments[1]!==void 0?arguments[1]:!1;f.activeIndex=C;const x={source:O?"keyboard":"mouse"},I=a.value[C];if(!I){i.onActiveValue(null,-1,x);return}i.onActiveValue(I.value,C,x)};ye([()=>a.value.length,()=>r.searchValue],()=>{h(i.defaultActiveFirstOption!==!1?d(0):-1)},{immediate:!0});const v=C=>i.rawValues.has(C)&&r.mode!=="combobox";ye([()=>r.open,()=>r.searchValue],()=>{if(!r.multiple&&r.open&&i.rawValues.size===1){const C=Array.from(i.rawValues)[0],O=tt(a.value).findIndex(x=>{let{data:I}=x;return I[i.fieldNames.value]===C});O!==-1&&(h(O),rt(()=>{u(O)}))}r.open&&rt(()=>{var C;(C=s.current)===null||C===void 0||C.scrollTo(void 0)})},{immediate:!0,flush:"post"});const g=C=>{C!==void 0&&i.onSelect(C,{selected:!i.rawValues.has(C)}),r.multiple||r.toggleOpen(!1)},b=C=>typeof C.label=="function"?C.label():C.label;function y(C){const O=a.value[C];if(!O)return null;const x=O.data||{},{value:I}=x,{group:T}=O,M=Ui(x,!0),E=b(O);return O?p("div",B(B({"aria-label":typeof E=="string"&&!T?E:null},M),{},{key:C,role:T?"presentation":"option",id:`${r.id}_list_${C}`,"aria-selected":v(I)}),[I]):null}return n({onKeydown:C=>{const{which:O,ctrlKey:x}=C;switch(O){case Ie.N:case Ie.P:case Ie.UP:case Ie.DOWN:{let I=0;if(O===Ie.UP?I=-1:O===Ie.DOWN?I=1:Sz()&&x&&(O===Ie.N?I=1:O===Ie.P&&(I=-1)),I!==0){const T=d(f.activeIndex+I,I);u(T),h(T,!0)}break}case Ie.ENTER:{const I=a.value[f.activeIndex];I&&!I.data.disabled?g(I.value):g(void 0),r.open&&C.preventDefault();break}case Ie.ESC:r.toggleOpen(!1),r.open&&C.stopPropagation()}},onKeyup:()=>{},scrollTo:C=>{u(C)}}),()=>{const{id:C,notFoundContent:O,onPopupScroll:x}=r,{menuItemSelectedIcon:I,fieldNames:T,virtual:M,listHeight:E,listItemHeight:A}=i,R=o.option,{activeIndex:z}=f,_=Object.keys(T).map(D=>T[D]);return a.value.length===0?p("div",{role:"listbox",id:`${C}_list`,class:`${l.value}-empty`,onMousedown:c},[O]):p(Le,null,[p("div",{role:"listbox",id:`${C}_list`,style:{height:0,width:0,overflow:"hidden"}},[y(z-1),y(z),y(z+1)]),p(r5,{itemKey:"key",ref:s,data:a.value,height:E,itemHeight:A,fullHeight:!1,onMousedown:c,onScroll:x,virtual:M},{default:(D,N)=>{var k;const{group:F,groupOption:L,data:H,value:j}=D,{key:Y}=H,Z=typeof D.label=="function"?D.label():D.label;if(F){const pe=(k=H.title)!==null&&k!==void 0?k:fx(Z)&&Z;return p("div",{class:le(l.value,`${l.value}-group`),title:pe},[R?R(H):Z!==void 0?Z:Y])}const{disabled:X,title:ee,children:U,style:Q,class:J,className:G}=H,q=xz(H,["disabled","title","children","style","class","className"]),V=ot(q,_),W=v(j),te=`${l.value}-option`,ue=le(l.value,te,J,G,{[`${te}-grouped`]:L,[`${te}-active`]:z===N&&!X,[`${te}-disabled`]:X,[`${te}-selected`]:W}),ie=b(D),ae=!I||typeof I=="function"||W,ce=typeof ie=="number"?ie:ie||j;let se=fx(ce)?ce.toString():void 0;return ee!==void 0&&(se=ee),p("div",B(B({},V),{},{"aria-selected":W,class:ue,title:se,onMousemove:pe=>{q.onMousemove&&q.onMousemove(pe),!(z===N||X)&&h(N)},onClick:pe=>{X||g(j),q.onClick&&q.onClick(pe)},style:Q}),[p("div",{class:`${te}-content`},[R?R(H):ce]),qt(I)||W,ae&&p(Ll,{class:`${l.value}-option-state`,customizeIcon:I,customizeIconProps:{isSelected:W}},{default:()=>[W?"✓":null]})])}})])}}});var Oz=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r1&&arguments[1]!==void 0?arguments[1]:!1;return wt(e).map((o,r)=>{var i;if(!qt(o)||!o.type)return null;const{type:{isSelectOptGroup:l},key:a,children:s,props:c}=o;if(t||!l)return Pz(o);const u=s&&s.default?s.default():void 0,d=(c==null?void 0:c.label)||((i=s.label)===null||i===void 0?void 0:i.call(s))||a;return m(m({key:`__RC_SELECT_GRP__${a===null?r:String(a)}__`},c),{label:d,options:l5(u||[])})}).filter(o=>o)}function Iz(e,t,n){const o=oe(),r=oe(),i=oe(),l=oe([]);return ye([e,t],()=>{e.value?l.value=tt(e.value).slice():l.value=l5(t.value)},{immediate:!0,deep:!0}),Ve(()=>{const a=l.value,s=new Map,c=new Map,u=n.value;function d(f){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;for(let v=0;v0&&arguments[0]!==void 0?arguments[0]:ne("");const t=`rc_select_${Ez()}`;return e.value||t}function a5(e){return Array.isArray(e)?e:e!==void 0?[e]:[]}function iv(e,t){return a5(e).join("").toUpperCase().includes(t)}const _z=(e,t,n,o,r)=>P(()=>{const i=n.value,l=r==null?void 0:r.value,a=o==null?void 0:o.value;if(!i||a===!1)return e.value;const{options:s,label:c,value:u}=t.value,d=[],f=typeof a=="function",h=i.toUpperCase(),v=f?a:(b,y)=>l?iv(y[l],h):y[s]?iv(y[c!=="children"?c:"label"],h):iv(y[u],h),g=f?b=>Lm(b):b=>b;return e.value.forEach(b=>{if(b[s]){if(v(i,g(b)))d.push(b);else{const S=b[s].filter($=>v(i,g($)));S.length&&d.push(m(m({},b),{[s]:S}))}return}v(i,g(b))&&d.push(b)}),d}),Mz=(e,t)=>{const n=oe({values:new Map,options:new Map});return[P(()=>{const{values:i,options:l}=n.value,a=e.value.map(u=>{var d;return u.label===void 0?m(m({},u),{label:(d=i.get(u.value))===null||d===void 0?void 0:d.label}):u}),s=new Map,c=new Map;return a.forEach(u=>{s.set(u.value,u),c.set(u.value,t.value.get(u.value)||l.get(u.value))}),n.value.values=s,n.value.options=c,a}),i=>t.value.get(i)||n.value.options.get(i)]};function Dt(e,t){const{defaultValue:n,value:o=ne()}=t||{};let r=typeof e=="function"?e():e;o.value!==void 0&&(r=je(o)),n!==void 0&&(r=typeof n=="function"?n():n);const i=ne(r),l=ne(r);Ve(()=>{let s=o.value!==void 0?o.value:i.value;t.postState&&(s=t.postState(s)),l.value=s});function a(s){const c=l.value;i.value=s,tt(l.value)!==s&&t.onChange&&t.onChange(s,c)}return ye(o,()=>{i.value=o.value}),[l,a]}function St(e){const t=typeof e=="function"?e():e,n=ne(t);function o(r){n.value=r}return[n,o]}const Az=["inputValue"];function s5(){return m(m({},lh()),{prefixCls:String,id:String,backfill:{type:Boolean,default:void 0},fieldNames:Object,inputValue:String,searchValue:String,onSearch:Function,autoClearSearchValue:{type:Boolean,default:void 0},onSelect:Function,onDeselect:Function,filterOption:{type:[Boolean,Function],default:void 0},filterSort:Function,optionFilterProp:String,optionLabelProp:String,options:Array,defaultActiveFirstOption:{type:Boolean,default:void 0},virtual:{type:Boolean,default:void 0},listHeight:Number,listItemHeight:Number,menuItemSelectedIcon:K.any,mode:String,labelInValue:{type:Boolean,default:void 0},value:K.any,defaultValue:K.any,onChange:Function,children:Array})}function Rz(e){return!e||typeof e!="object"}const Dz=re({compatConfig:{MODE:3},name:"VcSelect",inheritAttrs:!1,props:Qe(s5(),{prefixCls:"vc-select",autoClearSearchValue:!0,listHeight:200,listItemHeight:20,dropdownMatchSelectWidth:!0}),setup(e,t){let{expose:n,attrs:o,slots:r}=t;const i=vy(We(e,"id")),l=P(()=>t5(e.mode)),a=P(()=>!!(!e.options&&e.children)),s=P(()=>e.filterOption===void 0&&e.mode==="combobox"?!1:e.filterOption),c=P(()=>$P(e.fieldNames,a.value)),[u,d]=Dt("",{value:P(()=>e.searchValue!==void 0?e.searchValue:e.inputValue),postState:J=>J||""}),f=Iz(We(e,"options"),We(e,"children"),c),{valueOptions:h,labelOptions:v,options:g}=f,b=J=>a5(J).map(q=>{var V,W;let te,ue,ie,ae;Rz(q)?te=q:(ie=q.key,ue=q.label,te=(V=q.value)!==null&&V!==void 0?V:ie);const ce=h.value.get(te);return ce&&(ue===void 0&&(ue=ce==null?void 0:ce[e.optionLabelProp||c.value.label]),ie===void 0&&(ie=(W=ce==null?void 0:ce.key)!==null&&W!==void 0?W:te),ae=ce==null?void 0:ce.disabled),{label:ue,value:te,key:ie,disabled:ae,option:ce}}),[y,S]=Dt(e.defaultValue,{value:We(e,"value")}),$=P(()=>{var J;const G=b(y.value);return e.mode==="combobox"&&!(!((J=G[0])===null||J===void 0)&&J.value)?[]:G}),[w,C]=Mz($,h),O=P(()=>{if(!e.mode&&w.value.length===1){const J=w.value[0];if(J.value===null&&(J.label===null||J.label===void 0))return[]}return w.value.map(J=>{var G;return m(m({},J),{label:(G=typeof J.label=="function"?J.label():J.label)!==null&&G!==void 0?G:J.value})})}),x=P(()=>new Set(w.value.map(J=>J.value)));Ve(()=>{var J;if(e.mode==="combobox"){const G=(J=w.value[0])===null||J===void 0?void 0:J.value;G!=null&&d(String(G))}},{flush:"post"});const I=(J,G)=>{const q=G??J;return{[c.value.value]:J,[c.value.label]:q}},T=oe();Ve(()=>{if(e.mode!=="tags"){T.value=g.value;return}const J=g.value.slice(),G=q=>h.value.has(q);[...w.value].sort((q,V)=>q.value{const V=q.value;G(V)||J.push(I(V,q.label))}),T.value=J});const M=_z(T,c,u,s,We(e,"optionFilterProp")),E=P(()=>e.mode!=="tags"||!u.value||M.value.some(J=>J[e.optionFilterProp||"value"]===u.value)?M.value:[I(u.value),...M.value]),A=P(()=>e.filterSort?[...E.value].sort((J,G)=>e.filterSort(J,G)):E.value),R=P(()=>oN(A.value,{fieldNames:c.value,childrenAsData:a.value})),z=J=>{const G=b(J);if(S(G),e.onChange&&(G.length!==w.value.length||G.some((q,V)=>{var W;return((W=w.value[V])===null||W===void 0?void 0:W.value)!==(q==null?void 0:q.value)}))){const q=e.labelInValue?G.map(W=>m(m({},W),{originLabel:W.label,label:typeof W.label=="function"?W.label():W.label})):G.map(W=>W.value),V=G.map(W=>Lm(C(W.value)));e.onChange(l.value?q:q[0],l.value?V:V[0])}},[_,D]=St(null),[N,k]=St(0),F=P(()=>e.defaultActiveFirstOption!==void 0?e.defaultActiveFirstOption:e.mode!=="combobox"),L=function(J,G){let{source:q="keyboard"}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};k(G),e.backfill&&e.mode==="combobox"&&J!==null&&q==="keyboard"&&D(String(J))},H=(J,G)=>{const q=()=>{var V;const W=C(J),te=W==null?void 0:W[c.value.label];return[e.labelInValue?{label:typeof te=="function"?te():te,originLabel:te,value:J,key:(V=W==null?void 0:W.key)!==null&&V!==void 0?V:J}:J,Lm(W)]};if(G&&e.onSelect){const[V,W]=q();e.onSelect(V,W)}else if(!G&&e.onDeselect){const[V,W]=q();e.onDeselect(V,W)}},j=(J,G)=>{let q;const V=l.value?G.selected:!0;V?q=l.value?[...w.value,J]:[J]:q=w.value.filter(W=>W.value!==J),z(q),H(J,V),e.mode==="combobox"?D(""):(!l.value||e.autoClearSearchValue)&&(d(""),D(""))},Y=(J,G)=>{z(J),(G.type==="remove"||G.type==="clear")&&G.values.forEach(q=>{H(q.value,!1)})},Z=(J,G)=>{var q;if(d(J),D(null),G.source==="submit"){const V=(J||"").trim();if(V){const W=Array.from(new Set([...x.value,V]));z(W),H(V,!0),d("")}return}G.source!=="blur"&&(e.mode==="combobox"&&z(J),(q=e.onSearch)===null||q===void 0||q.call(e,J))},X=J=>{let G=J;e.mode!=="tags"&&(G=J.map(V=>{const W=v.value.get(V);return W==null?void 0:W.value}).filter(V=>V!==void 0));const q=Array.from(new Set([...x.value,...G]));z(q),q.forEach(V=>{H(V,!0)})},ee=P(()=>e.virtual!==!1&&e.dropdownMatchSelectWidth!==!1);$z(Rf(m(m({},f),{flattenOptions:R,onActiveValue:L,defaultActiveFirstOption:F,onSelect:j,menuItemSelectedIcon:We(e,"menuItemSelectedIcon"),rawValues:x,fieldNames:c,virtual:ee,listHeight:We(e,"listHeight"),listItemHeight:We(e,"listItemHeight"),childrenAsData:a})));const U=ne();n({focus(){var J;(J=U.value)===null||J===void 0||J.focus()},blur(){var J;(J=U.value)===null||J===void 0||J.blur()},scrollTo(J){var G;(G=U.value)===null||G===void 0||G.scrollTo(J)}});const Q=P(()=>ot(e,["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","listHeight","listItemHeight","value","defaultValue","labelInValue","onChange"]));return()=>p(hy,B(B(B({},Q.value),o),{},{id:i,prefixCls:e.prefixCls,ref:U,omitDomProps:Az,mode:e.mode,displayValues:O.value,onDisplayValuesChange:Y,searchValue:u.value,onSearch:Z,onSearchSplit:X,dropdownMatchSelectWidth:e.dropdownMatchSelectWidth,OptionList:wz,emptyOptions:!R.value.length,activeValue:_.value,activeDescendantId:`${i}_list_${N.value}`}),r)}}),my=()=>null;my.isSelectOption=!0;my.displayName="ASelectOption";const by=()=>null;by.isSelectOptGroup=!0;by.displayName="ASelectOptGroup";var Bz={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},Nz=Symbol("iconContext"),c5=function(){return Ge(Nz,{prefixCls:ne("anticon"),rootClassName:ne(""),csp:ne()})};function yy(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function kz(e,t){return e&&e.contains?e.contains(t):!1}var hx="data-vc-order",Fz="vc-icon-key",Ym=new Map;function u5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.mark;return t?t.startsWith("data-")?t:"data-".concat(t):Fz}function Sy(e){if(e.attachTo)return e.attachTo;var t=document.querySelector("head");return t||document.body}function Lz(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function d5(e){return Array.from((Ym.get(e)||e).children).filter(function(t){return t.tagName==="STYLE"})}function f5(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!yy())return null;var n=t.csp,o=t.prepend,r=document.createElement("style");r.setAttribute(hx,Lz(o)),n&&n.nonce&&(r.nonce=n.nonce),r.innerHTML=e;var i=Sy(t),l=i.firstChild;if(o){if(o==="queue"){var a=d5(i).filter(function(s){return["prepend","prependQueue"].includes(s.getAttribute(hx))});if(a.length)return i.insertBefore(r,a[a.length-1].nextSibling),r}i.insertBefore(r,l)}else i.appendChild(r);return r}function zz(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Sy(t);return d5(n).find(function(o){return o.getAttribute(u5(t))===e})}function Hz(e,t){var n=Ym.get(e);if(!n||!kz(document,n)){var o=f5("",t),r=o.parentNode;Ym.set(e,r),e.removeChild(o)}}function jz(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=Sy(n);Hz(o,n);var r=zz(t,n);if(r)return n.csp&&n.csp.nonce&&r.nonce!==n.csp.nonce&&(r.nonce=n.csp.nonce),r.innerHTML!==e&&(r.innerHTML=e),r;var i=f5(e,n);return i.setAttribute(u5(n),t),i}function gx(e){for(var t=1;t * { + line-height: 1; +} + +.anticon svg { + display: inline-block; +} + +.anticon::before { + display: none; +} + +.anticon .anticon-icon { + display: block; +} + +.anticon[tabindex] { + cursor: pointer; +} + +.anticon-spin::before, +.anticon-spin { + display: inline-block; + -webkit-animation: loadingCircle 1s infinite linear; + animation: loadingCircle 1s infinite linear; +} + +@-webkit-keyframes loadingCircle { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes loadingCircle { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +`;function g5(e){return e&&e.getRootNode&&e.getRootNode()}function Kz(e){return yy()?g5(e)instanceof ShadowRoot:!1}function Gz(e){return Kz(e)?g5(e):null}var Uz=function(){var t=c5(),n=t.prefixCls,o=t.csp,r=On(),i=Wz;n&&(i=i.replace(/anticon/g,n.value)),rt(function(){if(yy()){var l=r.vnode.el,a=Gz(l);jz(i,"@ant-design-vue-icons",{prepend:!0,csp:o.value,attachTo:a})}})},Xz=["icon","primaryColor","secondaryColor"];function Yz(e,t){if(e==null)return{};var n=qz(e,t),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}function qz(e,t){if(e==null)return{};var n={},o=Object.keys(e),r,i;for(i=0;i=0)&&(n[r]=e[r]);return n}function $d(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,o=new Array(t);ne.length)&&(t=e.length);for(var n=0,o=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}function hH(e,t){if(e==null)return{};var n={},o=Object.keys(e),r,i;for(i=0;i=0)&&(n[r]=e[r]);return n}v5(ZD.primary);var ke=function(t,n){var o,r=yx({},t,n.attrs),i=r.class,l=r.icon,a=r.spin,s=r.rotate,c=r.tabindex,u=r.twoToneColor,d=r.onClick,f=pH(r,aH),h=c5(),v=h.prefixCls,g=h.rootClassName,b=(o={},Ls(o,g.value,!!g.value),Ls(o,v.value,!0),Ls(o,"".concat(v.value,"-").concat(l.name),!!l.name),Ls(o,"".concat(v.value,"-spin"),!!a||l.name==="loading"),o),y=c;y===void 0&&d&&(y=-1);var S=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,$=h5(u),w=sH($,2),C=w[0],O=w[1];return p("span",yx({role:"img","aria-label":l.name},f,{onClick:d,class:[b,i],tabindex:y}),[p(Xi,{icon:l,primaryColor:C,secondaryColor:O,style:S},null),p(lH,null,null)])};ke.props={spin:Boolean,rotate:Number,icon:Object,twoToneColor:[String,Array]};ke.displayName="AntdIcon";ke.inheritAttrs=!1;ke.getTwoToneColor=iH;ke.setTwoToneColor=v5;function Sx(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};const{loading:n,multiple:o,prefixCls:r,hasFeedback:i,feedbackIcon:l,showArrow:a}=e,s=e.suffixIcon||t.suffixIcon&&t.suffixIcon(),c=e.clearIcon||t.clearIcon&&t.clearIcon(),u=e.menuItemSelectedIcon||t.menuItemSelectedIcon&&t.menuItemSelectedIcon(),d=e.removeIcon||t.removeIcon&&t.removeIcon(),f=c??p(Wn,null,null),h=y=>p(Le,null,[a!==!1&&y,i&&l]);let v=null;if(s!==void 0)v=h(s);else if(n)v=h(p(to,{spin:!0},null));else{const y=`${r}-suffix`;v=S=>{let{open:$,showSearch:w}=S;return h($&&w?p(Ar,{class:y},null):p(Jl,{class:y},null))}}let g=null;u!==void 0?g=u:o?g=p(Zl,null,null):g=null;let b=null;return d!==void 0?b=d:b=p(Vn,null,null),{clearIcon:f,suffixIcon:v,itemIcon:g,removeIcon:b}}function Cy(e){const t=Symbol("contextKey");return{useProvide:(r,i)=>{const l=ft({});return Ye(t,l),Ve(()=>{m(l,r,i||{})}),l},useInject:()=>Ge(t,e)||{}}}const Df=Symbol("ContextProps"),Bf=Symbol("InternalContextProps"),PH=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:P(()=>!0);const n=ne(new Map),o=(i,l)=>{n.value.set(i,l),n.value=new Map(n.value)},r=i=>{n.value.delete(i),n.value=new Map(n.value)};ye([t,n],()=>{}),Ye(Df,e),Ye(Bf,{addFormItemField:o,removeFormItemField:r})},Jm={id:P(()=>{}),onFieldBlur:()=>{},onFieldChange:()=>{},clearValidate:()=>{}},Zm={addFormItemField:()=>{},removeFormItemField:()=>{}},an=()=>{const e=Ge(Bf,Zm),t=Symbol("FormItemFieldKey"),n=On();return e.addFormItemField(t,n.type),et(()=>{e.removeFormItemField(t)}),Ye(Bf,Zm),Ye(Df,Jm),Ge(Df,Jm)},Nf=re({compatConfig:{MODE:3},name:"AFormItemRest",setup(e,t){let{slots:n}=t;return Ye(Bf,Zm),Ye(Df,Jm),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}}),yn=Cy({}),kf=re({name:"NoFormStatus",setup(e,t){let{slots:n}=t;return yn.useProvide({}),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}});function Fn(e,t,n){return le({[`${e}-status-success`]:t==="success",[`${e}-status-warning`]:t==="warning",[`${e}-status-error`]:t==="error",[`${e}-status-validating`]:t==="validating",[`${e}-has-feedback`]:n})}const fr=(e,t)=>t||e,IH=e=>{const{componentCls:t}=e;return{[t]:{display:"inline-flex","&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},TH=e=>{const{componentCls:t}=e;return{[t]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},[`${t}-item`]:{"&:empty":{display:"none"}}}}},m5=Ue("Space",e=>[TH(e),IH(e)]);var EH="[object Symbol]";function sh(e){return typeof e=="symbol"||sr(e)&&Gi(e)==EH}function xy(e,t){for(var n=-1,o=e==null?0:e.length,r=Array(o);++n0){if(++t>=GH)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function qH(e){return function(){return e}}var Ff=function(){try{var e=Xl(Object,"defineProperty");return e({},"",{}),e}catch{}}(),JH=Ff?function(e,t){return Ff(e,"toString",{configurable:!0,enumerable:!1,value:qH(t),writable:!0})}:wy,y5=YH(JH);function ZH(e,t){for(var n=-1,o=e==null?0:e.length;++n-1}function C5(e,t,n){t=="__proto__"&&Ff?Ff(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var nj=Object.prototype,oj=nj.hasOwnProperty;function Oy(e,t,n){var o=e[t];(!(oj.call(e,t)&&ty(o,n))||n===void 0&&!(t in e))&&C5(e,t,n)}function eu(e,t,n,o){var r=!n;n||(n={});for(var i=-1,l=t.length;++ir?0:r+t),n=n>r?r:n,n<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(r);++o=t||x<0||d&&I>=i}function y(){var O=lv();if(b(O))return S(O);a=setTimeout(y,g(O))}function S(O){return a=void 0,f&&o?h(O):(o=r=void 0,l)}function $(){a!==void 0&&clearTimeout(a),c=0,o=s=r=a=void 0}function w(){return a===void 0?l:S(lv())}function C(){var O=lv(),x=b(O);if(o=arguments,r=this,s=O,x){if(a===void 0)return v(s);if(d)return clearTimeout(a),a=setTimeout(y,t),h(s)}return a===void 0&&(a=setTimeout(y,t)),l}return C.cancel=$,C.flush=w,C}function hW(e){return sr(e)&&ls(e)}function gW(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function vW(e){return function(t,n,o){var r=Object(t);if(!ls(t)){var i=Ay(n);t=as(t),n=function(a){return i(r[a],a,r)}}var l=e(t,n,o);return l>-1?r[i?t[l]:l]:void 0}}var mW=Math.max;function bW(e,t,n){var o=e==null?0:e.length;if(!o)return-1;var r=n==null?0:HH(n);return r<0&&(r=mW(o+r,0)),S5(e,Ay(t),r)}var yW=vW(bW);function SW(e){for(var t=-1,n=e==null?0:e.length,o={};++t=120&&u.length>=120?new Za(l&&u):void 0}u=e[0];var d=-1,f=a[0];e:for(;++d1),i}),eu(e,T5(e),n),o&&(n=nc(n,DW|BW|NW,RW));for(var r=t.length;r--;)AW(n,t[r]);return n});function FW(e,t,n,o){if(!ar(e))return e;t=cs(t,e);for(var r=-1,i=t.length,l=i-1,a=e;a!=null&&++r=WW){var c=VW(e);if(c)return ny(c);l=!1,r=Ef,s=new Za}else s=a;e:for(;++o({compactSize:String,compactDirection:K.oneOf(Mn("horizontal","vertical")).def("horizontal"),isFirstItem:$e(),isLastItem:$e()}),uh=Cy(null),Yi=(e,t)=>{const n=uh.useInject(),o=P(()=>{if(!n||B5(n))return"";const{compactDirection:r,isFirstItem:i,isLastItem:l}=n,a=r==="vertical"?"-vertical-":"-";return le({[`${e.value}-compact${a}item`]:!0,[`${e.value}-compact${a}first-item`]:i,[`${e.value}-compact${a}last-item`]:l,[`${e.value}-compact${a}item-rtl`]:t.value==="rtl"})});return{compactSize:P(()=>n==null?void 0:n.compactSize),compactDirection:P(()=>n==null?void 0:n.compactDirection),compactItemClassnames:o}},Rc=re({name:"NoCompactStyle",setup(e,t){let{slots:n}=t;return uh.useProvide(null),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}}),UW=()=>({prefixCls:String,size:{type:String},direction:K.oneOf(Mn("horizontal","vertical")).def("horizontal"),align:K.oneOf(Mn("start","end","center","baseline")),block:{type:Boolean,default:void 0}}),XW=re({name:"CompactItem",props:GW(),setup(e,t){let{slots:n}=t;return uh.useProvide(e),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}}),Lf=re({name:"ASpaceCompact",inheritAttrs:!1,props:UW(),setup(e,t){let{attrs:n,slots:o}=t;const{prefixCls:r,direction:i}=Ee("space-compact",e),l=uh.useInject(),[a,s]=m5(r),c=P(()=>le(r.value,s.value,{[`${r.value}-rtl`]:i.value==="rtl",[`${r.value}-block`]:e.block,[`${r.value}-vertical`]:e.direction==="vertical"}));return()=>{var u;const d=wt(((u=o.default)===null||u===void 0?void 0:u.call(o))||[]);return d.length===0?null:a(p("div",B(B({},n),{},{class:[c.value,n.class]}),[d.map((f,h)=>{var v;const g=f&&f.key||`${r.value}-item-${h}`,b=!l||B5(l);return p(XW,{key:g,compactSize:(v=e.size)!==null&&v!==void 0?v:"middle",compactDirection:e.direction,isFirstItem:h===0&&(b||(l==null?void 0:l.isFirstItem)),isLastItem:h===d.length-1&&(b||(l==null?void 0:l.isLastItem))},{default:()=>[f]})})]))}}}),YW=e=>({animationDuration:e,animationFillMode:"both"}),qW=e=>({animationDuration:e,animationFillMode:"both"}),tu=function(e,t,n,o){const i=(arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1)?"&":"";return{[` + ${i}${e}-enter, + ${i}${e}-appear + `]:m(m({},YW(o)),{animationPlayState:"paused"}),[`${i}${e}-leave`]:m(m({},qW(o)),{animationPlayState:"paused"}),[` + ${i}${e}-enter${e}-enter-active, + ${i}${e}-appear${e}-appear-active + `]:{animationName:t,animationPlayState:"running"},[`${i}${e}-leave${e}-leave-active`]:{animationName:n,animationPlayState:"running",pointerEvents:"none"}}},JW=new it("antFadeIn",{"0%":{opacity:0},"100%":{opacity:1}}),ZW=new it("antFadeOut",{"0%":{opacity:1},"100%":{opacity:0}}),Dy=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const{antCls:n}=e,o=`${n}-fade`,r=t?"&":"";return[tu(o,JW,ZW,e.motionDurationMid,t),{[` + ${r}${o}-enter, + ${r}${o}-appear + `]:{opacity:0,animationTimingFunction:"linear"},[`${r}${o}-leave`]:{animationTimingFunction:"linear"}}]},QW=new it("antMoveDownIn",{"0%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),eK=new it("antMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0}}),tK=new it("antMoveLeftIn",{"0%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),nK=new it("antMoveLeftOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),oK=new it("antMoveRightIn",{"0%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),rK=new it("antMoveRightOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),iK=new it("antMoveUpIn",{"0%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),lK=new it("antMoveUpOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0}}),aK={"move-up":{inKeyframes:iK,outKeyframes:lK},"move-down":{inKeyframes:QW,outKeyframes:eK},"move-left":{inKeyframes:tK,outKeyframes:nK},"move-right":{inKeyframes:oK,outKeyframes:rK}},es=(e,t)=>{const{antCls:n}=e,o=`${n}-${t}`,{inKeyframes:r,outKeyframes:i}=aK[t];return[tu(o,r,i,e.motionDurationMid),{[` + ${o}-enter, + ${o}-appear + `]:{opacity:0,animationTimingFunction:e.motionEaseOutCirc},[`${o}-leave`]:{animationTimingFunction:e.motionEaseInOutCirc}}]},dh=new it("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),fh=new it("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),ph=new it("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),hh=new it("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),sK=new it("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),cK=new it("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}}),uK=new it("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),dK=new it("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}}),fK={"slide-up":{inKeyframes:dh,outKeyframes:fh},"slide-down":{inKeyframes:ph,outKeyframes:hh},"slide-left":{inKeyframes:sK,outKeyframes:cK},"slide-right":{inKeyframes:uK,outKeyframes:dK}},Rr=(e,t)=>{const{antCls:n}=e,o=`${n}-${t}`,{inKeyframes:r,outKeyframes:i}=fK[t];return[tu(o,r,i,e.motionDurationMid),{[` + ${o}-enter, + ${o}-appear + `]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:e.motionEaseOutQuint},[`${o}-leave`]:{animationTimingFunction:e.motionEaseInQuint}}]},By=new it("antZoomIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),pK=new it("antZoomOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),Lx=new it("antZoomBigIn",{"0%":{transform:"scale(0.8)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),zx=new it("antZoomBigOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.8)",opacity:0}}),hK=new it("antZoomUpIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 0%"}}),gK=new it("antZoomUpOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 0%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0}}),vK=new it("antZoomLeftIn",{"0%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"0% 50%"}}),mK=new it("antZoomLeftOut",{"0%":{transform:"scale(1)",transformOrigin:"0% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0}}),bK=new it("antZoomRightIn",{"0%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"100% 50%"}}),yK=new it("antZoomRightOut",{"0%":{transform:"scale(1)",transformOrigin:"100% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0}}),SK=new it("antZoomDownIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 100%"}}),$K=new it("antZoomDownOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 100%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0}}),CK={zoom:{inKeyframes:By,outKeyframes:pK},"zoom-big":{inKeyframes:Lx,outKeyframes:zx},"zoom-big-fast":{inKeyframes:Lx,outKeyframes:zx},"zoom-left":{inKeyframes:vK,outKeyframes:mK},"zoom-right":{inKeyframes:bK,outKeyframes:yK},"zoom-up":{inKeyframes:hK,outKeyframes:gK},"zoom-down":{inKeyframes:SK,outKeyframes:$K}},ds=(e,t)=>{const{antCls:n}=e,o=`${n}-${t}`,{inKeyframes:r,outKeyframes:i}=CK[t];return[tu(o,r,i,t==="zoom-big-fast"?e.motionDurationFast:e.motionDurationMid),{[` + ${o}-enter, + ${o}-appear + `]:{transform:"scale(0)",opacity:0,animationTimingFunction:e.motionEaseOutCirc,"&-prepare":{transform:"none"}},[`${o}-leave`]:{animationTimingFunction:e.motionEaseInOutCirc}}]},nu=e=>({[e.componentCls]:{[`${e.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${e.motionDurationMid} ${e.motionEaseInOut}, + opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}},[`${e.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${e.motionDurationMid} ${e.motionEaseInOut}, + opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}}}),Hx=e=>{const{controlPaddingHorizontal:t}=e;return{position:"relative",display:"block",minHeight:e.controlHeight,padding:`${(e.controlHeight-e.fontSize*e.lineHeight)/2}px ${t}px`,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,lineHeight:e.lineHeight,boxSizing:"border-box"}},xK=e=>{const{antCls:t,componentCls:n}=e,o=`${n}-item`;return[{[`${n}-dropdown`]:m(m({},qe(e)),{position:"absolute",top:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",padding:e.paddingXXS,overflow:"hidden",fontSize:e.fontSize,fontVariant:"initial",backgroundColor:e.colorBgElevated,borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary,[` + &${t}-slide-up-enter${t}-slide-up-enter-active${n}-dropdown-placement-bottomLeft, + &${t}-slide-up-appear${t}-slide-up-appear-active${n}-dropdown-placement-bottomLeft + `]:{animationName:dh},[` + &${t}-slide-up-enter${t}-slide-up-enter-active${n}-dropdown-placement-topLeft, + &${t}-slide-up-appear${t}-slide-up-appear-active${n}-dropdown-placement-topLeft + `]:{animationName:ph},[`&${t}-slide-up-leave${t}-slide-up-leave-active${n}-dropdown-placement-bottomLeft`]:{animationName:fh},[`&${t}-slide-up-leave${t}-slide-up-leave-active${n}-dropdown-placement-topLeft`]:{animationName:hh},"&-hidden":{display:"none"},"&-empty":{color:e.colorTextDisabled},[`${o}-empty`]:m(m({},Hx(e)),{color:e.colorTextDisabled}),[`${o}`]:m(m({},Hx(e)),{cursor:"pointer",transition:`background ${e.motionDurationSlow} ease`,borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":m({flex:"auto"},Jt),"&-state":{flex:"none"},[`&-active:not(${o}-option-disabled)`]:{backgroundColor:e.controlItemBgHover},[`&-selected:not(${o}-option-disabled)`]:{color:e.colorText,fontWeight:e.fontWeightStrong,backgroundColor:e.controlItemBgActive,[`${o}-option-state`]:{color:e.colorPrimary}},"&-disabled":{[`&${o}-option-selected`]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:e.controlPaddingHorizontal*2}}}),"&-rtl":{direction:"rtl"}})},Rr(e,"slide-up"),Rr(e,"slide-down"),es(e,"move-up"),es(e,"move-down")]},sa=2;function k5(e){let{controlHeightSM:t,controlHeight:n,lineWidth:o}=e;const r=(n-t)/2-o,i=Math.ceil(r/2);return[r,i]}function sv(e,t){const{componentCls:n,iconCls:o}=e,r=`${n}-selection-overflow`,i=e.controlHeightSM,[l]=k5(e),a=t?`${n}-${t}`:"";return{[`${n}-multiple${a}`]:{fontSize:e.fontSize,[r]:{position:"relative",display:"flex",flex:"auto",flexWrap:"wrap",maxWidth:"100%","&-item":{flex:"none",alignSelf:"center",maxWidth:"100%",display:"inline-flex"}},[`${n}-selector`]:{display:"flex",flexWrap:"wrap",alignItems:"center",padding:`${l-sa}px ${sa*2}px`,borderRadius:e.borderRadius,[`${n}-show-search&`]:{cursor:"text"},[`${n}-disabled&`]:{background:e.colorBgContainerDisabled,cursor:"not-allowed"},"&:after":{display:"inline-block",width:0,margin:`${sa}px 0`,lineHeight:`${i}px`,content:'"\\a0"'}},[` + &${n}-show-arrow ${n}-selector, + &${n}-allow-clear ${n}-selector + `]:{paddingInlineEnd:e.fontSizeIcon+e.controlPaddingHorizontal},[`${n}-selection-item`]:{position:"relative",display:"flex",flex:"none",boxSizing:"border-box",maxWidth:"100%",height:i,marginTop:sa,marginBottom:sa,lineHeight:`${i-e.lineWidth*2}px`,background:e.colorFillSecondary,border:`${e.lineWidth}px solid ${e.colorSplit}`,borderRadius:e.borderRadiusSM,cursor:"default",transition:`font-size ${e.motionDurationSlow}, line-height ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,userSelect:"none",marginInlineEnd:sa*2,paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS/2,[`${n}-disabled&`]:{color:e.colorTextDisabled,borderColor:e.colorBorder,cursor:"not-allowed"},"&-content":{display:"inline-block",marginInlineEnd:e.paddingXS/2,overflow:"hidden",whiteSpace:"pre",textOverflow:"ellipsis"},"&-remove":m(m({},Kl()),{display:"inline-block",color:e.colorIcon,fontWeight:"bold",fontSize:10,lineHeight:"inherit",cursor:"pointer",[`> ${o}`]:{verticalAlign:"-0.2em"},"&:hover":{color:e.colorIconHover}})},[`${r}-item + ${r}-item`]:{[`${n}-selection-search`]:{marginInlineStart:0}},[`${n}-selection-search`]:{display:"inline-flex",position:"relative",maxWidth:"100%",marginInlineStart:e.inputPaddingHorizontalBase-l,"\n &-input,\n &-mirror\n ":{height:i,fontFamily:e.fontFamily,lineHeight:`${i}px`,transition:`all ${e.motionDurationSlow}`},"&-input":{width:"100%",minWidth:4.1},"&-mirror":{position:"absolute",top:0,insetInlineStart:0,insetInlineEnd:"auto",zIndex:999,whiteSpace:"pre",visibility:"hidden"}},[`${n}-selection-placeholder `]:{position:"absolute",top:"50%",insetInlineStart:e.inputPaddingHorizontalBase,insetInlineEnd:e.inputPaddingHorizontalBase,transform:"translateY(-50%)",transition:`all ${e.motionDurationSlow}`}}}}function wK(e){const{componentCls:t}=e,n=ze(e,{controlHeight:e.controlHeightSM,controlHeightSM:e.controlHeightXS,borderRadius:e.borderRadiusSM,borderRadiusSM:e.borderRadiusXS}),[,o]=k5(e);return[sv(e),sv(n,"sm"),{[`${t}-multiple${t}-sm`]:{[`${t}-selection-placeholder`]:{insetInlineStart:e.controlPaddingHorizontalSM-e.lineWidth,insetInlineEnd:"auto"},[`${t}-selection-search`]:{marginInlineStart:o}}},sv(ze(e,{fontSize:e.fontSizeLG,controlHeight:e.controlHeightLG,controlHeightSM:e.controlHeight,borderRadius:e.borderRadiusLG,borderRadiusSM:e.borderRadius}),"lg")]}function cv(e,t){const{componentCls:n,inputPaddingHorizontalBase:o,borderRadius:r}=e,i=e.controlHeight-e.lineWidth*2,l=Math.ceil(e.fontSize*1.25),a=t?`${n}-${t}`:"";return{[`${n}-single${a}`]:{fontSize:e.fontSize,[`${n}-selector`]:m(m({},qe(e)),{display:"flex",borderRadius:r,[`${n}-selection-search`]:{position:"absolute",top:0,insetInlineStart:o,insetInlineEnd:o,bottom:0,"&-input":{width:"100%"}},[` + ${n}-selection-item, + ${n}-selection-placeholder + `]:{padding:0,lineHeight:`${i}px`,transition:`all ${e.motionDurationSlow}`,"@supports (-moz-appearance: meterbar)":{lineHeight:`${i}px`}},[`${n}-selection-item`]:{position:"relative",userSelect:"none"},[`${n}-selection-placeholder`]:{transition:"none",pointerEvents:"none"},[["&:after",`${n}-selection-item:after`,`${n}-selection-placeholder:after`].join(",")]:{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'}}),[` + &${n}-show-arrow ${n}-selection-item, + &${n}-show-arrow ${n}-selection-placeholder + `]:{paddingInlineEnd:l},[`&${n}-open ${n}-selection-item`]:{color:e.colorTextPlaceholder},[`&:not(${n}-customize-input)`]:{[`${n}-selector`]:{width:"100%",height:e.controlHeight,padding:`0 ${o}px`,[`${n}-selection-search-input`]:{height:i},"&:after":{lineHeight:`${i}px`}}},[`&${n}-customize-input`]:{[`${n}-selector`]:{"&:after":{display:"none"},[`${n}-selection-search`]:{position:"static",width:"100%"},[`${n}-selection-placeholder`]:{position:"absolute",insetInlineStart:0,insetInlineEnd:0,padding:`0 ${o}px`,"&:after":{display:"none"}}}}}}}function OK(e){const{componentCls:t}=e,n=e.controlPaddingHorizontalSM-e.lineWidth;return[cv(e),cv(ze(e,{controlHeight:e.controlHeightSM,borderRadius:e.borderRadiusSM}),"sm"),{[`${t}-single${t}-sm`]:{[`&:not(${t}-customize-input)`]:{[`${t}-selection-search`]:{insetInlineStart:n,insetInlineEnd:n},[`${t}-selector`]:{padding:`0 ${n}px`},[`&${t}-show-arrow ${t}-selection-search`]:{insetInlineEnd:n+e.fontSize*1.5},[` + &${t}-show-arrow ${t}-selection-item, + &${t}-show-arrow ${t}-selection-placeholder + `]:{paddingInlineEnd:e.fontSize*1.5}}}},cv(ze(e,{controlHeight:e.controlHeightLG,fontSize:e.fontSizeLG,borderRadius:e.borderRadiusLG}),"lg")]}function PK(e,t,n){const{focusElCls:o,focus:r,borderElCls:i}=n,l=i?"> *":"",a=["hover",r?"focus":null,"active"].filter(Boolean).map(s=>`&:${s} ${l}`).join(",");return{[`&-item:not(${t}-last-item)`]:{marginInlineEnd:-e.lineWidth},"&-item":m(m({[a]:{zIndex:2}},o?{[`&${o}`]:{zIndex:2}}:{}),{[`&[disabled] ${l}`]:{zIndex:0}})}}function IK(e,t,n){const{borderElCls:o}=n,r=o?`> ${o}`:"";return{[`&-item:not(${t}-first-item):not(${t}-last-item) ${r}`]:{borderRadius:0},[`&-item:not(${t}-last-item)${t}-first-item`]:{[`& ${r}, &${e}-sm ${r}, &${e}-lg ${r}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&-item:not(${t}-first-item)${t}-last-item`]:{[`& ${r}, &${e}-sm ${r}, &${e}-lg ${r}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function fs(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{focus:!0};const{componentCls:n}=e,o=`${n}-compact`;return{[o]:m(m({},PK(e,o,t)),IK(n,o,t))}}const TK=e=>{const{componentCls:t}=e;return{position:"relative",backgroundColor:e.colorBgContainer,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,input:{cursor:"pointer"},[`${t}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit"}},[`${t}-disabled&`]:{color:e.colorTextDisabled,background:e.colorBgContainerDisabled,cursor:"not-allowed",[`${t}-multiple&`]:{background:e.colorBgContainerDisabled},input:{cursor:"not-allowed"}}}},uv=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{componentCls:o,borderHoverColor:r,outlineColor:i,antCls:l}=t,a=n?{[`${o}-selector`]:{borderColor:r}}:{};return{[e]:{[`&:not(${o}-disabled):not(${o}-customize-input):not(${l}-pagination-size-changer)`]:m(m({},a),{[`${o}-focused& ${o}-selector`]:{borderColor:r,boxShadow:`0 0 0 ${t.controlOutlineWidth}px ${i}`,borderInlineEndWidth:`${t.controlLineWidth}px !important`,outline:0},[`&:hover ${o}-selector`]:{borderColor:r,borderInlineEndWidth:`${t.controlLineWidth}px !important`}})}}},EK=e=>{const{componentCls:t}=e;return{[`${t}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},_K=e=>{const{componentCls:t,inputPaddingHorizontalBase:n,iconCls:o}=e;return{[t]:m(m({},qe(e)),{position:"relative",display:"inline-block",cursor:"pointer",[`&:not(${t}-customize-input) ${t}-selector`]:m(m({},TK(e)),EK(e)),[`${t}-selection-item`]:m({flex:1,fontWeight:"normal"},Jt),[`${t}-selection-placeholder`]:m(m({},Jt),{flex:1,color:e.colorTextPlaceholder,pointerEvents:"none"}),[`${t}-arrow`]:m(m({},Kl()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:n,height:e.fontSizeIcon,marginTop:-e.fontSizeIcon/2,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",[o]:{verticalAlign:"top",transition:`transform ${e.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${t}-suffix)`]:{pointerEvents:"auto"}},[`${t}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${t}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:n,zIndex:1,display:"inline-block",width:e.fontSizeIcon,height:e.fontSizeIcon,marginTop:-e.fontSizeIcon/2,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",background:e.colorBgContainer,cursor:"pointer",opacity:0,transition:`color ${e.motionDurationMid} ease, opacity ${e.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:e.colorTextTertiary}},"&:hover":{[`${t}-clear`]:{opacity:1}}}),[`${t}-has-feedback`]:{[`${t}-clear`]:{insetInlineEnd:n+e.fontSize+e.paddingXXS}}}},MK=e=>{const{componentCls:t}=e;return[{[t]:{[`&-borderless ${t}-selector`]:{backgroundColor:"transparent !important",borderColor:"transparent !important",boxShadow:"none !important"},[`&${t}-in-form-item`]:{width:"100%"}}},_K(e),OK(e),wK(e),xK(e),{[`${t}-rtl`]:{direction:"rtl"}},uv(t,ze(e,{borderHoverColor:e.colorPrimaryHover,outlineColor:e.controlOutline})),uv(`${t}-status-error`,ze(e,{borderHoverColor:e.colorErrorHover,outlineColor:e.colorErrorOutline}),!0),uv(`${t}-status-warning`,ze(e,{borderHoverColor:e.colorWarningHover,outlineColor:e.colorWarningOutline}),!0),fs(e,{borderElCls:`${t}-selector`,focusElCls:`${t}-focused`})]},Ny=Ue("Select",(e,t)=>{let{rootPrefixCls:n}=t;const o=ze(e,{rootPrefixCls:n,inputPaddingHorizontalBase:e.paddingSM-1});return[MK(o)]},e=>({zIndexPopup:e.zIndexPopupBase+50})),gh=()=>m(m({},ot(s5(),["inputIcon","mode","getInputElement","getRawInputElement","backfill"])),{value:He([Array,Object,String,Number]),defaultValue:He([Array,Object,String,Number]),notFoundContent:K.any,suffixIcon:K.any,itemIcon:K.any,size:Ne(),mode:Ne(),bordered:$e(!0),transitionName:String,choiceTransitionName:Ne(""),popupClassName:String,dropdownClassName:String,placement:Ne(),status:Ne(),"onUpdate:value":ve()}),jx="SECRET_COMBOBOX_MODE_DO_NOT_USE",Cn=re({compatConfig:{MODE:3},name:"ASelect",Option:my,OptGroup:by,inheritAttrs:!1,props:Qe(gh(),{listHeight:256,listItemHeight:24}),SECRET_COMBOBOX_MODE_DO_NOT_USE:jx,slots:Object,setup(e,t){let{attrs:n,emit:o,slots:r,expose:i}=t;const l=ne(),a=an(),s=yn.useInject(),c=P(()=>fr(s.status,e.status)),u=()=>{var H;(H=l.value)===null||H===void 0||H.focus()},d=()=>{var H;(H=l.value)===null||H===void 0||H.blur()},f=H=>{var j;(j=l.value)===null||j===void 0||j.scrollTo(H)},h=P(()=>{const{mode:H}=e;if(H!=="combobox")return H===jx?"combobox":H}),{prefixCls:v,direction:g,renderEmpty:b,size:y,getPrefixCls:S,getPopupContainer:$,disabled:w,select:C}=Ee("select",e),{compactSize:O,compactItemClassnames:x}=Yi(v,g),I=P(()=>O.value||y.value),T=po(),M=P(()=>{var H;return(H=w.value)!==null&&H!==void 0?H:T.value}),[E,A]=Ny(v),R=P(()=>S()),z=P(()=>e.placement!==void 0?e.placement:g.value==="rtl"?"bottomRight":"bottomLeft"),_=P(()=>Hn(R.value,uy(z.value),e.transitionName)),D=P(()=>le({[`${v.value}-lg`]:I.value==="large",[`${v.value}-sm`]:I.value==="small",[`${v.value}-rtl`]:g.value==="rtl",[`${v.value}-borderless`]:!e.bordered,[`${v.value}-in-form-item`]:s.isFormItemInput},Fn(v.value,c.value,s.hasFeedback),x.value,A.value)),N=function(){for(var H=arguments.length,j=new Array(H),Y=0;Y{o("blur",H),a.onFieldBlur()};i({blur:d,focus:u,scrollTo:f});const F=P(()=>h.value==="multiple"||h.value==="tags"),L=P(()=>e.showArrow!==void 0?e.showArrow:e.loading||!(F.value||h.value==="combobox"));return()=>{var H,j,Y,Z;const{notFoundContent:X,listHeight:ee=256,listItemHeight:U=24,popupClassName:Q,dropdownClassName:J,virtual:G,dropdownMatchSelectWidth:q,id:V=a.id.value,placeholder:W=(H=r.placeholder)===null||H===void 0?void 0:H.call(r),showArrow:te}=e,{hasFeedback:ue,feedbackIcon:ie}=s;let ae;X!==void 0?ae=X:r.notFoundContent?ae=r.notFoundContent():h.value==="combobox"?ae=null:ae=(b==null?void 0:b("Select"))||p(Vb,{componentName:"Select"},null);const{suffixIcon:ce,itemIcon:se,removeIcon:pe,clearIcon:he}=$y(m(m({},e),{multiple:F.value,prefixCls:v.value,hasFeedback:ue,feedbackIcon:ie,showArrow:L.value}),r),ge=ot(e,["prefixCls","suffixIcon","itemIcon","removeIcon","clearIcon","size","bordered","status"]),me=le(Q||J,{[`${v.value}-dropdown-${g.value}`]:g.value==="rtl"},A.value);return E(p(Dz,B(B(B({ref:l,virtual:G,dropdownMatchSelectWidth:q},ge),n),{},{showSearch:(j=e.showSearch)!==null&&j!==void 0?j:(Y=C==null?void 0:C.value)===null||Y===void 0?void 0:Y.showSearch,placeholder:W,listHeight:ee,listItemHeight:U,mode:h.value,prefixCls:v.value,direction:g.value,inputIcon:ce,menuItemSelectedIcon:se,removeIcon:pe,clearIcon:he,notFoundContent:ae,class:[D.value,n.class],getPopupContainer:$==null?void 0:$.value,dropdownClassName:me,onChange:N,onBlur:k,id:V,dropdownRender:ge.dropdownRender||r.dropdownRender,transitionName:_.value,children:(Z=r.default)===null||Z===void 0?void 0:Z.call(r),tagRender:e.tagRender||r.tagRender,optionLabelRender:r.optionLabel,maxTagPlaceholder:e.maxTagPlaceholder||r.maxTagPlaceholder,showArrow:ue||te,disabled:M.value}),{option:r.option}))}}});Cn.install=function(e){return e.component(Cn.name,Cn),e.component(Cn.Option.displayName,Cn.Option),e.component(Cn.OptGroup.displayName,Cn.OptGroup),e};const AK=Cn.Option,RK=Cn.OptGroup,ki=()=>null;ki.isSelectOption=!0;ki.displayName="AAutoCompleteOption";const Na=()=>null;Na.isSelectOptGroup=!0;Na.displayName="AAutoCompleteOptGroup";function DK(e){var t,n;return((t=e==null?void 0:e.type)===null||t===void 0?void 0:t.isSelectOption)||((n=e==null?void 0:e.type)===null||n===void 0?void 0:n.isSelectOptGroup)}const BK=()=>m(m({},ot(gh(),["loading","mode","optionLabelProp","labelInValue"])),{dataSource:Array,dropdownMenuStyle:{type:Object,default:void 0},dropdownMatchSelectWidth:{type:[Number,Boolean],default:!0},prefixCls:String,showSearch:{type:Boolean,default:void 0},transitionName:String,choiceTransitionName:{type:String,default:"zoom"},autofocus:{type:Boolean,default:void 0},backfill:{type:Boolean,default:void 0},filterOption:{type:[Boolean,Function],default:!1},defaultActiveFirstOption:{type:Boolean,default:!0},status:String}),NK=ki,kK=Na,dv=re({compatConfig:{MODE:3},name:"AAutoComplete",inheritAttrs:!1,props:BK(),slots:Object,setup(e,t){let{slots:n,attrs:o,expose:r}=t;Po(!e.dropdownClassName);const i=ne(),l=()=>{var u;const d=wt((u=n.default)===null||u===void 0?void 0:u.call(n));return d.length?d[0]:void 0};r({focus:()=>{var u;(u=i.value)===null||u===void 0||u.focus()},blur:()=>{var u;(u=i.value)===null||u===void 0||u.blur()}});const{prefixCls:c}=Ee("select",e);return()=>{var u,d,f;const{size:h,dataSource:v,notFoundContent:g=(u=n.notFoundContent)===null||u===void 0?void 0:u.call(n)}=e;let b;const{class:y}=o,S={[y]:!!y,[`${c.value}-lg`]:h==="large",[`${c.value}-sm`]:h==="small",[`${c.value}-show-search`]:!0,[`${c.value}-auto-complete`]:!0};if(e.options===void 0){const w=((d=n.dataSource)===null||d===void 0?void 0:d.call(n))||((f=n.options)===null||f===void 0?void 0:f.call(n))||[];w.length&&DK(w[0])?b=w:b=v?v.map(C=>{if(qt(C))return C;switch(typeof C){case"string":return p(ki,{key:C,value:C},{default:()=>[C]});case"object":return p(ki,{key:C.value,value:C.value},{default:()=>[C.text]});default:throw new Error("AutoComplete[dataSource] only supports type `string[] | Object[]`.")}}):[]}const $=ot(m(m(m({},e),o),{mode:Cn.SECRET_COMBOBOX_MODE_DO_NOT_USE,getInputElement:l,notFoundContent:g,class:S,popupClassName:e.popupClassName||e.dropdownClassName,ref:i}),["dataSource","loading"]);return p(Cn,$,B({default:()=>[b]},ot(n,["default","dataSource","options"])))}}}),FK=m(dv,{Option:ki,OptGroup:Na,install(e){return e.component(dv.name,dv),e.component(ki.displayName,ki),e.component(Na.displayName,Na),e}});var LK={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"};function Vx(e){for(var t=1;t({backgroundColor:e,border:`${o.lineWidth}px ${o.lineType} ${t}`,[`${r}-icon`]:{color:n}}),QK=e=>{const{componentCls:t,motionDurationSlow:n,marginXS:o,marginSM:r,fontSize:i,fontSizeLG:l,lineHeight:a,borderRadiusLG:s,motionEaseInOutCirc:c,alertIconSizeLG:u,colorText:d,paddingContentVerticalSM:f,alertPaddingHorizontal:h,paddingMD:v,paddingContentHorizontalLG:g}=e;return{[t]:m(m({},qe(e)),{position:"relative",display:"flex",alignItems:"center",padding:`${f}px ${h}px`,wordWrap:"break-word",borderRadius:s,[`&${t}-rtl`]:{direction:"rtl"},[`${t}-content`]:{flex:1,minWidth:0},[`${t}-icon`]:{marginInlineEnd:o,lineHeight:0},"&-description":{display:"none",fontSize:i,lineHeight:a},"&-message":{color:d},[`&${t}-motion-leave`]:{overflow:"hidden",opacity:1,transition:`max-height ${n} ${c}, opacity ${n} ${c}, + padding-top ${n} ${c}, padding-bottom ${n} ${c}, + margin-bottom ${n} ${c}`},[`&${t}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),[`${t}-with-description`]:{alignItems:"flex-start",paddingInline:g,paddingBlock:v,[`${t}-icon`]:{marginInlineEnd:r,fontSize:u,lineHeight:0},[`${t}-message`]:{display:"block",marginBottom:o,color:d,fontSize:l},[`${t}-description`]:{display:"block"}},[`${t}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}},eG=e=>{const{componentCls:t,colorSuccess:n,colorSuccessBorder:o,colorSuccessBg:r,colorWarning:i,colorWarningBorder:l,colorWarningBg:a,colorError:s,colorErrorBorder:c,colorErrorBg:u,colorInfo:d,colorInfoBorder:f,colorInfoBg:h}=e;return{[t]:{"&-success":Vu(r,o,n,e,t),"&-info":Vu(h,f,d,e,t),"&-warning":Vu(a,l,i,e,t),"&-error":m(m({},Vu(u,c,s,e,t)),{[`${t}-description > pre`]:{margin:0,padding:0}})}}},tG=e=>{const{componentCls:t,iconCls:n,motionDurationMid:o,marginXS:r,fontSizeIcon:i,colorIcon:l,colorIconHover:a}=e;return{[t]:{"&-action":{marginInlineStart:r},[`${t}-close-icon`]:{marginInlineStart:r,padding:0,overflow:"hidden",fontSize:i,lineHeight:`${i}px`,backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",[`${n}-close`]:{color:l,transition:`color ${o}`,"&:hover":{color:a}}},"&-close-text":{color:l,transition:`color ${o}`,"&:hover":{color:a}}}}},nG=e=>[QK(e),eG(e),tG(e)],oG=Ue("Alert",e=>{const{fontSizeHeading3:t}=e,n=ze(e,{alertIconSizeLG:t,alertPaddingHorizontal:12});return[nG(n)]}),rG={success:pr,info:qi,error:Wn,warning:hr},iG={success:vh,info:bh,error:yh,warning:mh},lG=Mn("success","info","warning","error"),aG=()=>({type:K.oneOf(lG),closable:{type:Boolean,default:void 0},closeText:K.any,message:K.any,description:K.any,afterClose:Function,showIcon:{type:Boolean,default:void 0},prefixCls:String,banner:{type:Boolean,default:void 0},icon:K.any,closeIcon:K.any,onClose:Function}),sG=re({compatConfig:{MODE:3},name:"AAlert",inheritAttrs:!1,props:aG(),setup(e,t){let{slots:n,emit:o,attrs:r,expose:i}=t;const{prefixCls:l,direction:a}=Ee("alert",e),[s,c]=oG(l),u=oe(!1),d=oe(!1),f=oe(),h=y=>{y.preventDefault();const S=f.value;S.style.height=`${S.offsetHeight}px`,S.style.height=`${S.offsetHeight}px`,u.value=!0,o("close",y)},v=()=>{var y;u.value=!1,d.value=!0,(y=e.afterClose)===null||y===void 0||y.call(e)},g=P(()=>{const{type:y}=e;return y!==void 0?y:e.banner?"warning":"info"});i({animationEnd:v});const b=oe({});return()=>{var y,S,$,w,C,O,x,I,T,M;const{banner:E,closeIcon:A=(y=n.closeIcon)===null||y===void 0?void 0:y.call(n)}=e;let{closable:R,showIcon:z}=e;const _=(S=e.closeText)!==null&&S!==void 0?S:($=n.closeText)===null||$===void 0?void 0:$.call(n),D=(w=e.description)!==null&&w!==void 0?w:(C=n.description)===null||C===void 0?void 0:C.call(n),N=(O=e.message)!==null&&O!==void 0?O:(x=n.message)===null||x===void 0?void 0:x.call(n),k=(I=e.icon)!==null&&I!==void 0?I:(T=n.icon)===null||T===void 0?void 0:T.call(n),F=(M=n.action)===null||M===void 0?void 0:M.call(n);z=E&&z===void 0?!0:z;const L=(D?iG:rG)[g.value]||null;_&&(R=!0);const H=l.value,j=le(H,{[`${H}-${g.value}`]:!0,[`${H}-closing`]:u.value,[`${H}-with-description`]:!!D,[`${H}-no-icon`]:!z,[`${H}-banner`]:!!E,[`${H}-closable`]:R,[`${H}-rtl`]:a.value==="rtl",[c.value]:!0}),Y=R?p("button",{type:"button",onClick:h,class:`${H}-close-icon`,tabindex:0},[_?p("span",{class:`${H}-close-text`},[_]):A===void 0?p(Vn,null,null):A]):null,Z=k&&(qt(k)?pt(k,{class:`${H}-icon`}):p("span",{class:`${H}-icon`},[k]))||p(L,{class:`${H}-icon`},null),X=Go(`${H}-motion`,{appear:!1,css:!0,onAfterLeave:v,onBeforeLeave:ee=>{ee.style.maxHeight=`${ee.offsetHeight}px`},onLeave:ee=>{ee.style.maxHeight="0px"}});return s(d.value?null:p(bn,X,{default:()=>[Ln(p("div",B(B({role:"alert"},r),{},{style:[r.style,b.value],class:[r.class,j],"data-show":!u.value,ref:f}),[z?Z:null,p("div",{class:`${H}-content`},[N?p("div",{class:`${H}-message`},[N]):null,D?p("div",{class:`${H}-description`},[D]):null]),F?p("div",{class:`${H}-action`},[F]):null,Y]),[[Qn,!u.value]])]}))}}}),cG=Bt(sG),qr=["xxxl","xxl","xl","lg","md","sm","xs"],uG=e=>({xs:`(max-width: ${e.screenXSMax}px)`,sm:`(min-width: ${e.screenSM}px)`,md:`(min-width: ${e.screenMD}px)`,lg:`(min-width: ${e.screenLG}px)`,xl:`(min-width: ${e.screenXL}px)`,xxl:`(min-width: ${e.screenXXL}px)`,xxxl:`{min-width: ${e.screenXXXL}px}`});function ky(){const[,e]=si();return P(()=>{const t=uG(e.value),n=new Map;let o=-1,r={};return{matchHandlers:{},dispatch(i){return r=i,n.forEach(l=>l(r)),n.size>=1},subscribe(i){return n.size||this.register(),o+=1,n.set(o,i),i(r),o},unsubscribe(i){n.delete(i),n.size||this.unregister()},unregister(){Object.keys(t).forEach(i=>{const l=t[i],a=this.matchHandlers[l];a==null||a.mql.removeListener(a==null?void 0:a.listener)}),n.clear()},register(){Object.keys(t).forEach(i=>{const l=t[i],a=c=>{let{matches:u}=c;this.dispatch(m(m({},r),{[i]:u}))},s=window.matchMedia(l);s.addListener(a),this.matchHandlers[l]={mql:s,listener:a},a(s)})},responsiveMap:t}})}function ps(){const e=oe({});let t=null;const n=ky();return Ke(()=>{t=n.value.subscribe(o=>{e.value=o})}),wn(()=>{n.value.unsubscribe(t)}),e}function $o(e){const t=oe();return Ve(()=>{t.value=e()},{flush:"sync"}),t}const dG=e=>{const{antCls:t,componentCls:n,iconCls:o,avatarBg:r,avatarColor:i,containerSize:l,containerSizeLG:a,containerSizeSM:s,textFontSize:c,textFontSizeLG:u,textFontSizeSM:d,borderRadius:f,borderRadiusLG:h,borderRadiusSM:v,lineWidth:g,lineType:b}=e,y=(S,$,w)=>({width:S,height:S,lineHeight:`${S-g*2}px`,borderRadius:"50%",[`&${n}-square`]:{borderRadius:w},[`${n}-string`]:{position:"absolute",left:{_skip_check_:!0,value:"50%"},transformOrigin:"0 center"},[`&${n}-icon`]:{fontSize:$,[`> ${o}`]:{margin:0}}});return{[n]:m(m(m(m({},qe(e)),{position:"relative",display:"inline-block",overflow:"hidden",color:i,whiteSpace:"nowrap",textAlign:"center",verticalAlign:"middle",background:r,border:`${g}px ${b} transparent`,"&-image":{background:"transparent"},[`${t}-image-img`]:{display:"block"}}),y(l,c,f)),{"&-lg":m({},y(a,u,h)),"&-sm":m({},y(s,d,v)),"> img":{display:"block",width:"100%",height:"100%",objectFit:"cover"}})}},fG=e=>{const{componentCls:t,groupBorderColor:n,groupOverlapping:o,groupSpace:r}=e;return{[`${t}-group`]:{display:"inline-flex",[`${t}`]:{borderColor:n},"> *:not(:first-child)":{marginInlineStart:o}},[`${t}-group-popover`]:{[`${t} + ${t}`]:{marginInlineStart:r}}}},F5=Ue("Avatar",e=>{const{colorTextLightSolid:t,colorTextPlaceholder:n}=e,o=ze(e,{avatarBg:n,avatarColor:t});return[dG(o),fG(o)]},e=>{const{controlHeight:t,controlHeightLG:n,controlHeightSM:o,fontSize:r,fontSizeLG:i,fontSizeXL:l,fontSizeHeading3:a,marginXS:s,marginXXS:c,colorBorderBg:u}=e;return{containerSize:t,containerSizeLG:n,containerSizeSM:o,textFontSize:Math.round((i+l)/2),textFontSizeLG:a,textFontSizeSM:r,groupSpace:c,groupOverlapping:-s,groupBorderColor:u}}),L5=Symbol("AvatarContextKey"),pG=()=>Ge(L5,{}),hG=e=>Ye(L5,e),gG=()=>({prefixCls:String,shape:{type:String,default:"circle"},size:{type:[Number,String,Object],default:()=>"default"},src:String,srcset:String,icon:K.any,alt:String,gap:Number,draggable:{type:Boolean,default:void 0},crossOrigin:String,loadError:{type:Function}}),Il=re({compatConfig:{MODE:3},name:"AAvatar",inheritAttrs:!1,props:gG(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const r=oe(!0),i=oe(!1),l=oe(1),a=oe(null),s=oe(null),{prefixCls:c}=Ee("avatar",e),[u,d]=F5(c),f=pG(),h=P(()=>e.size==="default"?f.size:e.size),v=ps(),g=$o(()=>{if(typeof e.size!="object")return;const $=qr.find(C=>v.value[C]);return e.size[$]}),b=$=>g.value?{width:`${g.value}px`,height:`${g.value}px`,lineHeight:`${g.value}px`,fontSize:`${$?g.value/2:18}px`}:{},y=()=>{if(!a.value||!s.value)return;const $=a.value.offsetWidth,w=s.value.offsetWidth;if($!==0&&w!==0){const{gap:C=4}=e;C*2{const{loadError:$}=e;($==null?void 0:$())!==!1&&(r.value=!1)};return ye(()=>e.src,()=>{rt(()=>{r.value=!0,l.value=1})}),ye(()=>e.gap,()=>{rt(()=>{y()})}),Ke(()=>{rt(()=>{y(),i.value=!0})}),()=>{var $,w;const{shape:C,src:O,alt:x,srcset:I,draggable:T,crossOrigin:M}=e,E=($=f.shape)!==null&&$!==void 0?$:C,A=ln(n,e,"icon"),R=c.value,z={[`${o.class}`]:!!o.class,[R]:!0,[`${R}-lg`]:h.value==="large",[`${R}-sm`]:h.value==="small",[`${R}-${E}`]:!0,[`${R}-image`]:O&&r.value,[`${R}-icon`]:A,[d.value]:!0},_=typeof h.value=="number"?{width:`${h.value}px`,height:`${h.value}px`,lineHeight:`${h.value}px`,fontSize:A?`${h.value/2}px`:"18px"}:{},D=(w=n.default)===null||w===void 0?void 0:w.call(n);let N;if(O&&r.value)N=p("img",{draggable:T,src:O,srcset:I,onError:S,alt:x,crossorigin:M},null);else if(A)N=A;else if(i.value||l.value!==1){const k=`scale(${l.value}) translateX(-50%)`,F={msTransform:k,WebkitTransform:k,transform:k},L=typeof h.value=="number"?{lineHeight:`${h.value}px`}:{};N=p(Vo,{onResize:y},{default:()=>[p("span",{class:`${R}-string`,ref:a,style:m(m({},L),F)},[D])]})}else N=p("span",{class:`${R}-string`,ref:a,style:{opacity:0}},[D]);return u(p("span",B(B({},o),{},{ref:s,class:z,style:[_,b(!!A),o.style]}),[N]))}}}),Do={adjustX:1,adjustY:1},Bo=[0,0],z5={left:{points:["cr","cl"],overflow:Do,offset:[-4,0],targetOffset:Bo},right:{points:["cl","cr"],overflow:Do,offset:[4,0],targetOffset:Bo},top:{points:["bc","tc"],overflow:Do,offset:[0,-4],targetOffset:Bo},bottom:{points:["tc","bc"],overflow:Do,offset:[0,4],targetOffset:Bo},topLeft:{points:["bl","tl"],overflow:Do,offset:[0,-4],targetOffset:Bo},leftTop:{points:["tr","tl"],overflow:Do,offset:[-4,0],targetOffset:Bo},topRight:{points:["br","tr"],overflow:Do,offset:[0,-4],targetOffset:Bo},rightTop:{points:["tl","tr"],overflow:Do,offset:[4,0],targetOffset:Bo},bottomRight:{points:["tr","br"],overflow:Do,offset:[0,4],targetOffset:Bo},rightBottom:{points:["bl","br"],overflow:Do,offset:[4,0],targetOffset:Bo},bottomLeft:{points:["tl","bl"],overflow:Do,offset:[0,4],targetOffset:Bo},leftBottom:{points:["br","bl"],overflow:Do,offset:[-4,0],targetOffset:Bo}},vG={prefixCls:String,id:String,overlayInnerStyle:K.any},mG=re({compatConfig:{MODE:3},name:"TooltipContent",props:vG,setup(e,t){let{slots:n}=t;return()=>{var o;return p("div",{class:`${e.prefixCls}-inner`,id:e.id,role:"tooltip",style:e.overlayInnerStyle},[(o=n.overlay)===null||o===void 0?void 0:o.call(n)])}}});var bG=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{}),overlayStyle:{type:Object,default:void 0},overlayClassName:String,prefixCls:K.string.def("rc-tooltip"),mouseEnterDelay:K.number.def(.1),mouseLeaveDelay:K.number.def(.1),getPopupContainer:Function,destroyTooltipOnHide:{type:Boolean,default:!1},align:K.object.def(()=>({})),arrowContent:K.any.def(null),tipId:String,builtinPlacements:K.object,overlayInnerStyle:{type:Object,default:void 0},popupVisible:{type:Boolean,default:void 0},onVisibleChange:Function,onPopupAlign:Function,arrow:{type:Boolean,default:!0}},setup(e,t){let{slots:n,attrs:o,expose:r}=t;const i=oe(),l=()=>{const{prefixCls:u,tipId:d,overlayInnerStyle:f}=e;return[e.arrow?p("div",{class:`${u}-arrow`,key:"arrow"},[ln(n,e,"arrowContent")]):null,p(mG,{key:"content",prefixCls:u,id:d,overlayInnerStyle:f},{overlay:n.overlay})]};r({getPopupDomNode:()=>i.value.getPopupDomNode(),triggerDOM:i,forcePopupAlign:()=>{var u;return(u=i.value)===null||u===void 0?void 0:u.forcePopupAlign()}});const s=oe(!1),c=oe(!1);return Ve(()=>{const{destroyTooltipOnHide:u}=e;if(typeof u=="boolean")s.value=u;else if(u&&typeof u=="object"){const{keepParent:d}=u;s.value=d===!0,c.value=d===!1}}),()=>{const{overlayClassName:u,trigger:d,mouseEnterDelay:f,mouseLeaveDelay:h,overlayStyle:v,prefixCls:g,afterVisibleChange:b,transitionName:y,animation:S,placement:$,align:w,destroyTooltipOnHide:C,defaultVisible:O}=e,x=bG(e,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible"]),I=m({},x);e.visible!==void 0&&(I.popupVisible=e.visible);const T=m(m(m({popupClassName:u,prefixCls:g,action:d,builtinPlacements:z5,popupPlacement:$,popupAlign:w,afterPopupVisibleChange:b,popupTransitionName:y,popupAnimation:S,defaultPopupVisible:O,destroyPopupOnHide:s.value,autoDestroy:c.value,mouseLeaveDelay:h,popupStyle:v,mouseEnterDelay:f},I),o),{onPopupVisibleChange:e.onVisibleChange||qx,onPopupAlign:e.onPopupAlign||qx,ref:i,arrow:!!e.arrow,popup:l()});return p(ql,T,{default:n.default})}}}),Fy=()=>({trigger:[String,Array],open:{type:Boolean,default:void 0},visible:{type:Boolean,default:void 0},placement:String,color:String,transitionName:String,overlayStyle:Be(),overlayInnerStyle:Be(),overlayClassName:String,openClassName:String,prefixCls:String,mouseEnterDelay:Number,mouseLeaveDelay:Number,getPopupContainer:Function,arrowPointAtCenter:{type:Boolean,default:void 0},arrow:{type:[Boolean,Object],default:!0},autoAdjustOverflow:{type:[Boolean,Object],default:void 0},destroyTooltipOnHide:{type:Boolean,default:void 0},align:Be(),builtinPlacements:Be(),children:Array,onVisibleChange:Function,"onUpdate:visible":Function,onOpenChange:Function,"onUpdate:open":Function}),SG={adjustX:1,adjustY:1},Jx={adjustX:0,adjustY:0},$G=[0,0];function Zx(e){return typeof e=="boolean"?e?SG:Jx:m(m({},Jx),e)}function Ly(e){const{arrowWidth:t=4,horizontalArrowShift:n=16,verticalArrowShift:o=8,autoAdjustOverflow:r,arrowPointAtCenter:i}=e,l={left:{points:["cr","cl"],offset:[-4,0]},right:{points:["cl","cr"],offset:[4,0]},top:{points:["bc","tc"],offset:[0,-4]},bottom:{points:["tc","bc"],offset:[0,4]},topLeft:{points:["bl","tc"],offset:[-(n+t),-4]},leftTop:{points:["tr","cl"],offset:[-4,-(o+t)]},topRight:{points:["br","tc"],offset:[n+t,-4]},rightTop:{points:["tl","cr"],offset:[4,-(o+t)]},bottomRight:{points:["tr","bc"],offset:[n+t,4]},rightBottom:{points:["bl","cr"],offset:[4,o+t]},bottomLeft:{points:["tl","bc"],offset:[-(n+t),4]},leftBottom:{points:["br","cl"],offset:[-4,o+t]}};return Object.keys(l).forEach(a=>{l[a]=i?m(m({},l[a]),{overflow:Zx(r),targetOffset:$G}):m(m({},z5[a]),{overflow:Zx(r)}),l[a].ignoreShake=!0}),l}function zf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];for(let t=0,n=e.length;t`${e}-inverse`),xG=["success","processing","error","default","warning"];function Sh(e){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[...CG,...Pc].includes(e):Pc.includes(e)}function wG(e){return xG.includes(e)}function OG(e,t){const n=Sh(t),o=le({[`${e}-${t}`]:t&&n}),r={},i={};return t&&!n&&(r.background=t,i["--antd-arrow-background-color"]=t),{className:o,overlayStyle:r,arrowStyle:i}}function Wu(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return e.map(n=>`${t}${n}`).join(",")}const zy=8;function H5(e){const t=zy,{sizePopupArrow:n,contentRadius:o,borderRadiusOuter:r,limitVerticalRadius:i}=e,l=n/2-Math.ceil(r*(Math.sqrt(2)-1)),a=(o>12?o+2:12)-l,s=i?t-l:a;return{dropdownArrowOffset:a,dropdownArrowOffsetVertical:s}}function Hy(e,t){const{componentCls:n,sizePopupArrow:o,marginXXS:r,borderRadiusXS:i,borderRadiusOuter:l,boxShadowPopoverArrow:a}=e,{colorBg:s,showArrowCls:c,contentRadius:u=e.borderRadiusLG,limitVerticalRadius:d}=t,{dropdownArrowOffsetVertical:f,dropdownArrowOffset:h}=H5({sizePopupArrow:o,contentRadius:u,borderRadiusOuter:l,limitVerticalRadius:d}),v=o/2+r;return{[n]:{[`${n}-arrow`]:[m(m({position:"absolute",zIndex:1,display:"block"},Lb(o,i,l,s,a)),{"&:before":{background:s}})],[[`&-placement-top ${n}-arrow`,`&-placement-topLeft ${n}-arrow`,`&-placement-topRight ${n}-arrow`].join(",")]:{bottom:0,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top ${n}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},[`&-placement-topLeft ${n}-arrow`]:{left:{_skip_check_:!0,value:h}},[`&-placement-topRight ${n}-arrow`]:{right:{_skip_check_:!0,value:h}},[[`&-placement-bottom ${n}-arrow`,`&-placement-bottomLeft ${n}-arrow`,`&-placement-bottomRight ${n}-arrow`].join(",")]:{top:0,transform:"translateY(-100%)"},[`&-placement-bottom ${n}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},[`&-placement-bottomLeft ${n}-arrow`]:{left:{_skip_check_:!0,value:h}},[`&-placement-bottomRight ${n}-arrow`]:{right:{_skip_check_:!0,value:h}},[[`&-placement-left ${n}-arrow`,`&-placement-leftTop ${n}-arrow`,`&-placement-leftBottom ${n}-arrow`].join(",")]:{right:{_skip_check_:!0,value:0},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left ${n}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop ${n}-arrow`]:{top:f},[`&-placement-leftBottom ${n}-arrow`]:{bottom:f},[[`&-placement-right ${n}-arrow`,`&-placement-rightTop ${n}-arrow`,`&-placement-rightBottom ${n}-arrow`].join(",")]:{left:{_skip_check_:!0,value:0},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right ${n}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop ${n}-arrow`]:{top:f},[`&-placement-rightBottom ${n}-arrow`]:{bottom:f},[Wu(["&-placement-topLeft","&-placement-top","&-placement-topRight"].map(g=>g+=":not(&-arrow-hidden)"),c)]:{paddingBottom:v},[Wu(["&-placement-bottomLeft","&-placement-bottom","&-placement-bottomRight"].map(g=>g+=":not(&-arrow-hidden)"),c)]:{paddingTop:v},[Wu(["&-placement-leftTop","&-placement-left","&-placement-leftBottom"].map(g=>g+=":not(&-arrow-hidden)"),c)]:{paddingRight:{_skip_check_:!0,value:v}},[Wu(["&-placement-rightTop","&-placement-right","&-placement-rightBottom"].map(g=>g+=":not(&-arrow-hidden)"),c)]:{paddingLeft:{_skip_check_:!0,value:v}}}}}const PG=e=>{const{componentCls:t,tooltipMaxWidth:n,tooltipColor:o,tooltipBg:r,tooltipBorderRadius:i,zIndexPopup:l,controlHeight:a,boxShadowSecondary:s,paddingSM:c,paddingXS:u,tooltipRadiusOuter:d}=e;return[{[t]:m(m(m(m({},qe(e)),{position:"absolute",zIndex:l,display:"block","&":[{width:"max-content"},{width:"intrinsic"}],maxWidth:n,visibility:"visible","&-hidden":{display:"none"},"--antd-arrow-background-color":r,[`${t}-inner`]:{minWidth:a,minHeight:a,padding:`${c/2}px ${u}px`,color:o,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:r,borderRadius:i,boxShadow:s},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${t}-inner`]:{borderRadius:Math.min(i,zy)}},[`${t}-content`]:{position:"relative"}}),Pf(e,(f,h)=>{let{darkColor:v}=h;return{[`&${t}-${f}`]:{[`${t}-inner`]:{backgroundColor:v},[`${t}-arrow`]:{"--antd-arrow-background-color":v}}}})),{"&-rtl":{direction:"rtl"}})},Hy(ze(e,{borderRadiusOuter:d}),{colorBg:"var(--antd-arrow-background-color)",showArrowCls:"",contentRadius:i,limitVerticalRadius:!0}),{[`${t}-pure`]:{position:"relative",maxWidth:"none"}}]},IG=(e,t)=>Ue("Tooltip",o=>{if((t==null?void 0:t.value)===!1)return[];const{borderRadius:r,colorTextLightSolid:i,colorBgDefault:l,borderRadiusOuter:a}=o,s=ze(o,{tooltipMaxWidth:250,tooltipColor:i,tooltipBorderRadius:r,tooltipBg:l,tooltipRadiusOuter:a>4?4:a});return[PG(s),ds(o,"zoom-big-fast")]},o=>{let{zIndexPopupBase:r,colorBgSpotlight:i}=o;return{zIndexPopup:r+70,colorBgDefault:i}})(e),TG=(e,t)=>{const n={},o=m({},e);return t.forEach(r=>{e&&r in e&&(n[r]=e[r],delete o[r])}),{picked:n,omitted:o}},j5=()=>m(m({},Fy()),{title:K.any}),V5=()=>({trigger:"hover",align:{},placement:"top",mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0}),EG=re({compatConfig:{MODE:3},name:"ATooltip",inheritAttrs:!1,props:Qe(j5(),{trigger:"hover",align:{},placement:"top",mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0}),slots:Object,setup(e,t){let{slots:n,emit:o,attrs:r,expose:i}=t;const{prefixCls:l,getPopupContainer:a,direction:s,rootPrefixCls:c}=Ee("tooltip",e),u=P(()=>{var M;return(M=e.open)!==null&&M!==void 0?M:e.visible}),d=ne(zf([e.open,e.visible])),f=ne();let h;ye(u,M=>{Ze.cancel(h),h=Ze(()=>{d.value=!!M})});const v=()=>{var M;const E=(M=e.title)!==null&&M!==void 0?M:n.title;return!E&&E!==0},g=M=>{const E=v();u.value===void 0&&(d.value=E?!1:M),E||(o("update:visible",M),o("visibleChange",M),o("update:open",M),o("openChange",M))};i({getPopupDomNode:()=>f.value.getPopupDomNode(),open:d,forcePopupAlign:()=>{var M;return(M=f.value)===null||M===void 0?void 0:M.forcePopupAlign()}});const y=P(()=>{var M;const{builtinPlacements:E,autoAdjustOverflow:A,arrow:R,arrowPointAtCenter:z}=e;let _=z;return typeof R=="object"&&(_=(M=R.pointAtCenter)!==null&&M!==void 0?M:z),E||Ly({arrowPointAtCenter:_,autoAdjustOverflow:A})}),S=M=>M||M==="",$=M=>{const E=M.type;if(typeof E=="object"&&M.props&&((E.__ANT_BUTTON===!0||E==="button")&&S(M.props.disabled)||E.__ANT_SWITCH===!0&&(S(M.props.disabled)||S(M.props.loading))||E.__ANT_RADIO===!0&&S(M.props.disabled))){const{picked:A,omitted:R}=TG(SO(M),["position","left","right","top","bottom","float","display","zIndex"]),z=m(m({display:"inline-block"},A),{cursor:"not-allowed",lineHeight:1,width:M.props&&M.props.block?"100%":void 0}),_=m(m({},R),{pointerEvents:"none"}),D=pt(M,{style:_},!0);return p("span",{style:z,class:`${l.value}-disabled-compatible-wrapper`},[D])}return M},w=()=>{var M,E;return(M=e.title)!==null&&M!==void 0?M:(E=n.title)===null||E===void 0?void 0:E.call(n)},C=(M,E)=>{const A=y.value,R=Object.keys(A).find(z=>{var _,D;return A[z].points[0]===((_=E.points)===null||_===void 0?void 0:_[0])&&A[z].points[1]===((D=E.points)===null||D===void 0?void 0:D[1])});if(R){const z=M.getBoundingClientRect(),_={top:"50%",left:"50%"};R.indexOf("top")>=0||R.indexOf("Bottom")>=0?_.top=`${z.height-E.offset[1]}px`:(R.indexOf("Top")>=0||R.indexOf("bottom")>=0)&&(_.top=`${-E.offset[1]}px`),R.indexOf("left")>=0||R.indexOf("Right")>=0?_.left=`${z.width-E.offset[0]}px`:(R.indexOf("right")>=0||R.indexOf("Left")>=0)&&(_.left=`${-E.offset[0]}px`),M.style.transformOrigin=`${_.left} ${_.top}`}},O=P(()=>OG(l.value,e.color)),x=P(()=>r["data-popover-inject"]),[I,T]=IG(l,P(()=>!x.value));return()=>{var M,E;const{openClassName:A,overlayClassName:R,overlayStyle:z,overlayInnerStyle:_}=e;let D=(E=kt((M=n.default)===null||M===void 0?void 0:M.call(n)))!==null&&E!==void 0?E:null;D=D.length===1?D[0]:D;let N=d.value;if(u.value===void 0&&v()&&(N=!1),!D)return null;const k=$(qt(D)&&!_R(D)?D:p("span",null,[D])),F=le({[A||`${l.value}-open`]:!0,[k.props&&k.props.class]:k.props&&k.props.class}),L=le(R,{[`${l.value}-rtl`]:s.value==="rtl"},O.value.className,T.value),H=m(m({},O.value.overlayStyle),_),j=O.value.arrowStyle,Y=m(m(m({},r),e),{prefixCls:l.value,arrow:!!e.arrow,getPopupContainer:a==null?void 0:a.value,builtinPlacements:y.value,visible:N,ref:f,overlayClassName:L,overlayStyle:m(m({},j),z),overlayInnerStyle:H,onVisibleChange:g,onPopupAlign:C,transitionName:Hn(c.value,"zoom-big-fast",e.transitionName)});return I(p(yG,Y,{default:()=>[d.value?pt(k,{class:F}):k],arrowContent:()=>p("span",{class:`${l.value}-arrow-content`},null),overlay:w}))}}}),co=Bt(EG),_G=e=>{const{componentCls:t,popoverBg:n,popoverColor:o,width:r,fontWeightStrong:i,popoverPadding:l,boxShadowSecondary:a,colorTextHeading:s,borderRadiusLG:c,zIndexPopup:u,marginXS:d,colorBgElevated:f}=e;return[{[t]:m(m({},qe(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:u,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--antd-arrow-background-color":f,"&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:n,backgroundClip:"padding-box",borderRadius:c,boxShadow:a,padding:l},[`${t}-title`]:{minWidth:r,marginBottom:d,color:s,fontWeight:i},[`${t}-inner-content`]:{color:o}})},Hy(e,{colorBg:"var(--antd-arrow-background-color)"}),{[`${t}-pure`]:{position:"relative",maxWidth:"none",[`${t}-content`]:{display:"inline-block"}}}]},MG=e=>{const{componentCls:t}=e;return{[t]:Pc.map(n=>{const o=e[`${n}-6`];return{[`&${t}-${n}`]:{"--antd-arrow-background-color":o,[`${t}-inner`]:{backgroundColor:o},[`${t}-arrow`]:{background:"transparent"}}}})}},AG=e=>{const{componentCls:t,lineWidth:n,lineType:o,colorSplit:r,paddingSM:i,controlHeight:l,fontSize:a,lineHeight:s,padding:c}=e,u=l-Math.round(a*s),d=u/2,f=u/2-n,h=c;return{[t]:{[`${t}-inner`]:{padding:0},[`${t}-title`]:{margin:0,padding:`${d}px ${h}px ${f}px`,borderBottom:`${n}px ${o} ${r}`},[`${t}-inner-content`]:{padding:`${i}px ${h}px`}}}},RG=Ue("Popover",e=>{const{colorBgElevated:t,colorText:n,wireframe:o}=e,r=ze(e,{popoverBg:t,popoverColor:n,popoverPadding:12});return[_G(r),MG(r),o&&AG(r),ds(r,"zoom-big")]},e=>{let{zIndexPopupBase:t}=e;return{zIndexPopup:t+30,width:177}}),DG=()=>m(m({},Fy()),{content:It(),title:It()}),BG=re({compatConfig:{MODE:3},name:"APopover",inheritAttrs:!1,props:Qe(DG(),m(m({},V5()),{trigger:"hover",placement:"top",mouseEnterDelay:.1,mouseLeaveDelay:.1})),setup(e,t){let{expose:n,slots:o,attrs:r}=t;const i=ne();Po(e.visible===void 0),n({getPopupDomNode:()=>{var f,h;return(h=(f=i.value)===null||f===void 0?void 0:f.getPopupDomNode)===null||h===void 0?void 0:h.call(f)}});const{prefixCls:l,configProvider:a}=Ee("popover",e),[s,c]=RG(l),u=P(()=>a.getPrefixCls()),d=()=>{var f,h;const{title:v=kt((f=o.title)===null||f===void 0?void 0:f.call(o)),content:g=kt((h=o.content)===null||h===void 0?void 0:h.call(o))}=e,b=!!(Array.isArray(v)?v.length:v),y=!!(Array.isArray(g)?g.length:v);return!b&&!y?null:p(Le,null,[b&&p("div",{class:`${l.value}-title`},[v]),p("div",{class:`${l.value}-inner-content`},[g])])};return()=>{const f=le(e.overlayClassName,c.value);return s(p(co,B(B(B({},ot(e,["title","content"])),r),{},{prefixCls:l.value,ref:i,overlayClassName:f,transitionName:Hn(u.value,"zoom-big",e.transitionName),"data-popover-inject":!0}),{title:d,default:o.default}))}}}),jy=Bt(BG),NG=()=>({prefixCls:String,maxCount:Number,maxStyle:{type:Object,default:void 0},maxPopoverPlacement:{type:String,default:"top"},maxPopoverTrigger:String,size:{type:[Number,String,Object],default:"default"},shape:{type:String,default:"circle"}}),Hf=re({compatConfig:{MODE:3},name:"AAvatarGroup",inheritAttrs:!1,props:NG(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("avatar",e),l=P(()=>`${r.value}-group`),[a,s]=F5(r);return Ve(()=>{const c={size:e.size,shape:e.shape};hG(c)}),()=>{const{maxPopoverPlacement:c="top",maxCount:u,maxStyle:d,maxPopoverTrigger:f="hover",shape:h}=e,v={[l.value]:!0,[`${l.value}-rtl`]:i.value==="rtl",[`${o.class}`]:!!o.class,[s.value]:!0},g=ln(n,e),b=wt(g).map((S,$)=>pt(S,{key:`avatar-key-${$}`})),y=b.length;if(u&&u[p(Il,{style:d,shape:h},{default:()=>[`+${y-u}`]})]})),a(p("div",B(B({},o),{},{class:v,style:o.style}),[S]))}return a(p("div",B(B({},o),{},{class:v,style:o.style}),[b]))}}});Il.Group=Hf;Il.install=function(e){return e.component(Il.name,Il),e.component(Hf.name,Hf),e};function Qx(e){let{prefixCls:t,value:n,current:o,offset:r=0}=e,i;return r&&(i={position:"absolute",top:`${r}00%`,left:0}),p("p",{style:i,class:le(`${t}-only-unit`,{current:o})},[n])}function kG(e,t,n){let o=e,r=0;for(;(o+10)%10!==t;)o+=n,r+=n;return r}const FG=re({compatConfig:{MODE:3},name:"SingleNumber",props:{prefixCls:String,value:String,count:Number},setup(e){const t=P(()=>Number(e.value)),n=P(()=>Math.abs(e.count)),o=ft({prevValue:t.value,prevCount:n.value}),r=()=>{o.prevValue=t.value,o.prevCount=n.value},i=ne();return ye(t,()=>{clearTimeout(i.value),i.value=setTimeout(()=>{r()},1e3)},{flush:"post"}),wn(()=>{clearTimeout(i.value)}),()=>{let l,a={};const s=t.value;if(o.prevValue===s||Number.isNaN(s)||Number.isNaN(o.prevValue))l=[Qx(m(m({},e),{current:!0}))],a={transition:"none"};else{l=[];const c=s+10,u=[];for(let h=s;h<=c;h+=1)u.push(h);const d=u.findIndex(h=>h%10===o.prevValue);l=u.map((h,v)=>{const g=h%10;return Qx(m(m({},e),{value:g,offset:v-d,current:v===d}))});const f=o.prevCountr()},[l])}}});var LG=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{var i;const l=m(m({},e),n),{prefixCls:a,count:s,title:c,show:u,component:d="sup",class:f,style:h}=l,v=LG(l,["prefixCls","count","title","show","component","class","style"]),g=m(m({},v),{style:h,"data-show":e.show,class:le(r.value,f),title:c});let b=s;if(s&&Number(s)%1===0){const S=String(s).split("");b=S.map(($,w)=>p(FG,{prefixCls:r.value,count:Number(s),value:$,key:S.length-w},null))}h&&h.borderColor&&(g.style=m(m({},h),{boxShadow:`0 0 0 1px ${h.borderColor} inset`}));const y=kt((i=o.default)===null||i===void 0?void 0:i.call(o));return y&&y.length?pt(y,{class:le(`${r.value}-custom-component`)},!1):p(d,g,{default:()=>[b]})}}}),jG=new it("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),VG=new it("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),WG=new it("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),KG=new it("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),GG=new it("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),UG=new it("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),XG=e=>{const{componentCls:t,iconCls:n,antCls:o,badgeFontHeight:r,badgeShadowSize:i,badgeHeightSm:l,motionDurationSlow:a,badgeStatusSize:s,marginXS:c,badgeRibbonOffset:u}=e,d=`${o}-scroll-number`,f=`${o}-ribbon`,h=`${o}-ribbon-wrapper`,v=Pf(e,(b,y)=>{let{darkColor:S}=y;return{[`&${t} ${t}-color-${b}`]:{background:S,[`&:not(${t}-count)`]:{color:S}}}}),g=Pf(e,(b,y)=>{let{darkColor:S}=y;return{[`&${f}-color-${b}`]:{background:S,color:S}}});return{[t]:m(m(m(m({},qe(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${t}-count`]:{zIndex:e.badgeZIndex,minWidth:e.badgeHeight,height:e.badgeHeight,color:e.badgeTextColor,fontWeight:e.badgeFontWeight,fontSize:e.badgeFontSize,lineHeight:`${e.badgeHeight}px`,whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:e.badgeHeight/2,boxShadow:`0 0 0 ${i}px ${e.badgeShadowColor}`,transition:`background ${e.motionDurationMid}`,a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},[`${t}-count-sm`]:{minWidth:l,height:l,fontSize:e.badgeFontSizeSm,lineHeight:`${l}px`,borderRadius:l/2},[`${t}-multiple-words`]:{padding:`0 ${e.paddingXS}px`},[`${t}-dot`]:{zIndex:e.badgeZIndex,width:e.badgeDotSize,minWidth:e.badgeDotSize,height:e.badgeDotSize,background:e.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${i}px ${e.badgeShadowColor}`},[`${t}-dot${d}`]:{transition:`background ${a}`},[`${t}-count, ${t}-dot, ${d}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${n}-spin`]:{animationName:UG,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${t}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${t}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:s,height:s,verticalAlign:"middle",borderRadius:"50%"},[`${t}-status-success`]:{backgroundColor:e.colorSuccess},[`${t}-status-processing`]:{overflow:"visible",color:e.colorPrimary,backgroundColor:e.colorPrimary,"&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:i,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:jG,animationDuration:e.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${t}-status-default`]:{backgroundColor:e.colorTextPlaceholder},[`${t}-status-error`]:{backgroundColor:e.colorError},[`${t}-status-warning`]:{backgroundColor:e.colorWarning},[`${t}-status-text`]:{marginInlineStart:c,color:e.colorText,fontSize:e.fontSize}}}),v),{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:VG,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`${t}-zoom-leave`]:{animationName:WG,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`&${t}-not-a-wrapper`]:{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:KG,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`${t}-zoom-leave`]:{animationName:GG,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:"middle"},[`${d}-custom-component, ${t}-count`]:{transform:"none"},[`${d}-custom-component, ${d}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[`${d}`]:{overflow:"hidden",[`${d}-only`]:{position:"relative",display:"inline-block",height:e.badgeHeight,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${d}-only-unit`]:{height:e.badgeHeight,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${d}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${t}-count, ${t}-dot, ${d}-custom-component`]:{transform:"translate(-50%, -50%)"}}}),[`${h}`]:{position:"relative"},[`${f}`]:m(m(m(m({},qe(e)),{position:"absolute",top:c,padding:`0 ${e.paddingXS}px`,color:e.colorPrimary,lineHeight:`${r}px`,whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,[`${f}-text`]:{color:e.colorTextLightSolid},[`${f}-corner`]:{position:"absolute",top:"100%",width:u,height:u,color:"currentcolor",border:`${u/2}px solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),g),{[`&${f}-placement-end`]:{insetInlineEnd:-u,borderEndEndRadius:0,[`${f}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${f}-placement-start`]:{insetInlineStart:-u,borderEndStartRadius:0,[`${f}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}},W5=Ue("Badge",e=>{const{fontSize:t,lineHeight:n,fontSizeSM:o,lineWidth:r,marginXS:i,colorBorderBg:l}=e,a=Math.round(t*n),s=r,c="auto",u=a-2*s,d=e.colorBgContainer,f="normal",h=o,v=e.colorError,g=e.colorErrorHover,b=t,y=o/2,S=o,$=o/2,w=ze(e,{badgeFontHeight:a,badgeShadowSize:s,badgeZIndex:c,badgeHeight:u,badgeTextColor:d,badgeFontWeight:f,badgeFontSize:h,badgeColor:v,badgeColorHover:g,badgeShadowColor:l,badgeHeightSm:b,badgeDotSize:y,badgeFontSizeSm:S,badgeStatusSize:$,badgeProcessingDuration:"1.2s",badgeRibbonOffset:i,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"});return[XG(w)]});var YG=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefix:String,color:{type:String},text:K.any,placement:{type:String,default:"end"}}),jf=re({compatConfig:{MODE:3},name:"ABadgeRibbon",inheritAttrs:!1,props:qG(),slots:Object,setup(e,t){let{attrs:n,slots:o}=t;const{prefixCls:r,direction:i}=Ee("ribbon",e),[l,a]=W5(r),s=P(()=>Sh(e.color,!1)),c=P(()=>[r.value,`${r.value}-placement-${e.placement}`,{[`${r.value}-rtl`]:i.value==="rtl",[`${r.value}-color-${e.color}`]:s.value}]);return()=>{var u,d;const{class:f,style:h}=n,v=YG(n,["class","style"]),g={},b={};return e.color&&!s.value&&(g.background=e.color,b.color=e.color),l(p("div",B({class:`${r.value}-wrapper ${a.value}`},v),[(u=o.default)===null||u===void 0?void 0:u.call(o),p("div",{class:[c.value,f,a.value],style:m(m({},g),h)},[p("span",{class:`${r.value}-text`},[e.text||((d=o.text)===null||d===void 0?void 0:d.call(o))]),p("div",{class:`${r.value}-corner`,style:b},null)])]))}}}),Vf=e=>!isNaN(parseFloat(e))&&isFinite(e),JG=()=>({count:K.any.def(null),showZero:{type:Boolean,default:void 0},overflowCount:{type:Number,default:99},dot:{type:Boolean,default:void 0},prefixCls:String,scrollNumberPrefixCls:String,status:{type:String},size:{type:String,default:"default"},color:String,text:K.any,offset:Array,numberStyle:{type:Object,default:void 0},title:String}),oc=re({compatConfig:{MODE:3},name:"ABadge",Ribbon:jf,inheritAttrs:!1,props:JG(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("badge",e),[l,a]=W5(r),s=P(()=>e.count>e.overflowCount?`${e.overflowCount}+`:e.count),c=P(()=>s.value==="0"||s.value===0),u=P(()=>e.count===null||c.value&&!e.showZero),d=P(()=>(e.status!==null&&e.status!==void 0||e.color!==null&&e.color!==void 0)&&u.value),f=P(()=>e.dot&&!c.value),h=P(()=>f.value?"":s.value),v=P(()=>(h.value===null||h.value===void 0||h.value===""||c.value&&!e.showZero)&&!f.value),g=ne(e.count),b=ne(h.value),y=ne(f.value);ye([()=>e.count,h,f],()=>{v.value||(g.value=e.count,b.value=h.value,y.value=f.value)},{immediate:!0});const S=P(()=>Sh(e.color,!1)),$=P(()=>({[`${r.value}-status-dot`]:d.value,[`${r.value}-status-${e.status}`]:!!e.status,[`${r.value}-color-${e.color}`]:S.value})),w=P(()=>e.color&&!S.value?{background:e.color,color:e.color}:{}),C=P(()=>({[`${r.value}-dot`]:y.value,[`${r.value}-count`]:!y.value,[`${r.value}-count-sm`]:e.size==="small",[`${r.value}-multiple-words`]:!y.value&&b.value&&b.value.toString().length>1,[`${r.value}-status-${e.status}`]:!!e.status,[`${r.value}-color-${e.color}`]:S.value}));return()=>{var O,x;const{offset:I,title:T,color:M}=e,E=o.style,A=ln(n,e,"text"),R=r.value,z=g.value;let _=wt((O=n.default)===null||O===void 0?void 0:O.call(n));_=_.length?_:null;const D=!!(!v.value||n.count),N=(()=>{if(!I)return m({},E);const Z={marginTop:Vf(I[1])?`${I[1]}px`:I[1]};return i.value==="rtl"?Z.left=`${parseInt(I[0],10)}px`:Z.right=`${-parseInt(I[0],10)}px`,m(m({},Z),E)})(),k=T??(typeof z=="string"||typeof z=="number"?z:void 0),F=D||!A?null:p("span",{class:`${R}-status-text`},[A]),L=typeof z=="object"||z===void 0&&n.count?pt(z??((x=n.count)===null||x===void 0?void 0:x.call(n)),{style:N},!1):null,H=le(R,{[`${R}-status`]:d.value,[`${R}-not-a-wrapper`]:!_,[`${R}-rtl`]:i.value==="rtl"},o.class,a.value);if(!_&&d.value){const Z=N.color;return l(p("span",B(B({},o),{},{class:H,style:N}),[p("span",{class:$.value,style:w.value},null),p("span",{style:{color:Z},class:`${R}-status-text`},[A])]))}const j=Go(_?`${R}-zoom`:"",{appear:!1});let Y=m(m({},N),e.numberStyle);return M&&!S.value&&(Y=Y||{},Y.background=M),l(p("span",B(B({},o),{},{class:H}),[_,p(bn,j,{default:()=>[Ln(p(HG,{prefixCls:e.scrollNumberPrefixCls,show:D,class:C.value,count:b.value,title:k,style:Y,key:"scrollNumber"},{default:()=>[L]}),[[Qn,D]])]}),F]))}}});oc.install=function(e){return e.component(oc.name,oc),e.component(jf.name,jf),e};const ca={adjustX:1,adjustY:1},ua=[0,0],ZG={topLeft:{points:["bl","tl"],overflow:ca,offset:[0,-4],targetOffset:ua},topCenter:{points:["bc","tc"],overflow:ca,offset:[0,-4],targetOffset:ua},topRight:{points:["br","tr"],overflow:ca,offset:[0,-4],targetOffset:ua},bottomLeft:{points:["tl","bl"],overflow:ca,offset:[0,4],targetOffset:ua},bottomCenter:{points:["tc","bc"],overflow:ca,offset:[0,4],targetOffset:ua},bottomRight:{points:["tr","br"],overflow:ca,offset:[0,4],targetOffset:ua}};var QG=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);re.visible,h=>{h!==void 0&&(i.value=h)});const l=ne();r({triggerRef:l});const a=h=>{e.visible===void 0&&(i.value=!1),o("overlayClick",h)},s=h=>{e.visible===void 0&&(i.value=h),o("visibleChange",h)},c=()=>{var h;const v=(h=n.overlay)===null||h===void 0?void 0:h.call(n),g={prefixCls:`${e.prefixCls}-menu`,onClick:a};return p(Le,{key:mO},[e.arrow&&p("div",{class:`${e.prefixCls}-arrow`},null),pt(v,g,!1)])},u=P(()=>{const{minOverlayWidthMatchTrigger:h=!e.alignPoint}=e;return h}),d=()=>{var h;const v=(h=n.default)===null||h===void 0?void 0:h.call(n);return i.value&&v?pt(v[0],{class:e.openClassName||`${e.prefixCls}-open`},!1):v},f=P(()=>!e.hideAction&&e.trigger.indexOf("contextmenu")!==-1?["click"]:e.hideAction);return()=>{const{prefixCls:h,arrow:v,showAction:g,overlayStyle:b,trigger:y,placement:S,align:$,getPopupContainer:w,transitionName:C,animation:O,overlayClassName:x}=e,I=QG(e,["prefixCls","arrow","showAction","overlayStyle","trigger","placement","align","getPopupContainer","transitionName","animation","overlayClassName"]);return p(ql,B(B({},I),{},{prefixCls:h,ref:l,popupClassName:le(x,{[`${h}-show-arrow`]:v}),popupStyle:b,builtinPlacements:ZG,action:y,showAction:g,hideAction:f.value||[],popupPlacement:S,popupAlign:$,popupTransitionName:C,popupAnimation:O,popupVisible:i.value,stretch:u.value?"minWidth":"",onPopupVisibleChange:s,getPopupContainer:w}),{popup:c,default:d})}}}),eU=e=>{const{componentCls:t,colorPrimary:n}=e;return{[t]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${n})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${e.motionEaseOutCirc}`,`opacity 2s ${e.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0}}}}},tU=Ue("Wave",e=>[eU(e)]);function nU(e){const t=(e||"").match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/);return t&&t[1]&&t[2]&&t[3]?!(t[1]===t[2]&&t[2]===t[3]):!0}function fv(e){return e&&e!=="#fff"&&e!=="#ffffff"&&e!=="rgb(255, 255, 255)"&&e!=="rgba(255, 255, 255, 1)"&&nU(e)&&!/rgba\((?:\d*, ){3}0\)/.test(e)&&e!=="transparent"}function oU(e){const{borderTopColor:t,borderColor:n,backgroundColor:o}=getComputedStyle(e);return fv(t)?t:fv(n)?n:fv(o)?o:null}function pv(e){return Number.isNaN(e)?0:e}const rU=re({props:{target:Be(),className:String},setup(e){const t=oe(null),[n,o]=St(null),[r,i]=St([]),[l,a]=St(0),[s,c]=St(0),[u,d]=St(0),[f,h]=St(0),[v,g]=St(!1);function b(){const{target:x}=e,I=getComputedStyle(x);o(oU(x));const T=I.position==="static",{borderLeftWidth:M,borderTopWidth:E}=I;a(T?x.offsetLeft:pv(-parseFloat(M))),c(T?x.offsetTop:pv(-parseFloat(E))),d(x.offsetWidth),h(x.offsetHeight);const{borderTopLeftRadius:A,borderTopRightRadius:R,borderBottomLeftRadius:z,borderBottomRightRadius:_}=I;i([A,R,_,z].map(D=>pv(parseFloat(D))))}let y,S,$;const w=()=>{clearTimeout($),Ze.cancel(S),y==null||y.disconnect()},C=()=>{var x;const I=(x=t.value)===null||x===void 0?void 0:x.parentElement;I&&(Hi(null,I),I.parentElement&&I.parentElement.removeChild(I))};Ke(()=>{w(),$=setTimeout(()=>{C()},5e3);const{target:x}=e;x&&(S=Ze(()=>{b(),g(!0)}),typeof ResizeObserver<"u"&&(y=new ResizeObserver(b),y.observe(x)))}),et(()=>{w()});const O=x=>{x.propertyName==="opacity"&&C()};return()=>{if(!v.value)return null;const x={left:`${l.value}px`,top:`${s.value}px`,width:`${u.value}px`,height:`${f.value}px`,borderRadius:r.value.map(I=>`${I}px`).join(" ")};return n&&(x["--wave-color"]=n.value),p(bn,{appear:!0,name:"wave-motion",appearFromClass:"wave-motion-appear",appearActiveClass:"wave-motion-appear",appearToClass:"wave-motion-appear wave-motion-appear-active"},{default:()=>[p("div",{ref:t,class:e.className,style:x,onTransitionend:O},null)]})}}});function iU(e,t){const n=document.createElement("div");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",e==null||e.insertBefore(n,e==null?void 0:e.firstChild),Hi(p(rU,{target:e,className:t},null),n),()=>{Hi(null,n),n.parentElement&&n.parentElement.removeChild(n)}}function lU(e,t){const n=On();let o;function r(){var i;const l=Jn(n);o==null||o(),!(!((i=t==null?void 0:t.value)===null||i===void 0)&&i.disabled||!l)&&(o=iU(l,e.value))}return et(()=>{o==null||o()}),r}const Vy=re({compatConfig:{MODE:3},name:"Wave",props:{disabled:Boolean},setup(e,t){let{slots:n}=t;const o=On(),{prefixCls:r,wave:i}=Ee("wave",e),[,l]=tU(r),a=lU(P(()=>le(r.value,l.value)),i);let s;const c=()=>{Jn(o).removeEventListener("click",s,!0)};return Ke(()=>{ye(()=>e.disabled,()=>{c(),rt(()=>{const u=Jn(o);u==null||u.removeEventListener("click",s,!0),!(!u||u.nodeType!==1||e.disabled)&&(s=d=>{d.target.tagName==="INPUT"||!Zp(d.target)||!u.getAttribute||u.getAttribute("disabled")||u.disabled||u.className.includes("disabled")||u.className.includes("-leave")||a()},u.addEventListener("click",s,!0))})},{immediate:!0,flush:"post"})}),et(()=>{c()}),()=>{var u;return(u=n.default)===null||u===void 0?void 0:u.call(n)[0]}}});function Wf(e){return e==="danger"?{danger:!0}:{type:e}}const G5=()=>({prefixCls:String,type:String,htmlType:{type:String,default:"button"},shape:{type:String},size:{type:String},loading:{type:[Boolean,Object],default:()=>!1},disabled:{type:Boolean,default:void 0},ghost:{type:Boolean,default:void 0},block:{type:Boolean,default:void 0},danger:{type:Boolean,default:void 0},icon:K.any,href:String,target:String,title:String,onClick:Nl(),onMousedown:Nl()}),ew=e=>{e&&(e.style.width="0px",e.style.opacity="0",e.style.transform="scale(0)")},tw=e=>{rt(()=>{e&&(e.style.width=`${e.scrollWidth}px`,e.style.opacity="1",e.style.transform="scale(1)")})},nw=e=>{e&&e.style&&(e.style.width=null,e.style.opacity=null,e.style.transform=null)},aU=re({compatConfig:{MODE:3},name:"LoadingIcon",props:{prefixCls:String,loading:[Boolean,Object],existIcon:Boolean},setup(e){return()=>{const{existIcon:t,prefixCls:n,loading:o}=e;if(t)return p("span",{class:`${n}-loading-icon`},[p(to,null,null)]);const r=!!o;return p(bn,{name:`${n}-loading-icon-motion`,onBeforeEnter:ew,onEnter:tw,onAfterEnter:nw,onBeforeLeave:tw,onLeave:i=>{setTimeout(()=>{ew(i)})},onAfterLeave:nw},{default:()=>[r?p("span",{class:`${n}-loading-icon`},[p(to,null,null)]):null]})}}}),ow=(e,t)=>({[`> span, > ${e}`]:{"&:not(:last-child)":{[`&, & > ${e}`]:{"&:not(:disabled)":{borderInlineEndColor:t}}},"&:not(:first-child)":{[`&, & > ${e}`]:{"&:not(:disabled)":{borderInlineStartColor:t}}}}}),sU=e=>{const{componentCls:t,fontSize:n,lineWidth:o,colorPrimaryHover:r,colorErrorHover:i}=e;return{[`${t}-group`]:[{position:"relative",display:"inline-flex",[`> span, > ${t}`]:{"&:not(:last-child)":{[`&, & > ${t}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:-o,[`&, & > ${t}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[t]:{position:"relative",zIndex:1,"&:hover,\n &:focus,\n &:active":{zIndex:2},"&[disabled]":{zIndex:0}},[`${t}-icon-only`]:{fontSize:n}},ow(`${t}-primary`,r),ow(`${t}-danger`,i)]}};function cU(e,t){return{[`&-item:not(${t}-last-item)`]:{marginBottom:-e.lineWidth},"&-item":{"&:hover,&:focus,&:active":{zIndex:2},"&[disabled]":{zIndex:0}}}}function uU(e,t){return{[`&-item:not(${t}-first-item):not(${t}-last-item)`]:{borderRadius:0},[`&-item${t}-first-item:not(${t}-last-item)`]:{[`&, &${e}-sm, &${e}-lg`]:{borderEndEndRadius:0,borderEndStartRadius:0}},[`&-item${t}-last-item:not(${t}-first-item)`]:{[`&, &${e}-sm, &${e}-lg`]:{borderStartStartRadius:0,borderStartEndRadius:0}}}}function dU(e){const t=`${e.componentCls}-compact-vertical`;return{[t]:m(m({},cU(e,t)),uU(e.componentCls,t))}}const fU=e=>{const{componentCls:t,iconCls:n}=e;return{[t]:{outline:"none",position:"relative",display:"inline-block",fontWeight:400,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",backgroundColor:"transparent",border:`${e.lineWidth}px ${e.lineType} transparent`,cursor:"pointer",transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,userSelect:"none",touchAction:"manipulation",lineHeight:e.lineHeight,color:e.colorText,"> span":{display:"inline-block"},[`> ${n} + span, > span + ${n}`]:{marginInlineStart:e.marginXS},"> a":{color:"currentColor"},"&:not(:disabled)":m({},oi(e)),[`&-icon-only${t}-compact-item`]:{flex:"none"},[`&-compact-item${t}-primary`]:{[`&:not([disabled]) + ${t}-compact-item${t}-primary:not([disabled])`]:{position:"relative","&:before":{position:"absolute",top:-e.lineWidth,insetInlineStart:-e.lineWidth,display:"inline-block",width:e.lineWidth,height:`calc(100% + ${e.lineWidth*2}px)`,backgroundColor:e.colorPrimaryHover,content:'""'}}},"&-compact-vertical-item":{[`&${t}-primary`]:{[`&:not([disabled]) + ${t}-compact-vertical-item${t}-primary:not([disabled])`]:{position:"relative","&:before":{position:"absolute",top:-e.lineWidth,insetInlineStart:-e.lineWidth,display:"inline-block",width:`calc(100% + ${e.lineWidth*2}px)`,height:e.lineWidth,backgroundColor:e.colorPrimaryHover,content:'""'}}}}}}},ri=(e,t)=>({"&:not(:disabled)":{"&:hover":e,"&:active":t}}),pU=e=>({minWidth:e.controlHeight,paddingInlineStart:0,paddingInlineEnd:0,borderRadius:"50%"}),hU=e=>({borderRadius:e.controlHeight,paddingInlineStart:e.controlHeight/2,paddingInlineEnd:e.controlHeight/2}),e0=e=>({cursor:"not-allowed",borderColor:e.colorBorder,color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,boxShadow:"none"}),Kf=(e,t,n,o,r,i,l)=>({[`&${e}-background-ghost`]:m(m({color:t||void 0,backgroundColor:"transparent",borderColor:n||void 0,boxShadow:"none"},ri(m({backgroundColor:"transparent"},i),m({backgroundColor:"transparent"},l))),{"&:disabled":{cursor:"not-allowed",color:o||void 0,borderColor:r||void 0}})}),Wy=e=>({"&:disabled":m({},e0(e))}),U5=e=>m({},Wy(e)),Gf=e=>({"&:disabled":{cursor:"not-allowed",color:e.colorTextDisabled}}),X5=e=>m(m(m(m(m({},U5(e)),{backgroundColor:e.colorBgContainer,borderColor:e.colorBorder,boxShadow:`0 ${e.controlOutlineWidth}px 0 ${e.controlTmpOutline}`}),ri({color:e.colorPrimaryHover,borderColor:e.colorPrimaryHover},{color:e.colorPrimaryActive,borderColor:e.colorPrimaryActive})),Kf(e.componentCls,e.colorBgContainer,e.colorBgContainer,e.colorTextDisabled,e.colorBorder)),{[`&${e.componentCls}-dangerous`]:m(m(m({color:e.colorError,borderColor:e.colorError},ri({color:e.colorErrorHover,borderColor:e.colorErrorBorderHover},{color:e.colorErrorActive,borderColor:e.colorErrorActive})),Kf(e.componentCls,e.colorError,e.colorError,e.colorTextDisabled,e.colorBorder)),Wy(e))}),gU=e=>m(m(m(m(m({},U5(e)),{color:e.colorTextLightSolid,backgroundColor:e.colorPrimary,boxShadow:`0 ${e.controlOutlineWidth}px 0 ${e.controlOutline}`}),ri({color:e.colorTextLightSolid,backgroundColor:e.colorPrimaryHover},{color:e.colorTextLightSolid,backgroundColor:e.colorPrimaryActive})),Kf(e.componentCls,e.colorPrimary,e.colorPrimary,e.colorTextDisabled,e.colorBorder,{color:e.colorPrimaryHover,borderColor:e.colorPrimaryHover},{color:e.colorPrimaryActive,borderColor:e.colorPrimaryActive})),{[`&${e.componentCls}-dangerous`]:m(m(m({backgroundColor:e.colorError,boxShadow:`0 ${e.controlOutlineWidth}px 0 ${e.colorErrorOutline}`},ri({backgroundColor:e.colorErrorHover},{backgroundColor:e.colorErrorActive})),Kf(e.componentCls,e.colorError,e.colorError,e.colorTextDisabled,e.colorBorder,{color:e.colorErrorHover,borderColor:e.colorErrorHover},{color:e.colorErrorActive,borderColor:e.colorErrorActive})),Wy(e))}),vU=e=>m(m({},X5(e)),{borderStyle:"dashed"}),mU=e=>m(m(m({color:e.colorLink},ri({color:e.colorLinkHover},{color:e.colorLinkActive})),Gf(e)),{[`&${e.componentCls}-dangerous`]:m(m({color:e.colorError},ri({color:e.colorErrorHover},{color:e.colorErrorActive})),Gf(e))}),bU=e=>m(m(m({},ri({color:e.colorText,backgroundColor:e.colorBgTextHover},{color:e.colorText,backgroundColor:e.colorBgTextActive})),Gf(e)),{[`&${e.componentCls}-dangerous`]:m(m({color:e.colorError},Gf(e)),ri({color:e.colorErrorHover,backgroundColor:e.colorErrorBg},{color:e.colorErrorHover,backgroundColor:e.colorErrorBg}))}),yU=e=>m(m({},e0(e)),{[`&${e.componentCls}:hover`]:m({},e0(e))}),SU=e=>{const{componentCls:t}=e;return{[`${t}-default`]:X5(e),[`${t}-primary`]:gU(e),[`${t}-dashed`]:vU(e),[`${t}-link`]:mU(e),[`${t}-text`]:bU(e),[`${t}-disabled`]:yU(e)}},Ky=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const{componentCls:n,iconCls:o,controlHeight:r,fontSize:i,lineHeight:l,lineWidth:a,borderRadius:s,buttonPaddingHorizontal:c}=e,u=Math.max(0,(r-i*l)/2-a),d=c-a,f=`${n}-icon-only`;return[{[`${n}${t}`]:{fontSize:i,height:r,padding:`${u}px ${d}px`,borderRadius:s,[`&${f}`]:{width:r,paddingInlineStart:0,paddingInlineEnd:0,[`&${n}-round`]:{width:"auto"},"> span":{transform:"scale(1.143)"}},[`&${n}-loading`]:{opacity:e.opacityLoading,cursor:"default"},[`${n}-loading-icon`]:{transition:`width ${e.motionDurationSlow} ${e.motionEaseInOut}, opacity ${e.motionDurationSlow} ${e.motionEaseInOut}`},[`&:not(${f}) ${n}-loading-icon > ${o}`]:{marginInlineEnd:e.marginXS}}},{[`${n}${n}-circle${t}`]:pU(e)},{[`${n}${n}-round${t}`]:hU(e)}]},$U=e=>Ky(e),CU=e=>{const t=ze(e,{controlHeight:e.controlHeightSM,padding:e.paddingXS,buttonPaddingHorizontal:8,borderRadius:e.borderRadiusSM});return Ky(t,`${e.componentCls}-sm`)},xU=e=>{const t=ze(e,{controlHeight:e.controlHeightLG,fontSize:e.fontSizeLG,borderRadius:e.borderRadiusLG});return Ky(t,`${e.componentCls}-lg`)},wU=e=>{const{componentCls:t}=e;return{[t]:{[`&${t}-block`]:{width:"100%"}}}},OU=Ue("Button",e=>{const{controlTmpOutline:t,paddingContentHorizontal:n}=e,o=ze(e,{colorOutlineDefault:t,buttonPaddingHorizontal:n});return[fU(o),CU(o),$U(o),xU(o),wU(o),SU(o),sU(o),fs(e,{focus:!1}),dU(e)]}),PU=()=>({prefixCls:String,size:{type:String}}),Y5=Cy(),Uf=re({compatConfig:{MODE:3},name:"AButtonGroup",props:PU(),setup(e,t){let{slots:n}=t;const{prefixCls:o,direction:r}=Ee("btn-group",e),[,,i]=si();Y5.useProvide(ft({size:P(()=>e.size)}));const l=P(()=>{const{size:a}=e;let s="";switch(a){case"large":s="lg";break;case"small":s="sm";break;case"middle":case void 0:break;default:Mt(!a,"Button.Group","Invalid prop `size`.")}return{[`${o.value}`]:!0,[`${o.value}-${s}`]:s,[`${o.value}-rtl`]:r.value==="rtl",[i.value]:!0}});return()=>{var a;return p("div",{class:l.value},[wt((a=n.default)===null||a===void 0?void 0:a.call(n))])}}}),rw=/^[\u4e00-\u9fa5]{2}$/,iw=rw.test.bind(rw);function Ku(e){return e==="text"||e==="link"}const Wt=re({compatConfig:{MODE:3},name:"AButton",inheritAttrs:!1,__ANT_BUTTON:!0,props:Qe(G5(),{type:"default"}),slots:Object,setup(e,t){let{slots:n,attrs:o,emit:r,expose:i}=t;const{prefixCls:l,autoInsertSpaceInButton:a,direction:s,size:c}=Ee("btn",e),[u,d]=OU(l),f=Y5.useInject(),h=po(),v=P(()=>{var _;return(_=e.disabled)!==null&&_!==void 0?_:h.value}),g=oe(null),b=oe(void 0);let y=!1;const S=oe(!1),$=oe(!1),w=P(()=>a.value!==!1),{compactSize:C,compactItemClassnames:O}=Yi(l,s),x=P(()=>typeof e.loading=="object"&&e.loading.delay?e.loading.delay||!0:!!e.loading);ye(x,_=>{clearTimeout(b.value),typeof x.value=="number"?b.value=setTimeout(()=>{S.value=_},x.value):S.value=_},{immediate:!0});const I=P(()=>{const{type:_,shape:D="default",ghost:N,block:k,danger:F}=e,L=l.value,H={large:"lg",small:"sm",middle:void 0},j=C.value||(f==null?void 0:f.size)||c.value,Y=j&&H[j]||"";return[O.value,{[d.value]:!0,[`${L}`]:!0,[`${L}-${D}`]:D!=="default"&&D,[`${L}-${_}`]:_,[`${L}-${Y}`]:Y,[`${L}-loading`]:S.value,[`${L}-background-ghost`]:N&&!Ku(_),[`${L}-two-chinese-chars`]:$.value&&w.value,[`${L}-block`]:k,[`${L}-dangerous`]:!!F,[`${L}-rtl`]:s.value==="rtl"}]}),T=()=>{const _=g.value;if(!_||a.value===!1)return;const D=_.textContent;y&&iw(D)?$.value||($.value=!0):$.value&&($.value=!1)},M=_=>{if(S.value||v.value){_.preventDefault();return}r("click",_)},E=_=>{r("mousedown",_)},A=(_,D)=>{const N=D?" ":"";if(_.type===Ki){let k=_.children.trim();return iw(k)&&(k=k.split("").join(N)),p("span",null,[k])}return _};return Ve(()=>{Mt(!(e.ghost&&Ku(e.type)),"Button","`link` or `text` button can't be a `ghost` button.")}),Ke(T),jn(T),et(()=>{b.value&&clearTimeout(b.value)}),i({focus:()=>{var _;(_=g.value)===null||_===void 0||_.focus()},blur:()=>{var _;(_=g.value)===null||_===void 0||_.blur()}}),()=>{var _,D;const{icon:N=(_=n.icon)===null||_===void 0?void 0:_.call(n)}=e,k=wt((D=n.default)===null||D===void 0?void 0:D.call(n));y=k.length===1&&!N&&!Ku(e.type);const{type:F,htmlType:L,href:H,title:j,target:Y}=e,Z=S.value?"loading":N,X=m(m({},o),{title:j,disabled:v.value,class:[I.value,o.class,{[`${l.value}-icon-only`]:k.length===0&&!!Z}],onClick:M,onMousedown:E});v.value||delete X.disabled;const ee=N&&!S.value?N:p(aU,{existIcon:!!N,prefixCls:l.value,loading:!!S.value},null),U=k.map(J=>A(J,y&&w.value));if(H!==void 0)return u(p("a",B(B({},X),{},{href:H,target:Y,ref:g}),[ee,U]));let Q=p("button",B(B({},X),{},{ref:g,type:L}),[ee,U]);if(!Ku(F)){const J=function(){return Q}();Q=p(Vy,{ref:"wave",disabled:!!S.value},{default:()=>[J]})}return u(Q)}}});Wt.Group=Uf;Wt.install=function(e){return e.component(Wt.name,Wt),e.component(Uf.name,Uf),e};const q5=()=>({arrow:He([Boolean,Object]),trigger:{type:[Array,String]},menu:Be(),overlay:K.any,visible:$e(),open:$e(),disabled:$e(),danger:$e(),autofocus:$e(),align:Be(),getPopupContainer:Function,prefixCls:String,transitionName:String,placement:String,overlayClassName:String,overlayStyle:Be(),forceRender:$e(),mouseEnterDelay:Number,mouseLeaveDelay:Number,openClassName:String,minOverlayWidthMatchTrigger:$e(),destroyPopupOnHide:$e(),onVisibleChange:{type:Function},"onUpdate:visible":{type:Function},onOpenChange:{type:Function},"onUpdate:open":{type:Function}}),hv=G5(),IU=()=>m(m({},q5()),{type:hv.type,size:String,htmlType:hv.htmlType,href:String,disabled:$e(),prefixCls:String,icon:K.any,title:String,loading:hv.loading,onClick:Nl()});var TU={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"};function lw(e){for(var t=1;t{const{componentCls:t,antCls:n,paddingXS:o,opacityLoading:r}=e;return{[`${t}-button`]:{whiteSpace:"nowrap",[`&${n}-btn-group > ${n}-btn`]:{[`&-loading, &-loading + ${n}-btn`]:{cursor:"default",pointerEvents:"none",opacity:r},[`&:last-child:not(:first-child):not(${n}-btn-icon-only)`]:{paddingInline:o}}}}},MU=e=>{const{componentCls:t,menuCls:n,colorError:o,colorTextLightSolid:r}=e,i=`${n}-item`;return{[`${t}, ${t}-menu-submenu`]:{[`${n} ${i}`]:{[`&${i}-danger:not(${i}-disabled)`]:{color:o,"&:hover":{color:r,backgroundColor:o}}}}}},AU=e=>{const{componentCls:t,menuCls:n,zIndexPopup:o,dropdownArrowDistance:r,dropdownArrowOffset:i,sizePopupArrow:l,antCls:a,iconCls:s,motionDurationMid:c,dropdownPaddingVertical:u,fontSize:d,dropdownEdgeChildPadding:f,colorTextDisabled:h,fontSizeIcon:v,controlPaddingHorizontal:g,colorBgElevated:b,boxShadowPopoverArrow:y}=e;return[{[t]:m(m({},qe(e)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:o,display:"block","&::before":{position:"absolute",insetBlock:-r+l/2,zIndex:-9999,opacity:1e-4,content:'""'},[`${t}-wrap`]:{position:"relative",[`${a}-btn > ${s}-down`]:{fontSize:v},[`${s}-down::before`]:{transition:`transform ${c}`}},[`${t}-wrap-open`]:{[`${s}-down::before`]:{transform:"rotate(180deg)"}},"\n &-hidden,\n &-menu-hidden,\n &-menu-submenu-hidden\n ":{display:"none"},[` + &-show-arrow${t}-placement-topLeft, + &-show-arrow${t}-placement-top, + &-show-arrow${t}-placement-topRight + `]:{paddingBottom:r},[` + &-show-arrow${t}-placement-bottomLeft, + &-show-arrow${t}-placement-bottom, + &-show-arrow${t}-placement-bottomRight + `]:{paddingTop:r},[`${t}-arrow`]:m({position:"absolute",zIndex:1,display:"block"},Lb(l,e.borderRadiusXS,e.borderRadiusOuter,b,y)),[` + &-placement-top > ${t}-arrow, + &-placement-topLeft > ${t}-arrow, + &-placement-topRight > ${t}-arrow + `]:{bottom:r,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top > ${t}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},[`&-placement-topLeft > ${t}-arrow`]:{left:{_skip_check_:!0,value:i}},[`&-placement-topRight > ${t}-arrow`]:{right:{_skip_check_:!0,value:i}},[` + &-placement-bottom > ${t}-arrow, + &-placement-bottomLeft > ${t}-arrow, + &-placement-bottomRight > ${t}-arrow + `]:{top:r,transform:"translateY(-100%)"},[`&-placement-bottom > ${t}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateY(-100%) translateX(-50%)"},[`&-placement-bottomLeft > ${t}-arrow`]:{left:{_skip_check_:!0,value:i}},[`&-placement-bottomRight > ${t}-arrow`]:{right:{_skip_check_:!0,value:i}},[`&${a}-slide-down-enter${a}-slide-down-enter-active${t}-placement-bottomLeft, + &${a}-slide-down-appear${a}-slide-down-appear-active${t}-placement-bottomLeft, + &${a}-slide-down-enter${a}-slide-down-enter-active${t}-placement-bottom, + &${a}-slide-down-appear${a}-slide-down-appear-active${t}-placement-bottom, + &${a}-slide-down-enter${a}-slide-down-enter-active${t}-placement-bottomRight, + &${a}-slide-down-appear${a}-slide-down-appear-active${t}-placement-bottomRight`]:{animationName:dh},[`&${a}-slide-up-enter${a}-slide-up-enter-active${t}-placement-topLeft, + &${a}-slide-up-appear${a}-slide-up-appear-active${t}-placement-topLeft, + &${a}-slide-up-enter${a}-slide-up-enter-active${t}-placement-top, + &${a}-slide-up-appear${a}-slide-up-appear-active${t}-placement-top, + &${a}-slide-up-enter${a}-slide-up-enter-active${t}-placement-topRight, + &${a}-slide-up-appear${a}-slide-up-appear-active${t}-placement-topRight`]:{animationName:ph},[`&${a}-slide-down-leave${a}-slide-down-leave-active${t}-placement-bottomLeft, + &${a}-slide-down-leave${a}-slide-down-leave-active${t}-placement-bottom, + &${a}-slide-down-leave${a}-slide-down-leave-active${t}-placement-bottomRight`]:{animationName:fh},[`&${a}-slide-up-leave${a}-slide-up-leave-active${t}-placement-topLeft, + &${a}-slide-up-leave${a}-slide-up-leave-active${t}-placement-top, + &${a}-slide-up-leave${a}-slide-up-leave-active${t}-placement-topRight`]:{animationName:hh}})},{[`${t} ${n}`]:{position:"relative",margin:0},[`${n}-submenu-popup`]:{position:"absolute",zIndex:o,background:"transparent",boxShadow:"none",transformOrigin:"0 0","ul,li":{listStyle:"none"},ul:{marginInline:"0.3em"}},[`${t}, ${t}-menu-submenu`]:{[n]:m(m({padding:f,listStyleType:"none",backgroundColor:b,backgroundClip:"padding-box",borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary},oi(e)),{[`${n}-item-group-title`]:{padding:`${u}px ${g}px`,color:e.colorTextDescription,transition:`all ${c}`},[`${n}-item`]:{position:"relative",display:"flex",alignItems:"center",borderRadius:e.borderRadiusSM},[`${n}-item-icon`]:{minWidth:d,marginInlineEnd:e.marginXS,fontSize:e.fontSizeSM},[`${n}-title-content`]:{flex:"auto","> a":{color:"inherit",transition:`all ${c}`,"&:hover":{color:"inherit"},"&::after":{position:"absolute",inset:0,content:'""'}}},[`${n}-item, ${n}-submenu-title`]:m(m({clear:"both",margin:0,padding:`${u}px ${g}px`,color:e.colorText,fontWeight:"normal",fontSize:d,lineHeight:e.lineHeight,cursor:"pointer",transition:`all ${c}`,"&:hover, &-active":{backgroundColor:e.controlItemBgHover}},oi(e)),{"&-selected":{color:e.colorPrimary,backgroundColor:e.controlItemBgActive,"&:hover, &-active":{backgroundColor:e.controlItemBgActiveHover}},"&-disabled":{color:h,cursor:"not-allowed","&:hover":{color:h,backgroundColor:b,cursor:"not-allowed"},a:{pointerEvents:"none"}},"&-divider":{height:1,margin:`${e.marginXXS}px 0`,overflow:"hidden",lineHeight:0,backgroundColor:e.colorSplit},[`${t}-menu-submenu-expand-icon`]:{position:"absolute",insetInlineEnd:e.paddingXS,[`${t}-menu-submenu-arrow-icon`]:{marginInlineEnd:"0 !important",color:e.colorTextDescription,fontSize:v,fontStyle:"normal"}}}),[`${n}-item-group-list`]:{margin:`0 ${e.marginXS}px`,padding:0,listStyle:"none"},[`${n}-submenu-title`]:{paddingInlineEnd:g+e.fontSizeSM},[`${n}-submenu-vertical`]:{position:"relative"},[`${n}-submenu${n}-submenu-disabled ${t}-menu-submenu-title`]:{[`&, ${t}-menu-submenu-arrow-icon`]:{color:h,backgroundColor:b,cursor:"not-allowed"}},[`${n}-submenu-selected ${t}-menu-submenu-title`]:{color:e.colorPrimary}})}},[Rr(e,"slide-up"),Rr(e,"slide-down"),es(e,"move-up"),es(e,"move-down"),ds(e,"zoom-big")]]},J5=Ue("Dropdown",(e,t)=>{let{rootPrefixCls:n}=t;const{marginXXS:o,sizePopupArrow:r,controlHeight:i,fontSize:l,lineHeight:a,paddingXXS:s,componentCls:c,borderRadiusOuter:u,borderRadiusLG:d}=e,f=(i-l*a)/2,{dropdownArrowOffset:h}=H5({sizePopupArrow:r,contentRadius:d,borderRadiusOuter:u}),v=ze(e,{menuCls:`${c}-menu`,rootPrefixCls:n,dropdownArrowDistance:r/2+o,dropdownArrowOffset:h,dropdownPaddingVertical:f,dropdownEdgeChildPadding:s});return[AU(v),_U(v),MU(v)]},e=>({zIndexPopup:e.zIndexPopupBase+50}));var RU=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{r("update:visible",f),r("visibleChange",f),r("update:open",f),r("openChange",f)},{prefixCls:l,direction:a,getPopupContainer:s}=Ee("dropdown",e),c=P(()=>`${l.value}-button`),[u,d]=J5(l);return()=>{var f,h;const v=m(m({},e),o),{type:g="default",disabled:b,danger:y,loading:S,htmlType:$,class:w="",overlay:C=(f=n.overlay)===null||f===void 0?void 0:f.call(n),trigger:O,align:x,open:I,visible:T,onVisibleChange:M,placement:E=a.value==="rtl"?"bottomLeft":"bottomRight",href:A,title:R,icon:z=((h=n.icon)===null||h===void 0?void 0:h.call(n))||p(ou,null,null),mouseEnterDelay:_,mouseLeaveDelay:D,overlayClassName:N,overlayStyle:k,destroyPopupOnHide:F,onClick:L,"onUpdate:open":H}=v,j=RU(v,["type","disabled","danger","loading","htmlType","class","overlay","trigger","align","open","visible","onVisibleChange","placement","href","title","icon","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyPopupOnHide","onClick","onUpdate:open"]),Y={align:x,disabled:b,trigger:b?[]:O,placement:E,getPopupContainer:s==null?void 0:s.value,onOpenChange:i,mouseEnterDelay:_,mouseLeaveDelay:D,open:I??T,overlayClassName:N,overlayStyle:k,destroyPopupOnHide:F},Z=p(Wt,{danger:y,type:g,disabled:b,loading:S,onClick:L,htmlType:$,href:A,title:R},{default:n.default}),X=p(Wt,{danger:y,type:g,icon:z},null);return u(p(DU,B(B({},j),{},{class:le(c.value,w,d.value)}),{default:()=>[n.leftButton?n.leftButton({button:Z}):Z,p(rr,Y,{default:()=>[n.rightButton?n.rightButton({button:X}):X],overlay:()=>C})]}))}}});var BU={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"};function aw(e){for(var t=1;tGe(Z5,void 0),Gy=e=>{var t,n,o;const{prefixCls:r,mode:i,selectable:l,validator:a,onClick:s,expandIcon:c}=Q5()||{};Ye(Z5,{prefixCls:P(()=>{var u,d;return(d=(u=e.prefixCls)===null||u===void 0?void 0:u.value)!==null&&d!==void 0?d:r==null?void 0:r.value}),mode:P(()=>{var u,d;return(d=(u=e.mode)===null||u===void 0?void 0:u.value)!==null&&d!==void 0?d:i==null?void 0:i.value}),selectable:P(()=>{var u,d;return(d=(u=e.selectable)===null||u===void 0?void 0:u.value)!==null&&d!==void 0?d:l==null?void 0:l.value}),validator:(t=e.validator)!==null&&t!==void 0?t:a,onClick:(n=e.onClick)!==null&&n!==void 0?n:s,expandIcon:(o=e.expandIcon)!==null&&o!==void 0?o:c==null?void 0:c.value})},rr=re({compatConfig:{MODE:3},name:"ADropdown",inheritAttrs:!1,props:Qe(q5(),{mouseEnterDelay:.15,mouseLeaveDelay:.1,placement:"bottomLeft",trigger:"hover"}),slots:Object,setup(e,t){let{slots:n,attrs:o,emit:r}=t;const{prefixCls:i,rootPrefixCls:l,direction:a,getPopupContainer:s}=Ee("dropdown",e),[c,u]=J5(i),d=P(()=>{const{placement:b="",transitionName:y}=e;return y!==void 0?y:b.includes("top")?`${l.value}-slide-down`:`${l.value}-slide-up`});Gy({prefixCls:P(()=>`${i.value}-menu`),expandIcon:P(()=>p("span",{class:`${i.value}-menu-submenu-arrow`},[p(Eo,{class:`${i.value}-menu-submenu-arrow-icon`},null)])),mode:P(()=>"vertical"),selectable:P(()=>!1),onClick:()=>{},validator:b=>{let{mode:y}=b}});const f=()=>{var b,y,S;const $=e.overlay||((b=n.overlay)===null||b===void 0?void 0:b.call(n)),w=Array.isArray($)?$[0]:$;if(!w)return null;const C=w.props||{};Mt(!C.mode||C.mode==="vertical","Dropdown",`mode="${C.mode}" is not supported for Dropdown's Menu.`);const{selectable:O=!1,expandIcon:x=(S=(y=w.children)===null||y===void 0?void 0:y.expandIcon)===null||S===void 0?void 0:S.call(y)}=C,I=typeof x<"u"&&qt(x)?x:p("span",{class:`${i.value}-menu-submenu-arrow`},[p(Eo,{class:`${i.value}-menu-submenu-arrow-icon`},null)]);return qt(w)?pt(w,{mode:"vertical",selectable:O,expandIcon:()=>I}):w},h=P(()=>{const b=e.placement;if(!b)return a.value==="rtl"?"bottomRight":"bottomLeft";if(b.includes("Center")){const y=b.slice(0,b.indexOf("Center"));return Mt(!b.includes("Center"),"Dropdown",`You are using '${b}' placement in Dropdown, which is deprecated. Try to use '${y}' instead.`),y}return b}),v=P(()=>typeof e.visible=="boolean"?e.visible:e.open),g=b=>{r("update:visible",b),r("visibleChange",b),r("update:open",b),r("openChange",b)};return()=>{var b,y;const{arrow:S,trigger:$,disabled:w,overlayClassName:C}=e,O=(b=n.default)===null||b===void 0?void 0:b.call(n)[0],x=pt(O,m({class:le((y=O==null?void 0:O.props)===null||y===void 0?void 0:y.class,{[`${i.value}-rtl`]:a.value==="rtl"},`${i.value}-trigger`)},w?{disabled:w}:{})),I=le(C,u.value,{[`${i.value}-rtl`]:a.value==="rtl"}),T=w?[]:$;let M;T&&T.includes("contextmenu")&&(M=!0);const E=Ly({arrowPointAtCenter:typeof S=="object"&&S.pointAtCenter,autoAdjustOverflow:!0}),A=ot(m(m(m({},e),o),{visible:v.value,builtinPlacements:E,overlayClassName:I,arrow:!!S,alignPoint:M,prefixCls:i.value,getPopupContainer:s==null?void 0:s.value,transitionName:d.value,trigger:T,onVisibleChange:g,placement:h.value}),["overlay","onUpdate:visible"]);return c(p(K5,A,{default:()=>[x],overlay:f}))}}});rr.Button=Dc;var kU=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefixCls:String,href:String,separator:K.any,dropdownProps:Be(),overlay:K.any,onClick:Nl()}),Bc=re({compatConfig:{MODE:3},name:"ABreadcrumbItem",inheritAttrs:!1,__ANT_BREADCRUMB_ITEM:!0,props:FU(),slots:Object,setup(e,t){let{slots:n,attrs:o,emit:r}=t;const{prefixCls:i}=Ee("breadcrumb",e),l=(s,c)=>{const u=ln(n,e,"overlay");return u?p(rr,B(B({},e.dropdownProps),{},{overlay:u,placement:"bottom"}),{default:()=>[p("span",{class:`${c}-overlay-link`},[s,p(Jl,null,null)])]}):s},a=s=>{r("click",s)};return()=>{var s;const c=(s=ln(n,e,"separator"))!==null&&s!==void 0?s:"/",u=ln(n,e),{class:d,style:f}=o,h=kU(o,["class","style"]);let v;return e.href!==void 0?v=p("a",B({class:`${i.value}-link`,onClick:a},h),[u]):v=p("span",B({class:`${i.value}-link`,onClick:a},h),[u]),v=l(v,i.value),u!=null?p("li",{class:d,style:f},[v,c&&p("span",{class:`${i.value}-separator`},[c])]):null}}});function LU(e,t,n,o){let r;if(r!==void 0)return!!r;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;const a=Object.prototype.hasOwnProperty.bind(t);for(let s=0;s{Ye(eI,e)},di=()=>Ge(eI),nI=Symbol("ForceRenderKey"),zU=e=>{Ye(nI,e)},oI=()=>Ge(nI,!1),rI=Symbol("menuFirstLevelContextKey"),iI=e=>{Ye(rI,e)},HU=()=>Ge(rI,!0),Xf=re({compatConfig:{MODE:3},name:"MenuContextProvider",inheritAttrs:!1,props:{mode:{type:String,default:void 0},overflowDisabled:{type:Boolean,default:void 0}},setup(e,t){let{slots:n}=t;const o=di(),r=m({},o);return e.mode!==void 0&&(r.mode=We(e,"mode")),e.overflowDisabled!==void 0&&(r.overflowDisabled=We(e,"overflowDisabled")),tI(r),()=>{var i;return(i=n.default)===null||i===void 0?void 0:i.call(n)}}}),lI=Symbol("siderCollapsed"),aI=Symbol("siderHookProvider"),Gu="$$__vc-menu-more__key",sI=Symbol("KeyPathContext"),Uy=()=>Ge(sI,{parentEventKeys:P(()=>[]),parentKeys:P(()=>[]),parentInfo:{}}),jU=(e,t,n)=>{const{parentEventKeys:o,parentKeys:r}=Uy(),i=P(()=>[...o.value,e]),l=P(()=>[...r.value,t]);return Ye(sI,{parentEventKeys:i,parentKeys:l,parentInfo:n}),l},cI=Symbol("measure"),sw=re({compatConfig:{MODE:3},setup(e,t){let{slots:n}=t;return Ye(cI,!0),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}}),Xy=()=>Ge(cI,!1);function uI(e){const{mode:t,rtl:n,inlineIndent:o}=di();return P(()=>t.value!=="inline"?null:n.value?{paddingRight:`${e.value*o.value}px`}:{paddingLeft:`${e.value*o.value}px`})}let VU=0;const WU=()=>({id:String,role:String,disabled:Boolean,danger:Boolean,title:{type:[String,Boolean],default:void 0},icon:K.any,onMouseenter:Function,onMouseleave:Function,onClick:Function,onKeydown:Function,onFocus:Function,originItemValue:Be()}),Er=re({compatConfig:{MODE:3},name:"AMenuItem",inheritAttrs:!1,props:WU(),slots:Object,setup(e,t){let{slots:n,emit:o,attrs:r}=t;const i=On(),l=Xy(),a=typeof i.vnode.key=="symbol"?String(i.vnode.key):i.vnode.key;Mt(typeof i.vnode.key!="symbol","MenuItem",`MenuItem \`:key="${String(a)}"\` not support Symbol type`);const s=`menu_item_${++VU}_$$_${a}`,{parentEventKeys:c,parentKeys:u}=Uy(),{prefixCls:d,activeKeys:f,disabled:h,changeActiveKeys:v,rtl:g,inlineCollapsed:b,siderCollapsed:y,onItemClick:S,selectedKeys:$,registerMenuInfo:w,unRegisterMenuInfo:C}=di(),O=HU(),x=oe(!1),I=P(()=>[...u.value,a]);w(s,{eventKey:s,key:a,parentEventKeys:c,parentKeys:u,isLeaf:!0}),et(()=>{C(s)}),ye(f,()=>{x.value=!!f.value.find(H=>H===a)},{immediate:!0});const M=P(()=>h.value||e.disabled),E=P(()=>$.value.includes(a)),A=P(()=>{const H=`${d.value}-item`;return{[`${H}`]:!0,[`${H}-danger`]:e.danger,[`${H}-active`]:x.value,[`${H}-selected`]:E.value,[`${H}-disabled`]:M.value}}),R=H=>({key:a,eventKey:s,keyPath:I.value,eventKeyPath:[...c.value,s],domEvent:H,item:m(m({},e),r)}),z=H=>{if(M.value)return;const j=R(H);o("click",H),S(j)},_=H=>{M.value||(v(I.value),o("mouseenter",H))},D=H=>{M.value||(v([]),o("mouseleave",H))},N=H=>{if(o("keydown",H),H.which===Ie.ENTER){const j=R(H);o("click",H),S(j)}},k=H=>{v(I.value),o("focus",H)},F=(H,j)=>{const Y=p("span",{class:`${d.value}-title-content`},[j]);return(!H||qt(j)&&j.type==="span")&&j&&b.value&&O&&typeof j=="string"?p("div",{class:`${d.value}-inline-collapsed-noicon`},[j.charAt(0)]):Y},L=uI(P(()=>I.value.length));return()=>{var H,j,Y,Z,X;if(l)return null;const ee=(H=e.title)!==null&&H!==void 0?H:(j=n.title)===null||j===void 0?void 0:j.call(n),U=wt((Y=n.default)===null||Y===void 0?void 0:Y.call(n)),Q=U.length;let J=ee;typeof ee>"u"?J=O&&Q?U:"":ee===!1&&(J="");const G={title:J};!y.value&&!b.value&&(G.title=null,G.open=!1);const q={};e.role==="option"&&(q["aria-selected"]=E.value);const V=(Z=e.icon)!==null&&Z!==void 0?Z:(X=n.icon)===null||X===void 0?void 0:X.call(n,e);return p(co,B(B({},G),{},{placement:g.value?"left":"right",overlayClassName:`${d.value}-inline-collapsed-tooltip`}),{default:()=>[p(ei.Item,B(B(B({component:"li"},r),{},{id:e.id,style:m(m({},r.style||{}),L.value),class:[A.value,{[`${r.class}`]:!!r.class,[`${d.value}-item-only-child`]:(V?Q+1:Q)===1}],role:e.role||"menuitem",tabindex:e.disabled?null:-1,"data-menu-id":a,"aria-disabled":e.disabled},q),{},{onMouseenter:_,onMouseleave:D,onClick:z,onKeydown:N,onFocus:k,title:typeof ee=="string"?ee:void 0}),{default:()=>[pt(typeof V=="function"?V(e.originItemValue):V,{class:`${d.value}-item-icon`},!1),F(V,U)]})]})}}}),Ri={adjustX:1,adjustY:1},KU={topLeft:{points:["bl","tl"],overflow:Ri,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:Ri,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:Ri,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:Ri,offset:[4,0]}},GU={topLeft:{points:["bl","tl"],overflow:Ri,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:Ri,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:Ri,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:Ri,offset:[4,0]}},UU={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},cw=re({compatConfig:{MODE:3},name:"PopupTrigger",inheritAttrs:!1,props:{prefixCls:String,mode:String,visible:Boolean,popupClassName:String,popupOffset:Array,disabled:Boolean,onVisibleChange:Function},slots:Object,emits:["visibleChange"],setup(e,t){let{slots:n,emit:o}=t;const r=oe(!1),{getPopupContainer:i,rtl:l,subMenuOpenDelay:a,subMenuCloseDelay:s,builtinPlacements:c,triggerSubMenuAction:u,forceSubMenuRender:d,motion:f,defaultMotions:h,rootClassName:v}=di(),g=oI(),b=P(()=>l.value?m(m({},GU),c.value):m(m({},KU),c.value)),y=P(()=>UU[e.mode]),S=oe();ye(()=>e.visible,C=>{Ze.cancel(S.value),S.value=Ze(()=>{r.value=C})},{immediate:!0}),et(()=>{Ze.cancel(S.value)});const $=C=>{o("visibleChange",C)},w=P(()=>{var C,O;const x=f.value||((C=h.value)===null||C===void 0?void 0:C[e.mode])||((O=h.value)===null||O===void 0?void 0:O.other),I=typeof x=="function"?x():x;return I?Go(I.name,{css:!0}):void 0});return()=>{const{prefixCls:C,popupClassName:O,mode:x,popupOffset:I,disabled:T}=e;return p(ql,{prefixCls:C,popupClassName:le(`${C}-popup`,{[`${C}-rtl`]:l.value},O,v.value),stretch:x==="horizontal"?"minWidth":null,getPopupContainer:i.value,builtinPlacements:b.value,popupPlacement:y.value,popupVisible:r.value,popupAlign:I&&{offset:I},action:T?[]:[u.value],mouseEnterDelay:a.value,mouseLeaveDelay:s.value,onPopupVisibleChange:$,forceRender:g||d.value,popupAnimation:w.value},{popup:n.popup,default:n.default})}}}),Yy=(e,t)=>{let{slots:n,attrs:o}=t;var r;const{prefixCls:i,mode:l}=di();return p("ul",B(B({},o),{},{class:le(i.value,`${i.value}-sub`,`${i.value}-${l.value==="inline"?"inline":"vertical"}`),"data-menu-list":!0}),[(r=n.default)===null||r===void 0?void 0:r.call(n)])};Yy.displayName="SubMenuList";const XU=re({compatConfig:{MODE:3},name:"InlineSubMenuList",inheritAttrs:!1,props:{id:String,open:Boolean,keyPath:Array},setup(e,t){let{slots:n}=t;const o=P(()=>"inline"),{motion:r,mode:i,defaultMotions:l}=di(),a=P(()=>i.value===o.value),s=ne(!a.value),c=P(()=>a.value?e.open:!1);ye(i,()=>{a.value&&(s.value=!1)},{flush:"post"});const u=P(()=>{var d,f;const h=r.value||((d=l.value)===null||d===void 0?void 0:d[o.value])||((f=l.value)===null||f===void 0?void 0:f.other),v=typeof h=="function"?h():h;return m(m({},v),{appear:e.keyPath.length<=1})});return()=>{var d;return s.value?null:p(Xf,{mode:o.value},{default:()=>[p(bn,u.value,{default:()=>[Ln(p(Yy,{id:e.id},{default:()=>[(d=n.default)===null||d===void 0?void 0:d.call(n)]}),[[Qn,c.value]])]})]})}}});let uw=0;const YU=()=>({icon:K.any,title:K.any,disabled:Boolean,level:Number,popupClassName:String,popupOffset:Array,internalPopupClose:Boolean,eventKey:String,expandIcon:Function,theme:String,onMouseenter:Function,onMouseleave:Function,onTitleClick:Function,originItemValue:Be()}),zl=re({compatConfig:{MODE:3},name:"ASubMenu",inheritAttrs:!1,props:YU(),slots:Object,setup(e,t){let{slots:n,attrs:o,emit:r}=t;var i,l;iI(!1);const a=Xy(),s=On(),c=typeof s.vnode.key=="symbol"?String(s.vnode.key):s.vnode.key;Mt(typeof s.vnode.key!="symbol","SubMenu",`SubMenu \`:key="${String(c)}"\` not support Symbol type`);const u=Pm(c)?c:`sub_menu_${++uw}_$$_not_set_key`,d=(i=e.eventKey)!==null&&i!==void 0?i:Pm(c)?`sub_menu_${++uw}_$$_${c}`:u,{parentEventKeys:f,parentInfo:h,parentKeys:v}=Uy(),g=P(()=>[...v.value,u]),b=oe([]),y={eventKey:d,key:u,parentEventKeys:f,childrenEventKeys:b,parentKeys:v};(l=h.childrenEventKeys)===null||l===void 0||l.value.push(d),et(()=>{var se;h.childrenEventKeys&&(h.childrenEventKeys.value=(se=h.childrenEventKeys)===null||se===void 0?void 0:se.value.filter(pe=>pe!=d))}),jU(d,u,y);const{prefixCls:S,activeKeys:$,disabled:w,changeActiveKeys:C,mode:O,inlineCollapsed:x,openKeys:I,overflowDisabled:T,onOpenChange:M,registerMenuInfo:E,unRegisterMenuInfo:A,selectedSubMenuKeys:R,expandIcon:z,theme:_}=di(),D=c!=null,N=!a&&(oI()||!D);zU(N),(a&&D||!a&&!D||N)&&(E(d,y),et(()=>{A(d)}));const k=P(()=>`${S.value}-submenu`),F=P(()=>w.value||e.disabled),L=oe(),H=oe(),j=P(()=>I.value.includes(u)),Y=P(()=>!T.value&&j.value),Z=P(()=>R.value.includes(u)),X=oe(!1);ye($,()=>{X.value=!!$.value.find(se=>se===u)},{immediate:!0});const ee=se=>{F.value||(r("titleClick",se,u),O.value==="inline"&&M(u,!j.value))},U=se=>{F.value||(C(g.value),r("mouseenter",se))},Q=se=>{F.value||(C([]),r("mouseleave",se))},J=uI(P(()=>g.value.length)),G=se=>{O.value!=="inline"&&M(u,se)},q=()=>{C(g.value)},V=d&&`${d}-popup`,W=P(()=>le(S.value,`${S.value}-${e.theme||_.value}`,e.popupClassName)),te=(se,pe)=>{if(!pe)return x.value&&!v.value.length&&se&&typeof se=="string"?p("div",{class:`${S.value}-inline-collapsed-noicon`},[se.charAt(0)]):p("span",{class:`${S.value}-title-content`},[se]);const he=qt(se)&&se.type==="span";return p(Le,null,[pt(typeof pe=="function"?pe(e.originItemValue):pe,{class:`${S.value}-item-icon`},!1),he?se:p("span",{class:`${S.value}-title-content`},[se])])},ue=P(()=>O.value!=="inline"&&g.value.length>1?"vertical":O.value),ie=P(()=>O.value==="horizontal"?"vertical":O.value),ae=P(()=>ue.value==="horizontal"?"vertical":ue.value),ce=()=>{var se,pe;const he=k.value,ge=(se=e.icon)!==null&&se!==void 0?se:(pe=n.icon)===null||pe===void 0?void 0:pe.call(n,e),me=e.expandIcon||n.expandIcon||z.value,xe=te(ln(n,e,"title"),ge);return p("div",{style:J.value,class:`${he}-title`,tabindex:F.value?null:-1,ref:L,title:typeof xe=="string"?xe:null,"data-menu-id":u,"aria-expanded":Y.value,"aria-haspopup":!0,"aria-controls":V,"aria-disabled":F.value,onClick:ee,onFocus:q},[xe,O.value!=="horizontal"&&me?me(m(m({},e),{isOpen:Y.value})):p("i",{class:`${he}-arrow`},null)])};return()=>{var se;if(a)return D?(se=n.default)===null||se===void 0?void 0:se.call(n):null;const pe=k.value;let he=()=>null;if(!T.value&&O.value!=="inline"){const ge=O.value==="horizontal"?[0,8]:[10,0];he=()=>p(cw,{mode:ue.value,prefixCls:pe,visible:!e.internalPopupClose&&Y.value,popupClassName:W.value,popupOffset:e.popupOffset||ge,disabled:F.value,onVisibleChange:G},{default:()=>[ce()],popup:()=>p(Xf,{mode:ae.value},{default:()=>[p(Yy,{id:V,ref:H},{default:n.default})]})})}else he=()=>p(cw,null,{default:ce});return p(Xf,{mode:ie.value},{default:()=>[p(ei.Item,B(B({component:"li"},o),{},{role:"none",class:le(pe,`${pe}-${O.value}`,o.class,{[`${pe}-open`]:Y.value,[`${pe}-active`]:X.value,[`${pe}-selected`]:Z.value,[`${pe}-disabled`]:F.value}),onMouseenter:U,onMouseleave:Q,"data-submenu-id":u}),{default:()=>p(Le,null,[he(),!T.value&&p(XU,{id:V,open:Y.value,keyPath:g.value},{default:n.default})])})]})}}});function dI(e,t){return e.classList?e.classList.contains(t):` ${e.className} `.indexOf(` ${t} `)>-1}function Yf(e,t){e.classList?e.classList.add(t):dI(e,t)||(e.className=`${e.className} ${t}`)}function qf(e,t){if(e.classList)e.classList.remove(t);else if(dI(e,t)){const n=e.className;e.className=` ${n} `.replace(` ${t} `," ")}}const ru=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"ant-motion-collapse",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{name:e,appear:t,css:!0,onBeforeEnter:n=>{n.style.height="0px",n.style.opacity="0",Yf(n,e)},onEnter:n=>{rt(()=>{n.style.height=`${n.scrollHeight}px`,n.style.opacity="1"})},onAfterEnter:n=>{n&&(qf(n,e),n.style.height=null,n.style.opacity=null)},onBeforeLeave:n=>{Yf(n,e),n.style.height=`${n.offsetHeight}px`,n.style.opacity=null},onLeave:n=>{setTimeout(()=>{n.style.height="0px",n.style.opacity="0"})},onAfterLeave:n=>{n&&(qf(n,e),n.style&&(n.style.height=null,n.style.opacity=null))}}},qU=()=>({title:K.any,originItemValue:Be()}),Nc=re({compatConfig:{MODE:3},name:"AMenuItemGroup",inheritAttrs:!1,props:qU(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r}=di(),i=P(()=>`${r.value}-item-group`),l=Xy();return()=>{var a,s;return l?(a=n.default)===null||a===void 0?void 0:a.call(n):p("li",B(B({},o),{},{onClick:c=>c.stopPropagation(),class:i.value}),[p("div",{title:typeof e.title=="string"?e.title:void 0,class:`${i.value}-title`},[ln(n,e,"title")]),p("ul",{class:`${i.value}-list`},[(s=n.default)===null||s===void 0?void 0:s.call(n)])])}}}),JU=()=>({prefixCls:String,dashed:Boolean}),kc=re({compatConfig:{MODE:3},name:"AMenuDivider",props:JU(),setup(e){const{prefixCls:t}=di(),n=P(()=>({[`${t.value}-item-divider`]:!0,[`${t.value}-item-divider-dashed`]:!!e.dashed}));return()=>p("li",{class:n.value},null)}});var ZU=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{if(o&&typeof o=="object"){const i=o,{label:l,children:a,key:s,type:c}=i,u=ZU(i,["label","children","key","type"]),d=s??`tmp-${r}`,f=n?n.parentKeys.slice():[],h=[],v={eventKey:d,key:d,parentEventKeys:ne(f),parentKeys:ne(f),childrenEventKeys:ne(h),isLeaf:!1};if(a||c==="group"){if(c==="group"){const b=t0(a,t,n);return p(Nc,B(B({key:d},u),{},{title:l,originItemValue:o}),{default:()=>[b]})}t.set(d,v),n&&n.childrenEventKeys.push(d);const g=t0(a,t,{childrenEventKeys:h,parentKeys:[].concat(f,d)});return p(zl,B(B({key:d},u),{},{title:l,originItemValue:o}),{default:()=>[g]})}return c==="divider"?p(kc,B({key:d},u),null):(v.isLeaf=!0,t.set(d,v),p(Er,B(B({key:d},u),{},{originItemValue:o}),{default:()=>[l]}))}return null}).filter(o=>o)}function QU(e){const t=oe([]),n=oe(!1),o=oe(new Map);return ye(()=>e.items,()=>{const r=new Map;n.value=!1,e.items?(n.value=!0,t.value=t0(e.items,r)):t.value=void 0,o.value=r},{immediate:!0,deep:!0}),{itemsNodes:t,store:o,hasItmes:n}}const eX=e=>{const{componentCls:t,motionDurationSlow:n,menuHorizontalHeight:o,colorSplit:r,lineWidth:i,lineType:l,menuItemPaddingInline:a}=e;return{[`${t}-horizontal`]:{lineHeight:`${o}px`,border:0,borderBottom:`${i}px ${l} ${r}`,boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},[`${t}-item, ${t}-submenu`]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:a},[`> ${t}-item:hover, + > ${t}-item-active, + > ${t}-submenu ${t}-submenu-title:hover`]:{backgroundColor:"transparent"},[`${t}-item, ${t}-submenu-title`]:{transition:[`border-color ${n}`,`background ${n}`].join(",")},[`${t}-submenu-arrow`]:{display:"none"}}}},tX=e=>{let{componentCls:t,menuArrowOffset:n}=e;return{[`${t}-rtl`]:{direction:"rtl"},[`${t}-submenu-rtl`]:{transformOrigin:"100% 0"},[`${t}-rtl${t}-vertical, + ${t}-submenu-rtl ${t}-vertical`]:{[`${t}-submenu-arrow`]:{"&::before":{transform:`rotate(-45deg) translateY(-${n})`},"&::after":{transform:`rotate(45deg) translateY(${n})`}}}}},dw=e=>m({},ni(e)),fw=(e,t)=>{const{componentCls:n,colorItemText:o,colorItemTextSelected:r,colorGroupTitle:i,colorItemBg:l,colorSubItemBg:a,colorItemBgSelected:s,colorActiveBarHeight:c,colorActiveBarWidth:u,colorActiveBarBorderSize:d,motionDurationSlow:f,motionEaseInOut:h,motionEaseOut:v,menuItemPaddingInline:g,motionDurationMid:b,colorItemTextHover:y,lineType:S,colorSplit:$,colorItemTextDisabled:w,colorDangerItemText:C,colorDangerItemTextHover:O,colorDangerItemTextSelected:x,colorDangerItemBgActive:I,colorDangerItemBgSelected:T,colorItemBgHover:M,menuSubMenuBg:E,colorItemTextSelectedHorizontal:A,colorItemBgSelectedHorizontal:R}=e;return{[`${n}-${t}`]:{color:o,background:l,[`&${n}-root:focus-visible`]:m({},dw(e)),[`${n}-item-group-title`]:{color:i},[`${n}-submenu-selected`]:{[`> ${n}-submenu-title`]:{color:r}},[`${n}-item-disabled, ${n}-submenu-disabled`]:{color:`${w} !important`},[`${n}-item:hover, ${n}-submenu-title:hover`]:{[`&:not(${n}-item-selected):not(${n}-submenu-selected)`]:{color:y}},[`&:not(${n}-horizontal)`]:{[`${n}-item:not(${n}-item-selected)`]:{"&:hover":{backgroundColor:M},"&:active":{backgroundColor:s}},[`${n}-submenu-title`]:{"&:hover":{backgroundColor:M},"&:active":{backgroundColor:s}}},[`${n}-item-danger`]:{color:C,[`&${n}-item:hover`]:{[`&:not(${n}-item-selected):not(${n}-submenu-selected)`]:{color:O}},[`&${n}-item:active`]:{background:I}},[`${n}-item a`]:{"&, &:hover":{color:"inherit"}},[`${n}-item-selected`]:{color:r,[`&${n}-item-danger`]:{color:x},"a, a:hover":{color:"inherit"}},[`& ${n}-item-selected`]:{backgroundColor:s,[`&${n}-item-danger`]:{backgroundColor:T}},[`${n}-item, ${n}-submenu-title`]:{[`&:not(${n}-item-disabled):focus-visible`]:m({},dw(e))},[`&${n}-submenu > ${n}`]:{backgroundColor:E},[`&${n}-popup > ${n}`]:{backgroundColor:l},[`&${n}-horizontal`]:m(m({},t==="dark"?{borderBottom:0}:{}),{[`> ${n}-item, > ${n}-submenu`]:{top:d,marginTop:-d,marginBottom:0,borderRadius:0,"&::after":{position:"absolute",insetInline:g,bottom:0,borderBottom:`${c}px solid transparent`,transition:`border-color ${f} ${h}`,content:'""'},"&:hover, &-active, &-open":{"&::after":{borderBottomWidth:c,borderBottomColor:A}},"&-selected":{color:A,backgroundColor:R,"&::after":{borderBottomWidth:c,borderBottomColor:A}}}}),[`&${n}-root`]:{[`&${n}-inline, &${n}-vertical`]:{borderInlineEnd:`${d}px ${S} ${$}`}},[`&${n}-inline`]:{[`${n}-sub${n}-inline`]:{background:a},[`${n}-item, ${n}-submenu-title`]:d&&u?{width:`calc(100% + ${d}px)`}:{},[`${n}-item`]:{position:"relative","&::after":{position:"absolute",insetBlock:0,insetInlineEnd:0,borderInlineEnd:`${u}px solid ${r}`,transform:"scaleY(0.0001)",opacity:0,transition:[`transform ${b} ${v}`,`opacity ${b} ${v}`].join(","),content:'""'},[`&${n}-item-danger`]:{"&::after":{borderInlineEndColor:x}}},[`${n}-selected, ${n}-item-selected`]:{"&::after":{transform:"scaleY(1)",opacity:1,transition:[`transform ${b} ${h}`,`opacity ${b} ${h}`].join(",")}}}}}},pw=e=>{const{componentCls:t,menuItemHeight:n,itemMarginInline:o,padding:r,menuArrowSize:i,marginXS:l,marginXXS:a}=e,s=r+i+l;return{[`${t}-item`]:{position:"relative"},[`${t}-item, ${t}-submenu-title`]:{height:n,lineHeight:`${n}px`,paddingInline:r,overflow:"hidden",textOverflow:"ellipsis",marginInline:o,marginBlock:a,width:`calc(100% - ${o*2}px)`},[`${t}-submenu`]:{paddingBottom:.02},[`> ${t}-item, + > ${t}-submenu > ${t}-submenu-title`]:{height:n,lineHeight:`${n}px`},[`${t}-item-group-list ${t}-submenu-title, + ${t}-submenu-title`]:{paddingInlineEnd:s}}},nX=e=>{const{componentCls:t,iconCls:n,menuItemHeight:o,colorTextLightSolid:r,dropdownWidth:i,controlHeightLG:l,motionDurationMid:a,motionEaseOut:s,paddingXL:c,fontSizeSM:u,fontSizeLG:d,motionDurationSlow:f,paddingXS:h,boxShadowSecondary:v}=e,g={height:o,lineHeight:`${o}px`,listStylePosition:"inside",listStyleType:"disc"};return[{[t]:{"&-inline, &-vertical":m({[`&${t}-root`]:{boxShadow:"none"}},pw(e))},[`${t}-submenu-popup`]:{[`${t}-vertical`]:m(m({},pw(e)),{boxShadow:v})}},{[`${t}-submenu-popup ${t}-vertical${t}-sub`]:{minWidth:i,maxHeight:`calc(100vh - ${l*2.5}px)`,padding:"0",overflow:"hidden",borderInlineEnd:0,"&:not([class*='-active'])":{overflowX:"hidden",overflowY:"auto"}}},{[`${t}-inline`]:{width:"100%",[`&${t}-root`]:{[`${t}-item, ${t}-submenu-title`]:{display:"flex",alignItems:"center",transition:[`border-color ${f}`,`background ${f}`,`padding ${a} ${s}`].join(","),[`> ${t}-title-content`]:{flex:"auto",minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},"> *":{flex:"none"}}},[`${t}-sub${t}-inline`]:{padding:0,border:0,borderRadius:0,boxShadow:"none",[`& > ${t}-submenu > ${t}-submenu-title`]:g,[`& ${t}-item-group-title`]:{paddingInlineStart:c}},[`${t}-item`]:g}},{[`${t}-inline-collapsed`]:{width:o*2,[`&${t}-root`]:{[`${t}-item, ${t}-submenu ${t}-submenu-title`]:{[`> ${t}-inline-collapsed-noicon`]:{fontSize:d,textAlign:"center"}}},[`> ${t}-item, + > ${t}-item-group > ${t}-item-group-list > ${t}-item, + > ${t}-item-group > ${t}-item-group-list > ${t}-submenu > ${t}-submenu-title, + > ${t}-submenu > ${t}-submenu-title`]:{insetInlineStart:0,paddingInline:`calc(50% - ${u}px)`,textOverflow:"clip",[` + ${t}-submenu-arrow, + ${t}-submenu-expand-icon + `]:{opacity:0},[`${t}-item-icon, ${n}`]:{margin:0,fontSize:d,lineHeight:`${o}px`,"+ span":{display:"inline-block",opacity:0}}},[`${t}-item-icon, ${n}`]:{display:"inline-block"},"&-tooltip":{pointerEvents:"none",[`${t}-item-icon, ${n}`]:{display:"none"},"a, a:hover":{color:r}},[`${t}-item-group-title`]:m(m({},Jt),{paddingInline:h})}}]},hw=e=>{const{componentCls:t,fontSize:n,motionDurationSlow:o,motionDurationMid:r,motionEaseInOut:i,motionEaseOut:l,iconCls:a,controlHeightSM:s}=e;return{[`${t}-item, ${t}-submenu-title`]:{position:"relative",display:"block",margin:0,whiteSpace:"nowrap",cursor:"pointer",transition:[`border-color ${o}`,`background ${o}`,`padding ${o} ${i}`].join(","),[`${t}-item-icon, ${a}`]:{minWidth:n,fontSize:n,transition:[`font-size ${r} ${l}`,`margin ${o} ${i}`,`color ${o}`].join(","),"+ span":{marginInlineStart:s-n,opacity:1,transition:[`opacity ${o} ${i}`,`margin ${o}`,`color ${o}`].join(",")}},[`${t}-item-icon`]:m({},Kl()),[`&${t}-item-only-child`]:{[`> ${a}, > ${t}-item-icon`]:{marginInlineEnd:0}}},[`${t}-item-disabled, ${t}-submenu-disabled`]:{background:"none !important",cursor:"not-allowed","&::after":{borderColor:"transparent !important"},a:{color:"inherit !important"},[`> ${t}-submenu-title`]:{color:"inherit !important",cursor:"not-allowed"}}}},gw=e=>{const{componentCls:t,motionDurationSlow:n,motionEaseInOut:o,borderRadius:r,menuArrowSize:i,menuArrowOffset:l}=e;return{[`${t}-submenu`]:{"&-expand-icon, &-arrow":{position:"absolute",top:"50%",insetInlineEnd:e.margin,width:i,color:"currentcolor",transform:"translateY(-50%)",transition:`transform ${n} ${o}, opacity ${n}`},"&-arrow":{"&::before, &::after":{position:"absolute",width:i*.6,height:i*.15,backgroundColor:"currentcolor",borderRadius:r,transition:[`background ${n} ${o}`,`transform ${n} ${o}`,`top ${n} ${o}`,`color ${n} ${o}`].join(","),content:'""'},"&::before":{transform:`rotate(45deg) translateY(-${l})`},"&::after":{transform:`rotate(-45deg) translateY(${l})`}}}}},oX=e=>{const{antCls:t,componentCls:n,fontSize:o,motionDurationSlow:r,motionDurationMid:i,motionEaseInOut:l,lineHeight:a,paddingXS:s,padding:c,colorSplit:u,lineWidth:d,zIndexPopup:f,borderRadiusLG:h,radiusSubMenuItem:v,menuArrowSize:g,menuArrowOffset:b,lineType:y,menuPanelMaskInset:S}=e;return[{"":{[`${n}`]:m(m({},lr()),{"&-hidden":{display:"none"}})},[`${n}-submenu-hidden`]:{display:"none"}},{[n]:m(m(m(m(m(m(m({},qe(e)),lr()),{marginBottom:0,paddingInlineStart:0,fontSize:o,lineHeight:0,listStyle:"none",outline:"none",transition:`width ${r} cubic-bezier(0.2, 0, 0, 1) 0s`,"ul, ol":{margin:0,padding:0,listStyle:"none"},"&-overflow":{display:"flex",[`${n}-item`]:{flex:"none"}},[`${n}-item, ${n}-submenu, ${n}-submenu-title`]:{borderRadius:e.radiusItem},[`${n}-item-group-title`]:{padding:`${s}px ${c}px`,fontSize:o,lineHeight:a,transition:`all ${r}`},[`&-horizontal ${n}-submenu`]:{transition:[`border-color ${r} ${l}`,`background ${r} ${l}`].join(",")},[`${n}-submenu, ${n}-submenu-inline`]:{transition:[`border-color ${r} ${l}`,`background ${r} ${l}`,`padding ${i} ${l}`].join(",")},[`${n}-submenu ${n}-sub`]:{cursor:"initial",transition:[`background ${r} ${l}`,`padding ${r} ${l}`].join(",")},[`${n}-title-content`]:{transition:`color ${r}`},[`${n}-item a`]:{"&::before":{position:"absolute",inset:0,backgroundColor:"transparent",content:'""'}},[`${n}-item-divider`]:{overflow:"hidden",lineHeight:0,borderColor:u,borderStyle:y,borderWidth:0,borderTopWidth:d,marginBlock:d,padding:0,"&-dashed":{borderStyle:"dashed"}}}),hw(e)),{[`${n}-item-group`]:{[`${n}-item-group-list`]:{margin:0,padding:0,[`${n}-item, ${n}-submenu-title`]:{paddingInline:`${o*2}px ${c}px`}}},"&-submenu":{"&-popup":{position:"absolute",zIndex:f,background:"transparent",borderRadius:h,boxShadow:"none",transformOrigin:"0 0","&::before":{position:"absolute",inset:`${S}px 0 0`,zIndex:-1,width:"100%",height:"100%",opacity:0,content:'""'}},"&-placement-rightTop::before":{top:0,insetInlineStart:S},[`> ${n}`]:m(m(m({borderRadius:h},hw(e)),gw(e)),{[`${n}-item, ${n}-submenu > ${n}-submenu-title`]:{borderRadius:v},[`${n}-submenu-title::after`]:{transition:`transform ${r} ${l}`}})}}),gw(e)),{[`&-inline-collapsed ${n}-submenu-arrow, + &-inline ${n}-submenu-arrow`]:{"&::before":{transform:`rotate(-45deg) translateX(${b})`},"&::after":{transform:`rotate(45deg) translateX(-${b})`}},[`${n}-submenu-open${n}-submenu-inline > ${n}-submenu-title > ${n}-submenu-arrow`]:{transform:`translateY(-${g*.2}px)`,"&::after":{transform:`rotate(-45deg) translateX(-${b})`},"&::before":{transform:`rotate(45deg) translateX(${b})`}}})},{[`${t}-layout-header`]:{[n]:{lineHeight:"inherit"}}}]},rX=(e,t)=>Ue("Menu",(o,r)=>{let{overrideComponentToken:i}=r;if((t==null?void 0:t.value)===!1)return[];const{colorBgElevated:l,colorPrimary:a,colorError:s,colorErrorHover:c,colorTextLightSolid:u}=o,{controlHeightLG:d,fontSize:f}=o,h=f/7*5,v=ze(o,{menuItemHeight:d,menuItemPaddingInline:o.margin,menuArrowSize:h,menuHorizontalHeight:d*1.15,menuArrowOffset:`${h*.25}px`,menuPanelMaskInset:-7,menuSubMenuBg:l}),g=new vt(u).setAlpha(.65).toRgbString(),b=ze(v,{colorItemText:g,colorItemTextHover:u,colorGroupTitle:g,colorItemTextSelected:u,colorItemBg:"#001529",colorSubItemBg:"#000c17",colorItemBgActive:"transparent",colorItemBgSelected:a,colorActiveBarWidth:0,colorActiveBarHeight:0,colorActiveBarBorderSize:0,colorItemTextDisabled:new vt(u).setAlpha(.25).toRgbString(),colorDangerItemText:s,colorDangerItemTextHover:c,colorDangerItemTextSelected:u,colorDangerItemBgActive:s,colorDangerItemBgSelected:s,menuSubMenuBg:"#001529",colorItemTextSelectedHorizontal:u,colorItemBgSelectedHorizontal:a},m({},i));return[oX(v),eX(v),nX(v),fw(v,"light"),fw(b,"dark"),tX(v),nu(v),Rr(v,"slide-up"),Rr(v,"slide-down"),ds(v,"zoom-big")]},o=>{const{colorPrimary:r,colorError:i,colorTextDisabled:l,colorErrorBg:a,colorText:s,colorTextDescription:c,colorBgContainer:u,colorFillAlter:d,colorFillContent:f,lineWidth:h,lineWidthBold:v,controlItemBgActive:g,colorBgTextHover:b}=o;return{dropdownWidth:160,zIndexPopup:o.zIndexPopupBase+50,radiusItem:o.borderRadiusLG,radiusSubMenuItem:o.borderRadiusSM,colorItemText:s,colorItemTextHover:s,colorItemTextHoverHorizontal:r,colorGroupTitle:c,colorItemTextSelected:r,colorItemTextSelectedHorizontal:r,colorItemBg:u,colorItemBgHover:b,colorItemBgActive:f,colorSubItemBg:d,colorItemBgSelected:g,colorItemBgSelectedHorizontal:"transparent",colorActiveBarWidth:0,colorActiveBarHeight:v,colorActiveBarBorderSize:h,colorItemTextDisabled:l,colorDangerItemText:i,colorDangerItemTextHover:i,colorDangerItemTextSelected:i,colorDangerItemBgActive:a,colorDangerItemBgSelected:a,itemMarginInline:o.marginXXS}})(e),iX=()=>({id:String,prefixCls:String,items:Array,disabled:Boolean,inlineCollapsed:Boolean,disabledOverflow:Boolean,forceSubMenuRender:Boolean,openKeys:Array,selectedKeys:Array,activeKey:String,selectable:{type:Boolean,default:!0},multiple:{type:Boolean,default:!1},tabindex:{type:[Number,String]},motion:Object,role:String,theme:{type:String,default:"light"},mode:{type:String,default:"vertical"},inlineIndent:{type:Number,default:24},subMenuOpenDelay:{type:Number,default:0},subMenuCloseDelay:{type:Number,default:.1},builtinPlacements:{type:Object},triggerSubMenuAction:{type:String,default:"hover"},getPopupContainer:Function,expandIcon:Function,onOpenChange:Function,onSelect:Function,onDeselect:Function,onClick:[Function,Array],onFocus:Function,onBlur:Function,onMousedown:Function,"onUpdate:openKeys":Function,"onUpdate:selectedKeys":Function,"onUpdate:activeKey":Function}),vw=[],Xt=re({compatConfig:{MODE:3},name:"AMenu",inheritAttrs:!1,props:iX(),slots:Object,setup(e,t){let{slots:n,emit:o,attrs:r}=t;const{direction:i,getPrefixCls:l}=Ee("menu",e),a=Q5(),s=P(()=>{var U;return l("menu",e.prefixCls||((U=a==null?void 0:a.prefixCls)===null||U===void 0?void 0:U.value))}),[c,u]=rX(s,P(()=>!a)),d=oe(new Map),f=Ge(lI,ne(void 0)),h=P(()=>f.value!==void 0?f.value:e.inlineCollapsed),{itemsNodes:v}=QU(e),g=oe(!1);Ke(()=>{g.value=!0}),Ve(()=>{Mt(!(e.inlineCollapsed===!0&&e.mode!=="inline"),"Menu","`inlineCollapsed` should only be used when `mode` is inline."),Mt(!(f.value!==void 0&&e.inlineCollapsed===!0),"Menu","`inlineCollapsed` not control Menu under Sider. Should set `collapsed` on Sider instead.")});const b=ne([]),y=ne([]),S=ne({});ye(d,()=>{const U={};for(const Q of d.value.values())U[Q.key]=Q;S.value=U},{flush:"post"}),Ve(()=>{if(e.activeKey!==void 0){let U=[];const Q=e.activeKey?S.value[e.activeKey]:void 0;Q&&e.activeKey!==void 0?U=av([].concat(je(Q.parentKeys),e.activeKey)):U=[],ma(b.value,U)||(b.value=U)}}),ye(()=>e.selectedKeys,U=>{U&&(y.value=U.slice())},{immediate:!0,deep:!0});const $=ne([]);ye([S,y],()=>{let U=[];y.value.forEach(Q=>{const J=S.value[Q];J&&(U=U.concat(je(J.parentKeys)))}),U=av(U),ma($.value,U)||($.value=U)},{immediate:!0});const w=U=>{if(e.selectable){const{key:Q}=U,J=y.value.includes(Q);let G;e.multiple?J?G=y.value.filter(V=>V!==Q):G=[...y.value,Q]:G=[Q];const q=m(m({},U),{selectedKeys:G});ma(G,y.value)||(e.selectedKeys===void 0&&(y.value=G),o("update:selectedKeys",G),J&&e.multiple?o("deselect",q):o("select",q))}M.value!=="inline"&&!e.multiple&&C.value.length&&R(vw)},C=ne([]);ye(()=>e.openKeys,function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:C.value;ma(C.value,U)||(C.value=U.slice())},{immediate:!0,deep:!0});let O;const x=U=>{clearTimeout(O),O=setTimeout(()=>{e.activeKey===void 0&&(b.value=U),o("update:activeKey",U[U.length-1])})},I=P(()=>!!e.disabled),T=P(()=>i.value==="rtl"),M=ne("vertical"),E=oe(!1);Ve(()=>{var U;(e.mode==="inline"||e.mode==="vertical")&&h.value?(M.value="vertical",E.value=h.value):(M.value=e.mode,E.value=!1),!((U=a==null?void 0:a.mode)===null||U===void 0)&&U.value&&(M.value=a.mode.value)});const A=P(()=>M.value==="inline"),R=U=>{C.value=U,o("update:openKeys",U),o("openChange",U)},z=ne(C.value),_=oe(!1);ye(C,()=>{A.value&&(z.value=C.value)},{immediate:!0}),ye(A,()=>{if(!_.value){_.value=!0;return}A.value?C.value=z.value:R(vw)},{immediate:!0});const D=P(()=>({[`${s.value}`]:!0,[`${s.value}-root`]:!0,[`${s.value}-${M.value}`]:!0,[`${s.value}-inline-collapsed`]:E.value,[`${s.value}-rtl`]:T.value,[`${s.value}-${e.theme}`]:!0})),N=P(()=>l()),k=P(()=>({horizontal:{name:`${N.value}-slide-up`},inline:ru(`${N.value}-motion-collapse`),other:{name:`${N.value}-zoom-big`}}));iI(!0);const F=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const Q=[],J=d.value;return U.forEach(G=>{const{key:q,childrenEventKeys:V}=J.get(G);Q.push(q,...F(je(V)))}),Q},L=U=>{var Q;o("click",U),w(U),(Q=a==null?void 0:a.onClick)===null||Q===void 0||Q.call(a)},H=(U,Q)=>{var J;const G=((J=S.value[U])===null||J===void 0?void 0:J.childrenEventKeys)||[];let q=C.value.filter(V=>V!==U);if(Q)q.push(U);else if(M.value!=="inline"){const V=F(je(G));q=av(q.filter(W=>!V.includes(W)))}ma(C,q)||R(q)},j=(U,Q)=>{d.value.set(U,Q),d.value=new Map(d.value)},Y=U=>{d.value.delete(U),d.value=new Map(d.value)},Z=ne(0),X=P(()=>{var U;return e.expandIcon||n.expandIcon||!((U=a==null?void 0:a.expandIcon)===null||U===void 0)&&U.value?Q=>{let J=e.expandIcon||n.expandIcon;return J=typeof J=="function"?J(Q):J,pt(J,{class:`${s.value}-submenu-expand-icon`},!1)}:null});tI({prefixCls:s,activeKeys:b,openKeys:C,selectedKeys:y,changeActiveKeys:x,disabled:I,rtl:T,mode:M,inlineIndent:P(()=>e.inlineIndent),subMenuCloseDelay:P(()=>e.subMenuCloseDelay),subMenuOpenDelay:P(()=>e.subMenuOpenDelay),builtinPlacements:P(()=>e.builtinPlacements),triggerSubMenuAction:P(()=>e.triggerSubMenuAction),getPopupContainer:P(()=>e.getPopupContainer),inlineCollapsed:E,theme:P(()=>e.theme),siderCollapsed:f,defaultMotions:P(()=>g.value?k.value:null),motion:P(()=>g.value?e.motion:null),overflowDisabled:oe(void 0),onOpenChange:H,onItemClick:L,registerMenuInfo:j,unRegisterMenuInfo:Y,selectedSubMenuKeys:$,expandIcon:X,forceSubMenuRender:P(()=>e.forceSubMenuRender),rootClassName:u});const ee=()=>{var U;return v.value||wt((U=n.default)===null||U===void 0?void 0:U.call(n))};return()=>{var U;const Q=ee(),J=Z.value>=Q.length-1||M.value!=="horizontal"||e.disabledOverflow,G=V=>M.value!=="horizontal"||e.disabledOverflow?V:V.map((W,te)=>p(Xf,{key:W.key,overflowDisabled:te>Z.value},{default:()=>W})),q=((U=n.overflowedIndicator)===null||U===void 0?void 0:U.call(n))||p(ou,null,null);return c(p(ei,B(B({},r),{},{onMousedown:e.onMousedown,prefixCls:`${s.value}-overflow`,component:"ul",itemComponent:Er,class:[D.value,r.class,u.value],role:"menu",id:e.id,data:G(Q),renderRawItem:V=>V,renderRawRest:V=>{const W=V.length,te=W?Q.slice(-W):null;return p(Le,null,[p(zl,{eventKey:Gu,key:Gu,title:q,disabled:J,internalPopupClose:W===0},{default:()=>te}),p(sw,null,{default:()=>[p(zl,{eventKey:Gu,key:Gu,title:q,disabled:J,internalPopupClose:W===0},{default:()=>te})]})])},maxCount:M.value!=="horizontal"||e.disabledOverflow?ei.INVALIDATE:ei.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:V=>{Z.value=V}}),{default:()=>[p(yb,{to:"body"},{default:()=>[p("div",{style:{display:"none"},"aria-hidden":!0},[p(sw,null,{default:()=>[G(ee())]})])]})]}))}}});Xt.install=function(e){return e.component(Xt.name,Xt),e.component(Er.name,Er),e.component(zl.name,zl),e.component(kc.name,kc),e.component(Nc.name,Nc),e};Xt.Item=Er;Xt.Divider=kc;Xt.SubMenu=zl;Xt.ItemGroup=Nc;const lX=e=>{const{componentCls:t,iconCls:n}=e;return{[t]:m(m({},qe(e)),{color:e.breadcrumbBaseColor,fontSize:e.breadcrumbFontSize,[n]:{fontSize:e.breadcrumbIconFontSize},ol:{display:"flex",flexWrap:"wrap",margin:0,padding:0,listStyle:"none"},a:m({color:e.breadcrumbLinkColor,transition:`color ${e.motionDurationMid}`,padding:`0 ${e.paddingXXS}px`,borderRadius:e.borderRadiusSM,height:e.lineHeight*e.fontSize,display:"inline-block",marginInline:-e.marginXXS,"&:hover":{color:e.breadcrumbLinkColorHover,backgroundColor:e.colorBgTextHover}},oi(e)),"li:last-child":{color:e.breadcrumbLastItemColor,[`& > ${t}-separator`]:{display:"none"}},[`${t}-separator`]:{marginInline:e.breadcrumbSeparatorMargin,color:e.breadcrumbSeparatorColor},[`${t}-link`]:{[` + > ${n} + span, + > ${n} + a + `]:{marginInlineStart:e.marginXXS}},[`${t}-overlay-link`]:{borderRadius:e.borderRadiusSM,height:e.lineHeight*e.fontSize,display:"inline-block",padding:`0 ${e.paddingXXS}px`,marginInline:-e.marginXXS,[`> ${n}`]:{marginInlineStart:e.marginXXS,fontSize:e.fontSizeIcon},"&:hover":{color:e.breadcrumbLinkColorHover,backgroundColor:e.colorBgTextHover,a:{color:e.breadcrumbLinkColorHover}},a:{"&:hover":{backgroundColor:"transparent"}}},[`&${e.componentCls}-rtl`]:{direction:"rtl"}})}},aX=Ue("Breadcrumb",e=>{const t=ze(e,{breadcrumbBaseColor:e.colorTextDescription,breadcrumbFontSize:e.fontSize,breadcrumbIconFontSize:e.fontSize,breadcrumbLinkColor:e.colorTextDescription,breadcrumbLinkColorHover:e.colorText,breadcrumbLastItemColor:e.colorText,breadcrumbSeparatorMargin:e.marginXS,breadcrumbSeparatorColor:e.colorTextDescription});return[lX(t)]}),sX=()=>({prefixCls:String,routes:{type:Array},params:K.any,separator:K.any,itemRender:{type:Function}});function cX(e,t){if(!e.breadcrumbName)return null;const n=Object.keys(t).join("|");return e.breadcrumbName.replace(new RegExp(`:(${n})`,"g"),(r,i)=>t[i]||r)}function mw(e){const{route:t,params:n,routes:o,paths:r}=e,i=o.indexOf(t)===o.length-1,l=cX(t,n);return i?p("span",null,[l]):p("a",{href:`#/${r.join("/")}`},[l])}const Tl=re({compatConfig:{MODE:3},name:"ABreadcrumb",inheritAttrs:!1,props:sX(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("breadcrumb",e),[l,a]=aX(r),s=(d,f)=>(d=(d||"").replace(/^\//,""),Object.keys(f).forEach(h=>{d=d.replace(`:${h}`,f[h])}),d),c=(d,f,h)=>{const v=[...d],g=s(f||"",h);return g&&v.push(g),v},u=d=>{let{routes:f=[],params:h={},separator:v,itemRender:g=mw}=d;const b=[];return f.map(y=>{const S=s(y.path,h);S&&b.push(S);const $=[...b];let w=null;y.children&&y.children.length&&(w=p(Xt,{items:y.children.map(O=>({key:O.path||O.breadcrumbName,label:g({route:O,params:h,routes:f,paths:c($,O.path,h)})}))},null));const C={separator:v};return w&&(C.overlay=w),p(Bc,B(B({},C),{},{key:S||y.breadcrumbName}),{default:()=>[g({route:y,params:h,routes:f,paths:$})]})})};return()=>{var d;let f;const{routes:h,params:v={}}=e,g=wt(ln(n,e)),b=(d=ln(n,e,"separator"))!==null&&d!==void 0?d:"/",y=e.itemRender||n.itemRender||mw;h&&h.length>0?f=u({routes:h,params:v,separator:b,itemRender:y}):g.length&&(f=g.map(($,w)=>(Po(typeof $.type=="object"&&($.type.__ANT_BREADCRUMB_ITEM||$.type.__ANT_BREADCRUMB_SEPARATOR)),mn($,{separator:b,key:w}))));const S={[r.value]:!0,[`${r.value}-rtl`]:i.value==="rtl",[`${o.class}`]:!!o.class,[a.value]:!0};return l(p("nav",B(B({},o),{},{class:S}),[p("ol",null,[f])]))}}});var uX=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefixCls:String}),Jf=re({compatConfig:{MODE:3},name:"ABreadcrumbSeparator",__ANT_BREADCRUMB_SEPARATOR:!0,inheritAttrs:!1,props:dX(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r}=Ee("breadcrumb",e);return()=>{var i;const{separator:l,class:a}=o,s=uX(o,["separator","class"]),c=wt((i=n.default)===null||i===void 0?void 0:i.call(n));return p("span",B({class:[`${r.value}-separator`,a]},s),[c.length>0?c:"/"])}}});Tl.Item=Bc;Tl.Separator=Jf;Tl.install=function(e){return e.component(Tl.name,Tl),e.component(Bc.name,Bc),e.component(Jf.name,Jf),e};function Ji(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xd={exports:{}},fX=xd.exports,bw;function pX(){return bw||(bw=1,function(e,t){(function(n,o){e.exports=o()})(fX,function(){var n=1e3,o=6e4,r=36e5,i="millisecond",l="second",a="minute",s="hour",c="day",u="week",d="month",f="quarter",h="year",v="date",g="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,S={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var _=["th","st","nd","rd"],D=z%100;return"["+z+(_[(D-20)%10]||_[D]||_[0])+"]"}},$=function(z,_,D){var N=String(z);return!N||N.length>=_?z:""+Array(_+1-N.length).join(D)+z},w={s:$,z:function(z){var _=-z.utcOffset(),D=Math.abs(_),N=Math.floor(D/60),k=D%60;return(_<=0?"+":"-")+$(N,2,"0")+":"+$(k,2,"0")},m:function z(_,D){if(_.date()1)return z(L[0])}else{var H=_.name;O[H]=_,k=H}return!N&&k&&(C=k),k||!N&&C},M=function(z,_){if(I(z))return z.clone();var D=typeof _=="object"?_:{};return D.date=z,D.args=arguments,new A(D)},E=w;E.l=T,E.i=I,E.w=function(z,_){return M(z,{locale:_.$L,utc:_.$u,x:_.$x,$offset:_.$offset})};var A=function(){function z(D){this.$L=T(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[x]=!0}var _=z.prototype;return _.parse=function(D){this.$d=function(N){var k=N.date,F=N.utc;if(k===null)return new Date(NaN);if(E.u(k))return new Date;if(k instanceof Date)return new Date(k);if(typeof k=="string"&&!/Z$/i.test(k)){var L=k.match(b);if(L){var H=L[2]-1||0,j=(L[7]||"0").substring(0,3);return F?new Date(Date.UTC(L[1],H,L[3]||1,L[4]||0,L[5]||0,L[6]||0,j)):new Date(L[1],H,L[3]||1,L[4]||0,L[5]||0,L[6]||0,j)}}return new Date(k)}(D),this.init()},_.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},_.$utils=function(){return E},_.isValid=function(){return this.$d.toString()!==g},_.isSame=function(D,N){var k=M(D);return this.startOf(N)<=k&&k<=this.endOf(N)},_.isAfter=function(D,N){return M(D)25){var u=l(this).startOf(o).add(1,o).date(c),d=l(this).endOf(n);if(u.isBefore(d))return 1}var f=l(this).startOf(o).date(c).startOf(n).subtract(1,"millisecond"),h=this.diff(f,n,!0);return h<0?l(this).startOf("week").week():Math.ceil(h)},a.weeks=function(s){return s===void 0&&(s=null),this.week(s)}}})}(Pd)),Pd.exports}var OX=wX();const PX=Ji(OX);var Id={exports:{}},IX=Id.exports,Cw;function TX(){return Cw||(Cw=1,function(e,t){(function(n,o){e.exports=o()})(IX,function(){return function(n,o){o.prototype.weekYear=function(){var r=this.month(),i=this.week(),l=this.year();return i===1&&r===11?l+1:r===0&&i>=52?l-1:l}}})}(Id)),Id.exports}var EX=TX();const _X=Ji(EX);var Td={exports:{}},MX=Td.exports,xw;function AX(){return xw||(xw=1,function(e,t){(function(n,o){e.exports=o()})(MX,function(){var n="month",o="quarter";return function(r,i){var l=i.prototype;l.quarter=function(c){return this.$utils().u(c)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(c-1))};var a=l.add;l.add=function(c,u){return c=Number(c),this.$utils().p(u)===o?this.add(3*c,n):a.bind(this)(c,u)};var s=l.startOf;l.startOf=function(c,u){var d=this.$utils(),f=!!d.u(u)||u;if(d.p(c)===o){var h=this.quarter()-1;return f?this.month(3*h).startOf(n).startOf("day"):this.month(3*h+2).endOf(n).endOf("day")}return s.bind(this)(c,u)}}})}(Td)),Td.exports}var RX=AX();const DX=Ji(RX);var Ed={exports:{}},BX=Ed.exports,ww;function NX(){return ww||(ww=1,function(e,t){(function(n,o){e.exports=o()})(BX,function(){return function(n,o){var r=o.prototype,i=r.format;r.format=function(l){var a=this,s=this.$locale();if(!this.isValid())return i.bind(this)(l);var c=this.$utils(),u=(l||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(d){switch(d){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return s.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return s.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),d==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return d}});return i.bind(this)(u)}}})}(Ed)),Ed.exports}var kX=NX();const FX=Ji(kX);var _d={exports:{}},LX=_d.exports,Ow;function zX(){return Ow||(Ow=1,function(e,t){(function(n,o){e.exports=o()})(LX,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},o=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,i=/\d\d/,l=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,s={},c=function(b){return(b=+b)+(b>68?1900:2e3)},u=function(b){return function(y){this[b]=+y}},d=[/[+-]\d\d:?(\d\d)?|Z/,function(b){(this.zone||(this.zone={})).offset=function(y){if(!y||y==="Z")return 0;var S=y.match(/([+-]|\d\d)/g),$=60*S[1]+(+S[2]||0);return $===0?0:S[0]==="+"?-$:$}(b)}],f=function(b){var y=s[b];return y&&(y.indexOf?y:y.s.concat(y.f))},h=function(b,y){var S,$=s.meridiem;if($){for(var w=1;w<=24;w+=1)if(b.indexOf($(w,0,y))>-1){S=w>12;break}}else S=b===(y?"pm":"PM");return S},v={A:[a,function(b){this.afternoon=h(b,!1)}],a:[a,function(b){this.afternoon=h(b,!0)}],Q:[r,function(b){this.month=3*(b-1)+1}],S:[r,function(b){this.milliseconds=100*+b}],SS:[i,function(b){this.milliseconds=10*+b}],SSS:[/\d{3}/,function(b){this.milliseconds=+b}],s:[l,u("seconds")],ss:[l,u("seconds")],m:[l,u("minutes")],mm:[l,u("minutes")],H:[l,u("hours")],h:[l,u("hours")],HH:[l,u("hours")],hh:[l,u("hours")],D:[l,u("day")],DD:[i,u("day")],Do:[a,function(b){var y=s.ordinal,S=b.match(/\d+/);if(this.day=S[0],y)for(var $=1;$<=31;$+=1)y($).replace(/\[|\]/g,"")===b&&(this.day=$)}],w:[l,u("week")],ww:[i,u("week")],M:[l,u("month")],MM:[i,u("month")],MMM:[a,function(b){var y=f("months"),S=(f("monthsShort")||y.map(function($){return $.slice(0,3)})).indexOf(b)+1;if(S<1)throw new Error;this.month=S%12||S}],MMMM:[a,function(b){var y=f("months").indexOf(b)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(b){this.year=c(b)}],YYYY:[/\d{4}/,u("year")],Z:d,ZZ:d};function g(b){var y,S;y=b,S=s&&s.formats;for(var $=(b=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(M,E,A){var R=A&&A.toUpperCase();return E||S[A]||n[A]||S[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(z,_,D){return _||D.slice(1)})})).match(o),w=$.length,C=0;C-1)return new Date((k==="X"?1e3:1)*N);var H=g(k)(N),j=H.year,Y=H.month,Z=H.day,X=H.hours,ee=H.minutes,U=H.seconds,Q=H.milliseconds,J=H.zone,G=H.week,q=new Date,V=Z||(j||Y?1:q.getDate()),W=j||q.getFullYear(),te=0;j&&!Y||(te=Y>0?Y-1:q.getMonth());var ue,ie=X||0,ae=ee||0,ce=U||0,se=Q||0;return J?new Date(Date.UTC(W,te,V,ie,ae,ce,se+60*J.offset*1e3)):F?new Date(Date.UTC(W,te,V,ie,ae,ce,se)):(ue=new Date(W,te,V,ie,ae,ce,se),G&&(ue=L(ue).week(G).toDate()),ue)}catch{return new Date("")}}(O,T,x,S),this.init(),R&&R!==!0&&(this.$L=this.locale(R).$L),A&&O!=this.format(T)&&(this.$d=new Date("")),s={}}else if(T instanceof Array)for(var z=T.length,_=1;_<=z;_+=1){I[1]=T[_-1];var D=S.apply(this,I);if(D.isValid()){this.$d=D.$d,this.$L=D.$L,this.init();break}_===z&&(this.$d=new Date(""))}else w.call(this,C)}}})}(_d)),_d.exports}var HX=zX();const jX=Ji(HX);gn.extend(jX);gn.extend(FX);gn.extend(bX);gn.extend(CX);gn.extend(PX);gn.extend(_X);gn.extend(DX);gn.extend((e,t)=>{const n=t.prototype,o=n.format;n.format=function(i){const l=(i||"").replace("Wo","wo");return o.bind(this)(l)}});const VX={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},ll=e=>VX[e]||e.split("_")[0],Pw=()=>{qR(!1,"Not match any format. Please help to fire a issue about this.")},WX=/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|k{1,2}|S/g;function Iw(e,t,n){const o=[...new Set(e.split(n))];let r=0;for(let i=0;it)return l;r+=n.length}}const Tw=(e,t)=>{if(!e)return null;if(gn.isDayjs(e))return e;const n=t.matchAll(WX);let o=gn(e,t);if(n===null)return o;for(const r of n){const i=r[0],l=r.index;if(i==="Q"){const a=e.slice(l-1,l),s=Iw(e,l,a).match(/\d+/)[0];o=o.quarter(parseInt(s))}if(i.toLowerCase()==="wo"){const a=e.slice(l-1,l),s=Iw(e,l,a).match(/\d+/)[0];o=o.week(parseInt(s))}i.toLowerCase()==="ww"&&(o=o.week(parseInt(e.slice(l,l+i.length)))),i.toLowerCase()==="w"&&(o=o.week(parseInt(e.slice(l,l+i.length+1))))}return o},qy={getNow:()=>gn(),getFixedDate:e=>gn(e,["YYYY-M-DD","YYYY-MM-DD"]),getEndDate:e=>e.endOf("month"),getWeekDay:e=>{const t=e.locale("en");return t.weekday()+t.localeData().firstDayOfWeek()},getYear:e=>e.year(),getMonth:e=>e.month(),getDate:e=>e.date(),getHour:e=>e.hour(),getMinute:e=>e.minute(),getSecond:e=>e.second(),addYear:(e,t)=>e.add(t,"year"),addMonth:(e,t)=>e.add(t,"month"),addDate:(e,t)=>e.add(t,"day"),setYear:(e,t)=>e.year(t),setMonth:(e,t)=>e.month(t),setDate:(e,t)=>e.date(t),setHour:(e,t)=>e.hour(t),setMinute:(e,t)=>e.minute(t),setSecond:(e,t)=>e.second(t),isAfter:(e,t)=>e.isAfter(t),isValidate:e=>e.isValid(),locale:{getWeekFirstDay:e=>gn().locale(ll(e)).localeData().firstDayOfWeek(),getWeekFirstDate:(e,t)=>t.locale(ll(e)).weekday(0),getWeek:(e,t)=>t.locale(ll(e)).week(),getShortWeekDays:e=>gn().locale(ll(e)).localeData().weekdaysMin(),getShortMonths:e=>gn().locale(ll(e)).localeData().monthsShort(),format:(e,t,n)=>t.locale(ll(e)).format(n),parse:(e,t,n)=>{const o=ll(e);for(let r=0;rArray.isArray(e)?e.map(n=>Tw(n,t)):Tw(e,t),toString:(e,t)=>Array.isArray(e)?e.map(n=>gn.isDayjs(n)?n.format(t):n):gn.isDayjs(e)?e.format(t):e};function Qt(e){const t=$A();return m(m({},e),t)}const fI=Symbol("PanelContextProps"),Jy=e=>{Ye(fI,e)},Br=()=>Ge(fI,{}),Uu={visibility:"hidden"};function Zi(e,t){let{slots:n}=t;var o;const r=Qt(e),{prefixCls:i,prevIcon:l="‹",nextIcon:a="›",superPrevIcon:s="«",superNextIcon:c="»",onSuperPrev:u,onSuperNext:d,onPrev:f,onNext:h}=r,{hideNextBtn:v,hidePrevBtn:g}=Br();return p("div",{class:i},[u&&p("button",{type:"button",onClick:u,tabindex:-1,class:`${i}-super-prev-btn`,style:g.value?Uu:{}},[s]),f&&p("button",{type:"button",onClick:f,tabindex:-1,class:`${i}-prev-btn`,style:g.value?Uu:{}},[l]),p("div",{class:`${i}-view`},[(o=n.default)===null||o===void 0?void 0:o.call(n)]),h&&p("button",{type:"button",onClick:h,tabindex:-1,class:`${i}-next-btn`,style:v.value?Uu:{}},[a]),d&&p("button",{type:"button",onClick:d,tabindex:-1,class:`${i}-super-next-btn`,style:v.value?Uu:{}},[c])])}Zi.displayName="Header";Zi.inheritAttrs=!1;function Zy(e){const t=Qt(e),{prefixCls:n,generateConfig:o,viewDate:r,onPrevDecades:i,onNextDecades:l}=t,{hideHeader:a}=Br();if(a)return null;const s=`${n}-header`,c=o.getYear(r),u=Math.floor(c/Jr)*Jr,d=u+Jr-1;return p(Zi,B(B({},t),{},{prefixCls:s,onSuperPrev:i,onSuperNext:l}),{default:()=>[u,Pt("-"),d]})}Zy.displayName="DecadeHeader";Zy.inheritAttrs=!1;function pI(e,t,n,o,r){let i=e.setHour(t,n);return i=e.setMinute(i,o),i=e.setSecond(i,r),i}function Md(e,t,n){if(!n)return t;let o=t;return o=e.setHour(o,e.getHour(n)),o=e.setMinute(o,e.getMinute(n)),o=e.setSecond(o,e.getSecond(n)),o}function KX(e,t,n,o,r,i){const l=Math.floor(e/o)*o;if(l{z.stopPropagation(),A||o(E)},onMouseenter:()=>{!A&&y&&y(E)},onMouseleave:()=>{!A&&S&&S(E)}},[f?f(E):p("div",{class:`${w}-inner`},[d(E)])]))}C.push(p("tr",{key:O,class:s&&s(I)},[x]))}return p("div",{class:`${t}-body`},[p("table",{class:`${t}-content`},[b&&p("thead",null,[p("tr",null,[b])]),p("tbody",null,[C])])])}Ql.displayName="PanelBody";Ql.inheritAttrs=!1;const n0=3,Ew=4;function Qy(e){const t=Qt(e),n=er-1,{prefixCls:o,viewDate:r,generateConfig:i}=t,l=`${o}-cell`,a=i.getYear(r),s=Math.floor(a/er)*er,c=Math.floor(a/Jr)*Jr,u=c+Jr-1,d=i.setYear(r,c-Math.ceil((n0*Ew*er-Jr)/2)),f=h=>{const v=i.getYear(h),g=v+n;return{[`${l}-in-view`]:c<=v&&g<=u,[`${l}-selected`]:v===s}};return p(Ql,B(B({},t),{},{rowNum:Ew,colNum:n0,baseDate:d,getCellText:h=>{const v=i.getYear(h);return`${v}-${v+n}`},getCellClassName:f,getCellDate:(h,v)=>i.addYear(h,v*er)}),null)}Qy.displayName="DecadeBody";Qy.inheritAttrs=!1;const Xu=new Map;function UX(e,t){let n;function o(){Zp(e)?t():n=Ze(()=>{o()})}return o(),()=>{Ze.cancel(n)}}function o0(e,t,n){if(Xu.get(e)&&Ze.cancel(Xu.get(e)),n<=0){Xu.set(e,Ze(()=>{e.scrollTop=t}));return}const r=(t-e.scrollTop)/n*10;Xu.set(e,Ze(()=>{e.scrollTop+=r,e.scrollTop!==t&&o0(e,t,n-10)}))}function hs(e,t){let{onLeftRight:n,onCtrlLeftRight:o,onUpDown:r,onPageUpDown:i,onEnter:l}=t;const{which:a,ctrlKey:s,metaKey:c}=e;switch(a){case Ie.LEFT:if(s||c){if(o)return o(-1),!0}else if(n)return n(-1),!0;break;case Ie.RIGHT:if(s||c){if(o)return o(1),!0}else if(n)return n(1),!0;break;case Ie.UP:if(r)return r(-1),!0;break;case Ie.DOWN:if(r)return r(1),!0;break;case Ie.PAGE_UP:if(i)return i(-1),!0;break;case Ie.PAGE_DOWN:if(i)return i(1),!0;break;case Ie.ENTER:if(l)return l(),!0;break}return!1}function hI(e,t,n,o){let r=e;if(!r)switch(t){case"time":r=o?"hh:mm:ss a":"HH:mm:ss";break;case"week":r="gggg-wo";break;case"month":r="YYYY-MM";break;case"quarter":r="YYYY-[Q]Q";break;case"year":r="YYYY";break;default:r=n?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD"}return r}function gI(e,t,n){const o=e==="time"?8:10,r=typeof t=="function"?t(n.getNow()).length:t.length;return Math.max(o,r)+2}let As=null;const Yu=new Set;function XX(e){return!As&&typeof window<"u"&&window.addEventListener&&(As=t=>{[...Yu].forEach(n=>{n(t)})},window.addEventListener("mousedown",As)),Yu.add(e),()=>{Yu.delete(e),Yu.size===0&&(window.removeEventListener("mousedown",As),As=null)}}function YX(e){var t;const n=e.target;return e.composed&&n.shadowRoot&&((t=e.composedPath)===null||t===void 0?void 0:t.call(e)[0])||n}const qX=e=>e==="month"||e==="date"?"year":e,JX=e=>e==="date"?"month":e,ZX=e=>e==="month"||e==="date"?"quarter":e,QX=e=>e==="date"?"week":e,eY={year:qX,month:JX,quarter:ZX,week:QX,time:null,date:null};function vI(e,t){return e.some(n=>n&&n.contains(t))}const er=10,Jr=er*10;function e1(e){const t=Qt(e),{prefixCls:n,onViewDateChange:o,generateConfig:r,viewDate:i,operationRef:l,onSelect:a,onPanelChange:s}=t,c=`${n}-decade-panel`;l.value={onKeydown:f=>hs(f,{onLeftRight:h=>{a(r.addYear(i,h*er),"key")},onCtrlLeftRight:h=>{a(r.addYear(i,h*Jr),"key")},onUpDown:h=>{a(r.addYear(i,h*er*n0),"key")},onEnter:()=>{s("year",i)}})};const u=f=>{const h=r.addYear(i,f*Jr);o(h),s(null,h)},d=f=>{a(f,"mouse"),s("year",f)};return p("div",{class:c},[p(Zy,B(B({},t),{},{prefixCls:n,onPrevDecades:()=>{u(-1)},onNextDecades:()=>{u(1)}}),null),p(Qy,B(B({},t),{},{prefixCls:n,onSelect:d}),null)])}e1.displayName="DecadePanel";e1.inheritAttrs=!1;const Ad=7;function ea(e,t){if(!e&&!t)return!0;if(!e||!t)return!1}function tY(e,t,n){const o=ea(t,n);if(typeof o=="boolean")return o;const r=Math.floor(e.getYear(t)/10),i=Math.floor(e.getYear(n)/10);return r===i}function $h(e,t,n){const o=ea(t,n);return typeof o=="boolean"?o:e.getYear(t)===e.getYear(n)}function r0(e,t){return Math.floor(e.getMonth(t)/3)+1}function mI(e,t,n){const o=ea(t,n);return typeof o=="boolean"?o:$h(e,t,n)&&r0(e,t)===r0(e,n)}function t1(e,t,n){const o=ea(t,n);return typeof o=="boolean"?o:$h(e,t,n)&&e.getMonth(t)===e.getMonth(n)}function Zr(e,t,n){const o=ea(t,n);return typeof o=="boolean"?o:e.getYear(t)===e.getYear(n)&&e.getMonth(t)===e.getMonth(n)&&e.getDate(t)===e.getDate(n)}function nY(e,t,n){const o=ea(t,n);return typeof o=="boolean"?o:e.getHour(t)===e.getHour(n)&&e.getMinute(t)===e.getMinute(n)&&e.getSecond(t)===e.getSecond(n)}function bI(e,t,n,o){const r=ea(n,o);return typeof r=="boolean"?r:e.locale.getWeek(t,n)===e.locale.getWeek(t,o)}function ka(e,t,n){return Zr(e,t,n)&&nY(e,t,n)}function qu(e,t,n,o){return!t||!n||!o?!1:!Zr(e,t,o)&&!Zr(e,n,o)&&e.isAfter(o,t)&&e.isAfter(n,o)}function oY(e,t,n){const o=t.locale.getWeekFirstDay(e),r=t.setDate(n,1),i=t.getWeekDay(r);let l=t.addDate(r,o-i);return t.getMonth(l)===t.getMonth(n)&&t.getDate(l)>1&&(l=t.addDate(l,-7)),l}function rc(e,t,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;switch(t){case"year":return n.addYear(e,o*10);case"quarter":case"month":return n.addYear(e,o);default:return n.addMonth(e,o)}}function En(e,t){let{generateConfig:n,locale:o,format:r}=t;return typeof r=="function"?r(e):n.locale.format(o.locale,e,r)}function yI(e,t){let{generateConfig:n,locale:o,formatList:r}=t;return!e||typeof r[0]=="function"?null:n.locale.parse(o.locale,e,r)}function i0(e){let{cellDate:t,mode:n,disabledDate:o,generateConfig:r}=e;if(!o)return!1;const i=(l,a,s)=>{let c=a;for(;c<=s;){let u;switch(l){case"date":{if(u=r.setDate(t,c),!o(u))return!1;break}case"month":{if(u=r.setMonth(t,c),!i0({cellDate:u,mode:"month",generateConfig:r,disabledDate:o}))return!1;break}case"year":{if(u=r.setYear(t,c),!i0({cellDate:u,mode:"year",generateConfig:r,disabledDate:o}))return!1;break}}c+=1}return!0};switch(n){case"date":case"week":return o(t);case"month":{const a=r.getDate(r.getEndDate(t));return i("date",1,a)}case"quarter":{const l=Math.floor(r.getMonth(t)/3)*3,a=l+2;return i("month",l,a)}case"year":return i("month",0,11);case"decade":{const l=r.getYear(t),a=Math.floor(l/er)*er,s=a+er-1;return i("year",a,s)}}}function n1(e){const t=Qt(e),{hideHeader:n}=Br();if(n.value)return null;const{prefixCls:o,generateConfig:r,locale:i,value:l,format:a}=t,s=`${o}-header`;return p(Zi,{prefixCls:s},{default:()=>[l?En(l,{locale:i,format:a,generateConfig:r}):" "]})}n1.displayName="TimeHeader";n1.inheritAttrs=!1;const Ju=re({name:"TimeUnitColumn",props:["prefixCls","units","onSelect","value","active","hideDisabledOptions"],setup(e){const{open:t}=Br(),n=oe(null),o=ne(new Map),r=ne();return ye(()=>e.value,()=>{const i=o.value.get(e.value);i&&t.value!==!1&&o0(n.value,i.offsetTop,120)}),et(()=>{var i;(i=r.value)===null||i===void 0||i.call(r)}),ye(t,()=>{var i;(i=r.value)===null||i===void 0||i.call(r),rt(()=>{if(t.value){const l=o.value.get(e.value);l&&(r.value=UX(l,()=>{o0(n.value,l.offsetTop,0)}))}})},{immediate:!0,flush:"post"}),()=>{const{prefixCls:i,units:l,onSelect:a,value:s,active:c,hideDisabledOptions:u}=e,d=`${i}-cell`;return p("ul",{class:le(`${i}-column`,{[`${i}-column-active`]:c}),ref:n,style:{position:"relative"}},[l.map(f=>u&&f.disabled?null:p("li",{key:f.value,ref:h=>{o.value.set(f.value,h)},class:le(d,{[`${d}-disabled`]:f.disabled,[`${d}-selected`]:s===f.value}),onClick:()=>{f.disabled||a(f.value)}},[p("div",{class:`${d}-inner`},[f.label])]))])}}});function SI(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0",o=String(e);for(;o.length{(n.startsWith("data-")||n.startsWith("aria-")||n==="role"||n==="name")&&!n.startsWith("data-__")&&(t[n]=e[n])}),t}function $t(e,t){return e?e[t]:null}function ko(e,t,n){const o=[$t(e,0),$t(e,1)];return o[n]=typeof t=="function"?t(o[n]):t,!o[0]&&!o[1]?null:o}function gv(e,t,n,o){const r=[];for(let i=e;i<=t;i+=n)r.push({label:SI(i,2),value:i,disabled:(o||[]).includes(i)});return r}const iY=re({compatConfig:{MODE:3},name:"TimeBody",inheritAttrs:!1,props:["generateConfig","prefixCls","operationRef","activeColumnIndex","value","showHour","showMinute","showSecond","use12Hours","hourStep","minuteStep","secondStep","disabledHours","disabledMinutes","disabledSeconds","disabledTime","hideDisabledOptions","onSelect"],setup(e){const t=P(()=>e.value?e.generateConfig.getHour(e.value):-1),n=P(()=>e.use12Hours?t.value>=12:!1),o=P(()=>e.use12Hours?t.value%12:t.value),r=P(()=>e.value?e.generateConfig.getMinute(e.value):-1),i=P(()=>e.value?e.generateConfig.getSecond(e.value):-1),l=ne(e.generateConfig.getNow()),a=ne(),s=ne(),c=ne();Dp(()=>{l.value=e.generateConfig.getNow()}),Ve(()=>{if(e.disabledTime){const b=e.disabledTime(l);[a.value,s.value,c.value]=[b.disabledHours,b.disabledMinutes,b.disabledSeconds]}else[a.value,s.value,c.value]=[e.disabledHours,e.disabledMinutes,e.disabledSeconds]});const u=(b,y,S,$)=>{let w=e.value||e.generateConfig.getNow();const C=Math.max(0,y),O=Math.max(0,S),x=Math.max(0,$);return w=pI(e.generateConfig,w,!e.use12Hours||!b?C:C+12,O,x),w},d=P(()=>{var b;return gv(0,23,(b=e.hourStep)!==null&&b!==void 0?b:1,a.value&&a.value())}),f=P(()=>{if(!e.use12Hours)return[!1,!1];const b=[!0,!0];return d.value.forEach(y=>{let{disabled:S,value:$}=y;S||($>=12?b[1]=!1:b[0]=!1)}),b}),h=P(()=>e.use12Hours?d.value.filter(n.value?b=>b.value>=12:b=>b.value<12).map(b=>{const y=b.value%12,S=y===0?"12":SI(y,2);return m(m({},b),{label:S,value:y})}):d.value),v=P(()=>{var b;return gv(0,59,(b=e.minuteStep)!==null&&b!==void 0?b:1,s.value&&s.value(t.value))}),g=P(()=>{var b;return gv(0,59,(b=e.secondStep)!==null&&b!==void 0?b:1,c.value&&c.value(t.value,r.value))});return()=>{const{prefixCls:b,operationRef:y,activeColumnIndex:S,showHour:$,showMinute:w,showSecond:C,use12Hours:O,hideDisabledOptions:x,onSelect:I}=e,T=[],M=`${b}-content`,E=`${b}-time-panel`;y.value={onUpDown:z=>{const _=T[S];if(_){const D=_.units.findIndex(k=>k.value===_.value),N=_.units.length;for(let k=1;k{I(u(n.value,z,r.value,i.value),"mouse")}),A(w,p(Ju,{key:"minute"},null),r.value,v.value,z=>{I(u(n.value,o.value,z,i.value),"mouse")}),A(C,p(Ju,{key:"second"},null),i.value,g.value,z=>{I(u(n.value,o.value,r.value,z),"mouse")});let R=-1;return typeof n.value=="boolean"&&(R=n.value?1:0),A(O===!0,p(Ju,{key:"12hours"},null),R,[{label:"AM",value:0,disabled:f.value[0]},{label:"PM",value:1,disabled:f.value[1]}],z=>{I(u(!!z,o.value,r.value,i.value),"mouse")}),p("div",{class:M},[T.map(z=>{let{node:_}=z;return _})])}}}),lY=e=>e.filter(t=>t!==!1).length;function Ch(e){const t=Qt(e),{generateConfig:n,format:o="HH:mm:ss",prefixCls:r,active:i,operationRef:l,showHour:a,showMinute:s,showSecond:c,use12Hours:u=!1,onSelect:d,value:f}=t,h=`${r}-time-panel`,v=ne(),g=ne(-1),b=lY([a,s,c,u]);return l.value={onKeydown:y=>hs(y,{onLeftRight:S=>{g.value=(g.value+S+b)%b},onUpDown:S=>{g.value===-1?g.value=0:v.value&&v.value.onUpDown(S)},onEnter:()=>{d(f||n.getNow(),"key"),g.value=-1}}),onBlur:()=>{g.value=-1}},p("div",{class:le(h,{[`${h}-active`]:i})},[p(n1,B(B({},t),{},{format:o,prefixCls:r}),null),p(iY,B(B({},t),{},{prefixCls:r,activeColumnIndex:g.value,operationRef:v}),null)])}Ch.displayName="TimePanel";Ch.inheritAttrs=!1;function xh(e){let{cellPrefixCls:t,generateConfig:n,rangedValue:o,hoverRangedValue:r,isInView:i,isSameCell:l,offsetCell:a,today:s,value:c}=e;function u(d){const f=a(d,-1),h=a(d,1),v=$t(o,0),g=$t(o,1),b=$t(r,0),y=$t(r,1),S=qu(n,b,y,d);function $(T){return l(v,T)}function w(T){return l(g,T)}const C=l(b,d),O=l(y,d),x=(S||O)&&(!i(f)||w(f)),I=(S||C)&&(!i(h)||$(h));return{[`${t}-in-view`]:i(d),[`${t}-in-range`]:qu(n,v,g,d),[`${t}-range-start`]:$(d),[`${t}-range-end`]:w(d),[`${t}-range-start-single`]:$(d)&&!g,[`${t}-range-end-single`]:w(d)&&!v,[`${t}-range-start-near-hover`]:$(d)&&(l(f,b)||qu(n,b,y,f)),[`${t}-range-end-near-hover`]:w(d)&&(l(h,y)||qu(n,b,y,h)),[`${t}-range-hover`]:S,[`${t}-range-hover-start`]:C,[`${t}-range-hover-end`]:O,[`${t}-range-hover-edge-start`]:x,[`${t}-range-hover-edge-end`]:I,[`${t}-range-hover-edge-start-near-range`]:x&&l(f,g),[`${t}-range-hover-edge-end-near-range`]:I&&l(h,v),[`${t}-today`]:l(s,d),[`${t}-selected`]:l(c,d)}}return u}const xI=Symbol("RangeContextProps"),aY=e=>{Ye(xI,e)},iu=()=>Ge(xI,{rangedValue:ne(),hoverRangedValue:ne(),inRange:ne(),panelPosition:ne()}),sY=re({compatConfig:{MODE:3},name:"PanelContextProvider",inheritAttrs:!1,props:{value:{type:Object,default:()=>({})}},setup(e,t){let{slots:n}=t;const o={rangedValue:ne(e.value.rangedValue),hoverRangedValue:ne(e.value.hoverRangedValue),inRange:ne(e.value.inRange),panelPosition:ne(e.value.panelPosition)};return aY(o),ye(()=>e.value,()=>{Object.keys(e.value).forEach(r=>{o[r]&&(o[r].value=e.value[r])})}),()=>{var r;return(r=n.default)===null||r===void 0?void 0:r.call(n)}}});function wh(e){const t=Qt(e),{prefixCls:n,generateConfig:o,prefixColumn:r,locale:i,rowCount:l,viewDate:a,value:s,dateRender:c}=t,{rangedValue:u,hoverRangedValue:d}=iu(),f=oY(i.locale,o,a),h=`${n}-cell`,v=o.locale.getWeekFirstDay(i.locale),g=o.getNow(),b=[],y=i.shortWeekDays||(o.locale.getShortWeekDays?o.locale.getShortWeekDays(i.locale):[]);r&&b.push(p("th",{key:"empty","aria-label":"empty cell"},null));for(let w=0;wZr(o,w,C),isInView:w=>t1(o,w,a),offsetCell:(w,C)=>o.addDate(w,C)}),$=c?w=>c({current:w,today:g}):void 0;return p(Ql,B(B({},t),{},{rowNum:l,colNum:Ad,baseDate:f,getCellNode:$,getCellText:o.getDate,getCellClassName:S,getCellDate:o.addDate,titleCell:w=>En(w,{locale:i,format:"YYYY-MM-DD",generateConfig:o}),headerCells:b}),null)}wh.displayName="DateBody";wh.inheritAttrs=!1;wh.props=["prefixCls","generateConfig","value?","viewDate","locale","rowCount","onSelect","dateRender?","disabledDate?","prefixColumn?","rowClassName?"];function o1(e){const t=Qt(e),{prefixCls:n,generateConfig:o,locale:r,viewDate:i,onNextMonth:l,onPrevMonth:a,onNextYear:s,onPrevYear:c,onYearClick:u,onMonthClick:d}=t,{hideHeader:f}=Br();if(f.value)return null;const h=`${n}-header`,v=r.shortMonths||(o.locale.getShortMonths?o.locale.getShortMonths(r.locale):[]),g=o.getMonth(i),b=p("button",{type:"button",key:"year",onClick:u,tabindex:-1,class:`${n}-year-btn`},[En(i,{locale:r,format:r.yearFormat,generateConfig:o})]),y=p("button",{type:"button",key:"month",onClick:d,tabindex:-1,class:`${n}-month-btn`},[r.monthFormat?En(i,{locale:r,format:r.monthFormat,generateConfig:o}):v[g]]),S=r.monthBeforeYear?[y,b]:[b,y];return p(Zi,B(B({},t),{},{prefixCls:h,onSuperPrev:c,onPrev:a,onNext:l,onSuperNext:s}),{default:()=>[S]})}o1.displayName="DateHeader";o1.inheritAttrs=!1;const cY=6;function lu(e){const t=Qt(e),{prefixCls:n,panelName:o="date",keyboardConfig:r,active:i,operationRef:l,generateConfig:a,value:s,viewDate:c,onViewDateChange:u,onPanelChange:d,onSelect:f}=t,h=`${n}-${o}-panel`;l.value={onKeydown:b=>hs(b,m({onLeftRight:y=>{f(a.addDate(s||c,y),"key")},onCtrlLeftRight:y=>{f(a.addYear(s||c,y),"key")},onUpDown:y=>{f(a.addDate(s||c,y*Ad),"key")},onPageUpDown:y=>{f(a.addMonth(s||c,y),"key")}},r))};const v=b=>{const y=a.addYear(c,b);u(y),d(null,y)},g=b=>{const y=a.addMonth(c,b);u(y),d(null,y)};return p("div",{class:le(h,{[`${h}-active`]:i})},[p(o1,B(B({},t),{},{prefixCls:n,value:s,viewDate:c,onPrevYear:()=>{v(-1)},onNextYear:()=>{v(1)},onPrevMonth:()=>{g(-1)},onNextMonth:()=>{g(1)},onMonthClick:()=>{d("month",c)},onYearClick:()=>{d("year",c)}}),null),p(wh,B(B({},t),{},{onSelect:b=>f(b,"mouse"),prefixCls:n,value:s,viewDate:c,rowCount:cY}),null)])}lu.displayName="DatePanel";lu.inheritAttrs=!1;const _w=rY("date","time");function r1(e){const t=Qt(e),{prefixCls:n,operationRef:o,generateConfig:r,value:i,defaultValue:l,disabledTime:a,showTime:s,onSelect:c}=t,u=`${n}-datetime-panel`,d=ne(null),f=ne({}),h=ne({}),v=typeof s=="object"?m({},s):{};function g($){const w=_w.indexOf(d.value)+$;return _w[w]||null}const b=$=>{h.value.onBlur&&h.value.onBlur($),d.value=null};o.value={onKeydown:$=>{if($.which===Ie.TAB){const w=g($.shiftKey?-1:1);return d.value=w,w&&$.preventDefault(),!0}if(d.value){const w=d.value==="date"?f:h;return w.value&&w.value.onKeydown&&w.value.onKeydown($),!0}return[Ie.LEFT,Ie.RIGHT,Ie.UP,Ie.DOWN].includes($.which)?(d.value="date",!0):!1},onBlur:b,onClose:b};const y=($,w)=>{let C=$;w==="date"&&!i&&v.defaultValue?(C=r.setHour(C,r.getHour(v.defaultValue)),C=r.setMinute(C,r.getMinute(v.defaultValue)),C=r.setSecond(C,r.getSecond(v.defaultValue))):w==="time"&&!i&&l&&(C=r.setYear(C,r.getYear(l)),C=r.setMonth(C,r.getMonth(l)),C=r.setDate(C,r.getDate(l))),c&&c(C,"mouse")},S=a?a(i||null):{};return p("div",{class:le(u,{[`${u}-active`]:d.value})},[p(lu,B(B({},t),{},{operationRef:f,active:d.value==="date",onSelect:$=>{y(Md(r,$,!i&&typeof s=="object"?s.defaultValue:null),"date")}}),null),p(Ch,B(B(B(B({},t),{},{format:void 0},v),S),{},{disabledTime:null,defaultValue:void 0,operationRef:h,active:d.value==="time",onSelect:$=>{y($,"time")}}),null)])}r1.displayName="DatetimePanel";r1.inheritAttrs=!1;function i1(e){const t=Qt(e),{prefixCls:n,generateConfig:o,locale:r,value:i}=t,l=`${n}-cell`,a=u=>p("td",{key:"week",class:le(l,`${l}-week`)},[o.locale.getWeek(r.locale,u)]),s=`${n}-week-panel-row`,c=u=>le(s,{[`${s}-selected`]:bI(o,r.locale,i,u)});return p(lu,B(B({},t),{},{panelName:"week",prefixColumn:a,rowClassName:c,keyboardConfig:{onLeftRight:null}}),null)}i1.displayName="WeekPanel";i1.inheritAttrs=!1;function l1(e){const t=Qt(e),{prefixCls:n,generateConfig:o,locale:r,viewDate:i,onNextYear:l,onPrevYear:a,onYearClick:s}=t,{hideHeader:c}=Br();if(c.value)return null;const u=`${n}-header`;return p(Zi,B(B({},t),{},{prefixCls:u,onSuperPrev:a,onSuperNext:l}),{default:()=>[p("button",{type:"button",onClick:s,class:`${n}-year-btn`},[En(i,{locale:r,format:r.yearFormat,generateConfig:o})])]})}l1.displayName="MonthHeader";l1.inheritAttrs=!1;const wI=3,uY=4;function a1(e){const t=Qt(e),{prefixCls:n,locale:o,value:r,viewDate:i,generateConfig:l,monthCellRender:a}=t,{rangedValue:s,hoverRangedValue:c}=iu(),u=`${n}-cell`,d=xh({cellPrefixCls:u,value:r,generateConfig:l,rangedValue:s.value,hoverRangedValue:c.value,isSameCell:(g,b)=>t1(l,g,b),isInView:()=>!0,offsetCell:(g,b)=>l.addMonth(g,b)}),f=o.shortMonths||(l.locale.getShortMonths?l.locale.getShortMonths(o.locale):[]),h=l.setMonth(i,0),v=a?g=>a({current:g,locale:o}):void 0;return p(Ql,B(B({},t),{},{rowNum:uY,colNum:wI,baseDate:h,getCellNode:v,getCellText:g=>o.monthFormat?En(g,{locale:o,format:o.monthFormat,generateConfig:l}):f[l.getMonth(g)],getCellClassName:d,getCellDate:l.addMonth,titleCell:g=>En(g,{locale:o,format:"YYYY-MM",generateConfig:l})}),null)}a1.displayName="MonthBody";a1.inheritAttrs=!1;function s1(e){const t=Qt(e),{prefixCls:n,operationRef:o,onViewDateChange:r,generateConfig:i,value:l,viewDate:a,onPanelChange:s,onSelect:c}=t,u=`${n}-month-panel`;o.value={onKeydown:f=>hs(f,{onLeftRight:h=>{c(i.addMonth(l||a,h),"key")},onCtrlLeftRight:h=>{c(i.addYear(l||a,h),"key")},onUpDown:h=>{c(i.addMonth(l||a,h*wI),"key")},onEnter:()=>{s("date",l||a)}})};const d=f=>{const h=i.addYear(a,f);r(h),s(null,h)};return p("div",{class:u},[p(l1,B(B({},t),{},{prefixCls:n,onPrevYear:()=>{d(-1)},onNextYear:()=>{d(1)},onYearClick:()=>{s("year",a)}}),null),p(a1,B(B({},t),{},{prefixCls:n,onSelect:f=>{c(f,"mouse"),s("date",f)}}),null)])}s1.displayName="MonthPanel";s1.inheritAttrs=!1;function c1(e){const t=Qt(e),{prefixCls:n,generateConfig:o,locale:r,viewDate:i,onNextYear:l,onPrevYear:a,onYearClick:s}=t,{hideHeader:c}=Br();if(c.value)return null;const u=`${n}-header`;return p(Zi,B(B({},t),{},{prefixCls:u,onSuperPrev:a,onSuperNext:l}),{default:()=>[p("button",{type:"button",onClick:s,class:`${n}-year-btn`},[En(i,{locale:r,format:r.yearFormat,generateConfig:o})])]})}c1.displayName="QuarterHeader";c1.inheritAttrs=!1;const dY=4,fY=1;function u1(e){const t=Qt(e),{prefixCls:n,locale:o,value:r,viewDate:i,generateConfig:l}=t,{rangedValue:a,hoverRangedValue:s}=iu(),c=`${n}-cell`,u=xh({cellPrefixCls:c,value:r,generateConfig:l,rangedValue:a.value,hoverRangedValue:s.value,isSameCell:(f,h)=>mI(l,f,h),isInView:()=>!0,offsetCell:(f,h)=>l.addMonth(f,h*3)}),d=l.setDate(l.setMonth(i,0),1);return p(Ql,B(B({},t),{},{rowNum:fY,colNum:dY,baseDate:d,getCellText:f=>En(f,{locale:o,format:o.quarterFormat||"[Q]Q",generateConfig:l}),getCellClassName:u,getCellDate:(f,h)=>l.addMonth(f,h*3),titleCell:f=>En(f,{locale:o,format:"YYYY-[Q]Q",generateConfig:l})}),null)}u1.displayName="QuarterBody";u1.inheritAttrs=!1;function d1(e){const t=Qt(e),{prefixCls:n,operationRef:o,onViewDateChange:r,generateConfig:i,value:l,viewDate:a,onPanelChange:s,onSelect:c}=t,u=`${n}-quarter-panel`;o.value={onKeydown:f=>hs(f,{onLeftRight:h=>{c(i.addMonth(l||a,h*3),"key")},onCtrlLeftRight:h=>{c(i.addYear(l||a,h),"key")},onUpDown:h=>{c(i.addYear(l||a,h),"key")}})};const d=f=>{const h=i.addYear(a,f);r(h),s(null,h)};return p("div",{class:u},[p(c1,B(B({},t),{},{prefixCls:n,onPrevYear:()=>{d(-1)},onNextYear:()=>{d(1)},onYearClick:()=>{s("year",a)}}),null),p(u1,B(B({},t),{},{prefixCls:n,onSelect:f=>{c(f,"mouse")}}),null)])}d1.displayName="QuarterPanel";d1.inheritAttrs=!1;function f1(e){const t=Qt(e),{prefixCls:n,generateConfig:o,viewDate:r,onPrevDecade:i,onNextDecade:l,onDecadeClick:a}=t,{hideHeader:s}=Br();if(s.value)return null;const c=`${n}-header`,u=o.getYear(r),d=Math.floor(u/Di)*Di,f=d+Di-1;return p(Zi,B(B({},t),{},{prefixCls:c,onSuperPrev:i,onSuperNext:l}),{default:()=>[p("button",{type:"button",onClick:a,class:`${n}-decade-btn`},[d,Pt("-"),f])]})}f1.displayName="YearHeader";f1.inheritAttrs=!1;const l0=3,Mw=4;function p1(e){const t=Qt(e),{prefixCls:n,value:o,viewDate:r,locale:i,generateConfig:l}=t,{rangedValue:a,hoverRangedValue:s}=iu(),c=`${n}-cell`,u=l.getYear(r),d=Math.floor(u/Di)*Di,f=d+Di-1,h=l.setYear(r,d-Math.ceil((l0*Mw-Di)/2)),v=b=>{const y=l.getYear(b);return d<=y&&y<=f},g=xh({cellPrefixCls:c,value:o,generateConfig:l,rangedValue:a.value,hoverRangedValue:s.value,isSameCell:(b,y)=>$h(l,b,y),isInView:v,offsetCell:(b,y)=>l.addYear(b,y)});return p(Ql,B(B({},t),{},{rowNum:Mw,colNum:l0,baseDate:h,getCellText:l.getYear,getCellClassName:g,getCellDate:l.addYear,titleCell:b=>En(b,{locale:i,format:"YYYY",generateConfig:l})}),null)}p1.displayName="YearBody";p1.inheritAttrs=!1;const Di=10;function h1(e){const t=Qt(e),{prefixCls:n,operationRef:o,onViewDateChange:r,generateConfig:i,value:l,viewDate:a,sourceMode:s,onSelect:c,onPanelChange:u}=t,d=`${n}-year-panel`;o.value={onKeydown:h=>hs(h,{onLeftRight:v=>{c(i.addYear(l||a,v),"key")},onCtrlLeftRight:v=>{c(i.addYear(l||a,v*Di),"key")},onUpDown:v=>{c(i.addYear(l||a,v*l0),"key")},onEnter:()=>{u(s==="date"?"date":"month",l||a)}})};const f=h=>{const v=i.addYear(a,h*10);r(v),u(null,v)};return p("div",{class:d},[p(f1,B(B({},t),{},{prefixCls:n,onPrevDecade:()=>{f(-1)},onNextDecade:()=>{f(1)},onDecadeClick:()=>{u("decade",a)}}),null),p(p1,B(B({},t),{},{prefixCls:n,onSelect:h=>{u(s==="date"?"date":"month",h),c(h,"mouse")}}),null)])}h1.displayName="YearPanel";h1.inheritAttrs=!1;function OI(e,t,n){return n?p("div",{class:`${e}-footer-extra`},[n(t)]):null}function PI(e){let{prefixCls:t,components:n={},needConfirmButton:o,onNow:r,onOk:i,okDisabled:l,showNow:a,locale:s}=e,c,u;if(o){const d=n.button||"button";r&&a!==!1&&(c=p("li",{class:`${t}-now`},[p("a",{class:`${t}-now-btn`,onClick:r},[s.now])])),u=o&&p("li",{class:`${t}-ok`},[p(d,{disabled:l,onClick:f=>{f.stopPropagation(),i&&i()}},{default:()=>[s.ok]})])}return!c&&!u?null:p("ul",{class:`${t}-ranges`},[c,u])}function pY(){return re({name:"PickerPanel",inheritAttrs:!1,props:{prefixCls:String,locale:Object,generateConfig:Object,value:Object,defaultValue:Object,pickerValue:Object,defaultPickerValue:Object,disabledDate:Function,mode:String,picker:{type:String,default:"date"},tabindex:{type:[Number,String],default:0},showNow:{type:Boolean,default:void 0},showTime:[Boolean,Object],showToday:Boolean,renderExtraFooter:Function,dateRender:Function,hideHeader:{type:Boolean,default:void 0},onSelect:Function,onChange:Function,onPanelChange:Function,onMousedown:Function,onPickerValueChange:Function,onOk:Function,components:Object,direction:String,hourStep:{type:Number,default:1},minuteStep:{type:Number,default:1},secondStep:{type:Number,default:1}},setup(e,t){let{attrs:n}=t;const o=P(()=>e.picker==="date"&&!!e.showTime||e.picker==="time"),r=P(()=>24%e.hourStep===0),i=P(()=>60%e.minuteStep===0),l=P(()=>60%e.secondStep===0),a=Br(),{operationRef:s,onSelect:c,hideRanges:u,defaultOpenValue:d}=a,{inRange:f,panelPosition:h,rangedValue:v,hoverRangedValue:g}=iu(),b=ne({}),[y,S]=Dt(null,{value:We(e,"value"),defaultValue:e.defaultValue,postState:N=>!N&&(d!=null&&d.value)&&e.picker==="time"?d.value:N}),[$,w]=Dt(null,{value:We(e,"pickerValue"),defaultValue:e.defaultPickerValue||y.value,postState:N=>{const{generateConfig:k,showTime:F,defaultValue:L}=e,H=k.getNow();return N?!y.value&&e.showTime?typeof F=="object"?Md(k,Array.isArray(N)?N[0]:N,F.defaultValue||H):L?Md(k,Array.isArray(N)?N[0]:N,L):Md(k,Array.isArray(N)?N[0]:N,H):N:H}}),C=N=>{w(N),e.onPickerValueChange&&e.onPickerValueChange(N)},O=N=>{const k=eY[e.picker];return k?k(N):N},[x,I]=Dt(()=>e.picker==="time"?"time":O("date"),{value:We(e,"mode")});ye(()=>e.picker,()=>{I(e.picker)});const T=ne(x.value),M=N=>{T.value=N},E=(N,k)=>{const{onPanelChange:F,generateConfig:L}=e,H=O(N||x.value);M(x.value),I(H),F&&(x.value!==H||ka(L,$.value,$.value))&&F(k,H)},A=function(N,k){let F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{picker:L,generateConfig:H,onSelect:j,onChange:Y,disabledDate:Z}=e;(x.value===L||F)&&(S(N),j&&j(N),c&&c(N,k),Y&&!ka(H,N,y.value)&&!(Z!=null&&Z(N))&&Y(N))},R=N=>b.value&&b.value.onKeydown?([Ie.LEFT,Ie.RIGHT,Ie.UP,Ie.DOWN,Ie.PAGE_UP,Ie.PAGE_DOWN,Ie.ENTER].includes(N.which)&&N.preventDefault(),b.value.onKeydown(N)):!1,z=N=>{b.value&&b.value.onBlur&&b.value.onBlur(N)},_=()=>{const{generateConfig:N,hourStep:k,minuteStep:F,secondStep:L}=e,H=N.getNow(),j=KX(N.getHour(H),N.getMinute(H),N.getSecond(H),r.value?k:1,i.value?F:1,l.value?L:1),Y=pI(N,H,j[0],j[1],j[2]);A(Y,"submit")},D=P(()=>{const{prefixCls:N,direction:k}=e;return le(`${N}-panel`,{[`${N}-panel-has-range`]:v&&v.value&&v.value[0]&&v.value[1],[`${N}-panel-has-range-hover`]:g&&g.value&&g.value[0]&&g.value[1],[`${N}-panel-rtl`]:k==="rtl"})});return Jy(m(m({},a),{mode:x,hideHeader:P(()=>{var N;return e.hideHeader!==void 0?e.hideHeader:(N=a.hideHeader)===null||N===void 0?void 0:N.value}),hidePrevBtn:P(()=>f.value&&h.value==="right"),hideNextBtn:P(()=>f.value&&h.value==="left")})),ye(()=>e.value,()=>{e.value&&w(e.value)}),()=>{const{prefixCls:N="ant-picker",locale:k,generateConfig:F,disabledDate:L,picker:H="date",tabindex:j=0,showNow:Y,showTime:Z,showToday:X,renderExtraFooter:ee,onMousedown:U,onOk:Q,components:J}=e;s&&h.value!=="right"&&(s.value={onKeydown:R,onClose:()=>{b.value&&b.value.onClose&&b.value.onClose()}});let G;const q=m(m(m({},n),e),{operationRef:b,prefixCls:N,viewDate:$.value,value:y.value,onViewDateChange:C,sourceMode:T.value,onPanelChange:E,disabledDate:L});switch(delete q.onChange,delete q.onSelect,x.value){case"decade":G=p(e1,B(B({},q),{},{onSelect:(ue,ie)=>{C(ue),A(ue,ie)}}),null);break;case"year":G=p(h1,B(B({},q),{},{onSelect:(ue,ie)=>{C(ue),A(ue,ie)}}),null);break;case"month":G=p(s1,B(B({},q),{},{onSelect:(ue,ie)=>{C(ue),A(ue,ie)}}),null);break;case"quarter":G=p(d1,B(B({},q),{},{onSelect:(ue,ie)=>{C(ue),A(ue,ie)}}),null);break;case"week":G=p(i1,B(B({},q),{},{onSelect:(ue,ie)=>{C(ue),A(ue,ie)}}),null);break;case"time":delete q.showTime,G=p(Ch,B(B(B({},q),typeof Z=="object"?Z:null),{},{onSelect:(ue,ie)=>{C(ue),A(ue,ie)}}),null);break;default:Z?G=p(r1,B(B({},q),{},{onSelect:(ue,ie)=>{C(ue),A(ue,ie)}}),null):G=p(lu,B(B({},q),{},{onSelect:(ue,ie)=>{C(ue),A(ue,ie)}}),null)}let V,W;u!=null&&u.value||(V=OI(N,x.value,ee),W=PI({prefixCls:N,components:J,needConfirmButton:o.value,okDisabled:!y.value||L&&L(y.value),locale:k,showNow:Y,onNow:o.value&&_,onOk:()=>{y.value&&(A(y.value,"submit",!0),Q&&Q(y.value))}}));let te;if(X&&x.value==="date"&&H==="date"&&!Z){const ue=F.getNow(),ie=`${N}-today-btn`,ae=L&&L(ue);te=p("a",{class:le(ie,ae&&`${ie}-disabled`),"aria-disabled":ae,onClick:()=>{ae||A(ue,"mouse",!0)}},[k.today])}return p("div",{tabindex:j,class:le(D.value,n.class),style:n.style,onKeydown:R,onBlur:z,onMousedown:U},[G,V||W||te?p("div",{class:`${N}-footer`},[V,W,te]):null])}}})}const hY=pY(),g1=e=>p(hY,e),gY={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}}};function II(e,t){let{slots:n}=t;const{prefixCls:o,popupStyle:r,visible:i,dropdownClassName:l,dropdownAlign:a,transitionName:s,getPopupContainer:c,range:u,popupPlacement:d,direction:f}=Qt(e),h=`${o}-dropdown`;return p(ql,{showAction:[],hideAction:[],popupPlacement:d!==void 0?d:f==="rtl"?"bottomRight":"bottomLeft",builtinPlacements:gY,prefixCls:h,popupTransitionName:s,popupAlign:a,popupVisible:i,popupClassName:le(l,{[`${h}-range`]:u,[`${h}-rtl`]:f==="rtl"}),popupStyle:r,getPopupContainer:c},{default:n.default,popup:n.popupElement})}const TI=re({name:"PresetPanel",props:{prefixCls:String,presets:{type:Array,default:()=>[]},onClick:Function,onHover:Function},setup(e){return()=>e.presets.length?p("div",{class:`${e.prefixCls}-presets`},[p("ul",null,[e.presets.map((t,n)=>{let{label:o,value:r}=t;return p("li",{key:n,onClick:i=>{i.stopPropagation(),e.onClick(r)},onMouseenter:()=>{var i;(i=e.onHover)===null||i===void 0||i.call(e,r)},onMouseleave:()=>{var i;(i=e.onHover)===null||i===void 0||i.call(e,null)}},[o])})])]):null}});function a0(e){let{open:t,value:n,isClickOutside:o,triggerOpen:r,forwardKeydown:i,onKeydown:l,blurToCancel:a,onSubmit:s,onCancel:c,onFocus:u,onBlur:d}=e;const f=oe(!1),h=oe(!1),v=oe(!1),g=oe(!1),b=oe(!1),y=P(()=>({onMousedown:()=>{f.value=!0,r(!0)},onKeydown:$=>{if(l($,()=>{b.value=!0}),!b.value){switch($.which){case Ie.ENTER:{t.value?s()!==!1&&(f.value=!0):r(!0),$.preventDefault();return}case Ie.TAB:{f.value&&t.value&&!$.shiftKey?(f.value=!1,$.preventDefault()):!f.value&&t.value&&!i($)&&$.shiftKey&&(f.value=!0,$.preventDefault());return}case Ie.ESC:{f.value=!0,c();return}}!t.value&&![Ie.SHIFT].includes($.which)?r(!0):f.value||i($)}},onFocus:$=>{f.value=!0,h.value=!0,u&&u($)},onBlur:$=>{if(v.value||!o(document.activeElement)){v.value=!1;return}a.value?setTimeout(()=>{let{activeElement:w}=document;for(;w&&w.shadowRoot;)w=w.shadowRoot.activeElement;o(w)&&c()},0):t.value&&(r(!1),g.value&&s()),h.value=!1,d&&d($)}}));ye(t,()=>{g.value=!1}),ye(n,()=>{g.value=!0});const S=oe();return Ke(()=>{S.value=XX($=>{const w=YX($);if(t.value){const C=o(w);C?(!h.value||C)&&r(!1):(v.value=!0,Ze(()=>{v.value=!1}))}})}),et(()=>{S.value&&S.value()}),[y,{focused:h,typing:f}]}function s0(e){let{valueTexts:t,onTextChange:n}=e;const o=ne("");function r(l){o.value=l,n(l)}function i(){o.value=t.value[0]}return ye(()=>[...t.value],function(l){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];l.join("||")!==a.join("||")&&t.value.every(s=>s!==o.value)&&i()},{immediate:!0}),[o,r,i]}function Zf(e,t){let{formatList:n,generateConfig:o,locale:r}=t;const i=gy(()=>{if(!e.value)return[[""],""];let s="";const c=[];for(let u=0;uc[0]!==s[0]||!ma(c[1],s[1])),l=P(()=>i.value[0]),a=P(()=>i.value[1]);return[l,a]}function c0(e,t){let{formatList:n,generateConfig:o,locale:r}=t;const i=ne(null);let l;function a(d){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Ze.cancel(l),f){i.value=d;return}l=Ze(()=>{i.value=d})}const[,s]=Zf(i,{formatList:n,generateConfig:o,locale:r});function c(d){a(d)}function u(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;a(null,d)}return ye(e,()=>{u(!0)}),et(()=>{Ze.cancel(l)}),[s,c,u]}function EI(e,t){return P(()=>e!=null&&e.value?e.value:t!=null&&t.value?(Db(!1,"`ranges` is deprecated. Please use `presets` instead."),Object.keys(t.value).map(o=>{const r=t.value[o],i=typeof r=="function"?r():r;return{label:o,value:i}})):[])}function vY(){return re({name:"Picker",inheritAttrs:!1,props:["prefixCls","id","tabindex","dropdownClassName","dropdownAlign","popupStyle","transitionName","generateConfig","locale","inputReadOnly","allowClear","autofocus","showTime","showNow","showHour","showMinute","showSecond","picker","format","use12Hours","value","defaultValue","open","defaultOpen","defaultOpenValue","suffixIcon","presets","clearIcon","disabled","disabledDate","placeholder","getPopupContainer","panelRender","inputRender","onChange","onOpenChange","onPanelChange","onFocus","onBlur","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu","onClick","onKeydown","onSelect","direction","autocomplete","showToday","renderExtraFooter","dateRender","minuteStep","hourStep","secondStep","hideDisabledOptions"],setup(e,t){let{attrs:n,expose:o}=t;const r=ne(null),i=P(()=>e.presets),l=EI(i),a=P(()=>{var L;return(L=e.picker)!==null&&L!==void 0?L:"date"}),s=P(()=>a.value==="date"&&!!e.showTime||a.value==="time"),c=P(()=>$I(hI(e.format,a.value,e.showTime,e.use12Hours))),u=ne(null),d=ne(null),f=ne(null),[h,v]=Dt(null,{value:We(e,"value"),defaultValue:e.defaultValue}),g=ne(h.value),b=L=>{g.value=L},y=ne(null),[S,$]=Dt(!1,{value:We(e,"open"),defaultValue:e.defaultOpen,postState:L=>e.disabled?!1:L,onChange:L=>{e.onOpenChange&&e.onOpenChange(L),!L&&y.value&&y.value.onClose&&y.value.onClose()}}),[w,C]=Zf(g,{formatList:c,generateConfig:We(e,"generateConfig"),locale:We(e,"locale")}),[O,x,I]=s0({valueTexts:w,onTextChange:L=>{const H=yI(L,{locale:e.locale,formatList:c.value,generateConfig:e.generateConfig});H&&(!e.disabledDate||!e.disabledDate(H))&&b(H)}}),T=L=>{const{onChange:H,generateConfig:j,locale:Y}=e;b(L),v(L),H&&!ka(j,h.value,L)&&H(L,L?En(L,{generateConfig:j,locale:Y,format:c.value[0]}):"")},M=L=>{e.disabled&&L||$(L)},E=L=>S.value&&y.value&&y.value.onKeydown?y.value.onKeydown(L):!1,A=function(){e.onMouseup&&e.onMouseup(...arguments),r.value&&(r.value.focus(),M(!0))},[R,{focused:z,typing:_}]=a0({blurToCancel:s,open:S,value:O,triggerOpen:M,forwardKeydown:E,isClickOutside:L=>!vI([u.value,d.value,f.value],L),onSubmit:()=>!g.value||e.disabledDate&&e.disabledDate(g.value)?!1:(T(g.value),M(!1),I(),!0),onCancel:()=>{M(!1),b(h.value),I()},onKeydown:(L,H)=>{var j;(j=e.onKeydown)===null||j===void 0||j.call(e,L,H)},onFocus:L=>{var H;(H=e.onFocus)===null||H===void 0||H.call(e,L)},onBlur:L=>{var H;(H=e.onBlur)===null||H===void 0||H.call(e,L)}});ye([S,w],()=>{S.value||(b(h.value),!w.value.length||w.value[0]===""?x(""):C.value!==O.value&&I())}),ye(a,()=>{S.value||I()}),ye(h,()=>{b(h.value)});const[D,N,k]=c0(O,{formatList:c,generateConfig:We(e,"generateConfig"),locale:We(e,"locale")}),F=(L,H)=>{(H==="submit"||H!=="key"&&!s.value)&&(T(L),M(!1))};return Jy({operationRef:y,hideHeader:P(()=>a.value==="time"),onSelect:F,open:S,defaultOpenValue:We(e,"defaultOpenValue"),onDateMouseenter:N,onDateMouseleave:k}),o({focus:()=>{r.value&&r.value.focus()},blur:()=>{r.value&&r.value.blur()}}),()=>{const{prefixCls:L="rc-picker",id:H,tabindex:j,dropdownClassName:Y,dropdownAlign:Z,popupStyle:X,transitionName:ee,generateConfig:U,locale:Q,inputReadOnly:J,allowClear:G,autofocus:q,picker:V="date",defaultOpenValue:W,suffixIcon:te,clearIcon:ue,disabled:ie,placeholder:ae,getPopupContainer:ce,panelRender:se,onMousedown:pe,onMouseenter:he,onMouseleave:ge,onContextmenu:me,onClick:xe,onSelect:fe,direction:de,autocomplete:be="off"}=e,we=m(m(m({},e),n),{class:le({[`${L}-panel-focused`]:!_.value}),style:void 0,pickerValue:void 0,onPickerValueChange:void 0,onChange:null});let Te=p("div",{class:`${L}-panel-layout`},[p(TI,{prefixCls:L,presets:l.value,onClick:Ae=>{T(Ae),M(!1)}},null),p(g1,B(B({},we),{},{generateConfig:U,value:g.value,locale:Q,tabindex:-1,onSelect:Ae=>{fe==null||fe(Ae),b(Ae)},direction:de,onPanelChange:(Ae,Fe)=>{const{onPanelChange:lt}=e;k(!0),lt==null||lt(Ae,Fe)}}),null)]);se&&(Te=se(Te));const Re=p("div",{class:`${L}-panel-container`,ref:u,onMousedown:Ae=>{Ae.preventDefault()}},[Te]);let Se;te&&(Se=p("span",{class:`${L}-suffix`},[te]));let Ce;G&&h.value&&!ie&&(Ce=p("span",{onMousedown:Ae=>{Ae.preventDefault(),Ae.stopPropagation()},onMouseup:Ae=>{Ae.preventDefault(),Ae.stopPropagation(),T(null),M(!1)},class:`${L}-clear`,role:"button"},[ue||p("span",{class:`${L}-clear-btn`},null)]));const Pe=m(m(m(m({id:H,tabindex:j,disabled:ie,readonly:J||typeof c.value[0]=="function"||!_.value,value:D.value||O.value,onInput:Ae=>{x(Ae.target.value)},autofocus:q,placeholder:ae,ref:r,title:O.value},R.value),{size:gI(V,c.value[0],U)}),CI(e)),{autocomplete:be}),Me=e.inputRender?e.inputRender(Pe):p("input",Pe,null),De=de==="rtl"?"bottomRight":"bottomLeft";return p("div",{ref:f,class:le(L,n.class,{[`${L}-disabled`]:ie,[`${L}-focused`]:z.value,[`${L}-rtl`]:de==="rtl"}),style:n.style,onMousedown:pe,onMouseup:A,onMouseenter:he,onMouseleave:ge,onContextmenu:me,onClick:xe},[p("div",{class:le(`${L}-input`,{[`${L}-input-placeholder`]:!!D.value}),ref:d},[Me,Se,Ce]),p(II,{visible:S.value,popupStyle:X,prefixCls:L,dropdownClassName:Y,dropdownAlign:Z,getPopupContainer:ce,transitionName:ee,popupPlacement:De,direction:de},{default:()=>[p("div",{style:{pointerEvents:"none",position:"absolute",top:0,bottom:0,left:0,right:0}},null)],popupElement:()=>Re})])}}})}const mY=vY();function bY(e,t){let{picker:n,locale:o,selectedValue:r,disabledDate:i,disabled:l,generateConfig:a}=e;const s=P(()=>$t(r.value,0)),c=P(()=>$t(r.value,1));function u(g){return a.value.locale.getWeekFirstDate(o.value.locale,g)}function d(g){const b=a.value.getYear(g),y=a.value.getMonth(g);return b*100+y}function f(g){const b=a.value.getYear(g),y=r0(a.value,g);return b*10+y}return[g=>{var b;if(i&&(!((b=i==null?void 0:i.value)===null||b===void 0)&&b.call(i,g)))return!0;if(l[1]&&c)return!Zr(a.value,g,c.value)&&a.value.isAfter(g,c.value);if(t.value[1]&&c.value)switch(n.value){case"quarter":return f(g)>f(c.value);case"month":return d(g)>d(c.value);case"week":return u(g)>u(c.value);default:return!Zr(a.value,g,c.value)&&a.value.isAfter(g,c.value)}return!1},g=>{var b;if(!((b=i.value)===null||b===void 0)&&b.call(i,g))return!0;if(l[0]&&s)return!Zr(a.value,g,c.value)&&a.value.isAfter(s.value,g);if(t.value[0]&&s.value)switch(n.value){case"quarter":return f(g)tY(o,l,a));case"quarter":case"month":return i((l,a)=>$h(o,l,a));default:return i((l,a)=>t1(o,l,a))}}function SY(e,t,n,o){const r=$t(e,0),i=$t(e,1);if(t===0)return r;if(r&&i)switch(yY(r,i,n,o)){case"same":return r;case"closing":return r;default:return rc(i,n,o,-1)}return r}function $Y(e){let{values:t,picker:n,defaultDates:o,generateConfig:r}=e;const i=ne([$t(o,0),$t(o,1)]),l=ne(null),a=P(()=>$t(t.value,0)),s=P(()=>$t(t.value,1)),c=h=>i.value[h]?i.value[h]:$t(l.value,h)||SY(t.value,h,n.value,r.value)||a.value||s.value||r.value.getNow(),u=ne(null),d=ne(null);Ve(()=>{u.value=c(0),d.value=c(1)});function f(h,v){if(h){let g=ko(l.value,h,v);i.value=ko(i.value,null,v)||[null,null];const b=(v+1)%2;$t(t.value,b)||(g=ko(g,h,b)),l.value=g}else(a.value||s.value)&&(l.value=null)}return[u,d,f]}function _I(e){return ub()?(V8(e),!0):!1}function CY(e){return typeof e=="function"?e():je(e)}function v1(e){var t;const n=CY(e);return(t=n==null?void 0:n.$el)!==null&&t!==void 0?t:n}function xY(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;On()?Ke(e):t?e():rt(e)}function MI(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=oe(),o=()=>n.value=!!e();return o(),xY(o,t),n}var vv;const AI=typeof window<"u";AI&&(!((vv=window==null?void 0:window.navigator)===null||vv===void 0)&&vv.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const RI=AI?window:void 0;var wY=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r2&&arguments[2]!==void 0?arguments[2]:{};const{window:o=RI}=n,r=wY(n,["window"]);let i;const l=MI(()=>o&&"ResizeObserver"in o),a=()=>{i&&(i.disconnect(),i=void 0)},s=ye(()=>v1(e),u=>{a(),l.value&&o&&u&&(i=new ResizeObserver(t),i.observe(u,r))},{immediate:!0,flush:"post"}),c=()=>{a(),s()};return _I(c),{isSupported:l,stop:c}}function Rs(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{width:0,height:0},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{box:o="content-box"}=n,r=oe(t.width),i=oe(t.height);return OY(e,l=>{let[a]=l;const s=o==="border-box"?a.borderBoxSize:o==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;s?(r.value=s.reduce((c,u)=>{let{inlineSize:d}=u;return c+d},0),i.value=s.reduce((c,u)=>{let{blockSize:d}=u;return c+d},0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},n),ye(()=>v1(e),l=>{r.value=l?t.width:0,i.value=l?t.height:0}),{width:r,height:i}}function Aw(e,t){return e&&e[0]&&e[1]&&t.isAfter(e[0],e[1])?[e[1],e[0]]:e}function Rw(e,t,n,o){return!!(e||o&&o[t]||n[(t+1)%2])}function PY(){return re({name:"RangerPicker",inheritAttrs:!1,props:["prefixCls","id","popupStyle","dropdownClassName","transitionName","dropdownAlign","getPopupContainer","generateConfig","locale","placeholder","autofocus","disabled","format","picker","showTime","showNow","showHour","showMinute","showSecond","use12Hours","separator","value","defaultValue","defaultPickerValue","open","defaultOpen","disabledDate","disabledTime","dateRender","panelRender","ranges","allowEmpty","allowClear","suffixIcon","clearIcon","pickerRef","inputReadOnly","mode","renderExtraFooter","onChange","onOpenChange","onPanelChange","onCalendarChange","onFocus","onBlur","onMousedown","onMouseup","onMouseenter","onMouseleave","onClick","onOk","onKeydown","components","order","direction","activePickerIndex","autocomplete","minuteStep","hourStep","secondStep","hideDisabledOptions","disabledMinutes","presets","prevIcon","nextIcon","superPrevIcon","superNextIcon"],setup(e,t){let{attrs:n,expose:o}=t;const r=P(()=>e.picker==="date"&&!!e.showTime||e.picker==="time"),i=P(()=>e.presets),l=P(()=>e.ranges),a=EI(i,l),s=ne({}),c=ne(null),u=ne(null),d=ne(null),f=ne(null),h=ne(null),v=ne(null),g=ne(null),b=ne(null),y=P(()=>$I(hI(e.format,e.picker,e.showTime,e.use12Hours))),[S,$]=Dt(0,{value:We(e,"activePickerIndex")}),w=ne(null),C=P(()=>{const{disabled:_e}=e;return Array.isArray(_e)?_e:[_e||!1,_e||!1]}),[O,x]=Dt(null,{value:We(e,"value"),defaultValue:e.defaultValue,postState:_e=>e.picker==="time"&&!e.order?_e:Aw(_e,e.generateConfig)}),[I,T,M]=$Y({values:O,picker:We(e,"picker"),defaultDates:e.defaultPickerValue,generateConfig:We(e,"generateConfig")}),[E,A]=Dt(O.value,{postState:_e=>{let Je=_e;if(C.value[0]&&C.value[1])return Je;for(let Xe=0;Xe<2;Xe+=1)C.value[Xe]&&!$t(Je,Xe)&&!$t(e.allowEmpty,Xe)&&(Je=ko(Je,e.generateConfig.getNow(),Xe));return Je}}),[R,z]=Dt([e.picker,e.picker],{value:We(e,"mode")});ye(()=>e.picker,()=>{z([e.picker,e.picker])});const _=(_e,Je)=>{var Xe;z(_e),(Xe=e.onPanelChange)===null||Xe===void 0||Xe.call(e,Je,_e)},[D,N]=bY({picker:We(e,"picker"),selectedValue:E,locale:We(e,"locale"),disabled:C,disabledDate:We(e,"disabledDate"),generateConfig:We(e,"generateConfig")},s),[k,F]=Dt(!1,{value:We(e,"open"),defaultValue:e.defaultOpen,postState:_e=>C.value[S.value]?!1:_e,onChange:_e=>{var Je;(Je=e.onOpenChange)===null||Je===void 0||Je.call(e,_e),!_e&&w.value&&w.value.onClose&&w.value.onClose()}}),L=P(()=>k.value&&S.value===0),H=P(()=>k.value&&S.value===1),j=ne(0),Y=ne(0),Z=ne(0),{width:X}=Rs(c);ye([k,X],()=>{!k.value&&c.value&&(Z.value=X.value)});const{width:ee}=Rs(u),{width:U}=Rs(b),{width:Q}=Rs(d),{width:J}=Rs(h);ye([S,k,ee,U,Q,J,()=>e.direction],()=>{Y.value=0,S.value?d.value&&h.value&&(Y.value=Q.value+J.value,ee.value&&U.value&&Y.value>ee.value-U.value-(e.direction==="rtl"||b.value.offsetLeft>Y.value?0:b.value.offsetLeft)&&(j.value=Y.value)):S.value===0&&(j.value=0)},{immediate:!0});const G=ne();function q(_e,Je){if(_e)clearTimeout(G.value),s.value[Je]=!0,$(Je),F(_e),k.value||M(null,Je);else if(S.value===Je){F(_e);const Xe=s.value;G.value=setTimeout(()=>{Xe===s.value&&(s.value={})})}}function V(_e){q(!0,_e),setTimeout(()=>{const Je=[v,g][_e];Je.value&&Je.value.focus()},0)}function W(_e,Je){let Xe=_e,Et=$t(Xe,0),cn=$t(Xe,1);const{generateConfig:Ut,locale:ro,picker:Pn,order:vr,onCalendarChange:ho,allowEmpty:Mo,onChange:Ft,showTime:qo}=e;Et&&cn&&Ut.isAfter(Et,cn)&&(Pn==="week"&&!bI(Ut,ro.locale,Et,cn)||Pn==="quarter"&&!mI(Ut,Et,cn)||Pn!=="week"&&Pn!=="quarter"&&Pn!=="time"&&!(qo?ka(Ut,Et,cn):Zr(Ut,Et,cn))?(Je===0?(Xe=[Et,null],cn=null):(Et=null,Xe=[null,cn]),s.value={[Je]:!0}):(Pn!=="time"||vr!==!1)&&(Xe=Aw(Xe,Ut))),A(Xe);const Ao=Xe&&Xe[0]?En(Xe[0],{generateConfig:Ut,locale:ro,format:y.value[0]}):"",fi=Xe&&Xe[1]?En(Xe[1],{generateConfig:Ut,locale:ro,format:y.value[0]}):"";ho&&ho(Xe,[Ao,fi],{range:Je===0?"start":"end"});const pi=Rw(Et,0,C.value,Mo),Jo=Rw(cn,1,C.value,Mo);(Xe===null||pi&&Jo)&&(x(Xe),Ft&&(!ka(Ut,$t(O.value,0),Et)||!ka(Ut,$t(O.value,1),cn))&&Ft(Xe,[Ao,fi]));let Zo=null;Je===0&&!C.value[1]?Zo=1:Je===1&&!C.value[0]&&(Zo=0),Zo!==null&&Zo!==S.value&&(!s.value[Zo]||!$t(Xe,Zo))&&$t(Xe,Je)?V(Zo):q(!1,Je)}const te=_e=>k&&w.value&&w.value.onKeydown?w.value.onKeydown(_e):!1,ue={formatList:y,generateConfig:We(e,"generateConfig"),locale:We(e,"locale")},[ie,ae]=Zf(P(()=>$t(E.value,0)),ue),[ce,se]=Zf(P(()=>$t(E.value,1)),ue),pe=(_e,Je)=>{const Xe=yI(_e,{locale:e.locale,formatList:y.value,generateConfig:e.generateConfig});Xe&&!(Je===0?D:N)(Xe)&&(A(ko(E.value,Xe,Je)),M(Xe,Je))},[he,ge,me]=s0({valueTexts:ie,onTextChange:_e=>pe(_e,0)}),[xe,fe,de]=s0({valueTexts:ce,onTextChange:_e=>pe(_e,1)}),[be,we]=St(null),[Te,Re]=St(null),[Se,Ce,Pe]=c0(he,ue),[Me,De,Ae]=c0(xe,ue),Fe=_e=>{Re(ko(E.value,_e,S.value)),S.value===0?Ce(_e):De(_e)},lt=()=>{Re(ko(E.value,null,S.value)),S.value===0?Pe():Ae()},ht=(_e,Je)=>({forwardKeydown:te,onBlur:Xe=>{var Et;(Et=e.onBlur)===null||Et===void 0||Et.call(e,Xe)},isClickOutside:Xe=>!vI([u.value,d.value,f.value,c.value],Xe),onFocus:Xe=>{var Et;$(_e),(Et=e.onFocus)===null||Et===void 0||Et.call(e,Xe)},triggerOpen:Xe=>{q(Xe,_e)},onSubmit:()=>{if(!E.value||e.disabledDate&&e.disabledDate(E.value[_e]))return!1;W(E.value,_e),Je()},onCancel:()=>{q(!1,_e),A(O.value),Je()}}),[st,{focused:gt,typing:yt}]=a0(m(m({},ht(0,me)),{blurToCancel:r,open:L,value:he,onKeydown:(_e,Je)=>{var Xe;(Xe=e.onKeydown)===null||Xe===void 0||Xe.call(e,_e,Je)}})),[en,{focused:sn,typing:hn}]=a0(m(m({},ht(1,de)),{blurToCancel:r,open:H,value:xe,onKeydown:(_e,Je)=>{var Xe;(Xe=e.onKeydown)===null||Xe===void 0||Xe.call(e,_e,Je)}})),Gt=_e=>{var Je;(Je=e.onClick)===null||Je===void 0||Je.call(e,_e),!k.value&&!v.value.contains(_e.target)&&!g.value.contains(_e.target)&&(C.value[0]?C.value[1]||V(1):V(0))},An=_e=>{var Je;(Je=e.onMousedown)===null||Je===void 0||Je.call(e,_e),k.value&&(gt.value||sn.value)&&!v.value.contains(_e.target)&&!g.value.contains(_e.target)&&_e.preventDefault()},no=P(()=>{var _e;return!((_e=O.value)===null||_e===void 0)&&_e[0]?En(O.value[0],{locale:e.locale,format:"YYYYMMDDHHmmss",generateConfig:e.generateConfig}):""}),_o=P(()=>{var _e;return!((_e=O.value)===null||_e===void 0)&&_e[1]?En(O.value[1],{locale:e.locale,format:"YYYYMMDDHHmmss",generateConfig:e.generateConfig}):""});ye([k,ie,ce],()=>{k.value||(A(O.value),!ie.value.length||ie.value[0]===""?ge(""):ae.value!==he.value&&me(),!ce.value.length||ce.value[0]===""?fe(""):se.value!==xe.value&&de())}),ye([no,_o],()=>{A(O.value)}),o({focus:()=>{v.value&&v.value.focus()},blur:()=>{v.value&&v.value.blur(),g.value&&g.value.blur()}});const Yo=P(()=>k.value&&Te.value&&Te.value[0]&&Te.value[1]&&e.generateConfig.isAfter(Te.value[1],Te.value[0])?Te.value:null);function oo(){let _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{generateConfig:Xe,showTime:Et,dateRender:cn,direction:Ut,disabledTime:ro,prefixCls:Pn,locale:vr}=e;let ho=Et;if(Et&&typeof Et=="object"&&Et.defaultValue){const Ft=Et.defaultValue;ho=m(m({},Et),{defaultValue:$t(Ft,S.value)||void 0})}let Mo=null;return cn&&(Mo=Ft=>{let{current:qo,today:Ao}=Ft;return cn({current:qo,today:Ao,info:{range:S.value?"end":"start"}})}),p(sY,{value:{inRange:!0,panelPosition:_e,rangedValue:be.value||E.value,hoverRangedValue:Yo.value}},{default:()=>[p(g1,B(B(B({},e),Je),{},{dateRender:Mo,showTime:ho,mode:R.value[S.value],generateConfig:Xe,style:void 0,direction:Ut,disabledDate:S.value===0?D:N,disabledTime:Ft=>ro?ro(Ft,S.value===0?"start":"end"):!1,class:le({[`${Pn}-panel-focused`]:S.value===0?!yt.value:!hn.value}),value:$t(E.value,S.value),locale:vr,tabIndex:-1,onPanelChange:(Ft,qo)=>{S.value===0&&Pe(!0),S.value===1&&Ae(!0),_(ko(R.value,qo,S.value),ko(E.value,Ft,S.value));let Ao=Ft;_e==="right"&&R.value[S.value]===qo&&(Ao=rc(Ao,qo,Xe,-1)),M(Ao,S.value)},onOk:null,onSelect:void 0,onChange:void 0,defaultValue:S.value===0?$t(E.value,1):$t(E.value,0)}),null)]})}const el=(_e,Je)=>{const Xe=ko(E.value,_e,S.value);Je==="submit"||Je!=="key"&&!r.value?(W(Xe,S.value),S.value===0?Pe():Ae()):A(Xe)};return Jy({operationRef:w,hideHeader:P(()=>e.picker==="time"),onDateMouseenter:Fe,onDateMouseleave:lt,hideRanges:P(()=>!0),onSelect:el,open:k}),()=>{const{prefixCls:_e="rc-picker",id:Je,popupStyle:Xe,dropdownClassName:Et,transitionName:cn,dropdownAlign:Ut,getPopupContainer:ro,generateConfig:Pn,locale:vr,placeholder:ho,autofocus:Mo,picker:Ft="date",showTime:qo,separator:Ao="~",disabledDate:fi,panelRender:pi,allowClear:Jo,suffixIcon:ra,clearIcon:Zo,inputReadOnly:Cg,renderExtraFooter:sM,onMouseenter:cM,onMouseleave:uM,onMouseup:dM,onOk:XS,components:fM,direction:ws,autocomplete:YS="off"}=e,pM=ws==="rtl"?{right:`${Y.value}px`}:{left:`${Y.value}px`};function hM(){let io;const hi=OI(_e,R.value[S.value],sM),QS=PI({prefixCls:_e,components:fM,needConfirmButton:r.value,okDisabled:!$t(E.value,S.value)||fi&&fi(E.value[S.value]),locale:vr,onOk:()=>{$t(E.value,S.value)&&(W(E.value,S.value),XS&&XS(E.value))}});if(Ft!=="time"&&!qo){const gi=S.value===0?I.value:T.value,mM=rc(gi,Ft,Pn),Pg=R.value[S.value]===Ft,e$=oo(Pg?"left":!1,{pickerValue:gi,onPickerValueChange:Ig=>{M(Ig,S.value)}}),t$=oo("right",{pickerValue:mM,onPickerValueChange:Ig=>{M(rc(Ig,Ft,Pn,-1),S.value)}});ws==="rtl"?io=p(Le,null,[t$,Pg&&e$]):io=p(Le,null,[e$,Pg&&t$])}else io=oo();let Og=p("div",{class:`${_e}-panel-layout`},[p(TI,{prefixCls:_e,presets:a.value,onClick:gi=>{W(gi,null),q(!1,S.value)},onHover:gi=>{we(gi)}},null),p("div",null,[p("div",{class:`${_e}-panels`},[io]),(hi||QS)&&p("div",{class:`${_e}-footer`},[hi,QS])])]);return pi&&(Og=pi(Og)),p("div",{class:`${_e}-panel-container`,style:{marginLeft:`${j.value}px`},ref:u,onMousedown:gi=>{gi.preventDefault()}},[Og])}const gM=p("div",{class:le(`${_e}-range-wrapper`,`${_e}-${Ft}-range-wrapper`),style:{minWidth:`${Z.value}px`}},[p("div",{ref:b,class:`${_e}-range-arrow`,style:pM},null),hM()]);let qS;ra&&(qS=p("span",{class:`${_e}-suffix`},[ra]));let JS;Jo&&($t(O.value,0)&&!C.value[0]||$t(O.value,1)&&!C.value[1])&&(JS=p("span",{onMousedown:io=>{io.preventDefault(),io.stopPropagation()},onMouseup:io=>{io.preventDefault(),io.stopPropagation();let hi=O.value;C.value[0]||(hi=ko(hi,null,0)),C.value[1]||(hi=ko(hi,null,1)),W(hi,null),q(!1,S.value)},class:`${_e}-clear`},[Zo||p("span",{class:`${_e}-clear-btn`},null)]));const ZS={size:gI(Ft,y.value[0],Pn)};let xg=0,wg=0;d.value&&f.value&&h.value&&(S.value===0?wg=d.value.offsetWidth:(xg=Y.value,wg=f.value.offsetWidth));const vM=ws==="rtl"?{right:`${xg}px`}:{left:`${xg}px`};return p("div",B({ref:c,class:le(_e,`${_e}-range`,n.class,{[`${_e}-disabled`]:C.value[0]&&C.value[1],[`${_e}-focused`]:S.value===0?gt.value:sn.value,[`${_e}-rtl`]:ws==="rtl"}),style:n.style,onClick:Gt,onMouseenter:cM,onMouseleave:uM,onMousedown:An,onMouseup:dM},CI(e)),[p("div",{class:le(`${_e}-input`,{[`${_e}-input-active`]:S.value===0,[`${_e}-input-placeholder`]:!!Se.value}),ref:d},[p("input",B(B(B({id:Je,disabled:C.value[0],readonly:Cg||typeof y.value[0]=="function"||!yt.value,value:Se.value||he.value,onInput:io=>{ge(io.target.value)},autofocus:Mo,placeholder:$t(ho,0)||"",ref:v},st.value),ZS),{},{autocomplete:YS}),null)]),p("div",{class:`${_e}-range-separator`,ref:h},[Ao]),p("div",{class:le(`${_e}-input`,{[`${_e}-input-active`]:S.value===1,[`${_e}-input-placeholder`]:!!Me.value}),ref:f},[p("input",B(B(B({disabled:C.value[1],readonly:Cg||typeof y.value[0]=="function"||!hn.value,value:Me.value||xe.value,onInput:io=>{fe(io.target.value)},placeholder:$t(ho,1)||"",ref:g},en.value),ZS),{},{autocomplete:YS}),null)]),p("div",{class:`${_e}-active-bar`,style:m(m({},vM),{width:`${wg}px`,position:"absolute"})},null),qS,JS,p(II,{visible:k.value,popupStyle:Xe,prefixCls:_e,dropdownClassName:Et,dropdownAlign:Ut,getPopupContainer:ro,transitionName:cn,range:!0,direction:ws},{default:()=>[p("div",{style:{pointerEvents:"none",position:"absolute",top:0,bottom:0,left:0,right:0}},null)],popupElement:()=>gM})])}}})}const IY=PY();var TY=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);re.checked,()=>{i.value=e.checked}),r({focus(){var u;(u=l.value)===null||u===void 0||u.focus()},blur(){var u;(u=l.value)===null||u===void 0||u.blur()}});const a=ne(),s=u=>{if(e.disabled)return;e.checked===void 0&&(i.value=u.target.checked),u.shiftKey=a.value;const d={target:m(m({},e),{checked:u.target.checked}),stopPropagation(){u.stopPropagation()},preventDefault(){u.preventDefault()},nativeEvent:u};e.checked!==void 0&&(l.value.checked=!!e.checked),o("change",d),a.value=!1},c=u=>{o("click",u),a.value=u.shiftKey};return()=>{const{prefixCls:u,name:d,id:f,type:h,disabled:v,readonly:g,tabindex:b,autofocus:y,value:S,required:$}=e,w=TY(e,["prefixCls","name","id","type","disabled","readonly","tabindex","autofocus","value","required"]),{class:C,onFocus:O,onBlur:x,onKeydown:I,onKeypress:T,onKeyup:M}=n,E=m(m({},w),n),A=Object.keys(E).reduce((_,D)=>((D.startsWith("data-")||D.startsWith("aria-")||D==="role")&&(_[D]=E[D]),_),{}),R=le(u,C,{[`${u}-checked`]:i.value,[`${u}-disabled`]:v}),z=m(m({name:d,id:f,type:h,readonly:g,disabled:v,tabindex:b,class:`${u}-input`,checked:!!i.value,autofocus:y,value:S},A),{onChange:s,onClick:c,onFocus:O,onBlur:x,onKeydown:I,onKeypress:T,onKeyup:M,required:$});return p("span",{class:R},[p("input",B({ref:l},z),null),p("span",{class:`${u}-inner`},null)])}}}),BI=Symbol("radioGroupContextKey"),_Y=e=>{Ye(BI,e)},MY=()=>Ge(BI,void 0),NI=Symbol("radioOptionTypeContextKey"),AY=e=>{Ye(NI,e)},RY=()=>Ge(NI,void 0),DY=new it("antRadioEffect",{"0%":{transform:"scale(1)",opacity:.5},"100%":{transform:"scale(1.6)",opacity:0}}),BY=e=>{const{componentCls:t,antCls:n}=e,o=`${t}-group`;return{[o]:m(m({},qe(e)),{display:"inline-block",fontSize:0,[`&${o}-rtl`]:{direction:"rtl"},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:"none"}})}},NY=e=>{const{componentCls:t,radioWrapperMarginRight:n,radioCheckedColor:o,radioSize:r,motionDurationSlow:i,motionDurationMid:l,motionEaseInOut:a,motionEaseInOutCirc:s,radioButtonBg:c,colorBorder:u,lineWidth:d,radioDotSize:f,colorBgContainerDisabled:h,colorTextDisabled:v,paddingXS:g,radioDotDisabledColor:b,lineType:y,radioDotDisabledSize:S,wireframe:$,colorWhite:w}=e,C=`${t}-inner`;return{[`${t}-wrapper`]:m(m({},qe(e)),{position:"relative",display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer",[`&${t}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:e.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},[`${t}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${d}px ${y} ${o}`,borderRadius:"50%",visibility:"hidden",animationName:DY,animationDuration:i,animationTimingFunction:a,animationFillMode:"both",content:'""'},[t]:m(m({},qe(e)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center"}),[`${t}-wrapper:hover &, + &:hover ${C}`]:{borderColor:o},[`${t}-input:focus-visible + ${C}`]:m({},ni(e)),[`${t}:hover::after, ${t}-wrapper:hover &::after`]:{visibility:"visible"},[`${t}-inner`]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:r,height:r,marginBlockStart:r/-2,marginInlineStart:r/-2,backgroundColor:$?o:w,borderBlockStart:0,borderInlineStart:0,borderRadius:r,transform:"scale(0)",opacity:0,transition:`all ${i} ${s}`,content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:r,height:r,backgroundColor:c,borderColor:u,borderStyle:"solid",borderWidth:d,borderRadius:"50%",transition:`all ${l}`},[`${t}-input`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,insetBlockEnd:0,insetInlineStart:0,zIndex:1,cursor:"pointer",opacity:0},[`${t}-checked`]:{[C]:{borderColor:o,backgroundColor:$?c:o,"&::after":{transform:`scale(${f/r})`,opacity:1,transition:`all ${i} ${s}`}}},[`${t}-disabled`]:{cursor:"not-allowed",[C]:{backgroundColor:h,borderColor:u,cursor:"not-allowed","&::after":{backgroundColor:b}},[`${t}-input`]:{cursor:"not-allowed"},[`${t}-disabled + span`]:{color:v,cursor:"not-allowed"},[`&${t}-checked`]:{[C]:{"&::after":{transform:`scale(${S/r})`}}}},[`span${t} + *`]:{paddingInlineStart:g,paddingInlineEnd:g}})}},kY=e=>{const{radioButtonColor:t,controlHeight:n,componentCls:o,lineWidth:r,lineType:i,colorBorder:l,motionDurationSlow:a,motionDurationMid:s,radioButtonPaddingHorizontal:c,fontSize:u,radioButtonBg:d,fontSizeLG:f,controlHeightLG:h,controlHeightSM:v,paddingXS:g,borderRadius:b,borderRadiusSM:y,borderRadiusLG:S,radioCheckedColor:$,radioButtonCheckedBg:w,radioButtonHoverColor:C,radioButtonActiveColor:O,radioSolidCheckedColor:x,colorTextDisabled:I,colorBgContainerDisabled:T,radioDisabledButtonCheckedColor:M,radioDisabledButtonCheckedBg:E}=e;return{[`${o}-button-wrapper`]:{position:"relative",display:"inline-block",height:n,margin:0,paddingInline:c,paddingBlock:0,color:t,fontSize:u,lineHeight:`${n-r*2}px`,background:d,border:`${r}px ${i} ${l}`,borderBlockStartWidth:r+.02,borderInlineStartWidth:0,borderInlineEndWidth:r,cursor:"pointer",transition:[`color ${s}`,`background ${s}`,`border-color ${s}`,`box-shadow ${s}`].join(","),a:{color:t},[`> ${o}-button`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:first-child)":{"&::before":{position:"absolute",insetBlockStart:-r,insetInlineStart:-r,display:"block",boxSizing:"content-box",width:1,height:"100%",paddingBlock:r,paddingInline:0,backgroundColor:l,transition:`background-color ${a}`,content:'""'}},"&:first-child":{borderInlineStart:`${r}px ${i} ${l}`,borderStartStartRadius:b,borderEndStartRadius:b},"&:last-child":{borderStartEndRadius:b,borderEndEndRadius:b},"&:first-child:last-child":{borderRadius:b},[`${o}-group-large &`]:{height:h,fontSize:f,lineHeight:`${h-r*2}px`,"&:first-child":{borderStartStartRadius:S,borderEndStartRadius:S},"&:last-child":{borderStartEndRadius:S,borderEndEndRadius:S}},[`${o}-group-small &`]:{height:v,paddingInline:g-r,paddingBlock:0,lineHeight:`${v-r*2}px`,"&:first-child":{borderStartStartRadius:y,borderEndStartRadius:y},"&:last-child":{borderStartEndRadius:y,borderEndEndRadius:y}},"&:hover":{position:"relative",color:$},"&:has(:focus-visible)":m({},ni(e)),[`${o}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:"none"},[`&-checked:not(${o}-button-wrapper-disabled)`]:{zIndex:1,color:$,background:w,borderColor:$,"&::before":{backgroundColor:$},"&:first-child":{borderColor:$},"&:hover":{color:C,borderColor:C,"&::before":{backgroundColor:C}},"&:active":{color:O,borderColor:O,"&::before":{backgroundColor:O}}},[`${o}-group-solid &-checked:not(${o}-button-wrapper-disabled)`]:{color:x,background:$,borderColor:$,"&:hover":{color:x,background:C,borderColor:C},"&:active":{color:x,background:O,borderColor:O}},"&-disabled":{color:I,backgroundColor:T,borderColor:l,cursor:"not-allowed","&:first-child, &:hover":{color:I,backgroundColor:T,borderColor:l}},[`&-disabled${o}-button-wrapper-checked`]:{color:M,backgroundColor:E,borderColor:l,boxShadow:"none"}}}},kI=Ue("Radio",e=>{const{padding:t,lineWidth:n,controlItemBgActiveDisabled:o,colorTextDisabled:r,colorBgContainer:i,fontSizeLG:l,controlOutline:a,colorPrimaryHover:s,colorPrimaryActive:c,colorText:u,colorPrimary:d,marginXS:f,controlOutlineWidth:h,colorTextLightSolid:v,wireframe:g}=e,b=`0 0 0 ${h}px ${a}`,y=b,S=l,$=4,w=S-$*2,C=g?w:S-($+n)*2,O=d,x=u,I=s,T=c,M=t-n,R=ze(e,{radioFocusShadow:b,radioButtonFocusShadow:y,radioSize:S,radioDotSize:C,radioDotDisabledSize:w,radioCheckedColor:O,radioDotDisabledColor:r,radioSolidCheckedColor:v,radioButtonBg:i,radioButtonCheckedBg:i,radioButtonColor:x,radioButtonHoverColor:I,radioButtonActiveColor:T,radioButtonPaddingHorizontal:M,radioDisabledButtonCheckedBg:o,radioDisabledButtonCheckedColor:r,radioWrapperMarginRight:f});return[BY(R),NY(R),kY(R)]});var FY=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefixCls:String,checked:$e(),disabled:$e(),isGroup:$e(),value:K.any,name:String,id:String,autofocus:$e(),onChange:ve(),onFocus:ve(),onBlur:ve(),onClick:ve(),"onUpdate:checked":ve(),"onUpdate:value":ve()}),Xn=re({compatConfig:{MODE:3},name:"ARadio",inheritAttrs:!1,props:FI(),setup(e,t){let{emit:n,expose:o,slots:r,attrs:i}=t;const l=an(),a=yn.useInject(),s=RY(),c=MY(),u=po(),d=P(()=>{var I;return(I=g.value)!==null&&I!==void 0?I:u.value}),f=ne(),{prefixCls:h,direction:v,disabled:g}=Ee("radio",e),b=P(()=>(c==null?void 0:c.optionType.value)==="button"||s==="button"?`${h.value}-button`:h.value),y=po(),[S,$]=kI(h);o({focus:()=>{f.value.focus()},blur:()=>{f.value.blur()}});const O=I=>{const T=I.target.checked;n("update:checked",T),n("update:value",T),n("change",I),l.onFieldChange()},x=I=>{n("change",I),c&&c.onChange&&c.onChange(I)};return()=>{var I;const T=c,{prefixCls:M,id:E=l.id.value}=e,A=FY(e,["prefixCls","id"]),R=m(m({prefixCls:b.value,id:E},ot(A,["onUpdate:checked","onUpdate:value"])),{disabled:(I=g.value)!==null&&I!==void 0?I:y.value});T?(R.name=T.name.value,R.onChange=x,R.checked=e.value===T.value.value,R.disabled=d.value||T.disabled.value):R.onChange=O;const z=le({[`${b.value}-wrapper`]:!0,[`${b.value}-wrapper-checked`]:R.checked,[`${b.value}-wrapper-disabled`]:R.disabled,[`${b.value}-wrapper-rtl`]:v.value==="rtl",[`${b.value}-wrapper-in-form-item`]:a.isFormItemInput},i.class,$.value);return S(p("label",B(B({},i),{},{class:z}),[p(DI,B(B({},R),{},{type:"radio",ref:f}),null),r.default&&p("span",null,[r.default()])]))}}}),LY=()=>({prefixCls:String,value:K.any,size:Ne(),options:ct(),disabled:$e(),name:String,buttonStyle:Ne("outline"),id:String,optionType:Ne("default"),onChange:ve(),"onUpdate:value":ve()}),m1=re({compatConfig:{MODE:3},name:"ARadioGroup",inheritAttrs:!1,props:LY(),setup(e,t){let{slots:n,emit:o,attrs:r}=t;const i=an(),{prefixCls:l,direction:a,size:s}=Ee("radio",e),[c,u]=kI(l),d=ne(e.value),f=ne(!1);return ye(()=>e.value,v=>{d.value=v,f.value=!1}),_Y({onChange:v=>{const g=d.value,{value:b}=v.target;"value"in e||(d.value=b),!f.value&&b!==g&&(f.value=!0,o("update:value",b),o("change",v),i.onFieldChange()),rt(()=>{f.value=!1})},value:d,disabled:P(()=>e.disabled),name:P(()=>e.name),optionType:P(()=>e.optionType)}),()=>{var v;const{options:g,buttonStyle:b,id:y=i.id.value}=e,S=`${l.value}-group`,$=le(S,`${S}-${b}`,{[`${S}-${s.value}`]:s.value,[`${S}-rtl`]:a.value==="rtl"},r.class,u.value);let w=null;return g&&g.length>0?w=g.map(C=>{if(typeof C=="string"||typeof C=="number")return p(Xn,{key:C,prefixCls:l.value,disabled:e.disabled,value:C,checked:d.value===C},{default:()=>[C]});const{value:O,disabled:x,label:I}=C;return p(Xn,{key:`radio-group-value-options-${O}`,prefixCls:l.value,disabled:x||e.disabled,value:O,checked:d.value===O},{default:()=>[I]})}):w=(v=n.default)===null||v===void 0?void 0:v.call(n),c(p("div",B(B({},r),{},{class:$,id:y}),[w]))}}}),Qf=re({compatConfig:{MODE:3},name:"ARadioButton",inheritAttrs:!1,props:FI(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r}=Ee("radio",e);return AY("button"),()=>{var i;return p(Xn,B(B(B({},o),e),{},{prefixCls:r.value}),{default:()=>[(i=n.default)===null||i===void 0?void 0:i.call(n)]})}}});Xn.Group=m1;Xn.Button=Qf;Xn.install=function(e){return e.component(Xn.name,Xn),e.component(Xn.Group.name,Xn.Group),e.component(Xn.Button.name,Xn.Button),e};const zY=10,HY=20;function LI(e){const{fullscreen:t,validRange:n,generateConfig:o,locale:r,prefixCls:i,value:l,onChange:a,divRef:s}=e,c=o.getYear(l||o.getNow());let u=c-zY,d=u+HY;n&&(u=o.getYear(n[0]),d=o.getYear(n[1])+1);const f=r&&r.year==="年"?"年":"",h=[];for(let v=u;v{let g=o.setYear(l,v);if(n){const[b,y]=n,S=o.getYear(g),$=o.getMonth(g);S===o.getYear(y)&&$>o.getMonth(y)&&(g=o.setMonth(g,o.getMonth(y))),S===o.getYear(b)&&$s.value},null)}LI.inheritAttrs=!1;function zI(e){const{prefixCls:t,fullscreen:n,validRange:o,value:r,generateConfig:i,locale:l,onChange:a,divRef:s}=e,c=i.getMonth(r||i.getNow());let u=0,d=11;if(o){const[v,g]=o,b=i.getYear(r);i.getYear(g)===b&&(d=i.getMonth(g)),i.getYear(v)===b&&(u=i.getMonth(v))}const f=l.shortMonths||i.locale.getShortMonths(l.locale),h=[];for(let v=u;v<=d;v+=1)h.push({label:f[v],value:v});return p(Cn,{size:n?void 0:"small",class:`${t}-month-select`,value:c,options:h,onChange:v=>{a(i.setMonth(r,v))},getPopupContainer:()=>s.value},null)}zI.inheritAttrs=!1;function HI(e){const{prefixCls:t,locale:n,mode:o,fullscreen:r,onModeChange:i}=e;return p(m1,{onChange:l=>{let{target:{value:a}}=l;i(a)},value:o,size:r?void 0:"small",class:`${t}-mode-switch`},{default:()=>[p(Qf,{value:"month"},{default:()=>[n.month]}),p(Qf,{value:"year"},{default:()=>[n.year]})]})}HI.inheritAttrs=!1;const jY=re({name:"CalendarHeader",inheritAttrs:!1,props:["mode","prefixCls","value","validRange","generateConfig","locale","mode","fullscreen"],setup(e,t){let{attrs:n}=t;const o=ne(null),r=yn.useInject();return yn.useProvide(r,{isFormItemInput:!1}),()=>{const i=m(m({},e),n),{prefixCls:l,fullscreen:a,mode:s,onChange:c,onModeChange:u}=i,d=m(m({},i),{fullscreen:a,divRef:o});return p("div",{class:`${l}-header`,ref:o},[p(LI,B(B({},d),{},{onChange:f=>{c(f,"year")}}),null),s==="month"&&p(zI,B(B({},d),{},{onChange:f=>{c(f,"month")}}),null),p(HI,B(B({},d),{},{onModeChange:u}),null)])}}}),b1=e=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:e,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),gs=e=>({borderColor:e.inputBorderHoverColor,borderInlineEndWidth:e.lineWidth}),ji=e=>({borderColor:e.inputBorderHoverColor,boxShadow:`0 0 0 ${e.controlOutlineWidth}px ${e.controlOutline}`,borderInlineEndWidth:e.lineWidth,outline:0}),y1=e=>({color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"&:hover":m({},gs(ze(e,{inputBorderHoverColor:e.colorBorder})))}),jI=e=>{const{inputPaddingVerticalLG:t,fontSizeLG:n,lineHeightLG:o,borderRadiusLG:r,inputPaddingHorizontalLG:i}=e;return{padding:`${t}px ${i}px`,fontSize:n,lineHeight:o,borderRadius:r}},S1=e=>({padding:`${e.inputPaddingVerticalSM}px ${e.controlPaddingHorizontalSM-1}px`,borderRadius:e.borderRadiusSM}),au=(e,t)=>{const{componentCls:n,colorError:o,colorWarning:r,colorErrorOutline:i,colorWarningOutline:l,colorErrorBorderHover:a,colorWarningBorderHover:s}=e;return{[`&-status-error:not(${t}-disabled):not(${t}-borderless)${t}`]:{borderColor:o,"&:hover":{borderColor:a},"&:focus, &-focused":m({},ji(ze(e,{inputBorderActiveColor:o,inputBorderHoverColor:o,controlOutline:i}))),[`${n}-prefix`]:{color:o}},[`&-status-warning:not(${t}-disabled):not(${t}-borderless)${t}`]:{borderColor:r,"&:hover":{borderColor:s},"&:focus, &-focused":m({},ji(ze(e,{inputBorderActiveColor:r,inputBorderHoverColor:r,controlOutline:l}))),[`${n}-prefix`]:{color:r}}}},ta=e=>m(m({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:`${e.inputPaddingVertical}px ${e.inputPaddingHorizontal}px`,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,backgroundColor:e.colorBgContainer,backgroundImage:"none",borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:e.colorBorder,borderRadius:e.borderRadius,transition:`all ${e.motionDurationMid}`},b1(e.colorTextPlaceholder)),{"&:hover":m({},gs(e)),"&:focus, &-focused":m({},ji(e)),"&-disabled, &[disabled]":m({},y1(e)),"&-borderless":{"&, &:hover, &:focus, &-focused, &-disabled, &[disabled]":{backgroundColor:"transparent",border:"none",boxShadow:"none"}},"textarea&":{maxWidth:"100%",height:"auto",minHeight:e.controlHeight,lineHeight:e.lineHeight,verticalAlign:"bottom",transition:`all ${e.motionDurationSlow}, height 0s`,resize:"vertical"},"&-lg":m({},jI(e)),"&-sm":m({},S1(e)),"&-rtl":{direction:"rtl"},"&-textarea-rtl":{direction:"rtl"}}),VI=e=>{const{componentCls:t,antCls:n}=e;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:e.paddingXS,"&:last-child":{paddingInlineEnd:0}},[`&-lg ${t}, &-lg > ${t}-group-addon`]:m({},jI(e)),[`&-sm ${t}, &-sm > ${t}-group-addon`]:m({},S1(e)),[`> ${t}`]:{display:"table-cell","&:not(:first-child):not(:last-child)":{borderRadius:0}},[`${t}-group`]:{"&-addon, &-wrap":{display:"table-cell",width:1,whiteSpace:"nowrap",verticalAlign:"middle","&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:"block !important"},"&-addon":{position:"relative",padding:`0 ${e.inputPaddingHorizontal}px`,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,textAlign:"center",backgroundColor:e.colorFillAlter,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadius,transition:`all ${e.motionDurationSlow}`,lineHeight:1,[`${n}-select`]:{margin:`-${e.inputPaddingVertical+1}px -${e.inputPaddingHorizontal}px`,[`&${n}-select-single:not(${n}-select-customize-input)`]:{[`${n}-select-selector`]:{backgroundColor:"inherit",border:`${e.lineWidth}px ${e.lineType} transparent`,boxShadow:"none"}},"&-open, &-focused":{[`${n}-select-selector`]:{color:e.colorPrimary}}},[`${n}-cascader-picker`]:{margin:`-9px -${e.inputPaddingHorizontal}px`,backgroundColor:"transparent",[`${n}-cascader-input`]:{textAlign:"start",border:0,boxShadow:"none"}}},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}},[`${t}`]:{float:"inline-start",width:"100%",marginBottom:0,textAlign:"inherit","&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1,[`${t}-search-with-button &`]:{zIndex:0}}},[`> ${t}:first-child, ${t}-group-addon:first-child`]:{borderStartEndRadius:0,borderEndEndRadius:0,[`${n}-select ${n}-select-selector`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${t}-affix-wrapper`]:{[`&:not(:first-child) ${t}`]:{borderStartStartRadius:0,borderEndStartRadius:0},[`&:not(:last-child) ${t}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${t}:last-child, ${t}-group-addon:last-child`]:{borderStartStartRadius:0,borderEndStartRadius:0,[`${n}-select ${n}-select-selector`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`${t}-affix-wrapper`]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0,[`${t}-search &`]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius}},[`&:not(:first-child), ${t}-search &:not(:first-child)`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`&${t}-group-compact`]:m(m({display:"block"},lr()),{[`${t}-group-addon, ${t}-group-wrap, > ${t}`]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:e.lineWidth,"&:hover":{zIndex:1},"&:focus":{zIndex:1}}},"& > *":{display:"inline-block",float:"none",verticalAlign:"top",borderRadius:0},[`& > ${t}-affix-wrapper`]:{display:"inline-flex"},[`& > ${n}-picker-range`]:{display:"inline-flex"},"& > *:not(:last-child)":{marginInlineEnd:-e.lineWidth,borderInlineEndWidth:e.lineWidth},[`${t}`]:{float:"none"},[`& > ${n}-select > ${n}-select-selector, + & > ${n}-select-auto-complete ${t}, + & > ${n}-cascader-picker ${t}, + & > ${t}-group-wrapper ${t}`]:{borderInlineEndWidth:e.lineWidth,borderRadius:0,"&:hover":{zIndex:1},"&:focus":{zIndex:1}},[`& > ${n}-select-focused`]:{zIndex:1},[`& > ${n}-select > ${n}-select-arrow`]:{zIndex:1},[`& > *:first-child, + & > ${n}-select:first-child > ${n}-select-selector, + & > ${n}-select-auto-complete:first-child ${t}, + & > ${n}-cascader-picker:first-child ${t}`]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius},[`& > *:last-child, + & > ${n}-select:last-child > ${n}-select-selector, + & > ${n}-cascader-picker:last-child ${t}, + & > ${n}-cascader-picker-focused:last-child ${t}`]:{borderInlineEndWidth:e.lineWidth,borderStartEndRadius:e.borderRadius,borderEndEndRadius:e.borderRadius},[`& > ${n}-select-auto-complete ${t}`]:{verticalAlign:"top"},[`${t}-group-wrapper + ${t}-group-wrapper`]:{marginInlineStart:-e.lineWidth,[`${t}-affix-wrapper`]:{borderRadius:0}},[`${t}-group-wrapper:not(:last-child)`]:{[`&${t}-search > ${t}-group`]:{[`& > ${t}-group-addon > ${t}-search-button`]:{borderRadius:0},[`& > ${t}`]:{borderStartStartRadius:e.borderRadius,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:e.borderRadius}}}}),[`&&-sm ${n}-btn`]:{fontSize:e.fontSizeSM,height:e.controlHeightSM,lineHeight:"normal"},[`&&-lg ${n}-btn`]:{fontSize:e.fontSizeLG,height:e.controlHeightLG,lineHeight:"normal"},[`&&-lg ${n}-select-single ${n}-select-selector`]:{height:`${e.controlHeightLG}px`,[`${n}-select-selection-item, ${n}-select-selection-placeholder`]:{lineHeight:`${e.controlHeightLG-2}px`},[`${n}-select-selection-search-input`]:{height:`${e.controlHeightLG}px`}},[`&&-sm ${n}-select-single ${n}-select-selector`]:{height:`${e.controlHeightSM}px`,[`${n}-select-selection-item, ${n}-select-selection-placeholder`]:{lineHeight:`${e.controlHeightSM-2}px`},[`${n}-select-selection-search-input`]:{height:`${e.controlHeightSM}px`}}}},VY=e=>{const{componentCls:t,controlHeightSM:n,lineWidth:o}=e,i=(n-o*2-16)/2;return{[t]:m(m(m(m({},qe(e)),ta(e)),au(e,t)),{'&[type="color"]':{height:e.controlHeight,[`&${t}-lg`]:{height:e.controlHeightLG},[`&${t}-sm`]:{height:n,paddingTop:i,paddingBottom:i}}})}},WY=e=>{const{componentCls:t}=e;return{[`${t}-clear-icon`]:{margin:0,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,verticalAlign:-1,cursor:"pointer",transition:`color ${e.motionDurationSlow}`,"&:hover":{color:e.colorTextTertiary},"&:active":{color:e.colorText},"&-hidden":{visibility:"hidden"},"&-has-suffix":{margin:`0 ${e.inputAffixPadding}px`}},"&-textarea-with-clear-btn":{padding:"0 !important",border:"0 !important",[`${t}-clear-icon`]:{position:"absolute",insetBlockStart:e.paddingXS,insetInlineEnd:e.paddingXS,zIndex:1}}}},KY=e=>{const{componentCls:t,inputAffixPadding:n,colorTextDescription:o,motionDurationSlow:r,colorIcon:i,colorIconHover:l,iconCls:a}=e;return{[`${t}-affix-wrapper`]:m(m(m(m(m({},ta(e)),{display:"inline-flex",[`&:not(${t}-affix-wrapper-disabled):hover`]:m(m({},gs(e)),{zIndex:1,[`${t}-search-with-button &`]:{zIndex:0}}),"&-focused, &:focus":{zIndex:1},"&-disabled":{[`${t}[disabled]`]:{background:"transparent"}},[`> input${t}`]:{padding:0,fontSize:"inherit",border:"none",borderRadius:0,outline:"none","&:focus":{boxShadow:"none !important"}},"&::before":{width:0,visibility:"hidden",content:'"\\a0"'},[`${t}`]:{"&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center","> *:not(:last-child)":{marginInlineEnd:e.paddingXS}},"&-show-count-suffix":{color:o},"&-show-count-has-suffix":{marginInlineEnd:e.paddingXXS},"&-prefix":{marginInlineEnd:n},"&-suffix":{marginInlineStart:n}}}),WY(e)),{[`${a}${t}-password-icon`]:{color:i,cursor:"pointer",transition:`all ${r}`,"&:hover":{color:l}}}),au(e,`${t}-affix-wrapper`))}},GY=e=>{const{componentCls:t,colorError:n,colorSuccess:o,borderRadiusLG:r,borderRadiusSM:i}=e;return{[`${t}-group`]:m(m(m({},qe(e)),VI(e)),{"&-rtl":{direction:"rtl"},"&-wrapper":{display:"inline-block",width:"100%",textAlign:"start",verticalAlign:"top","&-rtl":{direction:"rtl"},"&-lg":{[`${t}-group-addon`]:{borderRadius:r}},"&-sm":{[`${t}-group-addon`]:{borderRadius:i}},"&-status-error":{[`${t}-group-addon`]:{color:n,borderColor:n}},"&-status-warning":{[`${t}-group-addon:last-child`]:{color:o,borderColor:o}}}})}},UY=e=>{const{componentCls:t,antCls:n}=e,o=`${t}-search`;return{[o]:{[`${t}`]:{"&:hover, &:focus":{borderColor:e.colorPrimaryHover,[`+ ${t}-group-addon ${o}-button:not(${n}-btn-primary)`]:{borderInlineStartColor:e.colorPrimaryHover}}},[`${t}-affix-wrapper`]:{borderRadius:0},[`${t}-lg`]:{lineHeight:e.lineHeightLG-2e-4},[`> ${t}-group`]:{[`> ${t}-group-addon:last-child`]:{insetInlineStart:-1,padding:0,border:0,[`${o}-button`]:{paddingTop:0,paddingBottom:0,borderStartStartRadius:0,borderStartEndRadius:e.borderRadius,borderEndEndRadius:e.borderRadius,borderEndStartRadius:0},[`${o}-button:not(${n}-btn-primary)`]:{color:e.colorTextDescription,"&:hover":{color:e.colorPrimaryHover},"&:active":{color:e.colorPrimaryActive},[`&${n}-btn-loading::before`]:{insetInlineStart:0,insetInlineEnd:0,insetBlockStart:0,insetBlockEnd:0}}}},[`${o}-button`]:{height:e.controlHeight,"&:hover, &:focus":{zIndex:1}},[`&-large ${o}-button`]:{height:e.controlHeightLG},[`&-small ${o}-button`]:{height:e.controlHeightSM},"&-rtl":{direction:"rtl"},[`&${t}-compact-item`]:{[`&:not(${t}-compact-last-item)`]:{[`${t}-group-addon`]:{[`${t}-search-button`]:{marginInlineEnd:-e.lineWidth,borderRadius:0}}},[`&:not(${t}-compact-first-item)`]:{[`${t},${t}-affix-wrapper`]:{borderRadius:0}},[`> ${t}-group-addon ${t}-search-button, + > ${t}, + ${t}-affix-wrapper`]:{"&:hover,&:focus,&:active":{zIndex:2}},[`> ${t}-affix-wrapper-focused`]:{zIndex:2}}}}};function na(e){return ze(e,{inputAffixPadding:e.paddingXXS,inputPaddingVertical:Math.max(Math.round((e.controlHeight-e.fontSize*e.lineHeight)/2*10)/10-e.lineWidth,3),inputPaddingVerticalLG:Math.ceil((e.controlHeightLG-e.fontSizeLG*e.lineHeightLG)/2*10)/10-e.lineWidth,inputPaddingVerticalSM:Math.max(Math.round((e.controlHeightSM-e.fontSize*e.lineHeight)/2*10)/10-e.lineWidth,0),inputPaddingHorizontal:e.paddingSM-e.lineWidth,inputPaddingHorizontalSM:e.paddingXS-e.lineWidth,inputPaddingHorizontalLG:e.controlPaddingHorizontal-e.lineWidth,inputBorderHoverColor:e.colorPrimaryHover,inputBorderActiveColor:e.colorPrimaryHover})}const XY=e=>{const{componentCls:t,inputPaddingHorizontal:n,paddingLG:o}=e,r=`${t}-textarea`;return{[r]:{position:"relative",[`${r}-suffix`]:{position:"absolute",top:0,insetInlineEnd:n,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto"},"&-status-error,\n &-status-warning,\n &-status-success,\n &-status-validating":{[`&${r}-has-feedback`]:{[`${t}`]:{paddingInlineEnd:o}}},"&-show-count":{[`> ${t}`]:{height:"100%"},"&::after":{color:e.colorTextDescription,whiteSpace:"nowrap",content:"attr(data-count)",pointerEvents:"none",float:"right"}},"&-rtl":{"&::after":{float:"left"}}}}},$1=Ue("Input",e=>{const t=na(e);return[VY(t),XY(t),KY(t),GY(t),UY(t),fs(t)]}),mv=(e,t,n,o)=>{const{lineHeight:r}=e,i=Math.floor(n*r)+2,l=Math.max((t-i)/2,0),a=Math.max(t-i-l,0);return{padding:`${l}px ${o}px ${a}px`}},YY=e=>{const{componentCls:t,pickerCellCls:n,pickerCellInnerCls:o,pickerPanelCellHeight:r,motionDurationSlow:i,borderRadiusSM:l,motionDurationMid:a,controlItemBgHover:s,lineWidth:c,lineType:u,colorPrimary:d,controlItemBgActive:f,colorTextLightSolid:h,controlHeightSM:v,pickerDateHoverRangeBorderColor:g,pickerCellBorderGap:b,pickerBasicCellHoverWithRangeColor:y,pickerPanelCellWidth:S,colorTextDisabled:$,colorBgContainerDisabled:w}=e;return{"&::before":{position:"absolute",top:"50%",insetInlineStart:0,insetInlineEnd:0,zIndex:1,height:r,transform:"translateY(-50%)",transition:`all ${i}`,content:'""'},[o]:{position:"relative",zIndex:2,display:"inline-block",minWidth:r,height:r,lineHeight:`${r}px`,borderRadius:l,transition:`background ${a}, border ${a}`},[`&:hover:not(${n}-in-view), + &:hover:not(${n}-selected):not(${n}-range-start):not(${n}-range-end):not(${n}-range-hover-start):not(${n}-range-hover-end)`]:{[o]:{background:s}},[`&-in-view${n}-today ${o}`]:{"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:1,border:`${c}px ${u} ${d}`,borderRadius:l,content:'""'}},[`&-in-view${n}-in-range`]:{position:"relative","&::before":{background:f}},[`&-in-view${n}-selected ${o}, + &-in-view${n}-range-start ${o}, + &-in-view${n}-range-end ${o}`]:{color:h,background:d},[`&-in-view${n}-range-start:not(${n}-range-start-single), + &-in-view${n}-range-end:not(${n}-range-end-single)`]:{"&::before":{background:f}},[`&-in-view${n}-range-start::before`]:{insetInlineStart:"50%"},[`&-in-view${n}-range-end::before`]:{insetInlineEnd:"50%"},[`&-in-view${n}-range-hover-start:not(${n}-in-range):not(${n}-range-start):not(${n}-range-end), + &-in-view${n}-range-hover-end:not(${n}-in-range):not(${n}-range-start):not(${n}-range-end), + &-in-view${n}-range-hover-start${n}-range-start-single, + &-in-view${n}-range-hover-start${n}-range-start${n}-range-end${n}-range-end-near-hover, + &-in-view${n}-range-hover-end${n}-range-start${n}-range-end${n}-range-start-near-hover, + &-in-view${n}-range-hover-end${n}-range-end-single, + &-in-view${n}-range-hover:not(${n}-in-range)`]:{"&::after":{position:"absolute",top:"50%",zIndex:0,height:v,borderTop:`${c}px dashed ${g}`,borderBottom:`${c}px dashed ${g}`,transform:"translateY(-50%)",transition:`all ${i}`,content:'""'}},"&-range-hover-start::after,\n &-range-hover-end::after,\n &-range-hover::after":{insetInlineEnd:0,insetInlineStart:b},[`&-in-view${n}-in-range${n}-range-hover::before, + &-in-view${n}-range-start${n}-range-hover::before, + &-in-view${n}-range-end${n}-range-hover::before, + &-in-view${n}-range-start:not(${n}-range-start-single)${n}-range-hover-start::before, + &-in-view${n}-range-end:not(${n}-range-end-single)${n}-range-hover-end::before, + ${t}-panel + > :not(${t}-date-panel) + &-in-view${n}-in-range${n}-range-hover-start::before, + ${t}-panel + > :not(${t}-date-panel) + &-in-view${n}-in-range${n}-range-hover-end::before`]:{background:y},[`&-in-view${n}-range-start:not(${n}-range-start-single):not(${n}-range-end) ${o}`]:{borderStartStartRadius:l,borderEndStartRadius:l,borderStartEndRadius:0,borderEndEndRadius:0},[`&-in-view${n}-range-end:not(${n}-range-end-single):not(${n}-range-start) ${o}`]:{borderStartStartRadius:0,borderEndStartRadius:0,borderStartEndRadius:l,borderEndEndRadius:l},[`&-range-hover${n}-range-end::after`]:{insetInlineStart:"50%"},[`tr > &-in-view${n}-range-hover:first-child::after, + tr > &-in-view${n}-range-hover-end:first-child::after, + &-in-view${n}-start${n}-range-hover-edge-start${n}-range-hover-edge-start-near-range::after, + &-in-view${n}-range-hover-edge-start:not(${n}-range-hover-edge-start-near-range)::after, + &-in-view${n}-range-hover-start::after`]:{insetInlineStart:(S-r)/2,borderInlineStart:`${c}px dashed ${g}`,borderStartStartRadius:c,borderEndStartRadius:c},[`tr > &-in-view${n}-range-hover:last-child::after, + tr > &-in-view${n}-range-hover-start:last-child::after, + &-in-view${n}-end${n}-range-hover-edge-end${n}-range-hover-edge-end-near-range::after, + &-in-view${n}-range-hover-edge-end:not(${n}-range-hover-edge-end-near-range)::after, + &-in-view${n}-range-hover-end::after`]:{insetInlineEnd:(S-r)/2,borderInlineEnd:`${c}px dashed ${g}`,borderStartEndRadius:c,borderEndEndRadius:c},"&-disabled":{color:$,pointerEvents:"none",[o]:{background:"transparent"},"&::before":{background:w}},[`&-disabled${n}-today ${o}::before`]:{borderColor:$}}},WI=e=>{const{componentCls:t,pickerCellInnerCls:n,pickerYearMonthCellWidth:o,pickerControlIconSize:r,pickerPanelCellWidth:i,paddingSM:l,paddingXS:a,paddingXXS:s,colorBgContainer:c,lineWidth:u,lineType:d,borderRadiusLG:f,colorPrimary:h,colorTextHeading:v,colorSplit:g,pickerControlIconBorderWidth:b,colorIcon:y,pickerTextHeight:S,motionDurationMid:$,colorIconHover:w,fontWeightStrong:C,pickerPanelCellHeight:O,pickerCellPaddingVertical:x,colorTextDisabled:I,colorText:T,fontSize:M,pickerBasicCellHoverWithRangeColor:E,motionDurationSlow:A,pickerPanelWithoutTimeCellHeight:R,pickerQuarterPanelContentHeight:z,colorLink:_,colorLinkActive:D,colorLinkHover:N,pickerDateHoverRangeBorderColor:k,borderRadiusSM:F,colorTextLightSolid:L,borderRadius:H,controlItemBgHover:j,pickerTimePanelColumnHeight:Y,pickerTimePanelColumnWidth:Z,pickerTimePanelCellHeight:X,controlItemBgActive:ee,marginXXS:U}=e,Q=i*7+l*2+4,J=(Q-a*2)/3-o-l;return{[t]:{"&-panel":{display:"inline-flex",flexDirection:"column",textAlign:"center",background:c,border:`${u}px ${d} ${g}`,borderRadius:f,outline:"none","&-focused":{borderColor:h},"&-rtl":{direction:"rtl",[`${t}-prev-icon, + ${t}-super-prev-icon`]:{transform:"rotate(45deg)"},[`${t}-next-icon, + ${t}-super-next-icon`]:{transform:"rotate(-135deg)"}}},"&-decade-panel,\n &-year-panel,\n &-quarter-panel,\n &-month-panel,\n &-week-panel,\n &-date-panel,\n &-time-panel":{display:"flex",flexDirection:"column",width:Q},"&-header":{display:"flex",padding:`0 ${a}px`,color:v,borderBottom:`${u}px ${d} ${g}`,"> *":{flex:"none"},button:{padding:0,color:y,lineHeight:`${S}px`,background:"transparent",border:0,cursor:"pointer",transition:`color ${$}`},"> button":{minWidth:"1.6em",fontSize:M,"&:hover":{color:w}},"&-view":{flex:"auto",fontWeight:C,lineHeight:`${S}px`,button:{color:"inherit",fontWeight:"inherit",verticalAlign:"top","&:not(:first-child)":{marginInlineStart:a},"&:hover":{color:h}}}},"&-prev-icon,\n &-next-icon,\n &-super-prev-icon,\n &-super-next-icon":{position:"relative",display:"inline-block",width:r,height:r,"&::before":{position:"absolute",top:0,insetInlineStart:0,display:"inline-block",width:r,height:r,border:"0 solid currentcolor",borderBlockStartWidth:b,borderBlockEndWidth:0,borderInlineStartWidth:b,borderInlineEndWidth:0,content:'""'}},"&-super-prev-icon,\n &-super-next-icon":{"&::after":{position:"absolute",top:Math.ceil(r/2),insetInlineStart:Math.ceil(r/2),display:"inline-block",width:r,height:r,border:"0 solid currentcolor",borderBlockStartWidth:b,borderBlockEndWidth:0,borderInlineStartWidth:b,borderInlineEndWidth:0,content:'""'}},"&-prev-icon,\n &-super-prev-icon":{transform:"rotate(-45deg)"},"&-next-icon,\n &-super-next-icon":{transform:"rotate(135deg)"},"&-content":{width:"100%",tableLayout:"fixed",borderCollapse:"collapse","th, td":{position:"relative",minWidth:O,fontWeight:"normal"},th:{height:O+x*2,color:T,verticalAlign:"middle"}},"&-cell":m({padding:`${x}px 0`,color:I,cursor:"pointer","&-in-view":{color:T}},YY(e)),[`&-date-panel ${t}-cell-in-view${t}-cell-in-range${t}-cell-range-hover-start ${n}, + &-date-panel ${t}-cell-in-view${t}-cell-in-range${t}-cell-range-hover-end ${n}`]:{"&::after":{position:"absolute",top:0,bottom:0,zIndex:-1,background:E,transition:`all ${A}`,content:'""'}},[`&-date-panel + ${t}-cell-in-view${t}-cell-in-range${t}-cell-range-hover-start + ${n}::after`]:{insetInlineEnd:-(i-O)/2,insetInlineStart:0},[`&-date-panel ${t}-cell-in-view${t}-cell-in-range${t}-cell-range-hover-end ${n}::after`]:{insetInlineEnd:0,insetInlineStart:-(i-O)/2},[`&-range-hover${t}-range-start::after`]:{insetInlineEnd:"50%"},"&-decade-panel,\n &-year-panel,\n &-quarter-panel,\n &-month-panel":{[`${t}-content`]:{height:R*4},[n]:{padding:`0 ${a}px`}},"&-quarter-panel":{[`${t}-content`]:{height:z}},[`&-panel ${t}-footer`]:{borderTop:`${u}px ${d} ${g}`},"&-footer":{width:"min-content",minWidth:"100%",lineHeight:`${S-2*u}px`,textAlign:"center","&-extra":{padding:`0 ${l}`,lineHeight:`${S-2*u}px`,textAlign:"start","&:not(:last-child)":{borderBottom:`${u}px ${d} ${g}`}}},"&-now":{textAlign:"start"},"&-today-btn":{color:_,"&:hover":{color:N},"&:active":{color:D},[`&${t}-today-btn-disabled`]:{color:I,cursor:"not-allowed"}},"&-decade-panel":{[n]:{padding:`0 ${a/2}px`},[`${t}-cell::before`]:{display:"none"}},"&-year-panel,\n &-quarter-panel,\n &-month-panel":{[`${t}-body`]:{padding:`0 ${a}px`},[n]:{width:o},[`${t}-cell-range-hover-start::after`]:{insetInlineStart:J,borderInlineStart:`${u}px dashed ${k}`,borderStartStartRadius:F,borderBottomStartRadius:F,borderStartEndRadius:0,borderBottomEndRadius:0,[`${t}-panel-rtl &`]:{insetInlineEnd:J,borderInlineEnd:`${u}px dashed ${k}`,borderStartStartRadius:0,borderBottomStartRadius:0,borderStartEndRadius:F,borderBottomEndRadius:F}},[`${t}-cell-range-hover-end::after`]:{insetInlineEnd:J,borderInlineEnd:`${u}px dashed ${k}`,borderStartStartRadius:0,borderEndStartRadius:0,borderStartEndRadius:H,borderEndEndRadius:H,[`${t}-panel-rtl &`]:{insetInlineStart:J,borderInlineStart:`${u}px dashed ${k}`,borderStartStartRadius:H,borderEndStartRadius:H,borderStartEndRadius:0,borderEndEndRadius:0}}},"&-week-panel":{[`${t}-body`]:{padding:`${a}px ${l}px`},[`${t}-cell`]:{[`&:hover ${n}, + &-selected ${n}, + ${n}`]:{background:"transparent !important"}},"&-row":{td:{transition:`background ${$}`,"&:first-child":{borderStartStartRadius:F,borderEndStartRadius:F},"&:last-child":{borderStartEndRadius:F,borderEndEndRadius:F}},"&:hover td":{background:j},"&-selected td,\n &-selected:hover td":{background:h,[`&${t}-cell-week`]:{color:new vt(L).setAlpha(.5).toHexString()},[`&${t}-cell-today ${n}::before`]:{borderColor:L},[n]:{color:L}}}},"&-date-panel":{[`${t}-body`]:{padding:`${a}px ${l}px`},[`${t}-content`]:{width:i*7,th:{width:i}}},"&-datetime-panel":{display:"flex",[`${t}-time-panel`]:{borderInlineStart:`${u}px ${d} ${g}`},[`${t}-date-panel, + ${t}-time-panel`]:{transition:`opacity ${A}`},"&-active":{[`${t}-date-panel, + ${t}-time-panel`]:{opacity:.3,"&-active":{opacity:1}}}},"&-time-panel":{width:"auto",minWidth:"auto",direction:"ltr",[`${t}-content`]:{display:"flex",flex:"auto",height:Y},"&-column":{flex:"1 0 auto",width:Z,margin:`${s}px 0`,padding:0,overflowY:"hidden",textAlign:"start",listStyle:"none",transition:`background ${$}`,overflowX:"hidden","&::after":{display:"block",height:Y-X,content:'""'},"&:not(:first-child)":{borderInlineStart:`${u}px ${d} ${g}`},"&-active":{background:new vt(ee).setAlpha(.2).toHexString()},"&:hover":{overflowY:"auto"},"> li":{margin:0,padding:0,[`&${t}-time-panel-cell`]:{marginInline:U,[`${t}-time-panel-cell-inner`]:{display:"block",width:Z-2*U,height:X,margin:0,paddingBlock:0,paddingInlineEnd:0,paddingInlineStart:(Z-X)/2,color:T,lineHeight:`${X}px`,borderRadius:F,cursor:"pointer",transition:`background ${$}`,"&:hover":{background:j}},"&-selected":{[`${t}-time-panel-cell-inner`]:{background:ee}},"&-disabled":{[`${t}-time-panel-cell-inner`]:{color:I,background:"transparent",cursor:"not-allowed"}}}}}},[`&-datetime-panel ${t}-time-panel-column:after`]:{height:Y-X+s*2}}}},qY=e=>{const{componentCls:t,colorBgContainer:n,colorError:o,colorErrorOutline:r,colorWarning:i,colorWarningOutline:l}=e;return{[t]:{[`&-status-error${t}`]:{"&, &:not([disabled]):hover":{backgroundColor:n,borderColor:o},"&-focused, &:focus":m({},ji(ze(e,{inputBorderActiveColor:o,inputBorderHoverColor:o,controlOutline:r}))),[`${t}-active-bar`]:{background:o}},[`&-status-warning${t}`]:{"&, &:not([disabled]):hover":{backgroundColor:n,borderColor:i},"&-focused, &:focus":m({},ji(ze(e,{inputBorderActiveColor:i,inputBorderHoverColor:i,controlOutline:l}))),[`${t}-active-bar`]:{background:i}}}}},JY=e=>{const{componentCls:t,antCls:n,boxShadowPopoverArrow:o,controlHeight:r,fontSize:i,inputPaddingHorizontal:l,colorBgContainer:a,lineWidth:s,lineType:c,colorBorder:u,borderRadius:d,motionDurationMid:f,colorBgContainerDisabled:h,colorTextDisabled:v,colorTextPlaceholder:g,controlHeightLG:b,fontSizeLG:y,controlHeightSM:S,inputPaddingHorizontalSM:$,paddingXS:w,marginXS:C,colorTextDescription:O,lineWidthBold:x,lineHeight:I,colorPrimary:T,motionDurationSlow:M,zIndexPopup:E,paddingXXS:A,paddingSM:R,pickerTextHeight:z,controlItemBgActive:_,colorPrimaryBorder:D,sizePopupArrow:N,borderRadiusXS:k,borderRadiusOuter:F,colorBgElevated:L,borderRadiusLG:H,boxShadowSecondary:j,borderRadiusSM:Y,colorSplit:Z,controlItemBgHover:X,presetsWidth:ee,presetsMaxWidth:U}=e;return[{[t]:m(m(m({},qe(e)),mv(e,r,i,l)),{position:"relative",display:"inline-flex",alignItems:"center",background:a,lineHeight:1,border:`${s}px ${c} ${u}`,borderRadius:d,transition:`border ${f}, box-shadow ${f}`,"&:hover, &-focused":m({},gs(e)),"&-focused":m({},ji(e)),[`&${t}-disabled`]:{background:h,borderColor:u,cursor:"not-allowed",[`${t}-suffix`]:{color:v}},[`&${t}-borderless`]:{backgroundColor:"transparent !important",borderColor:"transparent !important",boxShadow:"none !important"},[`${t}-input`]:{position:"relative",display:"inline-flex",alignItems:"center",width:"100%","> input":m(m({},ta(e)),{flex:"auto",minWidth:1,height:"auto",padding:0,background:"transparent",border:0,"&:focus":{boxShadow:"none"},"&[disabled]":{background:"transparent"}}),"&:hover":{[`${t}-clear`]:{opacity:1}},"&-placeholder":{"> input":{color:g}}},"&-large":m(m({},mv(e,b,y,l)),{[`${t}-input > input`]:{fontSize:y}}),"&-small":m({},mv(e,S,i,$)),[`${t}-suffix`]:{display:"flex",flex:"none",alignSelf:"center",marginInlineStart:w/2,color:v,lineHeight:1,pointerEvents:"none","> *":{verticalAlign:"top","&:not(:last-child)":{marginInlineEnd:C}}},[`${t}-clear`]:{position:"absolute",top:"50%",insetInlineEnd:0,color:v,lineHeight:1,background:a,transform:"translateY(-50%)",cursor:"pointer",opacity:0,transition:`opacity ${f}, color ${f}`,"> *":{verticalAlign:"top"},"&:hover":{color:O}},[`${t}-separator`]:{position:"relative",display:"inline-block",width:"1em",height:y,color:v,fontSize:y,verticalAlign:"top",cursor:"default",[`${t}-focused &`]:{color:O},[`${t}-range-separator &`]:{[`${t}-disabled &`]:{cursor:"not-allowed"}}},"&-range":{position:"relative",display:"inline-flex",[`${t}-clear`]:{insetInlineEnd:l},"&:hover":{[`${t}-clear`]:{opacity:1}},[`${t}-active-bar`]:{bottom:-s,height:x,marginInlineStart:l,background:T,opacity:0,transition:`all ${M} ease-out`,pointerEvents:"none"},[`&${t}-focused`]:{[`${t}-active-bar`]:{opacity:1}},[`${t}-range-separator`]:{alignItems:"center",padding:`0 ${w}px`,lineHeight:1},[`&${t}-small`]:{[`${t}-clear`]:{insetInlineEnd:$},[`${t}-active-bar`]:{marginInlineStart:$}}},"&-dropdown":m(m(m({},qe(e)),WI(e)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:E,[`&${t}-dropdown-hidden`]:{display:"none"},[`&${t}-dropdown-placement-bottomLeft`]:{[`${t}-range-arrow`]:{top:0,display:"block",transform:"translateY(-100%)"}},[`&${t}-dropdown-placement-topLeft`]:{[`${t}-range-arrow`]:{bottom:0,display:"block",transform:"translateY(100%) rotate(180deg)"}},[`&${n}-slide-up-enter${n}-slide-up-enter-active${t}-dropdown-placement-topLeft, + &${n}-slide-up-enter${n}-slide-up-enter-active${t}-dropdown-placement-topRight, + &${n}-slide-up-appear${n}-slide-up-appear-active${t}-dropdown-placement-topLeft, + &${n}-slide-up-appear${n}-slide-up-appear-active${t}-dropdown-placement-topRight`]:{animationName:ph},[`&${n}-slide-up-enter${n}-slide-up-enter-active${t}-dropdown-placement-bottomLeft, + &${n}-slide-up-enter${n}-slide-up-enter-active${t}-dropdown-placement-bottomRight, + &${n}-slide-up-appear${n}-slide-up-appear-active${t}-dropdown-placement-bottomLeft, + &${n}-slide-up-appear${n}-slide-up-appear-active${t}-dropdown-placement-bottomRight`]:{animationName:dh},[`&${n}-slide-up-leave${n}-slide-up-leave-active${t}-dropdown-placement-topLeft, + &${n}-slide-up-leave${n}-slide-up-leave-active${t}-dropdown-placement-topRight`]:{animationName:hh},[`&${n}-slide-up-leave${n}-slide-up-leave-active${t}-dropdown-placement-bottomLeft, + &${n}-slide-up-leave${n}-slide-up-leave-active${t}-dropdown-placement-bottomRight`]:{animationName:fh},[`${t}-panel > ${t}-time-panel`]:{paddingTop:A},[`${t}-ranges`]:{marginBottom:0,padding:`${A}px ${R}px`,overflow:"hidden",lineHeight:`${z-2*s-w/2}px`,textAlign:"start",listStyle:"none",display:"flex",justifyContent:"space-between","> li":{display:"inline-block"},[`${t}-preset > ${n}-tag-blue`]:{color:T,background:_,borderColor:D,cursor:"pointer"},[`${t}-ok`]:{marginInlineStart:"auto"}},[`${t}-range-wrapper`]:{display:"flex",position:"relative"},[`${t}-range-arrow`]:m({position:"absolute",zIndex:1,display:"none",marginInlineStart:l*1.5,transition:`left ${M} ease-out`},Lb(N,k,F,L,o)),[`${t}-panel-container`]:{overflow:"hidden",verticalAlign:"top",background:L,borderRadius:H,boxShadow:j,transition:`margin ${M}`,[`${t}-panel-layout`]:{display:"flex",flexWrap:"nowrap",alignItems:"stretch"},[`${t}-presets`]:{display:"flex",flexDirection:"column",minWidth:ee,maxWidth:U,ul:{height:0,flex:"auto",listStyle:"none",overflow:"auto",margin:0,padding:w,borderInlineEnd:`${s}px ${c} ${Z}`,li:m(m({},Jt),{borderRadius:Y,paddingInline:w,paddingBlock:(S-Math.round(i*I))/2,cursor:"pointer",transition:`all ${M}`,"+ li":{marginTop:C},"&:hover":{background:X}})}},[`${t}-panels`]:{display:"inline-flex",flexWrap:"nowrap",direction:"ltr",[`${t}-panel`]:{borderWidth:`0 0 ${s}px`},"&:last-child":{[`${t}-panel`]:{borderWidth:0}}},[`${t}-panel`]:{verticalAlign:"top",background:"transparent",borderRadius:0,borderWidth:0,[`${t}-content, + table`]:{textAlign:"center"},"&-focused":{borderColor:u}}}}),"&-dropdown-range":{padding:`${N*2/3}px 0`,"&-hidden":{display:"none"}},"&-rtl":{direction:"rtl",[`${t}-separator`]:{transform:"rotate(180deg)"},[`${t}-footer`]:{"&-extra":{direction:"rtl"}}}})},Rr(e,"slide-up"),Rr(e,"slide-down"),es(e,"move-up"),es(e,"move-down")]},KI=e=>{const{componentCls:n,controlHeightLG:o,controlHeightSM:r,colorPrimary:i,paddingXXS:l}=e;return{pickerCellCls:`${n}-cell`,pickerCellInnerCls:`${n}-cell-inner`,pickerTextHeight:o,pickerPanelCellWidth:r*1.5,pickerPanelCellHeight:r,pickerDateHoverRangeBorderColor:new vt(i).lighten(20).toHexString(),pickerBasicCellHoverWithRangeColor:new vt(i).lighten(35).toHexString(),pickerPanelWithoutTimeCellHeight:o*1.65,pickerYearMonthCellWidth:o*1.5,pickerTimePanelColumnHeight:28*8,pickerTimePanelColumnWidth:o*1.4,pickerTimePanelCellHeight:28,pickerQuarterPanelContentHeight:o*1.4,pickerCellPaddingVertical:l,pickerCellBorderGap:2,pickerControlIconSize:7,pickerControlIconBorderWidth:1.5}},GI=Ue("DatePicker",e=>{const t=ze(na(e),KI(e));return[JY(t),qY(t),fs(e,{focusElCls:`${e.componentCls}-focused`})]},e=>({presetsWidth:120,presetsMaxWidth:200,zIndexPopup:e.zIndexPopupBase+50})),ZY=e=>{const{calendarCls:t,componentCls:n,calendarFullBg:o,calendarFullPanelBg:r,calendarItemActiveBg:i}=e;return{[t]:m(m(m({},WI(e)),qe(e)),{background:o,"&-rtl":{direction:"rtl"},[`${t}-header`]:{display:"flex",justifyContent:"flex-end",padding:`${e.paddingSM}px 0`,[`${t}-year-select`]:{minWidth:e.yearControlWidth},[`${t}-month-select`]:{minWidth:e.monthControlWidth,marginInlineStart:e.marginXS},[`${t}-mode-switch`]:{marginInlineStart:e.marginXS}}}),[`${t} ${n}-panel`]:{background:r,border:0,borderTop:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,borderRadius:0,[`${n}-month-panel, ${n}-date-panel`]:{width:"auto"},[`${n}-body`]:{padding:`${e.paddingXS}px 0`},[`${n}-content`]:{width:"100%"}},[`${t}-mini`]:{borderRadius:e.borderRadiusLG,[`${t}-header`]:{paddingInlineEnd:e.paddingXS,paddingInlineStart:e.paddingXS},[`${n}-panel`]:{borderRadius:`0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px`},[`${n}-content`]:{height:e.miniContentHeight,th:{height:"auto",padding:0,lineHeight:`${e.weekHeight}px`}},[`${n}-cell::before`]:{pointerEvents:"none"}},[`${t}${t}-full`]:{[`${n}-panel`]:{display:"block",width:"100%",textAlign:"end",background:o,border:0,[`${n}-body`]:{"th, td":{padding:0},th:{height:"auto",paddingInlineEnd:e.paddingSM,paddingBottom:e.paddingXXS,lineHeight:`${e.weekHeight}px`}}},[`${n}-cell`]:{"&::before":{display:"none"},"&:hover":{[`${t}-date`]:{background:e.controlItemBgHover}},[`${t}-date-today::before`]:{display:"none"},[`&-in-view${n}-cell-selected`]:{[`${t}-date, ${t}-date-today`]:{background:i}},"&-selected, &-selected:hover":{[`${t}-date, ${t}-date-today`]:{[`${t}-date-value`]:{color:e.colorPrimary}}}},[`${t}-date`]:{display:"block",width:"auto",height:"auto",margin:`0 ${e.marginXS/2}px`,padding:`${e.paddingXS/2}px ${e.paddingXS}px 0`,border:0,borderTop:`${e.lineWidthBold}px ${e.lineType} ${e.colorSplit}`,borderRadius:0,transition:`background ${e.motionDurationSlow}`,"&-value":{lineHeight:`${e.dateValueHeight}px`,transition:`color ${e.motionDurationSlow}`},"&-content":{position:"static",width:"auto",height:e.dateContentHeight,overflowY:"auto",color:e.colorText,lineHeight:e.lineHeight,textAlign:"start"},"&-today":{borderColor:e.colorPrimary,[`${t}-date-value`]:{color:e.colorText}}}},[`@media only screen and (max-width: ${e.screenXS}px) `]:{[`${t}`]:{[`${t}-header`]:{display:"block",[`${t}-year-select`]:{width:"50%"},[`${t}-month-select`]:{width:`calc(50% - ${e.paddingXS}px)`},[`${t}-mode-switch`]:{width:"100%",marginTop:e.marginXS,marginInlineStart:0,"> label":{width:"50%",textAlign:"center"}}}}}}},QY=Ue("Calendar",e=>{const t=`${e.componentCls}-calendar`,n=ze(na(e),KI(e),{calendarCls:t,pickerCellInnerCls:`${e.componentCls}-cell-inner`,calendarFullBg:e.colorBgContainer,calendarFullPanelBg:e.colorBgContainer,calendarItemActiveBg:e.controlItemBgActive,dateValueHeight:e.controlHeightSM,weekHeight:e.controlHeightSM*.75,dateContentHeight:(e.fontSizeSM*e.lineHeightSM+e.marginXS)*3+e.lineWidth*2});return[ZY(n)]},{yearControlWidth:80,monthControlWidth:70,miniContentHeight:256});function eq(e){function t(i,l){return i&&l&&e.getYear(i)===e.getYear(l)}function n(i,l){return t(i,l)&&e.getMonth(i)===e.getMonth(l)}function o(i,l){return n(i,l)&&e.getDate(i)===e.getDate(l)}const r=re({name:"ACalendar",inheritAttrs:!1,props:{prefixCls:String,locale:{type:Object,default:void 0},validRange:{type:Array,default:void 0},disabledDate:{type:Function,default:void 0},dateFullCellRender:{type:Function,default:void 0},dateCellRender:{type:Function,default:void 0},monthFullCellRender:{type:Function,default:void 0},monthCellRender:{type:Function,default:void 0},headerRender:{type:Function,default:void 0},value:{type:[Object,String],default:void 0},defaultValue:{type:[Object,String],default:void 0},mode:{type:String,default:void 0},fullscreen:{type:Boolean,default:void 0},onChange:{type:Function,default:void 0},"onUpdate:value":{type:Function,default:void 0},onPanelChange:{type:Function,default:void 0},onSelect:{type:Function,default:void 0},valueFormat:{type:String,default:void 0}},slots:Object,setup(i,l){let{emit:a,slots:s,attrs:c}=l;const u=i,{prefixCls:d,direction:f}=Ee("picker",u),[h,v]=QY(d),g=P(()=>`${d.value}-calendar`),b=_=>u.valueFormat?e.toString(_,u.valueFormat):_,y=P(()=>u.value?u.valueFormat?e.toDate(u.value,u.valueFormat):u.value:u.value===""?void 0:u.value),S=P(()=>u.defaultValue?u.valueFormat?e.toDate(u.defaultValue,u.valueFormat):u.defaultValue:u.defaultValue===""?void 0:u.defaultValue),[$,w]=Dt(()=>y.value||e.getNow(),{defaultValue:S.value,value:y}),[C,O]=Dt("month",{value:We(u,"mode")}),x=P(()=>C.value==="year"?"month":"date"),I=P(()=>_=>{var D;return(u.validRange?e.isAfter(u.validRange[0],_)||e.isAfter(_,u.validRange[1]):!1)||!!(!((D=u.disabledDate)===null||D===void 0)&&D.call(u,_))}),T=(_,D)=>{a("panelChange",b(_),D)},M=_=>{if(w(_),!o(_,$.value)){(x.value==="date"&&!n(_,$.value)||x.value==="month"&&!t(_,$.value))&&T(_,C.value);const D=b(_);a("update:value",D),a("change",D)}},E=_=>{O(_),T($.value,_)},A=(_,D)=>{M(_),a("select",b(_),{source:D})},R=P(()=>{const{locale:_}=u,D=m(m({},Cc),_);return D.lang=m(m({},D.lang),(_||{}).lang),D}),[z]=Uo("Calendar",R);return()=>{const _=e.getNow(),{dateFullCellRender:D=s==null?void 0:s.dateFullCellRender,dateCellRender:N=s==null?void 0:s.dateCellRender,monthFullCellRender:k=s==null?void 0:s.monthFullCellRender,monthCellRender:F=s==null?void 0:s.monthCellRender,headerRender:L=s==null?void 0:s.headerRender,fullscreen:H=!0,validRange:j}=u,Y=X=>{let{current:ee}=X;return D?D({current:ee}):p("div",{class:le(`${d.value}-cell-inner`,`${g.value}-date`,{[`${g.value}-date-today`]:o(_,ee)})},[p("div",{class:`${g.value}-date-value`},[String(e.getDate(ee)).padStart(2,"0")]),p("div",{class:`${g.value}-date-content`},[N&&N({current:ee})])])},Z=(X,ee)=>{let{current:U}=X;if(k)return k({current:U});const Q=ee.shortMonths||e.locale.getShortMonths(ee.locale);return p("div",{class:le(`${d.value}-cell-inner`,`${g.value}-date`,{[`${g.value}-date-today`]:n(_,U)})},[p("div",{class:`${g.value}-date-value`},[Q[e.getMonth(U)]]),p("div",{class:`${g.value}-date-content`},[F&&F({current:U})])])};return h(p("div",B(B({},c),{},{class:le(g.value,{[`${g.value}-full`]:H,[`${g.value}-mini`]:!H,[`${g.value}-rtl`]:f.value==="rtl"},c.class,v.value)}),[L?L({value:$.value,type:C.value,onChange:X=>{A(X,"customize")},onTypeChange:E}):p(jY,{prefixCls:g.value,value:$.value,generateConfig:e,mode:C.value,fullscreen:H,locale:z.value.lang,validRange:j,onChange:A,onModeChange:E},null),p(g1,{value:$.value,prefixCls:d.value,locale:z.value.lang,generateConfig:e,dateRender:Y,monthCellRender:X=>Z(X,z.value.lang),onSelect:X=>{A(X,x.value)},mode:x.value,picker:x.value,disabledDate:I.value,hideHeader:!0},null)]))}}});return r.install=function(i){return i.component(r.name,r),i},r}const tq=eq(qy),nq=Bt(tq);function oq(e){const t=oe(),n=oe(!1);function o(){for(var r=arguments.length,i=new Array(r),l=0;l{e(...i)}))}return et(()=>{n.value=!0,Ze.cancel(t.value)}),o}function rq(e){const t=oe([]),n=oe(typeof e=="function"?e():e),o=oq(()=>{let i=n.value;t.value.forEach(l=>{i=l(i)}),t.value=[],n.value=i});function r(i){t.value.push(i),o()}return[n,r]}const iq=re({compatConfig:{MODE:3},name:"TabNode",props:{id:{type:String},prefixCls:{type:String},tab:{type:Object},active:{type:Boolean},closable:{type:Boolean},editable:{type:Object},onClick:{type:Function},onResize:{type:Function},renderWrapper:{type:Function},removeAriaLabel:{type:String},onFocus:{type:Function}},emits:["click","resize","remove","focus"],setup(e,t){let{expose:n,attrs:o}=t;const r=ne();function i(s){var c;!((c=e.tab)===null||c===void 0)&&c.disabled||e.onClick(s)}n({domRef:r});function l(s){var c;s.preventDefault(),s.stopPropagation(),e.editable.onEdit("remove",{key:(c=e.tab)===null||c===void 0?void 0:c.key,event:s})}const a=P(()=>{var s;return e.editable&&e.closable!==!1&&!(!((s=e.tab)===null||s===void 0)&&s.disabled)});return()=>{var s;const{prefixCls:c,id:u,active:d,tab:{key:f,tab:h,disabled:v,closeIcon:g},renderWrapper:b,removeAriaLabel:y,editable:S,onFocus:$}=e,w=`${c}-tab`,C=p("div",{key:f,ref:r,class:le(w,{[`${w}-with-remove`]:a.value,[`${w}-active`]:d,[`${w}-disabled`]:v}),style:o.style,onClick:i},[p("div",{role:"tab","aria-selected":d,id:u&&`${u}-tab-${f}`,class:`${w}-btn`,"aria-controls":u&&`${u}-panel-${f}`,"aria-disabled":v,tabindex:v?null:0,onClick:O=>{O.stopPropagation(),i(O)},onKeydown:O=>{[Ie.SPACE,Ie.ENTER].includes(O.which)&&(O.preventDefault(),i(O))},onFocus:$},[typeof h=="function"?h():h]),a.value&&p("button",{type:"button","aria-label":y||"remove",tabindex:0,class:`${w}-remove`,onClick:O=>{O.stopPropagation(),l(O)}},[(g==null?void 0:g())||((s=S.removeIcon)===null||s===void 0?void 0:s.call(S))||"×"])]);return b?b(C):C}}}),Dw={width:0,height:0,left:0,top:0};function lq(e,t){const n=ne(new Map);return Ve(()=>{var o,r;const i=new Map,l=e.value,a=t.value.get((o=l[0])===null||o===void 0?void 0:o.key)||Dw,s=a.left+a.width;for(let c=0;c{const{prefixCls:i,editable:l,locale:a}=e;return!l||l.showAdd===!1?null:p("button",{ref:r,type:"button",class:`${i}-nav-add`,style:o.style,"aria-label":(a==null?void 0:a.addAriaLabel)||"Add tab",onClick:s=>{l.onEdit("add",{event:s})}},[l.addIcon?l.addIcon():"+"])}}}),aq={prefixCls:{type:String},id:{type:String},tabs:{type:Object},rtl:{type:Boolean},tabBarGutter:{type:Number},activeKey:{type:[String,Number]},mobile:{type:Boolean},moreIcon:K.any,moreTransitionName:{type:String},editable:{type:Object},locale:{type:Object,default:void 0},removeAriaLabel:String,onTabClick:{type:Function},popupClassName:String,getPopupContainer:ve()},sq=re({compatConfig:{MODE:3},name:"OperationNode",inheritAttrs:!1,props:aq,emits:["tabClick"],slots:Object,setup(e,t){let{attrs:n,slots:o}=t;const[r,i]=St(!1),[l,a]=St(null),s=h=>{const v=e.tabs.filter(y=>!y.disabled);let g=v.findIndex(y=>y.key===l.value)||0;const b=v.length;for(let y=0;y{const{which:v}=h;if(!r.value){[Ie.DOWN,Ie.SPACE,Ie.ENTER].includes(v)&&(i(!0),h.preventDefault());return}switch(v){case Ie.UP:s(-1),h.preventDefault();break;case Ie.DOWN:s(1),h.preventDefault();break;case Ie.ESC:i(!1);break;case Ie.SPACE:case Ie.ENTER:l.value!==null&&e.onTabClick(l.value,h);break}},u=P(()=>`${e.id}-more-popup`),d=P(()=>l.value!==null?`${u.value}-${l.value}`:null),f=(h,v)=>{h.preventDefault(),h.stopPropagation(),e.editable.onEdit("remove",{key:v,event:h})};return Ke(()=>{ye(l,()=>{const h=document.getElementById(d.value);h&&h.scrollIntoView&&h.scrollIntoView(!1)},{flush:"post",immediate:!0})}),ye(r,()=>{r.value||a(null)}),Gy({}),()=>{var h;const{prefixCls:v,id:g,tabs:b,locale:y,mobile:S,moreIcon:$=((h=o.moreIcon)===null||h===void 0?void 0:h.call(o))||p(ou,null,null),moreTransitionName:w,editable:C,tabBarGutter:O,rtl:x,onTabClick:I,popupClassName:T}=e;if(!b.length)return null;const M=`${v}-dropdown`,E=y==null?void 0:y.dropdownAriaLabel,A={[x?"marginRight":"marginLeft"]:O};b.length||(A.visibility="hidden",A.order=1);const R=le({[`${M}-rtl`]:x,[`${T}`]:!0}),z=S?null:p(K5,{prefixCls:M,trigger:["hover"],visible:r.value,transitionName:w,onVisibleChange:i,overlayClassName:R,mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:e.getPopupContainer},{overlay:()=>p(Xt,{onClick:_=>{let{key:D,domEvent:N}=_;I(D,N),i(!1)},id:u.value,tabindex:-1,role:"listbox","aria-activedescendant":d.value,selectedKeys:[l.value],"aria-label":E!==void 0?E:"expanded dropdown"},{default:()=>[b.map(_=>{var D,N;const k=C&&_.closable!==!1&&!_.disabled;return p(Er,{key:_.key,id:`${u.value}-${_.key}`,role:"option","aria-controls":g&&`${g}-panel-${_.key}`,disabled:_.disabled},{default:()=>[p("span",null,[typeof _.tab=="function"?_.tab():_.tab]),k&&p("button",{type:"button","aria-label":e.removeAriaLabel||"remove",tabindex:0,class:`${M}-menu-item-remove`,onClick:F=>{F.stopPropagation(),f(F,_.key)}},[((D=_.closeIcon)===null||D===void 0?void 0:D.call(_))||((N=C.removeIcon)===null||N===void 0?void 0:N.call(C))||"×"])]})})]}),default:()=>p("button",{type:"button",class:`${v}-nav-more`,style:A,tabindex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":u.value,id:`${g}-more`,"aria-expanded":r.value,onKeydown:c},[$])});return p("div",{class:le(`${v}-nav-operations`,n.class),style:n.style},[z,p(UI,{prefixCls:v,locale:y,editable:C},null)])}}}),XI=Symbol("tabsContextKey"),cq=e=>{Ye(XI,e)},YI=()=>Ge(XI,{tabs:ne([]),prefixCls:ne()}),uq=.1,Bw=.01,Rd=20,Nw=Math.pow(.995,Rd);function dq(e,t){const[n,o]=St(),[r,i]=St(0),[l,a]=St(0),[s,c]=St(),u=ne();function d(C){const{screenX:O,screenY:x}=C.touches[0];o({x:O,y:x}),clearInterval(u.value)}function f(C){if(!n.value)return;C.preventDefault();const{screenX:O,screenY:x}=C.touches[0],I=O-n.value.x,T=x-n.value.y;t(I,T),o({x:O,y:x});const M=Date.now();a(M-r.value),i(M),c({x:I,y:T})}function h(){if(!n.value)return;const C=s.value;if(o(null),c(null),C){const O=C.x/l.value,x=C.y/l.value,I=Math.abs(O),T=Math.abs(x);if(Math.max(I,T){if(Math.abs(M)M?(I=O,v.value="x"):(I=x,v.value="y"),t(-I,-I)&&C.preventDefault()}const b=ne({onTouchStart:d,onTouchMove:f,onTouchEnd:h,onWheel:g});function y(C){b.value.onTouchStart(C)}function S(C){b.value.onTouchMove(C)}function $(C){b.value.onTouchEnd(C)}function w(C){b.value.onWheel(C)}Ke(()=>{var C,O;document.addEventListener("touchmove",S,{passive:!1}),document.addEventListener("touchend",$,{passive:!1}),(C=e.value)===null||C===void 0||C.addEventListener("touchstart",y,{passive:!1}),(O=e.value)===null||O===void 0||O.addEventListener("wheel",w,{passive:!1})}),et(()=>{document.removeEventListener("touchmove",S),document.removeEventListener("touchend",$)})}function kw(e,t){const n=ne(e);function o(r){const i=typeof r=="function"?r(n.value):r;i!==n.value&&t(i,n.value),n.value=i}return[n,o]}const C1=()=>{const e=ne(new Map),t=n=>o=>{e.value.set(n,o)};return Dp(()=>{e.value=new Map}),[t,e]},Fw={width:0,height:0,left:0,top:0,right:0},fq=()=>({id:{type:String},tabPosition:{type:String},activeKey:{type:[String,Number]},rtl:{type:Boolean},animated:Be(),editable:Be(),moreIcon:K.any,moreTransitionName:{type:String},mobile:{type:Boolean},tabBarGutter:{type:Number},renderTabBar:{type:Function},locale:Be(),popupClassName:String,getPopupContainer:ve(),onTabClick:{type:Function},onTabScroll:{type:Function}}),pq=(e,t)=>{const{offsetWidth:n,offsetHeight:o,offsetTop:r,offsetLeft:i}=e,{width:l,height:a,x:s,y:c}=e.getBoundingClientRect();return Math.abs(l-n)<1?[l,a,s-t.x,c-t.y]:[n,o,i,r]},Lw=re({compatConfig:{MODE:3},name:"TabNavList",inheritAttrs:!1,props:fq(),slots:Object,emits:["tabClick","tabScroll"],setup(e,t){let{attrs:n,slots:o}=t;const{tabs:r,prefixCls:i}=YI(),l=oe(),a=oe(),s=oe(),c=oe(),[u,d]=C1(),f=P(()=>e.tabPosition==="top"||e.tabPosition==="bottom"),[h,v]=kw(0,(ce,se)=>{f.value&&e.onTabScroll&&e.onTabScroll({direction:ce>se?"left":"right"})}),[g,b]=kw(0,(ce,se)=>{!f.value&&e.onTabScroll&&e.onTabScroll({direction:ce>se?"top":"bottom"})}),[y,S]=St(0),[$,w]=St(0),[C,O]=St(null),[x,I]=St(null),[T,M]=St(0),[E,A]=St(0),[R,z]=rq(new Map),_=lq(r,R),D=P(()=>`${i.value}-nav-operations-hidden`),N=oe(0),k=oe(0);Ve(()=>{f.value?e.rtl?(N.value=0,k.value=Math.max(0,y.value-C.value)):(N.value=Math.min(0,C.value-y.value),k.value=0):(N.value=Math.min(0,x.value-$.value),k.value=0)});const F=ce=>cek.value?k.value:ce,L=oe(),[H,j]=St(),Y=()=>{j(Date.now())},Z=()=>{clearTimeout(L.value)},X=(ce,se)=>{ce(pe=>F(pe+se))};dq(l,(ce,se)=>{if(f.value){if(C.value>=y.value)return!1;X(v,ce)}else{if(x.value>=$.value)return!1;X(b,se)}return Z(),Y(),!0}),ye(H,()=>{Z(),H.value&&(L.value=setTimeout(()=>{j(0)},100))});const ee=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e.activeKey;const se=_.value.get(ce)||{width:0,height:0,left:0,right:0,top:0};if(f.value){let pe=h.value;e.rtl?se.righth.value+C.value&&(pe=se.right+se.width-C.value):se.left<-h.value?pe=-se.left:se.left+se.width>-h.value+C.value&&(pe=-(se.left+se.width-C.value)),b(0),v(F(pe))}else{let pe=g.value;se.top<-g.value?pe=-se.top:se.top+se.height>-g.value+x.value&&(pe=-(se.top+se.height-x.value)),v(0),b(F(pe))}},U=oe(0),Q=oe(0);Ve(()=>{let ce,se,pe,he,ge,me;const xe=_.value;["top","bottom"].includes(e.tabPosition)?(ce="width",he=C.value,ge=y.value,me=T.value,se=e.rtl?"right":"left",pe=Math.abs(h.value)):(ce="height",he=x.value,ge=y.value,me=E.value,se="top",pe=-g.value);let fe=he;ge+me>he&&gepe+fe){we=Re-1;break}}let Te=0;for(let Re=be-1;Re>=0;Re-=1)if((xe.get(de[Re].key)||Fw)[se]{z(()=>{var ce;const se=new Map,pe=(ce=a.value)===null||ce===void 0?void 0:ce.getBoundingClientRect();return r.value.forEach(he=>{let{key:ge}=he;const me=d.value.get(ge),xe=(me==null?void 0:me.$el)||me;if(xe){const[fe,de,be,we]=pq(xe,pe);se.set(ge,{width:fe,height:de,left:be,top:we})}}),se})};ye(()=>r.value.map(ce=>ce.key).join("%%"),()=>{J()},{flush:"post"});const G=()=>{var ce,se,pe,he,ge;const me=((ce=l.value)===null||ce===void 0?void 0:ce.offsetWidth)||0,xe=((se=l.value)===null||se===void 0?void 0:se.offsetHeight)||0,fe=((pe=c.value)===null||pe===void 0?void 0:pe.$el)||{},de=fe.offsetWidth||0,be=fe.offsetHeight||0;O(me),I(xe),M(de),A(be);const we=(((he=a.value)===null||he===void 0?void 0:he.offsetWidth)||0)-de,Te=(((ge=a.value)===null||ge===void 0?void 0:ge.offsetHeight)||0)-be;S(we),w(Te),J()},q=P(()=>[...r.value.slice(0,U.value),...r.value.slice(Q.value+1)]),[V,W]=St(),te=P(()=>_.value.get(e.activeKey)),ue=oe(),ie=()=>{Ze.cancel(ue.value)};ye([te,f,()=>e.rtl],()=>{const ce={};te.value&&(f.value?(e.rtl?ce.right=pl(te.value.right):ce.left=pl(te.value.left),ce.width=pl(te.value.width)):(ce.top=pl(te.value.top),ce.height=pl(te.value.height))),ie(),ue.value=Ze(()=>{W(ce)})}),ye([()=>e.activeKey,te,_,f],()=>{ee()},{flush:"post"}),ye([()=>e.rtl,()=>e.tabBarGutter,()=>e.activeKey,()=>r.value],()=>{G()},{flush:"post"});const ae=ce=>{let{position:se,prefixCls:pe,extra:he}=ce;if(!he)return null;const ge=he==null?void 0:he({position:se});return ge?p("div",{class:`${pe}-extra-content`},[ge]):null};return et(()=>{Z(),ie()}),()=>{const{id:ce,animated:se,activeKey:pe,rtl:he,editable:ge,locale:me,tabPosition:xe,tabBarGutter:fe,onTabClick:de}=e,{class:be,style:we}=n,Te=i.value,Re=!!q.value.length,Se=`${Te}-nav-wrap`;let Ce,Pe,Me,De;f.value?he?(Pe=h.value>0,Ce=h.value+C.value{const{key:st}=lt;return p(iq,{id:ce,prefixCls:Te,key:st,tab:lt,style:ht===0?void 0:Ae,closable:lt.closable,editable:ge,active:st===pe,removeAriaLabel:me==null?void 0:me.removeAriaLabel,ref:u(st),onClick:gt=>{de(st,gt)},onFocus:()=>{ee(st),Y(),l.value&&(he||(l.value.scrollLeft=0),l.value.scrollTop=0)}},o)});return p("div",{role:"tablist",class:le(`${Te}-nav`,be),style:we,onKeydown:()=>{Y()}},[p(ae,{position:"left",prefixCls:Te,extra:o.leftExtra},null),p(Vo,{onResize:G},{default:()=>[p("div",{class:le(Se,{[`${Se}-ping-left`]:Ce,[`${Se}-ping-right`]:Pe,[`${Se}-ping-top`]:Me,[`${Se}-ping-bottom`]:De}),ref:l},[p(Vo,{onResize:G},{default:()=>[p("div",{ref:a,class:`${Te}-nav-list`,style:{transform:`translate(${h.value}px, ${g.value}px)`,transition:H.value?"none":void 0}},[Fe,p(UI,{ref:c,prefixCls:Te,locale:me,editable:ge,style:m(m({},Fe.length===0?void 0:Ae),{visibility:Re?"hidden":null})},null),p("div",{class:le(`${Te}-ink-bar`,{[`${Te}-ink-bar-animated`]:se.inkBar}),style:V.value},null)])]})])]}),p(sq,B(B({},e),{},{removeAriaLabel:me==null?void 0:me.removeAriaLabel,ref:s,prefixCls:Te,tabs:q.value,class:!Re&&D.value}),N5(o,["moreIcon"])),p(ae,{position:"right",prefixCls:Te,extra:o.rightExtra},null),p(ae,{position:"right",prefixCls:Te,extra:o.tabBarExtraContent},null)])}}}),hq=re({compatConfig:{MODE:3},name:"TabPanelList",inheritAttrs:!1,props:{activeKey:{type:[String,Number]},id:{type:String},rtl:{type:Boolean},animated:{type:Object,default:void 0},tabPosition:{type:String},destroyInactiveTabPane:{type:Boolean}},setup(e){const{tabs:t,prefixCls:n}=YI();return()=>{const{id:o,activeKey:r,animated:i,tabPosition:l,rtl:a,destroyInactiveTabPane:s}=e,c=i.tabPane,u=n.value,d=t.value.findIndex(f=>f.key===r);return p("div",{class:`${u}-content-holder`},[p("div",{class:[`${u}-content`,`${u}-content-${l}`,{[`${u}-content-animated`]:c}],style:d&&c?{[a?"marginRight":"marginLeft"]:`-${d}00%`}:null},[t.value.map(f=>pt(f.node,{key:f.key,prefixCls:u,tabKey:f.key,id:o,animated:c,active:f.key===r,destroyInactiveTabPane:s}))])])}}});var gq={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};function zw(e){for(var t=1;t{const{componentCls:t,motionDurationSlow:n}=e;return[{[t]:{[`${t}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${n}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${n}`}}}}},[Rr(e,"slide-up"),Rr(e,"slide-down")]]},bq=e=>{const{componentCls:t,tabsCardHorizontalPadding:n,tabsCardHeadBackground:o,tabsCardGutter:r,colorSplit:i}=e;return{[`${t}-card`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{margin:0,padding:n,background:o,border:`${e.lineWidth}px ${e.lineType} ${i}`,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOut}`},[`${t}-tab-active`]:{color:e.colorPrimary,background:e.colorBgContainer},[`${t}-ink-bar`]:{visibility:"hidden"}},[`&${t}-top, &${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginLeft:{_skip_check_:!0,value:`${r}px`}}}},[`&${t}-top`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:`${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`},[`${t}-tab-active`]:{borderBottomColor:e.colorBgContainer}}},[`&${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:`0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px`},[`${t}-tab-active`]:{borderTopColor:e.colorBgContainer}}},[`&${t}-left, &${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginTop:`${r}px`}}},[`&${t}-left`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`${e.borderRadiusLG}px 0 0 ${e.borderRadiusLG}px`}},[`${t}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:e.colorBgContainer}}}},[`&${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px 0`}},[`${t}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:e.colorBgContainer}}}}}}},yq=e=>{const{componentCls:t,tabsHoverColor:n,dropdownEdgeChildVerticalPadding:o}=e;return{[`${t}-dropdown`]:m(m({},qe(e)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:e.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${t}-dropdown-menu`]:{maxHeight:e.tabsDropdownHeight,margin:0,padding:`${o}px 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:e.colorBgContainer,backgroundClip:"padding-box",borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary,"&-item":m(m({},Jt),{display:"flex",alignItems:"center",minWidth:e.tabsDropdownWidth,margin:0,padding:`${e.paddingXXS}px ${e.paddingSM}px`,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:e.marginSM},color:e.colorTextDescription,fontSize:e.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:n}},"&:hover":{background:e.controlItemBgHover},"&-disabled":{"&, &:hover":{color:e.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},Sq=e=>{const{componentCls:t,margin:n,colorSplit:o}=e;return{[`${t}-top, ${t}-bottom`]:{flexDirection:"column",[`> ${t}-nav, > div > ${t}-nav`]:{margin:`0 0 ${n}px 0`,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${e.lineWidth}px ${e.lineType} ${o}`,content:"''"},[`${t}-ink-bar`]:{height:e.lineWidthBold,"&-animated":{transition:`width ${e.motionDurationSlow}, left ${e.motionDurationSlow}, + right ${e.motionDurationSlow}`}},[`${t}-nav-wrap`]:{"&::before, &::after":{top:0,bottom:0,width:e.controlHeight},"&::before":{left:{_skip_check_:!0,value:0},boxShadow:e.boxShadowTabsOverflowLeft},"&::after":{right:{_skip_check_:!0,value:0},boxShadow:e.boxShadowTabsOverflowRight},[`&${t}-nav-wrap-ping-left::before`]:{opacity:1},[`&${t}-nav-wrap-ping-right::after`]:{opacity:1}}}},[`${t}-top`]:{[`> ${t}-nav, + > div > ${t}-nav`]:{"&::before":{bottom:0},[`${t}-ink-bar`]:{bottom:0}}},[`${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{order:1,marginTop:`${n}px`,marginBottom:0,"&::before":{top:0},[`${t}-ink-bar`]:{top:0}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{order:0}},[`${t}-left, ${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{flexDirection:"column",minWidth:e.controlHeight*1.25,[`${t}-tab`]:{padding:`${e.paddingXS}px ${e.paddingLG}px`,textAlign:"center"},[`${t}-tab + ${t}-tab`]:{margin:`${e.margin}px 0 0 0`},[`${t}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:e.controlHeight},"&::before":{top:0,boxShadow:e.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:e.boxShadowTabsOverflowBottom},[`&${t}-nav-wrap-ping-top::before`]:{opacity:1},[`&${t}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${t}-ink-bar`]:{width:e.lineWidthBold,"&-animated":{transition:`height ${e.motionDurationSlow}, top ${e.motionDurationSlow}`}},[`${t}-nav-list, ${t}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${t}-left`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{marginLeft:{_skip_check_:!0,value:`-${e.lineWidth}px`},borderLeft:{_skip_check_:!0,value:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`},[`> ${t}-content > ${t}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:e.paddingLG}}}},[`${t}-right`]:{[`> ${t}-nav, > div > ${t}-nav`]:{order:1,[`${t}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${t}-content-holder, > div > ${t}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:-e.lineWidth},borderRight:{_skip_check_:!0,value:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`},[`> ${t}-content > ${t}-tabpane`]:{paddingRight:{_skip_check_:!0,value:e.paddingLG}}}}}},$q=e=>{const{componentCls:t,padding:n}=e;return{[t]:{"&-small":{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:`${e.paddingXS}px 0`,fontSize:e.fontSize}}},"&-large":{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:`${n}px 0`,fontSize:e.fontSizeLG}}}},[`${t}-card`]:{[`&${t}-small`]:{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:`${e.paddingXXS*1.5}px ${n}px`}},[`&${t}-bottom`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:`0 0 ${e.borderRadius}px ${e.borderRadius}px`}},[`&${t}-top`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:`${e.borderRadius}px ${e.borderRadius}px 0 0`}},[`&${t}-right`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${e.borderRadius}px ${e.borderRadius}px 0`}}},[`&${t}-left`]:{[`> ${t}-nav ${t}-tab`]:{borderRadius:{_skip_check_:!0,value:`${e.borderRadius}px 0 0 ${e.borderRadius}px`}}}},[`&${t}-large`]:{[`> ${t}-nav`]:{[`${t}-tab`]:{padding:`${e.paddingXS}px ${n}px ${e.paddingXXS*1.5}px`}}}}}},Cq=e=>{const{componentCls:t,tabsActiveColor:n,tabsHoverColor:o,iconCls:r,tabsHorizontalGutter:i}=e,l=`${t}-tab`;return{[l]:{position:"relative",display:"inline-flex",alignItems:"center",padding:`${e.paddingSM}px 0`,fontSize:`${e.fontSize}px`,background:"transparent",border:0,outline:"none",cursor:"pointer","&-btn, &-remove":m({"&:focus:not(:focus-visible), &:active":{color:n}},oi(e)),"&-btn":{outline:"none",transition:"all 0.3s"},"&-remove":{flex:"none",marginRight:{_skip_check_:!0,value:-e.marginXXS},marginLeft:{_skip_check_:!0,value:e.marginXS},color:e.colorTextDescription,fontSize:e.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${e.motionDurationSlow}`,"&:hover":{color:e.colorTextHeading}},"&:hover":{color:o},[`&${l}-active ${l}-btn`]:{color:e.colorPrimary,textShadow:e.tabsActiveTextShadow},[`&${l}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed"},[`&${l}-disabled ${l}-btn, &${l}-disabled ${t}-remove`]:{"&:focus, &:active":{color:e.colorTextDisabled}},[`& ${l}-remove ${r}`]:{margin:0},[r]:{marginRight:{_skip_check_:!0,value:e.marginSM}}},[`${l} + ${l}`]:{margin:{_skip_check_:!0,value:`0 0 0 ${i}px`}}}},xq=e=>{const{componentCls:t,tabsHorizontalGutter:n,iconCls:o,tabsCardGutter:r}=e;return{[`${t}-rtl`]:{direction:"rtl",[`${t}-nav`]:{[`${t}-tab`]:{margin:{_skip_check_:!0,value:`0 0 0 ${n}px`},[`${t}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[o]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:`${e.marginSM}px`}},[`${t}-tab-remove`]:{marginRight:{_skip_check_:!0,value:`${e.marginXS}px`},marginLeft:{_skip_check_:!0,value:`-${e.marginXXS}px`},[o]:{margin:0}}}},[`&${t}-left`]:{[`> ${t}-nav`]:{order:1},[`> ${t}-content-holder`]:{order:0}},[`&${t}-right`]:{[`> ${t}-nav`]:{order:0},[`> ${t}-content-holder`]:{order:1}},[`&${t}-card${t}-top, &${t}-card${t}-bottom`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-tab + ${t}-tab`]:{marginRight:{_skip_check_:!0,value:`${r}px`},marginLeft:{_skip_check_:!0,value:0}}}}},[`${t}-dropdown-rtl`]:{direction:"rtl"},[`${t}-menu-item`]:{[`${t}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},wq=e=>{const{componentCls:t,tabsCardHorizontalPadding:n,tabsCardHeight:o,tabsCardGutter:r,tabsHoverColor:i,tabsActiveColor:l,colorSplit:a}=e;return{[t]:m(m(m(m({},qe(e)),{display:"flex",[`> ${t}-nav, > div > ${t}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${t}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${e.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${t}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${e.motionDurationSlow}`},[`${t}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${t}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${t}-nav-more`]:{position:"relative",padding:n,background:"transparent",border:0,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:e.controlHeightLG/8,transform:"translateY(100%)",content:"''"}},[`${t}-nav-add`]:m({minWidth:`${o}px`,marginLeft:{_skip_check_:!0,value:`${r}px`},padding:`0 ${e.paddingXS}px`,background:"transparent",border:`${e.lineWidth}px ${e.lineType} ${a}`,borderRadius:`${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`,outline:"none",cursor:"pointer",color:e.colorText,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOut}`,"&:hover":{color:i},"&:active, &:focus:not(:focus-visible)":{color:l}},oi(e))},[`${t}-extra-content`]:{flex:"none"},[`${t}-ink-bar`]:{position:"absolute",background:e.colorPrimary,pointerEvents:"none"}}),Cq(e)),{[`${t}-content`]:{position:"relative",display:"flex",width:"100%","&-animated":{transition:"margin 0.3s"}},[`${t}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${t}-tabpane`]:{outline:"none",flex:"none",width:"100%"}}),[`${t}-centered`]:{[`> ${t}-nav, > div > ${t}-nav`]:{[`${t}-nav-wrap`]:{[`&:not([class*='${t}-nav-wrap-ping'])`]:{justifyContent:"center"}}}}}},Oq=Ue("Tabs",e=>{const t=e.controlHeightLG,n=ze(e,{tabsHoverColor:e.colorPrimaryHover,tabsActiveColor:e.colorPrimaryActive,tabsCardHorizontalPadding:`${(t-Math.round(e.fontSize*e.lineHeight))/2-e.lineWidth}px ${e.padding}px`,tabsCardHeight:t,tabsCardGutter:e.marginXXS/2,tabsHorizontalGutter:32,tabsCardHeadBackground:e.colorFillAlter,dropdownEdgeChildVerticalPadding:e.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120});return[$q(n),xq(n),Sq(n),yq(n),bq(n),wq(n),mq(n)]},e=>({zIndexPopup:e.zIndexPopupBase+50}));let Hw=0;const qI=()=>({prefixCls:{type:String},id:{type:String},popupClassName:String,getPopupContainer:ve(),activeKey:{type:[String,Number]},defaultActiveKey:{type:[String,Number]},direction:Ne(),animated:He([Boolean,Object]),renderTabBar:ve(),tabBarGutter:{type:Number},tabBarStyle:Be(),tabPosition:Ne(),destroyInactiveTabPane:$e(),hideAdd:Boolean,type:Ne(),size:Ne(),centered:Boolean,onEdit:ve(),onChange:ve(),onTabClick:ve(),onTabScroll:ve(),"onUpdate:activeKey":ve(),locale:Be(),onPrevClick:ve(),onNextClick:ve(),tabBarExtraContent:K.any});function Pq(e){return e.map(t=>{if(qt(t)){const n=m({},t.props||{});for(const[f,h]of Object.entries(n))delete n[f],n[rs(f)]=h;const o=t.children||{},r=t.key!==void 0?t.key:void 0,{tab:i=o.tab,disabled:l,forceRender:a,closable:s,animated:c,active:u,destroyInactiveTabPane:d}=n;return m(m({key:r},n),{node:t,closeIcon:o.closeIcon,tab:i,disabled:l===""||l,forceRender:a===""||a,closable:s===""||s,animated:c===""||c,active:u===""||u,destroyInactiveTabPane:d===""||d})}return null}).filter(t=>t)}const Iq=re({compatConfig:{MODE:3},name:"InternalTabs",inheritAttrs:!1,props:m(m({},Qe(qI(),{tabPosition:"top",animated:{inkBar:!0,tabPane:!1}})),{tabs:ct()}),slots:Object,setup(e,t){let{attrs:n,slots:o}=t;Mt(e.onPrevClick===void 0&&e.onNextClick===void 0,"Tabs","`onPrevClick / @prevClick` and `onNextClick / @nextClick` has been removed. Please use `onTabScroll / @tabScroll` instead."),Mt(e.tabBarExtraContent===void 0,"Tabs","`tabBarExtraContent` prop has been removed. Please use `rightExtra` slot instead."),Mt(o.tabBarExtraContent===void 0,"Tabs","`tabBarExtraContent` slot is deprecated. Please use `rightExtra` slot instead.");const{prefixCls:r,direction:i,size:l,rootPrefixCls:a,getPopupContainer:s}=Ee("tabs",e),[c,u]=Oq(r),d=P(()=>i.value==="rtl"),f=P(()=>{const{animated:x,tabPosition:I}=e;return x===!1||["left","right"].includes(I)?{inkBar:!1,tabPane:!1}:x===!0?{inkBar:!0,tabPane:!0}:m({inkBar:!0,tabPane:!1},typeof x=="object"?x:{})}),[h,v]=St(!1);Ke(()=>{v(py())});const[g,b]=Dt(()=>{var x;return(x=e.tabs[0])===null||x===void 0?void 0:x.key},{value:P(()=>e.activeKey),defaultValue:e.defaultActiveKey}),[y,S]=St(()=>e.tabs.findIndex(x=>x.key===g.value));Ve(()=>{var x;let I=e.tabs.findIndex(T=>T.key===g.value);I===-1&&(I=Math.max(0,Math.min(y.value,e.tabs.length-1)),b((x=e.tabs[I])===null||x===void 0?void 0:x.key)),S(I)});const[$,w]=Dt(null,{value:P(()=>e.id)}),C=P(()=>h.value&&!["left","right"].includes(e.tabPosition)?"top":e.tabPosition);Ke(()=>{e.id||(w(`rc-tabs-${Hw}`),Hw+=1)});const O=(x,I)=>{var T,M;(T=e.onTabClick)===null||T===void 0||T.call(e,x,I);const E=x!==g.value;b(x),E&&((M=e.onChange)===null||M===void 0||M.call(e,x))};return cq({tabs:P(()=>e.tabs),prefixCls:r}),()=>{const{id:x,type:I,tabBarGutter:T,tabBarStyle:M,locale:E,destroyInactiveTabPane:A,renderTabBar:R=o.renderTabBar,onTabScroll:z,hideAdd:_,centered:D}=e,N={id:$.value,activeKey:g.value,animated:f.value,tabPosition:C.value,rtl:d.value,mobile:h.value};let k;I==="editable-card"&&(k={onEdit:(j,Y)=>{let{key:Z,event:X}=Y;var ee;(ee=e.onEdit)===null||ee===void 0||ee.call(e,j==="add"?X:Z,j)},removeIcon:()=>p(Vn,null,null),addIcon:o.addIcon?o.addIcon:()=>p(x1,null,null),showAdd:_!==!0});let F;const L=m(m({},N),{moreTransitionName:`${a.value}-slide-up`,editable:k,locale:E,tabBarGutter:T,onTabClick:O,onTabScroll:z,style:M,getPopupContainer:s.value,popupClassName:le(e.popupClassName,u.value)});R?F=R(m(m({},L),{DefaultTabBar:Lw})):F=p(Lw,L,N5(o,["moreIcon","leftExtra","rightExtra","tabBarExtraContent"]));const H=r.value;return c(p("div",B(B({},n),{},{id:x,class:le(H,`${H}-${C.value}`,{[u.value]:!0,[`${H}-${l.value}`]:l.value,[`${H}-card`]:["card","editable-card"].includes(I),[`${H}-editable-card`]:I==="editable-card",[`${H}-centered`]:D,[`${H}-mobile`]:h.value,[`${H}-editable`]:I==="editable-card",[`${H}-rtl`]:d.value},n.class)}),[F,p(hq,B(B({destroyInactiveTabPane:A},N),{},{animated:f.value}),null)]))}}}),El=re({compatConfig:{MODE:3},name:"ATabs",inheritAttrs:!1,props:Qe(qI(),{tabPosition:"top",animated:{inkBar:!0,tabPane:!1}}),slots:Object,setup(e,t){let{attrs:n,slots:o,emit:r}=t;const i=l=>{r("update:activeKey",l),r("change",l)};return()=>{var l;const a=Pq(wt((l=o.default)===null||l===void 0?void 0:l.call(o)));return p(Iq,B(B(B({},ot(e,["onUpdate:activeKey"])),n),{},{onChange:i,tabs:a}),o)}}}),Tq=()=>({tab:K.any,disabled:{type:Boolean},forceRender:{type:Boolean},closable:{type:Boolean},animated:{type:Boolean},active:{type:Boolean},destroyInactiveTabPane:{type:Boolean},prefixCls:{type:String},tabKey:{type:[String,Number]},id:{type:String}}),ep=re({compatConfig:{MODE:3},name:"ATabPane",inheritAttrs:!1,__ANT_TAB_PANE:!0,props:Tq(),slots:Object,setup(e,t){let{attrs:n,slots:o}=t;const r=ne(e.forceRender);ye([()=>e.active,()=>e.destroyInactiveTabPane],()=>{e.active?r.value=!0:e.destroyInactiveTabPane&&(r.value=!1)},{immediate:!0});const i=P(()=>e.active?{}:e.animated?{visibility:"hidden",height:0,overflowY:"hidden"}:{display:"none"});return()=>{var l;const{prefixCls:a,forceRender:s,id:c,active:u,tabKey:d}=e;return p("div",{id:c&&`${c}-panel-${d}`,role:"tabpanel",tabindex:u?0:-1,"aria-labelledby":c&&`${c}-tab-${d}`,"aria-hidden":!u,style:[i.value,n.style],class:[`${a}-tabpane`,u&&`${a}-tabpane-active`,n.class]},[(u||r.value||s)&&((l=o.default)===null||l===void 0?void 0:l.call(o))])}}});El.TabPane=ep;El.install=function(e){return e.component(El.name,El),e.component(ep.name,ep),e};const Eq=e=>{const{antCls:t,componentCls:n,cardHeadHeight:o,cardPaddingBase:r,cardHeadTabsMarginBottom:i}=e;return m(m({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:o,marginBottom:-1,padding:`0 ${r}px`,color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG,background:"transparent",borderBottom:`${e.lineWidth}px ${e.lineType} ${e.colorBorderSecondary}`,borderRadius:`${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`},lr()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":m(m({display:"inline-block",flex:1},Jt),{[` + > ${n}-typography, + > ${n}-typography-edit-content + `]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),[`${t}-tabs-top`]:{clear:"both",marginBottom:i,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:`${e.lineWidth}px ${e.lineType} ${e.colorBorderSecondary}`}}})},_q=e=>{const{cardPaddingBase:t,colorBorderSecondary:n,cardShadow:o,lineWidth:r}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:` + ${r}px 0 0 0 ${n}, + 0 ${r}px 0 0 ${n}, + ${r}px ${r}px 0 0 ${n}, + ${r}px 0 0 0 ${n} inset, + 0 ${r}px 0 0 ${n} inset; + `,transition:`all ${e.motionDurationMid}`,"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:o}}},Mq=e=>{const{componentCls:t,iconCls:n,cardActionsLiMargin:o,cardActionsIconSize:r,colorBorderSecondary:i}=e;return m(m({margin:0,padding:0,listStyle:"none",background:e.colorBgContainer,borderTop:`${e.lineWidth}px ${e.lineType} ${i}`,display:"flex",borderRadius:`0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px `},lr()),{"& > li":{margin:o,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.cardActionsIconSize*2,fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:`color ${e.motionDurationMid}`},[`a:not(${t}-btn), > ${n}`]:{display:"inline-block",width:"100%",color:e.colorTextDescription,lineHeight:`${e.fontSize*e.lineHeight}px`,transition:`color ${e.motionDurationMid}`,"&:hover":{color:e.colorPrimary}},[`> ${n}`]:{fontSize:r,lineHeight:`${r*e.lineHeight}px`}},"&:not(:last-child)":{borderInlineEnd:`${e.lineWidth}px ${e.lineType} ${i}`}}})},Aq=e=>m(m({margin:`-${e.marginXXS}px 0`,display:"flex"},lr()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":m({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},Jt),"&-description":{color:e.colorTextDescription}}),Rq=e=>{const{componentCls:t,cardPaddingBase:n,colorFillAlter:o}=e;return{[`${t}-head`]:{padding:`0 ${n}px`,background:o,"&-title":{fontSize:e.fontSize}},[`${t}-body`]:{padding:`${e.padding}px ${n}px`}}},Dq=e=>{const{componentCls:t}=e;return{overflow:"hidden",[`${t}-body`]:{userSelect:"none"}}},Bq=e=>{const{componentCls:t,cardShadow:n,cardHeadPadding:o,colorBorderSecondary:r,boxShadow:i,cardPaddingBase:l}=e;return{[t]:m(m({},qe(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,[`&:not(${t}-bordered)`]:{boxShadow:i},[`${t}-head`]:Eq(e),[`${t}-extra`]:{marginInlineStart:"auto",color:"",fontWeight:"normal",fontSize:e.fontSize},[`${t}-body`]:m({padding:l,borderRadius:` 0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px`},lr()),[`${t}-grid`]:_q(e),[`${t}-cover`]:{"> *":{display:"block",width:"100%"},img:{borderRadius:`${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`}},[`${t}-actions`]:Mq(e),[`${t}-meta`]:Aq(e)}),[`${t}-bordered`]:{border:`${e.lineWidth}px ${e.lineType} ${r}`,[`${t}-cover`]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},[`${t}-hoverable`]:{cursor:"pointer",transition:`box-shadow ${e.motionDurationMid}, border-color ${e.motionDurationMid}`,"&:hover":{borderColor:"transparent",boxShadow:n}},[`${t}-contain-grid`]:{[`${t}-body`]:{display:"flex",flexWrap:"wrap"},[`&:not(${t}-loading) ${t}-body`]:{marginBlockStart:-e.lineWidth,marginInlineStart:-e.lineWidth,padding:0}},[`${t}-contain-tabs`]:{[`> ${t}-head`]:{[`${t}-head-title, ${t}-extra`]:{paddingTop:o}}},[`${t}-type-inner`]:Rq(e),[`${t}-loading`]:Dq(e),[`${t}-rtl`]:{direction:"rtl"}}},Nq=e=>{const{componentCls:t,cardPaddingSM:n,cardHeadHeightSM:o}=e;return{[`${t}-small`]:{[`> ${t}-head`]:{minHeight:o,padding:`0 ${n}px`,fontSize:e.fontSize,[`> ${t}-head-wrapper`]:{[`> ${t}-extra`]:{fontSize:e.fontSize}}},[`> ${t}-body`]:{padding:n}},[`${t}-small${t}-contain-tabs`]:{[`> ${t}-head`]:{[`${t}-head-title, ${t}-extra`]:{minHeight:o,paddingTop:0,display:"flex",alignItems:"center"}}}}},kq=Ue("Card",e=>{const t=ze(e,{cardShadow:e.boxShadowCard,cardHeadHeight:e.fontSizeLG*e.lineHeightLG+e.padding*2,cardHeadHeightSM:e.fontSize*e.lineHeight+e.paddingXS*2,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardHeadTabsMarginBottom:-e.padding-e.lineWidth,cardActionsLiMargin:`${e.paddingSM}px 0`,cardActionsIconSize:e.fontSize,cardPaddingSM:12});return[Bq(t),Nq(t)]}),Fq=()=>({prefixCls:String,width:{type:[Number,String]}}),Oh=re({compatConfig:{MODE:3},name:"SkeletonTitle",props:Fq(),setup(e){return()=>{const{prefixCls:t,width:n}=e,o=typeof n=="number"?`${n}px`:n;return p("h3",{class:t,style:{width:o}},null)}}}),Lq=()=>({prefixCls:String,width:{type:[Number,String,Array]},rows:Number}),zq=re({compatConfig:{MODE:3},name:"SkeletonParagraph",props:Lq(),setup(e){const t=n=>{const{width:o,rows:r=2}=e;if(Array.isArray(o))return o[n];if(r-1===n)return o};return()=>{const{prefixCls:n,rows:o}=e,r=[...Array(o)].map((i,l)=>{const a=t(l);return p("li",{key:l,style:{width:typeof a=="number"?`${a}px`:a}},null)});return p("ul",{class:n},[r])}}}),Ph=()=>({prefixCls:String,size:[String,Number],shape:String,active:{type:Boolean,default:void 0}}),su=e=>{const{prefixCls:t,size:n,shape:o}=e,r=le({[`${t}-lg`]:n==="large",[`${t}-sm`]:n==="small"}),i=le({[`${t}-circle`]:o==="circle",[`${t}-square`]:o==="square",[`${t}-round`]:o==="round"}),l=typeof n=="number"?{width:`${n}px`,height:`${n}px`,lineHeight:`${n}px`}:{};return p("span",{class:le(t,r,i),style:l},null)};su.displayName="SkeletonElement";const Hq=new it("ant-skeleton-loading",{"0%":{transform:"translateX(-37.5%)"},"100%":{transform:"translateX(37.5%)"}}),Ih=e=>({height:e,lineHeight:`${e}px`}),Fa=e=>m({width:e},Ih(e)),jq=e=>({position:"relative",zIndex:0,overflow:"hidden",background:"transparent","&::after":{position:"absolute",top:0,insetInlineEnd:"-150%",bottom:0,insetInlineStart:"-150%",background:e.skeletonLoadingBackground,animationName:Hq,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite",content:'""'}}),bv=e=>m({width:e*5,minWidth:e*5},Ih(e)),Vq=e=>{const{skeletonAvatarCls:t,color:n,controlHeight:o,controlHeightLG:r,controlHeightSM:i}=e;return{[`${t}`]:m({display:"inline-block",verticalAlign:"top",background:n},Fa(o)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:m({},Fa(r)),[`${t}${t}-sm`]:m({},Fa(i))}},Wq=e=>{const{controlHeight:t,borderRadiusSM:n,skeletonInputCls:o,controlHeightLG:r,controlHeightSM:i,color:l}=e;return{[`${o}`]:m({display:"inline-block",verticalAlign:"top",background:l,borderRadius:n},bv(t)),[`${o}-lg`]:m({},bv(r)),[`${o}-sm`]:m({},bv(i))}},jw=e=>m({width:e},Ih(e)),Kq=e=>{const{skeletonImageCls:t,imageSizeBase:n,color:o,borderRadiusSM:r}=e;return{[`${t}`]:m(m({display:"flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",background:o,borderRadius:r},jw(n*2)),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:m(m({},jw(n)),{maxWidth:n*4,maxHeight:n*4}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}},yv=(e,t,n)=>{const{skeletonButtonCls:o}=e;return{[`${n}${o}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${n}${o}-round`]:{borderRadius:t}}},Sv=e=>m({width:e*2,minWidth:e*2},Ih(e)),Gq=e=>{const{borderRadiusSM:t,skeletonButtonCls:n,controlHeight:o,controlHeightLG:r,controlHeightSM:i,color:l}=e;return m(m(m(m(m({[`${n}`]:m({display:"inline-block",verticalAlign:"top",background:l,borderRadius:t,width:o*2,minWidth:o*2},Sv(o))},yv(e,o,n)),{[`${n}-lg`]:m({},Sv(r))}),yv(e,r,`${n}-lg`)),{[`${n}-sm`]:m({},Sv(i))}),yv(e,i,`${n}-sm`))},Uq=e=>{const{componentCls:t,skeletonAvatarCls:n,skeletonTitleCls:o,skeletonParagraphCls:r,skeletonButtonCls:i,skeletonInputCls:l,skeletonImageCls:a,controlHeight:s,controlHeightLG:c,controlHeightSM:u,color:d,padding:f,marginSM:h,borderRadius:v,skeletonTitleHeight:g,skeletonBlockRadius:b,skeletonParagraphLineHeight:y,controlHeightXS:S,skeletonParagraphMarginTop:$}=e;return{[`${t}`]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:f,verticalAlign:"top",[`${n}`]:m({display:"inline-block",verticalAlign:"top",background:d},Fa(s)),[`${n}-circle`]:{borderRadius:"50%"},[`${n}-lg`]:m({},Fa(c)),[`${n}-sm`]:m({},Fa(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[`${o}`]:{width:"100%",height:g,background:d,borderRadius:b,[`+ ${r}`]:{marginBlockStart:u}},[`${r}`]:{padding:0,"> li":{width:"100%",height:y,listStyle:"none",background:d,borderRadius:b,"+ li":{marginBlockStart:S}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${o}, ${r} > li`]:{borderRadius:v}}},[`${t}-with-avatar ${t}-content`]:{[`${o}`]:{marginBlockStart:h,[`+ ${r}`]:{marginBlockStart:$}}},[`${t}${t}-element`]:m(m(m(m({display:"inline-block",width:"auto"},Gq(e)),Vq(e)),Wq(e)),Kq(e)),[`${t}${t}-block`]:{width:"100%",[`${i}`]:{width:"100%"},[`${l}`]:{width:"100%"}},[`${t}${t}-active`]:{[` + ${o}, + ${r} > li, + ${n}, + ${i}, + ${l}, + ${a} + `]:m({},jq(e))}}},cu=Ue("Skeleton",e=>{const{componentCls:t}=e,n=ze(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:e.controlHeight*1.5,skeletonTitleHeight:e.controlHeight/2,skeletonBlockRadius:e.borderRadiusSM,skeletonParagraphLineHeight:e.controlHeight/2,skeletonParagraphMarginTop:e.marginLG+e.marginXXS,borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.color} 25%, ${e.colorGradientEnd} 37%, ${e.color} 63%)`,skeletonLoadingMotionDuration:"1.4s"});return[Uq(n)]},e=>{const{colorFillContent:t,colorFill:n}=e;return{color:t,colorGradientEnd:n}}),Xq=()=>({active:{type:Boolean,default:void 0},loading:{type:Boolean,default:void 0},prefixCls:String,avatar:{type:[Boolean,Object],default:void 0},title:{type:[Boolean,Object],default:void 0},paragraph:{type:[Boolean,Object],default:void 0},round:{type:Boolean,default:void 0}});function $v(e){return e&&typeof e=="object"?e:{}}function Yq(e,t){return e&&!t?{size:"large",shape:"square"}:{size:"large",shape:"circle"}}function qq(e,t){return!e&&t?{width:"38%"}:e&&t?{width:"50%"}:{}}function Jq(e,t){const n={};return(!e||!t)&&(n.width="61%"),!e&&t?n.rows=3:n.rows=2,n}const Rn=re({compatConfig:{MODE:3},name:"ASkeleton",props:Qe(Xq(),{avatar:!1,title:!0,paragraph:!0}),setup(e,t){let{slots:n}=t;const{prefixCls:o,direction:r}=Ee("skeleton",e),[i,l]=cu(o);return()=>{var a;const{loading:s,avatar:c,title:u,paragraph:d,active:f,round:h}=e,v=o.value;if(s||e.loading===void 0){const g=!!c||c==="",b=!!u||u==="",y=!!d||d==="";let S;if(g){const C=m(m({prefixCls:`${v}-avatar`},Yq(b,y)),$v(c));S=p("div",{class:`${v}-header`},[p(su,C,null)])}let $;if(b||y){let C;if(b){const x=m(m({prefixCls:`${v}-title`},qq(g,y)),$v(u));C=p(Oh,x,null)}let O;if(y){const x=m(m({prefixCls:`${v}-paragraph`},Jq(g,b)),$v(d));O=p(zq,x,null)}$=p("div",{class:`${v}-content`},[C,O])}const w=le(v,{[`${v}-with-avatar`]:g,[`${v}-active`]:f,[`${v}-rtl`]:r.value==="rtl",[`${v}-round`]:h,[l.value]:!0});return i(p("div",{class:w},[S,$]))}return(a=n.default)===null||a===void 0?void 0:a.call(n)}}}),Zq=()=>m(m({},Ph()),{size:String,block:Boolean}),w1=re({compatConfig:{MODE:3},name:"ASkeletonButton",props:Qe(Zq(),{size:"default"}),setup(e){const{prefixCls:t}=Ee("skeleton",e),[n,o]=cu(t),r=P(()=>le(t.value,`${t.value}-element`,{[`${t.value}-active`]:e.active,[`${t.value}-block`]:e.block},o.value));return()=>n(p("div",{class:r.value},[p(su,B(B({},e),{},{prefixCls:`${t.value}-button`}),null)]))}}),O1=re({compatConfig:{MODE:3},name:"ASkeletonInput",props:m(m({},ot(Ph(),["shape"])),{size:String,block:Boolean}),setup(e){const{prefixCls:t}=Ee("skeleton",e),[n,o]=cu(t),r=P(()=>le(t.value,`${t.value}-element`,{[`${t.value}-active`]:e.active,[`${t.value}-block`]:e.block},o.value));return()=>n(p("div",{class:r.value},[p(su,B(B({},e),{},{prefixCls:`${t.value}-input`}),null)]))}}),Qq="M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",P1=re({compatConfig:{MODE:3},name:"ASkeletonImage",props:ot(Ph(),["size","shape","active"]),setup(e){const{prefixCls:t}=Ee("skeleton",e),[n,o]=cu(t),r=P(()=>le(t.value,`${t.value}-element`,o.value));return()=>n(p("div",{class:r.value},[p("div",{class:`${t.value}-image`},[p("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",class:`${t.value}-image-svg`},[p("path",{d:Qq,class:`${t.value}-image-path`},null)])])]))}}),eJ=()=>m(m({},Ph()),{shape:String}),I1=re({compatConfig:{MODE:3},name:"ASkeletonAvatar",props:Qe(eJ(),{size:"default",shape:"circle"}),setup(e){const{prefixCls:t}=Ee("skeleton",e),[n,o]=cu(t),r=P(()=>le(t.value,`${t.value}-element`,{[`${t.value}-active`]:e.active},o.value));return()=>n(p("div",{class:r.value},[p(su,B(B({},e),{},{prefixCls:`${t.value}-avatar`}),null)]))}});Rn.Button=w1;Rn.Avatar=I1;Rn.Input=O1;Rn.Image=P1;Rn.Title=Oh;Rn.install=function(e){return e.component(Rn.name,Rn),e.component(Rn.Button.name,w1),e.component(Rn.Avatar.name,I1),e.component(Rn.Input.name,O1),e.component(Rn.Image.name,P1),e.component(Rn.Title.name,Oh),e};const{TabPane:tJ}=El,nJ=()=>({prefixCls:String,title:K.any,extra:K.any,bordered:{type:Boolean,default:!0},bodyStyle:{type:Object,default:void 0},headStyle:{type:Object,default:void 0},loading:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1},type:{type:String},size:{type:String},actions:K.any,tabList:{type:Array},tabBarExtraContent:K.any,activeTabKey:String,defaultActiveTabKey:String,cover:K.any,onTabChange:{type:Function}}),La=re({compatConfig:{MODE:3},name:"ACard",inheritAttrs:!1,props:nJ(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i,size:l}=Ee("card",e),[a,s]=kq(r),c=f=>f.map((v,g)=>Yt(v)&&!qc(v)||!Yt(v)?p("li",{style:{width:`${100/f.length}%`},key:`action-${g}`},[p("span",null,[v])]):null),u=f=>{var h;(h=e.onTabChange)===null||h===void 0||h.call(e,f)},d=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],h;return f.forEach(v=>{v&&_y(v.type)&&v.type.__ANT_CARD_GRID&&(h=!0)}),h};return()=>{var f,h,v,g,b,y;const{headStyle:S={},bodyStyle:$={},loading:w,bordered:C=!0,type:O,tabList:x,hoverable:I,activeTabKey:T,defaultActiveTabKey:M,tabBarExtraContent:E=Ts((f=n.tabBarExtraContent)===null||f===void 0?void 0:f.call(n)),title:A=Ts((h=n.title)===null||h===void 0?void 0:h.call(n)),extra:R=Ts((v=n.extra)===null||v===void 0?void 0:v.call(n)),actions:z=Ts((g=n.actions)===null||g===void 0?void 0:g.call(n)),cover:_=Ts((b=n.cover)===null||b===void 0?void 0:b.call(n))}=e,D=wt((y=n.default)===null||y===void 0?void 0:y.call(n)),N=r.value,k={[`${N}`]:!0,[s.value]:!0,[`${N}-loading`]:w,[`${N}-bordered`]:C,[`${N}-hoverable`]:!!I,[`${N}-contain-grid`]:d(D),[`${N}-contain-tabs`]:x&&x.length,[`${N}-${l.value}`]:l.value,[`${N}-type-${O}`]:!!O,[`${N}-rtl`]:i.value==="rtl"},F=p(Rn,{loading:!0,active:!0,paragraph:{rows:4},title:!1},{default:()=>[D]}),L=T!==void 0,H={size:"large",[L?"activeKey":"defaultActiveKey"]:L?T:M,onChange:u,class:`${N}-head-tabs`};let j;const Y=x&&x.length?p(El,H,{default:()=>[x.map(U=>{const{tab:Q,slots:J}=U,G=J==null?void 0:J.tab;Mt(!J,"Card","tabList slots is deprecated, Please use `customTab` instead.");let q=Q!==void 0?Q:n[G]?n[G](U):null;return q=Jp(n,"customTab",U,()=>[q]),p(tJ,{tab:q,key:U.key,disabled:U.disabled},null)})],rightExtra:E?()=>E:null}):null;(A||R||Y)&&(j=p("div",{class:`${N}-head`,style:S},[p("div",{class:`${N}-head-wrapper`},[A&&p("div",{class:`${N}-head-title`},[A]),R&&p("div",{class:`${N}-extra`},[R])]),Y]));const Z=_?p("div",{class:`${N}-cover`},[_]):null,X=p("div",{class:`${N}-body`,style:$},[w?F:D]),ee=z&&z.length?p("ul",{class:`${N}-actions`},[c(z)]):null;return a(p("div",B(B({ref:"cardContainerRef"},o),{},{class:[k,o.class]}),[j,Z,D&&D.length?X:null,ee]))}}}),oJ=()=>({prefixCls:String,title:Nn(),description:Nn(),avatar:Nn()}),tp=re({compatConfig:{MODE:3},name:"ACardMeta",props:oJ(),slots:Object,setup(e,t){let{slots:n}=t;const{prefixCls:o}=Ee("card",e);return()=>{const r={[`${o.value}-meta`]:!0},i=ln(n,e,"avatar"),l=ln(n,e,"title"),a=ln(n,e,"description"),s=i?p("div",{class:`${o.value}-meta-avatar`},[i]):null,c=l?p("div",{class:`${o.value}-meta-title`},[l]):null,u=a?p("div",{class:`${o.value}-meta-description`},[a]):null,d=c||u?p("div",{class:`${o.value}-meta-detail`},[c,u]):null;return p("div",{class:r},[s,d])}}}),rJ=()=>({prefixCls:String,hoverable:{type:Boolean,default:!0}}),np=re({compatConfig:{MODE:3},name:"ACardGrid",__ANT_CARD_GRID:!0,props:rJ(),setup(e,t){let{slots:n}=t;const{prefixCls:o}=Ee("card",e),r=P(()=>({[`${o.value}-grid`]:!0,[`${o.value}-grid-hoverable`]:e.hoverable}));return()=>{var i;return p("div",{class:r.value},[(i=n.default)===null||i===void 0?void 0:i.call(n)])}}});La.Meta=tp;La.Grid=np;La.install=function(e){return e.component(La.name,La),e.component(tp.name,tp),e.component(np.name,np),e};const iJ=()=>({prefixCls:String,activeKey:He([Array,Number,String]),defaultActiveKey:He([Array,Number,String]),accordion:$e(),destroyInactivePanel:$e(),bordered:$e(),expandIcon:ve(),openAnimation:K.object,expandIconPosition:Ne(),collapsible:Ne(),ghost:$e(),onChange:ve(),"onUpdate:activeKey":ve()}),JI=()=>({openAnimation:K.object,prefixCls:String,header:K.any,headerClass:String,showArrow:$e(),isActive:$e(),destroyInactivePanel:$e(),disabled:$e(),accordion:$e(),forceRender:$e(),expandIcon:ve(),extra:K.any,panelKey:He(),collapsible:Ne(),role:String,onItemClick:ve()}),lJ=e=>{const{componentCls:t,collapseContentBg:n,padding:o,collapseContentPaddingHorizontal:r,collapseHeaderBg:i,collapseHeaderPadding:l,collapsePanelBorderRadius:a,lineWidth:s,lineType:c,colorBorder:u,colorText:d,colorTextHeading:f,colorTextDisabled:h,fontSize:v,lineHeight:g,marginSM:b,paddingSM:y,motionDurationSlow:S,fontSizeIcon:$}=e,w=`${s}px ${c} ${u}`;return{[t]:m(m({},qe(e)),{backgroundColor:i,border:w,borderBottom:0,borderRadius:`${a}px`,"&-rtl":{direction:"rtl"},[`& > ${t}-item`]:{borderBottom:w,"&:last-child":{[` + &, + & > ${t}-header`]:{borderRadius:`0 0 ${a}px ${a}px`}},[`> ${t}-header`]:{position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:l,color:f,lineHeight:g,cursor:"pointer",transition:`all ${S}, visibility 0s`,[`> ${t}-header-text`]:{flex:"auto"},"&:focus":{outline:"none"},[`${t}-expand-icon`]:{height:v*g,display:"flex",alignItems:"center",paddingInlineEnd:b},[`${t}-arrow`]:m(m({},Kl()),{fontSize:$,svg:{transition:`transform ${S}`}}),[`${t}-header-text`]:{marginInlineEnd:"auto"}},[`${t}-header-collapsible-only`]:{cursor:"default",[`${t}-header-text`]:{flex:"none",cursor:"pointer"},[`${t}-expand-icon`]:{cursor:"pointer"}},[`${t}-icon-collapsible-only`]:{cursor:"default",[`${t}-expand-icon`]:{cursor:"pointer"}},[`&${t}-no-arrow`]:{[`> ${t}-header`]:{paddingInlineStart:y}}},[`${t}-content`]:{color:d,backgroundColor:n,borderTop:w,[`& > ${t}-content-box`]:{padding:`${o}px ${r}px`},"&-hidden":{display:"none"}},[`${t}-item:last-child`]:{[`> ${t}-content`]:{borderRadius:`0 0 ${a}px ${a}px`}},[`& ${t}-item-disabled > ${t}-header`]:{"\n &,\n & > .arrow\n ":{color:h,cursor:"not-allowed"}},[`&${t}-icon-position-end`]:{[`& > ${t}-item`]:{[`> ${t}-header`]:{[`${t}-expand-icon`]:{order:1,paddingInlineEnd:0,paddingInlineStart:b}}}}})}},aJ=e=>{const{componentCls:t}=e,n=`> ${t}-item > ${t}-header ${t}-arrow svg`;return{[`${t}-rtl`]:{[n]:{transform:"rotate(180deg)"}}}},sJ=e=>{const{componentCls:t,collapseHeaderBg:n,paddingXXS:o,colorBorder:r}=e;return{[`${t}-borderless`]:{backgroundColor:n,border:0,[`> ${t}-item`]:{borderBottom:`1px solid ${r}`},[` + > ${t}-item:last-child, + > ${t}-item:last-child ${t}-header + `]:{borderRadius:0},[`> ${t}-item:last-child`]:{borderBottom:0},[`> ${t}-item > ${t}-content`]:{backgroundColor:"transparent",borderTop:0},[`> ${t}-item > ${t}-content > ${t}-content-box`]:{paddingTop:o}}}},cJ=e=>{const{componentCls:t,paddingSM:n}=e;return{[`${t}-ghost`]:{backgroundColor:"transparent",border:0,[`> ${t}-item`]:{borderBottom:0,[`> ${t}-content`]:{backgroundColor:"transparent",border:0,[`> ${t}-content-box`]:{paddingBlock:n}}}}}},uJ=Ue("Collapse",e=>{const t=ze(e,{collapseContentBg:e.colorBgContainer,collapseHeaderBg:e.colorFillAlter,collapseHeaderPadding:`${e.paddingSM}px ${e.padding}px`,collapsePanelBorderRadius:e.borderRadiusLG,collapseContentPaddingHorizontal:16});return[lJ(t),sJ(t),cJ(t),aJ(t),nu(t)]});function Vw(e){let t=e;if(!Array.isArray(t)){const n=typeof t;t=n==="number"||n==="string"?[t]:[]}return t.map(n=>String(n))}const ic=re({compatConfig:{MODE:3},name:"ACollapse",inheritAttrs:!1,props:Qe(iJ(),{accordion:!1,destroyInactivePanel:!1,bordered:!0,expandIconPosition:"start"}),slots:Object,setup(e,t){let{attrs:n,slots:o,emit:r}=t;const i=ne(Vw(zf([e.activeKey,e.defaultActiveKey])));ye(()=>e.activeKey,()=>{i.value=Vw(e.activeKey)},{deep:!0});const{prefixCls:l,direction:a,rootPrefixCls:s}=Ee("collapse",e),[c,u]=uJ(l),d=P(()=>{const{expandIconPosition:y}=e;return y!==void 0?y:a.value==="rtl"?"end":"start"}),f=y=>{const{expandIcon:S=o.expandIcon}=e,$=S?S(y):p(Eo,{rotate:y.isActive?90:void 0},null);return p("div",{class:[`${l.value}-expand-icon`,u.value],onClick:()=>["header","icon"].includes(e.collapsible)&&v(y.panelKey)},[qt(Array.isArray(S)?$[0]:$)?pt($,{class:`${l.value}-arrow`},!1):$])},h=y=>{e.activeKey===void 0&&(i.value=y);const S=e.accordion?y[0]:y;r("update:activeKey",S),r("change",S)},v=y=>{let S=i.value;if(e.accordion)S=S[0]===y?[]:[y];else{S=[...S];const $=S.indexOf(y);$>-1?S.splice($,1):S.push(y)}h(S)},g=(y,S)=>{var $,w,C;if(qc(y))return;const O=i.value,{accordion:x,destroyInactivePanel:I,collapsible:T,openAnimation:M}=e,E=M||ru(`${s.value}-motion-collapse`),A=String(($=y.key)!==null&&$!==void 0?$:S),{header:R=(C=(w=y.children)===null||w===void 0?void 0:w.header)===null||C===void 0?void 0:C.call(w),headerClass:z,collapsible:_,disabled:D}=y.props||{};let N=!1;x?N=O[0]===A:N=O.indexOf(A)>-1;let k=_??T;(D||D==="")&&(k="disabled");const F={key:A,panelKey:A,header:R,headerClass:z,isActive:N,prefixCls:l.value,destroyInactivePanel:I,openAnimation:E,accordion:x,onItemClick:k==="disabled"?null:v,expandIcon:f,collapsible:k};return pt(y,F)},b=()=>{var y;return wt((y=o.default)===null||y===void 0?void 0:y.call(o)).map(g)};return()=>{const{accordion:y,bordered:S,ghost:$}=e,w=le(l.value,{[`${l.value}-borderless`]:!S,[`${l.value}-icon-position-${d.value}`]:!0,[`${l.value}-rtl`]:a.value==="rtl",[`${l.value}-ghost`]:!!$,[n.class]:!!n.class},u.value);return c(p("div",B(B({class:w},cR(n)),{},{style:n.style,role:y?"tablist":null}),[b()]))}}}),dJ=re({compatConfig:{MODE:3},name:"PanelContent",props:JI(),setup(e,t){let{slots:n}=t;const o=oe(!1);return Ve(()=>{(e.isActive||e.forceRender)&&(o.value=!0)}),()=>{var r;if(!o.value)return null;const{prefixCls:i,isActive:l,role:a}=e;return p("div",{class:le(`${i}-content`,{[`${i}-content-active`]:l,[`${i}-content-inactive`]:!l}),role:a},[p("div",{class:`${i}-content-box`},[(r=n.default)===null||r===void 0?void 0:r.call(n)])])}}}),op=re({compatConfig:{MODE:3},name:"ACollapsePanel",inheritAttrs:!1,props:Qe(JI(),{showArrow:!0,isActive:!1,onItemClick(){},headerClass:"",forceRender:!1}),slots:Object,setup(e,t){let{slots:n,emit:o,attrs:r}=t;Mt(e.disabled===void 0,"Collapse.Panel",'`disabled` is deprecated. Please use `collapsible="disabled"` instead.');const{prefixCls:i}=Ee("collapse",e),l=()=>{o("itemClick",e.panelKey)},a=s=>{(s.key==="Enter"||s.keyCode===13||s.which===13)&&l()};return()=>{var s,c;const{header:u=(s=n.header)===null||s===void 0?void 0:s.call(n),headerClass:d,isActive:f,showArrow:h,destroyInactivePanel:v,accordion:g,forceRender:b,openAnimation:y,expandIcon:S=n.expandIcon,extra:$=(c=n.extra)===null||c===void 0?void 0:c.call(n),collapsible:w}=e,C=w==="disabled",O=i.value,x=le(`${O}-header`,{[d]:d,[`${O}-header-collapsible-only`]:w==="header",[`${O}-icon-collapsible-only`]:w==="icon"}),I=le({[`${O}-item`]:!0,[`${O}-item-active`]:f,[`${O}-item-disabled`]:C,[`${O}-no-arrow`]:!h,[`${r.class}`]:!!r.class});let T=p("i",{class:"arrow"},null);h&&typeof S=="function"&&(T=S(e));const M=Ln(p(dJ,{prefixCls:O,isActive:f,forceRender:b,role:g?"tabpanel":null},{default:n.default}),[[Qn,f]]),E=m({appear:!1,css:!1},y);return p("div",B(B({},r),{},{class:I}),[p("div",{class:x,onClick:()=>!["header","icon"].includes(w)&&l(),role:g?"tab":"button",tabindex:C?-1:0,"aria-expanded":f,onKeypress:a},[h&&T,p("span",{onClick:()=>w==="header"&&l(),class:`${O}-header-text`},[u]),$&&p("div",{class:`${O}-extra`},[$])]),p(bn,E,{default:()=>[!v||f?M:null]})])}}});ic.Panel=op;ic.install=function(e){return e.component(ic.name,ic),e.component(op.name,op),e};const fJ=function(e){return e.replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase()}).toLowerCase()},pJ=function(e){return/[height|width]$/.test(e)},Ww=function(e){let t="";const n=Object.keys(e);return n.forEach(function(o,r){let i=e[o];o=fJ(o),pJ(o)&&typeof i=="number"&&(i=i+"px"),i===!0?t+=o:i===!1?t+="not "+o:t+="("+o+": "+i+")",r{["touchstart","touchmove","wheel"].includes(e.type)||e.preventDefault()},rp=e=>{const t=[],n=QI(e),o=eT(e);for(let r=n;re.currentSlide-gJ(e),eT=e=>e.currentSlide+vJ(e),gJ=e=>e.centerMode?Math.floor(e.slidesToShow/2)+(parseInt(e.centerPadding)>0?1:0):0,vJ=e=>e.centerMode?Math.floor((e.slidesToShow-1)/2)+1+(parseInt(e.centerPadding)>0?1:0):e.slidesToShow,d0=e=>e&&e.offsetWidth||0,T1=e=>e&&e.offsetHeight||0,tT=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;const o=e.startX-e.curX,r=e.startY-e.curY,i=Math.atan2(r,o);return n=Math.round(i*180/Math.PI),n<0&&(n=360-Math.abs(n)),n<=45&&n>=0||n<=360&&n>=315?"left":n>=135&&n<=225?"right":t===!0?n>=35&&n<=135?"up":"down":"vertical"},Th=e=>{let t=!0;return e.infinite||(e.centerMode&&e.currentSlide>=e.slideCount-1||e.slideCount<=e.slidesToShow||e.currentSlide>=e.slideCount-e.slidesToShow)&&(t=!1),t},xv=(e,t)=>{const n={};return t.forEach(o=>n[o]=e[o]),n},mJ=e=>{const t=e.children.length,n=e.listRef,o=Math.ceil(d0(n)),r=e.trackRef,i=Math.ceil(d0(r));let l;if(e.vertical)l=o;else{let h=e.centerMode&&parseInt(e.centerPadding)*2;typeof e.centerPadding=="string"&&e.centerPadding.slice(-1)==="%"&&(h*=o/100),l=Math.ceil((o-h)/e.slidesToShow)}const a=n&&T1(n.querySelector('[data-index="0"]')),s=a*e.slidesToShow;let c=e.currentSlide===void 0?e.initialSlide:e.currentSlide;e.rtl&&e.currentSlide===void 0&&(c=t-1-e.initialSlide);let u=e.lazyLoadedList||[];const d=rp(m(m({},e),{currentSlide:c,lazyLoadedList:u}));u=u.concat(d);const f={slideCount:t,slideWidth:l,listWidth:o,trackWidth:i,currentSlide:c,slideHeight:a,listHeight:s,lazyLoadedList:u};return e.autoplaying===null&&e.autoplay&&(f.autoplaying="playing"),f},bJ=e=>{const{waitForAnimate:t,animating:n,fade:o,infinite:r,index:i,slideCount:l,lazyLoad:a,currentSlide:s,centerMode:c,slidesToScroll:u,slidesToShow:d,useCSS:f}=e;let{lazyLoadedList:h}=e;if(t&&n)return{};let v=i,g,b,y,S={},$={};const w=r?i:u0(i,0,l-1);if(o){if(!r&&(i<0||i>=l))return{};i<0?v=i+l:i>=l&&(v=i-l),a&&h.indexOf(v)<0&&(h=h.concat(v)),S={animating:!0,currentSlide:v,lazyLoadedList:h,targetSlide:v},$={animating:!1,targetSlide:v}}else g=v,v<0?(g=v+l,r?l%u!==0&&(g=l-l%u):g=0):!Th(e)&&v>s?v=g=s:c&&v>=l?(v=r?l:l-1,g=r?0:l-1):v>=l&&(g=v-l,r?l%u!==0&&(g=0):g=l-d),!r&&v+d>=l&&(g=l-d),b=Lc(m(m({},e),{slideIndex:v})),y=Lc(m(m({},e),{slideIndex:g})),r||(b===y&&(v=g),b=y),a&&(h=h.concat(rp(m(m({},e),{currentSlide:v})))),f?(S={animating:!0,currentSlide:g,trackStyle:nT(m(m({},e),{left:b})),lazyLoadedList:h,targetSlide:w},$={animating:!1,currentSlide:g,trackStyle:Fc(m(m({},e),{left:y})),swipeLeft:null,targetSlide:w}):S={currentSlide:g,trackStyle:Fc(m(m({},e),{left:y})),lazyLoadedList:h,targetSlide:w};return{state:S,nextState:$}},yJ=(e,t)=>{let n,o,r;const{slidesToScroll:i,slidesToShow:l,slideCount:a,currentSlide:s,targetSlide:c,lazyLoad:u,infinite:d}=e,h=a%i!==0?0:(a-s)%i;if(t.message==="previous")o=h===0?i:l-h,r=s-o,u&&!d&&(n=s-o,r=n===-1?a-1:n),d||(r=c-i);else if(t.message==="next")o=h===0?i:h,r=s+o,u&&!d&&(r=(s+i)%a+h),d||(r=c+i);else if(t.message==="dots")r=t.index*t.slidesToScroll;else if(t.message==="children"){if(r=t.index,d){const v=PJ(m(m({},e),{targetSlide:r}));r>t.currentSlide&&v==="left"?r=r-a:re.target.tagName.match("TEXTAREA|INPUT|SELECT")||!t?"":e.keyCode===37?n?"next":"previous":e.keyCode===39?n?"previous":"next":"",$J=(e,t,n)=>(e.target.tagName==="IMG"&&za(e),!t||!n&&e.type.indexOf("mouse")!==-1?"":{dragging:!0,touchObject:{startX:e.touches?e.touches[0].pageX:e.clientX,startY:e.touches?e.touches[0].pageY:e.clientY,curX:e.touches?e.touches[0].pageX:e.clientX,curY:e.touches?e.touches[0].pageY:e.clientY}}),CJ=(e,t)=>{const{scrolling:n,animating:o,vertical:r,swipeToSlide:i,verticalSwiping:l,rtl:a,currentSlide:s,edgeFriction:c,edgeDragged:u,onEdge:d,swiped:f,swiping:h,slideCount:v,slidesToScroll:g,infinite:b,touchObject:y,swipeEvent:S,listHeight:$,listWidth:w}=t;if(n)return;if(o)return za(e);r&&i&&l&&za(e);let C,O={};const x=Lc(t);y.curX=e.touches?e.touches[0].pageX:e.clientX,y.curY=e.touches?e.touches[0].pageY:e.clientY,y.swipeLength=Math.round(Math.sqrt(Math.pow(y.curX-y.startX,2)));const I=Math.round(Math.sqrt(Math.pow(y.curY-y.startY,2)));if(!l&&!h&&I>10)return{scrolling:!0};l&&(y.swipeLength=I);let T=(a?-1:1)*(y.curX>y.startX?1:-1);l&&(T=y.curY>y.startY?1:-1);const M=Math.ceil(v/g),E=tT(t.touchObject,l);let A=y.swipeLength;return b||(s===0&&(E==="right"||E==="down")||s+1>=M&&(E==="left"||E==="up")||!Th(t)&&(E==="left"||E==="up"))&&(A=y.swipeLength*c,u===!1&&d&&(d(E),O.edgeDragged=!0)),!f&&S&&(S(E),O.swiped=!0),r?C=x+A*($/w)*T:a?C=x-A*T:C=x+A*T,l&&(C=x+A*T),O=m(m({},O),{touchObject:y,swipeLeft:C,trackStyle:Fc(m(m({},t),{left:C}))}),Math.abs(y.curX-y.startX)10&&(O.swiping=!0,za(e)),O},xJ=(e,t)=>{const{dragging:n,swipe:o,touchObject:r,listWidth:i,touchThreshold:l,verticalSwiping:a,listHeight:s,swipeToSlide:c,scrolling:u,onSwipe:d,targetSlide:f,currentSlide:h,infinite:v}=t;if(!n)return o&&za(e),{};const g=a?s/l:i/l,b=tT(r,a),y={dragging:!1,edgeDragged:!1,scrolling:!1,swiping:!1,swiped:!1,swipeLeft:null,touchObject:{}};if(u||!r.swipeLength)return y;if(r.swipeLength>g){za(e),d&&d(b);let S,$;const w=v?h:f;switch(b){case"left":case"up":$=w+Gw(t),S=c?Kw(t,$):$,y.currentDirection=0;break;case"right":case"down":$=w-Gw(t),S=c?Kw(t,$):$,y.currentDirection=1;break;default:S=w}y.triggerSlideHandler=S}else{const S=Lc(t);y.trackStyle=nT(m(m({},t),{left:S}))}return y},wJ=e=>{const t=e.infinite?e.slideCount*2:e.slideCount;let n=e.infinite?e.slidesToShow*-1:0,o=e.infinite?e.slidesToShow*-1:0;const r=[];for(;n{const n=wJ(e);let o=0;if(t>n[n.length-1])t=n[n.length-1];else for(const r in n){if(t{const t=e.centerMode?e.slideWidth*Math.floor(e.slidesToShow/2):0;if(e.swipeToSlide){let n;const o=e.listRef,r=o.querySelectorAll&&o.querySelectorAll(".slick-slide")||[];if(Array.from(r).every(a=>{if(e.vertical){if(a.offsetTop+T1(a)/2>e.swipeLeft*-1)return n=a,!1}else if(a.offsetLeft-t+d0(a)/2>e.swipeLeft*-1)return n=a,!1;return!0}),!n)return 0;const i=e.rtl===!0?e.slideCount-e.currentSlide:e.currentSlide;return Math.abs(n.dataset.index-i)||1}else return e.slidesToScroll},E1=(e,t)=>t.reduce((n,o)=>n&&e.hasOwnProperty(o),!0)?null:console.error("Keys Missing:",e),Fc=e=>{E1(e,["left","variableWidth","slideCount","slidesToShow","slideWidth"]);let t,n;const o=e.slideCount+2*e.slidesToShow;e.vertical?n=o*e.slideHeight:t=OJ(e)*e.slideWidth;let r={opacity:1,transition:"",WebkitTransition:""};if(e.useTransform){const i=e.vertical?"translate3d(0px, "+e.left+"px, 0px)":"translate3d("+e.left+"px, 0px, 0px)",l=e.vertical?"translate3d(0px, "+e.left+"px, 0px)":"translate3d("+e.left+"px, 0px, 0px)",a=e.vertical?"translateY("+e.left+"px)":"translateX("+e.left+"px)";r=m(m({},r),{WebkitTransform:i,transform:l,msTransform:a})}else e.vertical?r.top=e.left:r.left=e.left;return e.fade&&(r={opacity:1}),t&&(r.width=t+"px"),n&&(r.height=n+"px"),window&&!window.addEventListener&&window.attachEvent&&(e.vertical?r.marginTop=e.left+"px":r.marginLeft=e.left+"px"),r},nT=e=>{E1(e,["left","variableWidth","slideCount","slidesToShow","slideWidth","speed","cssEase"]);const t=Fc(e);return e.useTransform?(t.WebkitTransition="-webkit-transform "+e.speed+"ms "+e.cssEase,t.transition="transform "+e.speed+"ms "+e.cssEase):e.vertical?t.transition="top "+e.speed+"ms "+e.cssEase:t.transition="left "+e.speed+"ms "+e.cssEase,t},Lc=e=>{if(e.unslick)return 0;E1(e,["slideIndex","trackRef","infinite","centerMode","slideCount","slidesToShow","slidesToScroll","slideWidth","listWidth","variableWidth","slideHeight"]);const{slideIndex:t,trackRef:n,infinite:o,centerMode:r,slideCount:i,slidesToShow:l,slidesToScroll:a,slideWidth:s,listWidth:c,variableWidth:u,slideHeight:d,fade:f,vertical:h}=e;let v=0,g,b,y=0;if(f||e.slideCount===1)return 0;let S=0;if(o?(S=-Qr(e),i%a!==0&&t+a>i&&(S=-(t>i?l-(t-i):i%a)),r&&(S+=parseInt(l/2))):(i%a!==0&&t+a>i&&(S=l-i%a),r&&(S=parseInt(l/2))),v=S*s,y=S*d,h?g=t*d*-1+y:g=t*s*-1+v,u===!0){let $;const w=n;if($=t+Qr(e),b=w&&w.childNodes[$],g=b?b.offsetLeft*-1:0,r===!0){$=o?t+Qr(e):t,b=w&&w.children[$],g=0;for(let C=0;C<$;C++)g-=w&&w.children[C]&&w.children[C].offsetWidth;g-=parseInt(e.centerPadding),g+=b&&(c-b.offsetWidth)/2}}return g},Qr=e=>e.unslick||!e.infinite?0:e.variableWidth?e.slideCount:e.slidesToShow+(e.centerMode?1:0),Dd=e=>e.unslick||!e.infinite?0:e.slideCount,OJ=e=>e.slideCount===1?1:Qr(e)+e.slideCount+Dd(e),PJ=e=>e.targetSlide>e.currentSlide?e.targetSlide>e.currentSlide+IJ(e)?"left":"right":e.targetSlide{let{slidesToShow:t,centerMode:n,rtl:o,centerPadding:r}=e;if(n){let i=(t-1)/2+1;return parseInt(r)>0&&(i+=1),o&&t%2===0&&(i+=1),i}return o?0:t-1},TJ=e=>{let{slidesToShow:t,centerMode:n,rtl:o,centerPadding:r}=e;if(n){let i=(t-1)/2+1;return parseInt(r)>0&&(i+=1),!o&&t%2===0&&(i+=1),i}return o?t-1:0},Uw=()=>!!(typeof window<"u"&&window.document&&window.document.createElement),wv=e=>{let t,n,o,r;e.rtl?r=e.slideCount-1-e.index:r=e.index;const i=r<0||r>=e.slideCount;e.centerMode?(o=Math.floor(e.slidesToShow/2),n=(r-e.currentSlide)%e.slideCount===0,r>e.currentSlide-o-1&&r<=e.currentSlide+o&&(t=!0)):t=e.currentSlide<=r&&r=e.slideCount?l=e.targetSlide-e.slideCount:l=e.targetSlide,{"slick-slide":!0,"slick-active":t,"slick-center":n,"slick-cloned":i,"slick-current":r===l}},EJ=function(e){const t={};return(e.variableWidth===void 0||e.variableWidth===!1)&&(t.width=e.slideWidth+(typeof e.slideWidth=="number"?"px":"")),e.fade&&(t.position="relative",e.vertical?t.top=-e.index*parseInt(e.slideHeight)+"px":t.left=-e.index*parseInt(e.slideWidth)+"px",t.opacity=e.currentSlide===e.index?1:0,e.useCSS&&(t.transition="opacity "+e.speed+"ms "+e.cssEase+", visibility "+e.speed+"ms "+e.cssEase)),t},Ov=(e,t)=>e.key+"-"+t,_J=function(e,t){let n;const o=[],r=[],i=[],l=t.length,a=QI(e),s=eT(e);return t.forEach((c,u)=>{let d;const f={message:"children",index:u,slidesToScroll:e.slidesToScroll,currentSlide:e.currentSlide};!e.lazyLoad||e.lazyLoad&&e.lazyLoadedList.indexOf(u)>=0?d=c:d=p("div");const h=EJ(m(m({},e),{index:u})),v=d.props.class||"";let g=wv(m(m({},e),{index:u}));if(o.push(Qs(d,{key:"original"+Ov(d,u),tabindex:"-1","data-index":u,"aria-hidden":!g["slick-active"],class:le(g,v),style:m(m({outline:"none"},d.props.style||{}),h),onClick:()=>{e.focusOnSelect&&e.focusOnSelect(f)}})),e.infinite&&e.fade===!1){const b=l-u;b<=Qr(e)&&l!==e.slidesToShow&&(n=-b,n>=a&&(d=c),g=wv(m(m({},e),{index:n})),r.push(Qs(d,{key:"precloned"+Ov(d,n),class:le(g,v),tabindex:"-1","data-index":n,"aria-hidden":!g["slick-active"],style:m(m({},d.props.style||{}),h),onClick:()=>{e.focusOnSelect&&e.focusOnSelect(f)}}))),l!==e.slidesToShow&&(n=l+u,n{e.focusOnSelect&&e.focusOnSelect(f)}})))}}),e.rtl?r.concat(o,i).reverse():r.concat(o,i)},oT=(e,t)=>{let{attrs:n,slots:o}=t;const r=_J(n,wt(o==null?void 0:o.default())),{onMouseenter:i,onMouseover:l,onMouseleave:a}=n,s={onMouseenter:i,onMouseover:l,onMouseleave:a},c=m({class:"slick-track",style:n.trackStyle},s);return p("div",c,[r])};oT.inheritAttrs=!1;const MJ=function(e){let t;return e.infinite?t=Math.ceil(e.slideCount/e.slidesToScroll):t=Math.ceil((e.slideCount-e.slidesToShow)/e.slidesToScroll)+1,t},rT=(e,t)=>{let{attrs:n}=t;const{slideCount:o,slidesToScroll:r,slidesToShow:i,infinite:l,currentSlide:a,appendDots:s,customPaging:c,clickHandler:u,dotsClass:d,onMouseenter:f,onMouseover:h,onMouseleave:v}=n,g=MJ({slideCount:o,slidesToScroll:r,slidesToShow:i,infinite:l}),b={onMouseenter:f,onMouseover:h,onMouseleave:v};let y=[];for(let S=0;S=O&&a<=w:a===O}),I={message:"dots",index:S,slidesToScroll:r,currentSlide:a};y=y.concat(p("li",{key:S,class:x},[pt(c({i:S}),{onClick:T})]))}return pt(s({dots:y}),m({class:d},b))};rT.inheritAttrs=!1;function iT(){}function lT(e,t,n){n&&n.preventDefault(),t(e,n)}const aT=(e,t)=>{let{attrs:n}=t;const{clickHandler:o,infinite:r,currentSlide:i,slideCount:l,slidesToShow:a}=n,s={"slick-arrow":!0,"slick-prev":!0};let c=function(h){lT({message:"previous"},o,h)};!r&&(i===0||l<=a)&&(s["slick-disabled"]=!0,c=iT);const u={key:"0","data-role":"none",class:s,style:{display:"block"},onClick:c},d={currentSlide:i,slideCount:l};let f;return n.prevArrow?f=pt(n.prevArrow(m(m({},u),d)),{key:"0",class:s,style:{display:"block"},onClick:c},!1):f=p("button",B({key:"0",type:"button"},u),[" ",Pt("Previous")]),f};aT.inheritAttrs=!1;const sT=(e,t)=>{let{attrs:n}=t;const{clickHandler:o,currentSlide:r,slideCount:i}=n,l={"slick-arrow":!0,"slick-next":!0};let a=function(d){lT({message:"next"},o,d)};Th(n)||(l["slick-disabled"]=!0,a=iT);const s={key:"1","data-role":"none",class:le(l),style:{display:"block"},onClick:a},c={currentSlide:r,slideCount:i};let u;return n.nextArrow?u=pt(n.nextArrow(m(m({},s),c)),{key:"1",class:le(l),style:{display:"block"},onClick:a},!1):u=p("button",B({key:"1",type:"button"},s),[" ",Pt("Next")]),u};sT.inheritAttrs=!1;var AJ=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{this.currentSlide>=e.children.length&&this.changeSlide({message:"index",index:e.children.length-e.slidesToShow,currentSlide:this.currentSlide}),!this.preProps.autoplay&&e.autoplay?this.handleAutoPlay("playing"):e.autoplay?this.handleAutoPlay("update"):this.pause("paused")}),this.preProps=m({},e)}},mounted(){if(this.__emit("init"),this.lazyLoad){const e=rp(m(m({},this.$props),this.$data));e.length>0&&(this.setState(t=>({lazyLoadedList:t.lazyLoadedList.concat(e)})),this.__emit("lazyLoad",e))}this.$nextTick(()=>{const e=m({listRef:this.list,trackRef:this.track,children:this.children},this.$props);this.updateState(e,!0,()=>{this.adaptHeight(),this.autoplay&&this.handleAutoPlay("playing")}),this.lazyLoad==="progressive"&&(this.lazyLoadTimer=setInterval(this.progressiveLazyLoad,1e3)),this.ro=new Tb(()=>{this.animating?(this.onWindowResized(!1),this.callbackTimers.push(setTimeout(()=>this.onWindowResized(),this.speed))):this.onWindowResized()}),this.ro.observe(this.list),document.querySelectorAll&&Array.prototype.forEach.call(document.querySelectorAll(".slick-slide"),t=>{t.onfocus=this.$props.pauseOnFocus?this.onSlideFocus:null,t.onblur=this.$props.pauseOnFocus?this.onSlideBlur:null}),window.addEventListener?window.addEventListener("resize",this.onWindowResized):window.attachEvent("onresize",this.onWindowResized)})},beforeUnmount(){var e;this.animationEndCallback&&clearTimeout(this.animationEndCallback),this.lazyLoadTimer&&clearInterval(this.lazyLoadTimer),this.callbackTimers.length&&(this.callbackTimers.forEach(t=>clearTimeout(t)),this.callbackTimers=[]),window.addEventListener?window.removeEventListener("resize",this.onWindowResized):window.detachEvent("onresize",this.onWindowResized),this.autoplayTimer&&clearInterval(this.autoplayTimer),(e=this.ro)===null||e===void 0||e.disconnect()},updated(){if(this.checkImagesLoad(),this.__emit("reInit"),this.lazyLoad){const e=rp(m(m({},this.$props),this.$data));e.length>0&&(this.setState(t=>({lazyLoadedList:t.lazyLoadedList.concat(e)})),this.__emit("lazyLoad"))}this.adaptHeight()},methods:{listRefHandler(e){this.list=e},trackRefHandler(e){this.track=e},adaptHeight(){if(this.adaptiveHeight&&this.list){const e=this.list.querySelector(`[data-index="${this.currentSlide}"]`);this.list.style.height=T1(e)+"px"}},onWindowResized(e){this.debouncedResize&&this.debouncedResize.cancel(),this.debouncedResize=Ry(()=>this.resizeWindow(e),50),this.debouncedResize()},resizeWindow(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(!!!this.track)return;const n=m(m({listRef:this.list,trackRef:this.track,children:this.children},this.$props),this.$data);this.updateState(n,e,()=>{this.autoplay?this.handleAutoPlay("update"):this.pause("paused")}),this.setState({animating:!1}),clearTimeout(this.animationEndCallback),delete this.animationEndCallback},updateState(e,t,n){const o=mJ(e);e=m(m(m({},e),o),{slideIndex:o.currentSlide});const r=Lc(e);e=m(m({},e),{left:r});const i=Fc(e);(t||this.children.length!==e.children.length)&&(o.trackStyle=i),this.setState(o,n)},ssrInit(){const e=this.children;if(this.variableWidth){let s=0,c=0;const u=[],d=Qr(m(m(m({},this.$props),this.$data),{slideCount:e.length})),f=Dd(m(m(m({},this.$props),this.$data),{slideCount:e.length}));e.forEach(v=>{var g,b;const y=((b=(g=v.props.style)===null||g===void 0?void 0:g.width)===null||b===void 0?void 0:b.split("px")[0])||0;u.push(y),s+=y});for(let v=0;v{const r=()=>++n&&n>=t&&this.onWindowResized();if(!o.onclick)o.onclick=()=>o.parentNode.focus();else{const i=o.onclick;o.onclick=()=>{i(),o.parentNode.focus()}}o.onload||(this.$props.lazyLoad?o.onload=()=>{this.adaptHeight(),this.callbackTimers.push(setTimeout(this.onWindowResized,this.speed))}:(o.onload=r,o.onerror=()=>{r(),this.__emit("lazyLoadError")}))})},progressiveLazyLoad(){const e=[],t=m(m({},this.$props),this.$data);for(let n=this.currentSlide;n=-Qr(t);n--)if(this.lazyLoadedList.indexOf(n)<0){e.push(n);break}e.length>0?(this.setState(n=>({lazyLoadedList:n.lazyLoadedList.concat(e)})),this.__emit("lazyLoad",e)):this.lazyLoadTimer&&(clearInterval(this.lazyLoadTimer),delete this.lazyLoadTimer)},slideHandler(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const{asNavFor:n,beforeChange:o,speed:r,afterChange:i}=this.$props,{state:l,nextState:a}=bJ(m(m(m({index:e},this.$props),this.$data),{trackRef:this.track,useCSS:this.useCSS&&!t}));if(!l)return;o&&o(this.currentSlide,l.currentSlide);const s=l.lazyLoadedList.filter(c=>this.lazyLoadedList.indexOf(c)<0);this.$attrs.onLazyLoad&&s.length>0&&this.__emit("lazyLoad",s),!this.$props.waitForAnimate&&this.animationEndCallback&&(clearTimeout(this.animationEndCallback),i&&i(this.currentSlide),delete this.animationEndCallback),this.setState(l,()=>{n&&this.asNavForIndex!==e&&(this.asNavForIndex=e,n.innerSlider.slideHandler(e)),a&&(this.animationEndCallback=setTimeout(()=>{const{animating:c}=a,u=AJ(a,["animating"]);this.setState(u,()=>{this.callbackTimers.push(setTimeout(()=>this.setState({animating:c}),10)),i&&i(l.currentSlide),delete this.animationEndCallback})},r))})},changeSlide(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=m(m({},this.$props),this.$data),o=yJ(n,e);if(!(o!==0&&!o)&&(t===!0?this.slideHandler(o,t):this.slideHandler(o),this.$props.autoplay&&this.handleAutoPlay("update"),this.$props.focusOnSelect)){const r=this.list.querySelectorAll(".slick-current");r[0]&&r[0].focus()}},clickHandler(e){this.clickable===!1&&(e.stopPropagation(),e.preventDefault()),this.clickable=!0},keyHandler(e){const t=SJ(e,this.accessibility,this.rtl);t!==""&&this.changeSlide({message:t})},selectHandler(e){this.changeSlide(e)},disableBodyScroll(){const e=t=>{t=t||window.event,t.preventDefault&&t.preventDefault(),t.returnValue=!1};window.ontouchmove=e},enableBodyScroll(){window.ontouchmove=null},swipeStart(e){this.verticalSwiping&&this.disableBodyScroll();const t=$J(e,this.swipe,this.draggable);t!==""&&this.setState(t)},swipeMove(e){const t=CJ(e,m(m(m({},this.$props),this.$data),{trackRef:this.track,listRef:this.list,slideIndex:this.currentSlide}));t&&(t.swiping&&(this.clickable=!1),this.setState(t))},swipeEnd(e){const t=xJ(e,m(m(m({},this.$props),this.$data),{trackRef:this.track,listRef:this.list,slideIndex:this.currentSlide}));if(!t)return;const n=t.triggerSlideHandler;delete t.triggerSlideHandler,this.setState(t),n!==void 0&&(this.slideHandler(n),this.$props.verticalSwiping&&this.enableBodyScroll())},touchEnd(e){this.swipeEnd(e),this.clickable=!0},slickPrev(){this.callbackTimers.push(setTimeout(()=>this.changeSlide({message:"previous"}),0))},slickNext(){this.callbackTimers.push(setTimeout(()=>this.changeSlide({message:"next"}),0))},slickGoTo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e=Number(e),isNaN(e))return"";this.callbackTimers.push(setTimeout(()=>this.changeSlide({message:"index",index:e,currentSlide:this.currentSlide},t),0))},play(){let e;if(this.rtl)e=this.currentSlide-this.slidesToScroll;else if(Th(m(m({},this.$props),this.$data)))e=this.currentSlide+this.slidesToScroll;else return!1;this.slideHandler(e)},handleAutoPlay(e){this.autoplayTimer&&clearInterval(this.autoplayTimer);const t=this.autoplaying;if(e==="update"){if(t==="hovered"||t==="focused"||t==="paused")return}else if(e==="leave"){if(t==="paused"||t==="focused")return}else if(e==="blur"&&(t==="paused"||t==="hovered"))return;this.autoplayTimer=setInterval(this.play,this.autoplaySpeed+50),this.setState({autoplaying:"playing"})},pause(e){this.autoplayTimer&&(clearInterval(this.autoplayTimer),this.autoplayTimer=null);const t=this.autoplaying;e==="paused"?this.setState({autoplaying:"paused"}):e==="focused"?(t==="hovered"||t==="playing")&&this.setState({autoplaying:"focused"}):t==="playing"&&this.setState({autoplaying:"hovered"})},onDotsOver(){this.autoplay&&this.pause("hovered")},onDotsLeave(){this.autoplay&&this.autoplaying==="hovered"&&this.handleAutoPlay("leave")},onTrackOver(){this.autoplay&&this.pause("hovered")},onTrackLeave(){this.autoplay&&this.autoplaying==="hovered"&&this.handleAutoPlay("leave")},onSlideFocus(){this.autoplay&&this.pause("focused")},onSlideBlur(){this.autoplay&&this.autoplaying==="focused"&&this.handleAutoPlay("blur")},customPaging(e){let{i:t}=e;return p("button",null,[t+1])},appendDots(e){let{dots:t}=e;return p("ul",{style:{display:"block"}},[t])}},render(){const e=le("slick-slider",this.$attrs.class,{"slick-vertical":this.vertical,"slick-initialized":!0}),t=m(m({},this.$props),this.$data);let n=xv(t,["fade","cssEase","speed","infinite","centerMode","focusOnSelect","currentSlide","lazyLoad","lazyLoadedList","rtl","slideWidth","slideHeight","listHeight","vertical","slidesToShow","slidesToScroll","slideCount","trackStyle","variableWidth","unslick","centerPadding","targetSlide","useCSS"]);const{pauseOnHover:o}=this.$props;n=m(m({},n),{focusOnSelect:this.focusOnSelect&&this.clickable?this.selectHandler:null,ref:this.trackRefHandler,onMouseleave:o?this.onTrackLeave:vo,onMouseover:o?this.onTrackOver:vo});let r;if(this.dots===!0&&this.slideCount>=this.slidesToShow){let b=xv(t,["dotsClass","slideCount","slidesToShow","currentSlide","slidesToScroll","clickHandler","children","infinite","appendDots"]);b.customPaging=this.customPaging,b.appendDots=this.appendDots;const{customPaging:y,appendDots:S}=this.$slots;y&&(b.customPaging=y),S&&(b.appendDots=S);const{pauseOnDotsHover:$}=this.$props;b=m(m({},b),{clickHandler:this.changeSlide,onMouseover:$?this.onDotsOver:vo,onMouseleave:$?this.onDotsLeave:vo}),r=p(rT,b,null)}let i,l;const a=xv(t,["infinite","centerMode","currentSlide","slideCount","slidesToShow"]);a.clickHandler=this.changeSlide;const{prevArrow:s,nextArrow:c}=this.$slots;s&&(a.prevArrow=s),c&&(a.nextArrow=c),this.arrows&&(i=p(aT,a,null),l=p(sT,a,null));let u=null;this.vertical&&(u={height:typeof this.listHeight=="number"?`${this.listHeight}px`:this.listHeight});let d=null;this.vertical===!1?this.centerMode===!0&&(d={padding:"0px "+this.centerPadding}):this.centerMode===!0&&(d={padding:this.centerPadding+" 0px"});const f=m(m({},u),d),h=this.touchMove;let v={ref:this.listRefHandler,class:"slick-list",style:f,onClick:this.clickHandler,onMousedown:h?this.swipeStart:vo,onMousemove:this.dragging&&h?this.swipeMove:vo,onMouseup:h?this.swipeEnd:vo,onMouseleave:this.dragging&&h?this.swipeEnd:vo,[on?"onTouchstartPassive":"onTouchstart"]:h?this.swipeStart:vo,[on?"onTouchmovePassive":"onTouchmove"]:this.dragging&&h?this.swipeMove:vo,onTouchend:h?this.touchEnd:vo,onTouchcancel:this.dragging&&h?this.swipeEnd:vo,onKeydown:this.accessibility?this.keyHandler:vo},g={class:e,dir:"ltr",style:this.$attrs.style};return this.unslick&&(v={class:"slick-list",ref:this.listRefHandler},g={class:e}),p("div",g,[this.unslick?"":i,p("div",v,[p(oT,n,{default:()=>[this.children]})]),this.unslick?"":l,this.unslick?"":r])}},DJ=re({name:"Slider",mixins:[Yl],inheritAttrs:!1,props:m({},ZI),data(){return this._responsiveMediaHandlers=[],{breakpoint:null}},mounted(){if(this.responsive){const e=this.responsive.map(n=>n.breakpoint);e.sort((n,o)=>n-o),e.forEach((n,o)=>{let r;o===0?r=Cv({minWidth:0,maxWidth:n}):r=Cv({minWidth:e[o-1]+1,maxWidth:n}),Uw()&&this.media(r,()=>{this.setState({breakpoint:n})})});const t=Cv({minWidth:e.slice(-1)[0]});Uw()&&this.media(t,()=>{this.setState({breakpoint:null})})}},beforeUnmount(){this._responsiveMediaHandlers.forEach(function(e){e.mql.removeListener(e.listener)})},methods:{innerSliderRefHandler(e){this.innerSlider=e},media(e,t){const n=window.matchMedia(e),o=r=>{let{matches:i}=r;i&&t()};n.addListener(o),o(n),this._responsiveMediaHandlers.push({mql:n,query:e,listener:o})},slickPrev(){var e;(e=this.innerSlider)===null||e===void 0||e.slickPrev()},slickNext(){var e;(e=this.innerSlider)===null||e===void 0||e.slickNext()},slickGoTo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var n;(n=this.innerSlider)===null||n===void 0||n.slickGoTo(e,t)},slickPause(){var e;(e=this.innerSlider)===null||e===void 0||e.pause("paused")},slickPlay(){var e;(e=this.innerSlider)===null||e===void 0||e.handleAutoPlay("play")}},render(){var e;let t,n;this.breakpoint?(n=this.responsive.filter(a=>a.breakpoint===this.breakpoint),t=n[0].settings==="unslick"?"unslick":m(m({},this.$props),n[0].settings)):t=m({},this.$props),t.centerMode&&(t.slidesToScroll>1,t.slidesToScroll=1),t.fade&&(t.slidesToShow>1,t.slidesToScroll>1,t.slidesToShow=1,t.slidesToScroll=1);let o=Hp(this)||[];o=o.filter(a=>typeof a=="string"?!!a.trim():!!a),t.variableWidth&&(t.rows>1||t.slidesPerRow>1)&&(console.warn("variableWidth is not supported in case of rows > 1 or slidesPerRow > 1"),t.variableWidth=!1);const r=[];let i=null;for(let a=0;a=o.length));d+=1)u.push(pt(o[d],{key:100*a+10*c+d,tabindex:-1,style:{width:`${100/t.slidesPerRow}%`,display:"inline-block"}}));s.push(p("div",{key:10*a+c},[u]))}t.variableWidth?r.push(p("div",{key:a,style:{width:i}},[s])):r.push(p("div",{key:a},[s]))}if(t==="unslick"){const a="regular slider "+(this.className||"");return p("div",{class:a},[o])}else r.length<=t.slidesToShow&&(t.unslick=!0);const l=m(m(m({},this.$attrs),t),{children:r,ref:this.innerSliderRefHandler});return p(RJ,B(B({},l),{},{__propsSymbol__:[]}),this.$slots)}}),BJ=e=>{const{componentCls:t,antCls:n,carouselArrowSize:o,carouselDotOffset:r,marginXXS:i}=e,l=-o*1.25,a=i;return{[t]:m(m({},qe(e)),{".slick-slider":{position:"relative",display:"block",boxSizing:"border-box",touchAction:"pan-y",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",".slick-track, .slick-list":{transform:"translate3d(0, 0, 0)",touchAction:"pan-y"}},".slick-list":{position:"relative",display:"block",margin:0,padding:0,overflow:"hidden","&:focus":{outline:"none"},"&.dragging":{cursor:"pointer"},".slick-slide":{pointerEvents:"none",[`input${n}-radio-input, input${n}-checkbox-input`]:{visibility:"hidden"},"&.slick-active":{pointerEvents:"auto",[`input${n}-radio-input, input${n}-checkbox-input`]:{visibility:"visible"}},"> div > div":{verticalAlign:"bottom"}}},".slick-track":{position:"relative",top:0,insetInlineStart:0,display:"block","&::before, &::after":{display:"table",content:'""'},"&::after":{clear:"both"}},".slick-slide":{display:"none",float:"left",height:"100%",minHeight:1,img:{display:"block"},"&.dragging img":{pointerEvents:"none"}},".slick-initialized .slick-slide":{display:"block"},".slick-vertical .slick-slide":{display:"block",height:"auto"},".slick-arrow.slick-hidden":{display:"none"},".slick-prev, .slick-next":{position:"absolute",top:"50%",display:"block",width:o,height:o,marginTop:-o/2,padding:0,color:"transparent",fontSize:0,lineHeight:0,background:"transparent",border:0,outline:"none",cursor:"pointer","&:hover, &:focus":{color:"transparent",background:"transparent",outline:"none","&::before":{opacity:1}},"&.slick-disabled::before":{opacity:.25}},".slick-prev":{insetInlineStart:l,"&::before":{content:'"←"'}},".slick-next":{insetInlineEnd:l,"&::before":{content:'"→"'}},".slick-dots":{position:"absolute",insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:15,display:"flex !important",justifyContent:"center",paddingInlineStart:0,listStyle:"none","&-bottom":{bottom:r},"&-top":{top:r,bottom:"auto"},li:{position:"relative",display:"inline-block",flex:"0 1 auto",boxSizing:"content-box",width:e.dotWidth,height:e.dotHeight,marginInline:a,padding:0,textAlign:"center",textIndent:-999,verticalAlign:"top",transition:`all ${e.motionDurationSlow}`,button:{position:"relative",display:"block",width:"100%",height:e.dotHeight,padding:0,color:"transparent",fontSize:0,background:e.colorBgContainer,border:0,borderRadius:1,outline:"none",cursor:"pointer",opacity:.3,transition:`all ${e.motionDurationSlow}`,"&: hover, &:focus":{opacity:.75},"&::after":{position:"absolute",inset:-a,content:'""'}},"&.slick-active":{width:e.dotWidthActive,"& button":{background:e.colorBgContainer,opacity:1},"&: hover, &:focus":{opacity:1}}}}})}},NJ=e=>{const{componentCls:t,carouselDotOffset:n,marginXXS:o}=e,r={width:e.dotHeight,height:e.dotWidth};return{[`${t}-vertical`]:{".slick-dots":{top:"50%",bottom:"auto",flexDirection:"column",width:e.dotHeight,height:"auto",margin:0,transform:"translateY(-50%)","&-left":{insetInlineEnd:"auto",insetInlineStart:n},"&-right":{insetInlineEnd:n,insetInlineStart:"auto"},li:m(m({},r),{margin:`${o}px 0`,verticalAlign:"baseline",button:r,"&.slick-active":m(m({},r),{button:r})})}}}},kJ=e=>{const{componentCls:t}=e;return[{[`${t}-rtl`]:{direction:"rtl",".slick-dots":{[`${t}-rtl&`]:{flexDirection:"row-reverse"}}}},{[`${t}-vertical`]:{".slick-dots":{[`${t}-rtl&`]:{flexDirection:"column"}}}}]},FJ=Ue("Carousel",e=>{const{controlHeightLG:t,controlHeightSM:n}=e,o=ze(e,{carouselArrowSize:t/2,carouselDotOffset:n/2});return[BJ(o),NJ(o),kJ(o)]},{dotWidth:16,dotHeight:3,dotWidthActive:24});var LJ=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({effect:Ne(),dots:$e(!0),vertical:$e(),autoplay:$e(),easing:String,beforeChange:ve(),afterChange:ve(),prefixCls:String,accessibility:$e(),nextArrow:K.any,prevArrow:K.any,pauseOnHover:$e(),adaptiveHeight:$e(),arrows:$e(!1),autoplaySpeed:Number,centerMode:$e(),centerPadding:String,cssEase:String,dotsClass:String,draggable:$e(!1),fade:$e(),focusOnSelect:$e(),infinite:$e(),initialSlide:Number,lazyLoad:Ne(),rtl:$e(),slide:String,slidesToShow:Number,slidesToScroll:Number,speed:Number,swipe:$e(),swipeToSlide:$e(),swipeEvent:ve(),touchMove:$e(),touchThreshold:Number,variableWidth:$e(),useCSS:$e(),slickGoTo:Number,responsive:Array,dotPosition:Ne(),verticalSwiping:$e(!1)}),HJ=re({compatConfig:{MODE:3},name:"ACarousel",inheritAttrs:!1,props:zJ(),setup(e,t){let{slots:n,attrs:o,expose:r}=t;const i=ne();r({goTo:function(v){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var b;(b=i.value)===null||b===void 0||b.slickGoTo(v,g)},autoplay:v=>{var g,b;(b=(g=i.value)===null||g===void 0?void 0:g.innerSlider)===null||b===void 0||b.handleAutoPlay(v)},prev:()=>{var v;(v=i.value)===null||v===void 0||v.slickPrev()},next:()=>{var v;(v=i.value)===null||v===void 0||v.slickNext()},innerSlider:P(()=>{var v;return(v=i.value)===null||v===void 0?void 0:v.innerSlider})}),Ve(()=>{Po(e.vertical===void 0)});const{prefixCls:a,direction:s}=Ee("carousel",e),[c,u]=FJ(a),d=P(()=>e.dotPosition?e.dotPosition:e.vertical!==void 0&&e.vertical?"right":"bottom"),f=P(()=>d.value==="left"||d.value==="right"),h=P(()=>{const v="slick-dots";return le({[v]:!0,[`${v}-${d.value}`]:!0,[`${e.dotsClass}`]:!!e.dotsClass})});return()=>{const{dots:v,arrows:g,draggable:b,effect:y}=e,{class:S,style:$}=o,w=LJ(o,["class","style"]),C=y==="fade"?!0:e.fade,O=le(a.value,{[`${a.value}-rtl`]:s.value==="rtl",[`${a.value}-vertical`]:f.value,[`${S}`]:!!S},u.value);return c(p("div",{class:O,style:$},[p(DJ,B(B(B({ref:i},e),w),{},{dots:!!v,dotsClass:h.value,arrows:g,draggable:b,fade:C,vertical:f.value}),n)]))}}}),jJ=Bt(HJ),_1="__RC_CASCADER_SPLIT__",cT="SHOW_PARENT",uT="SHOW_CHILD";function Fi(e){return e.join(_1)}function wa(e){return e.map(Fi)}function VJ(e){return e.split(_1)}function WJ(e){const{label:t,value:n,children:o}=e||{},r=n||"value";return{label:t||"label",value:r,key:r,children:o||"children"}}function zs(e,t){var n,o;return(n=e.isLeaf)!==null&&n!==void 0?n:!(!((o=e[t.children])===null||o===void 0)&&o.length)}function KJ(e){const t=e.parentElement;if(!t)return;const n=e.offsetTop-t.offsetTop;n-t.scrollTop<0?t.scrollTo({top:n}):n+e.offsetHeight-t.scrollTop>t.offsetHeight&&t.scrollTo({top:n+e.offsetHeight-t.offsetHeight})}const dT=Symbol("TreeContextKey"),GJ=re({compatConfig:{MODE:3},name:"TreeContext",props:{value:{type:Object}},setup(e,t){let{slots:n}=t;return Ye(dT,P(()=>e.value)),()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}}),M1=()=>Ge(dT,P(()=>({}))),fT=Symbol("KeysStateKey"),UJ=e=>{Ye(fT,e)},pT=()=>Ge(fT,{expandedKeys:oe([]),selectedKeys:oe([]),loadedKeys:oe([]),loadingKeys:oe([]),checkedKeys:oe([]),halfCheckedKeys:oe([]),expandedKeysSet:P(()=>new Set),selectedKeysSet:P(()=>new Set),loadedKeysSet:P(()=>new Set),loadingKeysSet:P(()=>new Set),checkedKeysSet:P(()=>new Set),halfCheckedKeysSet:P(()=>new Set),flattenNodes:oe([])}),XJ=e=>{let{prefixCls:t,level:n,isStart:o,isEnd:r}=e;const i=`${t}-indent-unit`,l=[];for(let a=0;a({prefixCls:String,focusable:{type:Boolean,default:void 0},activeKey:[Number,String],tabindex:Number,children:K.any,treeData:{type:Array},fieldNames:{type:Object},showLine:{type:[Boolean,Object],default:void 0},showIcon:{type:Boolean,default:void 0},icon:K.any,selectable:{type:Boolean,default:void 0},expandAction:[String,Boolean],disabled:{type:Boolean,default:void 0},multiple:{type:Boolean,default:void 0},checkable:{type:Boolean,default:void 0},checkStrictly:{type:Boolean,default:void 0},draggable:{type:[Function,Boolean]},defaultExpandParent:{type:Boolean,default:void 0},autoExpandParent:{type:Boolean,default:void 0},defaultExpandAll:{type:Boolean,default:void 0},defaultExpandedKeys:{type:Array},expandedKeys:{type:Array},defaultCheckedKeys:{type:Array},checkedKeys:{type:[Object,Array]},defaultSelectedKeys:{type:Array},selectedKeys:{type:Array},allowDrop:{type:Function},dropIndicatorRender:{type:Function},onFocus:{type:Function},onBlur:{type:Function},onKeydown:{type:Function},onContextmenu:{type:Function},onClick:{type:Function},onDblclick:{type:Function},onScroll:{type:Function},onExpand:{type:Function},onCheck:{type:Function},onSelect:{type:Function},onLoad:{type:Function},loadData:{type:Function},loadedKeys:{type:Array},onMouseenter:{type:Function},onMouseleave:{type:Function},onRightClick:{type:Function},onDragstart:{type:Function},onDragenter:{type:Function},onDragover:{type:Function},onDragleave:{type:Function},onDragend:{type:Function},onDrop:{type:Function},onActiveChange:{type:Function},filterTreeNode:{type:Function},motion:K.any,switcherIcon:K.any,height:Number,itemHeight:Number,virtual:{type:Boolean,default:void 0},direction:{type:String},rootClassName:String,rootStyle:Object});var qJ=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r"`v-slot:"+fe+"` ")}`;const i=oe(!1),l=M1(),{expandedKeysSet:a,selectedKeysSet:s,loadedKeysSet:c,loadingKeysSet:u,checkedKeysSet:d,halfCheckedKeysSet:f}=pT(),{dragOverNodeKey:h,dropPosition:v,keyEntities:g}=l.value,b=P(()=>Bd(e.eventKey,{expandedKeysSet:a.value,selectedKeysSet:s.value,loadedKeysSet:c.value,loadingKeysSet:u.value,checkedKeysSet:d.value,halfCheckedKeysSet:f.value,dragOverNodeKey:h,dropPosition:v,keyEntities:g})),y=$o(()=>b.value.expanded),S=$o(()=>b.value.selected),$=$o(()=>b.value.checked),w=$o(()=>b.value.loaded),C=$o(()=>b.value.loading),O=$o(()=>b.value.halfChecked),x=$o(()=>b.value.dragOver),I=$o(()=>b.value.dragOverGapTop),T=$o(()=>b.value.dragOverGapBottom),M=$o(()=>b.value.pos),E=oe(),A=P(()=>{const{eventKey:fe}=e,{keyEntities:de}=l.value,{children:be}=de[fe]||{};return!!(be||[]).length}),R=P(()=>{const{isLeaf:fe}=e,{loadData:de}=l.value,be=A.value;return fe===!1?!1:fe||!de&&!be||de&&w.value&&!be}),z=P(()=>R.value?null:y.value?Xw:Yw),_=P(()=>{const{disabled:fe}=e,{disabled:de}=l.value;return!!(de||fe)}),D=P(()=>{const{checkable:fe}=e,{checkable:de}=l.value;return!de||fe===!1?!1:de}),N=P(()=>{const{selectable:fe}=e,{selectable:de}=l.value;return typeof fe=="boolean"?fe:de}),k=P(()=>{const{data:fe,active:de,checkable:be,disableCheckbox:we,disabled:Te,selectable:Re}=e;return m(m({active:de,checkable:be,disableCheckbox:we,disabled:Te,selectable:Re},fe),{dataRef:fe,data:fe,isLeaf:R.value,checked:$.value,expanded:y.value,loading:C.value,selected:S.value,halfChecked:O.value})}),F=On(),L=P(()=>{const{eventKey:fe}=e,{keyEntities:de}=l.value,{parent:be}=de[fe]||{};return m(m({},Nd(m({},e,b.value))),{parent:be})}),H=ft({eventData:L,eventKey:P(()=>e.eventKey),selectHandle:E,pos:M,key:F.vnode.key});r(H);const j=fe=>{const{onNodeDoubleClick:de}=l.value;de(fe,L.value)},Y=fe=>{if(_.value)return;const{onNodeSelect:de}=l.value;fe.preventDefault(),de(fe,L.value)},Z=fe=>{if(_.value)return;const{disableCheckbox:de}=e,{onNodeCheck:be}=l.value;if(!D.value||de)return;fe.preventDefault();const we=!$.value;be(fe,L.value,we)},X=fe=>{const{onNodeClick:de}=l.value;de(fe,L.value),N.value?Y(fe):Z(fe)},ee=fe=>{const{onNodeMouseEnter:de}=l.value;de(fe,L.value)},U=fe=>{const{onNodeMouseLeave:de}=l.value;de(fe,L.value)},Q=fe=>{const{onNodeContextMenu:de}=l.value;de(fe,L.value)},J=fe=>{const{onNodeDragStart:de}=l.value;fe.stopPropagation(),i.value=!0,de(fe,H);try{fe.dataTransfer.setData("text/plain","")}catch{}},G=fe=>{const{onNodeDragEnter:de}=l.value;fe.preventDefault(),fe.stopPropagation(),de(fe,H)},q=fe=>{const{onNodeDragOver:de}=l.value;fe.preventDefault(),fe.stopPropagation(),de(fe,H)},V=fe=>{const{onNodeDragLeave:de}=l.value;fe.stopPropagation(),de(fe,H)},W=fe=>{const{onNodeDragEnd:de}=l.value;fe.stopPropagation(),i.value=!1,de(fe,H)},te=fe=>{const{onNodeDrop:de}=l.value;fe.preventDefault(),fe.stopPropagation(),i.value=!1,de(fe,H)},ue=fe=>{const{onNodeExpand:de}=l.value;C.value||de(fe,L.value)},ie=()=>{const{data:fe}=e,{draggable:de}=l.value;return!!(de&&(!de.nodeDraggable||de.nodeDraggable(fe)))},ae=()=>{const{draggable:fe,prefixCls:de}=l.value;return fe&&(fe!=null&&fe.icon)?p("span",{class:`${de}-draggable-icon`},[fe.icon]):null},ce=()=>{var fe,de,be;const{switcherIcon:we=o.switcherIcon||((fe=l.value.slots)===null||fe===void 0?void 0:fe[(be=(de=e.data)===null||de===void 0?void 0:de.slots)===null||be===void 0?void 0:be.switcherIcon])}=e,{switcherIcon:Te}=l.value,Re=we||Te;return typeof Re=="function"?Re(k.value):Re},se=()=>{const{loadData:fe,onNodeLoad:de}=l.value;C.value||fe&&y.value&&!R.value&&!A.value&&!w.value&&de(L.value)};Ke(()=>{se()}),jn(()=>{se()});const pe=()=>{const{prefixCls:fe}=l.value,de=ce();if(R.value)return de!==!1?p("span",{class:le(`${fe}-switcher`,`${fe}-switcher-noop`)},[de]):null;const be=le(`${fe}-switcher`,`${fe}-switcher_${y.value?Xw:Yw}`);return de!==!1?p("span",{onClick:ue,class:be},[de]):null},he=()=>{var fe,de;const{disableCheckbox:be}=e,{prefixCls:we}=l.value,Te=_.value;return D.value?p("span",{class:le(`${we}-checkbox`,$.value&&`${we}-checkbox-checked`,!$.value&&O.value&&`${we}-checkbox-indeterminate`,(Te||be)&&`${we}-checkbox-disabled`),onClick:Z},[(de=(fe=l.value).customCheckable)===null||de===void 0?void 0:de.call(fe)]):null},ge=()=>{const{prefixCls:fe}=l.value;return p("span",{class:le(`${fe}-iconEle`,`${fe}-icon__${z.value||"docu"}`,C.value&&`${fe}-icon_loading`)},null)},me=()=>{const{disabled:fe,eventKey:de}=e,{draggable:be,dropLevelOffset:we,dropPosition:Te,prefixCls:Re,indent:Se,dropIndicatorRender:Ce,dragOverNodeKey:Pe,direction:Me}=l.value;return!fe&&be!==!1&&Pe===de?Ce({dropPosition:Te,dropLevelOffset:we,indent:Se,prefixCls:Re,direction:Me}):null},xe=()=>{var fe,de,be,we,Te,Re;const{icon:Se=o.icon,data:Ce}=e,Pe=o.title||((fe=l.value.slots)===null||fe===void 0?void 0:fe[(be=(de=e.data)===null||de===void 0?void 0:de.slots)===null||be===void 0?void 0:be.title])||((we=l.value.slots)===null||we===void 0?void 0:we.title)||e.title,{prefixCls:Me,showIcon:De,icon:Ae,loadData:Fe}=l.value,lt=_.value,ht=`${Me}-node-content-wrapper`;let st;if(De){const en=Se||((Te=l.value.slots)===null||Te===void 0?void 0:Te[(Re=Ce==null?void 0:Ce.slots)===null||Re===void 0?void 0:Re.icon])||Ae;st=en?p("span",{class:le(`${Me}-iconEle`,`${Me}-icon__customize`)},[typeof en=="function"?en(k.value):en]):ge()}else Fe&&C.value&&(st=ge());let gt;typeof Pe=="function"?gt=Pe(k.value):gt=Pe,gt=gt===void 0?JJ:gt;const yt=p("span",{class:`${Me}-title`},[gt]);return p("span",{ref:E,title:typeof Pe=="string"?Pe:"",class:le(`${ht}`,`${ht}-${z.value||"normal"}`,!lt&&(S.value||i.value)&&`${Me}-node-selected`),onMouseenter:ee,onMouseleave:U,onContextmenu:Q,onClick:X,onDblclick:j},[st,yt,me()])};return()=>{const fe=m(m({},e),n),{eventKey:de,isLeaf:be,isStart:we,isEnd:Te,domRef:Re,active:Se,data:Ce,onMousemove:Pe,selectable:Me}=fe,De=qJ(fe,["eventKey","isLeaf","isStart","isEnd","domRef","active","data","onMousemove","selectable"]),{prefixCls:Ae,filterTreeNode:Fe,keyEntities:lt,dropContainerKey:ht,dropTargetKey:st,draggingNodeKey:gt}=l.value,yt=_.value,en=Ui(De,{aria:!0,data:!0}),{level:sn}=lt[de]||{},hn=Te[Te.length-1],Gt=ie(),An=!yt&&Gt,no=gt===de,_o=Me!==void 0?{"aria-selected":!!Me}:void 0;return p("div",B(B({ref:Re,class:le(n.class,`${Ae}-treenode`,{[`${Ae}-treenode-disabled`]:yt,[`${Ae}-treenode-switcher-${y.value?"open":"close"}`]:!be,[`${Ae}-treenode-checkbox-checked`]:$.value,[`${Ae}-treenode-checkbox-indeterminate`]:O.value,[`${Ae}-treenode-selected`]:S.value,[`${Ae}-treenode-loading`]:C.value,[`${Ae}-treenode-active`]:Se,[`${Ae}-treenode-leaf-last`]:hn,[`${Ae}-treenode-draggable`]:An,dragging:no,"drop-target":st===de,"drop-container":ht===de,"drag-over":!yt&&x.value,"drag-over-gap-top":!yt&&I.value,"drag-over-gap-bottom":!yt&&T.value,"filter-node":Fe&&Fe(L.value)}),style:n.style,draggable:An,"aria-grabbed":no,onDragstart:An?J:void 0,onDragenter:Gt?G:void 0,onDragover:Gt?q:void 0,onDragleave:Gt?V:void 0,onDrop:Gt?te:void 0,onDragend:Gt?W:void 0,onMousemove:Pe},_o),en),[p(XJ,{prefixCls:Ae,level:sn,isStart:we,isEnd:Te},null),ae(),pe(),he(),xe()])}}});function $r(e,t){if(!e)return[];const n=e.slice(),o=n.indexOf(t);return o>=0&&n.splice(o,1),n}function jr(e,t){const n=(e||[]).slice();return n.indexOf(t)===-1&&n.push(t),n}function A1(e){return e.split("-")}function vT(e,t){return`${e}-${t}`}function ZJ(e){return e&&e.type&&e.type.isTreeNode}function QJ(e,t){const n=[],o=t[e];function r(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(l=>{let{key:a,children:s}=l;n.push(a),r(s)})}return r(o.children),n}function eZ(e){if(e.parent){const t=A1(e.pos);return Number(t[t.length-1])===e.parent.children.length-1}return!1}function tZ(e){const t=A1(e.pos);return Number(t[t.length-1])===0}function qw(e,t,n,o,r,i,l,a,s,c){var u;const{clientX:d,clientY:f}=e,{top:h,height:v}=e.target.getBoundingClientRect(),b=((c==="rtl"?-1:1)*(((r==null?void 0:r.x)||0)-d)-12)/o;let y=a[n.eventKey];if(fR.key===y.key),E=M<=0?0:M-1,A=l[E].key;y=a[A]}const S=y.key,$=y,w=y.key;let C=0,O=0;if(!s.has(S))for(let M=0;M-1.5?i({dragNode:x,dropNode:I,dropPosition:1})?C=1:T=!1:i({dragNode:x,dropNode:I,dropPosition:0})?C=0:i({dragNode:x,dropNode:I,dropPosition:1})?C=1:T=!1:i({dragNode:x,dropNode:I,dropPosition:1})?C=1:T=!1,{dropPosition:C,dropLevelOffset:O,dropTargetKey:y.key,dropTargetPos:y.pos,dragOverNodeKey:w,dropContainerKey:C===0?null:((u=y.parent)===null||u===void 0?void 0:u.key)||null,dropAllowed:T}}function Jw(e,t){if(!e)return;const{multiple:n}=t;return n?e.slice():e.length?[e[0]]:e}function Pv(e){if(!e)return null;let t;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else if(typeof e=="object")t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0};else return null;return t}function p0(e,t){const n=new Set;function o(r){if(n.has(r))return;const i=t[r];if(!i)return;n.add(r);const{parent:l,node:a}=i;a.disabled||l&&o(l.key)}return(e||[]).forEach(r=>{o(r)}),[...n]}var nZ=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r0&&arguments[0]!==void 0?arguments[0]:[];return kt(n).map(r=>{var i,l,a,s;if(!ZJ(r))return null;const c=r.children||{},u=r.key,d={};for(const[M,E]of Object.entries(r.props))d[rs(M)]=E;const{isLeaf:f,checkable:h,selectable:v,disabled:g,disableCheckbox:b}=d,y={isLeaf:f||f===""||void 0,checkable:h||h===""||void 0,selectable:v||v===""||void 0,disabled:g||g===""||void 0,disableCheckbox:b||b===""||void 0},S=m(m({},d),y),{title:$=(i=c.title)===null||i===void 0?void 0:i.call(c,S),icon:w=(l=c.icon)===null||l===void 0?void 0:l.call(c,S),switcherIcon:C=(a=c.switcherIcon)===null||a===void 0?void 0:a.call(c,S)}=d,O=nZ(d,["title","icon","switcherIcon"]),x=(s=c.default)===null||s===void 0?void 0:s.call(c),I=m(m(m({},O),{title:$,icon:w,switcherIcon:C,key:u,isLeaf:f}),y),T=t(x);return T.length&&(I.children=T),I})}return t(e)}function oZ(e,t,n){const{_title:o,key:r,children:i}=Eh(n),l=new Set(t===!0?[]:t),a=[];function s(c){let u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return c.map((d,f)=>{const h=vT(u?u.pos:"0",f),v=uu(d[r],h);let g;for(let y=0;yf[i]:typeof i=="function"&&(u=f=>i(f)):u=(f,h)=>uu(f[a],h);function d(f,h,v,g){const b=f?f[c]:e,y=f?vT(v.pos,h):"0",S=f?[...g,f]:[];if(f){const $=u(f,y),w={node:f,index:h,pos:y,key:$,parentPos:v.node?v.pos:null,level:v.level+1,nodes:S};t(w)}b&&b.forEach(($,w)=>{d($,w,{node:f,pos:y,level:v?v.level+1:-1},S)})}d(null)}function du(e){let{initWrapper:t,processEntity:n,onProcessFinished:o,externalGetKey:r,childrenPropName:i,fieldNames:l}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;const s=r||a,c={},u={};let d={posEntities:c,keyEntities:u};return t&&(d=t(d)||d),rZ(e,f=>{const{node:h,index:v,pos:g,key:b,parentPos:y,level:S,nodes:$}=f,w={node:h,nodes:$,index:v,key:b,pos:g,level:S},C=uu(b,g);c[g]=w,u[C]=w,w.parent=c[y],w.parent&&(w.parent.children=w.parent.children||[],w.parent.children.push(w)),n&&n(w,d)},{externalGetKey:s,childrenPropName:i,fieldNames:l}),o&&o(d),d}function Bd(e,t){let{expandedKeysSet:n,selectedKeysSet:o,loadedKeysSet:r,loadingKeysSet:i,checkedKeysSet:l,halfCheckedKeysSet:a,dragOverNodeKey:s,dropPosition:c,keyEntities:u}=t;const d=u[e];return{eventKey:e,expanded:n.has(e),selected:o.has(e),loaded:r.has(e),loading:i.has(e),checked:l.has(e),halfChecked:a.has(e),pos:String(d?d.pos:""),parent:d.parent,dragOver:s===e&&c===0,dragOverGapTop:s===e&&c===-1,dragOverGapBottom:s===e&&c===1}}function Nd(e){const{data:t,expanded:n,selected:o,checked:r,loaded:i,loading:l,halfChecked:a,dragOver:s,dragOverGapTop:c,dragOverGapBottom:u,pos:d,active:f,eventKey:h}=e,v=m(m({dataRef:t},t),{expanded:n,selected:o,checked:r,loaded:i,loading:l,halfChecked:a,dragOver:s,dragOverGapTop:c,dragOverGapBottom:u,pos:d,active:f,eventKey:h,key:h});return"props"in v||Object.defineProperty(v,"props",{get(){return e}}),v}const iZ=(e,t)=>P(()=>du(e.value,{fieldNames:t.value,initWrapper:o=>m(m({},o),{pathKeyEntities:{}}),processEntity:(o,r)=>{const i=o.nodes.map(l=>l[t.value.value]).join(_1);r.pathKeyEntities[i]=o,o.key=i}}).pathKeyEntities);function lZ(e){const t=oe(!1),n=ne({});return Ve(()=>{if(!e.value){t.value=!1,n.value={};return}let o={matchInputWidth:!0,limit:50};e.value&&typeof e.value=="object"&&(o=m(m({},o),e.value)),o.limit<=0&&delete o.limit,t.value=!0,n.value=o}),{showSearch:t,searchConfig:n}}const lc="__rc_cascader_search_mark__",aZ=(e,t,n)=>{let{label:o}=n;return t.some(r=>String(r[o]).toLowerCase().includes(e.toLowerCase()))},sZ=e=>{let{path:t,fieldNames:n}=e;return t.map(o=>o[n.label]).join(" / ")},cZ=(e,t,n,o,r,i)=>P(()=>{const{filter:l=aZ,render:a=sZ,limit:s=50,sort:c}=r.value,u=[];if(!e.value)return[];function d(f,h){f.forEach(v=>{if(!c&&s>0&&u.length>=s)return;const g=[...h,v],b=v[n.value.children];(!b||b.length===0||i.value)&&l(e.value,g,{label:n.value.label})&&u.push(m(m({},v),{[n.value.label]:a({inputValue:e.value,path:g,prefixCls:o.value,fieldNames:n.value}),[lc]:g})),b&&d(v[n.value.children],g)})}return d(t.value,[]),c&&u.sort((f,h)=>c(f[lc],h[lc],e.value,n.value)),s>0?u.slice(0,s):u});function Zw(e,t,n){const o=new Set(e);return e.filter(r=>{const i=t[r],l=i?i.parent:null,a=i?i.children:null;return n===uT?!(a&&a.some(s=>s.key&&o.has(s.key))):!(l&&!l.node.disabled&&o.has(l.key))})}function zc(e,t,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;var r;let i=t;const l=[];for(let a=0;a{const f=d[n.value];return o?String(f)===String(s):f===s}),u=c!==-1?i==null?void 0:i[c]:null;l.push({value:(r=u==null?void 0:u[n.value])!==null&&r!==void 0?r:s,index:c,option:u}),i=u==null?void 0:u[n.children]}return l}const uZ=(e,t,n)=>P(()=>{const o=[],r=[];return n.value.forEach(i=>{zc(i,e.value,t.value).every(a=>a.option)?r.push(i):o.push(i)}),[r,o]});function mT(e,t){const n=new Set;return e.forEach(o=>{t.has(o)||n.add(o)}),n}function dZ(e){const{disabled:t,disableCheckbox:n,checkable:o}=e||{};return!!(t||n)||o===!1}function fZ(e,t,n,o){const r=new Set(e),i=new Set;for(let a=0;a<=n;a+=1)(t.get(a)||new Set).forEach(c=>{const{key:u,node:d,children:f=[]}=c;r.has(u)&&!o(d)&&f.filter(h=>!o(h.node)).forEach(h=>{r.add(h.key)})});const l=new Set;for(let a=n;a>=0;a-=1)(t.get(a)||new Set).forEach(c=>{const{parent:u,node:d}=c;if(o(d)||!c.parent||l.has(c.parent.key))return;if(o(c.parent.node)){l.add(u.key);return}let f=!0,h=!1;(u.children||[]).filter(v=>!o(v.node)).forEach(v=>{let{key:g}=v;const b=r.has(g);f&&!b&&(f=!1),!h&&(b||i.has(g))&&(h=!0)}),f&&r.add(u.key),h&&i.add(u.key),l.add(u.key)});return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(mT(i,r))}}function pZ(e,t,n,o,r){const i=new Set(e);let l=new Set(t);for(let s=0;s<=o;s+=1)(n.get(s)||new Set).forEach(u=>{const{key:d,node:f,children:h=[]}=u;!i.has(d)&&!l.has(d)&&!r(f)&&h.filter(v=>!r(v.node)).forEach(v=>{i.delete(v.key)})});l=new Set;const a=new Set;for(let s=o;s>=0;s-=1)(n.get(s)||new Set).forEach(u=>{const{parent:d,node:f}=u;if(r(f)||!u.parent||a.has(u.parent.key))return;if(r(u.parent.node)){a.add(d.key);return}let h=!0,v=!1;(d.children||[]).filter(g=>!r(g.node)).forEach(g=>{let{key:b}=g;const y=i.has(b);h&&!y&&(h=!1),!v&&(y||l.has(b))&&(v=!0)}),h||i.delete(d.key),v&&l.add(d.key),a.add(d.key)});return{checkedKeys:Array.from(i),halfCheckedKeys:Array.from(mT(l,i))}}function Ho(e,t,n,o,r,i){let l;i?l=i:l=dZ;const a=new Set(e.filter(c=>!!n[c]));let s;return t===!0?s=fZ(a,r,o,l):s=pZ(a,t.halfCheckedKeys,r,o,l),s}const hZ=(e,t,n,o,r)=>P(()=>{const i=r.value||(l=>{let{labels:a}=l;const s=o.value?a.slice(-1):a,c=" / ";return s.every(u=>["string","number"].includes(typeof u))?s.join(c):s.reduce((u,d,f)=>{const h=qt(d)?pt(d,{key:f}):d;return f===0?[h]:[...u,c,h]},[])});return e.value.map(l=>{const a=zc(l,t.value,n.value),s=i({labels:a.map(u=>{let{option:d,value:f}=u;var h;return(h=d==null?void 0:d[n.value.label])!==null&&h!==void 0?h:f}),selectedOptions:a.map(u=>{let{option:d}=u;return d})}),c=Fi(l);return{label:s,value:c,key:c,valueCells:l}})}),bT=Symbol("CascaderContextKey"),gZ=e=>{Ye(bT,e)},_h=()=>Ge(bT),vZ=()=>{const e=Qc(),{values:t}=_h(),[n,o]=St([]);return ye(()=>e.open,()=>{if(e.open&&!e.multiple){const r=t.value[0];o(r||[])}},{immediate:!0}),[n,o]},mZ=(e,t,n,o,r,i)=>{const l=Qc(),a=P(()=>l.direction==="rtl"),[s,c,u]=[ne([]),ne(),ne([])];Ve(()=>{let g=-1,b=t.value;const y=[],S=[],$=o.value.length;for(let C=0;C<$&&b;C+=1){const O=b.findIndex(x=>x[n.value.value]===o.value[C]);if(O===-1)break;g=O,y.push(g),S.push(o.value[C]),b=b[g][n.value.children]}let w=t.value;for(let C=0;C{r(g)},f=g=>{const b=u.value.length;let y=c.value;y===-1&&g<0&&(y=b);for(let S=0;S{if(s.value.length>1){const g=s.value.slice(0,-1);d(g)}else l.toggleOpen(!1)},v=()=>{var g;const y=(((g=u.value[c.value])===null||g===void 0?void 0:g[n.value.children])||[]).find(S=>!S.disabled);if(y){const S=[...s.value,y[n.value.value]];d(S)}};e.expose({onKeydown:g=>{const{which:b}=g;switch(b){case Ie.UP:case Ie.DOWN:{let y=0;b===Ie.UP?y=-1:b===Ie.DOWN&&(y=1),y!==0&&f(y);break}case Ie.LEFT:{a.value?v():h();break}case Ie.RIGHT:{a.value?h():v();break}case Ie.BACKSPACE:{l.searchValue||h();break}case Ie.ENTER:{if(s.value.length){const y=u.value[c.value],S=(y==null?void 0:y[lc])||[];S.length?i(S.map($=>$[n.value.value]),S[S.length-1]):i(s.value,y)}break}case Ie.ESC:l.toggleOpen(!1),open&&g.stopPropagation()}},onKeyup:()=>{}})};function Mh(e){let{prefixCls:t,checked:n,halfChecked:o,disabled:r,onClick:i}=e;const{customSlots:l,checkable:a}=_h(),s=a.value!==!1?l.value.checkable:a.value,c=typeof s=="function"?s():typeof s=="boolean"?null:s;return p("span",{class:{[t]:!0,[`${t}-checked`]:n,[`${t}-indeterminate`]:!n&&o,[`${t}-disabled`]:r},onClick:i},[c])}Mh.props=["prefixCls","checked","halfChecked","disabled","onClick"];Mh.displayName="Checkbox";Mh.inheritAttrs=!1;const yT="__cascader_fix_label__";function Ah(e){let{prefixCls:t,multiple:n,options:o,activeValue:r,prevValuePath:i,onToggleOpen:l,onSelect:a,onActive:s,checkedSet:c,halfCheckedSet:u,loadingKeys:d,isSelectable:f}=e;var h,v,g,b,y,S;const $=`${t}-menu`,w=`${t}-menu-item`,{fieldNames:C,changeOnSelect:O,expandTrigger:x,expandIcon:I,loadingIcon:T,dropdownMenuColumnStyle:M,customSlots:E}=_h(),A=(h=I.value)!==null&&h!==void 0?h:(g=(v=E.value).expandIcon)===null||g===void 0?void 0:g.call(v),R=(b=T.value)!==null&&b!==void 0?b:(S=(y=E.value).loadingIcon)===null||S===void 0?void 0:S.call(y),z=x.value==="hover";return p("ul",{class:$,role:"menu"},[o.map(_=>{var D;const{disabled:N}=_,k=_[lc],F=(D=_[yT])!==null&&D!==void 0?D:_[C.value.label],L=_[C.value.value],H=zs(_,C.value),j=k?k.map(G=>G[C.value.value]):[...i,L],Y=Fi(j),Z=d.includes(Y),X=c.has(Y),ee=u.has(Y),U=()=>{!N&&(!z||!H)&&s(j)},Q=()=>{f(_)&&a(j,H)};let J;return typeof _.title=="string"?J=_.title:typeof F=="string"&&(J=F),p("li",{key:Y,class:[w,{[`${w}-expand`]:!H,[`${w}-active`]:r===L,[`${w}-disabled`]:N,[`${w}-loading`]:Z}],style:M.value,role:"menuitemcheckbox",title:J,"aria-checked":X,"data-path-key":Y,onClick:()=>{U(),(!n||H)&&Q()},onDblclick:()=>{O.value&&l(!1)},onMouseenter:()=>{z&&U()},onMousedown:G=>{G.preventDefault()}},[n&&p(Mh,{prefixCls:`${t}-checkbox`,checked:X,halfChecked:ee,disabled:N,onClick:G=>{G.stopPropagation(),Q()}},null),p("div",{class:`${w}-content`},[F]),!Z&&A&&!H&&p("div",{class:`${w}-expand-icon`},[pt(A)]),Z&&R&&p("div",{class:`${w}-loading-icon`},[pt(R)])])})])}Ah.props=["prefixCls","multiple","options","activeValue","prevValuePath","onToggleOpen","onSelect","onActive","checkedSet","halfCheckedSet","loadingKeys","isSelectable"];Ah.displayName="Column";Ah.inheritAttrs=!1;const bZ=re({compatConfig:{MODE:3},name:"OptionList",inheritAttrs:!1,setup(e,t){const{attrs:n,slots:o}=t,r=Qc(),i=ne(),l=P(()=>r.direction==="rtl"),{options:a,values:s,halfValues:c,fieldNames:u,changeOnSelect:d,onSelect:f,searchOptions:h,dropdownPrefixCls:v,loadData:g,expandTrigger:b,customSlots:y}=_h(),S=P(()=>v.value||r.prefixCls),$=oe([]),w=D=>{if(!g.value||r.searchValue)return;const k=zc(D,a.value,u.value).map(L=>{let{option:H}=L;return H}),F=k[k.length-1];if(F&&!zs(F,u.value)){const L=Fi(D);$.value=[...$.value,L],g.value(k)}};Ve(()=>{$.value.length&&$.value.forEach(D=>{const N=VJ(D),k=zc(N,a.value,u.value,!0).map(L=>{let{option:H}=L;return H}),F=k[k.length-1];(!F||F[u.value.children]||zs(F,u.value))&&($.value=$.value.filter(L=>L!==D))})});const C=P(()=>new Set(wa(s.value))),O=P(()=>new Set(wa(c.value))),[x,I]=vZ(),T=D=>{I(D),w(D)},M=D=>{const{disabled:N}=D,k=zs(D,u.value);return!N&&(k||d.value||r.multiple)},E=function(D,N){let k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;f(D),!r.multiple&&(N||d.value&&(b.value==="hover"||k))&&r.toggleOpen(!1)},A=P(()=>r.searchValue?h.value:a.value),R=P(()=>{const D=[{options:A.value}];let N=A.value;for(let k=0;kj[u.value.value]===F),H=L==null?void 0:L[u.value.children];if(!(H!=null&&H.length))break;N=H,D.push({options:H})}return D});mZ(t,A,u,x,T,(D,N)=>{M(N)&&E(D,zs(N,u.value),!0)});const _=D=>{D.preventDefault()};return Ke(()=>{ye(x,D=>{var N;for(let k=0;k{var D,N,k,F,L;const{notFoundContent:H=((D=o.notFoundContent)===null||D===void 0?void 0:D.call(o))||((k=(N=y.value).notFoundContent)===null||k===void 0?void 0:k.call(N)),multiple:j,toggleOpen:Y}=r,Z=!(!((L=(F=R.value[0])===null||F===void 0?void 0:F.options)===null||L===void 0)&&L.length),X=[{[u.value.value]:"__EMPTY__",[yT]:H,disabled:!0}],ee=m(m({},n),{multiple:!Z&&j,onSelect:E,onActive:T,onToggleOpen:Y,checkedSet:C.value,halfCheckedSet:O.value,loadingKeys:$.value,isSelectable:M}),Q=(Z?[{options:X}]:R.value).map((J,G)=>{const q=x.value.slice(0,G),V=x.value[G];return p(Ah,B(B({key:G},ee),{},{prefixCls:S.value,options:J.options,prevValuePath:q,activeValue:V}),null)});return p("div",{class:[`${S.value}-menus`,{[`${S.value}-menu-empty`]:Z,[`${S.value}-rtl`]:l.value}],onMousedown:_,ref:i},[Q])}}});function Rh(e){const t=ne(0),n=oe();return Ve(()=>{const o=new Map;let r=0;const i=e.value||{};for(const l in i)if(Object.prototype.hasOwnProperty.call(i,l)){const a=i[l],{level:s}=a;let c=o.get(s);c||(c=new Set,o.set(s,c)),c.add(a),r=Math.max(r,s)}t.value=r,n.value=o}),{maxLevel:t,levelEntities:n}}function yZ(){return m(m({},ot(lh(),["tokenSeparators","mode","showSearch"])),{id:String,prefixCls:String,fieldNames:Be(),children:Array,value:{type:[String,Number,Array]},defaultValue:{type:[String,Number,Array]},changeOnSelect:{type:Boolean,default:void 0},displayRender:Function,checkable:{type:Boolean,default:void 0},showCheckedStrategy:{type:String,default:cT},showSearch:{type:[Boolean,Object],default:void 0},searchValue:String,onSearch:Function,expandTrigger:String,options:Array,dropdownPrefixCls:String,loadData:Function,popupVisible:{type:Boolean,default:void 0},dropdownClassName:String,dropdownMenuColumnStyle:{type:Object,default:void 0},popupStyle:{type:Object,default:void 0},dropdownStyle:{type:Object,default:void 0},popupPlacement:String,placement:String,onPopupVisibleChange:Function,onDropdownVisibleChange:Function,expandIcon:K.any,loadingIcon:K.any})}function ST(){return m(m({},yZ()),{onChange:Function,customSlots:Object})}function SZ(e){return Array.isArray(e)&&Array.isArray(e[0])}function Qw(e){return e?SZ(e)?e:(e.length===0?[]:[e]).map(t=>Array.isArray(t)?t:[t]):[]}const $Z=re({compatConfig:{MODE:3},name:"Cascader",inheritAttrs:!1,props:Qe(ST(),{}),setup(e,t){let{attrs:n,expose:o,slots:r}=t;const i=vy(We(e,"id")),l=P(()=>!!e.checkable),[a,s]=Dt(e.defaultValue,{value:P(()=>e.value),postState:Qw}),c=P(()=>WJ(e.fieldNames)),u=P(()=>e.options||[]),d=iZ(u,c),f=G=>{const q=d.value;return G.map(V=>{const{nodes:W}=q[V];return W.map(te=>te[c.value.value])})},[h,v]=Dt("",{value:P(()=>e.searchValue),postState:G=>G||""}),g=(G,q)=>{v(G),q.source!=="blur"&&e.onSearch&&e.onSearch(G)},{showSearch:b,searchConfig:y}=lZ(We(e,"showSearch")),S=cZ(h,u,c,P(()=>e.dropdownPrefixCls||e.prefixCls),y,We(e,"changeOnSelect")),$=uZ(u,c,a),[w,C,O]=[ne([]),ne([]),ne([])],{maxLevel:x,levelEntities:I}=Rh(d);Ve(()=>{const[G,q]=$.value;if(!l.value||!a.value.length){[w.value,C.value,O.value]=[G,[],q];return}const V=wa(G),W=d.value,{checkedKeys:te,halfCheckedKeys:ue}=Ho(V,!0,W,x.value,I.value);[w.value,C.value,O.value]=[f(te),f(ue),q]});const T=P(()=>{const G=wa(w.value),q=Zw(G,d.value,e.showCheckedStrategy);return[...O.value,...f(q)]}),M=hZ(T,u,c,l,We(e,"displayRender")),E=G=>{if(s(G),e.onChange){const q=Qw(G),V=q.map(ue=>zc(ue,u.value,c.value).map(ie=>ie.option)),W=l.value?q:q[0],te=l.value?V:V[0];e.onChange(W,te)}},A=G=>{if(v(""),!l.value)E(G);else{const q=Fi(G),V=wa(w.value),W=wa(C.value),te=V.includes(q),ue=O.value.some(ce=>Fi(ce)===q);let ie=w.value,ae=O.value;if(ue&&!te)ae=O.value.filter(ce=>Fi(ce)!==q);else{const ce=te?V.filter(he=>he!==q):[...V,q];let se;te?{checkedKeys:se}=Ho(ce,{halfCheckedKeys:W},d.value,x.value,I.value):{checkedKeys:se}=Ho(ce,!0,d.value,x.value,I.value);const pe=Zw(se,d.value,e.showCheckedStrategy);ie=f(pe)}E([...ae,...ie])}},R=(G,q)=>{if(q.type==="clear"){E([]);return}const{valueCells:V}=q.values[0];A(V)},z=P(()=>e.open!==void 0?e.open:e.popupVisible),_=P(()=>e.dropdownStyle||e.popupStyle||{}),D=P(()=>e.placement||e.popupPlacement),N=G=>{var q,V;(q=e.onDropdownVisibleChange)===null||q===void 0||q.call(e,G),(V=e.onPopupVisibleChange)===null||V===void 0||V.call(e,G)},{changeOnSelect:k,checkable:F,dropdownPrefixCls:L,loadData:H,expandTrigger:j,expandIcon:Y,loadingIcon:Z,dropdownMenuColumnStyle:X,customSlots:ee,dropdownClassName:U}=nr(e);gZ({options:u,fieldNames:c,values:w,halfValues:C,changeOnSelect:k,onSelect:A,checkable:F,searchOptions:S,dropdownPrefixCls:L,loadData:H,expandTrigger:j,expandIcon:Y,loadingIcon:Z,dropdownMenuColumnStyle:X,customSlots:ee});const Q=ne();o({focus(){var G;(G=Q.value)===null||G===void 0||G.focus()},blur(){var G;(G=Q.value)===null||G===void 0||G.blur()},scrollTo(G){var q;(q=Q.value)===null||q===void 0||q.scrollTo(G)}});const J=P(()=>ot(e,["id","prefixCls","fieldNames","defaultValue","value","changeOnSelect","onChange","displayRender","checkable","searchValue","onSearch","showSearch","expandTrigger","options","dropdownPrefixCls","loadData","popupVisible","open","dropdownClassName","dropdownMenuColumnStyle","popupPlacement","placement","onDropdownVisibleChange","onPopupVisibleChange","expandIcon","loadingIcon","customSlots","showCheckedStrategy","children"]));return()=>{const G=!(h.value?S.value:u.value).length,{dropdownMatchSelectWidth:q=!1}=e,V=h.value&&y.value.matchInputWidth||G?{}:{minWidth:"auto"};return p(hy,B(B(B({},J.value),n),{},{ref:Q,id:i,prefixCls:e.prefixCls,dropdownMatchSelectWidth:q,dropdownStyle:m(m({},_.value),V),displayValues:M.value,onDisplayValuesChange:R,mode:l.value?"multiple":void 0,searchValue:h.value,onSearch:g,showSearch:b.value,OptionList:bZ,emptyOptions:G,open:z.value,dropdownClassName:U.value,placement:D.value,onDropdownVisibleChange:N,getRawInputElement:()=>{var W;return(W=r.default)===null||W===void 0?void 0:W.call(r)}}),r)}}});var CZ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"};function e2(e){for(var t=1;tzn()&&window.document.documentElement,CT=e=>{if(zn()&&window.document.documentElement){const t=Array.isArray(e)?e:[e],{documentElement:n}=window.document;return t.some(o=>o in n.style)}return!1},wZ=(e,t)=>{if(!CT(e))return!1;const n=document.createElement("div"),o=n.style[e];return n.style[e]=t,n.style[e]!==o};function R1(e,t){return!Array.isArray(e)&&t!==void 0?wZ(e,t):CT(e)}let Zu;const OZ=()=>{if(!$T())return!1;if(Zu!==void 0)return Zu;const e=document.createElement("div");return e.style.display="flex",e.style.flexDirection="column",e.style.rowGap="1px",e.appendChild(document.createElement("div")),e.appendChild(document.createElement("div")),document.body.appendChild(e),Zu=e.scrollHeight===1,document.body.removeChild(e),Zu},xT=()=>{const e=oe(!1);return Ke(()=>{e.value=OZ()}),e},wT=Symbol("rowContextKey"),PZ=e=>{Ye(wT,e)},IZ=()=>Ge(wT,{gutter:P(()=>{}),wrap:P(()=>{}),supportFlexGap:P(()=>{})}),TZ=e=>{const{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around ":{justifyContent:"space-around"},"&-space-evenly ":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},EZ=e=>{const{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},_Z=(e,t)=>{const{componentCls:n,gridColumns:o}=e,r={};for(let i=o;i>=0;i--)i===0?(r[`${n}${t}-${i}`]={display:"none"},r[`${n}-push-${i}`]={insetInlineStart:"auto"},r[`${n}-pull-${i}`]={insetInlineEnd:"auto"},r[`${n}${t}-push-${i}`]={insetInlineStart:"auto"},r[`${n}${t}-pull-${i}`]={insetInlineEnd:"auto"},r[`${n}${t}-offset-${i}`]={marginInlineEnd:0},r[`${n}${t}-order-${i}`]={order:0}):(r[`${n}${t}-${i}`]={display:"block",flex:`0 0 ${i/o*100}%`,maxWidth:`${i/o*100}%`},r[`${n}${t}-push-${i}`]={insetInlineStart:`${i/o*100}%`},r[`${n}${t}-pull-${i}`]={insetInlineEnd:`${i/o*100}%`},r[`${n}${t}-offset-${i}`]={marginInlineStart:`${i/o*100}%`},r[`${n}${t}-order-${i}`]={order:i});return r},g0=(e,t)=>_Z(e,t),MZ=(e,t,n)=>({[`@media (min-width: ${t}px)`]:m({},g0(e,n))}),AZ=Ue("Grid",e=>[TZ(e)]),RZ=Ue("Grid",e=>{const t=ze(e,{gridColumns:24}),n={"-sm":t.screenSMMin,"-md":t.screenMDMin,"-lg":t.screenLGMin,"-xl":t.screenXLMin,"-xxl":t.screenXXLMin};return[EZ(t),g0(t,""),g0(t,"-xs"),Object.keys(n).map(o=>MZ(t,n[o],o)).reduce((o,r)=>m(m({},o),r),{})]}),DZ=()=>({align:He([String,Object]),justify:He([String,Object]),prefixCls:String,gutter:He([Number,Array,Object],0),wrap:{type:Boolean,default:void 0}}),D1=re({compatConfig:{MODE:3},name:"ARow",inheritAttrs:!1,props:DZ(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("row",e),[l,a]=AZ(r);let s;const c=ky(),u=ne({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),d=ne({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),f=$=>P(()=>{if(typeof e[$]=="string")return e[$];if(typeof e[$]!="object")return"";for(let w=0;w{s=c.value.subscribe($=>{d.value=$;const w=e.gutter||0;(!Array.isArray(w)&&typeof w=="object"||Array.isArray(w)&&(typeof w[0]=="object"||typeof w[1]=="object"))&&(u.value=$)})}),et(()=>{c.value.unsubscribe(s)});const b=P(()=>{const $=[void 0,void 0],{gutter:w=0}=e;return(Array.isArray(w)?w:[w,void 0]).forEach((O,x)=>{if(typeof O=="object")for(let I=0;Ie.wrap)});const y=P(()=>le(r.value,{[`${r.value}-no-wrap`]:e.wrap===!1,[`${r.value}-${v.value}`]:v.value,[`${r.value}-${h.value}`]:h.value,[`${r.value}-rtl`]:i.value==="rtl"},o.class,a.value)),S=P(()=>{const $=b.value,w={},C=$[0]!=null&&$[0]>0?`${$[0]/-2}px`:void 0,O=$[1]!=null&&$[1]>0?`${$[1]/-2}px`:void 0;return C&&(w.marginLeft=C,w.marginRight=C),g.value?w.rowGap=`${$[1]}px`:O&&(w.marginTop=O,w.marginBottom=O),w});return()=>{var $;return l(p("div",B(B({},o),{},{class:y.value,style:m(m({},S.value),o.style)}),[($=n.default)===null||$===void 0?void 0:$.call(n)]))}}});function Sl(){return Sl=Object.assign?Object.assign.bind():function(e){for(var t=1;t"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 kd(e,t,n){return NZ()?kd=Reflect.construct.bind():kd=function(r,i,l){var a=[null];a.push.apply(a,i);var s=Function.bind.apply(r,a),c=new s;return l&&Hc(c,l.prototype),c},kd.apply(null,arguments)}function kZ(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function m0(e){var t=typeof Map=="function"?new Map:void 0;return m0=function(o){if(o===null||!kZ(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(o))return t.get(o);t.set(o,r)}function r(){return kd(o,arguments,v0(this).constructor)}return r.prototype=Object.create(o.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Hc(r,o)},m0(e)}var FZ=/%[sdj%]/g,LZ=function(){};function b0(e){if(!e||!e.length)return null;var t={};return e.forEach(function(n){var o=n.field;t[o]=t[o]||[],t[o].push(n)}),t}function xo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o=i)return a;switch(a){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}break;default:return a}});return l}return e}function zZ(e){return e==="string"||e==="url"||e==="hex"||e==="email"||e==="date"||e==="pattern"}function Sn(e,t){return!!(e==null||t==="array"&&Array.isArray(e)&&!e.length||zZ(t)&&typeof e=="string"&&!e)}function HZ(e,t,n){var o=[],r=0,i=e.length;function l(a){o.push.apply(o,a||[]),r++,r===i&&n(o)}e.forEach(function(a){t(a,l)})}function t2(e,t,n){var o=0,r=e.length;function i(l){if(l&&l.length){n(l);return}var a=o;o=o+1,a()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},Hs={integer:function(t){return Hs.number(t)&&parseInt(t,10)===t},float:function(t){return Hs.number(t)&&!Hs.integer(t)},array:function(t){return Array.isArray(t)},regexp:function(t){if(t instanceof RegExp)return!0;try{return!!new RegExp(t)}catch{return!1}},date:function(t){return typeof t.getTime=="function"&&typeof t.getMonth=="function"&&typeof t.getYear=="function"&&!isNaN(t.getTime())},number:function(t){return isNaN(t)?!1:typeof t=="number"},object:function(t){return typeof t=="object"&&!Hs.array(t)},method:function(t){return typeof t=="function"},email:function(t){return typeof t=="string"&&t.length<=320&&!!t.match(i2.email)},url:function(t){return typeof t=="string"&&t.length<=2048&&!!t.match(UZ())},hex:function(t){return typeof t=="string"&&!!t.match(i2.hex)}},XZ=function(t,n,o,r,i){if(t.required&&n===void 0){OT(t,n,o,r,i);return}var l=["integer","float","array","regexp","object","method","email","number","date","url","hex"],a=t.type;l.indexOf(a)>-1?Hs[a](n)||r.push(xo(i.messages.types[a],t.fullField,t.type)):a&&typeof n!==t.type&&r.push(xo(i.messages.types[a],t.fullField,t.type))},YZ=function(t,n,o,r,i){var l=typeof t.len=="number",a=typeof t.min=="number",s=typeof t.max=="number",c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,u=n,d=null,f=typeof n=="number",h=typeof n=="string",v=Array.isArray(n);if(f?d="number":h?d="string":v&&(d="array"),!d)return!1;v&&(u=n.length),h&&(u=n.replace(c,"_").length),l?u!==t.len&&r.push(xo(i.messages[d].len,t.fullField,t.len)):a&&!s&&ut.max?r.push(xo(i.messages[d].max,t.fullField,t.max)):a&&s&&(ut.max)&&r.push(xo(i.messages[d].range,t.fullField,t.min,t.max))},da="enum",qZ=function(t,n,o,r,i){t[da]=Array.isArray(t[da])?t[da]:[],t[da].indexOf(n)===-1&&r.push(xo(i.messages[da],t.fullField,t[da].join(", ")))},JZ=function(t,n,o,r,i){if(t.pattern){if(t.pattern instanceof RegExp)t.pattern.lastIndex=0,t.pattern.test(n)||r.push(xo(i.messages.pattern.mismatch,t.fullField,n,t.pattern));else if(typeof t.pattern=="string"){var l=new RegExp(t.pattern);l.test(n)||r.push(xo(i.messages.pattern.mismatch,t.fullField,n,t.pattern))}}},xt={required:OT,whitespace:GZ,type:XZ,range:YZ,enum:qZ,pattern:JZ},ZZ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n,"string")&&!t.required)return o();xt.required(t,n,r,l,i,"string"),Sn(n,"string")||(xt.type(t,n,r,l,i),xt.range(t,n,r,l,i),xt.pattern(t,n,r,l,i),t.whitespace===!0&&xt.whitespace(t,n,r,l,i))}o(l)},QZ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i),n!==void 0&&xt.type(t,n,r,l,i)}o(l)},eQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(n===""&&(n=void 0),Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i),n!==void 0&&(xt.type(t,n,r,l,i),xt.range(t,n,r,l,i))}o(l)},tQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i),n!==void 0&&xt.type(t,n,r,l,i)}o(l)},nQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i),Sn(n)||xt.type(t,n,r,l,i)}o(l)},oQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i),n!==void 0&&(xt.type(t,n,r,l,i),xt.range(t,n,r,l,i))}o(l)},rQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i),n!==void 0&&(xt.type(t,n,r,l,i),xt.range(t,n,r,l,i))}o(l)},iQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(n==null&&!t.required)return o();xt.required(t,n,r,l,i,"array"),n!=null&&(xt.type(t,n,r,l,i),xt.range(t,n,r,l,i))}o(l)},lQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i),n!==void 0&&xt.type(t,n,r,l,i)}o(l)},aQ="enum",sQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i),n!==void 0&&xt[aQ](t,n,r,l,i)}o(l)},cQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n,"string")&&!t.required)return o();xt.required(t,n,r,l,i),Sn(n,"string")||xt.pattern(t,n,r,l,i)}o(l)},uQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n,"date")&&!t.required)return o();if(xt.required(t,n,r,l,i),!Sn(n,"date")){var s;n instanceof Date?s=n:s=new Date(n),xt.type(t,s,r,l,i),s&&xt.range(t,s.getTime(),r,l,i)}}o(l)},dQ=function(t,n,o,r,i){var l=[],a=Array.isArray(n)?"array":typeof n;xt.required(t,n,r,l,i,a),o(l)},Iv=function(t,n,o,r,i){var l=t.type,a=[],s=t.required||!t.required&&r.hasOwnProperty(t.field);if(s){if(Sn(n,l)&&!t.required)return o();xt.required(t,n,r,a,i,l),Sn(n,l)||xt.type(t,n,r,a,i)}o(a)},fQ=function(t,n,o,r,i){var l=[],a=t.required||!t.required&&r.hasOwnProperty(t.field);if(a){if(Sn(n)&&!t.required)return o();xt.required(t,n,r,l,i)}o(l)},ac={string:ZZ,method:QZ,number:eQ,boolean:tQ,regexp:nQ,integer:oQ,float:rQ,array:iQ,object:lQ,enum:sQ,pattern:cQ,date:uQ,url:Iv,hex:Iv,email:Iv,required:dQ,any:fQ};function y0(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var t=JSON.parse(JSON.stringify(this));return t.clone=this.clone,t}}}var S0=y0(),fu=function(){function e(n){this.rules=null,this._messages=S0,this.define(n)}var t=e.prototype;return t.define=function(o){var r=this;if(!o)throw new Error("Cannot configure a schema with no rules");if(typeof o!="object"||Array.isArray(o))throw new Error("Rules must be an object");this.rules={},Object.keys(o).forEach(function(i){var l=o[i];r.rules[i]=Array.isArray(l)?l:[l]})},t.messages=function(o){return o&&(this._messages=r2(y0(),o)),this._messages},t.validate=function(o,r,i){var l=this;r===void 0&&(r={}),i===void 0&&(i=function(){});var a=o,s=r,c=i;if(typeof s=="function"&&(c=s,s={}),!this.rules||Object.keys(this.rules).length===0)return c&&c(null,a),Promise.resolve(a);function u(g){var b=[],y={};function S(w){if(Array.isArray(w)){var C;b=(C=b).concat.apply(C,w)}else b.push(w)}for(var $=0;$3&&arguments[3]!==void 0?arguments[3]:!1;return t.length&&o&&n===void 0&&!PT(e,t.slice(0,-1))?e:IT(e,t,n,o)}function $0(e){return Li(e)}function hQ(e,t){return PT(e,t)}function gQ(e,t,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return pQ(e,t,n,o)}function vQ(e,t){return e&&e.some(n=>bQ(n,t))}function l2(e){return typeof e=="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function TT(e,t){const n=Array.isArray(e)?[...e]:m({},e);return t&&Object.keys(t).forEach(o=>{const r=n[o],i=t[o],l=l2(r)&&l2(i);n[o]=l?TT(r,i||{}):i}),n}function mQ(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;oTT(r,i),e)}function a2(e,t){let n={};return t.forEach(o=>{const r=hQ(e,o);n=gQ(n,o,r)}),n}function bQ(e,t){return!e||!t||e.length!==t.length?!1:e.every((n,o)=>t[o]===n)}const mo="'${name}' is not a valid ${type}",Dh={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:mo,method:mo,array:mo,object:mo,number:mo,date:mo,boolean:mo,integer:mo,float:mo,regexp:mo,email:mo,url:mo,hex:mo},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}};var Bh=function(e,t,n,o){function r(i){return i instanceof n?i:new n(function(l){l(i)})}return new(n||(n=Promise))(function(i,l){function a(u){try{c(o.next(u))}catch(d){l(d)}}function s(u){try{c(o.throw(u))}catch(d){l(d)}}function c(u){u.done?i(u.value):r(u.value).then(a,s)}c((o=o.apply(e,t||[])).next())})};const yQ=fu;function SQ(e,t){return e.replace(/\$\{\w+\}/g,n=>{const o=n.slice(2,-1);return t[o]})}function C0(e,t,n,o,r){return Bh(this,void 0,void 0,function*(){const i=m({},n);delete i.ruleIndex,delete i.trigger;let l=null;i&&i.type==="array"&&i.defaultField&&(l=i.defaultField,delete i.defaultField);const a=new yQ({[e]:[i]}),s=mQ({},Dh,o.validateMessages);a.messages(s);let c=[];try{yield Promise.resolve(a.validate({[e]:t},m({},o)))}catch(f){f.errors?c=f.errors.map((h,v)=>{let{message:g}=h;return qt(g)?mn(g,{key:`error_${v}`}):g}):(console.error(f),c=[s.default()])}if(!c.length&&l)return(yield Promise.all(t.map((h,v)=>C0(`${e}.${v}`,h,l,o,r)))).reduce((h,v)=>[...h,...v],[]);const u=m(m(m({},n),{name:e,enum:(n.enum||[]).join(", ")}),r);return c.map(f=>typeof f=="string"?SQ(f,u):f)})}function ET(e,t,n,o,r,i){const l=e.join("."),a=n.map((c,u)=>{const d=c.validator,f=m(m({},c),{ruleIndex:u});return d&&(f.validator=(h,v,g)=>{let b=!1;const S=d(h,v,function(){for(var $=arguments.length,w=new Array($),C=0;C<$;C++)w[C]=arguments[C];Promise.resolve().then(()=>{b||g(...w)})});b=S&&typeof S.then=="function"&&typeof S.catch=="function",b&&S.then(()=>{g()}).catch($=>{g($||" ")})}),f}).sort((c,u)=>{let{warningOnly:d,ruleIndex:f}=c,{warningOnly:h,ruleIndex:v}=u;return!!d==!!h?f-v:d?1:-1});let s;if(r===!0)s=new Promise((c,u)=>Bh(this,void 0,void 0,function*(){for(let d=0;dC0(l,t,u,o,i).then(d=>({errors:d,rule:u})));s=(r?CQ(c):$Q(c)).then(u=>Promise.reject(u))}return s.catch(c=>c),s}function $Q(e){return Bh(this,void 0,void 0,function*(){return Promise.all(e).then(t=>[].concat(...t))})}function CQ(e){return Bh(this,void 0,void 0,function*(){let t=0;return new Promise(n=>{e.forEach(o=>{o.then(r=>{r.errors.length&&n([r]),t+=1,t===e.length&&n([])})})})})}const _T=Symbol("formContextKey"),MT=e=>{Ye(_T,e)},B1=()=>Ge(_T,{name:P(()=>{}),labelAlign:P(()=>"right"),vertical:P(()=>!1),addField:(e,t)=>{},removeField:e=>{},model:P(()=>{}),rules:P(()=>{}),colon:P(()=>{}),labelWrap:P(()=>{}),labelCol:P(()=>{}),requiredMark:P(()=>!1),validateTrigger:P(()=>{}),onValidate:()=>{},validateMessages:P(()=>Dh)}),AT=Symbol("formItemPrefixContextKey"),xQ=e=>{Ye(AT,e)},wQ=()=>Ge(AT,{prefixCls:P(()=>"")});function OQ(e){return typeof e=="number"?`${e} ${e} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?`0 0 ${e}`:e}const PQ=()=>({span:[String,Number],order:[String,Number],offset:[String,Number],push:[String,Number],pull:[String,Number],xs:{type:[String,Number,Object],default:void 0},sm:{type:[String,Number,Object],default:void 0},md:{type:[String,Number,Object],default:void 0},lg:{type:[String,Number,Object],default:void 0},xl:{type:[String,Number,Object],default:void 0},xxl:{type:[String,Number,Object],default:void 0},prefixCls:String,flex:[String,Number]}),IQ=["xs","sm","md","lg","xl","xxl"],Nh=re({compatConfig:{MODE:3},name:"ACol",inheritAttrs:!1,props:PQ(),setup(e,t){let{slots:n,attrs:o}=t;const{gutter:r,supportFlexGap:i,wrap:l}=IZ(),{prefixCls:a,direction:s}=Ee("col",e),[c,u]=RZ(a),d=P(()=>{const{span:h,order:v,offset:g,push:b,pull:y}=e,S=a.value;let $={};return IQ.forEach(w=>{let C={};const O=e[w];typeof O=="number"?C.span=O:typeof O=="object"&&(C=O||{}),$=m(m({},$),{[`${S}-${w}-${C.span}`]:C.span!==void 0,[`${S}-${w}-order-${C.order}`]:C.order||C.order===0,[`${S}-${w}-offset-${C.offset}`]:C.offset||C.offset===0,[`${S}-${w}-push-${C.push}`]:C.push||C.push===0,[`${S}-${w}-pull-${C.pull}`]:C.pull||C.pull===0,[`${S}-rtl`]:s.value==="rtl"})}),le(S,{[`${S}-${h}`]:h!==void 0,[`${S}-order-${v}`]:v,[`${S}-offset-${g}`]:g,[`${S}-push-${b}`]:b,[`${S}-pull-${y}`]:y},$,o.class,u.value)}),f=P(()=>{const{flex:h}=e,v=r.value,g={};if(v&&v[0]>0){const b=`${v[0]/2}px`;g.paddingLeft=b,g.paddingRight=b}if(v&&v[1]>0&&!i.value){const b=`${v[1]/2}px`;g.paddingTop=b,g.paddingBottom=b}return h&&(g.flex=OQ(h),l.value===!1&&!g.minWidth&&(g.minWidth=0)),g});return()=>{var h;return c(p("div",B(B({},o),{},{class:d.value,style:[f.value,o.style]}),[(h=n.default)===null||h===void 0?void 0:h.call(n)]))}}});var TQ={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"};function s2(e){for(var t=1;t{let{slots:n,emit:o,attrs:r}=t;var i,l,a,s,c;const{prefixCls:u,htmlFor:d,labelCol:f,labelAlign:h,colon:v,required:g,requiredMark:b}=m(m({},e),r),[y]=Uo("Form"),S=(i=e.label)!==null&&i!==void 0?i:(l=n.label)===null||l===void 0?void 0:l.call(n);if(!S)return null;const{vertical:$,labelAlign:w,labelCol:C,labelWrap:O,colon:x}=B1(),I=f||(C==null?void 0:C.value)||{},T=h||(w==null?void 0:w.value),M=`${u}-item-label`,E=le(M,T==="left"&&`${M}-left`,I.class,{[`${M}-wrap`]:!!O.value});let A=S;const R=v===!0||(x==null?void 0:x.value)!==!1&&v!==!1;if(R&&!$.value&&typeof S=="string"&&S.trim()!==""&&(A=S.replace(/[:|:]\s*$/,"")),e.tooltip||n.tooltip){const D=p("span",{class:`${u}-item-tooltip`},[p(co,{title:e.tooltip},{default:()=>[p(pu,null,null)]})]);A=p(Le,null,[A,n.tooltip?(a=n.tooltip)===null||a===void 0?void 0:a.call(n,{class:`${u}-item-tooltip`}):D])}b==="optional"&&!g&&(A=p(Le,null,[A,p("span",{class:`${u}-item-optional`},[((s=y.value)===null||s===void 0?void 0:s.optional)||((c=eo.Form)===null||c===void 0?void 0:c.optional)])]));const _=le({[`${u}-item-required`]:g,[`${u}-item-required-mark-optional`]:b==="optional",[`${u}-item-no-colon`]:!R});return p(Nh,B(B({},I),{},{class:E}),{default:()=>[p("label",{for:d,class:_,title:typeof S=="string"?S:"",onClick:D=>o("click",D)},[A])]})};N1.displayName="FormItemLabel";N1.inheritAttrs=!1;const _Q=e=>{const{componentCls:t}=e,n=`${t}-show-help`,o=`${t}-show-help-item`;return{[n]:{transition:`opacity ${e.motionDurationSlow} ${e.motionEaseInOut}`,"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[o]:{overflow:"hidden",transition:`height ${e.motionDurationSlow} ${e.motionEaseInOut}, + opacity ${e.motionDurationSlow} ${e.motionEaseInOut}, + transform ${e.motionDurationSlow} ${e.motionEaseInOut} !important`,[`&${o}-appear, &${o}-enter`]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},[`&${o}-leave-active`]:{transform:"translateY(-5px)"}}}}},MQ=e=>({legend:{display:"block",width:"100%",marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`},label:{fontSize:e.fontSize},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:`0 0 0 ${e.controlOutlineWidth}px ${e.controlOutline}`},output:{display:"block",paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),c2=(e,t)=>{const{formItemCls:n}=e;return{[n]:{[`${n}-label > label`]:{height:t},[`${n}-control-input`]:{minHeight:t}}}},AQ=e=>{const{componentCls:t}=e;return{[e.componentCls]:m(m(m({},qe(e)),MQ(e)),{[`${t}-text`]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":m({},c2(e,e.controlHeightSM)),"&-large":m({},c2(e,e.controlHeightLG))})}},RQ=e=>{const{formItemCls:t,iconCls:n,componentCls:o,rootPrefixCls:r}=e;return{[t]:m(m({},qe(e)),{marginBottom:e.marginLG,verticalAlign:"top","&-with-help":{transition:"none"},[`&-hidden, + &-hidden.${r}-row`]:{display:"none"},"&-has-warning":{[`${t}-split`]:{color:e.colorError}},"&-has-error":{[`${t}-split`]:{color:e.colorWarning}},[`${t}-label`]:{display:"inline-block",flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:`${e.lineHeight} - 0.25em`,whiteSpace:"unset"},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:e.controlHeight,color:e.colorTextHeading,fontSize:e.fontSize,[`> ${n}`]:{fontSize:e.fontSize,verticalAlign:"top"},[`&${t}-required:not(${t}-required-mark-optional)::before`]:{display:"inline-block",marginInlineEnd:e.marginXXS,color:e.colorError,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"',[`${o}-hide-required-mark &`]:{display:"none"}},[`${t}-optional`]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,[`${o}-hide-required-mark &`]:{display:"none"}},[`${t}-tooltip`]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:e.marginXXS/2,marginInlineEnd:e.marginXS},[`&${t}-no-colon::after`]:{content:'" "'}}},[`${t}-control`]:{display:"flex",flexDirection:"column",flexGrow:1,[`&:first-child:not([class^="'${r}-col-'"]):not([class*="' ${r}-col-'"])`]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[t]:{"&-explain, &-extra":{clear:"both",color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:e.controlHeightSM,transition:`color ${e.motionDurationMid} ${e.motionEaseOut}`},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},[`&-with-help ${t}-explain`]:{height:"auto",opacity:1},[`${t}-feedback-icon`]:{fontSize:e.fontSize,textAlign:"center",visibility:"visible",animationName:By,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:"none","&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}})}},DQ=e=>{const{componentCls:t,formItemCls:n,rootPrefixCls:o}=e;return{[`${t}-horizontal`]:{[`${n}-label`]:{flexGrow:0},[`${n}-control`]:{flex:"1 1 0",minWidth:0},[`${n}-label.${o}-col-24 + ${n}-control`]:{minWidth:"unset"}}}},BQ=e=>{const{componentCls:t,formItemCls:n}=e;return{[`${t}-inline`]:{display:"flex",flexWrap:"wrap",[n]:{flex:"none",flexWrap:"nowrap",marginInlineEnd:e.margin,marginBottom:0,"&-with-help":{marginBottom:e.marginLG},[`> ${n}-label, + > ${n}-control`]:{display:"inline-block",verticalAlign:"top"},[`> ${n}-label`]:{flex:"none"},[`${t}-text`]:{display:"inline-block"},[`${n}-has-feedback`]:{display:"inline-block"}}}}},ba=e=>({margin:0,padding:`0 0 ${e.paddingXS}px`,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{display:"none"}}}),NQ=e=>{const{componentCls:t,formItemCls:n}=e;return{[`${n} ${n}-label`]:ba(e),[t]:{[n]:{flexWrap:"wrap",[`${n}-label, + ${n}-control`]:{flex:"0 0 100%",maxWidth:"100%"}}}}},kQ=e=>{const{componentCls:t,formItemCls:n,rootPrefixCls:o}=e;return{[`${t}-vertical`]:{[n]:{"&-row":{flexDirection:"column"},"&-label > label":{height:"auto"},[`${t}-item-control`]:{width:"100%"}}},[`${t}-vertical ${n}-label, + .${o}-col-24${n}-label, + .${o}-col-xl-24${n}-label`]:ba(e),[`@media (max-width: ${e.screenXSMax}px)`]:[NQ(e),{[t]:{[`.${o}-col-xs-24${n}-label`]:ba(e)}}],[`@media (max-width: ${e.screenSMMax}px)`]:{[t]:{[`.${o}-col-sm-24${n}-label`]:ba(e)}},[`@media (max-width: ${e.screenMDMax}px)`]:{[t]:{[`.${o}-col-md-24${n}-label`]:ba(e)}},[`@media (max-width: ${e.screenLGMax}px)`]:{[t]:{[`.${o}-col-lg-24${n}-label`]:ba(e)}}}},k1=Ue("Form",(e,t)=>{let{rootPrefixCls:n}=t;const o=ze(e,{formItemCls:`${e.componentCls}-item`,rootPrefixCls:n});return[AQ(o),RQ(o),_Q(o),DQ(o),BQ(o),kQ(o),nu(o),By]}),FQ=re({compatConfig:{MODE:3},name:"ErrorList",inheritAttrs:!1,props:["errors","help","onErrorVisibleChanged","helpStatus","warnings"],setup(e,t){let{attrs:n}=t;const{prefixCls:o,status:r}=wQ(),i=P(()=>`${o.value}-item-explain`),l=P(()=>!!(e.errors&&e.errors.length)),a=ne(r.value),[,s]=k1(o);return ye([l,r],()=>{l.value&&(a.value=r.value)}),()=>{var c,u;const d=ru(`${o.value}-show-help-item`),f=rh(`${o.value}-show-help-item`,d);return f.role="alert",f.class=[s.value,i.value,n.class,`${o.value}-show-help`],p(bn,B(B({},Go(`${o.value}-show-help`)),{},{onAfterEnter:()=>e.onErrorVisibleChanged(!0),onAfterLeave:()=>e.onErrorVisibleChanged(!1)}),{default:()=>[Ln(p(Fp,B(B({},f),{},{tag:"div"}),{default:()=>[(u=e.errors)===null||u===void 0?void 0:u.map((h,v)=>p("div",{key:v,class:a.value?`${i.value}-${a.value}`:""},[h]))]}),[[Qn,!!(!((c=e.errors)===null||c===void 0)&&c.length)]])]})}}}),LQ=re({compatConfig:{MODE:3},slots:Object,inheritAttrs:!1,props:["prefixCls","errors","hasFeedback","onDomErrorVisibleChange","wrapperCol","help","extra","status","marginBottom","onErrorVisibleChanged"],setup(e,t){let{slots:n}=t;const o=B1(),{wrapperCol:r}=o,i=m({},o);return delete i.labelCol,delete i.wrapperCol,MT(i),xQ({prefixCls:P(()=>e.prefixCls),status:P(()=>e.status)}),()=>{var l,a,s;const{prefixCls:c,wrapperCol:u,marginBottom:d,onErrorVisibleChanged:f,help:h=(l=n.help)===null||l===void 0?void 0:l.call(n),errors:v=kt((a=n.errors)===null||a===void 0?void 0:a.call(n)),extra:g=(s=n.extra)===null||s===void 0?void 0:s.call(n)}=e,b=`${c}-item`,y=u||(r==null?void 0:r.value)||{},S=le(`${b}-control`,y.class);return p(Nh,B(B({},y),{},{class:S}),{default:()=>{var $;return p(Le,null,[p("div",{class:`${b}-control-input`},[p("div",{class:`${b}-control-input-content`},[($=n.default)===null||$===void 0?void 0:$.call(n)])]),d!==null||v.length?p("div",{style:{display:"flex",flexWrap:"nowrap"}},[p(FQ,{errors:v,help:h,class:`${b}-explain-connected`,onErrorVisibleChanged:f},null),!!d&&p("div",{style:{width:0,height:`${d}px`}},null)]):null,g?p("div",{class:`${b}-extra`},[g]):null])}})}}});function zQ(e){const t=oe(e.value.slice());let n=null;return Ve(()=>{clearTimeout(n),n=setTimeout(()=>{t.value=e.value},e.value.length?0:10)}),t}Mn("success","warning","error","validating","");const HQ={success:pr,warning:hr,error:Wn,validating:to};function Tv(e,t,n){let o=e;const r=t;let i=0;try{for(let l=r.length;i({htmlFor:String,prefixCls:String,label:K.any,help:K.any,extra:K.any,labelCol:{type:Object},wrapperCol:{type:Object},hasFeedback:{type:Boolean,default:!1},colon:{type:Boolean,default:void 0},labelAlign:String,prop:{type:[String,Number,Array]},name:{type:[String,Number,Array]},rules:[Array,Object],autoLink:{type:Boolean,default:!0},required:{type:Boolean,default:void 0},validateFirst:{type:Boolean,default:void 0},validateStatus:K.oneOf(Mn("","success","warning","error","validating")),validateTrigger:{type:[String,Array]},messageVariables:{type:Object},hidden:Boolean,noStyle:Boolean,tooltip:String});let VQ=0;const WQ="form_item",RT=re({compatConfig:{MODE:3},name:"AFormItem",inheritAttrs:!1,__ANT_NEW_FORM_ITEM:!0,props:jQ(),slots:Object,setup(e,t){let{slots:n,attrs:o,expose:r}=t;e.prop;const i=`form-item-${++VQ}`,{prefixCls:l}=Ee("form",e),[a,s]=k1(l),c=oe(),u=B1(),d=P(()=>e.name||e.prop),f=oe([]),h=oe(!1),v=oe(),g=P(()=>{const X=d.value;return $0(X)}),b=P(()=>{if(g.value.length){const X=u.name.value,ee=g.value.join("_");return X?`${X}_${ee}`:`${WQ}_${ee}`}else return}),y=()=>{const X=u.model.value;if(!(!X||!d.value))return Tv(X,g.value,!0).v},S=P(()=>y()),$=oe(Cd(S.value)),w=P(()=>{let X=e.validateTrigger!==void 0?e.validateTrigger:u.validateTrigger.value;return X=X===void 0?"change":X,Li(X)}),C=P(()=>{let X=u.rules.value;const ee=e.rules,U=e.required!==void 0?{required:!!e.required,trigger:w.value}:[],Q=Tv(X,g.value);X=X?Q.o[Q.k]||Q.v:[];const J=[].concat(ee||X||[]);return yW(J,G=>G.required)?J:J.concat(U)}),O=P(()=>{const X=C.value;let ee=!1;return X&&X.length&&X.every(U=>U.required?(ee=!0,!1):!0),ee||e.required}),x=oe();Ve(()=>{x.value=e.validateStatus});const I=P(()=>{let X={};return typeof e.label=="string"?X.label=e.label:e.name&&(X.label=String(e.name)),e.messageVariables&&(X=m(m({},X),e.messageVariables)),X}),T=X=>{if(g.value.length===0)return;const{validateFirst:ee=!1}=e,{triggerName:U}=X||{};let Q=C.value;if(U&&(Q=Q.filter(G=>{const{trigger:q}=G;return!q&&!w.value.length?!0:Li(q||w.value).includes(U)})),!Q.length)return Promise.resolve();const J=ET(g.value,S.value,Q,m({validateMessages:u.validateMessages.value},X),ee,I.value);return x.value="validating",f.value=[],J.catch(G=>G).then(function(){let G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(x.value==="validating"){const q=G.filter(V=>V&&V.errors.length);x.value=q.length?"error":"success",f.value=q.map(V=>V.errors),u.onValidate(d.value,!f.value.length,f.value.length?tt(f.value[0]):null)}}),J},M=()=>{T({triggerName:"blur"})},E=()=>{if(h.value){h.value=!1;return}T({triggerName:"change"})},A=()=>{x.value=e.validateStatus,h.value=!1,f.value=[]},R=()=>{var X;x.value=e.validateStatus,h.value=!0,f.value=[];const ee=u.model.value||{},U=S.value,Q=Tv(ee,g.value,!0);Array.isArray(U)?Q.o[Q.k]=[].concat((X=$.value)!==null&&X!==void 0?X:[]):Q.o[Q.k]=$.value,rt(()=>{h.value=!1})},z=P(()=>e.htmlFor===void 0?b.value:e.htmlFor),_=()=>{const X=z.value;if(!X||!v.value)return;const ee=v.value.$el.querySelector(`[id="${X}"]`);ee&&ee.focus&&ee.focus()};r({onFieldBlur:M,onFieldChange:E,clearValidate:A,resetField:R}),PH({id:b,onFieldBlur:()=>{e.autoLink&&M()},onFieldChange:()=>{e.autoLink&&E()},clearValidate:A},P(()=>!!(e.autoLink&&u.model.value&&d.value)));let D=!1;ye(d,X=>{X?D||(D=!0,u.addField(i,{fieldValue:S,fieldId:b,fieldName:d,resetField:R,clearValidate:A,namePath:g,validateRules:T,rules:C})):(D=!1,u.removeField(i))},{immediate:!0}),et(()=>{u.removeField(i)});const N=zQ(f),k=P(()=>e.validateStatus!==void 0?e.validateStatus:N.value.length?"error":x.value),F=P(()=>({[`${l.value}-item`]:!0,[s.value]:!0,[`${l.value}-item-has-feedback`]:k.value&&e.hasFeedback,[`${l.value}-item-has-success`]:k.value==="success",[`${l.value}-item-has-warning`]:k.value==="warning",[`${l.value}-item-has-error`]:k.value==="error",[`${l.value}-item-is-validating`]:k.value==="validating",[`${l.value}-item-hidden`]:e.hidden})),L=ft({});yn.useProvide(L),Ve(()=>{let X;if(e.hasFeedback){const ee=k.value&&HQ[k.value];X=ee?p("span",{class:le(`${l.value}-item-feedback-icon`,`${l.value}-item-feedback-icon-${k.value}`)},[p(ee,null,null)]):null}m(L,{status:k.value,hasFeedback:e.hasFeedback,feedbackIcon:X,isFormItemInput:!0})});const H=oe(null),j=oe(!1),Y=()=>{if(c.value){const X=getComputedStyle(c.value);H.value=parseInt(X.marginBottom,10)}};Ke(()=>{ye(j,()=>{j.value&&Y()},{flush:"post",immediate:!0})});const Z=X=>{X||(H.value=null)};return()=>{var X,ee;if(e.noStyle)return(X=n.default)===null||X===void 0?void 0:X.call(n);const U=(ee=e.help)!==null&&ee!==void 0?ee:n.help?kt(n.help()):null,Q=!!(U!=null&&Array.isArray(U)&&U.length||N.value.length);return j.value=Q,a(p("div",{class:[F.value,Q?`${l.value}-item-with-help`:"",o.class],ref:c},[p(D1,B(B({},o),{},{class:`${l.value}-item-row`,key:"row"}),{default:()=>{var J,G;return p(Le,null,[p(N1,B(B({},e),{},{htmlFor:z.value,required:O.value,requiredMark:u.requiredMark.value,prefixCls:l.value,onClick:_,label:e.label}),{label:n.label,tooltip:n.tooltip}),p(LQ,B(B({},e),{},{errors:U!=null?Li(U):N.value,marginBottom:H.value,prefixCls:l.value,status:k.value,ref:v,help:U,extra:(J=e.extra)!==null&&J!==void 0?J:(G=n.extra)===null||G===void 0?void 0:G.call(n),onErrorVisibleChanged:Z}),{default:n.default})])}}),!!H.value&&p("div",{class:`${l.value}-margin-offset`,style:{marginBottom:`-${H.value}px`}},null)]))}}});function DT(e){let t=!1,n=e.length;const o=[];return e.length?new Promise((r,i)=>{e.forEach((l,a)=>{l.catch(s=>(t=!0,s)).then(s=>{n-=1,o[a]=s,!(n>0)&&(t&&i(o),r(o))})})}):Promise.resolve([])}function u2(e){let t=!1;return e&&e.length&&e.every(n=>n.required?(t=!0,!1):!0),t}function d2(e){return e==null?[]:Array.isArray(e)?e:[e]}function Ev(e,t,n){let o=e;t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,"");const r=t.split(".");let i=0;for(let l=r.length;i1&&arguments[1]!==void 0?arguments[1]:ne({}),n=arguments.length>2?arguments[2]:void 0;const o=Cd(je(e)),r=ft({}),i=oe([]),l=$=>{m(je(e),m(m({},Cd(o)),$)),rt(()=>{Object.keys(r).forEach(w=>{r[w]={autoLink:!1,required:u2(je(t)[w])}})})},a=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],w=arguments.length>1?arguments[1]:void 0;return w.length?$.filter(C=>{const O=d2(C.trigger||"change");return wW(O,w).length}):$};let s=null;const c=function($){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=arguments.length>2?arguments[2]:void 0;const O=[],x={};for(let M=0;M<$.length;M++){const E=$[M],A=Ev(je(e),E,C);if(!A.isValid)continue;x[E]=A.v;const R=a(je(t)[E],d2(w&&w.trigger));R.length&&O.push(u(E,A.v,R,w||{}).then(()=>({name:E,errors:[],warnings:[]})).catch(z=>{const _=[],D=[];return z.forEach(N=>{let{rule:{warningOnly:k},errors:F}=N;k?D.push(...F):_.push(...F)}),_.length?Promise.reject({name:E,errors:_,warnings:D}):{name:E,errors:_,warnings:D}}))}const I=DT(O);s=I;const T=I.then(()=>s===I?Promise.resolve(x):Promise.reject([])).catch(M=>{const E=M.filter(A=>A&&A.errors.length);return E.length?Promise.reject({values:x,errorFields:E,outOfDate:s!==I}):Promise.resolve(x)});return T.catch(M=>M),T},u=function($,w,C){let O=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const x=ET([$],w,C,m({validateMessages:Dh},O),!!O.validateFirst);return r[$]?(r[$].validateStatus="validating",x.catch(I=>I).then(function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];var T;if(r[$].validateStatus==="validating"){const M=I.filter(E=>E&&E.errors.length);r[$].validateStatus=M.length?"error":"success",r[$].help=M.length?M.map(E=>E.errors):null,(T=n==null?void 0:n.onValidate)===null||T===void 0||T.call(n,$,!M.length,M.length?tt(r[$].help[0]):null)}}),x):x.catch(I=>I)},d=($,w)=>{let C=[],O=!0;$?Array.isArray($)?C=$:C=[$]:(O=!1,C=i.value);const x=c(C,w||{},O);return x.catch(I=>I),x},f=$=>{let w=[];$?Array.isArray($)?w=$:w=[$]:w=i.value,w.forEach(C=>{r[C]&&m(r[C],{validateStatus:"",help:null})})},h=$=>{const w={autoLink:!1},C=[],O=Array.isArray($)?$:[$];for(let x=0;x{const w=[];i.value.forEach(C=>{const O=Ev($,C,!1),x=Ev(v,C,!1);(g&&(n==null?void 0:n.immediate)&&O.isValid||!cy(O.v,x.v))&&w.push(C)}),d(w,{trigger:"change"}),g=!1,v=Cd(tt($))},y=n==null?void 0:n.debounce;let S=!0;return ye(t,()=>{i.value=t?Object.keys(je(t)):[],!S&&n&&n.validateOnRuleChange&&d(),S=!1},{deep:!0,immediate:!0}),ye(i,()=>{const $={};i.value.forEach(w=>{$[w]=m({},r[w],{autoLink:!1,required:u2(je(t)[w])}),delete r[w]});for(const w in r)Object.prototype.hasOwnProperty.call(r,w)&&delete r[w];m(r,$)},{immediate:!0}),ye(e,y&&y.wait?Ry(b,y.wait,kW(y,["wait"])):b,{immediate:n&&!!n.immediate,deep:!0}),{modelRef:e,rulesRef:t,initialModel:o,validateInfos:r,resetFields:l,validate:d,validateField:u,mergeValidateInfo:h,clearValidate:f}}const GQ=()=>({layout:K.oneOf(Mn("horizontal","inline","vertical")),labelCol:Be(),wrapperCol:Be(),colon:$e(),labelAlign:Ne(),labelWrap:$e(),prefixCls:String,requiredMark:He([String,Boolean]),hideRequiredMark:$e(),model:K.object,rules:Be(),validateMessages:Be(),validateOnRuleChange:$e(),scrollToFirstError:It(),onSubmit:ve(),name:String,validateTrigger:He([String,Array]),size:Ne(),disabled:$e(),onValuesChange:ve(),onFieldsChange:ve(),onFinish:ve(),onFinishFailed:ve(),onValidate:ve()});function UQ(e,t){return cy(Li(e),Li(t))}const _i=re({compatConfig:{MODE:3},name:"AForm",inheritAttrs:!1,props:Qe(GQ(),{layout:"horizontal",hideRequiredMark:!1,colon:!0}),Item:RT,useForm:KQ,setup(e,t){let{emit:n,slots:o,expose:r,attrs:i}=t;const{prefixCls:l,direction:a,form:s,size:c,disabled:u}=Ee("form",e),d=P(()=>e.requiredMark===""||e.requiredMark),f=P(()=>{var N;return d.value!==void 0?d.value:s&&((N=s.value)===null||N===void 0?void 0:N.requiredMark)!==void 0?s.value.requiredMark:!e.hideRequiredMark});aP(c),TO(u);const h=P(()=>{var N,k;return(N=e.colon)!==null&&N!==void 0?N:(k=s.value)===null||k===void 0?void 0:k.colon}),{validateMessages:v}=BR(),g=P(()=>m(m(m({},Dh),v.value),e.validateMessages)),[b,y]=k1(l),S=P(()=>le(l.value,{[`${l.value}-${e.layout}`]:!0,[`${l.value}-hide-required-mark`]:f.value===!1,[`${l.value}-rtl`]:a.value==="rtl",[`${l.value}-${c.value}`]:c.value},y.value)),$=ne(),w={},C=(N,k)=>{w[N]=k},O=N=>{delete w[N]},x=N=>{const k=!!N,F=k?Li(N).map($0):[];return k?Object.values(w).filter(L=>F.findIndex(H=>UQ(H,L.fieldName.value))>-1):Object.values(w)},I=N=>{e.model&&x(N).forEach(k=>{k.resetField()})},T=N=>{x(N).forEach(k=>{k.clearValidate()})},M=N=>{const{scrollToFirstError:k}=e;if(n("finishFailed",N),k&&N.errorFields.length){let F={};typeof k=="object"&&(F=k),A(N.errorFields[0].name,F)}},E=function(){return _(...arguments)},A=function(N){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const F=x(N?[N]:void 0);if(F.length){const L=F[0].fieldId.value,H=L?document.getElementById(L):null;H&&uP(H,m({scrollMode:"if-needed",block:"nearest"},k))}},R=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(N===!0){const k=[];return Object.values(w).forEach(F=>{let{namePath:L}=F;k.push(L.value)}),a2(e.model,k)}else return a2(e.model,N)},z=(N,k)=>{if(!e.model)return Promise.reject("Form `model` is required for validateFields to work.");const F=!!N,L=F?Li(N).map($0):[],H=[];Object.values(w).forEach(Z=>{var X;if(F||L.push(Z.namePath.value),!(!((X=Z.rules)===null||X===void 0)&&X.value.length))return;const ee=Z.namePath.value;if(!F||vQ(L,ee)){const U=Z.validateRules(m({validateMessages:g.value},k));H.push(U.then(()=>({name:ee,errors:[],warnings:[]})).catch(Q=>{const J=[],G=[];return Q.forEach(q=>{let{rule:{warningOnly:V},errors:W}=q;V?G.push(...W):J.push(...W)}),J.length?Promise.reject({name:ee,errors:J,warnings:G}):{name:ee,errors:J,warnings:G}}))}});const j=DT(H);$.value=j;const Y=j.then(()=>$.value===j?Promise.resolve(R(L)):Promise.reject([])).catch(Z=>{const X=Z.filter(ee=>ee&&ee.errors.length);return Promise.reject({values:R(L),errorFields:X,outOfDate:$.value!==j})});return Y.catch(Z=>Z),Y},_=function(){return z(...arguments)},D=N=>{N.preventDefault(),N.stopPropagation(),n("submit",N),e.model&&z().then(F=>{n("finish",F)}).catch(F=>{M(F)})};return r({resetFields:I,clearValidate:T,validateFields:z,getFieldsValue:R,validate:E,scrollToField:A}),MT({model:P(()=>e.model),name:P(()=>e.name),labelAlign:P(()=>e.labelAlign),labelCol:P(()=>e.labelCol),labelWrap:P(()=>e.labelWrap),wrapperCol:P(()=>e.wrapperCol),vertical:P(()=>e.layout==="vertical"),colon:h,requiredMark:f,validateTrigger:P(()=>e.validateTrigger),rules:P(()=>e.rules),addField:C,removeField:O,onValidate:(N,k,F)=>{n("validate",N,k,F)},validateMessages:g}),ye(()=>e.rules,()=>{e.validateOnRuleChange&&z()}),()=>{var N;return b(p("form",B(B({},i),{},{onSubmit:D,class:[S.value,i.class]}),[(N=o.default)===null||N===void 0?void 0:N.call(o)]))}}});_i.useInjectFormItemContext=an;_i.ItemRest=Nf;_i.install=function(e){return e.component(_i.name,_i),e.component(_i.Item.name,_i.Item),e.component(Nf.name,Nf),e};const XQ=new it("antCheckboxEffect",{"0%":{transform:"scale(1)",opacity:.5},"100%":{transform:"scale(1.6)",opacity:0}}),YQ=e=>{const{checkboxCls:t}=e,n=`${t}-wrapper`;return[{[`${t}-group`]:m(m({},qe(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,[`> ${e.antCls}-row`]:{flex:1}}),[n]:m(m({},qe(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${n}`]:{marginInlineStart:0},[`&${n}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[t]:m(m({},qe(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",alignSelf:"center",[`${t}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${t}-inner`]:m({},ni(e))},[`${t}-inner`]:{boxSizing:"border-box",position:"relative",top:0,insetInlineStart:0,display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:`all ${e.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"21.5%",display:"table",width:e.checkboxSize/14*5,height:e.checkboxSize/14*8,border:`${e.lineWidthBold}px solid ${e.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${e.motionDurationFast} ${e.motionEaseInBack}, opacity ${e.motionDurationFast}`}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{[t]:{"&-indeterminate":{[`${t}-inner`]:{"&:after":{top:"50%",insetInlineStart:"50%",width:e.fontSizeLG/2,height:e.fontSizeLG/2,backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}}}}},{[`${n}:hover ${t}:after`]:{visibility:"visible"},[` + ${n}:not(${n}-disabled), + ${t}:not(${t}-disabled) + `]:{[`&:hover ${t}-inner`]:{borderColor:e.colorPrimary}},[`${n}:not(${n}-disabled)`]:{[`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${t}-checked:not(${t}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${t}-checked`]:{[`${t}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}},"&:after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderRadius:e.borderRadiusSM,visibility:"hidden",border:`${e.lineWidthBold}px solid ${e.colorPrimary}`,animationName:XQ,animationDuration:e.motionDurationSlow,animationTimingFunction:"ease-in-out",animationFillMode:"backwards",content:'""',transition:`all ${e.motionDurationSlow}`}},[` + ${n}-checked:not(${n}-disabled), + ${t}-checked:not(${t}-disabled) + `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${t}:after`]:{borderColor:e.colorPrimaryHover}}},{[`${n}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]};function kh(e,t){const n=ze(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize});return[YQ(n)]}const BT=Ue("Checkbox",(e,t)=>{let{prefixCls:n}=t;return[kh(n,e)]}),qQ=e=>{const{prefixCls:t,componentCls:n,antCls:o}=e,r=`${n}-menu-item`,i=` + &${r}-expand ${r}-expand-icon, + ${r}-loading-icon + `,l=Math.round((e.controlHeight-e.fontSize*e.lineHeight)/2);return[{[n]:{width:e.controlWidth}},{[`${n}-dropdown`]:[kh(`${t}-checkbox`,e),{[`&${o}-select-dropdown`]:{padding:0}},{[n]:{"&-checkbox":{top:0,marginInlineEnd:e.paddingXS},"&-menus":{display:"flex",flexWrap:"nowrap",alignItems:"flex-start",[`&${n}-menu-empty`]:{[`${n}-menu`]:{width:"100%",height:"auto",[r]:{color:e.colorTextDisabled}}}},"&-menu":{flexGrow:1,minWidth:e.controlItemWidth,height:e.dropdownHeight,margin:0,padding:e.paddingXXS,overflow:"auto",verticalAlign:"top",listStyle:"none","-ms-overflow-style":"-ms-autohiding-scrollbar","&:not(:last-child)":{borderInlineEnd:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`},"&-item":m(m({},Jt),{display:"flex",flexWrap:"nowrap",alignItems:"center",padding:`${l}px ${e.paddingSM}px`,lineHeight:e.lineHeight,cursor:"pointer",transition:`all ${e.motionDurationMid}`,borderRadius:e.borderRadiusSM,"&:hover":{background:e.controlItemBgHover},"&-disabled":{color:e.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"},[i]:{color:e.colorTextDisabled}},[`&-active:not(${r}-disabled)`]:{"&, &:hover":{fontWeight:e.fontWeightStrong,backgroundColor:e.controlItemBgActive}},"&-content":{flex:"auto"},[i]:{marginInlineStart:e.paddingXXS,color:e.colorTextDescription,fontSize:e.fontSizeIcon},"&-keyword":{color:e.colorHighlight}})}}}]},{[`${n}-dropdown-rtl`]:{direction:"rtl"}},fs(e)]},JQ=Ue("Cascader",e=>[qQ(e)],{controlWidth:184,controlItemWidth:111,dropdownHeight:180});var ZQ=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rs===0?[a]:[...l,t,a],[]),r=[];let i=0;return o.forEach((l,a)=>{const s=i+l.length;let c=e.slice(i,s);i=s,a%2===1&&(c=p("span",{class:`${n}-menu-item-keyword`,key:"seperator"},[c])),r.push(c)}),r}const eee=e=>{let{inputValue:t,path:n,prefixCls:o,fieldNames:r}=e;const i=[],l=t.toLowerCase();return n.forEach((a,s)=>{s!==0&&i.push(" / ");let c=a[r.label];const u=typeof c;(u==="string"||u==="number")&&(c=QQ(String(c),l,o)),i.push(c)}),i};function tee(){return m(m({},ot(ST(),["customSlots","checkable","options"])),{multiple:{type:Boolean,default:void 0},size:String,bordered:{type:Boolean,default:void 0},placement:{type:String},suffixIcon:K.any,status:String,options:Array,popupClassName:String,dropdownClassName:String,"onUpdate:value":Function})}const nee=re({compatConfig:{MODE:3},name:"ACascader",inheritAttrs:!1,props:Qe(tee(),{bordered:!0,choiceTransitionName:"",allowClear:!0}),setup(e,t){let{attrs:n,expose:o,slots:r,emit:i}=t;const l=an(),a=yn.useInject(),s=P(()=>fr(a.status,e.status)),{prefixCls:c,rootPrefixCls:u,getPrefixCls:d,direction:f,getPopupContainer:h,renderEmpty:v,size:g,disabled:b}=Ee("cascader",e),y=P(()=>d("select",e.prefixCls)),{compactSize:S,compactItemClassnames:$}=Yi(y,f),w=P(()=>S.value||g.value),C=po(),O=P(()=>{var k;return(k=b.value)!==null&&k!==void 0?k:C.value}),[x,I]=Ny(y),[T]=JQ(c),M=P(()=>f.value==="rtl"),E=P(()=>{if(!e.showSearch)return e.showSearch;let k={render:eee};return typeof e.showSearch=="object"&&(k=m(m({},k),e.showSearch)),k}),A=P(()=>le(e.popupClassName||e.dropdownClassName,`${c.value}-dropdown`,{[`${c.value}-dropdown-rtl`]:M.value},I.value)),R=ne();o({focus(){var k;(k=R.value)===null||k===void 0||k.focus()},blur(){var k;(k=R.value)===null||k===void 0||k.blur()}});const z=function(){for(var k=arguments.length,F=new Array(k),L=0;Le.showArrow!==void 0?e.showArrow:e.loading||!e.multiple),N=P(()=>e.placement!==void 0?e.placement:f.value==="rtl"?"bottomRight":"bottomLeft");return()=>{var k,F;const{notFoundContent:L=(k=r.notFoundContent)===null||k===void 0?void 0:k.call(r),expandIcon:H=(F=r.expandIcon)===null||F===void 0?void 0:F.call(r),multiple:j,bordered:Y,allowClear:Z,choiceTransitionName:X,transitionName:ee,id:U=l.id.value}=e,Q=ZQ(e,["notFoundContent","expandIcon","multiple","bordered","allowClear","choiceTransitionName","transitionName","id"]),J=L||v("Cascader");let G=H;H||(G=M.value?p(Dr,null,null):p(Eo,null,null));const q=p("span",{class:`${y.value}-menu-item-loading-icon`},[p(to,{spin:!0},null)]),{suffixIcon:V,removeIcon:W,clearIcon:te}=$y(m(m({},e),{hasFeedback:a.hasFeedback,feedbackIcon:a.feedbackIcon,multiple:j,prefixCls:y.value,showArrow:D.value}),r);return T(x(p($Z,B(B(B({},Q),n),{},{id:U,prefixCls:y.value,class:[c.value,{[`${y.value}-lg`]:w.value==="large",[`${y.value}-sm`]:w.value==="small",[`${y.value}-rtl`]:M.value,[`${y.value}-borderless`]:!Y,[`${y.value}-in-form-item`]:a.isFormItemInput},Fn(y.value,s.value,a.hasFeedback),$.value,n.class,I.value],disabled:O.value,direction:f.value,placement:N.value,notFoundContent:J,allowClear:Z,showSearch:E.value,expandIcon:G,inputIcon:V,removeIcon:W,clearIcon:te,loadingIcon:q,checkable:!!j,dropdownClassName:A.value,dropdownPrefixCls:c.value,choiceTransitionName:Hn(u.value,"",X),transitionName:Hn(u.value,uy(N.value),ee),getPopupContainer:h==null?void 0:h.value,customSlots:m(m({},r),{checkable:()=>p("span",{class:`${c.value}-checkbox-inner`},null)}),tagRender:e.tagRender||r.tagRender,displayRender:e.displayRender||r.displayRender,maxTagPlaceholder:e.maxTagPlaceholder||r.maxTagPlaceholder,showArrow:a.hasFeedback||e.showArrow,onChange:z,onBlur:_,ref:R}),r)))}}}),oee=Bt(m(nee,{SHOW_CHILD:uT,SHOW_PARENT:cT})),ree=()=>({name:String,prefixCls:String,options:ct([]),disabled:Boolean,id:String}),iee=()=>m(m({},ree()),{defaultValue:ct(),value:ct(),onChange:ve(),"onUpdate:value":ve()}),lee=()=>({prefixCls:String,defaultChecked:$e(),checked:$e(),disabled:$e(),isGroup:$e(),value:K.any,name:String,id:String,indeterminate:$e(),type:Ne("checkbox"),autofocus:$e(),onChange:ve(),"onUpdate:checked":ve(),onClick:ve(),skipGroup:$e(!1)}),aee=()=>m(m({},lee()),{indeterminate:$e(!1)}),NT=Symbol("CheckboxGroupContext");var f2=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r(v==null?void 0:v.disabled.value)||u.value);Ve(()=>{!e.skipGroup&&v&&v.registerValue(g,e.value)}),et(()=>{v&&v.cancelValue(g)}),Ke(()=>{Po(!!(e.checked!==void 0||v||e.value===void 0))});const y=C=>{const O=C.target.checked;n("update:checked",O),n("change",C),l.onFieldChange()},S=ne();return i({focus:()=>{var C;(C=S.value)===null||C===void 0||C.focus()},blur:()=>{var C;(C=S.value)===null||C===void 0||C.blur()}}),()=>{var C;const O=wt((C=r.default)===null||C===void 0?void 0:C.call(r)),{indeterminate:x,skipGroup:I,id:T=l.id.value}=e,M=f2(e,["indeterminate","skipGroup","id"]),{onMouseenter:E,onMouseleave:A,onInput:R,class:z,style:_}=o,D=f2(o,["onMouseenter","onMouseleave","onInput","class","style"]),N=m(m(m(m({},M),{id:T,prefixCls:s.value}),D),{disabled:b.value});v&&!I?(N.onChange=function(){for(var H=arguments.length,j=new Array(H),Y=0;Y`${a.value}-group`),[u,d]=BT(c),f=ne((e.value===void 0?e.defaultValue:e.value)||[]);ye(()=>e.value,()=>{f.value=e.value||[]});const h=P(()=>e.options.map(w=>typeof w=="string"||typeof w=="number"?{label:w,value:w}:w)),v=ne(Symbol()),g=ne(new Map),b=w=>{g.value.delete(w),v.value=Symbol()},y=(w,C)=>{g.value.set(w,C),v.value=Symbol()},S=ne(new Map);return ye(v,()=>{const w=new Map;for(const C of g.value.values())w.set(C,!0);S.value=w}),Ye(NT,{cancelValue:b,registerValue:y,toggleOption:w=>{const C=f.value.indexOf(w.value),O=[...f.value];C===-1?O.push(w.value):O.splice(C,1),e.value===void 0&&(f.value=O);const x=O.filter(I=>S.value.has(I)).sort((I,T)=>{const M=h.value.findIndex(A=>A.value===I),E=h.value.findIndex(A=>A.value===T);return M-E});r("update:value",x),r("change",x),l.onFieldChange()},mergedValue:f,name:P(()=>e.name),disabled:P(()=>e.disabled)}),i({mergedValue:f}),()=>{var w;const{id:C=l.id.value}=e;let O=null;return h.value&&h.value.length>0&&(O=h.value.map(x=>{var I;return p(jo,{prefixCls:a.value,key:x.value.toString(),disabled:"disabled"in x?x.disabled:e.disabled,indeterminate:x.indeterminate,value:x.value,checked:f.value.indexOf(x.value)!==-1,onChange:x.onChange,class:`${c.value}-item`},{default:()=>[n.label!==void 0?(I=n.label)===null||I===void 0?void 0:I.call(n,x):x.label]})})),u(p("div",B(B({},o),{},{class:[c.value,{[`${c.value}-rtl`]:s.value==="rtl"},o.class,d.value],id:C}),[O||((w=n.default)===null||w===void 0?void 0:w.call(n))]))}}});jo.Group=ip;jo.install=function(e){return e.component(jo.name,jo),e.component(ip.name,ip),e};const see={useBreakpoint:ps},cee=Bt(Nh),uee=e=>{const{componentCls:t,commentBg:n,commentPaddingBase:o,commentNestIndent:r,commentFontSizeBase:i,commentFontSizeSm:l,commentAuthorNameColor:a,commentAuthorTimeColor:s,commentActionColor:c,commentActionHoverColor:u,commentActionsMarginBottom:d,commentActionsMarginTop:f,commentContentDetailPMarginBottom:h}=e;return{[t]:{position:"relative",backgroundColor:n,[`${t}-inner`]:{display:"flex",padding:o},[`${t}-avatar`]:{position:"relative",flexShrink:0,marginRight:e.marginSM,cursor:"pointer",img:{width:"32px",height:"32px",borderRadius:"50%"}},[`${t}-content`]:{position:"relative",flex:"1 1 auto",minWidth:"1px",fontSize:i,wordWrap:"break-word","&-author":{display:"flex",flexWrap:"wrap",justifyContent:"flex-start",marginBottom:e.marginXXS,fontSize:i,"& > a,& > span":{paddingRight:e.paddingXS,fontSize:l,lineHeight:"18px"},"&-name":{color:a,fontSize:i,transition:`color ${e.motionDurationSlow}`,"> *":{color:a,"&:hover":{color:a}}},"&-time":{color:s,whiteSpace:"nowrap",cursor:"auto"}},"&-detail p":{marginBottom:h,whiteSpace:"pre-wrap"}},[`${t}-actions`]:{marginTop:f,marginBottom:d,paddingLeft:0,"> li":{display:"inline-block",color:c,"> span":{marginRight:"10px",color:c,fontSize:l,cursor:"pointer",transition:`color ${e.motionDurationSlow}`,userSelect:"none","&:hover":{color:u}}}},[`${t}-nested`]:{marginLeft:r},"&-rtl":{direction:"rtl"}}}},dee=Ue("Comment",e=>{const t=ze(e,{commentBg:"inherit",commentPaddingBase:`${e.paddingMD}px 0`,commentNestIndent:"44px",commentFontSizeBase:e.fontSize,commentFontSizeSm:e.fontSizeSM,commentAuthorNameColor:e.colorTextTertiary,commentAuthorTimeColor:e.colorTextPlaceholder,commentActionColor:e.colorTextTertiary,commentActionHoverColor:e.colorTextSecondary,commentActionsMarginBottom:"inherit",commentActionsMarginTop:e.marginSM,commentContentDetailPMarginBottom:"inherit"});return[uee(t)]}),fee=()=>({actions:Array,author:K.any,avatar:K.any,content:K.any,prefixCls:String,datetime:K.any}),pee=re({compatConfig:{MODE:3},name:"AComment",inheritAttrs:!1,props:fee(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("comment",e),[l,a]=dee(r),s=(u,d)=>p("div",{class:`${u}-nested`},[d]),c=u=>!u||!u.length?null:u.map((f,h)=>p("li",{key:`action-${h}`},[f]));return()=>{var u,d,f,h,v,g,b,y,S,$,w;const C=r.value,O=(u=e.actions)!==null&&u!==void 0?u:(d=n.actions)===null||d===void 0?void 0:d.call(n),x=(f=e.author)!==null&&f!==void 0?f:(h=n.author)===null||h===void 0?void 0:h.call(n),I=(v=e.avatar)!==null&&v!==void 0?v:(g=n.avatar)===null||g===void 0?void 0:g.call(n),T=(b=e.content)!==null&&b!==void 0?b:(y=n.content)===null||y===void 0?void 0:y.call(n),M=(S=e.datetime)!==null&&S!==void 0?S:($=n.datetime)===null||$===void 0?void 0:$.call(n),E=p("div",{class:`${C}-avatar`},[typeof I=="string"?p("img",{src:I,alt:"comment-avatar"},null):I]),A=O?p("ul",{class:`${C}-actions`},[c(Array.isArray(O)?O:[O])]):null,R=p("div",{class:`${C}-content-author`},[x&&p("span",{class:`${C}-content-author-name`},[x]),M&&p("span",{class:`${C}-content-author-time`},[M])]),z=p("div",{class:`${C}-content`},[R,p("div",{class:`${C}-content-detail`},[T]),A]),_=p("div",{class:`${C}-inner`},[E,z]),D=wt((w=n.default)===null||w===void 0?void 0:w.call(n));return l(p("div",B(B({},o),{},{class:[C,{[`${C}-rtl`]:i.value==="rtl"},o.class,a.value]}),[_,D&&D.length?s(C,D):null]))}}}),hee=Bt(pee);let Fd=m({},eo.Modal);function gee(e){e?Fd=m(m({},Fd),e):Fd=m({},eo.Modal)}function vee(){return Fd}const x0="internalMark",Ld=re({compatConfig:{MODE:3},name:"ALocaleProvider",props:{locale:{type:Object},ANT_MARK__:String},setup(e,t){let{slots:n}=t;Po(e.ANT_MARK__===x0);const o=ft({antLocale:m(m({},e.locale),{exist:!0}),ANT_MARK__:x0});return Ye("localeData",o),ye(()=>e.locale,r=>{gee(r&&r.Modal),o.antLocale=m(m({},r),{exist:!0})},{immediate:!0}),()=>{var r;return(r=n.default)===null||r===void 0?void 0:r.call(n)}}});Ld.install=function(e){return e.component(Ld.name,Ld),e};const kT=Bt(Ld),FT=re({name:"Notice",inheritAttrs:!1,props:["prefixCls","duration","updateMark","noticeKey","closeIcon","closable","props","onClick","onClose","holder","visible"],setup(e,t){let{attrs:n,slots:o}=t,r,i=!1;const l=P(()=>e.duration===void 0?4.5:e.duration),a=()=>{l.value&&!i&&(r=setTimeout(()=>{c()},l.value*1e3))},s=()=>{r&&(clearTimeout(r),r=null)},c=d=>{d&&d.stopPropagation(),s();const{onClose:f,noticeKey:h}=e;f&&f(h)},u=()=>{s(),a()};return Ke(()=>{a()}),wn(()=>{i=!0,s()}),ye([l,()=>e.updateMark,()=>e.visible],(d,f)=>{let[h,v,g]=d,[b,y,S]=f;(h!==b||v!==y||g!==S&&S)&&u()},{flush:"post"}),()=>{var d,f;const{prefixCls:h,closable:v,closeIcon:g=(d=o.closeIcon)===null||d===void 0?void 0:d.call(o),onClick:b,holder:y}=e,{class:S,style:$}=n,w=`${h}-notice`,C=Object.keys(n).reduce((x,I)=>((I.startsWith("data-")||I.startsWith("aria-")||I==="role")&&(x[I]=n[I]),x),{}),O=p("div",B({class:le(w,S,{[`${w}-closable`]:v}),style:$,onMouseenter:s,onMouseleave:a,onClick:b},C),[p("div",{class:`${w}-content`},[(f=o.default)===null||f===void 0?void 0:f.call(o)]),v?p("a",{tabindex:0,onClick:c,class:`${w}-close`},[g||p("span",{class:`${w}-close-x`},null)]):null]);return y?p(yb,{to:y},{default:()=>O}):O}}});var mee=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const{prefixCls:u,animation:d="fade"}=e;let f=e.transitionName;return!f&&d&&(f=`${u}-${d}`),rh(f)}),s=(u,d)=>{const f=u.key||h2(),h=m(m({},u),{key:f}),{maxCount:v}=e,g=l.value.map(y=>y.notice.key).indexOf(f),b=l.value.concat();g!==-1?b.splice(g,1,{notice:h,holderCallback:d}):(v&&l.value.length>=v&&(h.key=b[0].notice.key,h.updateMark=h2(),h.userPassKey=f,b.shift()),b.push({notice:h,holderCallback:d})),l.value=b},c=u=>{l.value=tt(l.value).filter(d=>{let{notice:{key:f,userPassKey:h}}=d;return(h||f)!==u})};return o({add:s,remove:c,notices:l}),()=>{var u;const{prefixCls:d,closeIcon:f=(u=r.closeIcon)===null||u===void 0?void 0:u.call(r,{prefixCls:d})}=e,h=l.value.map((g,b)=>{let{notice:y,holderCallback:S}=g;const $=b===l.value.length-1?y.updateMark:void 0,{key:w,userPassKey:C}=y,{content:O}=y,x=m(m(m({prefixCls:d,closeIcon:typeof f=="function"?f({prefixCls:d}):f},y),y.props),{key:w,noticeKey:C||w,updateMark:$,onClose:I=>{var T;c(I),(T=y.onClose)===null||T===void 0||T.call(y)},onClick:y.onClick});return S?p("div",{key:w,class:`${d}-hook-holder`,ref:I=>{typeof w>"u"||(I?(i.set(w,I),S(I,x)):i.delete(w))}},null):p(FT,B(B({},x),{},{class:le(x.class,e.hashId)}),{default:()=>[typeof O=="function"?O({prefixCls:d}):O]})}),v={[d]:1,[n.class]:!!n.class,[e.hashId]:!0};return p("div",{class:v,style:n.style||{top:"65px",left:"50%"}},[p(Fp,B({tag:"div"},a.value),{default:()=>[h]})])}}});lp.newInstance=function(t,n){const o=t||{},{name:r="notification",getContainer:i,appContext:l,prefixCls:a,rootPrefixCls:s,transitionName:c,hasTransitionName:u,useStyle:d}=o,f=mee(o,["name","getContainer","appContext","prefixCls","rootPrefixCls","transitionName","hasTransitionName","useStyle"]),h=document.createElement("div");i?i().appendChild(h):document.body.appendChild(h);const g=p(re({compatConfig:{MODE:3},name:"NotificationWrapper",setup(b,y){let{attrs:S}=y;const $=oe(),w=P(()=>In.getPrefixCls(r,a)),[,C]=d(w);return Ke(()=>{n({notice(O){var x;(x=$.value)===null||x===void 0||x.add(O)},removeNotice(O){var x;(x=$.value)===null||x===void 0||x.remove(O)},destroy(){Hi(null,h),h.parentNode&&h.parentNode.removeChild(h)},component:$})}),()=>{const O=In,x=O.getRootPrefixCls(s,w.value),I=u?c:`${w.value}-${c}`;return p(_l,B(B({},O),{},{prefixCls:x}),{default:()=>[p(lp,B(B({ref:$},S),{},{prefixCls:w.value,transitionName:I,hashId:C.value}),null)]})}}}),f);g.appContext=l||g.appContext,Hi(g,h)};let g2=0;const yee=Date.now();function v2(){const e=g2;return g2+=1,`rcNotification_${yee}_${e}`}const See=re({name:"HookNotification",inheritAttrs:!1,props:["prefixCls","transitionName","animation","maxCount","closeIcon","hashId","remove","notices","getStyles","getClassName","onAllRemoved","getContainer"],setup(e,t){let{attrs:n,slots:o}=t;const r=new Map,i=P(()=>e.notices),l=P(()=>{let u=e.transitionName;if(!u&&e.animation)switch(typeof e.animation){case"string":u=e.animation;break;case"function":u=e.animation().name;break;case"object":u=e.animation.name;break;default:u=`${e.prefixCls}-fade`;break}return rh(u)}),a=u=>e.remove(u),s=ne({});ye(i,()=>{const u={};Object.keys(s.value).forEach(d=>{u[d]=[]}),e.notices.forEach(d=>{const{placement:f="topRight"}=d.notice;f&&(u[f]=u[f]||[],u[f].push(d))}),s.value=u});const c=P(()=>Object.keys(s.value));return()=>{var u;const{prefixCls:d,closeIcon:f=(u=o.closeIcon)===null||u===void 0?void 0:u.call(o,{prefixCls:d})}=e,h=c.value.map(v=>{var g,b;const y=s.value[v],S=(g=e.getClassName)===null||g===void 0?void 0:g.call(e,v),$=(b=e.getStyles)===null||b===void 0?void 0:b.call(e,v),w=y.map((x,I)=>{let{notice:T,holderCallback:M}=x;const E=I===i.value.length-1?T.updateMark:void 0,{key:A,userPassKey:R}=T,{content:z}=T,_=m(m(m({prefixCls:d,closeIcon:typeof f=="function"?f({prefixCls:d}):f},T),T.props),{key:A,noticeKey:R||A,updateMark:E,onClose:D=>{var N;a(D),(N=T.onClose)===null||N===void 0||N.call(T)},onClick:T.onClick});return M?p("div",{key:A,class:`${d}-hook-holder`,ref:D=>{typeof A>"u"||(D?(r.set(A,D),M(D,_)):r.delete(A))}},null):p(FT,B(B({},_),{},{class:le(_.class,e.hashId)}),{default:()=>[typeof z=="function"?z({prefixCls:d}):z]})}),C={[d]:1,[`${d}-${v}`]:1,[n.class]:!!n.class,[e.hashId]:!0,[S]:!!S};function O(){var x;y.length>0||(Reflect.deleteProperty(s.value,v),(x=e.onAllRemoved)===null||x===void 0||x.call(e))}return p("div",{key:v,class:C,style:n.style||$||{top:"65px",left:"50%"}},[p(Fp,B(B({tag:"div"},l.value),{},{onAfterLeave:O}),{default:()=>[w]})])});return p(UP,{getContainer:e.getContainer},{default:()=>[h]})}}});var $ee=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rdocument.body;let m2=0;function xee(){const e={};for(var t=arguments.length,n=new Array(t),o=0;o{r&&Object.keys(r).forEach(i=>{const l=r[i];l!==void 0&&(e[i]=l)})}),e}function LT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{getContainer:t=Cee,motion:n,prefixCls:o,maxCount:r,getClassName:i,getStyles:l,onAllRemoved:a}=e,s=$ee(e,["getContainer","motion","prefixCls","maxCount","getClassName","getStyles","onAllRemoved"]),c=oe([]),u=oe(),d=(y,S)=>{const $=y.key||v2(),w=m(m({},y),{key:$}),C=c.value.map(x=>x.notice.key).indexOf($),O=c.value.concat();C!==-1?O.splice(C,1,{notice:w,holderCallback:S}):(r&&c.value.length>=r&&(w.key=O[0].notice.key,w.updateMark=v2(),w.userPassKey=$,O.shift()),O.push({notice:w,holderCallback:S})),c.value=O},f=y=>{c.value=c.value.filter(S=>{let{notice:{key:$,userPassKey:w}}=S;return(w||$)!==y})},h=()=>{c.value=[]},v=()=>p(See,{ref:u,prefixCls:o,maxCount:r,notices:c.value,remove:f,getClassName:i,getStyles:l,animation:n,hashId:e.hashId,onAllRemoved:a,getContainer:t},null),g=oe([]),b={open:y=>{const S=xee(s,y);(S.key===null||S.key===void 0)&&(S.key=`vc-notification-${m2}`,m2+=1),g.value=[...g.value,{type:"open",config:S}]},close:y=>{g.value=[...g.value,{type:"close",key:y}]},destroy:()=>{g.value=[...g.value,{type:"destroy"}]}};return ye(g,()=>{g.value.length&&(g.value.forEach(y=>{switch(y.type){case"open":d(y.config);break;case"close":f(y.key);break;case"destroy":h();break}}),g.value=[])}),[b,v]}const wee=e=>{const{componentCls:t,iconCls:n,boxShadowSecondary:o,colorBgElevated:r,colorSuccess:i,colorError:l,colorWarning:a,colorInfo:s,fontSizeLG:c,motionEaseInOutCirc:u,motionDurationSlow:d,marginXS:f,paddingXS:h,borderRadiusLG:v,zIndexPopup:g,messageNoticeContentPadding:b}=e,y=new it("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:h,transform:"translateY(0)",opacity:1}}),S=new it("MessageMoveOut",{"0%":{maxHeight:e.height,padding:h,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}});return[{[t]:m(m({},qe(e)),{position:"fixed",top:f,left:"50%",transform:"translateX(-50%)",width:"100%",pointerEvents:"none",zIndex:g,[`${t}-move-up`]:{animationFillMode:"forwards"},[` + ${t}-move-up-appear, + ${t}-move-up-enter + `]:{animationName:y,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},[` + ${t}-move-up-appear${t}-move-up-appear-active, + ${t}-move-up-enter${t}-move-up-enter-active + `]:{animationPlayState:"running"},[`${t}-move-up-leave`]:{animationName:S,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},[`${t}-move-up-leave${t}-move-up-leave-active`]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{[`${t}-notice`]:{padding:h,textAlign:"center",[n]:{verticalAlign:"text-bottom",marginInlineEnd:f,fontSize:c},[`${t}-notice-content`]:{display:"inline-block",padding:b,background:r,borderRadius:v,boxShadow:o,pointerEvents:"all"},[`${t}-success ${n}`]:{color:i},[`${t}-error ${n}`]:{color:l},[`${t}-warning ${n}`]:{color:a},[` + ${t}-info ${n}, + ${t}-loading ${n}`]:{color:s}}},{[`${t}-notice-pure-panel`]:{padding:0,textAlign:"start"}}]},zT=Ue("Message",e=>{const t=ze(e,{messageNoticeContentPadding:`${(e.controlHeightLG-e.fontSize*e.lineHeight)/2}px ${e.paddingSM}px`});return[wee(t)]},e=>({height:150,zIndexPopup:e.zIndexPopupBase+10})),Oee={info:p(qi,null,null),success:p(pr,null,null),error:p(Wn,null,null),warning:p(hr,null,null),loading:p(to,null,null)},Pee=re({name:"PureContent",inheritAttrs:!1,props:["prefixCls","type","icon"],setup(e,t){let{slots:n}=t;return()=>{var o;return p("div",{class:le(`${e.prefixCls}-custom-content`,`${e.prefixCls}-${e.type}`)},[e.icon||Oee[e.type],p("span",null,[(o=n.default)===null||o===void 0?void 0:o.call(n)])])}}});var Iee=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);ri("message",e.prefixCls)),[,s]=zT(a),c=()=>{var g;const b=(g=e.top)!==null&&g!==void 0?g:Tee;return{left:"50%",transform:"translateX(-50%)",top:typeof b=="number"?`${b}px`:b}},u=()=>le(s.value,e.rtl?`${a.value}-rtl`:""),d=()=>{var g;return Yb({prefixCls:a.value,animation:(g=e.animation)!==null&&g!==void 0?g:"move-up",transitionName:e.transitionName})},f=p("span",{class:`${a.value}-close-x`},[p(Vn,{class:`${a.value}-close-icon`},null)]),[h,v]=LT({getStyles:c,prefixCls:a.value,getClassName:u,motion:d,closable:!1,closeIcon:f,duration:(o=e.duration)!==null&&o!==void 0?o:Eee,getContainer:(r=e.staticGetContainer)!==null&&r!==void 0?r:l.value,maxCount:e.maxCount,onAllRemoved:e.onAllRemoved});return n(m(m({},h),{prefixCls:a,hashId:s})),v}});let b2=0;function Mee(e){const t=oe(null),n=Symbol("messageHolderKey"),o=s=>{var c;(c=t.value)===null||c===void 0||c.close(s)},r=s=>{if(!t.value){const C=()=>{};return C.then=()=>{},C}const{open:c,prefixCls:u,hashId:d}=t.value,f=`${u}-notice`,{content:h,icon:v,type:g,key:b,class:y,onClose:S}=s,$=Iee(s,["content","icon","type","key","class","onClose"]);let w=b;return w==null&&(b2+=1,w=`antd-message-${b2}`),uR(C=>(c(m(m({},$),{key:w,content:()=>p(Pee,{prefixCls:u,type:g,icon:typeof v=="function"?v():v},{default:()=>[typeof h=="function"?h():h]}),placement:"top",class:le(g&&`${f}-${g}`,d,y),onClose:()=>{S==null||S(),C()}})),()=>{o(w)}))},l={open:r,destroy:s=>{var c;s!==void 0?o(s):(c=t.value)===null||c===void 0||c.destroy()}};return["info","success","warning","error","loading"].forEach(s=>{const c=(u,d,f)=>{let h;u&&typeof u=="object"&&"content"in u?h=u:h={content:u};let v,g;typeof d=="function"?g=d:(v=d,g=f);const b=m(m({onClose:g,duration:v},h),{type:s});return r(b)};l[s]=c}),[l,()=>p(_ee,B(B({key:n},e),{},{ref:t}),null)]}function HT(e){return Mee(e)}let jT=3,VT,qn,Aee=1,WT="",KT="move-up",GT=!1,UT=()=>document.body,XT,YT=!1;function Ree(){return Aee++}function Dee(e){e.top!==void 0&&(VT=e.top,qn=null),e.duration!==void 0&&(jT=e.duration),e.prefixCls!==void 0&&(WT=e.prefixCls),e.getContainer!==void 0&&(UT=e.getContainer,qn=null),e.transitionName!==void 0&&(KT=e.transitionName,qn=null,GT=!0),e.maxCount!==void 0&&(XT=e.maxCount,qn=null),e.rtl!==void 0&&(YT=e.rtl)}function Bee(e,t){if(qn){t(qn);return}lp.newInstance({appContext:e.appContext,prefixCls:e.prefixCls||WT,rootPrefixCls:e.rootPrefixCls,transitionName:KT,hasTransitionName:GT,style:{top:VT},getContainer:UT||e.getPopupContainer,maxCount:XT,name:"message",useStyle:zT},n=>{if(qn){t(qn);return}qn=n,t(n)})}const qT={info:qi,success:pr,error:Wn,warning:hr,loading:to},Nee=Object.keys(qT);function kee(e){const t=e.duration!==void 0?e.duration:jT,n=e.key||Ree(),o=new Promise(i=>{const l=()=>(typeof e.onClose=="function"&&e.onClose(),i(!0));Bee(e,a=>{a.notice({key:n,duration:t,style:e.style||{},class:e.class,content:s=>{let{prefixCls:c}=s;const u=qT[e.type],d=u?p(u,null,null):"",f=le(`${c}-custom-content`,{[`${c}-${e.type}`]:e.type,[`${c}-rtl`]:YT===!0});return p("div",{class:f},[typeof e.icon=="function"?e.icon():e.icon||d,p("span",null,[typeof e.content=="function"?e.content():e.content])])},onClose:l,onClick:e.onClick})})}),r=()=>{qn&&qn.removeNotice(n)};return r.then=(i,l)=>o.then(i,l),r.promise=o,r}function Fee(e){return Object.prototype.toString.call(e)==="[object Object]"&&!!e.content}const Zn={open:kee,config:Dee,destroy(e){if(qn)if(e){const{removeNotice:t}=qn;t(e)}else{const{destroy:t}=qn;t(),qn=null}}};function Lee(e,t){e[t]=(n,o,r)=>Fee(n)?e.open(m(m({},n),{type:t})):(typeof o=="function"&&(r=o,o=void 0),e.open({content:n,duration:o,type:t,onClose:r}))}Nee.forEach(e=>Lee(Zn,e));Zn.warn=Zn.warning;Zn.useMessage=HT;const zee=e=>{const{componentCls:t,width:n,notificationMarginEdge:o}=e,r=new it("antNotificationTopFadeIn",{"0%":{marginTop:"-100%",opacity:0},"100%":{marginTop:0,opacity:1}}),i=new it("antNotificationBottomFadeIn",{"0%":{marginBottom:"-100%",opacity:0},"100%":{marginBottom:0,opacity:1}}),l=new it("antNotificationLeftFadeIn",{"0%":{right:{_skip_check_:!0,value:n},opacity:0},"100%":{right:{_skip_check_:!0,value:0},opacity:1}});return{[`&${t}-top, &${t}-bottom`]:{marginInline:0},[`&${t}-top`]:{[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:r}},[`&${t}-bottom`]:{[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:i}},[`&${t}-topLeft, &${t}-bottomLeft`]:{marginInlineEnd:0,marginInlineStart:o,[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:l}}}},Hee=e=>{const{iconCls:t,componentCls:n,boxShadowSecondary:o,fontSizeLG:r,notificationMarginBottom:i,borderRadiusLG:l,colorSuccess:a,colorInfo:s,colorWarning:c,colorError:u,colorTextHeading:d,notificationBg:f,notificationPadding:h,notificationMarginEdge:v,motionDurationMid:g,motionEaseInOut:b,fontSize:y,lineHeight:S,width:$,notificationIconSize:w}=e,C=`${n}-notice`,O=new it("antNotificationFadeIn",{"0%":{left:{_skip_check_:!0,value:$},opacity:0},"100%":{left:{_skip_check_:!0,value:0},opacity:1}}),x=new it("antNotificationFadeOut",{"0%":{maxHeight:e.animationMaxHeight,marginBottom:i,opacity:1},"100%":{maxHeight:0,marginBottom:0,paddingTop:0,paddingBottom:0,opacity:0}});return[{[n]:m(m(m(m({},qe(e)),{position:"fixed",zIndex:e.zIndexPopup,marginInlineEnd:v,[`${n}-hook-holder`]:{position:"relative"},[`&${n}-top, &${n}-bottom`]:{[`${n}-notice`]:{marginInline:"auto auto"}},[`&${n}-topLeft, &${n}-bottomLeft`]:{[`${n}-notice`]:{marginInlineEnd:"auto",marginInlineStart:0}},[`${n}-fade-enter, ${n}-fade-appear`]:{animationDuration:e.motionDurationMid,animationTimingFunction:b,animationFillMode:"both",opacity:0,animationPlayState:"paused"},[`${n}-fade-leave`]:{animationTimingFunction:b,animationFillMode:"both",animationDuration:g,animationPlayState:"paused"},[`${n}-fade-enter${n}-fade-enter-active, ${n}-fade-appear${n}-fade-appear-active`]:{animationName:O,animationPlayState:"running"},[`${n}-fade-leave${n}-fade-leave-active`]:{animationName:x,animationPlayState:"running"}}),zee(e)),{"&-rtl":{direction:"rtl",[`${n}-notice-btn`]:{float:"left"}}})},{[C]:{position:"relative",width:$,maxWidth:`calc(100vw - ${v*2}px)`,marginBottom:i,marginInlineStart:"auto",padding:h,overflow:"hidden",lineHeight:S,wordWrap:"break-word",background:f,borderRadius:l,boxShadow:o,[`${n}-close-icon`]:{fontSize:y,cursor:"pointer"},[`${C}-message`]:{marginBottom:e.marginXS,color:d,fontSize:r,lineHeight:e.lineHeightLG},[`${C}-description`]:{fontSize:y},[`&${C}-closable ${C}-message`]:{paddingInlineEnd:e.paddingLG},[`${C}-with-icon ${C}-message`]:{marginBottom:e.marginXS,marginInlineStart:e.marginSM+w,fontSize:r},[`${C}-with-icon ${C}-description`]:{marginInlineStart:e.marginSM+w,fontSize:y},[`${C}-icon`]:{position:"absolute",fontSize:w,lineHeight:0,[`&-success${t}`]:{color:a},[`&-info${t}`]:{color:s},[`&-warning${t}`]:{color:c},[`&-error${t}`]:{color:u}},[`${C}-close`]:{position:"absolute",top:e.notificationPaddingVertical,insetInlineEnd:e.notificationPaddingHorizontal,color:e.colorIcon,outline:"none",width:e.notificationCloseButtonSize,height:e.notificationCloseButtonSize,borderRadius:e.borderRadiusSM,transition:`background-color ${e.motionDurationMid}, color ${e.motionDurationMid}`,display:"flex",alignItems:"center",justifyContent:"center","&:hover":{color:e.colorIconHover,backgroundColor:e.wireframe?"transparent":e.colorFillContent}},[`${C}-btn`]:{float:"right",marginTop:e.marginSM}}},{[`${C}-pure-panel`]:{margin:0}}]},JT=Ue("Notification",e=>{const t=e.paddingMD,n=e.paddingLG,o=ze(e,{notificationBg:e.colorBgElevated,notificationPaddingVertical:t,notificationPaddingHorizontal:n,notificationPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`,notificationMarginBottom:e.margin,notificationMarginEdge:e.marginLG,animationMaxHeight:150,notificationIconSize:e.fontSizeLG*e.lineHeightLG,notificationCloseButtonSize:e.controlHeightLG*.55});return[Hee(o)]},e=>({zIndexPopup:e.zIndexPopupBase+50,width:384}));function jee(e,t){return t||p("span",{class:`${e}-close-x`},[p(Vn,{class:`${e}-close-icon`},null)])}p(qi,null,null),p(pr,null,null),p(Wn,null,null),p(hr,null,null),p(to,null,null);const Vee={success:pr,info:qi,error:Wn,warning:hr};function Wee(e){let{prefixCls:t,icon:n,type:o,message:r,description:i,btn:l}=e,a=null;if(n)a=p("span",{class:`${t}-icon`},[$a(n)]);else if(o){const s=Vee[o];a=p(s,{class:`${t}-icon ${t}-icon-${o}`},null)}return p("div",{class:le({[`${t}-with-icon`]:a}),role:"alert"},[a,p("div",{class:`${t}-message`},[r]),p("div",{class:`${t}-description`},[i]),l&&p("div",{class:`${t}-btn`},[l])])}function ZT(e,t,n){let o;switch(t=typeof t=="number"?`${t}px`:t,n=typeof n=="number"?`${n}px`:n,e){case"top":o={left:"50%",transform:"translateX(-50%)",right:"auto",top:t,bottom:"auto"};break;case"topLeft":o={left:0,top:t,bottom:"auto"};break;case"topRight":o={right:0,top:t,bottom:"auto"};break;case"bottom":o={left:"50%",transform:"translateX(-50%)",right:"auto",top:"auto",bottom:n};break;case"bottomLeft":o={left:0,top:"auto",bottom:n};break;default:o={right:0,top:"auto",bottom:n};break}return o}function Kee(e){return{name:`${e}-fade`}}var Gee=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);re.prefixCls||o("notification")),l=f=>{var h,v;return ZT(f,(h=e.top)!==null&&h!==void 0?h:y2,(v=e.bottom)!==null&&v!==void 0?v:y2)},[,a]=JT(i),s=()=>le(a.value,{[`${i.value}-rtl`]:e.rtl}),c=()=>Kee(i.value),[u,d]=LT({prefixCls:i.value,getStyles:l,getClassName:s,motion:c,closable:!0,closeIcon:jee(i.value),duration:Uee,getContainer:()=>{var f,h;return((f=e.getPopupContainer)===null||f===void 0?void 0:f.call(e))||((h=r.value)===null||h===void 0?void 0:h.call(r))||document.body},maxCount:e.maxCount,hashId:a.value,onAllRemoved:e.onAllRemoved});return n(m(m({},u),{prefixCls:i.value,hashId:a})),d}});function Yee(e){const t=oe(null),n=Symbol("notificationHolderKey"),o=a=>{if(!t.value)return;const{open:s,prefixCls:c,hashId:u}=t.value,d=`${c}-notice`,{message:f,description:h,icon:v,type:g,btn:b,class:y}=a,S=Gee(a,["message","description","icon","type","btn","class"]);return s(m(m({placement:"topRight"},S),{content:()=>p(Wee,{prefixCls:d,icon:typeof v=="function"?v():v,type:g,message:typeof f=="function"?f():f,description:typeof h=="function"?h():h,btn:typeof b=="function"?b():b},null),class:le(g&&`${d}-${g}`,u,y)}))},i={open:o,destroy:a=>{var s,c;a!==void 0?(s=t.value)===null||s===void 0||s.close(a):(c=t.value)===null||c===void 0||c.destroy()}};return["success","info","warning","error"].forEach(a=>{i[a]=s=>o(m(m({},s),{type:a}))}),[i,()=>p(Xee,B(B({key:n},e),{},{ref:t}),null)]}function QT(e){return Yee(e)}const vl={};let eE=4.5,tE="24px",nE="24px",w0="",oE="topRight",rE=()=>document.body,iE=null,O0=!1,lE;function qee(e){const{duration:t,placement:n,bottom:o,top:r,getContainer:i,closeIcon:l,prefixCls:a}=e;a!==void 0&&(w0=a),t!==void 0&&(eE=t),n!==void 0&&(oE=n),o!==void 0&&(nE=typeof o=="number"?`${o}px`:o),r!==void 0&&(tE=typeof r=="number"?`${r}px`:r),i!==void 0&&(rE=i),l!==void 0&&(iE=l),e.rtl!==void 0&&(O0=e.rtl),e.maxCount!==void 0&&(lE=e.maxCount)}function Jee(e,t){let{prefixCls:n,placement:o=oE,getContainer:r=rE,top:i,bottom:l,closeIcon:a=iE,appContext:s}=e;const{getPrefixCls:c}=cte(),u=c("notification",n||w0),d=`${u}-${o}-${O0}`,f=vl[d];if(f){Promise.resolve(f).then(v=>{t(v)});return}const h=le(`${u}-${o}`,{[`${u}-rtl`]:O0===!0});lp.newInstance({name:"notification",prefixCls:n||w0,useStyle:JT,class:h,style:ZT(o,i??tE,l??nE),appContext:s,getContainer:r,closeIcon:v=>{let{prefixCls:g}=v;return p("span",{class:`${g}-close-x`},[$a(a,{},p(Vn,{class:`${g}-close-icon`},null))])},maxCount:lE,hasTransitionName:!0},v=>{vl[d]=v,t(v)})}const Zee={success:vh,info:bh,error:yh,warning:mh};function Qee(e){const{icon:t,type:n,description:o,message:r,btn:i}=e,l=e.duration===void 0?eE:e.duration;Jee(e,a=>{a.notice({content:s=>{let{prefixCls:c}=s;const u=`${c}-notice`;let d=null;if(t)d=()=>p("span",{class:`${u}-icon`},[$a(t)]);else if(n){const f=Zee[n];d=()=>p(f,{class:`${u}-icon ${u}-icon-${n}`},null)}return p("div",{class:d?`${u}-with-icon`:""},[d&&d(),p("div",{class:`${u}-message`},[!o&&d?p("span",{class:`${u}-message-single-line-auto-margin`},null):null,$a(r)]),p("div",{class:`${u}-description`},[$a(o)]),i?p("span",{class:`${u}-btn`},[$a(i)]):null])},duration:l,closable:!0,onClose:e.onClose,onClick:e.onClick,key:e.key,style:e.style||{},class:e.class})})}const cr={open:Qee,close(e){Object.keys(vl).forEach(t=>Promise.resolve(vl[t]).then(n=>{n.removeNotice(e)}))},config:qee,destroy(){Object.keys(vl).forEach(e=>{Promise.resolve(vl[e]).then(t=>{t.destroy()}),delete vl[e]})}},ete=["success","info","warning","error"];ete.forEach(e=>{cr[e]=t=>cr.open(m(m({},t),{type:e}))});cr.warn=cr.warning;cr.useNotification=QT;const tte=`-ant-${Date.now()}-${Math.random()}`;function nte(e,t){const n={},o=(l,a)=>{let s=l.clone();return s=(a==null?void 0:a(s))||s,s.toRgbString()},r=(l,a)=>{const s=new vt(l),c=ti(s.toRgbString());n[`${a}-color`]=o(s),n[`${a}-color-disabled`]=c[1],n[`${a}-color-hover`]=c[4],n[`${a}-color-active`]=c[6],n[`${a}-color-outline`]=s.clone().setAlpha(.2).toRgbString(),n[`${a}-color-deprecated-bg`]=c[0],n[`${a}-color-deprecated-border`]=c[2]};if(t.primaryColor){r(t.primaryColor,"primary");const l=new vt(t.primaryColor),a=ti(l.toRgbString());a.forEach((c,u)=>{n[`primary-${u+1}`]=c}),n["primary-color-deprecated-l-35"]=o(l,c=>c.lighten(35)),n["primary-color-deprecated-l-20"]=o(l,c=>c.lighten(20)),n["primary-color-deprecated-t-20"]=o(l,c=>c.tint(20)),n["primary-color-deprecated-t-50"]=o(l,c=>c.tint(50)),n["primary-color-deprecated-f-12"]=o(l,c=>c.setAlpha(c.getAlpha()*.12));const s=new vt(a[0]);n["primary-color-active-deprecated-f-30"]=o(s,c=>c.setAlpha(c.getAlpha()*.3)),n["primary-color-active-deprecated-d-02"]=o(s,c=>c.darken(2))}return t.successColor&&r(t.successColor,"success"),t.warningColor&&r(t.warningColor,"warning"),t.errorColor&&r(t.errorColor,"error"),t.infoColor&&r(t.infoColor,"info"),` + :root { + ${Object.keys(n).map(l=>`--${e}-${l}: ${n[l]};`).join(` +`)} + } + `.trim()}function ote(e,t){const n=nte(e,t);zn()&&wc(n,`${tte}-dynamic-theme`)}const rte=e=>{const[t,n]=si();return Am(P(()=>({theme:t.value,token:n.value,hashId:"",path:["ant-design-icons",e.value]})),()=>[{[`.${e.value}`]:m(m({},Kl()),{[`.${e.value} .${e.value}-icon`]:{display:"block"}})}])};function ite(e,t){const n=P(()=>(e==null?void 0:e.value)||{}),o=P(()=>n.value.inherit===!1||!(t!=null&&t.value)?zb:t.value);return P(()=>{if(!(e!=null&&e.value))return t==null?void 0:t.value;const i=m({},o.value.components);return Object.keys(e.value.components||{}).forEach(l=>{i[l]=m(m({},i[l]),e.value.components[l])}),m(m(m({},o.value),n.value),{token:m(m({},o.value.token),n.value.token),components:i})})}var lte=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{m(In,F1),In.prefixCls=Ha(),In.iconPrefixCls=aE(),In.getPrefixCls=(e,t)=>t||(e?`${In.prefixCls}-${e}`:In.prefixCls),In.getRootPrefixCls=()=>In.prefixCls?In.prefixCls:Ha()});let _v;const ste=e=>{_v&&_v(),_v=Ve(()=>{m(F1,ft(e)),m(In,ft(e))}),e.theme&&ote(Ha(),e.theme)},cte=()=>({getPrefixCls:(e,t)=>t||(e?`${Ha()}-${e}`:Ha()),getIconPrefixCls:aE,getRootPrefixCls:()=>In.prefixCls?In.prefixCls:Ha()}),_l=re({compatConfig:{MODE:3},name:"AConfigProvider",inheritAttrs:!1,props:NR(),setup(e,t){let{slots:n}=t;const o=jp(),r=(_,D)=>{const{prefixCls:N="ant"}=e;if(D)return D;const k=N||o.getPrefixCls("");return _?`${k}-${_}`:k},i=P(()=>e.iconPrefixCls||o.iconPrefixCls.value||Mb),l=P(()=>i.value!==o.iconPrefixCls.value),a=P(()=>{var _;return e.csp||((_=o.csp)===null||_===void 0?void 0:_.value)}),s=rte(i),c=ite(P(()=>e.theme),P(()=>{var _;return(_=o.theme)===null||_===void 0?void 0:_.value})),u=_=>(e.renderEmpty||n.renderEmpty||o.renderEmpty||SB)(_),d=P(()=>{var _,D;return(_=e.autoInsertSpaceInButton)!==null&&_!==void 0?_:(D=o.autoInsertSpaceInButton)===null||D===void 0?void 0:D.value}),f=P(()=>{var _;return e.locale||((_=o.locale)===null||_===void 0?void 0:_.value)});ye(f,()=>{F1.locale=f.value},{immediate:!0});const h=P(()=>{var _;return e.direction||((_=o.direction)===null||_===void 0?void 0:_.value)}),v=P(()=>{var _,D;return(_=e.space)!==null&&_!==void 0?_:(D=o.space)===null||D===void 0?void 0:D.value}),g=P(()=>{var _,D;return(_=e.virtual)!==null&&_!==void 0?_:(D=o.virtual)===null||D===void 0?void 0:D.value}),b=P(()=>{var _,D;return(_=e.dropdownMatchSelectWidth)!==null&&_!==void 0?_:(D=o.dropdownMatchSelectWidth)===null||D===void 0?void 0:D.value}),y=P(()=>{var _;return e.getTargetContainer!==void 0?e.getTargetContainer:(_=o.getTargetContainer)===null||_===void 0?void 0:_.value}),S=P(()=>{var _;return e.getPopupContainer!==void 0?e.getPopupContainer:(_=o.getPopupContainer)===null||_===void 0?void 0:_.value}),$=P(()=>{var _;return e.pageHeader!==void 0?e.pageHeader:(_=o.pageHeader)===null||_===void 0?void 0:_.value}),w=P(()=>{var _;return e.input!==void 0?e.input:(_=o.input)===null||_===void 0?void 0:_.value}),C=P(()=>{var _;return e.pagination!==void 0?e.pagination:(_=o.pagination)===null||_===void 0?void 0:_.value}),O=P(()=>{var _;return e.form!==void 0?e.form:(_=o.form)===null||_===void 0?void 0:_.value}),x=P(()=>{var _;return e.select!==void 0?e.select:(_=o.select)===null||_===void 0?void 0:_.value}),I=P(()=>e.componentSize),T=P(()=>e.componentDisabled),M=P(()=>{var _,D;return(_=e.wave)!==null&&_!==void 0?_:(D=o.wave)===null||D===void 0?void 0:D.value}),E={csp:a,autoInsertSpaceInButton:d,locale:f,direction:h,space:v,virtual:g,dropdownMatchSelectWidth:b,getPrefixCls:r,iconPrefixCls:i,theme:P(()=>{var _,D;return(_=c.value)!==null&&_!==void 0?_:(D=o.theme)===null||D===void 0?void 0:D.value}),renderEmpty:u,getTargetContainer:y,getPopupContainer:S,pageHeader:$,input:w,pagination:C,form:O,select:x,componentSize:I,componentDisabled:T,transformCellText:P(()=>e.transformCellText),wave:M},A=P(()=>{const _=c.value||{},{algorithm:D,token:N}=_,k=lte(_,["algorithm","token"]),F=D&&(!Array.isArray(D)||D.length>0)?HO(D):void 0;return m(m({},k),{theme:F,token:m(m({},Up),N)})}),R=P(()=>{var _,D;let N={};return f.value&&(N=((_=f.value.Form)===null||_===void 0?void 0:_.defaultValidateMessages)||((D=eo.Form)===null||D===void 0?void 0:D.defaultValidateMessages)||{}),e.form&&e.form.validateMessages&&(N=m(m({},N),e.form.validateMessages)),N});kR(E),DR({validateMessages:R}),aP(I),TO(T);const z=_=>{var D,N;let k=l.value?s((D=n.default)===null||D===void 0?void 0:D.call(n)):(N=n.default)===null||N===void 0?void 0:N.call(n);if(e.theme){const F=function(){return k}();k=p(gB,{value:A.value},{default:()=>[F]})}return p(kT,{locale:f.value||_,ANT_MARK__:x0},{default:()=>[k]})};return Ve(()=>{h.value&&(Zn.config({rtl:h.value==="rtl"}),cr.config({rtl:h.value==="rtl"}))}),()=>p(Wl,{children:(_,D,N)=>z(N)},null)}});_l.config=ste;_l.install=function(e){e.component(_l.name,_l)};const ute=(e,t)=>{let{attrs:n,slots:o}=t;return p(Wt,B(B({size:"small",type:"primary"},e),n),o)},ed=(e,t,n)=>{const o=lR(n);return{[`${e.componentCls}-${t}`]:{color:e[`color${n}`],background:e[`color${o}Bg`],borderColor:e[`color${o}Border`],[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}},dte=e=>Pf(e,(t,n)=>{let{textColor:o,lightBorderColor:r,lightColor:i,darkColor:l}=n;return{[`${e.componentCls}-${t}`]:{color:o,background:i,borderColor:r,"&-inverse":{color:e.colorTextLightSolid,background:l,borderColor:l},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}}),fte=e=>{const{paddingXXS:t,lineWidth:n,tagPaddingHorizontal:o,componentCls:r}=e,i=o-n,l=t-n;return{[r]:m(m({},qe(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:i,fontSize:e.tagFontSize,lineHeight:`${e.tagLineHeight}px`,whiteSpace:"nowrap",background:e.tagDefaultBg,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",[`&${r}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.tagDefaultColor},[`${r}-close-icon`]:{marginInlineStart:l,color:e.colorTextDescription,fontSize:e.tagIconSize,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${r}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${r}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:i}}),[`${r}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}},sE=Ue("Tag",e=>{const{fontSize:t,lineHeight:n,lineWidth:o,fontSizeIcon:r}=e,i=Math.round(t*n),l=e.fontSizeSM,a=i-o*2,s=e.colorFillAlter,c=e.colorText,u=ze(e,{tagFontSize:l,tagLineHeight:a,tagDefaultBg:s,tagDefaultColor:c,tagIconSize:r-2*o,tagPaddingHorizontal:8,tagBorderlessBg:e.colorFillTertiary});return[fte(u),dte(u),ed(u,"success","Success"),ed(u,"processing","Info"),ed(u,"error","Error"),ed(u,"warning","Warning")]}),pte=()=>({prefixCls:String,checked:{type:Boolean,default:void 0},onChange:{type:Function},onClick:{type:Function},"onUpdate:checked":Function}),ap=re({compatConfig:{MODE:3},name:"ACheckableTag",inheritAttrs:!1,props:pte(),setup(e,t){let{slots:n,emit:o,attrs:r}=t;const{prefixCls:i}=Ee("tag",e),[l,a]=sE(i),s=u=>{const{checked:d}=e;o("update:checked",!d),o("change",!d),o("click",u)},c=P(()=>le(i.value,a.value,{[`${i.value}-checkable`]:!0,[`${i.value}-checkable-checked`]:e.checked}));return()=>{var u;return l(p("span",B(B({},r),{},{class:[c.value,r.class],onClick:s}),[(u=n.default)===null||u===void 0?void 0:u.call(n)]))}}}),hte=()=>({prefixCls:String,color:{type:String},closable:{type:Boolean,default:!1},closeIcon:K.any,visible:{type:Boolean,default:void 0},onClose:{type:Function},onClick:Nl(),"onUpdate:visible":Function,icon:K.any,bordered:{type:Boolean,default:!0}}),ja=re({compatConfig:{MODE:3},name:"ATag",inheritAttrs:!1,props:hte(),slots:Object,setup(e,t){let{slots:n,emit:o,attrs:r}=t;const{prefixCls:i,direction:l}=Ee("tag",e),[a,s]=sE(i),c=oe(!0);Ve(()=>{e.visible!==void 0&&(c.value=e.visible)});const u=v=>{v.stopPropagation(),o("update:visible",!1),o("close",v),!v.defaultPrevented&&e.visible===void 0&&(c.value=!1)},d=P(()=>Sh(e.color)||wG(e.color)),f=P(()=>le(i.value,s.value,{[`${i.value}-${e.color}`]:d.value,[`${i.value}-has-color`]:e.color&&!d.value,[`${i.value}-hidden`]:!c.value,[`${i.value}-rtl`]:l.value==="rtl",[`${i.value}-borderless`]:!e.bordered})),h=v=>{o("click",v)};return()=>{var v,g,b;const{icon:y=(v=n.icon)===null||v===void 0?void 0:v.call(n),color:S,closeIcon:$=(g=n.closeIcon)===null||g===void 0?void 0:g.call(n),closable:w=!1}=e,C=()=>w?$?p("span",{class:`${i.value}-close-icon`,onClick:u},[$]):p(Vn,{class:`${i.value}-close-icon`,onClick:u},null):null,O={backgroundColor:S&&!d.value?S:void 0},x=y||null,I=(b=n.default)===null||b===void 0?void 0:b.call(n),T=x?p(Le,null,[x,p("span",null,[I])]):I,M=e.onClick!==void 0,E=p("span",B(B({},r),{},{onClick:h,class:[f.value,r.class],style:[O,r.style]}),[T,C()]);return a(M?p(Vy,null,{default:()=>[E]}):E)}}});ja.CheckableTag=ap;ja.install=function(e){return e.component(ja.name,ja),e.component(ap.name,ap),e};function gte(e,t){let{slots:n,attrs:o}=t;return p(ja,B(B({color:"blue"},e),o),n)}var vte={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"};function S2(e){for(var t=1;tE.value||I.value),[z,_]=GI(C),D=ne();g({focus:()=>{var Q;(Q=D.value)===null||Q===void 0||Q.focus()},blur:()=>{var Q;(Q=D.value)===null||Q===void 0||Q.blur()}});const N=Q=>S.valueFormat?e.toString(Q,S.valueFormat):Q,k=(Q,J)=>{const G=N(Q);y("update:value",G),y("change",G,J),$.onFieldChange()},F=Q=>{y("update:open",Q),y("openChange",Q)},L=Q=>{y("focus",Q)},H=Q=>{y("blur",Q),$.onFieldBlur()},j=(Q,J)=>{const G=N(Q);y("panelChange",G,J)},Y=Q=>{const J=N(Q);y("ok",J)},[Z]=Uo("DatePicker",Cc),X=P(()=>S.value?S.valueFormat?e.toDate(S.value,S.valueFormat):S.value:S.value===""?void 0:S.value),ee=P(()=>S.defaultValue?S.valueFormat?e.toDate(S.defaultValue,S.valueFormat):S.defaultValue:S.defaultValue===""?void 0:S.defaultValue),U=P(()=>S.defaultPickerValue?S.valueFormat?e.toDate(S.defaultPickerValue,S.valueFormat):S.defaultPickerValue:S.defaultPickerValue===""?void 0:S.defaultPickerValue);return()=>{var Q,J,G,q,V,W;const te=m(m({},Z.value),S.locale),ue=m(m({},S),b),{bordered:ie=!0,placeholder:ae,suffixIcon:ce=(Q=v.suffixIcon)===null||Q===void 0?void 0:Q.call(v),showToday:se=!0,transitionName:pe,allowClear:he=!0,dateRender:ge=v.dateRender,renderExtraFooter:me=v.renderExtraFooter,monthCellRender:xe=v.monthCellRender||S.monthCellContentRender||v.monthCellContentRender,clearIcon:fe=(J=v.clearIcon)===null||J===void 0?void 0:J.call(v),id:de=$.id.value}=ue,be=Cte(ue,["bordered","placeholder","suffixIcon","showToday","transitionName","allowClear","dateRender","renderExtraFooter","monthCellRender","clearIcon","id"]),we=ue.showTime===""?!0:ue.showTime,{format:Te}=ue;let Re={};c&&(Re.picker=c);const Se=c||ue.picker||"date";Re=m(m(m({},Re),we?cp(m({format:Te,picker:Se},typeof we=="object"?we:{})):{}),Se==="time"?cp(m(m({format:Te},be),{picker:Se})):{});const Ce=C.value,Pe=p(Le,null,[ce||p(c==="time"?Lh:Fh,null,null),w.hasFeedback&&w.feedbackIcon]);return z(p(mY,B(B(B({monthCellRender:xe,dateRender:ge,renderExtraFooter:me,ref:D,placeholder:Ste(te,Se,ae),suffixIcon:Pe,dropdownAlign:cE(O.value,S.placement),clearIcon:fe||p(Wn,null,null),allowClear:he,transitionName:pe||`${T.value}-slide-up`},be),Re),{},{id:de,picker:Se,value:X.value,defaultValue:ee.value,defaultPickerValue:U.value,showToday:se,locale:te.lang,class:le({[`${Ce}-${R.value}`]:R.value,[`${Ce}-borderless`]:!ie},Fn(Ce,fr(w.status,S.status),w.hasFeedback),b.class,_.value,A.value),disabled:M.value,prefixCls:Ce,getPopupContainer:b.getCalendarContainer||x.value,generateConfig:e,prevIcon:((G=v.prevIcon)===null||G===void 0?void 0:G.call(v))||p("span",{class:`${Ce}-prev-icon`},null),nextIcon:((q=v.nextIcon)===null||q===void 0?void 0:q.call(v))||p("span",{class:`${Ce}-next-icon`},null),superPrevIcon:((V=v.superPrevIcon)===null||V===void 0?void 0:V.call(v))||p("span",{class:`${Ce}-super-prev-icon`},null),superNextIcon:((W=v.superNextIcon)===null||W===void 0?void 0:W.call(v))||p("span",{class:`${Ce}-super-next-icon`},null),components:fE,direction:O.value,dropdownClassName:le(_.value,S.popupClassName,S.dropdownClassName),onChange:k,onOpenChange:F,onFocus:L,onBlur:H,onPanelChange:j,onOk:Y}),null))}}})}const o=n(void 0,"ADatePicker"),r=n("week","AWeekPicker"),i=n("month","AMonthPicker"),l=n("year","AYearPicker"),a=n("time","TimePicker"),s=n("quarter","AQuarterPicker");return{DatePicker:o,WeekPicker:r,MonthPicker:i,YearPicker:l,TimePicker:a,QuarterPicker:s}}var wte={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z"}}]},name:"swap-right",theme:"outlined"};function C2(e){for(var t=1;tS.value||g.value),[C,O]=GI(f),x=ne();i({focus:()=>{var L;(L=x.value)===null||L===void 0||L.focus()},blur:()=>{var L;(L=x.value)===null||L===void 0||L.blur()}});const I=L=>c.valueFormat?e.toString(L,c.valueFormat):L,T=(L,H)=>{const j=I(L);s("update:value",j),s("change",j,H),u.onFieldChange()},M=L=>{s("update:open",L),s("openChange",L)},E=L=>{s("focus",L)},A=L=>{s("blur",L),u.onFieldBlur()},R=(L,H)=>{const j=I(L);s("panelChange",j,H)},z=L=>{const H=I(L);s("ok",H)},_=(L,H,j)=>{const Y=I(L);s("calendarChange",Y,H,j)},[D]=Uo("DatePicker",Cc),N=P(()=>c.value&&c.valueFormat?e.toDate(c.value,c.valueFormat):c.value),k=P(()=>c.defaultValue&&c.valueFormat?e.toDate(c.defaultValue,c.valueFormat):c.defaultValue),F=P(()=>c.defaultPickerValue&&c.valueFormat?e.toDate(c.defaultPickerValue,c.valueFormat):c.defaultPickerValue);return()=>{var L,H,j,Y,Z,X,ee;const U=m(m({},D.value),c.locale),Q=m(m({},c),a),{prefixCls:J,bordered:G=!0,placeholder:q,suffixIcon:V=(L=l.suffixIcon)===null||L===void 0?void 0:L.call(l),picker:W="date",transitionName:te,allowClear:ue=!0,dateRender:ie=l.dateRender,renderExtraFooter:ae=l.renderExtraFooter,separator:ce=(H=l.separator)===null||H===void 0?void 0:H.call(l),clearIcon:se=(j=l.clearIcon)===null||j===void 0?void 0:j.call(l),id:pe=u.id.value}=Q,he=Pte(Q,["prefixCls","bordered","placeholder","suffixIcon","picker","transitionName","allowClear","dateRender","renderExtraFooter","separator","clearIcon","id"]);delete he["onUpdate:value"],delete he["onUpdate:open"];const{format:ge,showTime:me}=Q;let xe={};xe=m(m(m({},xe),me?cp(m({format:ge,picker:W},me)):{}),W==="time"?cp(m(m({format:ge},ot(he,["disabledTime"])),{picker:W})):{});const fe=f.value,de=p(Le,null,[V||p(W==="time"?Lh:Fh,null,null),d.hasFeedback&&d.feedbackIcon]);return C(p(IY,B(B(B({dateRender:ie,renderExtraFooter:ae,separator:ce||p("span",{"aria-label":"to",class:`${fe}-separator`},[p(L1,null,null)]),ref:x,dropdownAlign:cE(h.value,c.placement),placeholder:$te(U,W,q),suffixIcon:de,clearIcon:se||p(Wn,null,null),allowClear:ue,transitionName:te||`${b.value}-slide-up`},he),xe),{},{disabled:y.value,id:pe,value:N.value,defaultValue:k.value,defaultPickerValue:F.value,picker:W,class:le({[`${fe}-${w.value}`]:w.value,[`${fe}-borderless`]:!G},Fn(fe,fr(d.status,c.status),d.hasFeedback),a.class,O.value,$.value),locale:U.lang,prefixCls:fe,getPopupContainer:a.getCalendarContainer||v.value,generateConfig:e,prevIcon:((Y=l.prevIcon)===null||Y===void 0?void 0:Y.call(l))||p("span",{class:`${fe}-prev-icon`},null),nextIcon:((Z=l.nextIcon)===null||Z===void 0?void 0:Z.call(l))||p("span",{class:`${fe}-next-icon`},null),superPrevIcon:((X=l.superPrevIcon)===null||X===void 0?void 0:X.call(l))||p("span",{class:`${fe}-super-prev-icon`},null),superNextIcon:((ee=l.superNextIcon)===null||ee===void 0?void 0:ee.call(l))||p("span",{class:`${fe}-super-next-icon`},null),components:fE,direction:h.value,dropdownClassName:le(O.value,c.popupClassName,c.dropdownClassName),onChange:T,onOpenChange:M,onFocus:E,onBlur:A,onPanelChange:R,onOk:z,onCalendarChange:_}),null))}}})}const fE={button:ute,rangeItem:gte};function Tte(e){return e?Array.isArray(e)?e:[e]:[]}function cp(e){const{format:t,picker:n,showHour:o,showMinute:r,showSecond:i,use12Hours:l}=e,a=Tte(t)[0],s=m({},e);return a&&typeof a=="string"&&(!a.includes("s")&&i===void 0&&(s.showSecond=!1),!a.includes("m")&&r===void 0&&(s.showMinute=!1),!a.includes("H")&&!a.includes("h")&&o===void 0&&(s.showHour=!1),(a.includes("a")||a.includes("A"))&&l===void 0&&(s.use12Hours=!0)),n==="time"?s:(typeof a=="function"&&delete s.format,{showTime:s})}function pE(e,t){const{DatePicker:n,WeekPicker:o,MonthPicker:r,YearPicker:i,TimePicker:l,QuarterPicker:a}=xte(e,t),s=Ite(e,t);return{DatePicker:n,WeekPicker:o,MonthPicker:r,YearPicker:i,TimePicker:l,QuarterPicker:a,RangePicker:s}}const{DatePicker:Mv,WeekPicker:zd,MonthPicker:Hd,YearPicker:Ete,TimePicker:_te,QuarterPicker:jd,RangePicker:Vd}=pE(qy),Mte=m(Mv,{WeekPicker:zd,MonthPicker:Hd,YearPicker:Ete,RangePicker:Vd,TimePicker:_te,QuarterPicker:jd,install:e=>(e.component(Mv.name,Mv),e.component(Vd.name,Vd),e.component(Hd.name,Hd),e.component(zd.name,zd),e.component(jd.name,jd),e)});function td(e){return e!=null}const Av=e=>{const{itemPrefixCls:t,component:n,span:o,labelStyle:r,contentStyle:i,bordered:l,label:a,content:s,colon:c}=e,u=n;return l?p(u,{class:[{[`${t}-item-label`]:td(a),[`${t}-item-content`]:td(s)}],colSpan:o},{default:()=>[td(a)&&p("span",{style:r},[a]),td(s)&&p("span",{style:i},[s])]}):p(u,{class:[`${t}-item`],colSpan:o},{default:()=>[p("div",{class:`${t}-item-container`},[(a||a===0)&&p("span",{class:[`${t}-item-label`,{[`${t}-item-no-colon`]:!c}],style:r},[a]),(s||s===0)&&p("span",{class:`${t}-item-content`,style:i},[s])])]})},Ate=e=>{const t=(c,u,d)=>{let{colon:f,prefixCls:h,bordered:v}=u,{component:g,type:b,showLabel:y,showContent:S,labelStyle:$,contentStyle:w}=d;return c.map((C,O)=>{var x,I;const T=C.props||{},{prefixCls:M=h,span:E=1,labelStyle:A=T["label-style"],contentStyle:R=T["content-style"],label:z=(I=(x=C.children)===null||x===void 0?void 0:x.label)===null||I===void 0?void 0:I.call(x)}=T,_=Hp(C),D=ER(C),N=SO(C),{key:k}=C;return typeof g=="string"?p(Av,{key:`${b}-${String(k)||O}`,class:D,style:N,labelStyle:m(m({},$),A),contentStyle:m(m({},w),R),span:E,colon:f,component:g,itemPrefixCls:M,bordered:v,label:y?z:null,content:S?_:null},null):[p(Av,{key:`label-${String(k)||O}`,class:D,style:m(m(m({},$),N),A),span:1,colon:f,component:g[0],itemPrefixCls:M,bordered:v,label:z},null),p(Av,{key:`content-${String(k)||O}`,class:D,style:m(m(m({},w),N),R),span:E*2-1,component:g[1],itemPrefixCls:M,bordered:v,content:_},null)]})},{prefixCls:n,vertical:o,row:r,index:i,bordered:l}=e,{labelStyle:a,contentStyle:s}=Ge(vE,{labelStyle:ne({}),contentStyle:ne({})});return o?p(Le,null,[p("tr",{key:`label-${i}`,class:`${n}-row`},[t(r,e,{component:"th",type:"label",showLabel:!0,labelStyle:a.value,contentStyle:s.value})]),p("tr",{key:`content-${i}`,class:`${n}-row`},[t(r,e,{component:"td",type:"content",showContent:!0,labelStyle:a.value,contentStyle:s.value})])]):p("tr",{key:i,class:`${n}-row`},[t(r,e,{component:l?["th","td"]:"td",type:"item",showLabel:!0,showContent:!0,labelStyle:a.value,contentStyle:s.value})])},Rte=e=>{const{componentCls:t,descriptionsSmallPadding:n,descriptionsDefaultPadding:o,descriptionsMiddlePadding:r,descriptionsBg:i}=e;return{[`&${t}-bordered`]:{[`${t}-view`]:{border:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,"> table":{tableLayout:"auto",borderCollapse:"collapse"}},[`${t}-item-label, ${t}-item-content`]:{padding:o,borderInlineEnd:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderInlineEnd:"none"}},[`${t}-item-label`]:{backgroundColor:i,"&::after":{display:"none"}},[`${t}-row`]:{borderBottom:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderBottom:"none"}},[`&${t}-middle`]:{[`${t}-item-label, ${t}-item-content`]:{padding:r}},[`&${t}-small`]:{[`${t}-item-label, ${t}-item-content`]:{padding:n}}}}},Dte=e=>{const{componentCls:t,descriptionsExtraColor:n,descriptionItemPaddingBottom:o,descriptionsItemLabelColonMarginRight:r,descriptionsItemLabelColonMarginLeft:i,descriptionsTitleMarginBottom:l}=e;return{[t]:m(m(m({},qe(e)),Rte(e)),{"&-rtl":{direction:"rtl"},[`${t}-header`]:{display:"flex",alignItems:"center",marginBottom:l},[`${t}-title`]:m(m({},Jt),{flex:"auto",color:e.colorText,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}),[`${t}-extra`]:{marginInlineStart:"auto",color:n,fontSize:e.fontSize},[`${t}-view`]:{width:"100%",borderRadius:e.borderRadiusLG,table:{width:"100%",tableLayout:"fixed"}},[`${t}-row`]:{"> th, > td":{paddingBottom:o},"&:last-child":{borderBottom:"none"}},[`${t}-item-label`]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"start","&::after":{content:'":"',position:"relative",top:-.5,marginInline:`${i}px ${r}px`},[`&${t}-item-no-colon::after`]:{content:'""'}},[`${t}-item-no-label`]:{"&::after":{margin:0,content:'""'}},[`${t}-item-content`]:{display:"table-cell",flex:1,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,wordBreak:"break-word",overflowWrap:"break-word"},[`${t}-item`]:{paddingBottom:0,verticalAlign:"top","&-container":{display:"flex",[`${t}-item-label`]:{display:"inline-flex",alignItems:"baseline"},[`${t}-item-content`]:{display:"inline-flex",alignItems:"baseline"}}},"&-middle":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingSM}}},"&-small":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingXS}}}})}},Bte=Ue("Descriptions",e=>{const t=e.colorFillAlter,n=e.fontSizeSM*e.lineHeightSM,o=e.colorText,r=`${e.paddingXS}px ${e.padding}px`,i=`${e.padding}px ${e.paddingLG}px`,l=`${e.paddingSM}px ${e.paddingLG}px`,a=e.padding,s=e.marginXS,c=e.marginXXS/2,u=ze(e,{descriptionsBg:t,descriptionsTitleMarginBottom:n,descriptionsExtraColor:o,descriptionItemPaddingBottom:a,descriptionsSmallPadding:r,descriptionsDefaultPadding:i,descriptionsMiddlePadding:l,descriptionsItemLabelColonMarginRight:s,descriptionsItemLabelColonMarginLeft:c});return[Dte(u)]});K.any;const Nte=()=>({prefixCls:String,label:K.any,labelStyle:{type:Object,default:void 0},contentStyle:{type:Object,default:void 0},span:{type:Number,default:1}}),hE=re({compatConfig:{MODE:3},name:"ADescriptionsItem",props:Nte(),setup(e,t){let{slots:n}=t;return()=>{var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}}}),gE={xxxl:3,xxl:3,xl:3,lg:3,md:3,sm:2,xs:1};function kte(e,t){if(typeof e=="number")return e;if(typeof e=="object")for(let n=0;nt)&&(o=pt(e,{span:t})),o}function Fte(e,t){const n=wt(e),o=[];let r=[],i=t;return n.forEach((l,a)=>{var s;const c=(s=l.props)===null||s===void 0?void 0:s.span,u=c||1;if(a===n.length-1){r.push(x2(l,i,c)),o.push(r);return}u({prefixCls:String,bordered:{type:Boolean,default:void 0},size:{type:String,default:"default"},title:K.any,extra:K.any,column:{type:[Number,Object],default:()=>gE},layout:String,colon:{type:Boolean,default:void 0},labelStyle:{type:Object,default:void 0},contentStyle:{type:Object,default:void 0}}),vE=Symbol("descriptionsContext"),ya=re({compatConfig:{MODE:3},name:"ADescriptions",inheritAttrs:!1,props:Lte(),slots:Object,Item:hE,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("descriptions",e);let l;const a=ne({}),[s,c]=Bte(r),u=ky();Rp(()=>{l=u.value.subscribe(f=>{typeof e.column=="object"&&(a.value=f)})}),et(()=>{u.value.unsubscribe(l)}),Ye(vE,{labelStyle:We(e,"labelStyle"),contentStyle:We(e,"contentStyle")});const d=P(()=>kte(e.column,a.value));return()=>{var f,h,v;const{size:g,bordered:b=!1,layout:y="horizontal",colon:S=!0,title:$=(f=n.title)===null||f===void 0?void 0:f.call(n),extra:w=(h=n.extra)===null||h===void 0?void 0:h.call(n)}=e,C=(v=n.default)===null||v===void 0?void 0:v.call(n),O=Fte(C,d.value);return s(p("div",B(B({},o),{},{class:[r.value,{[`${r.value}-${g}`]:g!=="default",[`${r.value}-bordered`]:!!b,[`${r.value}-rtl`]:i.value==="rtl"},o.class,c.value]}),[($||w)&&p("div",{class:`${r.value}-header`},[$&&p("div",{class:`${r.value}-title`},[$]),w&&p("div",{class:`${r.value}-extra`},[w])]),p("div",{class:`${r.value}-view`},[p("table",null,[p("tbody",null,[O.map((x,I)=>p(Ate,{key:I,index:I,colon:S,prefixCls:r.value,vertical:y==="vertical",bordered:b,row:x},null))])])])]))}}});ya.install=function(e){return e.component(ya.name,ya),e.component(ya.Item.name,ya.Item),e};const zte=e=>{const{componentCls:t,sizePaddingEdgeHorizontal:n,colorSplit:o,lineWidth:r}=e;return{[t]:m(m({},qe(e)),{borderBlockStart:`${r}px solid ${o}`,"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",margin:`0 ${e.dividerVerticalGutterMargin}px`,verticalAlign:"middle",borderTop:0,borderInlineStart:`${r}px solid ${o}`},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:`${e.dividerHorizontalGutterMargin}px 0`},[`&-horizontal${t}-with-text`]:{display:"flex",alignItems:"center",margin:`${e.dividerHorizontalWithTextGutterMargin}px 0`,color:e.colorTextHeading,fontWeight:500,fontSize:e.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:`0 ${o}`,"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:`${r}px solid transparent`,borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},[`&-horizontal${t}-with-text-left`]:{"&::before":{width:"5%"},"&::after":{width:"95%"}},[`&-horizontal${t}-with-text-right`]:{"&::before":{width:"95%"},"&::after":{width:"5%"}},[`${t}-inner-text`]:{display:"inline-block",padding:"0 1em"},"&-dashed":{background:"none",borderColor:o,borderStyle:"dashed",borderWidth:`${r}px 0 0`},[`&-horizontal${t}-with-text${t}-dashed`]:{"&::before, &::after":{borderStyle:"dashed none none"}},[`&-vertical${t}-dashed`]:{borderInlineStartWidth:r,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},[`&-plain${t}-with-text`]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize},[`&-horizontal${t}-with-text-left${t}-no-default-orientation-margin-left`]:{"&::before":{width:0},"&::after":{width:"100%"},[`${t}-inner-text`]:{paddingInlineStart:n}},[`&-horizontal${t}-with-text-right${t}-no-default-orientation-margin-right`]:{"&::before":{width:"100%"},"&::after":{width:0},[`${t}-inner-text`]:{paddingInlineEnd:n}}})}},Hte=Ue("Divider",e=>{const t=ze(e,{dividerVerticalGutterMargin:e.marginXS,dividerHorizontalWithTextGutterMargin:e.margin,dividerHorizontalGutterMargin:e.marginLG});return[zte(t)]},{sizePaddingEdgeHorizontal:0}),jte=()=>({prefixCls:String,type:{type:String,default:"horizontal"},dashed:{type:Boolean,default:!1},orientation:{type:String,default:"center"},plain:{type:Boolean,default:!1},orientationMargin:[String,Number]}),Vte=re({name:"ADivider",inheritAttrs:!1,compatConfig:{MODE:3},props:jte(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("divider",e),[l,a]=Hte(r),s=P(()=>e.orientation==="left"&&e.orientationMargin!=null),c=P(()=>e.orientation==="right"&&e.orientationMargin!=null),u=P(()=>{const{type:h,dashed:v,plain:g}=e,b=r.value;return{[b]:!0,[a.value]:!!a.value,[`${b}-${h}`]:!0,[`${b}-dashed`]:!!v,[`${b}-plain`]:!!g,[`${b}-rtl`]:i.value==="rtl",[`${b}-no-default-orientation-margin-left`]:s.value,[`${b}-no-default-orientation-margin-right`]:c.value}}),d=P(()=>{const h=typeof e.orientationMargin=="number"?`${e.orientationMargin}px`:e.orientationMargin;return m(m({},s.value&&{marginLeft:h}),c.value&&{marginRight:h})}),f=P(()=>e.orientation.length>0?"-"+e.orientation:e.orientation);return()=>{var h;const v=wt((h=n.default)===null||h===void 0?void 0:h.call(n));return l(p("div",B(B({},o),{},{class:[u.value,v.length?`${r.value}-with-text ${r.value}-with-text${f.value}`:"",o.class],role:"separator"}),[v.length?p("span",{class:`${r.value}-inner-text`,style:d.value},[v]):null]))}}}),Wte=Bt(Vte);rr.Button=Dc;rr.install=function(e){return e.component(rr.name,rr),e.component(Dc.name,Dc),e};const mE=()=>({prefixCls:String,width:K.oneOfType([K.string,K.number]),height:K.oneOfType([K.string,K.number]),style:{type:Object,default:void 0},class:String,rootClassName:String,rootStyle:Be(),placement:{type:String},wrapperClassName:String,level:{type:[String,Array]},levelMove:{type:[Number,Function,Array]},duration:String,ease:String,showMask:{type:Boolean,default:void 0},maskClosable:{type:Boolean,default:void 0},maskStyle:{type:Object,default:void 0},afterVisibleChange:Function,keyboard:{type:Boolean,default:void 0},contentWrapperStyle:ct(),autofocus:{type:Boolean,default:void 0},open:{type:Boolean,default:void 0},motion:ve(),maskMotion:Be()}),Kte=()=>m(m({},mE()),{forceRender:{type:Boolean,default:void 0},getContainer:K.oneOfType([K.string,K.func,K.object,K.looseBool])}),Gte=()=>m(m({},mE()),{getContainer:Function,getOpenCount:Function,scrollLocker:K.any,inline:Boolean});function Ute(e){return Array.isArray(e)?e:[e]}const Xte={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"};Object.keys(Xte).filter(e=>{if(typeof document>"u")return!1;const t=document.getElementsByTagName("html")[0];return e in(t?t.style:{})})[0];const Yte=!(typeof window<"u"&&window.document&&window.document.createElement);var qte=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{rt(()=>{var y;const{open:S,getContainer:$,showMask:w,autofocus:C}=e,O=$==null?void 0:$();v(e),S&&(O&&(O.parentNode,document.body),rt(()=>{C&&u()}),w&&((y=e.scrollLocker)===null||y===void 0||y.lock()))})}),ye(()=>e.level,()=>{v(e)},{flush:"post"}),ye(()=>e.open,()=>{const{open:y,getContainer:S,scrollLocker:$,showMask:w,autofocus:C}=e,O=S==null?void 0:S();O&&(O.parentNode,document.body),y?(C&&u(),w&&($==null||$.lock())):$==null||$.unLock()},{flush:"post"}),wn(()=>{var y;const{open:S}=e;S&&(document.body.style.touchAction=""),(y=e.scrollLocker)===null||y===void 0||y.unLock()}),ye(()=>e.placement,y=>{y&&(s.value=null)});const u=()=>{var y,S;(S=(y=i.value)===null||y===void 0?void 0:y.focus)===null||S===void 0||S.call(y)},d=y=>{n("close",y)},f=y=>{y.keyCode===Ie.ESC&&(y.stopPropagation(),d(y))},h=()=>{const{open:y,afterVisibleChange:S}=e;S&&S(!!y)},v=y=>{let{level:S,getContainer:$}=y;if(Yte)return;const w=$==null?void 0:$(),C=w?w.parentNode:null;c=[],S==="all"?(C?Array.prototype.slice.call(C.children):[]).forEach(x=>{x.nodeName!=="SCRIPT"&&x.nodeName!=="STYLE"&&x.nodeName!=="LINK"&&x!==w&&c.push(x)}):S&&Ute(S).forEach(O=>{document.querySelectorAll(O).forEach(x=>{c.push(x)})})},g=y=>{n("handleClick",y)},b=oe(!1);return ye(i,()=>{rt(()=>{b.value=!0})}),()=>{var y,S;const{width:$,height:w,open:C,prefixCls:O,placement:x,level:I,levelMove:T,ease:M,duration:E,getContainer:A,onChange:R,afterVisibleChange:z,showMask:_,maskClosable:D,maskStyle:N,keyboard:k,getOpenCount:F,scrollLocker:L,contentWrapperStyle:H,style:j,class:Y,rootClassName:Z,rootStyle:X,maskMotion:ee,motion:U,inline:Q}=e,J=qte(e,["width","height","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","keyboard","getOpenCount","scrollLocker","contentWrapperStyle","style","class","rootClassName","rootStyle","maskMotion","motion","inline"]),G=C&&b.value,q=le(O,{[`${O}-${x}`]:!0,[`${O}-open`]:G,[`${O}-inline`]:Q,"no-mask":!_,[Z]:!0}),V=typeof U=="function"?U(x):U;return p("div",B(B({},ot(J,["autofocus"])),{},{tabindex:-1,class:q,style:X,ref:i,onKeydown:G&&k?f:void 0}),[p(bn,ee,{default:()=>[_&&Ln(p("div",{class:`${O}-mask`,onClick:D?d:void 0,style:N,ref:l},null),[[Qn,G]])]}),p(bn,B(B({},V),{},{onAfterEnter:h,onAfterLeave:h}),{default:()=>[Ln(p("div",{class:`${O}-content-wrapper`,style:[H],ref:r},[p("div",{class:[`${O}-content`,Y],style:j,ref:s},[(y=o.default)===null||y===void 0?void 0:y.call(o)]),o.handler?p("div",{onClick:g,ref:a},[(S=o.handler)===null||S===void 0?void 0:S.call(o)]):null]),[[Qn,G]])]})])}}});var O2=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{},showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",keyboard:!0,forceRender:!1,autofocus:!0}),emits:["handleClick","close"],setup(e,t){let{emit:n,slots:o}=t;const r=ne(null),i=a=>{n("handleClick",a)},l=a=>{n("close",a)};return()=>{const{getContainer:a,wrapperClassName:s,rootClassName:c,rootStyle:u,forceRender:d}=e,f=O2(e,["getContainer","wrapperClassName","rootClassName","rootStyle","forceRender"]);let h=null;if(!a)return p(w2,B(B({},f),{},{rootClassName:c,rootStyle:u,open:e.open,onClose:l,onHandleClick:i,inline:!0}),o);const v=!!o.handler||d;return(v||e.open||r.value)&&(h=p(Zc,{autoLock:!0,visible:e.open,forceRender:v,getContainer:a,wrapperClassName:s},{default:g=>{var{visible:b,afterClose:y}=g,S=O2(g,["visible","afterClose"]);return p(w2,B(B(B({ref:r},f),S),{},{rootClassName:c,rootStyle:u,open:b!==void 0?b:e.open,afterVisibleChange:y!==void 0?y:e.afterVisibleChange,onClose:l,onHandleClick:i}),o)}})),h}}}),Zte=e=>{const{componentCls:t,motionDurationSlow:n}=e,o={"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${n}`}}};return{[t]:{[`${t}-mask-motion`]:{"&-enter, &-appear, &-leave":{"&-active":{transition:`all ${n}`}},"&-enter, &-appear":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}}},[`${t}-panel-motion`]:{"&-left":[o,{"&-enter, &-appear":{"&-start":{transform:"translateX(-100%) !important"},"&-active":{transform:"translateX(0)"}},"&-leave":{transform:"translateX(0)","&-active":{transform:"translateX(-100%)"}}}],"&-right":[o,{"&-enter, &-appear":{"&-start":{transform:"translateX(100%) !important"},"&-active":{transform:"translateX(0)"}},"&-leave":{transform:"translateX(0)","&-active":{transform:"translateX(100%)"}}}],"&-top":[o,{"&-enter, &-appear":{"&-start":{transform:"translateY(-100%) !important"},"&-active":{transform:"translateY(0)"}},"&-leave":{transform:"translateY(0)","&-active":{transform:"translateY(-100%)"}}}],"&-bottom":[o,{"&-enter, &-appear":{"&-start":{transform:"translateY(100%) !important"},"&-active":{transform:"translateY(0)"}},"&-leave":{transform:"translateY(0)","&-active":{transform:"translateY(100%)"}}}]}}}},Qte=e=>{const{componentCls:t,zIndexPopup:n,colorBgMask:o,colorBgElevated:r,motionDurationSlow:i,motionDurationMid:l,padding:a,paddingLG:s,fontSizeLG:c,lineHeightLG:u,lineWidth:d,lineType:f,colorSplit:h,marginSM:v,colorIcon:g,colorIconHover:b,colorText:y,fontWeightStrong:S,drawerFooterPaddingVertical:$,drawerFooterPaddingHorizontal:w}=e,C=`${t}-content-wrapper`;return{[t]:{position:"fixed",inset:0,zIndex:n,pointerEvents:"none","&-pure":{position:"relative",background:r,[`&${t}-left`]:{boxShadow:e.boxShadowDrawerLeft},[`&${t}-right`]:{boxShadow:e.boxShadowDrawerRight},[`&${t}-top`]:{boxShadow:e.boxShadowDrawerUp},[`&${t}-bottom`]:{boxShadow:e.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${t}-mask`]:{position:"absolute",inset:0,zIndex:n,background:o,pointerEvents:"auto"},[C]:{position:"absolute",zIndex:n,transition:`all ${i}`,"&-hidden":{display:"none"}},[`&-left > ${C}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:e.boxShadowDrawerLeft},[`&-right > ${C}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:e.boxShadowDrawerRight},[`&-top > ${C}`]:{top:0,insetInline:0,boxShadow:e.boxShadowDrawerUp},[`&-bottom > ${C}`]:{bottom:0,insetInline:0,boxShadow:e.boxShadowDrawerDown},[`${t}-content`]:{width:"100%",height:"100%",overflow:"auto",background:r,pointerEvents:"auto"},[`${t}-wrapper-body`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%"},[`${t}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${a}px ${s}px`,fontSize:c,lineHeight:u,borderBottom:`${d}px ${f} ${h}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${t}-extra`]:{flex:"none"},[`${t}-close`]:{display:"inline-block",marginInlineEnd:v,color:g,fontWeight:S,fontSize:c,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,outline:0,cursor:"pointer",transition:`color ${l}`,textRendering:"auto","&:focus, &:hover":{color:b,textDecoration:"none"}},[`${t}-title`]:{flex:1,margin:0,color:y,fontWeight:e.fontWeightStrong,fontSize:c,lineHeight:u},[`${t}-body`]:{flex:1,minWidth:0,minHeight:0,padding:s,overflow:"auto"},[`${t}-footer`]:{flexShrink:0,padding:`${$}px ${w}px`,borderTop:`${d}px ${f} ${h}`},"&-rtl":{direction:"rtl"}}}},ene=Ue("Drawer",e=>{const t=ze(e,{drawerFooterPaddingVertical:e.paddingXS,drawerFooterPaddingHorizontal:e.padding});return[Qte(t),Zte(t)]},e=>({zIndexPopup:e.zIndexPopupBase}));var tne=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({autofocus:{type:Boolean,default:void 0},closable:{type:Boolean,default:void 0},closeIcon:K.any,destroyOnClose:{type:Boolean,default:void 0},forceRender:{type:Boolean,default:void 0},getContainer:{type:[String,Function,Boolean,Object],default:void 0},maskClosable:{type:Boolean,default:void 0},mask:{type:Boolean,default:void 0},maskStyle:Be(),rootClassName:String,rootStyle:Be(),size:{type:String},drawerStyle:Be(),headerStyle:Be(),bodyStyle:Be(),contentWrapperStyle:{type:Object,default:void 0},title:K.any,visible:{type:Boolean,default:void 0},open:{type:Boolean,default:void 0},width:K.oneOfType([K.string,K.number]),height:K.oneOfType([K.string,K.number]),zIndex:Number,prefixCls:String,push:K.oneOfType([K.looseBool,{type:Object}]),placement:K.oneOf(nne),keyboard:{type:Boolean,default:void 0},extra:K.any,footer:K.any,footerStyle:Be(),level:K.any,levelMove:{type:[Number,Array,Function]},handle:K.any,afterVisibleChange:Function,onAfterVisibleChange:Function,onAfterOpenChange:Function,"onUpdate:visible":Function,"onUpdate:open":Function,onClose:Function}),rne=re({compatConfig:{MODE:3},name:"ADrawer",inheritAttrs:!1,props:Qe(one(),{closable:!0,placement:"right",maskClosable:!0,mask:!0,level:null,keyboard:!0,push:P2}),slots:Object,setup(e,t){let{emit:n,slots:o,attrs:r}=t;const i=oe(!1),l=oe(!1),a=oe(null),s=oe(!1),c=oe(!1),u=P(()=>{var F;return(F=e.open)!==null&&F!==void 0?F:e.visible});ye(u,()=>{u.value?s.value=!0:c.value=!1},{immediate:!0}),ye([u,s],()=>{u.value&&s.value&&(c.value=!0)},{immediate:!0});const d=Ge("parentDrawerOpts",null),{prefixCls:f,getPopupContainer:h,direction:v}=Ee("drawer",e),[g,b]=ene(f),y=P(()=>e.getContainer===void 0&&(h!=null&&h.value)?()=>h.value(document.body):e.getContainer);Mt(!e.afterVisibleChange,"Drawer","`afterVisibleChange` prop is deprecated, please use `@afterVisibleChange` event instead"),Ye("parentDrawerOpts",{setPush:()=>{i.value=!0},setPull:()=>{i.value=!1,rt(()=>{w()})}}),Ke(()=>{u.value&&d&&d.setPush()}),wn(()=>{d&&d.setPull()}),ye(c,()=>{d&&(c.value?d.setPush():d.setPull())},{flush:"post"});const w=()=>{var F,L;(L=(F=a.value)===null||F===void 0?void 0:F.domFocus)===null||L===void 0||L.call(F)},C=F=>{n("update:visible",!1),n("update:open",!1),n("close",F)},O=F=>{var L;F||(l.value===!1&&(l.value=!0),e.destroyOnClose&&(s.value=!1)),(L=e.afterVisibleChange)===null||L===void 0||L.call(e,F),n("afterVisibleChange",F),n("afterOpenChange",F)},x=P(()=>{const{push:F,placement:L}=e;let H;return typeof F=="boolean"?H=F?P2.distance:0:H=F.distance,H=parseFloat(String(H||0)),L==="left"||L==="right"?`translateX(${L==="left"?H:-H}px)`:L==="top"||L==="bottom"?`translateY(${L==="top"?H:-H}px)`:null}),I=P(()=>{var F;return(F=e.width)!==null&&F!==void 0?F:e.size==="large"?736:378}),T=P(()=>{var F;return(F=e.height)!==null&&F!==void 0?F:e.size==="large"?736:378}),M=P(()=>{const{mask:F,placement:L}=e;if(!c.value&&!F)return{};const H={};return L==="left"||L==="right"?H.width=Vf(I.value)?`${I.value}px`:I.value:H.height=Vf(T.value)?`${T.value}px`:T.value,H}),E=P(()=>{const{zIndex:F,contentWrapperStyle:L}=e,H=M.value;return[{zIndex:F,transform:i.value?x.value:void 0},m({},L),H]}),A=F=>{const{closable:L,headerStyle:H}=e,j=ln(o,e,"extra"),Y=ln(o,e,"title");return!Y&&!L?null:p("div",{class:le(`${F}-header`,{[`${F}-header-close-only`]:L&&!Y&&!j}),style:H},[p("div",{class:`${F}-header-title`},[R(F),Y&&p("div",{class:`${F}-title`},[Y])]),j&&p("div",{class:`${F}-extra`},[j])])},R=F=>{var L;const{closable:H}=e,j=o.closeIcon?(L=o.closeIcon)===null||L===void 0?void 0:L.call(o):e.closeIcon;return H&&p("button",{key:"closer",onClick:C,"aria-label":"Close",class:`${F}-close`},[j===void 0?p(Vn,null,null):j])},z=F=>{var L;if(l.value&&!e.forceRender&&!s.value)return null;const{bodyStyle:H,drawerStyle:j}=e;return p("div",{class:`${F}-wrapper-body`,style:j},[A(F),p("div",{key:"body",class:`${F}-body`,style:H},[(L=o.default)===null||L===void 0?void 0:L.call(o)]),_(F)])},_=F=>{const L=ln(o,e,"footer");if(!L)return null;const H=`${F}-footer`;return p("div",{class:H,style:e.footerStyle},[L])},D=P(()=>le({"no-mask":!e.mask,[`${f.value}-rtl`]:v.value==="rtl"},e.rootClassName,b.value)),N=P(()=>Go(Hn(f.value,"mask-motion"))),k=F=>Go(Hn(f.value,`panel-motion-${F}`));return()=>{const{width:F,height:L,placement:H,mask:j,forceRender:Y}=e,Z=tne(e,["width","height","placement","mask","forceRender"]),X=m(m(m({},r),ot(Z,["size","closeIcon","closable","destroyOnClose","drawerStyle","headerStyle","bodyStyle","title","push","onAfterVisibleChange","onClose","onUpdate:visible","onUpdate:open","visible"])),{forceRender:Y,onClose:C,afterVisibleChange:O,handler:!1,prefixCls:f.value,open:c.value,showMask:j,placement:H,ref:a});return g(p(Rc,null,{default:()=>[p(Jte,B(B({},X),{},{maskMotion:N.value,motion:k,width:I.value,height:T.value,getContainer:y.value,rootClassName:D.value,rootStyle:e.rootStyle,contentWrapperStyle:E.value}),{handler:e.handle?()=>e.handle:o.handle,default:()=>z(f.value)})]}))}}}),ine=Bt(rne);var lne={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"};function I2(e){for(var t=1;t({prefixCls:String,description:K.any,type:Ne("default"),shape:Ne("circle"),tooltip:K.any,href:String,target:String,badge:Be(),onClick:ve()}),sne=()=>({prefixCls:Ne()}),cne=()=>m(m({},z1()),{trigger:Ne(),open:$e(),onOpenChange:ve(),"onUpdate:open":ve()}),une=()=>m(m({},z1()),{prefixCls:String,duration:Number,target:ve(),visibilityHeight:Number,onClick:ve()}),dne=re({compatConfig:{MODE:3},name:"AFloatButtonContent",inheritAttrs:!1,props:sne(),setup(e,t){let{attrs:n,slots:o}=t;return()=>{var r;const{prefixCls:i}=e,l=kt((r=o.description)===null||r===void 0?void 0:r.call(o));return p("div",B(B({},n),{},{class:[n.class,`${i}-content`]}),[o.icon||l.length?p(Le,null,[o.icon&&p("div",{class:`${i}-icon`},[o.icon()]),l.length?p("div",{class:`${i}-description`},[l]):null]):p("div",{class:`${i}-icon`},[p(vs,null,null)])])}}}),bE=Symbol("floatButtonGroupContext"),fne=e=>(Ye(bE,e),e),yE=()=>Ge(bE,{shape:ne()}),T2=e=>e===0?0:e-Math.sqrt(Math.pow(e,2)/2),pne=e=>{const{componentCls:t,floatButtonSize:n,motionDurationSlow:o,motionEaseInOutCirc:r}=e,i=`${t}-group`,l=new it("antFloatButtonMoveDownIn",{"0%":{transform:`translate3d(0, ${n}px, 0)`,transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),a=new it("antFloatButtonMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:`translate3d(0, ${n}px, 0)`,transformOrigin:"0 0",opacity:0}});return[{[`${i}-wrap`]:m({},tu(`${i}-wrap`,l,a,o,!0))},{[`${i}-wrap`]:{[` + &${i}-wrap-enter, + &${i}-wrap-appear + `]:{opacity:0,animationTimingFunction:r},[`&${i}-wrap-leave`]:{animationTimingFunction:r}}}]},hne=e=>{const{antCls:t,componentCls:n,floatButtonSize:o,margin:r,borderRadiusLG:i,borderRadiusSM:l,badgeOffset:a,floatButtonBodyPadding:s}=e,c=`${n}-group`;return{[c]:m(m({},qe(e)),{zIndex:99,display:"block",border:"none",position:"fixed",width:o,height:"auto",boxShadow:"none",minHeight:o,insetInlineEnd:e.floatButtonInsetInlineEnd,insetBlockEnd:e.floatButtonInsetBlockEnd,borderRadius:i,[`${c}-wrap`]:{zIndex:-1,display:"block",position:"relative",marginBottom:r},[`&${c}-rtl`]:{direction:"rtl"},[n]:{position:"static"}}),[`${c}-circle`]:{[`${n}-circle:not(:last-child)`]:{marginBottom:e.margin,[`${n}-body`]:{width:o,height:o,borderRadius:"50%"}}},[`${c}-square`]:{[`${n}-square`]:{borderRadius:0,padding:0,"&:first-child":{borderStartStartRadius:i,borderStartEndRadius:i},"&:last-child":{borderEndStartRadius:i,borderEndEndRadius:i},"&:not(:last-child)":{borderBottom:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`},[`${t}-badge`]:{[`${t}-badge-count`]:{top:-(s+a),insetInlineEnd:-(s+a)}}},[`${c}-wrap`]:{display:"block",borderRadius:i,boxShadow:e.boxShadowSecondary,[`${n}-square`]:{boxShadow:"none",marginTop:0,borderRadius:0,padding:s,"&:first-child":{borderStartStartRadius:i,borderStartEndRadius:i},"&:last-child":{borderEndStartRadius:i,borderEndEndRadius:i},"&:not(:last-child)":{borderBottom:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`},[`${n}-body`]:{width:e.floatButtonBodySize,height:e.floatButtonBodySize}}}},[`${c}-circle-shadow`]:{boxShadow:"none"},[`${c}-square-shadow`]:{boxShadow:e.boxShadowSecondary,[`${n}-square`]:{boxShadow:"none",padding:s,[`${n}-body`]:{width:e.floatButtonBodySize,height:e.floatButtonBodySize,borderRadius:l}}}}},gne=e=>{const{antCls:t,componentCls:n,floatButtonBodyPadding:o,floatButtonIconSize:r,floatButtonSize:i,borderRadiusLG:l,badgeOffset:a,dotOffsetInSquare:s,dotOffsetInCircle:c}=e;return{[n]:m(m({},qe(e)),{border:"none",position:"fixed",cursor:"pointer",zIndex:99,display:"block",justifyContent:"center",alignItems:"center",width:i,height:i,insetInlineEnd:e.floatButtonInsetInlineEnd,insetBlockEnd:e.floatButtonInsetBlockEnd,boxShadow:e.boxShadowSecondary,"&-pure":{position:"relative",inset:"auto"},"&:empty":{display:"none"},[`${t}-badge`]:{width:"100%",height:"100%",[`${t}-badge-count`]:{transform:"translate(0, 0)",transformOrigin:"center",top:-a,insetInlineEnd:-a}},[`${n}-body`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",transition:`all ${e.motionDurationMid}`,[`${n}-content`]:{overflow:"hidden",textAlign:"center",minHeight:i,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:`${o/2}px ${o}px`,[`${n}-icon`]:{textAlign:"center",margin:"auto",width:r,fontSize:r,lineHeight:1}}}}),[`${n}-rtl`]:{direction:"rtl"},[`${n}-circle`]:{height:i,borderRadius:"50%",[`${t}-badge`]:{[`${t}-badge-dot`]:{top:c,insetInlineEnd:c}},[`${n}-body`]:{borderRadius:"50%"}},[`${n}-square`]:{height:"auto",minHeight:i,borderRadius:l,[`${t}-badge`]:{[`${t}-badge-dot`]:{top:s,insetInlineEnd:s}},[`${n}-body`]:{height:"auto",borderRadius:l}},[`${n}-default`]:{backgroundColor:e.floatButtonBackgroundColor,transition:`background-color ${e.motionDurationMid}`,[`${n}-body`]:{backgroundColor:e.floatButtonBackgroundColor,transition:`background-color ${e.motionDurationMid}`,"&:hover":{backgroundColor:e.colorFillContent},[`${n}-content`]:{[`${n}-icon`]:{color:e.colorText},[`${n}-description`]:{display:"flex",alignItems:"center",lineHeight:`${e.fontSizeLG}px`,color:e.colorText,fontSize:e.fontSizeSM}}}},[`${n}-primary`]:{backgroundColor:e.colorPrimary,[`${n}-body`]:{backgroundColor:e.colorPrimary,transition:`background-color ${e.motionDurationMid}`,"&:hover":{backgroundColor:e.colorPrimaryHover},[`${n}-content`]:{[`${n}-icon`]:{color:e.colorTextLightSolid},[`${n}-description`]:{display:"flex",alignItems:"center",lineHeight:`${e.fontSizeLG}px`,color:e.colorTextLightSolid,fontSize:e.fontSizeSM}}}}}},H1=Ue("FloatButton",e=>{const{colorTextLightSolid:t,colorBgElevated:n,controlHeightLG:o,marginXXL:r,marginLG:i,fontSize:l,fontSizeIcon:a,controlItemBgHover:s,paddingXXS:c,borderRadiusLG:u}=e,d=ze(e,{floatButtonBackgroundColor:n,floatButtonColor:t,floatButtonHoverBackgroundColor:s,floatButtonFontSize:l,floatButtonIconSize:a*1.5,floatButtonSize:o,floatButtonInsetBlockEnd:r,floatButtonInsetInlineEnd:i,floatButtonBodySize:o-c*2,floatButtonBodyPadding:c,badgeOffset:c*1.5,dotOffsetInCircle:T2(o/2),dotOffsetInSquare:T2(u)});return[hne(d),gne(d),Dy(e),pne(d)]});var vne=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r(s==null?void 0:s.value)||e.shape);return()=>{var d;const{prefixCls:f,type:h="default",shape:v="circle",description:g=(d=o.description)===null||d===void 0?void 0:d.call(o),tooltip:b,badge:y={}}=e,S=vne(e,["prefixCls","type","shape","description","tooltip","badge"]),$=le(r.value,`${r.value}-${h}`,`${r.value}-${u.value}`,{[`${r.value}-rtl`]:i.value==="rtl"},n.class,a.value),w=p(co,{placement:"left"},{title:o.tooltip||b?()=>o.tooltip&&o.tooltip()||b:void 0,default:()=>p(oc,y,{default:()=>[p("div",{class:`${r.value}-body`},[p(dne,{prefixCls:r.value},{icon:o.icon,description:()=>g})])]})});return l(e.href?p("a",B(B(B({ref:c},n),S),{},{class:$}),[w]):p("button",B(B(B({ref:c},n),S),{},{class:$,type:"button"}),[w]))}}}),up=re({compatConfig:{MODE:3},name:"AFloatButtonGroup",inheritAttrs:!1,props:Qe(cne(),{type:"default",shape:"circle"}),setup(e,t){let{attrs:n,slots:o,emit:r}=t;const{prefixCls:i,direction:l}=Ee(j1,e),[a,s]=H1(i),[c,u]=Dt(!1,{value:P(()=>e.open)}),d=ne(null),f=ne(null);fne({shape:P(()=>e.shape)});const h={onMouseenter(){var y;u(!0),r("update:open",!0),(y=e.onOpenChange)===null||y===void 0||y.call(e,!0)},onMouseleave(){var y;u(!1),r("update:open",!1),(y=e.onOpenChange)===null||y===void 0||y.call(e,!1)}},v=P(()=>e.trigger==="hover"?h:{}),g=()=>{var y;const S=!c.value;r("update:open",S),(y=e.onOpenChange)===null||y===void 0||y.call(e,S),u(S)},b=y=>{var S,$,w;if(!((S=d.value)===null||S===void 0)&&S.contains(y.target)){!(($=Jn(f.value))===null||$===void 0)&&$.contains(y.target)&&g();return}u(!1),r("update:open",!1),(w=e.onOpenChange)===null||w===void 0||w.call(e,!1)};return ye(P(()=>e.trigger),y=>{zn()&&(document.removeEventListener("click",b),y==="click"&&document.addEventListener("click",b))},{immediate:!0}),et(()=>{document.removeEventListener("click",b)}),()=>{var y;const{shape:S="circle",type:$="default",tooltip:w,description:C,trigger:O}=e,x=`${i.value}-group`,I=le(x,s.value,n.class,{[`${x}-rtl`]:l.value==="rtl",[`${x}-${S}`]:S,[`${x}-${S}-shadow`]:!O}),T=le(s.value,`${x}-wrap`),M=Go(`${x}-wrap`);return a(p("div",B(B({ref:d},n),{},{class:I},v.value),[O&&["click","hover"].includes(O)?p(Le,null,[p(bn,M,{default:()=>[Ln(p("div",{class:T},[o.default&&o.default()]),[[Qn,c.value]])]}),p(zi,{ref:f,type:$,shape:S,tooltip:w,description:C},{icon:()=>{var E,A;return c.value?((E=o.closeIcon)===null||E===void 0?void 0:E.call(o))||p(Vn,null,null):((A=o.icon)===null||A===void 0?void 0:A.call(o))||p(vs,null,null)},tooltip:o.tooltip,description:o.description})]):(y=o.default)===null||y===void 0?void 0:y.call(o)]))}}});var mne={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z"}}]},name:"vertical-align-top",theme:"outlined"};function E2(e){for(var t=1;twindow,duration:450,type:"default",shape:"circle"}),setup(e,t){let{slots:n,attrs:o,emit:r}=t;const{prefixCls:i,direction:l}=Ee(j1,e),[a]=H1(i),s=ne(),c=ft({visible:e.visibilityHeight===0,scrollEvent:null}),u=()=>s.value&&s.value.ownerDocument?s.value.ownerDocument:window,d=b=>{const{target:y=u,duration:S}=e;Kb(0,{getContainer:y,duration:S}),r("click",b)},f=Im(b=>{const{visibilityHeight:y}=e,S=Wb(b.target);c.visible=S>=y}),h=()=>{const{target:b}=e,S=(b||u)();f({target:S}),S==null||S.addEventListener("scroll",f)},v=()=>{const{target:b}=e,S=(b||u)();f.cancel(),S==null||S.removeEventListener("scroll",f)};ye(()=>e.target,()=>{v(),rt(()=>{h()})}),Ke(()=>{rt(()=>{h()})}),Mp(()=>{rt(()=>{h()})}),O6(()=>{v()}),et(()=>{v()});const g=yE();return()=>{const{description:b,type:y,shape:S,tooltip:$,badge:w}=e,C=m(m({},o),{shape:(g==null?void 0:g.shape.value)||S,onClick:d,class:{[`${i.value}`]:!0,[`${o.class}`]:o.class,[`${i.value}-rtl`]:l.value==="rtl"},description:b,type:y,tooltip:$,badge:w}),O=Go("fade");return a(p(bn,O,{default:()=>[Ln(p(zi,B(B({},C),{},{ref:s}),{icon:()=>{var x;return((x=n.icon)===null||x===void 0?void 0:x.call(n))||p(V1,null,null)}}),[[Qn,c.visible]])]}))}}});zi.Group=up;zi.BackTop=dp;zi.install=function(e){return e.component(zi.name,zi),e.component(up.name,up),e.component(dp.name,dp),e};const sc=e=>e!=null&&(Array.isArray(e)?kt(e).length:!0);function W1(e){return sc(e.prefix)||sc(e.suffix)||sc(e.allowClear)}function Wd(e){return sc(e.addonBefore)||sc(e.addonAfter)}function P0(e){return typeof e>"u"||e===null?"":String(e)}function cc(e,t,n,o){if(!n)return;const r=t;if(t.type==="click"){Object.defineProperty(r,"target",{writable:!0}),Object.defineProperty(r,"currentTarget",{writable:!0});const i=e.cloneNode(!0);r.target=i,r.currentTarget=i,i.value="",n(r);return}if(o!==void 0){Object.defineProperty(r,"target",{writable:!0}),Object.defineProperty(r,"currentTarget",{writable:!0}),r.target=e,r.currentTarget=e,e.value=o,n(r);return}n(r)}function SE(e,t){if(!e)return;e.focus(t);const{cursor:n}=t||{};if(n){const o=e.value.length;switch(n){case"start":e.setSelectionRange(0,0);break;case"end":e.setSelectionRange(o,o);break;default:e.setSelectionRange(0,o)}}}const yne=()=>({addonBefore:K.any,addonAfter:K.any,prefix:K.any,suffix:K.any,clearIcon:K.any,affixWrapperClassName:String,groupClassName:String,wrapperClassName:String,inputClassName:String,allowClear:{type:Boolean,default:void 0}}),$E=()=>m(m({},yne()),{value:{type:[String,Number,Symbol],default:void 0},defaultValue:{type:[String,Number,Symbol],default:void 0},inputElement:K.any,prefixCls:String,disabled:{type:Boolean,default:void 0},focused:{type:Boolean,default:void 0},triggerFocus:Function,readonly:{type:Boolean,default:void 0},handleReset:Function,hidden:{type:Boolean,default:void 0}}),CE=()=>m(m({},$E()),{id:String,placeholder:{type:[String,Number]},autocomplete:String,type:Ne("text"),name:String,size:{type:String},autofocus:{type:Boolean,default:void 0},lazy:{type:Boolean,default:!0},maxlength:Number,loading:{type:Boolean,default:void 0},bordered:{type:Boolean,default:void 0},showCount:{type:[Boolean,Object]},htmlSize:Number,onPressEnter:Function,onKeydown:Function,onKeyup:Function,onFocus:Function,onBlur:Function,onChange:Function,onInput:Function,"onUpdate:value":Function,onCompositionstart:Function,onCompositionend:Function,valueModifiers:Object,hidden:{type:Boolean,default:void 0},status:String}),Sne=re({name:"BaseInput",inheritAttrs:!1,props:$E(),setup(e,t){let{slots:n,attrs:o}=t;const r=ne(),i=a=>{var s;if(!((s=r.value)===null||s===void 0)&&s.contains(a.target)){const{triggerFocus:c}=e;c==null||c()}},l=()=>{var a;const{allowClear:s,value:c,disabled:u,readonly:d,handleReset:f,suffix:h=n.suffix,prefixCls:v}=e;if(!s)return null;const g=!u&&!d&&c,b=`${v}-clear-icon`,y=((a=n.clearIcon)===null||a===void 0?void 0:a.call(n))||"*";return p("span",{onClick:f,onMousedown:S=>S.preventDefault(),class:le({[`${b}-hidden`]:!g,[`${b}-has-suffix`]:!!h},b),role:"button",tabindex:-1},[y])};return()=>{var a,s;const{focused:c,value:u,disabled:d,allowClear:f,readonly:h,hidden:v,prefixCls:g,prefix:b=(a=n.prefix)===null||a===void 0?void 0:a.call(n),suffix:y=(s=n.suffix)===null||s===void 0?void 0:s.call(n),addonAfter:S=n.addonAfter,addonBefore:$=n.addonBefore,inputElement:w,affixWrapperClassName:C,wrapperClassName:O,groupClassName:x}=e;let I=pt(w,{value:u,hidden:v});if(W1({prefix:b,suffix:y,allowClear:f})){const T=`${g}-affix-wrapper`,M=le(T,{[`${T}-disabled`]:d,[`${T}-focused`]:c,[`${T}-readonly`]:h,[`${T}-input-with-clear-btn`]:y&&f&&u},!Wd({addonAfter:S,addonBefore:$})&&o.class,C),E=(y||f)&&p("span",{class:`${g}-suffix`},[l(),y]);I=p("span",{class:M,style:o.style,hidden:!Wd({addonAfter:S,addonBefore:$})&&v,onMousedown:i,ref:r},[b&&p("span",{class:`${g}-prefix`},[b]),pt(w,{style:null,value:u,hidden:null}),E])}if(Wd({addonAfter:S,addonBefore:$})){const T=`${g}-group`,M=`${T}-addon`,E=le(`${g}-wrapper`,T,O),A=le(`${g}-group-wrapper`,o.class,x);return p("span",{class:A,style:o.style,hidden:v},[p("span",{class:E},[$&&p("span",{class:M},[$]),pt(I,{style:null,hidden:null}),S&&p("span",{class:M},[S])])])}return I}}});var $ne=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);re.value,()=>{l.value=e.value}),ye(()=>e.disabled,()=>{e.disabled&&(a.value=!1)});const u=x=>{s.value&&SE(s.value.input,x)},d=()=>{var x;(x=s.value.input)===null||x===void 0||x.blur()},f=(x,I,T)=>{var M;(M=s.value.input)===null||M===void 0||M.setSelectionRange(x,I,T)},h=()=>{var x;(x=s.value.input)===null||x===void 0||x.select()};r({focus:u,blur:d,input:P(()=>{var x;return(x=s.value.input)===null||x===void 0?void 0:x.input}),stateValue:l,setSelectionRange:f,select:h});const v=x=>{i("change",x)},g=(x,I)=>{l.value!==x&&(e.value===void 0?l.value=x:rt(()=>{var T;s.value.input.value!==l.value&&((T=c.value)===null||T===void 0||T.$forceUpdate())}),rt(()=>{I&&I()}))},b=x=>{const{value:I}=x.target;if(l.value===I)return;const T=x.target.value;cc(s.value.input,x,v),g(T)},y=x=>{x.keyCode===13&&i("pressEnter",x),i("keydown",x)},S=x=>{a.value=!0,i("focus",x)},$=x=>{a.value=!1,i("blur",x)},w=x=>{cc(s.value.input,x,v),g("",()=>{u()})},C=()=>{var x,I;const{addonBefore:T=n.addonBefore,addonAfter:M=n.addonAfter,disabled:E,valueModifiers:A={},htmlSize:R,autocomplete:z,prefixCls:_,inputClassName:D,prefix:N=(x=n.prefix)===null||x===void 0?void 0:x.call(n),suffix:k=(I=n.suffix)===null||I===void 0?void 0:I.call(n),allowClear:F,type:L="text"}=e,H=ot(e,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","size","bordered","htmlSize","lazy","showCount","valueModifiers","showCount","affixWrapperClassName","groupClassName","inputClassName","wrapperClassName"]),j=m(m(m({},H),o),{autocomplete:z,onChange:b,onInput:b,onFocus:S,onBlur:$,onKeydown:y,class:le(_,{[`${_}-disabled`]:E},D,!Wd({addonAfter:M,addonBefore:T})&&!W1({prefix:N,suffix:k,allowClear:F})&&o.class),ref:s,key:"ant-input",size:R,type:L,lazy:e.lazy});return A.lazy&&delete j.onInput,j.autofocus||delete j.autofocus,p(ss,ot(j,["size"]),null)},O=()=>{var x;const{maxlength:I,suffix:T=(x=n.suffix)===null||x===void 0?void 0:x.call(n),showCount:M,prefixCls:E}=e,A=Number(I)>0;if(T||M){const R=[...P0(l.value)].length,z=typeof M=="object"?M.formatter({count:R,maxlength:I}):`${R}${A?` / ${I}`:""}`;return p(Le,null,[!!M&&p("span",{class:le(`${E}-show-count-suffix`,{[`${E}-show-count-has-suffix`]:!!T})},[z]),T])}return null};return Ke(()=>{}),()=>{const{prefixCls:x,disabled:I}=e,T=$ne(e,["prefixCls","disabled"]);return p(Sne,B(B(B({},T),o),{},{ref:c,prefixCls:x,inputElement:C(),handleReset:w,value:P0(l.value),focused:a.value,triggerFocus:u,suffix:O(),disabled:I}),n)}}}),zh=()=>ot(CE(),["wrapperClassName","groupClassName","inputClassName","affixWrapperClassName"]),xE=()=>m(m({},ot(zh(),["prefix","addonBefore","addonAfter","suffix"])),{rows:Number,autosize:{type:[Boolean,Object],default:void 0},autoSize:{type:[Boolean,Object],default:void 0},onResize:{type:Function},onCompositionstart:Nl(),onCompositionend:Nl(),valueModifiers:Object});var xne=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rfr(s.status,e.status)),{direction:u,prefixCls:d,size:f,autocomplete:h}=Ee("input",e),{compactSize:v,compactItemClassnames:g}=Yi(d,u),b=P(()=>v.value||f.value),[y,S]=$1(d),$=po();r({focus:R=>{var z;(z=l.value)===null||z===void 0||z.focus(R)},blur:()=>{var R;(R=l.value)===null||R===void 0||R.blur()},input:l,setSelectionRange:(R,z,_)=>{var D;(D=l.value)===null||D===void 0||D.setSelectionRange(R,z,_)},select:()=>{var R;(R=l.value)===null||R===void 0||R.select()}});const I=ne([]),T=()=>{I.value.push(setTimeout(()=>{var R,z,_,D;!((R=l.value)===null||R===void 0)&&R.input&&((z=l.value)===null||z===void 0?void 0:z.input.getAttribute("type"))==="password"&&(!((_=l.value)===null||_===void 0)&&_.input.hasAttribute("value"))&&((D=l.value)===null||D===void 0||D.input.removeAttribute("value"))}))};Ke(()=>{T()}),Dp(()=>{I.value.forEach(R=>clearTimeout(R))}),et(()=>{I.value.forEach(R=>clearTimeout(R))});const M=R=>{T(),i("blur",R),a.onFieldBlur()},E=R=>{T(),i("focus",R)},A=R=>{i("update:value",R.target.value),i("change",R),i("input",R),a.onFieldChange()};return()=>{var R,z,_,D,N,k;const{hasFeedback:F,feedbackIcon:L}=s,{allowClear:H,bordered:j=!0,prefix:Y=(R=n.prefix)===null||R===void 0?void 0:R.call(n),suffix:Z=(z=n.suffix)===null||z===void 0?void 0:z.call(n),addonAfter:X=(_=n.addonAfter)===null||_===void 0?void 0:_.call(n),addonBefore:ee=(D=n.addonBefore)===null||D===void 0?void 0:D.call(n),id:U=(N=a.id)===null||N===void 0?void 0:N.value}=e,Q=xne(e,["allowClear","bordered","prefix","suffix","addonAfter","addonBefore","id"]),J=(F||Z)&&p(Le,null,[Z,F&&L]),G=d.value,q=W1({prefix:Y,suffix:Z})||!!F,V=n.clearIcon||(()=>p(Wn,null,null));return y(p(Cne,B(B(B({},o),ot(Q,["onUpdate:value","onChange","onInput"])),{},{onChange:A,id:U,disabled:(k=e.disabled)!==null&&k!==void 0?k:$.value,ref:l,prefixCls:G,autocomplete:h.value,onBlur:M,onFocus:E,prefix:Y,suffix:J,allowClear:H,addonAfter:X&&p(Rc,null,{default:()=>[p(kf,null,{default:()=>[X]})]}),addonBefore:ee&&p(Rc,null,{default:()=>[p(kf,null,{default:()=>[ee]})]}),class:[o.class,g.value],inputClassName:le({[`${G}-sm`]:b.value==="small",[`${G}-lg`]:b.value==="large",[`${G}-rtl`]:u.value==="rtl",[`${G}-borderless`]:!j},!q&&Fn(G,c.value),S.value),affixWrapperClassName:le({[`${G}-affix-wrapper-sm`]:b.value==="small",[`${G}-affix-wrapper-lg`]:b.value==="large",[`${G}-affix-wrapper-rtl`]:u.value==="rtl",[`${G}-affix-wrapper-borderless`]:!j},Fn(`${G}-affix-wrapper`,c.value,F),S.value),wrapperClassName:le({[`${G}-group-rtl`]:u.value==="rtl"},S.value),groupClassName:le({[`${G}-group-wrapper-sm`]:b.value==="small",[`${G}-group-wrapper-lg`]:b.value==="large",[`${G}-group-wrapper-rtl`]:u.value==="rtl"},Fn(`${G}-group-wrapper`,c.value,F),S.value)}),m(m({},n),{clearIcon:V})))}}}),wE=re({compatConfig:{MODE:3},name:"AInputGroup",inheritAttrs:!1,props:{prefixCls:String,size:{type:String},compact:{type:Boolean,default:void 0}},setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i,getPrefixCls:l}=Ee("input-group",e),a=yn.useInject();yn.useProvide(a,{isFormItemInput:!1});const s=P(()=>l("input")),[c,u]=$1(s),d=P(()=>{const f=r.value;return{[`${f}`]:!0,[u.value]:!0,[`${f}-lg`]:e.size==="large",[`${f}-sm`]:e.size==="small",[`${f}-compact`]:e.compact,[`${f}-rtl`]:i.value==="rtl"}});return()=>{var f;return c(p("span",B(B({},o),{},{class:le(d.value,o.class)}),[(f=n.default)===null||f===void 0?void 0:f.call(n)]))}}});var wne=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{var C;(C=l.value)===null||C===void 0||C.focus()},blur:()=>{var C;(C=l.value)===null||C===void 0||C.blur()}});const u=C=>{i("update:value",C.target.value),C&&C.target&&C.type==="click"&&i("search",C.target.value,C),i("change",C)},d=C=>{var O;document.activeElement===((O=l.value)===null||O===void 0?void 0:O.input)&&C.preventDefault()},f=C=>{var O,x;i("search",(x=(O=l.value)===null||O===void 0?void 0:O.input)===null||x===void 0?void 0:x.stateValue,C)},h=C=>{a.value||e.loading||f(C)},v=C=>{a.value=!0,i("compositionstart",C)},g=C=>{a.value=!1,i("compositionend",C)},{prefixCls:b,getPrefixCls:y,direction:S,size:$}=Ee("input-search",e),w=P(()=>y("input",e.inputPrefixCls));return()=>{var C,O,x,I;const{disabled:T,loading:M,addonAfter:E=(C=n.addonAfter)===null||C===void 0?void 0:C.call(n),suffix:A=(O=n.suffix)===null||O===void 0?void 0:O.call(n)}=e,R=wne(e,["disabled","loading","addonAfter","suffix"]);let{enterButton:z=(I=(x=n.enterButton)===null||x===void 0?void 0:x.call(n))!==null&&I!==void 0?I:!1}=e;z=z||z==="";const _=typeof z=="boolean"?p(Ar,null,null):null,D=`${b.value}-button`,N=Array.isArray(z)?z[0]:z;let k;const F=N.type&&_y(N.type)&&N.type.__ANT_BUTTON;if(F||N.tagName==="button")k=pt(N,m({onMousedown:d,onClick:f,key:"enterButton"},F?{class:D,size:$.value}:{}),!1);else{const H=_&&!z;k=p(Wt,{class:D,type:z?"primary":void 0,size:$.value,disabled:T,key:"enterButton",onMousedown:d,onClick:f,loading:M,icon:H?_:null},{default:()=>[H?null:_||z]})}E&&(k=[k,E]);const L=le(b.value,{[`${b.value}-rtl`]:S.value==="rtl",[`${b.value}-${$.value}`]:!!$.value,[`${b.value}-with-button`]:!!z},o.class);return p(un,B(B(B({ref:l},ot(R,["onUpdate:value","onSearch","enterButton"])),o),{},{onPressEnter:h,onCompositionstart:v,onCompositionend:g,size:$.value,prefixCls:w.value,addonAfter:k,suffix:A,onChange:u,class:L,disabled:T}),n)}}}),_2=e=>e!=null&&(Array.isArray(e)?kt(e).length:!0);function One(e){return _2(e.addonBefore)||_2(e.addonAfter)}const Pne=["text","input"],Ine=re({compatConfig:{MODE:3},name:"ClearableLabeledInput",inheritAttrs:!1,props:{prefixCls:String,inputType:K.oneOf(Mn("text","input")),value:It(),defaultValue:It(),allowClear:{type:Boolean,default:void 0},element:It(),handleReset:Function,disabled:{type:Boolean,default:void 0},direction:{type:String},size:{type:String},suffix:It(),prefix:It(),addonBefore:It(),addonAfter:It(),readonly:{type:Boolean,default:void 0},focused:{type:Boolean,default:void 0},bordered:{type:Boolean,default:!0},triggerFocus:{type:Function},hidden:Boolean,status:String,hashId:String},setup(e,t){let{slots:n,attrs:o}=t;const r=yn.useInject(),i=a=>{const{value:s,disabled:c,readonly:u,handleReset:d,suffix:f=n.suffix}=e,h=!c&&!u&&s,v=`${a}-clear-icon`;return p(Wn,{onClick:d,onMousedown:g=>g.preventDefault(),class:le({[`${v}-hidden`]:!h,[`${v}-has-suffix`]:!!f},v),role:"button"},null)},l=(a,s)=>{const{value:c,allowClear:u,direction:d,bordered:f,hidden:h,status:v,addonAfter:g=n.addonAfter,addonBefore:b=n.addonBefore,hashId:y}=e,{status:S,hasFeedback:$}=r;if(!u)return pt(s,{value:c,disabled:e.disabled});const w=le(`${a}-affix-wrapper`,`${a}-affix-wrapper-textarea-with-clear-btn`,Fn(`${a}-affix-wrapper`,fr(S,v),$),{[`${a}-affix-wrapper-rtl`]:d==="rtl",[`${a}-affix-wrapper-borderless`]:!f,[`${o.class}`]:!One({addonAfter:g,addonBefore:b})&&o.class},y);return p("span",{class:w,style:o.style,hidden:h},[pt(s,{style:null,value:c,disabled:e.disabled}),i(a)])};return()=>{var a;const{prefixCls:s,inputType:c,element:u=(a=n.element)===null||a===void 0?void 0:a.call(n)}=e;return c===Pne[0]?l(s,u):null}}}),Tne=` + min-height:0 !important; + max-height:none !important; + height:0 !important; + visibility:hidden !important; + overflow:hidden !important; + position:absolute !important; + z-index:-1000 !important; + top:0 !important; + right:0 !important; + pointer-events: none !important; +`,Ene=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],Rv={};let No;function _ne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const n=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&Rv[n])return Rv[n];const o=window.getComputedStyle(e),r=o.getPropertyValue("box-sizing")||o.getPropertyValue("-moz-box-sizing")||o.getPropertyValue("-webkit-box-sizing"),i=parseFloat(o.getPropertyValue("padding-bottom"))+parseFloat(o.getPropertyValue("padding-top")),l=parseFloat(o.getPropertyValue("border-bottom-width"))+parseFloat(o.getPropertyValue("border-top-width")),s={sizingStyle:Ene.map(c=>`${c}:${o.getPropertyValue(c)}`).join(";"),paddingSize:i,borderSize:l,boxSizing:r};return t&&n&&(Rv[n]=s),s}function Mne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;No||(No=document.createElement("textarea"),No.setAttribute("tab-index","-1"),No.setAttribute("aria-hidden","true"),document.body.appendChild(No)),e.getAttribute("wrap")?No.setAttribute("wrap",e.getAttribute("wrap")):No.removeAttribute("wrap");const{paddingSize:r,borderSize:i,boxSizing:l,sizingStyle:a}=_ne(e,t);No.setAttribute("style",`${a};${Tne}`),No.value=e.value||e.placeholder||"";let s,c,u,d=No.scrollHeight;if(l==="border-box"?d+=i:l==="content-box"&&(d-=r),n!==null||o!==null){No.value=" ";const h=No.scrollHeight-r;n!==null&&(s=h*n,l==="border-box"&&(s=s+r+i),d=Math.max(s,d)),o!==null&&(c=h*o,l==="border-box"&&(c=c+r+i),u=d>c?"":"hidden",d=Math.min(c,d))}const f={height:`${d}px`,overflowY:u,resize:"none"};return s&&(f.minHeight=`${s}px`),c&&(f.maxHeight=`${c}px`),f}const Dv=0,Bv=1,Nv=2,Ane=re({compatConfig:{MODE:3},name:"ResizableTextArea",inheritAttrs:!1,props:xE(),setup(e,t){let{attrs:n,emit:o,expose:r}=t,i,l;const a=ne(),s=ne({}),c=ne(Nv);et(()=>{Ze.cancel(i),Ze.cancel(l)});const u=()=>{try{if(a.value&&document.activeElement===a.value.input){const O=a.value.getSelectionStart(),x=a.value.getSelectionEnd(),I=a.value.getScrollTop();a.value.setSelectionRange(O,x),a.value.setScrollTop(I)}}catch{}},d=ne(),f=ne();Ve(()=>{const O=e.autoSize||e.autosize;O?(d.value=O.minRows,f.value=O.maxRows):(d.value=void 0,f.value=void 0)});const h=P(()=>!!(e.autoSize||e.autosize)),v=()=>{c.value=Dv};ye([()=>e.value,d,f,h],()=>{h.value&&v()},{immediate:!0});const g=ne();ye([c,a],()=>{if(a.value)if(c.value===Dv)c.value=Bv;else if(c.value===Bv){const O=Mne(a.value.input,!1,d.value,f.value);c.value=Nv,g.value=O}else u()},{immediate:!0,flush:"post"});const b=On(),y=ne(),S=()=>{Ze.cancel(y.value)},$=O=>{c.value===Nv&&(o("resize",O),h.value&&(S(),y.value=Ze(()=>{v()})))};et(()=>{S()}),r({resizeTextarea:()=>{v()},textArea:P(()=>{var O;return(O=a.value)===null||O===void 0?void 0:O.input}),instance:b}),Po(e.autosize===void 0);const C=()=>{const{prefixCls:O,disabled:x}=e,I=ot(e,["prefixCls","onPressEnter","autoSize","autosize","defaultValue","allowClear","type","maxlength","valueModifiers"]),T=le(O,n.class,{[`${O}-disabled`]:x}),M=h.value?g.value:null,E=[n.style,s.value,M],A=m(m(m({},I),n),{style:E,class:T});return(c.value===Dv||c.value===Bv)&&E.push({overflowX:"hidden",overflowY:"hidden"}),A.autofocus||delete A.autofocus,A.rows===0&&delete A.rows,p(Vo,{onResize:$,disabled:!h.value},{default:()=>[p(ss,B(B({},A),{},{ref:a,tag:"textarea"}),null)]})};return()=>C()}});function PE(e,t){return[...e||""].slice(0,t).join("")}function M2(e,t,n,o){let r=n;return e?r=PE(n,o):[...t||""].lengtho&&(r=t),r}const K1=re({compatConfig:{MODE:3},name:"ATextarea",inheritAttrs:!1,props:xE(),setup(e,t){let{attrs:n,expose:o,emit:r}=t;var i;const l=an(),a=yn.useInject(),s=P(()=>fr(a.status,e.status)),c=oe((i=e.value)!==null&&i!==void 0?i:e.defaultValue),u=oe(),d=oe(""),{prefixCls:f,size:h,direction:v}=Ee("input",e),[g,b]=$1(f),y=po(),S=P(()=>e.showCount===""||e.showCount||!1),$=P(()=>Number(e.maxlength)>0),w=oe(!1),C=oe(),O=oe(0),x=F=>{w.value=!0,C.value=d.value,O.value=F.currentTarget.selectionStart,r("compositionstart",F)},I=F=>{var L;w.value=!1;let H=F.currentTarget.value;if($.value){const j=O.value>=e.maxlength+1||O.value===((L=C.value)===null||L===void 0?void 0:L.length);H=M2(j,C.value,H,e.maxlength)}H!==d.value&&(A(H),cc(F.currentTarget,F,_,H)),r("compositionend",F)},T=On();ye(()=>e.value,()=>{var F;"value"in T.vnode.props,c.value=(F=e.value)!==null&&F!==void 0?F:""});const M=F=>{var L;SE((L=u.value)===null||L===void 0?void 0:L.textArea,F)},E=()=>{var F,L;(L=(F=u.value)===null||F===void 0?void 0:F.textArea)===null||L===void 0||L.blur()},A=(F,L)=>{c.value!==F&&(e.value===void 0?c.value=F:rt(()=>{var H,j,Y;u.value.textArea.value!==d.value&&((Y=(H=u.value)===null||H===void 0?void 0:(j=H.instance).update)===null||Y===void 0||Y.call(j))}),rt(()=>{L&&L()}))},R=F=>{F.keyCode===13&&r("pressEnter",F),r("keydown",F)},z=F=>{const{onBlur:L}=e;L==null||L(F),l.onFieldBlur()},_=F=>{r("update:value",F.target.value),r("change",F),r("input",F),l.onFieldChange()},D=F=>{cc(u.value.textArea,F,_),A("",()=>{M()})},N=F=>{let L=F.target.value;if(c.value!==L){if($.value){const H=F.target,j=H.selectionStart>=e.maxlength+1||H.selectionStart===L.length||!H.selectionStart;L=M2(j,d.value,L,e.maxlength)}cc(F.currentTarget,F,_,L),A(L)}},k=()=>{var F,L;const{class:H}=n,{bordered:j=!0}=e,Y=m(m(m({},ot(e,["allowClear"])),n),{class:[{[`${f.value}-borderless`]:!j,[`${H}`]:H&&!S.value,[`${f.value}-sm`]:h.value==="small",[`${f.value}-lg`]:h.value==="large"},Fn(f.value,s.value),b.value],disabled:y.value,showCount:null,prefixCls:f.value,onInput:N,onChange:N,onBlur:z,onKeydown:R,onCompositionstart:x,onCompositionend:I});return!((F=e.valueModifiers)===null||F===void 0)&&F.lazy&&delete Y.onInput,p(Ane,B(B({},Y),{},{id:(L=Y==null?void 0:Y.id)!==null&&L!==void 0?L:l.id.value,ref:u,maxlength:e.maxlength,lazy:e.lazy}),null)};return o({focus:M,blur:E,resizableTextArea:u}),Ve(()=>{let F=P0(c.value);!w.value&&$.value&&(e.value===null||e.value===void 0)&&(F=PE(F,e.maxlength)),d.value=F}),()=>{var F;const{maxlength:L,bordered:H=!0,hidden:j}=e,{style:Y,class:Z}=n,X=m(m(m({},e),n),{prefixCls:f.value,inputType:"text",handleReset:D,direction:v.value,bordered:H,style:S.value?void 0:Y,hashId:b.value,disabled:(F=e.disabled)!==null&&F!==void 0?F:y.value});let ee=p(Ine,B(B({},X),{},{value:d.value,status:e.status}),{element:k});if(S.value||a.hasFeedback){const U=[...d.value].length;let Q="";typeof S.value=="object"?Q=S.value.formatter({value:d.value,count:U,maxlength:L}):Q=`${U}${$.value?` / ${L}`:""}`,ee=p("div",{hidden:j,class:le(`${f.value}-textarea`,{[`${f.value}-textarea-rtl`]:v.value==="rtl",[`${f.value}-textarea-show-count`]:S.value,[`${f.value}-textarea-in-form-item`]:a.isFormItemInput},`${f.value}-textarea-show-count`,Z,b.value),style:Y,"data-count":typeof Q!="object"?Q:void 0},[ee,a.hasFeedback&&p("span",{class:`${f.value}-textarea-suffix`},[a.feedbackIcon])])}return g(ee)}}});var Rne={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"};function A2(e){for(var t=1;tp(e?hu:G1,null,null),IE=re({compatConfig:{MODE:3},name:"AInputPassword",inheritAttrs:!1,props:m(m({},zh()),{prefixCls:String,inputPrefixCls:String,action:{type:String,default:"click"},visibilityToggle:{type:Boolean,default:!0},visible:{type:Boolean,default:void 0},"onUpdate:visible":Function,iconRender:Function}),setup(e,t){let{slots:n,attrs:o,expose:r,emit:i}=t;const l=oe(!1),a=()=>{const{disabled:b}=e;b||(l.value=!l.value,i("update:visible",l.value))};Ve(()=>{e.visible!==void 0&&(l.value=!!e.visible)});const s=oe();r({focus:()=>{var b;(b=s.value)===null||b===void 0||b.focus()},blur:()=>{var b;(b=s.value)===null||b===void 0||b.blur()}});const d=b=>{const{action:y,iconRender:S=n.iconRender||Lne}=e,$=Fne[y]||"",w=S(l.value),C={[$]:a,class:`${b}-icon`,key:"passwordIcon",onMousedown:O=>{O.preventDefault()},onMouseup:O=>{O.preventDefault()}};return pt(qt(w)?w:p("span",null,[w]),C)},{prefixCls:f,getPrefixCls:h}=Ee("input-password",e),v=P(()=>h("input",e.inputPrefixCls)),g=()=>{const{size:b,visibilityToggle:y}=e,S=kne(e,["size","visibilityToggle"]),$=y&&d(f.value),w=le(f.value,o.class,{[`${f.value}-${b}`]:!!b}),C=m(m(m({},ot(S,["suffix","iconRender","action"])),o),{type:l.value?"text":"password",class:w,prefixCls:v.value,suffix:$});return b&&(C.size=b),p(un,B({ref:s},C),n)};return()=>g()}});un.Group=wE;un.Search=OE;un.TextArea=K1;un.Password=IE;un.install=function(e){return e.component(un.name,un),e.component(un.Group.name,un.Group),e.component(un.Search.name,un.Search),e.component(un.TextArea.name,un.TextArea),e.component(un.Password.name,un.Password),e};function Hh(){return{keyboard:{type:Boolean,default:void 0},mask:{type:Boolean,default:void 0},afterClose:Function,closable:{type:Boolean,default:void 0},maskClosable:{type:Boolean,default:void 0},visible:{type:Boolean,default:void 0},destroyOnClose:{type:Boolean,default:void 0},mousePosition:K.shape({x:Number,y:Number}).loose,title:K.any,footer:K.any,transitionName:String,maskTransitionName:String,animation:K.any,maskAnimation:K.any,wrapStyle:{type:Object,default:void 0},bodyStyle:{type:Object,default:void 0},maskStyle:{type:Object,default:void 0},prefixCls:String,wrapClassName:String,rootClassName:String,width:[String,Number],height:[String,Number],zIndex:Number,bodyProps:K.any,maskProps:K.any,wrapProps:K.any,getContainer:K.any,dialogStyle:{type:Object,default:void 0},dialogClass:String,closeIcon:K.any,forceRender:{type:Boolean,default:void 0},getOpenCount:Function,focusTriggerAfterClose:{type:Boolean,default:void 0},onClose:Function,modalRender:Function}}function D2(e,t,n){let o=t;return!o&&n&&(o=`${e}-${n}`),o}let B2=-1;function zne(){return B2+=1,B2}function N2(e,t){let n=e[`page${t?"Y":"X"}Offset`];const o=`scroll${t?"Top":"Left"}`;if(typeof n!="number"){const r=e.document;n=r.documentElement[o],typeof n!="number"&&(n=r.body[o])}return n}function Hne(e){const t=e.getBoundingClientRect(),n={left:t.left,top:t.top},o=e.ownerDocument,r=o.defaultView||o.parentWindow;return n.left+=N2(r),n.top+=N2(r,!0),n}const jne={width:0,height:0,overflow:"hidden",outline:"none"},Vne={outline:"none"},Wne=re({compatConfig:{MODE:3},name:"DialogContent",inheritAttrs:!1,props:m(m({},Hh()),{motionName:String,ariaId:String,onVisibleChanged:Function,onMousedown:Function,onMouseup:Function}),setup(e,t){let{expose:n,slots:o,attrs:r}=t;const i=ne(),l=ne(),a=ne();n({focus:()=>{var f;(f=i.value)===null||f===void 0||f.focus({preventScroll:!0})},changeActive:f=>{const{activeElement:h}=document;f&&h===l.value?i.value.focus({preventScroll:!0}):!f&&h===i.value&&l.value.focus({preventScroll:!0})}});const s=ne(),c=P(()=>{const{width:f,height:h}=e,v={};return f!==void 0&&(v.width=typeof f=="number"?`${f}px`:f),h!==void 0&&(v.height=typeof h=="number"?`${h}px`:h),s.value&&(v.transformOrigin=s.value),v}),u=()=>{rt(()=>{if(a.value){const f=Hne(a.value);s.value=e.mousePosition?`${e.mousePosition.x-f.left}px ${e.mousePosition.y-f.top}px`:""}})},d=f=>{e.onVisibleChanged(f)};return()=>{var f,h,v,g;const{prefixCls:b,footer:y=(f=o.footer)===null||f===void 0?void 0:f.call(o),title:S=(h=o.title)===null||h===void 0?void 0:h.call(o),ariaId:$,closable:w,closeIcon:C=(v=o.closeIcon)===null||v===void 0?void 0:v.call(o),onClose:O,bodyStyle:x,bodyProps:I,onMousedown:T,onMouseup:M,visible:E,modalRender:A=o.modalRender,destroyOnClose:R,motionName:z}=e;let _;y&&(_=p("div",{class:`${b}-footer`},[y]));let D;S&&(D=p("div",{class:`${b}-header`},[p("div",{class:`${b}-title`,id:$},[S])]));let N;w&&(N=p("button",{type:"button",onClick:O,"aria-label":"Close",class:`${b}-close`},[C||p("span",{class:`${b}-close-x`},null)]));const k=p("div",{class:`${b}-content`},[N,D,p("div",B({class:`${b}-body`,style:x},I),[(g=o.default)===null||g===void 0?void 0:g.call(o)]),_]),F=Go(z);return p(bn,B(B({},F),{},{onBeforeEnter:u,onAfterEnter:()=>d(!0),onAfterLeave:()=>d(!1)}),{default:()=>[E||!R?Ln(p("div",B(B({},r),{},{ref:a,key:"dialog-element",role:"document",style:[c.value,r.style],class:[b,r.class],onMousedown:T,onMouseup:M}),[p("div",{tabindex:0,ref:i,style:Vne},[A?A({originVNode:k}):k]),p("div",{tabindex:0,ref:l,style:jne},null)]),[[Qn,E]]):null]})}}}),Kne=re({compatConfig:{MODE:3},name:"DialogMask",props:{prefixCls:String,visible:Boolean,motionName:String,maskProps:Object},setup(e,t){return()=>{const{prefixCls:n,visible:o,maskProps:r,motionName:i}=e,l=Go(i);return p(bn,l,{default:()=>[Ln(p("div",B({class:`${n}-mask`},r),null),[[Qn,o]])]})}}}),k2=re({compatConfig:{MODE:3},name:"VcDialog",inheritAttrs:!1,props:Qe(m(m({},Hh()),{getOpenCount:Function,scrollLocker:Object}),{mask:!0,visible:!1,keyboard:!0,closable:!0,maskClosable:!0,destroyOnClose:!1,prefixCls:"rc-dialog",getOpenCount:()=>null,focusTriggerAfterClose:!0}),setup(e,t){let{attrs:n,slots:o}=t;const r=oe(),i=oe(),l=oe(),a=oe(e.visible),s=oe(`vcDialogTitle${zne()}`),c=y=>{var S,$;if(y)Ti(i.value,document.activeElement)||(r.value=document.activeElement,(S=l.value)===null||S===void 0||S.focus());else{const w=a.value;if(a.value=!1,e.mask&&r.value&&e.focusTriggerAfterClose){try{r.value.focus({preventScroll:!0})}catch{}r.value=null}w&&(($=e.afterClose)===null||$===void 0||$.call(e))}},u=y=>{var S;(S=e.onClose)===null||S===void 0||S.call(e,y)},d=oe(!1),f=oe(),h=()=>{clearTimeout(f.value),d.value=!0},v=()=>{f.value=setTimeout(()=>{d.value=!1})},g=y=>{if(!e.maskClosable)return null;d.value?d.value=!1:i.value===y.target&&u(y)},b=y=>{if(e.keyboard&&y.keyCode===Ie.ESC){y.stopPropagation(),u(y);return}e.visible&&y.keyCode===Ie.TAB&&l.value.changeActive(!y.shiftKey)};return ye(()=>e.visible,()=>{e.visible&&(a.value=!0)},{flush:"post"}),et(()=>{var y;clearTimeout(f.value),(y=e.scrollLocker)===null||y===void 0||y.unLock()}),Ve(()=>{var y,S;(y=e.scrollLocker)===null||y===void 0||y.unLock(),a.value&&((S=e.scrollLocker)===null||S===void 0||S.lock())}),()=>{const{prefixCls:y,mask:S,visible:$,maskTransitionName:w,maskAnimation:C,zIndex:O,wrapClassName:x,rootClassName:I,wrapStyle:T,closable:M,maskProps:E,maskStyle:A,transitionName:R,animation:z,wrapProps:_,title:D=o.title}=e,{style:N,class:k}=n;return p("div",B({class:[`${y}-root`,I]},Ui(e,{data:!0})),[p(Kne,{prefixCls:y,visible:S&&$,motionName:D2(y,w,C),style:m({zIndex:O},A),maskProps:E},null),p("div",B({tabIndex:-1,onKeydown:b,class:le(`${y}-wrap`,x),ref:i,onClick:g,role:"dialog","aria-labelledby":D?s.value:null,style:m(m({zIndex:O},T),{display:a.value?null:"none"})},_),[p(Wne,B(B({},ot(e,["scrollLocker"])),{},{style:N,class:k,onMousedown:h,onMouseup:v,ref:l,closable:M,ariaId:s.value,prefixCls:y,visible:$,onClose:u,onVisibleChanged:c,motionName:D2(y,R,z)}),o)])])}}}),Gne=Hh(),TE=re({compatConfig:{MODE:3},name:"DialogWrap",inheritAttrs:!1,props:Qe(Gne,{visible:!1}),setup(e,t){let{attrs:n,slots:o}=t;const r=ne(e.visible);return dy({},{inTriggerContext:!1}),ye(()=>e.visible,()=>{e.visible&&(r.value=!0)},{flush:"post"}),()=>{const{visible:i,getContainer:l,forceRender:a,destroyOnClose:s=!1,afterClose:c}=e;let u=m(m(m({},e),n),{ref:"_component",key:"dialog"});return l===!1?p(k2,B(B({},u),{},{getOpenCount:()=>2}),o):!a&&s&&!r.value?null:p(Zc,{autoLock:!0,visible:i,forceRender:a,getContainer:l},{default:d=>(u=m(m(m({},u),d),{afterClose:()=>{c==null||c(),r.value=!1}}),p(k2,u,o))})}}});function Une(e){const t=ne(null),n=ft(m({},e)),o=ne([]),r=i=>{t.value===null&&(o.value=[],t.value=Ze(()=>{let l;o.value.forEach(a=>{l=m(m({},l),a)}),m(n,l),t.value=null})),o.value.push(i)};return Ke(()=>{t.value&&Ze.cancel(t.value)}),[n,r]}function F2(e,t,n,o){const r=t+n,i=(n-o)/2;if(n>o){if(t>0)return{[e]:i};if(t<0&&ro)return{[e]:t<0?i:-i};return{}}function Xne(e,t,n,o){const{width:r,height:i}=DL();let l=null;return e<=r&&t<=i?l={x:0,y:0}:(e>r||t>i)&&(l=m(m({},F2("x",n,e,r)),F2("y",o,t,i))),l}var Yne=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{Ye(L2,e)},inject:()=>Ge(L2,{isPreviewGroup:oe(!1),previewUrls:P(()=>new Map),setPreviewUrls:()=>{},current:ne(null),setCurrent:()=>{},setShowPreview:()=>{},setMousePosition:()=>{},registerImage:null,rootClassName:""})},qne=()=>({previewPrefixCls:String,preview:{type:[Boolean,Object],default:!0},icons:{type:Object,default:()=>({})}}),EE=re({compatConfig:{MODE:3},name:"PreviewGroup",inheritAttrs:!1,props:qne(),setup(e,t){let{slots:n}=t;const o=P(()=>{const C={visible:void 0,onVisibleChange:()=>{},getContainer:void 0,current:0};return typeof e.preview=="object"?AE(e.preview,C):C}),r=ft(new Map),i=ne(),l=P(()=>o.value.visible),a=P(()=>o.value.getContainer),s=(C,O)=>{var x,I;(I=(x=o.value).onVisibleChange)===null||I===void 0||I.call(x,C,O)},[c,u]=Dt(!!l.value,{value:l,onChange:s}),d=ne(null),f=P(()=>l.value!==void 0),h=P(()=>Array.from(r.keys())),v=P(()=>h.value[o.value.current]),g=P(()=>new Map(Array.from(r).filter(C=>{let[,{canPreview:O}]=C;return!!O}).map(C=>{let[O,{url:x}]=C;return[O,x]}))),b=function(C,O){let x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;r.set(C,{url:O,canPreview:x})},y=C=>{i.value=C},S=C=>{d.value=C},$=function(C,O){let x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;const I=()=>{r.delete(C)};return r.set(C,{url:O,canPreview:x}),I},w=C=>{C==null||C.stopPropagation(),u(!1),S(null)};return ye(v,C=>{y(C)},{immediate:!0,flush:"post"}),Ve(()=>{c.value&&f.value&&y(v.value)},{flush:"post"}),U1.provide({isPreviewGroup:oe(!0),previewUrls:g,setPreviewUrls:b,current:i,setCurrent:y,setShowPreview:u,setMousePosition:S,registerImage:$}),()=>{const C=Yne(o.value,[]);return p(Le,null,[n.default&&n.default(),p(_E,B(B({},C),{},{"ria-hidden":!c.value,visible:c.value,prefixCls:e.previewPrefixCls,onClose:w,mousePosition:d.value,src:g.value.get(i.value),icons:e.icons,getContainer:a.value}),null)])}}}),al={x:0,y:0},Jne=m(m({},Hh()),{src:String,alt:String,rootClassName:String,icons:{type:Object,default:()=>({})}}),_E=re({compatConfig:{MODE:3},name:"Preview",inheritAttrs:!1,props:Jne,emits:["close","afterClose"],setup(e,t){let{emit:n,attrs:o}=t;const{rotateLeft:r,rotateRight:i,zoomIn:l,zoomOut:a,close:s,left:c,right:u,flipX:d,flipY:f}=ft(e.icons),h=oe(1),v=oe(0),g=ft({x:1,y:1}),[b,y]=Une(al),S=()=>n("close"),$=oe(),w=ft({originX:0,originY:0,deltaX:0,deltaY:0}),C=oe(!1),O=U1.inject(),{previewUrls:x,current:I,isPreviewGroup:T,setCurrent:M}=O,E=P(()=>x.value.size),A=P(()=>Array.from(x.value.keys())),R=P(()=>A.value.indexOf(I.value)),z=P(()=>T.value?x.value.get(I.value):e.src),_=P(()=>T.value&&E.value>1),D=oe({wheelDirection:0}),N=()=>{h.value=1,v.value=0,g.x=1,g.y=1,y(al),n("afterClose")},k=ae=>{ae?h.value+=.5:h.value++,y(al)},F=ae=>{h.value>1&&(ae?h.value-=.5:h.value--),y(al)},L=()=>{v.value+=90},H=()=>{v.value-=90},j=()=>{g.x=-g.x},Y=()=>{g.y=-g.y},Z=ae=>{ae.preventDefault(),ae.stopPropagation(),R.value>0&&M(A.value[R.value-1])},X=ae=>{ae.preventDefault(),ae.stopPropagation(),R.valuek(),type:"zoomIn"},{icon:a,onClick:()=>F(),type:"zoomOut",disabled:P(()=>h.value===1)},{icon:i,onClick:L,type:"rotateRight"},{icon:r,onClick:H,type:"rotateLeft"},{icon:d,onClick:j,type:"flipX"},{icon:f,onClick:Y,type:"flipY"}],G=()=>{if(e.visible&&C.value){const ae=$.value.offsetWidth*h.value,ce=$.value.offsetHeight*h.value,{left:se,top:pe}=Af($.value),he=v.value%180!==0;C.value=!1;const ge=Xne(he?ce:ae,he?ae:ce,se,pe);ge&&y(m({},ge))}},q=ae=>{ae.button===0&&(ae.preventDefault(),ae.stopPropagation(),w.deltaX=ae.pageX-b.x,w.deltaY=ae.pageY-b.y,w.originX=b.x,w.originY=b.y,C.value=!0)},V=ae=>{e.visible&&C.value&&y({x:ae.pageX-w.deltaX,y:ae.pageY-w.deltaY})},W=ae=>{if(!e.visible)return;ae.preventDefault();const ce=ae.deltaY;D.value={wheelDirection:ce}},te=ae=>{!e.visible||!_.value||(ae.preventDefault(),ae.keyCode===Ie.LEFT?R.value>0&&M(A.value[R.value-1]):ae.keyCode===Ie.RIGHT&&R.value{e.visible&&(h.value!==1&&(h.value=1),(b.x!==al.x||b.y!==al.y)&&y(al))};let ie=()=>{};return Ke(()=>{ye([()=>e.visible,C],()=>{ie();let ae,ce;const se=Nt(window,"mouseup",G,!1),pe=Nt(window,"mousemove",V,!1),he=Nt(window,"wheel",W,{passive:!1}),ge=Nt(window,"keydown",te,!1);try{window.top!==window.self&&(ae=Nt(window.top,"mouseup",G,!1),ce=Nt(window.top,"mousemove",V,!1))}catch{}ie=()=>{se.remove(),pe.remove(),he.remove(),ge.remove(),ae&&ae.remove(),ce&&ce.remove()}},{flush:"post",immediate:!0}),ye([D],()=>{const{wheelDirection:ae}=D.value;ae>0?F(!0):ae<0&&k(!0)})}),wn(()=>{ie()}),()=>{const{visible:ae,prefixCls:ce,rootClassName:se}=e;return p(TE,B(B({},o),{},{transitionName:e.transitionName,maskTransitionName:e.maskTransitionName,closable:!1,keyboard:!0,prefixCls:ce,onClose:S,afterClose:N,visible:ae,wrapClassName:ee,rootClassName:se,getContainer:e.getContainer}),{default:()=>[p("div",{class:[`${e.prefixCls}-operations-wrapper`,se]},[p("ul",{class:`${e.prefixCls}-operations`},[J.map(pe=>{let{icon:he,onClick:ge,type:me,disabled:xe}=pe;return p("li",{class:le(U,{[`${e.prefixCls}-operations-operation-disabled`]:xe&&(xe==null?void 0:xe.value)}),onClick:ge,key:me},[mn(he,{class:Q})])})])]),p("div",{class:`${e.prefixCls}-img-wrapper`,style:{transform:`translate3d(${b.x}px, ${b.y}px, 0)`}},[p("img",{onMousedown:q,onDblclick:ue,ref:$,class:`${e.prefixCls}-img`,src:z.value,alt:e.alt,style:{transform:`scale3d(${g.x*h.value}, ${g.y*h.value}, 1) rotate(${v.value}deg)`}},null)]),_.value&&p("div",{class:le(`${e.prefixCls}-switch-left`,{[`${e.prefixCls}-switch-left-disabled`]:R.value<=0}),onClick:Z},[c]),_.value&&p("div",{class:le(`${e.prefixCls}-switch-right`,{[`${e.prefixCls}-switch-right-disabled`]:R.value>=E.value-1}),onClick:X},[u])]})}}});var Zne=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({src:String,wrapperClassName:String,wrapperStyle:{type:Object,default:void 0},rootClassName:String,prefixCls:String,previewPrefixCls:String,width:[Number,String],height:[Number,String],previewMask:{type:[Boolean,Function],default:void 0},placeholder:K.any,fallback:String,preview:{type:[Boolean,Object],default:!0},onClick:{type:Function},onError:{type:Function}}),AE=(e,t)=>{const n=m({},e);return Object.keys(t).forEach(o=>{e[o]===void 0&&(n[o]=t[o])}),n};let Qne=0;const RE=re({compatConfig:{MODE:3},name:"VcImage",inheritAttrs:!1,props:ME(),emits:["click","error"],setup(e,t){let{attrs:n,slots:o,emit:r}=t;const i=P(()=>e.prefixCls),l=P(()=>`${i.value}-preview`),a=P(()=>{const k={visible:void 0,onVisibleChange:()=>{},getContainer:void 0};return typeof e.preview=="object"?AE(e.preview,k):k}),s=P(()=>{var k;return(k=a.value.src)!==null&&k!==void 0?k:e.src}),c=P(()=>e.placeholder&&e.placeholder!==!0||o.placeholder),u=P(()=>a.value.visible),d=P(()=>a.value.getContainer),f=P(()=>u.value!==void 0),h=(k,F)=>{var L,H;(H=(L=a.value).onVisibleChange)===null||H===void 0||H.call(L,k,F)},[v,g]=Dt(!!u.value,{value:u,onChange:h}),b=ne(c.value?"loading":"normal");ye(()=>e.src,()=>{b.value=c.value?"loading":"normal"});const y=ne(null),S=P(()=>b.value==="error"),$=U1.inject(),{isPreviewGroup:w,setCurrent:C,setShowPreview:O,setMousePosition:x,registerImage:I}=$,T=ne(Qne++),M=P(()=>e.preview&&!S.value),E=()=>{b.value="normal"},A=k=>{b.value="error",r("error",k)},R=k=>{if(!f.value){const{left:F,top:L}=Af(k.target);w.value?(C(T.value),x({x:F,y:L})):y.value={x:F,y:L}}w.value?O(!0):g(!0),r("click",k)},z=()=>{g(!1),f.value||(y.value=null)},_=ne(null);ye(()=>_,()=>{b.value==="loading"&&_.value.complete&&(_.value.naturalWidth||_.value.naturalHeight)&&E()});let D=()=>{};Ke(()=>{ye([s,M],()=>{if(D(),!w.value)return()=>{};D=I(T.value,s.value,M.value),M.value||D()},{flush:"post",immediate:!0})}),wn(()=>{D()});const N=k=>MW(k)?k+"px":k;return()=>{const{prefixCls:k,wrapperClassName:F,fallback:L,src:H,placeholder:j,wrapperStyle:Y,rootClassName:Z,width:X,height:ee,crossorigin:U,decoding:Q,alt:J,sizes:G,srcset:q,usemap:V,class:W,style:te}=m(m({},e),n),ue=a.value,{icons:ie,maskClassName:ae}=ue,ce=Zne(ue,["icons","maskClassName"]),se=le(k,F,Z,{[`${k}-error`]:S.value}),pe=S.value&&L?L:s.value,he={crossorigin:U,decoding:Q,alt:J,sizes:G,srcset:q,usemap:V,width:X,height:ee,class:le(`${k}-img`,{[`${k}-img-placeholder`]:j===!0},W),style:m({height:N(ee)},te)};return p(Le,null,[p("div",{class:se,onClick:M.value?R:ge=>{r("click",ge)},style:m({width:N(X),height:N(ee)},Y)},[p("img",B(B(B({},he),S.value&&L?{src:L}:{onLoad:E,onError:A,src:H}),{},{ref:_}),null),b.value==="loading"&&p("div",{"aria-hidden":"true",class:`${k}-placeholder`},[j||o.placeholder&&o.placeholder()]),o.previewMask&&M.value&&p("div",{class:[`${k}-mask`,ae]},[o.previewMask()])]),!w.value&&M.value&&p(_E,B(B({},ce),{},{"aria-hidden":!v.value,visible:v.value,prefixCls:l.value,onClose:z,mousePosition:y.value,src:pe,alt:J,getContainer:d.value,icons:ie,rootClassName:Z}),null)])}}});RE.PreviewGroup=EE;var eoe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z"}},{tag:"path",attrs:{d:"M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z"}}]},name:"rotate-left",theme:"outlined"};function z2(e){for(var t=1;t{const{componentCls:t}=e;return[{[`${t}-root`]:{[`${t}${e.antCls}-zoom-enter, ${t}${e.antCls}-zoom-appear`]:{transform:"none",opacity:0,animationDuration:e.motionDurationSlow,userSelect:"none"},[`${t}${e.antCls}-zoom-leave ${t}-content`]:{pointerEvents:"none"},[`${t}-mask`]:m(m({},K2("fixed")),{zIndex:e.zIndexPopupBase,height:"100%",backgroundColor:e.colorBgMask,[`${t}-hidden`]:{display:"none"}}),[`${t}-wrap`]:m(m({},K2("fixed")),{overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"})}},{[`${t}-root`]:Dy(e)}]},uoe=e=>{const{componentCls:t}=e;return[{[`${t}-root`]:{[`${t}-wrap`]:{zIndex:e.zIndexPopupBase,position:"fixed",inset:0,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},[`${t}-wrap-rtl`]:{direction:"rtl"},[`${t}-centered`]:{textAlign:"center","&::before":{display:"inline-block",width:0,height:"100%",verticalAlign:"middle",content:'""'},[t]:{top:0,display:"inline-block",paddingBottom:0,textAlign:"start",verticalAlign:"middle"}},[`@media (max-width: ${e.screenSMMax})`]:{[t]:{maxWidth:"calc(100vw - 16px)",margin:`${e.marginXS} auto`},[`${t}-centered`]:{[t]:{flex:1}}}}},{[t]:m(m({},qe(e)),{pointerEvents:"none",position:"relative",top:100,width:"auto",maxWidth:`calc(100vw - ${e.margin*2}px)`,margin:"0 auto",paddingBottom:e.paddingLG,[`${t}-title`]:{margin:0,color:e.modalHeadingColor,fontWeight:e.fontWeightStrong,fontSize:e.modalHeaderTitleFontSize,lineHeight:e.modalHeaderTitleLineHeight,wordWrap:"break-word"},[`${t}-content`]:{position:"relative",backgroundColor:e.modalContentBg,backgroundClip:"padding-box",border:0,borderRadius:e.borderRadiusLG,boxShadow:e.boxShadowSecondary,pointerEvents:"auto",padding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`},[`${t}-close`]:m({position:"absolute",top:(e.modalHeaderCloseSize-e.modalCloseBtnSize)/2,insetInlineEnd:(e.modalHeaderCloseSize-e.modalCloseBtnSize)/2,zIndex:e.zIndexPopupBase+10,padding:0,color:e.modalCloseColor,fontWeight:e.fontWeightStrong,lineHeight:1,textDecoration:"none",background:"transparent",borderRadius:e.borderRadiusSM,width:e.modalConfirmIconSize,height:e.modalConfirmIconSize,border:0,outline:0,cursor:"pointer",transition:`color ${e.motionDurationMid}, background-color ${e.motionDurationMid}`,"&-x":{display:"block",fontSize:e.fontSizeLG,fontStyle:"normal",lineHeight:`${e.modalCloseBtnSize}px`,textAlign:"center",textTransform:"none",textRendering:"auto"},"&:hover":{color:e.modalIconHoverColor,backgroundColor:e.wireframe?"transparent":e.colorFillContent,textDecoration:"none"},"&:active":{backgroundColor:e.wireframe?"transparent":e.colorFillContentHover}},oi(e)),[`${t}-header`]:{color:e.colorText,background:e.modalHeaderBg,borderRadius:`${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`,marginBottom:e.marginXS},[`${t}-body`]:{fontSize:e.fontSize,lineHeight:e.lineHeight,wordWrap:"break-word"},[`${t}-footer`]:{textAlign:"end",background:e.modalFooterBg,marginTop:e.marginSM,[`${e.antCls}-btn + ${e.antCls}-btn:not(${e.antCls}-dropdown-trigger)`]:{marginBottom:0,marginInlineStart:e.marginXS}},[`${t}-open`]:{overflow:"hidden"}})},{[`${t}-pure-panel`]:{top:"auto",padding:0,display:"flex",flexDirection:"column",[`${t}-content, + ${t}-body, + ${t}-confirm-body-wrapper`]:{display:"flex",flexDirection:"column",flex:"auto"},[`${t}-confirm-body`]:{marginBottom:"auto"}}}]},doe=e=>{const{componentCls:t}=e,n=`${t}-confirm`;return{[n]:{"&-rtl":{direction:"rtl"},[`${e.antCls}-modal-header`]:{display:"none"},[`${n}-body-wrapper`]:m({},lr()),[`${n}-body`]:{display:"flex",flexWrap:"wrap",alignItems:"center",[`${n}-title`]:{flex:"0 0 100%",display:"block",overflow:"hidden",color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.modalHeaderTitleFontSize,lineHeight:e.modalHeaderTitleLineHeight,[`+ ${n}-content`]:{marginBlockStart:e.marginXS,flexBasis:"100%",maxWidth:`calc(100% - ${e.modalConfirmIconSize+e.marginSM}px)`}},[`${n}-content`]:{color:e.colorText,fontSize:e.fontSize},[`> ${e.iconCls}`]:{flex:"none",marginInlineEnd:e.marginSM,fontSize:e.modalConfirmIconSize,[`+ ${n}-title`]:{flex:1},[`+ ${n}-title + ${n}-content`]:{marginInlineStart:e.modalConfirmIconSize+e.marginSM}}},[`${n}-btns`]:{textAlign:"end",marginTop:e.marginSM,[`${e.antCls}-btn + ${e.antCls}-btn`]:{marginBottom:0,marginInlineStart:e.marginXS}}},[`${n}-error ${n}-body > ${e.iconCls}`]:{color:e.colorError},[`${n}-warning ${n}-body > ${e.iconCls}, + ${n}-confirm ${n}-body > ${e.iconCls}`]:{color:e.colorWarning},[`${n}-info ${n}-body > ${e.iconCls}`]:{color:e.colorInfo},[`${n}-success ${n}-body > ${e.iconCls}`]:{color:e.colorSuccess},[`${t}-zoom-leave ${t}-btns`]:{pointerEvents:"none"}}},foe=e=>{const{componentCls:t}=e;return{[`${t}-root`]:{[`${t}-wrap-rtl`]:{direction:"rtl",[`${t}-confirm-body`]:{direction:"rtl"}}}}},poe=e=>{const{componentCls:t,antCls:n}=e,o=`${t}-confirm`;return{[t]:{[`${t}-content`]:{padding:0},[`${t}-header`]:{padding:e.modalHeaderPadding,borderBottom:`${e.modalHeaderBorderWidth}px ${e.modalHeaderBorderStyle} ${e.modalHeaderBorderColorSplit}`,marginBottom:0},[`${t}-body`]:{padding:e.modalBodyPadding},[`${t}-footer`]:{padding:`${e.modalFooterPaddingVertical}px ${e.modalFooterPaddingHorizontal}px`,borderTop:`${e.modalFooterBorderWidth}px ${e.modalFooterBorderStyle} ${e.modalFooterBorderColorSplit}`,borderRadius:`0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px`,marginTop:0}},[o]:{[`${n}-modal-body`]:{padding:`${e.padding*2}px ${e.padding*2}px ${e.paddingLG}px`},[`${o}-body`]:{[`> ${e.iconCls}`]:{marginInlineEnd:e.margin,[`+ ${o}-title + ${o}-content`]:{marginInlineStart:e.modalConfirmIconSize+e.margin}}},[`${o}-btns`]:{marginTop:e.marginLG}}}},hoe=Ue("Modal",e=>{const t=e.padding,n=e.fontSizeHeading5,o=e.lineHeightHeading5,r=ze(e,{modalBodyPadding:e.paddingLG,modalHeaderBg:e.colorBgElevated,modalHeaderPadding:`${t}px ${e.paddingLG}px`,modalHeaderBorderWidth:e.lineWidth,modalHeaderBorderStyle:e.lineType,modalHeaderTitleLineHeight:o,modalHeaderTitleFontSize:n,modalHeaderBorderColorSplit:e.colorSplit,modalHeaderCloseSize:o*n+t*2,modalContentBg:e.colorBgElevated,modalHeadingColor:e.colorTextHeading,modalCloseColor:e.colorTextDescription,modalFooterBg:"transparent",modalFooterBorderColorSplit:e.colorSplit,modalFooterBorderStyle:e.lineType,modalFooterPaddingVertical:e.paddingXS,modalFooterPaddingHorizontal:e.padding,modalFooterBorderWidth:e.lineWidth,modalConfirmTitleFontSize:e.fontSizeLG,modalIconHoverColor:e.colorIconHover,modalConfirmIconSize:e.fontSize*e.lineHeight,modalCloseBtnSize:e.controlHeightLG*.55});return[uoe(r),doe(r),foe(r),DE(r),e.wireframe&&poe(r),ds(r,"zoom")]}),I0=e=>({position:e||"absolute",inset:0}),goe=e=>{const{iconCls:t,motionDurationSlow:n,paddingXXS:o,marginXXS:r,prefixCls:i}=e;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",background:new vt("#000").setAlpha(.5).toRgbString(),cursor:"pointer",opacity:0,transition:`opacity ${n}`,[`.${i}-mask-info`]:m(m({},Jt),{padding:`0 ${o}px`,[t]:{marginInlineEnd:r,svg:{verticalAlign:"baseline"}}})}},voe=e=>{const{previewCls:t,modalMaskBg:n,paddingSM:o,previewOperationColorDisabled:r,motionDurationSlow:i}=e,l=new vt(n).setAlpha(.1),a=l.clone().setAlpha(.2);return{[`${t}-operations`]:m(m({},qe(e)),{display:"flex",flexDirection:"row-reverse",alignItems:"center",color:e.previewOperationColor,listStyle:"none",background:l.toRgbString(),pointerEvents:"auto","&-operation":{marginInlineStart:o,padding:o,cursor:"pointer",transition:`all ${i}`,userSelect:"none","&:hover":{background:a.toRgbString()},"&-disabled":{color:r,pointerEvents:"none"},"&:last-of-type":{marginInlineStart:0}},"&-progress":{position:"absolute",left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%)"},"&-icon":{fontSize:e.previewOperationSize}})}},moe=e=>{const{modalMaskBg:t,iconCls:n,previewOperationColorDisabled:o,previewCls:r,zIndexPopup:i,motionDurationSlow:l}=e,a=new vt(t).setAlpha(.1),s=a.clone().setAlpha(.2);return{[`${r}-switch-left, ${r}-switch-right`]:{position:"fixed",insetBlockStart:"50%",zIndex:i+1,display:"flex",alignItems:"center",justifyContent:"center",width:e.imagePreviewSwitchSize,height:e.imagePreviewSwitchSize,marginTop:-e.imagePreviewSwitchSize/2,color:e.previewOperationColor,background:a.toRgbString(),borderRadius:"50%",transform:"translateY(-50%)",cursor:"pointer",transition:`all ${l}`,pointerEvents:"auto",userSelect:"none","&:hover":{background:s.toRgbString()},"&-disabled":{"&, &:hover":{color:o,background:"transparent",cursor:"not-allowed",[`> ${n}`]:{cursor:"not-allowed"}}},[`> ${n}`]:{fontSize:e.previewOperationSize}},[`${r}-switch-left`]:{insetInlineStart:e.marginSM},[`${r}-switch-right`]:{insetInlineEnd:e.marginSM}}},boe=e=>{const{motionEaseOut:t,previewCls:n,motionDurationSlow:o,componentCls:r}=e;return[{[`${r}-preview-root`]:{[n]:{height:"100%",textAlign:"center",pointerEvents:"none"},[`${n}-body`]:m(m({},I0()),{overflow:"hidden"}),[`${n}-img`]:{maxWidth:"100%",maxHeight:"100%",verticalAlign:"middle",transform:"scale3d(1, 1, 1)",cursor:"grab",transition:`transform ${o} ${t} 0s`,userSelect:"none",pointerEvents:"auto","&-wrapper":m(m({},I0()),{transition:`transform ${o} ${t} 0s`,display:"flex",justifyContent:"center",alignItems:"center","&::before":{display:"inline-block",width:1,height:"50%",marginInlineEnd:-1,content:'""'}})},[`${n}-moving`]:{[`${n}-preview-img`]:{cursor:"grabbing","&-wrapper":{transitionDuration:"0s"}}}}},{[`${r}-preview-root`]:{[`${n}-wrap`]:{zIndex:e.zIndexPopup}}},{[`${r}-preview-operations-wrapper`]:{position:"fixed",insetBlockStart:0,insetInlineEnd:0,zIndex:e.zIndexPopup+1,width:"100%"},"&":[voe(e),moe(e)]}]},yoe=e=>{const{componentCls:t}=e;return{[t]:{position:"relative",display:"inline-block",[`${t}-img`]:{width:"100%",height:"auto",verticalAlign:"middle"},[`${t}-img-placeholder`]:{backgroundColor:e.colorBgContainerDisabled,backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundSize:"30%"},[`${t}-mask`]:m({},goe(e)),[`${t}-mask:hover`]:{opacity:1},[`${t}-placeholder`]:m({},I0())}}},Soe=e=>{const{previewCls:t}=e;return{[`${t}-root`]:ds(e,"zoom"),"&":Dy(e,!0)}},BE=Ue("Image",e=>{const t=`${e.componentCls}-preview`,n=ze(e,{previewCls:t,modalMaskBg:new vt("#000").setAlpha(.45).toRgbString(),imagePreviewSwitchSize:e.controlHeightLG});return[yoe(n),boe(n),DE(ze(n,{componentCls:t})),Soe(n)]},e=>({zIndexPopup:e.zIndexPopupBase+80,previewOperationColor:new vt(e.colorTextLightSolid).toRgbString(),previewOperationColorDisabled:new vt(e.colorTextLightSolid).setAlpha(.25).toRgbString(),previewOperationSize:e.fontSizeIcon*1.5})),NE={rotateLeft:p(X1,null,null),rotateRight:p(Y1,null,null),zoomIn:p(q1,null,null),zoomOut:p(J1,null,null),close:p(Vn,null,null),left:p(Dr,null,null),right:p(Eo,null,null),flipX:p(fp,null,null),flipY:p(fp,{rotate:90},null)},$oe=()=>({previewPrefixCls:String,preview:It()}),kE=re({compatConfig:{MODE:3},name:"AImagePreviewGroup",inheritAttrs:!1,props:$oe(),setup(e,t){let{attrs:n,slots:o}=t;const{prefixCls:r,rootPrefixCls:i}=Ee("image",e),l=P(()=>`${r.value}-preview`),[a,s]=BE(r),c=P(()=>{const{preview:u}=e;if(u===!1)return u;const d=typeof u=="object"?u:{};return m(m({},d),{rootClassName:s.value,transitionName:Hn(i.value,"zoom",d.transitionName),maskTransitionName:Hn(i.value,"fade",d.maskTransitionName)})});return()=>a(p(EE,B(B({},m(m({},n),e)),{},{preview:c.value,icons:NE,previewPrefixCls:l.value}),o))}}),ml=re({name:"AImage",inheritAttrs:!1,props:ME(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,rootPrefixCls:i,configProvider:l}=Ee("image",e),[a,s]=BE(r),c=P(()=>{const{preview:u}=e;if(u===!1)return u;const d=typeof u=="object"?u:{};return m(m({icons:NE},d),{transitionName:Hn(i.value,"zoom",d.transitionName),maskTransitionName:Hn(i.value,"fade",d.maskTransitionName)})});return()=>{var u,d;const f=((d=(u=l.locale)===null||u===void 0?void 0:u.value)===null||d===void 0?void 0:d.Image)||eo.Image,h=()=>p("div",{class:`${r.value}-mask-info`},[p(hu,null,null),f==null?void 0:f.preview]),{previewMask:v=n.previewMask||h}=e;return a(p(RE,B(B({},m(m(m({},o),e),{prefixCls:r.value})),{},{preview:c.value,rootClassName:le(e.rootClassName,s.value)}),m(m({},n),{previewMask:typeof v=="function"?v:null})))}}});ml.PreviewGroup=kE;ml.install=function(e){return e.component(ml.name,ml),e.component(ml.PreviewGroup.name,ml.PreviewGroup),e};var Coe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"};function G2(e){for(var t=1;tNumber.MAX_SAFE_INTEGER)return String(T0()?BigInt(e).toString():Number.MAX_SAFE_INTEGER);if(eNumber.MAX_SAFE_INTEGER)return new bl(Number.MAX_SAFE_INTEGER);if(o0&&arguments[0]!==void 0?arguments[0]:!0)?this.isInvalidate()?"":eS(this.number):this.origin}}class Oa{constructor(t){if(this.origin="",FE(t)){this.empty=!0;return}if(this.origin=String(t),t==="-"||Number.isNaN(t)){this.nan=!0;return}let n=t;if(Q1(n)&&(n=Number(n)),n=typeof n=="string"?n:eS(n),tS(n)){const o=uc(n);this.negative=o.negative;const r=o.trimStr.split(".");this.integer=BigInt(r[0]);const i=r[1]||"0";this.decimal=BigInt(i),this.decimalLen=i.length}else this.nan=!0}getMark(){return this.negative?"-":""}getIntegerStr(){return this.integer.toString()}getDecimalStr(){return this.decimal.toString().padStart(this.decimalLen,"0")}alignDecimal(t){const n=`${this.getMark()}${this.getIntegerStr()}${this.getDecimalStr().padEnd(t,"0")}`;return BigInt(n)}negate(){const t=new Oa(this.toString());return t.negative=!t.negative,t}add(t){if(this.isInvalidate())return new Oa(t);const n=new Oa(t);if(n.isInvalidate())return this;const o=Math.max(this.getDecimalStr().length,n.getDecimalStr().length),r=this.alignDecimal(o),i=n.alignDecimal(o),l=(r+i).toString(),{negativeStr:a,trimStr:s}=uc(l),c=`${a}${s.padStart(o+1,"0")}`;return new Oa(`${c.slice(0,-o)}.${c.slice(-o)}`)}isEmpty(){return this.empty}isNaN(){return this.nan}isInvalidate(){return this.isEmpty()||this.isNaN()}equals(t){return this.toString()===(t==null?void 0:t.toString())}lessEquals(t){return this.add(t.negate().toString()).toNumber()<=0}toNumber(){return this.isNaN()?NaN:Number(this.toString())}toString(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0)?this.isInvalidate()?"":uc(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr:this.origin}}function xr(e){return T0()?new Oa(e):new bl(e)}function E0(e,t,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e==="")return"";const{negativeStr:r,integerStr:i,decimalStr:l}=uc(e),a=`${t}${l}`,s=`${r}${i}`;if(n>=0){const c=Number(l[n]);if(c>=5&&!o){const u=xr(e).add(`${r}0.${"0".repeat(n)}${10-c}`);return E0(u.toString(),t,n,o)}return n===0?s:`${s}${t}${l.padEnd(n,"0").slice(0,n)}`}return a===".0"?s:`${s}${a}`}const woe=200,Ooe=600,Poe=re({compatConfig:{MODE:3},name:"StepHandler",inheritAttrs:!1,props:{prefixCls:String,upDisabled:Boolean,downDisabled:Boolean,onStep:ve()},slots:Object,setup(e,t){let{slots:n,emit:o}=t;const r=ne(),i=(a,s)=>{a.preventDefault(),o("step",s);function c(){o("step",s),r.value=setTimeout(c,woe)}r.value=setTimeout(c,Ooe)},l=()=>{clearTimeout(r.value)};return et(()=>{l()}),()=>{if(py())return null;const{prefixCls:a,upDisabled:s,downDisabled:c}=e,u=`${a}-handler`,d=le(u,`${u}-up`,{[`${u}-up-disabled`]:s}),f=le(u,`${u}-down`,{[`${u}-down-disabled`]:c}),h={unselectable:"on",role:"button",onMouseup:l,onMouseleave:l},{upNode:v,downNode:g}=n;return p("div",{class:`${u}-wrap`},[p("span",B(B({},h),{},{onMousedown:b=>{i(b,!0)},"aria-label":"Increase Value","aria-disabled":s,class:d}),[(v==null?void 0:v())||p("span",{unselectable:"on",class:`${a}-handler-up-inner`},null)]),p("span",B(B({},h),{},{onMousedown:b=>{i(b,!1)},"aria-label":"Decrease Value","aria-disabled":c,class:f}),[(g==null?void 0:g())||p("span",{unselectable:"on",class:`${a}-handler-down-inner`},null)])])}}});function Ioe(e,t){const n=ne(null);function o(){try{const{selectionStart:i,selectionEnd:l,value:a}=e.value,s=a.substring(0,i),c=a.substring(l);n.value={start:i,end:l,value:a,beforeTxt:s,afterTxt:c}}catch{}}function r(){if(e.value&&n.value&&t.value)try{const{value:i}=e.value,{beforeTxt:l,afterTxt:a,start:s}=n.value;let c=i.length;if(i.endsWith(a))c=i.length-n.value.afterTxt.length;else if(i.startsWith(l))c=l.length;else{const u=l[s-1],d=i.indexOf(u,s-1);d!==-1&&(c=d+1)}e.value.setSelectionRange(c,c)}catch(i){`${i.message}`}}return[o,r]}const Toe=()=>{const e=oe(0),t=()=>{Ze.cancel(e.value)};return et(()=>{t()}),n=>{t(),e.value=Ze(()=>{n()})}};var Eoe=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);re||t.isEmpty()?t.toString():t.toNumber(),X2=e=>{const t=xr(e);return t.isInvalidate()?null:t},LE=()=>({stringMode:$e(),defaultValue:He([String,Number]),value:He([String,Number]),prefixCls:Ne(),min:He([String,Number]),max:He([String,Number]),step:He([String,Number],1),tabindex:Number,controls:$e(!0),readonly:$e(),disabled:$e(),autofocus:$e(),keyboard:$e(!0),parser:ve(),formatter:ve(),precision:Number,decimalSeparator:String,onInput:ve(),onChange:ve(),onPressEnter:ve(),onStep:ve(),onBlur:ve(),onFocus:ve()}),_oe=re({compatConfig:{MODE:3},name:"InnerInputNumber",inheritAttrs:!1,props:m(m({},LE()),{lazy:Boolean}),slots:Object,setup(e,t){let{attrs:n,slots:o,emit:r,expose:i}=t;const l=oe(),a=oe(!1),s=oe(!1),c=oe(!1),u=oe(xr(e.value));function d(j){e.value===void 0&&(u.value=j)}const f=(j,Y)=>{if(!Y)return e.precision>=0?e.precision:Math.max(jc(j),jc(e.step))},h=j=>{const Y=String(j);if(e.parser)return e.parser(Y);let Z=Y;return e.decimalSeparator&&(Z=Z.replace(e.decimalSeparator,".")),Z.replace(/[^\w.-]+/g,"")},v=oe(""),g=(j,Y)=>{if(e.formatter)return e.formatter(j,{userTyping:Y,input:String(v.value)});let Z=typeof j=="number"?eS(j):j;if(!Y){const X=f(Z,Y);if(tS(Z)&&(e.decimalSeparator||X>=0)){const ee=e.decimalSeparator||".";Z=E0(Z,ee,X)}}return Z},b=(()=>{const j=e.value;return u.value.isInvalidate()&&["string","number"].includes(typeof j)?Number.isNaN(j)?"":j:g(u.value.toString(),!1)})();v.value=b;function y(j,Y){v.value=g(j.isInvalidate()?j.toString(!1):j.toString(!Y),Y)}const S=P(()=>X2(e.max)),$=P(()=>X2(e.min)),w=P(()=>!S.value||!u.value||u.value.isInvalidate()?!1:S.value.lessEquals(u.value)),C=P(()=>!$.value||!u.value||u.value.isInvalidate()?!1:u.value.lessEquals($.value)),[O,x]=Ioe(l,a),I=j=>S.value&&!j.lessEquals(S.value)?S.value:$.value&&!$.value.lessEquals(j)?$.value:null,T=j=>!I(j),M=(j,Y)=>{var Z;let X=j,ee=T(X)||X.isEmpty();if(!X.isEmpty()&&!Y&&(X=I(X)||X,ee=!0),!e.readonly&&!e.disabled&&ee){const U=X.toString(),Q=f(U,Y);return Q>=0&&(X=xr(E0(U,".",Q))),X.equals(u.value)||(d(X),(Z=e.onChange)===null||Z===void 0||Z.call(e,X.isEmpty()?null:U2(e.stringMode,X)),e.value===void 0&&y(X,Y)),X}return u.value},E=Toe(),A=j=>{var Y;if(O(),v.value=j,!c.value){const Z=h(j),X=xr(Z);X.isNaN()||M(X,!0)}(Y=e.onInput)===null||Y===void 0||Y.call(e,j),E(()=>{let Z=j;e.parser||(Z=j.replace(/。/g,".")),Z!==j&&A(Z)})},R=()=>{c.value=!0},z=()=>{c.value=!1,A(l.value.value)},_=j=>{A(j.target.value)},D=j=>{var Y,Z;if(j&&w.value||!j&&C.value)return;s.value=!1;let X=xr(e.step);j||(X=X.negate());const ee=(u.value||xr(0)).add(X.toString()),U=M(ee,!1);(Y=e.onStep)===null||Y===void 0||Y.call(e,U2(e.stringMode,U),{offset:e.step,type:j?"up":"down"}),(Z=l.value)===null||Z===void 0||Z.focus()},N=j=>{const Y=xr(h(v.value));let Z=Y;Y.isNaN()?Z=u.value:Z=M(Y,j),e.value!==void 0?y(u.value,!1):Z.isNaN()||y(Z,!1)},k=()=>{s.value=!0},F=j=>{var Y;const{which:Z}=j;s.value=!0,Z===Ie.ENTER&&(c.value||(s.value=!1),N(!1),(Y=e.onPressEnter)===null||Y===void 0||Y.call(e,j)),e.keyboard!==!1&&!c.value&&[Ie.UP,Ie.DOWN].includes(Z)&&(D(Ie.UP===Z),j.preventDefault())},L=()=>{s.value=!1},H=j=>{N(!1),a.value=!1,s.value=!1,r("blur",j)};return ye(()=>e.precision,()=>{u.value.isInvalidate()||y(u.value,!1)},{flush:"post"}),ye(()=>e.value,()=>{const j=xr(e.value);u.value=j;const Y=xr(h(v.value));(!j.equals(Y)||!s.value||e.formatter)&&y(j,s.value)},{flush:"post"}),ye(v,()=>{e.formatter&&x()},{flush:"post"}),ye(()=>e.disabled,j=>{j&&(a.value=!1)}),i({focus:()=>{var j;(j=l.value)===null||j===void 0||j.focus()},blur:()=>{var j;(j=l.value)===null||j===void 0||j.blur()}}),()=>{const j=m(m({},n),e),{prefixCls:Y="rc-input-number",min:Z,max:X,step:ee=1,defaultValue:U,value:Q,disabled:J,readonly:G,keyboard:q,controls:V=!0,autofocus:W,stringMode:te,parser:ue,formatter:ie,precision:ae,decimalSeparator:ce,onChange:se,onInput:pe,onPressEnter:he,onStep:ge,lazy:me,class:xe,style:fe}=j,de=Eoe(j,["prefixCls","min","max","step","defaultValue","value","disabled","readonly","keyboard","controls","autofocus","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","lazy","class","style"]),{upHandler:be,downHandler:we}=o,Te=`${Y}-input`,Re={};return me?Re.onChange=_:Re.onInput=_,p("div",{class:le(Y,xe,{[`${Y}-focused`]:a.value,[`${Y}-disabled`]:J,[`${Y}-readonly`]:G,[`${Y}-not-a-number`]:u.value.isNaN(),[`${Y}-out-of-range`]:!u.value.isInvalidate()&&!T(u.value)}),style:fe,onKeydown:F,onKeyup:L},[V&&p(Poe,{prefixCls:Y,upDisabled:w.value,downDisabled:C.value,onStep:D},{upNode:be,downNode:we}),p("div",{class:`${Te}-wrap`},[p("input",B(B(B({autofocus:W,autocomplete:"off",role:"spinbutton","aria-valuemin":Z,"aria-valuemax":X,"aria-valuenow":u.value.isInvalidate()?null:u.value.toString(),step:ee},de),{},{ref:l,class:Te,value:v.value,disabled:J,readonly:G,onFocus:Se=>{a.value=!0,r("focus",Se)}},Re),{},{onBlur:H,onCompositionstart:R,onCompositionend:z,onBeforeinput:k}),null)])])}}});function kv(e){return e!=null}const Moe=e=>{const{componentCls:t,lineWidth:n,lineType:o,colorBorder:r,borderRadius:i,fontSizeLG:l,controlHeightLG:a,controlHeightSM:s,colorError:c,inputPaddingHorizontalSM:u,colorTextDescription:d,motionDurationMid:f,colorPrimary:h,controlHeight:v,inputPaddingHorizontal:g,colorBgContainer:b,colorTextDisabled:y,borderRadiusSM:S,borderRadiusLG:$,controlWidth:w,handleVisible:C}=e;return[{[t]:m(m(m(m({},qe(e)),ta(e)),au(e,t)),{display:"inline-block",width:w,margin:0,padding:0,border:`${n}px ${o} ${r}`,borderRadius:i,"&-rtl":{direction:"rtl",[`${t}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:l,borderRadius:$,[`input${t}-input`]:{height:a-2*n}},"&-sm":{padding:0,borderRadius:S,[`input${t}-input`]:{height:s-2*n,padding:`0 ${u}px`}},"&:hover":m({},gs(e)),"&-focused":m({},ji(e)),"&-disabled":m(m({},y1(e)),{[`${t}-input`]:{cursor:"not-allowed"}}),"&-out-of-range":{input:{color:c}},"&-group":m(m(m({},qe(e)),VI(e)),{"&-wrapper":{display:"inline-block",textAlign:"start",verticalAlign:"top",[`${t}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${t}-group-addon`]:{borderRadius:$}},"&-sm":{[`${t}-group-addon`]:{borderRadius:S}}}}),[t]:{"&-input":m(m({width:"100%",height:v-2*n,padding:`0 ${g}px`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:i,outline:0,transition:`all ${f} linear`,appearance:"textfield",color:e.colorText,fontSize:"inherit",verticalAlign:"top"},b1(e.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,webkitAppearance:"none",appearance:"none"}})}})},{[t]:{[`&:hover ${t}-handler-wrap, &-focused ${t}-handler-wrap`]:{opacity:1},[`${t}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:e.handleWidth,height:"100%",background:b,borderStartStartRadius:0,borderStartEndRadius:i,borderEndEndRadius:i,borderEndStartRadius:0,opacity:C===!0?1:0,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`opacity ${f} linear ${f}`,[`${t}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[` + ${t}-handler-up-inner, + ${t}-handler-down-inner + `]:{marginInlineEnd:0,fontSize:e.handleFontSize}}},[`${t}-handler`]:{height:"50%",overflow:"hidden",color:d,fontWeight:"bold",lineHeight:0,textAlign:"center",cursor:"pointer",borderInlineStart:`${n}px ${o} ${r}`,transition:`all ${f} linear`,"&:active":{background:e.colorFillAlter},"&:hover":{height:"60%",[` + ${t}-handler-up-inner, + ${t}-handler-down-inner + `]:{color:h}},"&-up-inner, &-down-inner":m(m({},Kl()),{color:d,transition:`all ${f} linear`,userSelect:"none"})},[`${t}-handler-up`]:{borderStartEndRadius:i},[`${t}-handler-down`]:{borderBlockStart:`${n}px ${o} ${r}`,borderEndEndRadius:i},"&-disabled, &-readonly":{[`${t}-handler-wrap`]:{display:"none"},[`${t}-input`]:{color:"inherit"}},[` + ${t}-handler-up-disabled, + ${t}-handler-down-disabled + `]:{cursor:"not-allowed"},[` + ${t}-handler-up-disabled:hover &-handler-up-inner, + ${t}-handler-down-disabled:hover &-handler-down-inner + `]:{color:y}}},{[`${t}-borderless`]:{borderColor:"transparent",boxShadow:"none",[`${t}-handler-down`]:{borderBlockStartWidth:0}}}]},Aoe=e=>{const{componentCls:t,inputPaddingHorizontal:n,inputAffixPadding:o,controlWidth:r,borderRadiusLG:i,borderRadiusSM:l}=e;return{[`${t}-affix-wrapper`]:m(m(m({},ta(e)),au(e,`${t}-affix-wrapper`)),{position:"relative",display:"inline-flex",width:r,padding:0,paddingInlineStart:n,"&-lg":{borderRadius:i},"&-sm":{borderRadius:l},[`&:not(${t}-affix-wrapper-disabled):hover`]:m(m({},gs(e)),{zIndex:1}),"&-focused, &:focus":{zIndex:1},"&-disabled":{[`${t}[disabled]`]:{background:"transparent"}},[`> div${t}`]:{width:"100%",border:"none",outline:"none",[`&${t}-focused`]:{boxShadow:"none !important"}},[`input${t}-input`]:{padding:0},"&::before":{width:0,visibility:"hidden",content:'"\\a0"'},[`${t}-handler-wrap`]:{zIndex:2},[t]:{"&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:o},"&-suffix":{position:"absolute",insetBlockStart:0,insetInlineEnd:0,zIndex:1,height:"100%",marginInlineEnd:n,marginInlineStart:o}}})}},Roe=Ue("InputNumber",e=>{const t=na(e);return[Moe(t),Aoe(t),fs(t)]},e=>({controlWidth:90,handleWidth:e.controlHeightSM-e.lineWidth*2,handleFontSize:e.fontSize/2,handleVisible:"auto"}));var Doe=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rm(m({},Y2),{size:Ne(),bordered:$e(!0),placeholder:String,name:String,id:String,type:String,addonBefore:K.any,addonAfter:K.any,prefix:K.any,"onUpdate:value":Y2.onChange,valueModifiers:Object,status:Ne()}),Fv=re({compatConfig:{MODE:3},name:"AInputNumber",inheritAttrs:!1,props:Boe(),slots:Object,setup(e,t){let{emit:n,expose:o,attrs:r,slots:i}=t;var l;const a=an(),s=yn.useInject(),c=P(()=>fr(s.status,e.status)),{prefixCls:u,size:d,direction:f,disabled:h}=Ee("input-number",e),{compactSize:v,compactItemClassnames:g}=Yi(u,f),b=po(),y=P(()=>{var R;return(R=h.value)!==null&&R!==void 0?R:b.value}),[S,$]=Roe(u),w=P(()=>v.value||d.value),C=oe((l=e.value)!==null&&l!==void 0?l:e.defaultValue),O=oe(!1);ye(()=>e.value,()=>{C.value=e.value});const x=oe(null),I=()=>{var R;(R=x.value)===null||R===void 0||R.focus()};o({focus:I,blur:()=>{var R;(R=x.value)===null||R===void 0||R.blur()}});const M=R=>{e.value===void 0&&(C.value=R),n("update:value",R),n("change",R),a.onFieldChange()},E=R=>{O.value=!1,n("blur",R),a.onFieldBlur()},A=R=>{O.value=!0,n("focus",R)};return()=>{var R,z,_,D;const{hasFeedback:N,isFormItemInput:k,feedbackIcon:F}=s,L=(R=e.id)!==null&&R!==void 0?R:a.id.value,H=m(m(m({},r),e),{id:L,disabled:y.value}),{class:j,bordered:Y,readonly:Z,style:X,addonBefore:ee=(z=i.addonBefore)===null||z===void 0?void 0:z.call(i),addonAfter:U=(_=i.addonAfter)===null||_===void 0?void 0:_.call(i),prefix:Q=(D=i.prefix)===null||D===void 0?void 0:D.call(i),valueModifiers:J={}}=H,G=Doe(H,["class","bordered","readonly","style","addonBefore","addonAfter","prefix","valueModifiers"]),q=u.value,V=le({[`${q}-lg`]:w.value==="large",[`${q}-sm`]:w.value==="small",[`${q}-rtl`]:f.value==="rtl",[`${q}-readonly`]:Z,[`${q}-borderless`]:!Y,[`${q}-in-form-item`]:k},Fn(q,c.value),j,g.value,$.value);let W=p(_oe,B(B({},ot(G,["size","defaultValue"])),{},{ref:x,lazy:!!J.lazy,value:C.value,class:V,prefixCls:q,readonly:Z,onChange:M,onBlur:E,onFocus:A}),{upHandler:i.upIcon?()=>p("span",{class:`${q}-handler-up-inner`},[i.upIcon()]):()=>p(Z1,{class:`${q}-handler-up-inner`},null),downHandler:i.downIcon?()=>p("span",{class:`${q}-handler-down-inner`},[i.downIcon()]):()=>p(Jl,{class:`${q}-handler-down-inner`},null)});const te=kv(ee)||kv(U),ue=kv(Q);if(ue||N){const ie=le(`${q}-affix-wrapper`,Fn(`${q}-affix-wrapper`,c.value,N),{[`${q}-affix-wrapper-focused`]:O.value,[`${q}-affix-wrapper-disabled`]:y.value,[`${q}-affix-wrapper-sm`]:w.value==="small",[`${q}-affix-wrapper-lg`]:w.value==="large",[`${q}-affix-wrapper-rtl`]:f.value==="rtl",[`${q}-affix-wrapper-readonly`]:Z,[`${q}-affix-wrapper-borderless`]:!Y,[`${j}`]:!te&&j},$.value);W=p("div",{class:ie,style:X,onClick:I},[ue&&p("span",{class:`${q}-prefix`},[Q]),W,N&&p("span",{class:`${q}-suffix`},[F])])}if(te){const ie=`${q}-group`,ae=`${ie}-addon`,ce=ee?p("div",{class:ae},[ee]):null,se=U?p("div",{class:ae},[U]):null,pe=le(`${q}-wrapper`,ie,{[`${ie}-rtl`]:f.value==="rtl"},$.value),he=le(`${q}-group-wrapper`,{[`${q}-group-wrapper-sm`]:w.value==="small",[`${q}-group-wrapper-lg`]:w.value==="large",[`${q}-group-wrapper-rtl`]:f.value==="rtl"},Fn(`${u}-group-wrapper`,c.value,N),j,$.value);W=p("div",{class:he,style:X},[p("div",{class:pe},[ce&&p(Rc,null,{default:()=>[p(kf,null,{default:()=>[ce]})]}),W,se&&p(Rc,null,{default:()=>[p(kf,null,{default:()=>[se]})]})])])}return S(pt(W,{style:X}))}}}),Noe=m(Fv,{install:e=>(e.component(Fv.name,Fv),e)}),koe=e=>{const{componentCls:t,colorBgContainer:n,colorBgBody:o,colorText:r}=e;return{[`${t}-sider-light`]:{background:n,[`${t}-sider-trigger`]:{color:r,background:n},[`${t}-sider-zero-width-trigger`]:{color:r,background:n,border:`1px solid ${o}`,borderInlineStart:0}}}},Foe=e=>{const{antCls:t,componentCls:n,colorText:o,colorTextLightSolid:r,colorBgHeader:i,colorBgBody:l,colorBgTrigger:a,layoutHeaderHeight:s,layoutHeaderPaddingInline:c,layoutHeaderColor:u,layoutFooterPadding:d,layoutTriggerHeight:f,layoutZeroTriggerSize:h,motionDurationMid:v,motionDurationSlow:g,fontSize:b,borderRadius:y}=e;return{[n]:m(m({display:"flex",flex:"auto",flexDirection:"column",color:o,minHeight:0,background:l,"&, *":{boxSizing:"border-box"},[`&${n}-has-sider`]:{flexDirection:"row",[`> ${n}, > ${n}-content`]:{width:0}},[`${n}-header, &${n}-footer`]:{flex:"0 0 auto"},[`${n}-header`]:{height:s,paddingInline:c,color:u,lineHeight:`${s}px`,background:i,[`${t}-menu`]:{lineHeight:"inherit"}},[`${n}-footer`]:{padding:d,color:o,fontSize:b,background:l},[`${n}-content`]:{flex:"auto",minHeight:0},[`${n}-sider`]:{position:"relative",minWidth:0,background:i,transition:`all ${v}, background 0s`,"&-children":{height:"100%",marginTop:-.1,paddingTop:.1,[`${t}-menu${t}-menu-inline-collapsed`]:{width:"auto"}},"&-has-trigger":{paddingBottom:f},"&-right":{order:1},"&-trigger":{position:"fixed",bottom:0,zIndex:1,height:f,color:r,lineHeight:`${f}px`,textAlign:"center",background:a,cursor:"pointer",transition:`all ${v}`},"&-zero-width":{"> *":{overflow:"hidden"},"&-trigger":{position:"absolute",top:s,insetInlineEnd:-h,zIndex:1,width:h,height:h,color:r,fontSize:e.fontSizeXL,display:"flex",alignItems:"center",justifyContent:"center",background:i,borderStartStartRadius:0,borderStartEndRadius:y,borderEndEndRadius:y,borderEndStartRadius:0,cursor:"pointer",transition:`background ${g} ease`,"&::after":{position:"absolute",inset:0,background:"transparent",transition:`all ${g}`,content:'""'},"&:hover::after":{background:"rgba(255, 255, 255, 0.2)"},"&-right":{insetInlineStart:-h,borderStartStartRadius:y,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:y}}}}},koe(e)),{"&-rtl":{direction:"rtl"}})}},Loe=Ue("Layout",e=>{const{colorText:t,controlHeightSM:n,controlHeight:o,controlHeightLG:r,marginXXS:i}=e,l=r*1.25,a=ze(e,{layoutHeaderHeight:o*2,layoutHeaderPaddingInline:l,layoutHeaderColor:t,layoutFooterPadding:`${n}px ${l}px`,layoutTriggerHeight:r+i*2,layoutZeroTriggerSize:r});return[Foe(a)]},e=>{const{colorBgLayout:t}=e;return{colorBgHeader:"#001529",colorBgBody:t,colorBgTrigger:"#002140"}}),nS=()=>({prefixCls:String,hasSider:{type:Boolean,default:void 0},tagName:String});function jh(e){let{suffixCls:t,tagName:n,name:o}=e;return r=>re({compatConfig:{MODE:3},name:o,props:nS(),setup(l,a){let{slots:s}=a;const{prefixCls:c}=Ee(t,l);return()=>{const u=m(m({},l),{prefixCls:c.value,tagName:n});return p(r,u,s)}}})}const oS=re({compatConfig:{MODE:3},props:nS(),setup(e,t){let{slots:n}=t;return()=>p(e.tagName,{class:e.prefixCls},n)}}),zoe=re({compatConfig:{MODE:3},inheritAttrs:!1,props:nS(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("",e),[l,a]=Loe(r),s=ne([]);Ye(aI,{addSider:d=>{s.value=[...s.value,d]},removeSider:d=>{s.value=s.value.filter(f=>f!==d)}});const u=P(()=>{const{prefixCls:d,hasSider:f}=e;return{[a.value]:!0,[`${d}`]:!0,[`${d}-has-sider`]:typeof f=="boolean"?f:s.value.length>0,[`${d}-rtl`]:i.value==="rtl"}});return()=>{const{tagName:d}=e;return l(p(d,m(m({},o),{class:[u.value,o.class]}),n))}}}),Lv=jh({suffixCls:"layout",tagName:"section",name:"ALayout"})(zoe),Kd=jh({suffixCls:"layout-header",tagName:"header",name:"ALayoutHeader"})(oS),Gd=jh({suffixCls:"layout-footer",tagName:"footer",name:"ALayoutFooter"})(oS),Ud=jh({suffixCls:"layout-content",tagName:"main",name:"ALayoutContent"})(oS);var Hoe={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"};function q2(e){for(var t=1;t({prefixCls:String,collapsible:{type:Boolean,default:void 0},collapsed:{type:Boolean,default:void 0},defaultCollapsed:{type:Boolean,default:void 0},reverseArrow:{type:Boolean,default:void 0},zeroWidthTriggerStyle:{type:Object,default:void 0},trigger:K.any,width:K.oneOfType([K.number,K.string]),collapsedWidth:K.oneOfType([K.number,K.string]),breakpoint:K.oneOf(Mn("xs","sm","md","lg","xl","xxl","xxxl")),theme:K.oneOf(Mn("light","dark")).def("dark"),onBreakpoint:Function,onCollapse:Function}),Woe=(()=>{let e=0;return function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e+=1,`${t}${e}`}})(),Xd=re({compatConfig:{MODE:3},name:"ALayoutSider",inheritAttrs:!1,props:Qe(Voe(),{collapsible:!1,defaultCollapsed:!1,reverseArrow:!1,width:200,collapsedWidth:80}),emits:["breakpoint","update:collapsed","collapse"],setup(e,t){let{emit:n,attrs:o,slots:r}=t;const{prefixCls:i}=Ee("layout-sider",e),l=Ge(aI,void 0),a=oe(!!(e.collapsed!==void 0?e.collapsed:e.defaultCollapsed)),s=oe(!1);ye(()=>e.collapsed,()=>{a.value=!!e.collapsed}),Ye(lI,a);const c=(g,b)=>{e.collapsed===void 0&&(a.value=g),n("update:collapsed",g),n("collapse",g,b)},u=oe(g=>{s.value=g.matches,n("breakpoint",g.matches),a.value!==g.matches&&c(g.matches,"responsive")});let d;function f(g){return u.value(g)}const h=Woe("ant-sider-");l&&l.addSider(h),Ke(()=>{ye(()=>e.breakpoint,()=>{try{d==null||d.removeEventListener("change",f)}catch{d==null||d.removeListener(f)}if(typeof window<"u"){const{matchMedia:g}=window;if(g&&e.breakpoint&&e.breakpoint in J2){d=g(`(max-width: ${J2[e.breakpoint]})`);try{d.addEventListener("change",f)}catch{d.addListener(f)}f(d)}}},{immediate:!0})}),et(()=>{try{d==null||d.removeEventListener("change",f)}catch{d==null||d.removeListener(f)}l&&l.removeSider(h)});const v=()=>{c(!a.value,"clickTrigger")};return()=>{var g,b;const y=i.value,{collapsedWidth:S,width:$,reverseArrow:w,zeroWidthTriggerStyle:C,trigger:O=(g=r.trigger)===null||g===void 0?void 0:g.call(r),collapsible:x,theme:I}=e,T=a.value?S:$,M=Vf(T)?`${T}px`:String(T),E=parseFloat(String(S||0))===0?p("span",{onClick:v,class:le(`${y}-zero-width-trigger`,`${y}-zero-width-trigger-${w?"right":"left"}`),style:C},[O||p(rS,null,null)]):null,A={expanded:p(w?Eo:Dr,null,null),collapsed:p(w?Dr:Eo,null,null)},R=a.value?"collapsed":"expanded",z=A[R],_=O!==null?E||p("div",{class:`${y}-trigger`,onClick:v,style:{width:M}},[O||z]):null,D=[o.style,{flex:`0 0 ${M}`,maxWidth:M,minWidth:M,width:M}],N=le(y,`${y}-${I}`,{[`${y}-collapsed`]:!!a.value,[`${y}-has-trigger`]:x&&O!==null&&!E,[`${y}-below`]:!!s.value,[`${y}-zero-width`]:parseFloat(M)===0},o.class);return p("aside",B(B({},o),{},{class:N,style:D}),[p("div",{class:`${y}-children`},[(b=r.default)===null||b===void 0?void 0:b.call(r)]),x||s.value&&E?_:null])}}}),Koe=Kd,Goe=Gd,Uoe=Xd,Xoe=Ud,Yoe=m(Lv,{Header:Kd,Footer:Gd,Content:Ud,Sider:Xd,install:e=>(e.component(Lv.name,Lv),e.component(Kd.name,Kd),e.component(Gd.name,Gd),e.component(Xd.name,Xd),e.component(Ud.name,Ud),e)});function qoe(e,t,n){var o=n||{},r=o.noTrailing,i=r===void 0?!1:r,l=o.noLeading,a=l===void 0?!1:l,s=o.debounceMode,c=s===void 0?void 0:s,u,d=!1,f=0;function h(){u&&clearTimeout(u)}function v(b){var y=b||{},S=y.upcomingOnly,$=S===void 0?!1:S;h(),d=!$}function g(){for(var b=arguments.length,y=new Array(b),S=0;Se?a?(f=Date.now(),i||(u=setTimeout(c?O:C,e))):C():i!==!0&&(u=setTimeout(c?O:C,c===void 0?e-w:e))}return g.cancel=v,g}function Joe(e,t,n){var o={},r=o.atBegin,i=r===void 0?!1:r;return qoe(e,t,{debounceMode:i!==!1})}const Zoe=new it("antSpinMove",{to:{opacity:1}}),Qoe=new it("antRotate",{to:{transform:"rotate(405deg)"}}),ere=e=>({[`${e.componentCls}`]:m(m({},qe(e)),{position:"absolute",display:"none",color:e.colorPrimary,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,"&-spinning":{position:"static",display:"inline-block",opacity:1},"&-nested-loading":{position:"relative",[`> div > ${e.componentCls}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:e.contentHeight,[`${e.componentCls}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:-e.spinDotSize/2},[`${e.componentCls}-text`]:{position:"absolute",top:"50%",width:"100%",paddingTop:(e.spinDotSize-e.fontSize)/2+2,textShadow:`0 1px 2px ${e.colorBgContainer}`},[`&${e.componentCls}-show-text ${e.componentCls}-dot`]:{marginTop:-(e.spinDotSize/2)-10},"&-sm":{[`${e.componentCls}-dot`]:{margin:-e.spinDotSizeSM/2},[`${e.componentCls}-text`]:{paddingTop:(e.spinDotSizeSM-e.fontSize)/2+2},[`&${e.componentCls}-show-text ${e.componentCls}-dot`]:{marginTop:-(e.spinDotSizeSM/2)-10}},"&-lg":{[`${e.componentCls}-dot`]:{margin:-(e.spinDotSizeLG/2)},[`${e.componentCls}-text`]:{paddingTop:(e.spinDotSizeLG-e.fontSize)/2+2},[`&${e.componentCls}-show-text ${e.componentCls}-dot`]:{marginTop:-(e.spinDotSizeLG/2)-10}}},[`${e.componentCls}-container`]:{position:"relative",transition:`opacity ${e.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:e.colorBgContainer,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${e.componentCls}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:e.spinDotDefault},[`${e.componentCls}-dot`]:{position:"relative",display:"inline-block",fontSize:e.spinDotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:(e.spinDotSize-e.marginXXS/2)/2,height:(e.spinDotSize-e.marginXXS/2)/2,backgroundColor:e.colorPrimary,borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:Zoe,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:Qoe,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&-sm ${e.componentCls}-dot`]:{fontSize:e.spinDotSizeSM,i:{width:(e.spinDotSizeSM-e.marginXXS/2)/2,height:(e.spinDotSizeSM-e.marginXXS/2)/2}},[`&-lg ${e.componentCls}-dot`]:{fontSize:e.spinDotSizeLG,i:{width:(e.spinDotSizeLG-e.marginXXS)/2,height:(e.spinDotSizeLG-e.marginXXS)/2}},[`&${e.componentCls}-show-text ${e.componentCls}-text`]:{display:"block"}})}),tre=Ue("Spin",e=>{const t=ze(e,{spinDotDefault:e.colorTextDescription,spinDotSize:e.controlHeightLG/2,spinDotSizeSM:e.controlHeightLG*.35,spinDotSizeLG:e.controlHeight});return[ere(t)]},{contentHeight:400});var nre=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefixCls:String,spinning:{type:Boolean,default:void 0},size:String,wrapperClassName:String,tip:K.any,delay:Number,indicator:K.any});let Yd=null;function rre(e,t){return!!e&&!!t&&!isNaN(Number(t))}function ire(e){const t=e.indicator;Yd=typeof t=="function"?t:()=>p(t,null,null)}const _r=re({compatConfig:{MODE:3},name:"ASpin",inheritAttrs:!1,props:Qe(ore(),{size:"default",spinning:!0,wrapperClassName:""}),setup(e,t){let{attrs:n,slots:o}=t;const{prefixCls:r,size:i,direction:l}=Ee("spin",e),[a,s]=tre(r),c=oe(e.spinning&&!rre(e.spinning,e.delay));let u;return ye([()=>e.spinning,()=>e.delay],()=>{u==null||u.cancel(),u=Joe(e.delay,()=>{c.value=e.spinning}),u==null||u()},{immediate:!0,flush:"post"}),et(()=>{u==null||u.cancel()}),()=>{var d,f;const{class:h}=n,v=nre(n,["class"]),{tip:g=(d=o.tip)===null||d===void 0?void 0:d.call(o)}=e,b=(f=o.default)===null||f===void 0?void 0:f.call(o),y={[s.value]:!0,[r.value]:!0,[`${r.value}-sm`]:i.value==="small",[`${r.value}-lg`]:i.value==="large",[`${r.value}-spinning`]:c.value,[`${r.value}-show-text`]:!!g,[`${r.value}-rtl`]:l.value==="rtl",[h]:!!h};function S(w){const C=`${w}-dot`;let O=ln(o,e,"indicator");return O===null?null:(Array.isArray(O)&&(O=O.length===1?O[0]:O),Yt(O)?mn(O,{class:C}):Yd&&Yt(Yd())?mn(Yd(),{class:C}):p("span",{class:`${C} ${w}-dot-spin`},[p("i",{class:`${w}-dot-item`},null),p("i",{class:`${w}-dot-item`},null),p("i",{class:`${w}-dot-item`},null),p("i",{class:`${w}-dot-item`},null)]))}const $=p("div",B(B({},v),{},{class:y,"aria-live":"polite","aria-busy":c.value}),[S(r.value),g?p("div",{class:`${r.value}-text`},[g]):null]);if(b&&kt(b).length){const w={[`${r.value}-container`]:!0,[`${r.value}-blur`]:c.value};return a(p("div",{class:[`${r.value}-nested-loading`,e.wrapperClassName,s.value]},[c.value&&p("div",{key:"loading"},[$]),p("div",{class:w,key:"container"},[b])]))}return a($)}}});_r.setDefaultIndicator=ire;_r.install=function(e){return e.component(_r.name,_r),e};var lre={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"}}]},name:"double-left",theme:"outlined"};function Z2(e){for(var t=1;t{const r=m(m(m({},e),{size:"small"}),n);return p(Cn,r,o)}}}),dre=re({name:"MiddleSelect",inheritAttrs:!1,props:gh(),Option:Cn.Option,setup(e,t){let{attrs:n,slots:o}=t;return()=>{const r=m(m(m({},e),{size:"middle"}),n);return p(Cn,r,o)}}}),sl=re({compatConfig:{MODE:3},name:"Pager",inheritAttrs:!1,props:{rootPrefixCls:String,page:Number,active:{type:Boolean,default:void 0},last:{type:Boolean,default:void 0},locale:K.object,showTitle:{type:Boolean,default:void 0},itemRender:{type:Function,default:()=>{}},onClick:{type:Function},onKeypress:{type:Function}},eimt:["click","keypress"],setup(e,t){let{emit:n,attrs:o}=t;const r=()=>{n("click",e.page)},i=l=>{n("keypress",l,r,e.page)};return()=>{const{showTitle:l,page:a,itemRender:s}=e,{class:c,style:u}=o,d=`${e.rootPrefixCls}-item`,f=le(d,`${d}-${e.page}`,{[`${d}-active`]:e.active,[`${d}-disabled`]:!e.page},c);return p("li",{onClick:r,onKeypress:i,title:l?String(a):null,tabindex:"0",class:f,style:u},[s({page:a,type:"page",originalElement:p("a",{rel:"nofollow"},[a])})])}}}),dl={ENTER:13,ARROW_UP:38,ARROW_DOWN:40},fre=re({compatConfig:{MODE:3},props:{disabled:{type:Boolean,default:void 0},changeSize:Function,quickGo:Function,selectComponentClass:K.any,current:Number,pageSizeOptions:K.array.def(["10","20","50","100"]),pageSize:Number,buildOptionText:Function,locale:K.object,rootPrefixCls:String,selectPrefixCls:String,goButton:K.any},setup(e){const t=ne(""),n=P(()=>!t.value||isNaN(t.value)?void 0:Number(t.value)),o=s=>`${s.value} ${e.locale.items_per_page}`,r=s=>{const{value:c}=s.target;t.value!==c&&(t.value=c)},i=s=>{const{goButton:c,quickGo:u,rootPrefixCls:d}=e;if(!(c||t.value===""))if(s.relatedTarget&&(s.relatedTarget.className.indexOf(`${d}-item-link`)>=0||s.relatedTarget.className.indexOf(`${d}-item`)>=0)){t.value="";return}else u(n.value),t.value=""},l=s=>{t.value!==""&&(s.keyCode===dl.ENTER||s.type==="click")&&(e.quickGo(n.value),t.value="")},a=P(()=>{const{pageSize:s,pageSizeOptions:c}=e;return c.some(u=>u.toString()===s.toString())?c:c.concat([s.toString()]).sort((u,d)=>{const f=isNaN(Number(u))?0:Number(u),h=isNaN(Number(d))?0:Number(d);return f-h})});return()=>{const{rootPrefixCls:s,locale:c,changeSize:u,quickGo:d,goButton:f,selectComponentClass:h,selectPrefixCls:v,pageSize:g,disabled:b}=e,y=`${s}-options`;let S=null,$=null,w=null;if(!u&&!d)return null;if(u&&h){const C=e.buildOptionText||o,O=a.value.map((x,I)=>p(h.Option,{key:I,value:x},{default:()=>[C({value:x})]}));S=p(h,{disabled:b,prefixCls:v,showSearch:!1,class:`${y}-size-changer`,optionLabelProp:"children",value:(g||a.value[0]).toString(),onChange:x=>u(Number(x)),getPopupContainer:x=>x.parentNode},{default:()=>[O]})}return d&&(f&&(w=typeof f=="boolean"?p("button",{type:"button",onClick:l,onKeyup:l,disabled:b,class:`${y}-quick-jumper-button`},[c.jump_to_confirm]):p("span",{onClick:l,onKeyup:l},[f])),$=p("div",{class:`${y}-quick-jumper`},[c.jump_to,p(ss,{disabled:b,type:"text",value:t.value,onInput:r,onChange:r,onKeyup:l,onBlur:i},null),c.page,w])),p("li",{class:`${y}`},[S,$])}}}),zE={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页"};var pre=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r"u"?t.statePageSize:e;return Math.floor((n.total-1)/o)+1}const vre=re({compatConfig:{MODE:3},name:"Pagination",mixins:[Yl],inheritAttrs:!1,props:{disabled:{type:Boolean,default:void 0},prefixCls:K.string.def("rc-pagination"),selectPrefixCls:K.string.def("rc-select"),current:Number,defaultCurrent:K.number.def(1),total:K.number.def(0),pageSize:Number,defaultPageSize:K.number.def(10),hideOnSinglePage:{type:Boolean,default:!1},showSizeChanger:{type:Boolean,default:void 0},showLessItems:{type:Boolean,default:!1},selectComponentClass:K.any,showPrevNextJumpers:{type:Boolean,default:!0},showQuickJumper:K.oneOfType([K.looseBool,K.object]).def(!1),showTitle:{type:Boolean,default:!0},pageSizeOptions:K.arrayOf(K.oneOfType([K.number,K.string])),buildOptionText:Function,showTotal:Function,simple:{type:Boolean,default:void 0},locale:K.object.def(zE),itemRender:K.func.def(gre),prevIcon:K.any,nextIcon:K.any,jumpPrevIcon:K.any,jumpNextIcon:K.any,totalBoundaryShowSizeChanger:K.number.def(50)},data(){const e=this.$props;let t=zf([this.current,this.defaultCurrent]);const n=zf([this.pageSize,this.defaultPageSize]);return t=Math.min(t,zr(n,void 0,e)),{stateCurrent:t,stateCurrentInputValue:t,statePageSize:n}},watch:{current(e){this.setState({stateCurrent:e,stateCurrentInputValue:e})},pageSize(e){const t={};let n=this.stateCurrent;const o=zr(e,this.$data,this.$props);n=n>o?o:n,Xr(this,"current")||(t.stateCurrent=n,t.stateCurrentInputValue=n),t.statePageSize=e,this.setState(t)},stateCurrent(e,t){this.$nextTick(()=>{if(this.$refs.paginationNode){const n=this.$refs.paginationNode.querySelector(`.${this.prefixCls}-item-${t}`);n&&document.activeElement===n&&n.blur()}})},total(){const e={},t=zr(this.pageSize,this.$data,this.$props);if(Xr(this,"current")){const n=Math.min(this.current,t);e.stateCurrent=n,e.stateCurrentInputValue=n}else{let n=this.stateCurrent;n===0&&t>0?n=1:n=Math.min(this.stateCurrent,t),e.stateCurrent=n}this.setState(e)}},methods:{getJumpPrevPage(){return Math.max(1,this.stateCurrent-(this.showLessItems?3:5))},getJumpNextPage(){return Math.min(zr(void 0,this.$data,this.$props),this.stateCurrent+(this.showLessItems?3:5))},getItemIcon(e,t){const{prefixCls:n}=this.$props;return yO(this,e,this.$props)||p("button",{type:"button","aria-label":t,class:`${n}-item-link`},null)},getValidValue(e){const t=e.target.value,n=zr(void 0,this.$data,this.$props),{stateCurrentInputValue:o}=this.$data;let r;return t===""?r=t:isNaN(Number(t))?r=o:t>=n?r=n:r=Number(t),r},isValid(e){return hre(e)&&e!==this.stateCurrent},shouldDisplayQuickJumper(){const{showQuickJumper:e,pageSize:t,total:n}=this.$props;return n<=t?!1:e},handleKeyDown(e){(e.keyCode===dl.ARROW_UP||e.keyCode===dl.ARROW_DOWN)&&e.preventDefault()},handleKeyUp(e){const t=this.getValidValue(e),n=this.stateCurrentInputValue;t!==n&&this.setState({stateCurrentInputValue:t}),e.keyCode===dl.ENTER?this.handleChange(t):e.keyCode===dl.ARROW_UP?this.handleChange(t-1):e.keyCode===dl.ARROW_DOWN&&this.handleChange(t+1)},changePageSize(e){let t=this.stateCurrent;const n=t,o=zr(e,this.$data,this.$props);t=t>o?o:t,o===0&&(t=this.stateCurrent),typeof e=="number"&&(Xr(this,"pageSize")||this.setState({statePageSize:e}),Xr(this,"current")||this.setState({stateCurrent:t,stateCurrentInputValue:t})),this.__emit("update:pageSize",e),t!==n&&this.__emit("update:current",t),this.__emit("showSizeChange",t,e),this.__emit("change",t,e)},handleChange(e){const{disabled:t}=this.$props;let n=e;if(this.isValid(n)&&!t){const o=zr(void 0,this.$data,this.$props);return n>o?n=o:n<1&&(n=1),Xr(this,"current")||this.setState({stateCurrent:n,stateCurrentInputValue:n}),this.__emit("update:current",n),this.__emit("change",n,this.statePageSize),n}return this.stateCurrent},prev(){this.hasPrev()&&this.handleChange(this.stateCurrent-1)},next(){this.hasNext()&&this.handleChange(this.stateCurrent+1)},jumpPrev(){this.handleChange(this.getJumpPrevPage())},jumpNext(){this.handleChange(this.getJumpNextPage())},hasPrev(){return this.stateCurrent>1},hasNext(){return this.stateCurrentn},runIfEnter(e,t){if(e.key==="Enter"||e.charCode===13){e.preventDefault();for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r0?y-1:0,D=y+1=z*2&&y!==3&&(x[0]=p(sl,{locale:r,rootPrefixCls:e,onClick:this.handleChange,onKeypress:this.runIfEnter,key:X,page:X,class:`${e}-item-after-jump-prev`,active:!1,showTitle:this.showTitle,itemRender:u},null),x.unshift(I)),O-y>=z*2&&y!==O-2&&(x[x.length-1]=p(sl,{locale:r,rootPrefixCls:e,onClick:this.handleChange,onKeypress:this.runIfEnter,key:ee,page:ee,class:`${e}-item-before-jump-next`,active:!1,showTitle:this.showTitle,itemRender:u},null),x.push(T)),X!==1&&x.unshift(M),ee!==O&&x.push(E)}let F=null;s&&(F=p("li",{class:`${e}-total-text`},[s(o,[o===0?0:(y-1)*S+1,y*S>o?o:y*S])]));const L=!N||!O,H=!k||!O,j=this.buildOptionText||this.$slots.buildOptionText;return p("ul",B(B({unselectable:"on",ref:"paginationNode"},C),{},{class:le({[`${e}`]:!0,[`${e}-disabled`]:t},w)}),[F,p("li",{title:a?r.prev_page:null,onClick:this.prev,tabindex:L?null:0,onKeypress:this.runIfEnterPrev,class:le(`${e}-prev`,{[`${e}-disabled`]:L}),"aria-disabled":L},[this.renderPrev(_)]),x,p("li",{title:a?r.next_page:null,onClick:this.next,tabindex:H?null:0,onKeypress:this.runIfEnterNext,class:le(`${e}-next`,{[`${e}-disabled`]:H}),"aria-disabled":H},[this.renderNext(D)]),p(fre,{disabled:t,locale:r,rootPrefixCls:e,selectComponentClass:v,selectPrefixCls:g,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:y,pageSize:S,pageSizeOptions:b,buildOptionText:j||null,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:R},null)])}}),mre=e=>{const{componentCls:t}=e;return{[`${t}-disabled`]:{"&, &:hover":{cursor:"not-allowed",[`${t}-item-link`]:{color:e.colorTextDisabled,cursor:"not-allowed"}},"&:focus-visible":{cursor:"not-allowed",[`${t}-item-link`]:{color:e.colorTextDisabled,cursor:"not-allowed"}}},[`&${t}-disabled`]:{cursor:"not-allowed",[`&${t}-mini`]:{[` + &:hover ${t}-item:not(${t}-item-active), + &:active ${t}-item:not(${t}-item-active), + &:hover ${t}-item-link, + &:active ${t}-item-link + `]:{backgroundColor:"transparent"}},[`${t}-item`]:{cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},a:{color:e.colorTextDisabled,backgroundColor:"transparent",border:"none",cursor:"not-allowed"},"&-active":{borderColor:e.colorBorder,backgroundColor:e.paginationItemDisabledBgActive,"&:hover, &:active":{backgroundColor:e.paginationItemDisabledBgActive},a:{color:e.paginationItemDisabledColorActive}}},[`${t}-item-link`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},[`${t}-simple&`]:{backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"}}},[`${t}-simple-pager`]:{color:e.colorTextDisabled},[`${t}-jump-prev, ${t}-jump-next`]:{[`${t}-item-link-icon`]:{opacity:0},[`${t}-item-ellipsis`]:{opacity:1}}},[`&${t}-simple`]:{[`${t}-prev, ${t}-next`]:{[`&${t}-disabled ${t}-item-link`]:{"&:hover, &:active":{backgroundColor:"transparent"}}}}}},bre=e=>{const{componentCls:t}=e;return{[`&${t}-mini ${t}-total-text, &${t}-mini ${t}-simple-pager`]:{height:e.paginationItemSizeSM,lineHeight:`${e.paginationItemSizeSM}px`},[`&${t}-mini ${t}-item`]:{minWidth:e.paginationItemSizeSM,height:e.paginationItemSizeSM,margin:0,lineHeight:`${e.paginationItemSizeSM-2}px`},[`&${t}-mini ${t}-item:not(${t}-item-active)`]:{backgroundColor:"transparent",borderColor:"transparent","&:hover":{backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},[`&${t}-mini ${t}-prev, &${t}-mini ${t}-next`]:{minWidth:e.paginationItemSizeSM,height:e.paginationItemSizeSM,margin:0,lineHeight:`${e.paginationItemSizeSM}px`,[`&:hover ${t}-item-link`]:{backgroundColor:e.colorBgTextHover},[`&:active ${t}-item-link`]:{backgroundColor:e.colorBgTextActive},[`&${t}-disabled:hover ${t}-item-link`]:{backgroundColor:"transparent"}},[` + &${t}-mini ${t}-prev ${t}-item-link, + &${t}-mini ${t}-next ${t}-item-link + `]:{backgroundColor:"transparent",borderColor:"transparent","&::after":{height:e.paginationItemSizeSM,lineHeight:`${e.paginationItemSizeSM}px`}},[`&${t}-mini ${t}-jump-prev, &${t}-mini ${t}-jump-next`]:{height:e.paginationItemSizeSM,marginInlineEnd:0,lineHeight:`${e.paginationItemSizeSM}px`},[`&${t}-mini ${t}-options`]:{marginInlineStart:e.paginationMiniOptionsMarginInlineStart,"&-size-changer":{top:e.paginationMiniOptionsSizeChangerTop},"&-quick-jumper":{height:e.paginationItemSizeSM,lineHeight:`${e.paginationItemSizeSM}px`,input:m(m({},S1(e)),{width:e.paginationMiniQuickJumperInputWidth,height:e.controlHeightSM})}}}},yre=e=>{const{componentCls:t}=e;return{[` + &${t}-simple ${t}-prev, + &${t}-simple ${t}-next + `]:{height:e.paginationItemSizeSM,lineHeight:`${e.paginationItemSizeSM}px`,verticalAlign:"top",[`${t}-item-link`]:{height:e.paginationItemSizeSM,backgroundColor:"transparent",border:0,"&:hover":{backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive},"&::after":{height:e.paginationItemSizeSM,lineHeight:`${e.paginationItemSizeSM}px`}}},[`&${t}-simple ${t}-simple-pager`]:{display:"inline-block",height:e.paginationItemSizeSM,marginInlineEnd:e.marginXS,input:{boxSizing:"border-box",height:"100%",marginInlineEnd:e.marginXS,padding:`0 ${e.paginationItemPaddingInline}px`,textAlign:"center",backgroundColor:e.paginationItemInputBg,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadius,outline:"none",transition:`border-color ${e.motionDurationMid}`,color:"inherit","&:hover":{borderColor:e.colorPrimary},"&:focus":{borderColor:e.colorPrimaryHover,boxShadow:`${e.inputOutlineOffset}px 0 ${e.controlOutlineWidth}px ${e.controlOutline}`},"&[disabled]":{color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,cursor:"not-allowed"}}}}},Sre=e=>{const{componentCls:t}=e;return{[`${t}-jump-prev, ${t}-jump-next`]:{outline:0,[`${t}-item-container`]:{position:"relative",[`${t}-item-link-icon`]:{color:e.colorPrimary,fontSize:e.fontSizeSM,opacity:0,transition:`all ${e.motionDurationMid}`,"&-svg":{top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,margin:"auto"}},[`${t}-item-ellipsis`]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,display:"block",margin:"auto",color:e.colorTextDisabled,fontFamily:"Arial, Helvetica, sans-serif",letterSpacing:e.paginationEllipsisLetterSpacing,textAlign:"center",textIndent:e.paginationEllipsisTextIndent,opacity:1,transition:`all ${e.motionDurationMid}`}},"&:hover":{[`${t}-item-link-icon`]:{opacity:1},[`${t}-item-ellipsis`]:{opacity:0}},"&:focus-visible":m({[`${t}-item-link-icon`]:{opacity:1},[`${t}-item-ellipsis`]:{opacity:0}},ni(e))},[` + ${t}-prev, + ${t}-jump-prev, + ${t}-jump-next + `]:{marginInlineEnd:e.marginXS},[` + ${t}-prev, + ${t}-next, + ${t}-jump-prev, + ${t}-jump-next + `]:{display:"inline-block",minWidth:e.paginationItemSize,height:e.paginationItemSize,color:e.colorText,fontFamily:e.paginationFontFamily,lineHeight:`${e.paginationItemSize}px`,textAlign:"center",verticalAlign:"middle",listStyle:"none",borderRadius:e.borderRadius,cursor:"pointer",transition:`all ${e.motionDurationMid}`},[`${t}-prev, ${t}-next`]:{fontFamily:"Arial, Helvetica, sans-serif",outline:0,button:{color:e.colorText,cursor:"pointer",userSelect:"none"},[`${t}-item-link`]:{display:"block",width:"100%",height:"100%",padding:0,fontSize:e.fontSizeSM,textAlign:"center",backgroundColor:"transparent",border:`${e.lineWidth}px ${e.lineType} transparent`,borderRadius:e.borderRadius,outline:"none",transition:`all ${e.motionDurationMid}`},[`&:focus-visible ${t}-item-link`]:m({},ni(e)),[`&:hover ${t}-item-link`]:{backgroundColor:e.colorBgTextHover},[`&:active ${t}-item-link`]:{backgroundColor:e.colorBgTextActive},[`&${t}-disabled:hover`]:{[`${t}-item-link`]:{backgroundColor:"transparent"}}},[`${t}-slash`]:{marginInlineEnd:e.paginationSlashMarginInlineEnd,marginInlineStart:e.paginationSlashMarginInlineStart},[`${t}-options`]:{display:"inline-block",marginInlineStart:e.margin,verticalAlign:"middle","&-size-changer.-select":{display:"inline-block",width:"auto"},"&-quick-jumper":{display:"inline-block",height:e.controlHeight,marginInlineStart:e.marginXS,lineHeight:`${e.controlHeight}px`,verticalAlign:"top",input:m(m({},ta(e)),{width:e.controlHeightLG*1.25,height:e.controlHeight,boxSizing:"border-box",margin:0,marginInlineStart:e.marginXS,marginInlineEnd:e.marginXS})}}}},$re=e=>{const{componentCls:t}=e;return{[`${t}-item`]:m(m({display:"inline-block",minWidth:e.paginationItemSize,height:e.paginationItemSize,marginInlineEnd:e.marginXS,fontFamily:e.paginationFontFamily,lineHeight:`${e.paginationItemSize-2}px`,textAlign:"center",verticalAlign:"middle",listStyle:"none",backgroundColor:"transparent",border:`${e.lineWidth}px ${e.lineType} transparent`,borderRadius:e.borderRadius,outline:0,cursor:"pointer",userSelect:"none",a:{display:"block",padding:`0 ${e.paginationItemPaddingInline}px`,color:e.colorText,transition:"none","&:hover":{textDecoration:"none"}},[`&:not(${t}-item-active)`]:{"&:hover":{transition:`all ${e.motionDurationMid}`,backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}}},oi(e)),{"&-active":{fontWeight:e.paginationFontWeightActive,backgroundColor:e.paginationItemBgActive,borderColor:e.colorPrimary,a:{color:e.colorPrimary},"&:hover":{borderColor:e.colorPrimaryHover},"&:hover a":{color:e.colorPrimaryHover}}})}},Cre=e=>{const{componentCls:t}=e;return{[t]:m(m(m(m(m(m(m(m({},qe(e)),{"ul, ol":{margin:0,padding:0,listStyle:"none"},"&::after":{display:"block",clear:"both",height:0,overflow:"hidden",visibility:"hidden",content:'""'},[`${t}-total-text`]:{display:"inline-block",height:e.paginationItemSize,marginInlineEnd:e.marginXS,lineHeight:`${e.paginationItemSize-2}px`,verticalAlign:"middle"}}),$re(e)),Sre(e)),yre(e)),bre(e)),mre(e)),{[`@media only screen and (max-width: ${e.screenLG}px)`]:{[`${t}-item`]:{"&-after-jump-prev, &-before-jump-next":{display:"none"}}},[`@media only screen and (max-width: ${e.screenSM}px)`]:{[`${t}-options`]:{display:"none"}}}),[`&${e.componentCls}-rtl`]:{direction:"rtl"}}},xre=e=>{const{componentCls:t}=e;return{[`${t}${t}-disabled`]:{"&, &:hover":{[`${t}-item-link`]:{borderColor:e.colorBorder}},"&:focus-visible":{[`${t}-item-link`]:{borderColor:e.colorBorder}},[`${t}-item, ${t}-item-link`]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,[`&:hover:not(${t}-item-active)`]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,a:{color:e.colorTextDisabled}},[`&${t}-item-active`]:{backgroundColor:e.paginationItemDisabledBgActive}},[`${t}-prev, ${t}-next`]:{"&:hover button":{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,color:e.colorTextDisabled},[`${t}-item-link`]:{backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder}}},[t]:{[`${t}-prev, ${t}-next`]:{"&:hover button":{borderColor:e.colorPrimaryHover,backgroundColor:e.paginationItemBg},[`${t}-item-link`]:{backgroundColor:e.paginationItemLinkBg,borderColor:e.colorBorder},[`&:hover ${t}-item-link`]:{borderColor:e.colorPrimary,backgroundColor:e.paginationItemBg,color:e.colorPrimary},[`&${t}-disabled`]:{[`${t}-item-link`]:{borderColor:e.colorBorder,color:e.colorTextDisabled}}},[`${t}-item`]:{backgroundColor:e.paginationItemBg,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,[`&:hover:not(${t}-item-active)`]:{borderColor:e.colorPrimary,backgroundColor:e.paginationItemBg,a:{color:e.colorPrimary}},"&-active":{borderColor:e.colorPrimary}}}}},wre=Ue("Pagination",e=>{const t=ze(e,{paginationItemSize:e.controlHeight,paginationFontFamily:e.fontFamily,paginationItemBg:e.colorBgContainer,paginationItemBgActive:e.colorBgContainer,paginationFontWeightActive:e.fontWeightStrong,paginationItemSizeSM:e.controlHeightSM,paginationItemInputBg:e.colorBgContainer,paginationMiniOptionsSizeChangerTop:0,paginationItemDisabledBgActive:e.controlItemBgActiveDisabled,paginationItemDisabledColorActive:e.colorTextDisabled,paginationItemLinkBg:e.colorBgContainer,inputOutlineOffset:"0 0",paginationMiniOptionsMarginInlineStart:e.marginXXS/2,paginationMiniQuickJumperInputWidth:e.controlHeightLG*1.1,paginationItemPaddingInline:e.marginXXS*1.5,paginationEllipsisLetterSpacing:e.marginXXS/2,paginationSlashMarginInlineStart:e.marginXXS,paginationSlashMarginInlineEnd:e.marginSM,paginationEllipsisTextIndent:"0.13em"},na(e));return[Cre(t),e.wireframe&&xre(t)]});var Ore=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({total:Number,defaultCurrent:Number,disabled:$e(),current:Number,defaultPageSize:Number,pageSize:Number,hideOnSinglePage:$e(),showSizeChanger:$e(),pageSizeOptions:ct(),buildOptionText:ve(),showQuickJumper:He([Boolean,Object]),showTotal:ve(),size:Ne(),simple:$e(),locale:Object,prefixCls:String,selectPrefixCls:String,totalBoundaryShowSizeChanger:Number,selectComponentClass:String,itemRender:ve(),role:String,responsive:Boolean,showLessItems:$e(),onChange:ve(),onShowSizeChange:ve(),"onUpdate:current":ve(),"onUpdate:pageSize":ve()}),Ire=re({compatConfig:{MODE:3},name:"APagination",inheritAttrs:!1,props:Pre(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,configProvider:i,direction:l,size:a}=Ee("pagination",e),[s,c]=wre(r),u=P(()=>i.getPrefixCls("select",e.selectPrefixCls)),d=ps(),[f]=Uo("Pagination",EO,We(e,"locale")),h=v=>{const g=p("span",{class:`${v}-item-ellipsis`},[Pt("•••")]),b=p("button",{class:`${v}-item-link`,type:"button",tabindex:-1},[l.value==="rtl"?p(Eo,null,null):p(Dr,null,null)]),y=p("button",{class:`${v}-item-link`,type:"button",tabindex:-1},[l.value==="rtl"?p(Dr,null,null):p(Eo,null,null)]),S=p("a",{rel:"nofollow",class:`${v}-item-link`},[p("div",{class:`${v}-item-container`},[l.value==="rtl"?p(hp,{class:`${v}-item-link-icon`},null):p(pp,{class:`${v}-item-link-icon`},null),g])]),$=p("a",{rel:"nofollow",class:`${v}-item-link`},[p("div",{class:`${v}-item-container`},[l.value==="rtl"?p(pp,{class:`${v}-item-link-icon`},null):p(hp,{class:`${v}-item-link-icon`},null),g])]);return{prevIcon:b,nextIcon:y,jumpPrevIcon:S,jumpNextIcon:$}};return()=>{var v;const{itemRender:g=n.itemRender,buildOptionText:b=n.buildOptionText,selectComponentClass:y,responsive:S}=e,$=Ore(e,["itemRender","buildOptionText","selectComponentClass","responsive"]),w=a.value==="small"||!!(!((v=d.value)===null||v===void 0)&&v.xs&&!a.value&&S),C=m(m(m(m(m({},$),h(r.value)),{prefixCls:r.value,selectPrefixCls:u.value,selectComponentClass:y||(w?ure:dre),locale:f.value,buildOptionText:b}),o),{class:le({[`${r.value}-mini`]:w,[`${r.value}-rtl`]:l.value==="rtl"},o.class,c.value),itemRender:g});return s(p(vre,C,null))}}}),Vh=Bt(Ire),Tre=()=>({avatar:K.any,description:K.any,prefixCls:String,title:K.any}),HE=re({compatConfig:{MODE:3},name:"AListItemMeta",props:Tre(),displayName:"AListItemMeta",__ANT_LIST_ITEM_META:!0,slots:Object,setup(e,t){let{slots:n}=t;const{prefixCls:o}=Ee("list",e);return()=>{var r,i,l,a,s,c;const u=`${o.value}-item-meta`,d=(r=e.title)!==null&&r!==void 0?r:(i=n.title)===null||i===void 0?void 0:i.call(n),f=(l=e.description)!==null&&l!==void 0?l:(a=n.description)===null||a===void 0?void 0:a.call(n),h=(s=e.avatar)!==null&&s!==void 0?s:(c=n.avatar)===null||c===void 0?void 0:c.call(n),v=p("div",{class:`${o.value}-item-meta-content`},[d&&p("h4",{class:`${o.value}-item-meta-title`},[d]),f&&p("div",{class:`${o.value}-item-meta-description`},[f])]);return p("div",{class:u},[h&&p("div",{class:`${o.value}-item-meta-avatar`},[h]),(d||f)&&v])}}}),jE=Symbol("ListContextKey");var Ere=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefixCls:String,extra:K.any,actions:K.array,grid:Object,colStyle:{type:Object,default:void 0}}),VE=re({compatConfig:{MODE:3},name:"AListItem",inheritAttrs:!1,Meta:HE,props:_re(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{itemLayout:r,grid:i}=Ge(jE,{grid:ne(),itemLayout:ne()}),{prefixCls:l}=Ee("list",e),a=()=>{var c;const u=((c=n.default)===null||c===void 0?void 0:c.call(n))||[];let d;return u.forEach(f=>{AR(f)&&!qc(f)&&(d=!0)}),d&&u.length>1},s=()=>{var c,u;const d=(c=e.extra)!==null&&c!==void 0?c:(u=n.extra)===null||u===void 0?void 0:u.call(n);return r.value==="vertical"?!!d:!a()};return()=>{var c,u,d,f,h;const{class:v}=o,g=Ere(o,["class"]),b=l.value,y=(c=e.extra)!==null&&c!==void 0?c:(u=n.extra)===null||u===void 0?void 0:u.call(n),S=(d=n.default)===null||d===void 0?void 0:d.call(n);let $=(f=e.actions)!==null&&f!==void 0?f:wt((h=n.actions)===null||h===void 0?void 0:h.call(n));$=$&&!Array.isArray($)?[$]:$;const w=$&&$.length>0&&p("ul",{class:`${b}-item-action`,key:"actions"},[$.map((x,I)=>p("li",{key:`${b}-item-action-${I}`},[x,I!==$.length-1&&p("em",{class:`${b}-item-action-split`},null)]))]),C=i.value?"div":"li",O=p(C,B(B({},g),{},{class:le(`${b}-item`,{[`${b}-item-no-flex`]:!s()},v)}),{default:()=>[r.value==="vertical"&&y?[p("div",{class:`${b}-item-main`,key:"content"},[S,w]),p("div",{class:`${b}-item-extra`,key:"extra"},[y])]:[S,w,pt(y,{key:"extra"})]]});return i.value?p(Nh,{flex:1,style:e.colStyle},{default:()=>[O]}):O}}}),Mre=e=>{const{listBorderedCls:t,componentCls:n,paddingLG:o,margin:r,padding:i,listItemPaddingSM:l,marginLG:a,borderRadiusLG:s}=e;return{[`${t}`]:{border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:s,[`${n}-header,${n}-footer,${n}-item`]:{paddingInline:o},[`${n}-pagination`]:{margin:`${r}px ${a}px`}},[`${t}${n}-sm`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:l}},[`${t}${n}-lg`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:`${i}px ${o}px`}}}},Are=e=>{const{componentCls:t,screenSM:n,screenMD:o,marginLG:r,marginSM:i,margin:l}=e;return{[`@media screen and (max-width:${o})`]:{[`${t}`]:{[`${t}-item`]:{[`${t}-item-action`]:{marginInlineStart:r}}},[`${t}-vertical`]:{[`${t}-item`]:{[`${t}-item-extra`]:{marginInlineStart:r}}}},[`@media screen and (max-width: ${n})`]:{[`${t}`]:{[`${t}-item`]:{flexWrap:"wrap",[`${t}-action`]:{marginInlineStart:i}}},[`${t}-vertical`]:{[`${t}-item`]:{flexWrap:"wrap-reverse",[`${t}-item-main`]:{minWidth:e.contentWidth},[`${t}-item-extra`]:{margin:`auto auto ${l}px`}}}}}},Rre=e=>{const{componentCls:t,antCls:n,controlHeight:o,minHeight:r,paddingSM:i,marginLG:l,padding:a,listItemPadding:s,colorPrimary:c,listItemPaddingSM:u,listItemPaddingLG:d,paddingXS:f,margin:h,colorText:v,colorTextDescription:g,motionDurationSlow:b,lineWidth:y}=e;return{[`${t}`]:m(m({},qe(e)),{position:"relative","*":{outline:"none"},[`${t}-header, ${t}-footer`]:{background:"transparent",paddingBlock:i},[`${t}-pagination`]:{marginBlockStart:l,textAlign:"end",[`${n}-pagination-options`]:{textAlign:"start"}},[`${t}-spin`]:{minHeight:r,textAlign:"center"},[`${t}-items`]:{margin:0,padding:0,listStyle:"none"},[`${t}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:s,color:v,[`${t}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${t}-item-meta-avatar`]:{marginInlineEnd:a},[`${t}-item-meta-content`]:{flex:"1 0",width:0,color:v},[`${t}-item-meta-title`]:{marginBottom:e.marginXXS,color:v,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:v,transition:`all ${b}`,"&:hover":{color:c}}},[`${t}-item-meta-description`]:{color:g,fontSize:e.fontSize,lineHeight:e.lineHeight}},[`${t}-item-action`]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${f}px`,color:g,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${t}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:y,height:Math.ceil(e.fontSize*e.lineHeight)-e.marginXXS*2,transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},[`${t}-empty`]:{padding:`${a}px 0`,color:g,fontSize:e.fontSizeSM,textAlign:"center"},[`${t}-empty-text`]:{padding:a,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},[`${t}-item-no-flex`]:{display:"block"}}),[`${t}-grid ${n}-col > ${t}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:h,paddingBlock:0,borderBlockEnd:"none"},[`${t}-vertical ${t}-item`]:{alignItems:"initial",[`${t}-item-main`]:{display:"block",flex:1},[`${t}-item-extra`]:{marginInlineStart:l},[`${t}-item-meta`]:{marginBlockEnd:a,[`${t}-item-meta-title`]:{marginBlockEnd:i,color:v,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},[`${t}-item-action`]:{marginBlockStart:a,marginInlineStart:"auto","> li":{padding:`0 ${a}px`,"&:first-child":{paddingInlineStart:0}}}},[`${t}-split ${t}-item`]:{borderBlockEnd:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${t}-split ${t}-header`]:{borderBlockEnd:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`},[`${t}-split${t}-empty ${t}-footer`]:{borderTop:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`},[`${t}-loading ${t}-spin-nested-loading`]:{minHeight:o},[`${t}-split${t}-something-after-last-item ${n}-spin-container > ${t}-items > ${t}-item:last-child`]:{borderBlockEnd:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`},[`${t}-lg ${t}-item`]:{padding:d},[`${t}-sm ${t}-item`]:{padding:u},[`${t}:not(${t}-vertical)`]:{[`${t}-item-no-flex`]:{[`${t}-item-action`]:{float:"right"}}}}},Dre=Ue("List",e=>{const t=ze(e,{listBorderedCls:`${e.componentCls}-bordered`,minHeight:e.controlHeightLG,listItemPadding:`${e.paddingContentVertical}px ${e.paddingContentHorizontalLG}px`,listItemPaddingSM:`${e.paddingContentVerticalSM}px ${e.paddingContentHorizontal}px`,listItemPaddingLG:`${e.paddingContentVerticalLG}px ${e.paddingContentHorizontalLG}px`});return[Rre(t),Mre(t),Are(t)]},{contentWidth:220}),Bre=()=>({bordered:$e(),dataSource:ct(),extra:Nn(),grid:Be(),itemLayout:String,loading:He([Boolean,Object]),loadMore:Nn(),pagination:He([Boolean,Object]),prefixCls:String,rowKey:He([String,Number,Function]),renderItem:ve(),size:String,split:$e(),header:Nn(),footer:Nn(),locale:Be()}),Ci=re({compatConfig:{MODE:3},name:"AList",inheritAttrs:!1,Item:VE,props:Qe(Bre(),{dataSource:[],bordered:!1,split:!0,loading:!1,pagination:!1}),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;var r,i;Ye(jE,{grid:We(e,"grid"),itemLayout:We(e,"itemLayout")});const l={current:1,total:0},{prefixCls:a,direction:s,renderEmpty:c}=Ee("list",e),[u,d]=Dre(a),f=P(()=>e.pagination&&typeof e.pagination=="object"?e.pagination:{}),h=ne((r=f.value.defaultCurrent)!==null&&r!==void 0?r:1),v=ne((i=f.value.defaultPageSize)!==null&&i!==void 0?i:10);ye(f,()=>{"current"in f.value&&(h.value=f.value.current),"pageSize"in f.value&&(v.value=f.value.pageSize)});const g=[],b=R=>(z,_)=>{h.value=z,v.value=_,f.value[R]&&f.value[R](z,_)},y=b("onChange"),S=b("onShowSizeChange"),$=P(()=>typeof e.loading=="boolean"?{spinning:e.loading}:e.loading),w=P(()=>$.value&&$.value.spinning),C=P(()=>{let R="";switch(e.size){case"large":R="lg";break;case"small":R="sm";break}return R}),O=P(()=>({[`${a.value}`]:!0,[`${a.value}-vertical`]:e.itemLayout==="vertical",[`${a.value}-${C.value}`]:C.value,[`${a.value}-split`]:e.split,[`${a.value}-bordered`]:e.bordered,[`${a.value}-loading`]:w.value,[`${a.value}-grid`]:!!e.grid,[`${a.value}-rtl`]:s.value==="rtl"})),x=P(()=>{const R=m(m(m({},l),{total:e.dataSource.length,current:h.value,pageSize:v.value}),e.pagination||{}),z=Math.ceil(R.total/R.pageSize);return R.current>z&&(R.current=z),R}),I=P(()=>{let R=[...e.dataSource];return e.pagination&&e.dataSource.length>(x.value.current-1)*x.value.pageSize&&(R=[...e.dataSource].splice((x.value.current-1)*x.value.pageSize,x.value.pageSize)),R}),T=ps(),M=$o(()=>{for(let R=0;R{if(!e.grid)return;const R=M.value&&e.grid[M.value]?e.grid[M.value]:e.grid.column;if(R)return{width:`${100/R}%`,maxWidth:`${100/R}%`}}),A=(R,z)=>{var _;const D=(_=e.renderItem)!==null&&_!==void 0?_:n.renderItem;if(!D)return null;let N;const k=typeof e.rowKey;return k==="function"?N=e.rowKey(R):k==="string"||k==="number"?N=R[e.rowKey]:N=R.key,N||(N=`list-item-${z}`),g[z]=N,D({item:R,index:z})};return()=>{var R,z,_,D,N,k,F,L;const H=(R=e.loadMore)!==null&&R!==void 0?R:(z=n.loadMore)===null||z===void 0?void 0:z.call(n),j=(_=e.footer)!==null&&_!==void 0?_:(D=n.footer)===null||D===void 0?void 0:D.call(n),Y=(N=e.header)!==null&&N!==void 0?N:(k=n.header)===null||k===void 0?void 0:k.call(n),Z=wt((F=n.default)===null||F===void 0?void 0:F.call(n)),X=!!(H||e.pagination||j),ee=le(m(m({},O.value),{[`${a.value}-something-after-last-item`]:X}),o.class,d.value),U=e.pagination?p("div",{class:`${a.value}-pagination`},[p(Vh,B(B({},x.value),{},{onChange:y,onShowSizeChange:S}),null)]):null;let Q=w.value&&p("div",{style:{minHeight:"53px"}},null);if(I.value.length>0){g.length=0;const G=I.value.map((V,W)=>A(V,W)),q=G.map((V,W)=>p("div",{key:g[W],style:E.value},[V]));Q=e.grid?p(D1,{gutter:e.grid.gutter},{default:()=>[q]}):p("ul",{class:`${a.value}-items`},[G])}else!Z.length&&!w.value&&(Q=p("div",{class:`${a.value}-empty-text`},[((L=e.locale)===null||L===void 0?void 0:L.emptyText)||c("List")]));const J=x.value.position||"bottom";return u(p("div",B(B({},o),{},{class:ee}),[(J==="top"||J==="both")&&U,Y&&p("div",{class:`${a.value}-header`},[Y]),p(_r,$.value,{default:()=>[Q,Z]}),j&&p("div",{class:`${a.value}-footer`},[j]),H||(J==="bottom"||J==="both")&&U]))}}});Ci.install=function(e){return e.component(Ci.name,Ci),e.component(Ci.Item.name,Ci.Item),e.component(Ci.Item.Meta.name,Ci.Item.Meta),e};function Nre(e){const{selectionStart:t}=e;return e.value.slice(0,t)}function kre(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(Array.isArray(t)?t:[t]).reduce((o,r)=>{const i=e.lastIndexOf(r);return i>o.location?{location:i,prefix:r}:o},{location:-1,prefix:""})}function e4(e){return(e||"").toLowerCase()}function Fre(e,t,n){const o=e[0];if(!o||o===n)return e;let r=e;const i=t.length;for(let l=0;l[]}},setup(e,t){let{slots:n}=t;const{activeIndex:o,setActiveIndex:r,selectOption:i,onFocus:l=Vre,loading:a}=Ge(WE,{activeIndex:oe(),loading:oe(!1)});let s;const c=u=>{clearTimeout(s),s=setTimeout(()=>{l(u)})};return et(()=>{clearTimeout(s)}),()=>{var u;const{prefixCls:d,options:f}=e,h=f[o.value]||{};return p(Xt,{prefixCls:`${d}-menu`,activeKey:h.value,onSelect:v=>{let{key:g}=v;const b=f.find(y=>{let{value:S}=y;return S===g});i(b)},onMousedown:c},{default:()=>[!a.value&&f.map((v,g)=>{var b,y;const{value:S,disabled:$,label:w=v.value,class:C,style:O}=v;return p(Er,{key:S,disabled:$,onMouseenter:()=>{r(g)},class:C,style:O},{default:()=>[(y=(b=n.option)===null||b===void 0?void 0:b.call(n,v))!==null&&y!==void 0?y:typeof w=="function"?w(v):w]})}),!a.value&&f.length===0?p(Er,{key:"notFoundContent",disabled:!0},{default:()=>[(u=n.notFoundContent)===null||u===void 0?void 0:u.call(n)]}):null,a.value&&p(Er,{key:"loading",disabled:!0},{default:()=>[p(_r,{size:"small"},null)]})]})}}}),Kre={bottomRight:{points:["tl","br"],offset:[0,4],overflow:{adjustX:0,adjustY:1}},bottomLeft:{points:["tr","bl"],offset:[0,4],overflow:{adjustX:0,adjustY:1}},topRight:{points:["bl","tr"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}},topLeft:{points:["br","tl"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}}},Gre=re({compatConfig:{MODE:3},name:"KeywordTrigger",props:{loading:{type:Boolean,default:void 0},options:{type:Array,default:()=>[]},prefixCls:String,placement:String,visible:{type:Boolean,default:void 0},transitionName:String,getPopupContainer:Function,direction:String,dropdownClassName:String},setup(e,t){let{slots:n}=t;const o=()=>`${e.prefixCls}-dropdown`,r=()=>{const{options:l}=e;return p(Wre,{prefixCls:o(),options:l},{notFoundContent:n.notFoundContent,option:n.option})},i=P(()=>{const{placement:l,direction:a}=e;let s="topRight";return a==="rtl"?s=l==="top"?"topLeft":"bottomLeft":s=l==="top"?"topRight":"bottomRight",s});return()=>{const{visible:l,transitionName:a,getPopupContainer:s}=e;return p(ql,{prefixCls:o(),popupVisible:l,popup:r(),popupClassName:e.dropdownClassName,popupPlacement:i.value,popupTransitionName:a,builtinPlacements:Kre,getPopupContainer:s},{default:n.default})}}}),Ure=Mn("top","bottom"),KE={autofocus:{type:Boolean,default:void 0},prefix:K.oneOfType([K.string,K.arrayOf(K.string)]),prefixCls:String,value:String,disabled:{type:Boolean,default:void 0},split:String,transitionName:String,placement:K.oneOf(Ure),character:K.any,characterRender:Function,filterOption:{type:[Boolean,Function]},validateSearch:Function,getPopupContainer:{type:Function},options:ct(),loading:{type:Boolean,default:void 0},rows:[Number,String],direction:{type:String}},GE=m(m({},KE),{dropdownClassName:String}),UE={prefix:"@",split:" ",rows:1,validateSearch:Hre,filterOption:()=>jre};Qe(GE,UE);var t4=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{c.value=e.value});const u=E=>{n("change",E)},d=E=>{let{target:{value:A}}=E;u(A)},f=(E,A,R)=>{m(c,{measuring:!0,measureText:E,measurePrefix:A,measureLocation:R,activeIndex:0})},h=E=>{m(c,{measuring:!1,measureLocation:0,measureText:null}),E==null||E()},v=E=>{const{which:A}=E;if(c.measuring){if(A===Ie.UP||A===Ie.DOWN){const R=I.value.length,z=A===Ie.UP?-1:1,_=(c.activeIndex+z+R)%R;c.activeIndex=_,E.preventDefault()}else if(A===Ie.ESC)h();else if(A===Ie.ENTER){if(E.preventDefault(),!I.value.length){h();return}const R=I.value[c.activeIndex];C(R)}}},g=E=>{const{key:A,which:R}=E,{measureText:z,measuring:_}=c,{prefix:D,validateSearch:N}=e,k=E.target;if(k.composing)return;const F=Nre(k),{location:L,prefix:H}=kre(F,D);if([Ie.ESC,Ie.UP,Ie.DOWN,Ie.ENTER].indexOf(R)===-1)if(L!==-1){const j=F.slice(L+H.length),Y=N(j,e),Z=!!x(j).length;Y?(A===H||A==="Shift"||_||j!==z&&Z)&&f(j,H,L):_&&h(),Y&&n("search",j,H)}else _&&h()},b=E=>{c.measuring||n("pressenter",E)},y=E=>{$(E)},S=E=>{w(E)},$=E=>{clearTimeout(s.value);const{isFocus:A}=c;!A&&E&&n("focus",E),c.isFocus=!0},w=E=>{s.value=setTimeout(()=>{c.isFocus=!1,h(),n("blur",E)},100)},C=E=>{const{split:A}=e,{value:R=""}=E,{text:z,selectionLocation:_}=Lre(c.value,{measureLocation:c.measureLocation,targetText:R,prefix:c.measurePrefix,selectionStart:a.value.getSelectionStart(),split:A});u(z),h(()=>{zre(a.value.input,_)}),n("select",E,c.measurePrefix)},O=E=>{c.activeIndex=E},x=E=>{const A=E||c.measureText||"",{filterOption:R}=e;return e.options.filter(_=>R?R(A,_):!0)},I=P(()=>x());return r({blur:()=>{a.value.blur()},focus:()=>{a.value.focus()}}),Ye(WE,{activeIndex:We(c,"activeIndex"),setActiveIndex:O,selectOption:C,onFocus:$,onBlur:w,loading:We(e,"loading")}),jn(()=>{rt(()=>{c.measuring&&(l.value.scrollTop=a.value.getScrollTop())})}),()=>{const{measureLocation:E,measurePrefix:A,measuring:R}=c,{prefixCls:z,placement:_,transitionName:D,getPopupContainer:N,direction:k}=e,F=t4(e,["prefixCls","placement","transitionName","getPopupContainer","direction"]),{class:L,style:H}=o,j=t4(o,["class","style"]),Y=ot(F,["value","prefix","split","validateSearch","filterOption","options","loading"]),Z=m(m(m({},Y),j),{onChange:n4,onSelect:n4,value:c.value,onInput:d,onBlur:S,onKeydown:v,onKeyup:g,onFocus:y,onPressenter:b});return p("div",{class:le(z,L),style:H},[p(ss,B(B({},Z),{},{ref:a,tag:"textarea"}),null),R&&p("div",{ref:l,class:`${z}-measure`},[c.value.slice(0,E),p(Gre,{prefixCls:z,transitionName:D,dropdownClassName:e.dropdownClassName,placement:_,options:R?I.value:[],visible:!0,direction:k,getPopupContainer:N},{default:()=>[p("span",null,[A])],notFoundContent:i.notFoundContent,option:i.option}),c.value.slice(E+A.length)])])}}}),Yre={value:String,disabled:Boolean,payload:Be()},XE=m(m({},Yre),{label:It([])}),YE={name:"Option",props:XE,render(e,t){let{slots:n}=t;var o;return(o=n.default)===null||o===void 0?void 0:o.call(n)}};m({compatConfig:{MODE:3}},YE);const qre=e=>{const{componentCls:t,colorTextDisabled:n,controlItemBgHover:o,controlPaddingHorizontal:r,colorText:i,motionDurationSlow:l,lineHeight:a,controlHeight:s,inputPaddingHorizontal:c,inputPaddingVertical:u,fontSize:d,colorBgElevated:f,borderRadiusLG:h,boxShadowSecondary:v}=e,g=Math.round((e.controlHeight-e.fontSize*e.lineHeight)/2);return{[t]:m(m(m(m(m({},qe(e)),ta(e)),{position:"relative",display:"inline-block",height:"auto",padding:0,overflow:"hidden",lineHeight:a,whiteSpace:"pre-wrap",verticalAlign:"bottom"}),au(e,t)),{"&-disabled":{"> textarea":m({},y1(e))},"&-focused":m({},ji(e)),[`&-affix-wrapper ${t}-suffix`]:{position:"absolute",top:0,insetInlineEnd:c,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto"},[`> textarea, ${t}-measure`]:{color:i,boxSizing:"border-box",minHeight:s-2,margin:0,padding:`${u}px ${c}px`,overflow:"inherit",overflowX:"hidden",overflowY:"auto",fontWeight:"inherit",fontSize:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontVariant:"inherit",fontSizeAdjust:"inherit",fontStretch:"inherit",lineHeight:"inherit",direction:"inherit",letterSpacing:"inherit",whiteSpace:"inherit",textAlign:"inherit",verticalAlign:"top",wordWrap:"break-word",wordBreak:"inherit",tabSize:"inherit"},"> textarea":m({width:"100%",border:"none",outline:"none",resize:"none",backgroundColor:"inherit"},b1(e.colorTextPlaceholder)),[`${t}-measure`]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:-1,color:"transparent",pointerEvents:"none","> span":{display:"inline-block",minHeight:"1em"}},"&-dropdown":m(m({},qe(e)),{position:"absolute",top:-9999,insetInlineStart:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",fontSize:d,fontVariant:"initial",backgroundColor:f,borderRadius:h,outline:"none",boxShadow:v,"&-hidden":{display:"none"},[`${t}-dropdown-menu`]:{maxHeight:e.dropdownHeight,marginBottom:0,paddingInlineStart:0,overflow:"auto",listStyle:"none",outline:"none","&-item":m(m({},Jt),{position:"relative",display:"block",minWidth:e.controlItemWidth,padding:`${g}px ${r}px`,color:i,fontWeight:"normal",lineHeight:a,cursor:"pointer",transition:`background ${l} ease`,"&:hover":{backgroundColor:o},"&:first-child":{borderStartStartRadius:h,borderStartEndRadius:h,borderEndStartRadius:0,borderEndEndRadius:0},"&:last-child":{borderStartStartRadius:0,borderStartEndRadius:0,borderEndStartRadius:h,borderEndEndRadius:h},"&-disabled":{color:n,cursor:"not-allowed","&:hover":{color:n,backgroundColor:o,cursor:"not-allowed"}},"&-selected":{color:i,fontWeight:e.fontWeightStrong,backgroundColor:o},"&-active":{backgroundColor:o}})}})})}},Jre=Ue("Mentions",e=>{const t=na(e);return[qre(t)]},e=>({dropdownHeight:250,controlItemWidth:100,zIndexPopup:e.zIndexPopupBase+50}));var o4=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{prefix:n="@",split:o=" "}=t,r=Array.isArray(n)?n:[n];return e.split(o).map(function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",l=null;return r.some(a=>i.slice(0,a.length)===a?(l=a,!0):!1),l!==null?{prefix:l,value:i.slice(l.length)}:null}).filter(i=>!!i&&!!i.value)},eie=()=>m(m({},KE),{loading:{type:Boolean,default:void 0},onFocus:{type:Function},onBlur:{type:Function},onSelect:{type:Function},onChange:{type:Function},onPressenter:{type:Function},"onUpdate:value":{type:Function},notFoundContent:K.any,defaultValue:String,id:String,status:String}),zv=re({compatConfig:{MODE:3},name:"AMentions",inheritAttrs:!1,props:eie(),slots:Object,setup(e,t){let{slots:n,emit:o,attrs:r,expose:i}=t;var l,a;const{prefixCls:s,renderEmpty:c,direction:u}=Ee("mentions",e),[d,f]=Jre(s),h=oe(!1),v=oe(null),g=oe((a=(l=e.value)!==null&&l!==void 0?l:e.defaultValue)!==null&&a!==void 0?a:""),b=an(),y=yn.useInject(),S=P(()=>fr(y.status,e.status));Gy({prefixCls:P(()=>`${s.value}-menu`),mode:P(()=>"vertical"),selectable:P(()=>!1),onClick:()=>{},validator:A=>{let{mode:R}=A}}),ye(()=>e.value,A=>{g.value=A});const $=A=>{h.value=!0,o("focus",A)},w=A=>{h.value=!1,o("blur",A),b.onFieldBlur()},C=function(){for(var A=arguments.length,R=new Array(A),z=0;z{e.value===void 0&&(g.value=A),o("update:value",A),o("change",A),b.onFieldChange()},x=()=>{const A=e.notFoundContent;return A!==void 0?A:n.notFoundContent?n.notFoundContent():c("Select")},I=()=>{var A;return wt(((A=n.default)===null||A===void 0?void 0:A.call(n))||[]).map(R=>{var z,_;return m(m({},bO(R)),{label:(_=(z=R.children)===null||z===void 0?void 0:z.default)===null||_===void 0?void 0:_.call(z)})})};i({focus:()=>{v.value.focus()},blur:()=>{v.value.blur()}});const E=P(()=>e.loading?Zre:e.filterOption);return()=>{const{disabled:A,getPopupContainer:R,rows:z=1,id:_=b.id.value}=e,D=o4(e,["disabled","getPopupContainer","rows","id"]),{hasFeedback:N,feedbackIcon:k}=y,{class:F}=r,L=o4(r,["class"]),H=ot(D,["defaultValue","onUpdate:value","prefixCls"]),j=le({[`${s.value}-disabled`]:A,[`${s.value}-focused`]:h.value,[`${s.value}-rtl`]:u.value==="rtl"},Fn(s.value,S.value),!N&&F,f.value),Y=m(m(m(m({prefixCls:s.value},H),{disabled:A,direction:u.value,filterOption:E.value,getPopupContainer:R,options:e.loading?[{value:"ANTDV_SEARCHING",disabled:!0,label:p(_r,{size:"small"},null)}]:e.options||I(),class:j}),L),{rows:z,onChange:O,onSelect:C,onFocus:$,onBlur:w,ref:v,value:g.value,id:_}),Z=p(Xre,B(B({},Y),{},{dropdownClassName:f.value}),{notFoundContent:x,option:n.option});return d(N?p("div",{class:le(`${s.value}-affix-wrapper`,Fn(`${s.value}-affix-wrapper`,S.value,N),F,f.value)},[Z,p("span",{class:`${s.value}-suffix`},[k])]):Z)}}}),qd=re(m(m({compatConfig:{MODE:3}},YE),{name:"AMentionsOption",props:XE})),tie=m(zv,{Option:qd,getMentions:Qre,install:e=>(e.component(zv.name,zv),e.component(qd.name,qd),e)});var nie=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{_0={x:e.pageX,y:e.pageY},setTimeout(()=>_0=null,100)};$T()&&Nt(document.documentElement,"click",oie,!0);const rie=()=>({prefixCls:String,visible:{type:Boolean,default:void 0},open:{type:Boolean,default:void 0},confirmLoading:{type:Boolean,default:void 0},title:K.any,closable:{type:Boolean,default:void 0},closeIcon:K.any,onOk:Function,onCancel:Function,"onUpdate:visible":Function,"onUpdate:open":Function,onChange:Function,afterClose:Function,centered:{type:Boolean,default:void 0},width:[String,Number],footer:K.any,okText:K.any,okType:String,cancelText:K.any,icon:K.any,maskClosable:{type:Boolean,default:void 0},forceRender:{type:Boolean,default:void 0},okButtonProps:Be(),cancelButtonProps:Be(),destroyOnClose:{type:Boolean,default:void 0},wrapClassName:String,maskTransitionName:String,transitionName:String,getContainer:{type:[String,Function,Boolean,Object],default:void 0},zIndex:Number,bodyStyle:Be(),maskStyle:Be(),mask:{type:Boolean,default:void 0},keyboard:{type:Boolean,default:void 0},wrapProps:Object,focusTriggerAfterClose:{type:Boolean,default:void 0},modalRender:Function,mousePosition:Be()}),rn=re({compatConfig:{MODE:3},name:"AModal",inheritAttrs:!1,props:Qe(rie(),{width:520,confirmLoading:!1,okType:"primary"}),setup(e,t){let{emit:n,slots:o,attrs:r}=t;const[i]=Uo("Modal"),{prefixCls:l,rootPrefixCls:a,direction:s,getPopupContainer:c}=Ee("modal",e),[u,d]=hoe(l);Po(e.visible===void 0);const f=g=>{n("update:visible",!1),n("update:open",!1),n("cancel",g),n("change",!1)},h=g=>{n("ok",g)},v=()=>{var g,b;const{okText:y=(g=o.okText)===null||g===void 0?void 0:g.call(o),okType:S,cancelText:$=(b=o.cancelText)===null||b===void 0?void 0:b.call(o),confirmLoading:w}=e;return p(Le,null,[p(Wt,B({onClick:f},e.cancelButtonProps),{default:()=>[$||i.value.cancelText]}),p(Wt,B(B({},Wf(S)),{},{loading:w,onClick:h},e.okButtonProps),{default:()=>[y||i.value.okText]})])};return()=>{var g,b;const{prefixCls:y,visible:S,open:$,wrapClassName:w,centered:C,getContainer:O,closeIcon:x=(g=o.closeIcon)===null||g===void 0?void 0:g.call(o),focusTriggerAfterClose:I=!0}=e,T=nie(e,["prefixCls","visible","open","wrapClassName","centered","getContainer","closeIcon","focusTriggerAfterClose"]),M=le(w,{[`${l.value}-centered`]:!!C,[`${l.value}-wrap-rtl`]:s.value==="rtl"});return u(p(TE,B(B(B({},T),r),{},{rootClassName:d.value,class:le(d.value,r.class),getContainer:O||(c==null?void 0:c.value),prefixCls:l.value,wrapClassName:M,visible:$??S,onClose:f,focusTriggerAfterClose:I,transitionName:Hn(a.value,"zoom",e.transitionName),maskTransitionName:Hn(a.value,"fade",e.maskTransitionName),mousePosition:(b=T.mousePosition)!==null&&b!==void 0?b:_0}),m(m({},o),{footer:o.footer||v,closeIcon:()=>p("span",{class:`${l.value}-close-x`},[x||p(Vn,{class:`${l.value}-close-icon`},null)])})))}}}),qE=()=>{const e=oe(!1);return et(()=>{e.value=!0}),e},iie={type:{type:String},actionFn:Function,close:Function,autofocus:Boolean,prefixCls:String,buttonProps:Be(),emitEvent:Boolean,quitOnNullishReturnValue:Boolean};function r4(e){return!!(e&&e.then)}const M0=re({compatConfig:{MODE:3},name:"ActionButton",props:iie,setup(e,t){let{slots:n}=t;const o=oe(!1),r=oe(),i=oe(!1);let l;const a=qE();Ke(()=>{e.autofocus&&(l=setTimeout(()=>{var d,f;return(f=(d=Jn(r.value))===null||d===void 0?void 0:d.focus)===null||f===void 0?void 0:f.call(d)}))}),et(()=>{clearTimeout(l)});const s=function(){for(var d,f=arguments.length,h=new Array(f),v=0;v{r4(d)&&(i.value=!0,d.then(function(){a.value||(i.value=!1),s(...arguments),o.value=!1},f=>(a.value||(i.value=!1),o.value=!1,Promise.reject(f))))},u=d=>{const{actionFn:f}=e;if(o.value)return;if(o.value=!0,!f){s();return}let h;if(e.emitEvent){if(h=f(d),e.quitOnNullishReturnValue&&!r4(h)){o.value=!1,s(d);return}}else if(f.length)h=f(e.close),o.value=!1;else if(h=f(),!h){s();return}c(h)};return()=>{const{type:d,prefixCls:f,buttonProps:h}=e;return p(Wt,B(B(B({},Wf(d)),{},{onClick:u,loading:i.value,prefixCls:f},h),{},{ref:r}),n)}}});function fa(e){return typeof e=="function"?e():e}const JE=re({name:"ConfirmDialog",inheritAttrs:!1,props:["icon","onCancel","onOk","close","closable","zIndex","afterClose","visible","open","keyboard","centered","getContainer","maskStyle","okButtonProps","cancelButtonProps","okType","prefixCls","okCancel","width","mask","maskClosable","okText","cancelText","autoFocusButton","transitionName","maskTransitionName","type","title","content","direction","rootPrefixCls","bodyStyle","closeIcon","modalRender","focusTriggerAfterClose","wrapClassName","confirmPrefixCls","footer"],setup(e,t){let{attrs:n}=t;const[o]=Uo("Modal");return()=>{const{icon:r,onCancel:i,onOk:l,close:a,okText:s,closable:c=!1,zIndex:u,afterClose:d,keyboard:f,centered:h,getContainer:v,maskStyle:g,okButtonProps:b,cancelButtonProps:y,okCancel:S,width:$=416,mask:w=!0,maskClosable:C=!1,type:O,open:x,title:I,content:T,direction:M,closeIcon:E,modalRender:A,focusTriggerAfterClose:R,rootPrefixCls:z,bodyStyle:_,wrapClassName:D,footer:N}=e;let k=r;if(!r&&r!==null)switch(O){case"info":k=p(qi,null,null);break;case"success":k=p(pr,null,null);break;case"error":k=p(Wn,null,null);break;default:k=p(hr,null,null)}const F=e.okType||"primary",L=e.prefixCls||"ant-modal",H=`${L}-confirm`,j=n.style||{},Y=S??O==="confirm",Z=e.autoFocusButton===null?!1:e.autoFocusButton||"ok",X=`${L}-confirm`,ee=le(X,`${X}-${e.type}`,{[`${X}-rtl`]:M==="rtl"},n.class),U=o.value,Q=Y&&p(M0,{actionFn:i,close:a,autofocus:Z==="cancel",buttonProps:y,prefixCls:`${z}-btn`},{default:()=>[fa(e.cancelText)||U.cancelText]});return p(rn,{prefixCls:L,class:ee,wrapClassName:le({[`${X}-centered`]:!!h},D),onCancel:J=>a==null?void 0:a({triggerCancel:!0},J),open:x,title:"",footer:"",transitionName:Hn(z,"zoom",e.transitionName),maskTransitionName:Hn(z,"fade",e.maskTransitionName),mask:w,maskClosable:C,maskStyle:g,style:j,bodyStyle:_,width:$,zIndex:u,afterClose:d,keyboard:f,centered:h,getContainer:v,closable:c,closeIcon:E,modalRender:A,focusTriggerAfterClose:R},{default:()=>[p("div",{class:`${H}-body-wrapper`},[p("div",{class:`${H}-body`},[fa(k),I===void 0?null:p("span",{class:`${H}-title`},[fa(I)]),p("div",{class:`${H}-content`},[fa(T)])]),N!==void 0?fa(N):p("div",{class:`${H}-btns`},[Q,p(M0,{type:F,actionFn:l,close:a,autofocus:Z==="ok",buttonProps:b,prefixCls:`${z}-btn`},{default:()=>[fa(s)||(Y?U.okText:U.justOkText)]})])])]})}}}),$l=[],gu=e=>{const t=document.createDocumentFragment();let n=m(m({},ot(e,["parentContext","appContext"])),{close:i,open:!0}),o=null;function r(){o&&(Hi(null,t),o=null);for(var c=arguments.length,u=new Array(c),d=0;dh&&h.triggerCancel);e.onCancel&&f&&e.onCancel(()=>{},...u.slice(1));for(let h=0;h<$l.length;h++)if($l[h]===i){$l.splice(h,1);break}}function i(){for(var c=arguments.length,u=new Array(c),d=0;d{typeof e.afterClose=="function"&&e.afterClose(),r.apply(this,u)}}),n.visible&&delete n.visible,l(n)}function l(c){typeof c=="function"?n=c(n):n=m(m({},n),c),o&&HN(o,n,t)}const a=c=>{const u=In,d=u.prefixCls,f=c.prefixCls||`${d}-modal`,h=u.iconPrefixCls,v=vee();return p(_l,B(B({},u),{},{prefixCls:d}),{default:()=>[p(JE,B(B({},c),{},{rootPrefixCls:d,prefixCls:f,iconPrefixCls:h,locale:v,cancelText:c.cancelText||v.cancelText}),null)]})};function s(c){const u=p(a,m({},c));return u.appContext=e.parentContext||e.appContext||u.appContext,Hi(u,t),u}return o=s(n),$l.push(i),{destroy:i,update:l}};function ZE(e){return m(m({},e),{type:"warning"})}function QE(e){return m(m({},e),{type:"info"})}function e7(e){return m(m({},e),{type:"success"})}function t7(e){return m(m({},e),{type:"error"})}function n7(e){return m(m({},e),{type:"confirm"})}const lie=()=>({config:Object,afterClose:Function,destroyAction:Function,open:Boolean}),aie=re({name:"HookModal",inheritAttrs:!1,props:Qe(lie(),{config:{width:520,okType:"primary"}}),setup(e,t){let{expose:n}=t;var o;const r=P(()=>e.open),i=P(()=>e.config),{direction:l,getPrefixCls:a}=jp(),s=a("modal"),c=a(),u=()=>{var v,g;e==null||e.afterClose(),(g=(v=i.value).afterClose)===null||g===void 0||g.call(v)},d=function(){e.destroyAction(...arguments)};n({destroy:d});const f=(o=i.value.okCancel)!==null&&o!==void 0?o:i.value.type==="confirm",[h]=Uo("Modal",eo.Modal);return()=>p(JE,B(B({prefixCls:s,rootPrefixCls:c},i.value),{},{close:d,open:r.value,afterClose:u,okText:i.value.okText||(f?h==null?void 0:h.value.okText:h==null?void 0:h.value.justOkText),direction:i.value.direction||l.value,cancelText:i.value.cancelText||(h==null?void 0:h.value.cancelText)}),null)}});let i4=0;const sie=re({name:"ElementsHolder",inheritAttrs:!1,setup(e,t){let{expose:n}=t;const o=oe([]);return n({addModal:i=>(o.value.push(i),o.value=o.value.slice(),()=>{o.value=o.value.filter(l=>l!==i)})}),()=>o.value.map(i=>i())}});function o7(){const e=oe(null),t=oe([]);ye(t,()=>{t.value.length&&([...t.value].forEach(l=>{l()}),t.value=[])},{immediate:!0});const n=i=>function(a){var s;i4+=1;const c=oe(!0),u=oe(null),d=oe(je(a)),f=oe({});ye(()=>a,$=>{b(m(m({},Vt($)?$.value:$),f.value))});const h=function(){c.value=!1;for(var $=arguments.length,w=new Array($),C=0;C<$;C++)w[C]=arguments[C];const O=w.some(x=>x&&x.triggerCancel);d.value.onCancel&&O&&d.value.onCancel(()=>{},...w.slice(1))};let v;const g=()=>p(aie,{key:`modal-${i4}`,config:i(d.value),ref:u,open:c.value,destroyAction:h,afterClose:()=>{v==null||v()}},null);v=(s=e.value)===null||s===void 0?void 0:s.addModal(g),v&&$l.push(v);const b=$=>{d.value=m(m({},d.value),$)};return{destroy:()=>{u.value?h():t.value=[...t.value,h]},update:$=>{f.value=$,u.value?b($):t.value=[...t.value,()=>b($)]}}},o=P(()=>({info:n(QE),success:n(e7),error:n(t7),warning:n(ZE),confirm:n(n7)})),r=Symbol("modalHolderKey");return[o.value,()=>p(sie,{key:r,ref:e},null)]}function r7(e){return gu(ZE(e))}rn.useModal=o7;rn.info=function(t){return gu(QE(t))};rn.success=function(t){return gu(e7(t))};rn.error=function(t){return gu(t7(t))};rn.warning=r7;rn.warn=r7;rn.confirm=function(t){return gu(n7(t))};rn.destroyAll=function(){for(;$l.length;){const t=$l.pop();t&&t()}};rn.install=function(e){return e.component(rn.name,rn),e};const i7=e=>{const{value:t,formatter:n,precision:o,decimalSeparator:r,groupSeparator:i="",prefixCls:l}=e;let a;if(typeof n=="function")a=n({value:t});else{const s=String(t),c=s.match(/^(-?)(\d*)(\.(\d+))?$/);if(!c)a=s;else{const u=c[1];let d=c[2]||"0",f=c[4]||"";d=d.replace(/\B(?=(\d{3})+(?!\d))/g,i),typeof o=="number"&&(f=f.padEnd(o,"0").slice(0,o>0?o:0)),f&&(f=`${r}${f}`),a=[p("span",{key:"int",class:`${l}-content-value-int`},[u,d]),f&&p("span",{key:"decimal",class:`${l}-content-value-decimal`},[f])]}}return p("span",{class:`${l}-content-value`},[a])};i7.displayName="StatisticNumber";const cie=e=>{const{componentCls:t,marginXXS:n,padding:o,colorTextDescription:r,statisticTitleFontSize:i,colorTextHeading:l,statisticContentFontSize:a,statisticFontFamily:s}=e;return{[`${t}`]:m(m({},qe(e)),{[`${t}-title`]:{marginBottom:n,color:r,fontSize:i},[`${t}-skeleton`]:{paddingTop:o},[`${t}-content`]:{color:l,fontSize:a,fontFamily:s,[`${t}-content-value`]:{display:"inline-block",direction:"ltr"},[`${t}-content-prefix, ${t}-content-suffix`]:{display:"inline-block"},[`${t}-content-prefix`]:{marginInlineEnd:n},[`${t}-content-suffix`]:{marginInlineStart:n}}})}},uie=Ue("Statistic",e=>{const{fontSizeHeading3:t,fontSize:n,fontFamily:o}=e,r=ze(e,{statisticTitleFontSize:n,statisticContentFontSize:t,statisticFontFamily:o});return[cie(r)]}),l7=()=>({prefixCls:String,decimalSeparator:String,groupSeparator:String,format:String,value:He([Number,String,Object]),valueStyle:{type:Object,default:void 0},valueRender:ve(),formatter:It(),precision:Number,prefix:Nn(),suffix:Nn(),title:Nn(),loading:$e()}),Yr=re({compatConfig:{MODE:3},name:"AStatistic",inheritAttrs:!1,props:Qe(l7(),{decimalSeparator:".",groupSeparator:",",loading:!1}),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("statistic",e),[l,a]=uie(r);return()=>{var s,c,u,d,f,h,v;const{value:g=0,valueStyle:b,valueRender:y}=e,S=r.value,$=(s=e.title)!==null&&s!==void 0?s:(c=n.title)===null||c===void 0?void 0:c.call(n),w=(u=e.prefix)!==null&&u!==void 0?u:(d=n.prefix)===null||d===void 0?void 0:d.call(n),C=(f=e.suffix)!==null&&f!==void 0?f:(h=n.suffix)===null||h===void 0?void 0:h.call(n),O=(v=e.formatter)!==null&&v!==void 0?v:n.formatter;let x=p(i7,B({"data-for-update":Date.now()},m(m({},e),{prefixCls:S,value:g,formatter:O})),null);return y&&(x=y(x)),l(p("div",B(B({},o),{},{class:[S,{[`${S}-rtl`]:i.value==="rtl"},o.class,a.value]}),[$&&p("div",{class:`${S}-title`},[$]),p(Rn,{paragraph:!1,loading:e.loading},{default:()=>[p("div",{style:b,class:`${S}-content`},[w&&p("span",{class:`${S}-content-prefix`},[w]),x,C&&p("span",{class:`${S}-content-suffix`},[C])])]})]))}}}),die=[["Y",1e3*60*60*24*365],["M",1e3*60*60*24*30],["D",1e3*60*60*24],["H",1e3*60*60],["m",1e3*60],["s",1e3],["S",1]];function fie(e,t){let n=e;const o=/\[[^\]]*]/g,r=(t.match(o)||[]).map(s=>s.slice(1,-1)),i=t.replace(o,"[]"),l=die.reduce((s,c)=>{let[u,d]=c;if(s.includes(u)){const f=Math.floor(n/d);return n-=f*d,s.replace(new RegExp(`${u}+`,"g"),h=>{const v=h.length;return f.toString().padStart(v,"0")})}return s},i);let a=0;return l.replace(o,()=>{const s=r[a];return a+=1,s})}function pie(e,t){const{format:n=""}=t,o=new Date(e).getTime(),r=Date.now(),i=Math.max(o-r,0);return fie(i,n)}const hie=1e3/30;function Hv(e){return new Date(e).getTime()}const gie=()=>m(m({},l7()),{value:He([Number,String,Object]),format:String,onFinish:Function,onChange:Function}),vie=re({compatConfig:{MODE:3},name:"AStatisticCountdown",props:Qe(gie(),{format:"HH:mm:ss"}),setup(e,t){let{emit:n,slots:o}=t;const r=ne(),i=ne(),l=()=>{const{value:d}=e;Hv(d)>=Date.now()?a():s()},a=()=>{if(r.value)return;const d=Hv(e.value);r.value=setInterval(()=>{i.value.$forceUpdate(),d>Date.now()&&n("change",d-Date.now()),l()},hie)},s=()=>{const{value:d}=e;r.value&&(clearInterval(r.value),r.value=void 0,Hv(d){let{value:f,config:h}=d;const{format:v}=e;return pie(f,m(m({},h),{format:v}))},u=d=>d;return Ke(()=>{l()}),jn(()=>{l()}),et(()=>{s()}),()=>{const d=e.value;return p(Yr,B({ref:i},m(m({},ot(e,["onFinish","onChange"])),{value:d,valueRender:u,formatter:c})),o)}}});Yr.Countdown=vie;Yr.install=function(e){return e.component(Yr.name,Yr),e.component(Yr.Countdown.name,Yr.Countdown),e};const mie=Yr.Countdown;var bie={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};function l4(e){for(var t=1;t{const{keyCode:h}=f;h===Ie.ENTER&&f.preventDefault()},s=f=>{const{keyCode:h}=f;h===Ie.ENTER&&o("click",f)},c=f=>{o("click",f)},u=()=>{l.value&&l.value.focus()},d=()=>{l.value&&l.value.blur()};return Ke(()=>{e.autofocus&&u()}),i({focus:u,blur:d}),()=>{var f;const{noStyle:h,disabled:v}=e,g=Cie(e,["noStyle","disabled"]);let b={};return h||(b=m({},xie)),v&&(b.pointerEvents="none"),p("div",B(B(B({role:"button",tabindex:0,ref:l},g),r),{},{onClick:c,onKeydown:a,onKeyup:s,style:m(m({},b),r.style||{})}),[(f=n.default)===null||f===void 0?void 0:f.call(n)])}}}),wie={small:8,middle:16,large:24},Oie=()=>({prefixCls:String,size:{type:[String,Number,Array]},direction:K.oneOf(Mn("horizontal","vertical")).def("horizontal"),align:K.oneOf(Mn("start","end","center","baseline")),wrap:$e()});function Pie(e){return typeof e=="string"?wie[e]:e||0}const Va=re({compatConfig:{MODE:3},name:"ASpace",inheritAttrs:!1,props:Oie(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,space:i,direction:l}=Ee("space",e),[a,s]=m5(r),c=xT(),u=P(()=>{var y,S,$;return($=(y=e.size)!==null&&y!==void 0?y:(S=i==null?void 0:i.value)===null||S===void 0?void 0:S.size)!==null&&$!==void 0?$:"small"}),d=ne(),f=ne();ye(u,()=>{[d.value,f.value]=(Array.isArray(u.value)?u.value:[u.value,u.value]).map(y=>Pie(y))},{immediate:!0});const h=P(()=>e.align===void 0&&e.direction==="horizontal"?"center":e.align),v=P(()=>le(r.value,s.value,`${r.value}-${e.direction}`,{[`${r.value}-rtl`]:l.value==="rtl",[`${r.value}-align-${h.value}`]:h.value})),g=P(()=>l.value==="rtl"?"marginLeft":"marginRight"),b=P(()=>{const y={};return c.value&&(y.columnGap=`${d.value}px`,y.rowGap=`${f.value}px`),m(m({},y),e.wrap&&{flexWrap:"wrap",marginBottom:`${-f.value}px`})});return()=>{var y,S;const{wrap:$,direction:w="horizontal"}=e,C=(y=n.default)===null||y===void 0?void 0:y.call(n),O=kt(C),x=O.length;if(x===0)return null;const I=(S=n.split)===null||S===void 0?void 0:S.call(n),T=`${r.value}-item`,M=d.value,E=x-1;return p("div",B(B({},o),{},{class:[v.value,o.class],style:[b.value,o.style]}),[O.map((A,R)=>{let z=C.indexOf(A);z===-1&&(z=`$$space-${R}`);let _={};return c.value||(w==="vertical"?R{const{componentCls:t,antCls:n}=e;return{[t]:m(m({},qe(e)),{position:"relative",padding:`${e.pageHeaderPaddingVertical}px ${e.pageHeaderPadding}px`,backgroundColor:e.colorBgContainer,[`&${t}-ghost`]:{backgroundColor:e.pageHeaderGhostBg},"&.has-footer":{paddingBottom:0},[`${t}-back`]:{marginRight:e.marginMD,fontSize:e.fontSizeLG,lineHeight:1,"&-button":m(m({},Xp(e)),{color:e.pageHeaderBackColor,cursor:"pointer"})},[`${n}-divider-vertical`]:{height:"14px",margin:`0 ${e.marginSM}`,verticalAlign:"middle"},[`${n}-breadcrumb + &-heading`]:{marginTop:e.marginXS},[`${t}-heading`]:{display:"flex",justifyContent:"space-between","&-left":{display:"flex",alignItems:"center",margin:`${e.marginXS/2}px 0`,overflow:"hidden"},"&-title":m({marginRight:e.marginSM,marginBottom:0,color:e.colorTextHeading,fontWeight:600,fontSize:e.pageHeaderHeadingTitle,lineHeight:`${e.controlHeight}px`},Jt),[`${n}-avatar`]:{marginRight:e.marginSM},"&-sub-title":m({marginRight:e.marginSM,color:e.colorTextDescription,fontSize:e.pageHeaderHeadingSubTitle,lineHeight:e.lineHeight},Jt),"&-extra":{margin:`${e.marginXS/2}px 0`,whiteSpace:"nowrap","> *":{marginLeft:e.marginSM,whiteSpace:"unset"},"> *:first-child":{marginLeft:0}}},[`${t}-content`]:{paddingTop:e.pageHeaderContentPaddingVertical},[`${t}-footer`]:{marginTop:e.marginMD,[`${n}-tabs`]:{[`> ${n}-tabs-nav`]:{margin:0,"&::before":{border:"none"}},[`${n}-tabs-tab`]:{paddingTop:e.paddingXS,paddingBottom:e.paddingXS,fontSize:e.pageHeaderTabFontSize}}},[`${t}-compact ${t}-heading`]:{flexWrap:"wrap"},[`&${e.componentCls}-rtl`]:{direction:"rtl"}})}},Tie=Ue("PageHeader",e=>{const t=ze(e,{pageHeaderPadding:e.paddingLG,pageHeaderPaddingVertical:e.paddingMD,pageHeaderPaddingBreadcrumb:e.paddingSM,pageHeaderContentPaddingVertical:e.paddingSM,pageHeaderBackColor:e.colorTextBase,pageHeaderGhostBg:"transparent",pageHeaderHeadingTitle:e.fontSizeHeading4,pageHeaderHeadingSubTitle:e.fontSize,pageHeaderTabFontSize:e.fontSizeLG});return[Iie(t)]}),Eie=()=>({backIcon:Nn(),prefixCls:String,title:Nn(),subTitle:Nn(),breadcrumb:K.object,tags:Nn(),footer:Nn(),extra:Nn(),avatar:Be(),ghost:{type:Boolean,default:void 0},onBack:Function}),_ie=re({compatConfig:{MODE:3},name:"APageHeader",inheritAttrs:!1,props:Eie(),slots:Object,setup(e,t){let{emit:n,slots:o,attrs:r}=t;const{prefixCls:i,direction:l,pageHeader:a}=Ee("page-header",e),[s,c]=Tie(i),u=oe(!1),d=qE(),f=w=>{let{width:C}=w;d.value||(u.value=C<768)},h=P(()=>{var w,C,O;return(O=(w=e.ghost)!==null&&w!==void 0?w:(C=a==null?void 0:a.value)===null||C===void 0?void 0:C.ghost)!==null&&O!==void 0?O:!0}),v=()=>{var w,C,O;return(O=(w=e.backIcon)!==null&&w!==void 0?w:(C=o.backIcon)===null||C===void 0?void 0:C.call(o))!==null&&O!==void 0?O:l.value==="rtl"?p(lS,null,null):p(iS,null,null)},g=w=>!w||!e.onBack?null:p(Wl,{componentName:"PageHeader",children:C=>{let{back:O}=C;return p("div",{class:`${i.value}-back`},[p(gp,{onClick:x=>{n("back",x)},class:`${i.value}-back-button`,"aria-label":O},{default:()=>[w]})])}},null),b=()=>{var w;return e.breadcrumb?p(Tl,e.breadcrumb,null):(w=o.breadcrumb)===null||w===void 0?void 0:w.call(o)},y=()=>{var w,C,O,x,I,T,M,E,A;const{avatar:R}=e,z=(w=e.title)!==null&&w!==void 0?w:(C=o.title)===null||C===void 0?void 0:C.call(o),_=(O=e.subTitle)!==null&&O!==void 0?O:(x=o.subTitle)===null||x===void 0?void 0:x.call(o),D=(I=e.tags)!==null&&I!==void 0?I:(T=o.tags)===null||T===void 0?void 0:T.call(o),N=(M=e.extra)!==null&&M!==void 0?M:(E=o.extra)===null||E===void 0?void 0:E.call(o),k=`${i.value}-heading`,F=z||_||D||N;if(!F)return null;const L=v(),H=g(L);return p("div",{class:k},[(H||R||F)&&p("div",{class:`${k}-left`},[H,R?p(Il,R,null):(A=o.avatar)===null||A===void 0?void 0:A.call(o),z&&p("span",{class:`${k}-title`,title:typeof z=="string"?z:void 0},[z]),_&&p("span",{class:`${k}-sub-title`,title:typeof _=="string"?_:void 0},[_]),D&&p("span",{class:`${k}-tags`},[D])]),N&&p("span",{class:`${k}-extra`},[p(Va,null,{default:()=>[N]})])])},S=()=>{var w,C;const O=(w=e.footer)!==null&&w!==void 0?w:kt((C=o.footer)===null||C===void 0?void 0:C.call(o));return MR(O)?null:p("div",{class:`${i.value}-footer`},[O])},$=w=>p("div",{class:`${i.value}-content`},[w]);return()=>{var w,C;const O=((w=e.breadcrumb)===null||w===void 0?void 0:w.routes)||o.breadcrumb,x=e.footer||o.footer,I=wt((C=o.default)===null||C===void 0?void 0:C.call(o)),T=le(i.value,{"has-breadcrumb":O,"has-footer":x,[`${i.value}-ghost`]:h.value,[`${i.value}-rtl`]:l.value==="rtl",[`${i.value}-compact`]:u.value},r.class,c.value);return s(p(Vo,{onResize:f},{default:()=>[p("div",B(B({},r),{},{class:T}),[b(),y(),I.length?$(I):null,S()])]}))}}}),Mie=Bt(_ie),Aie=e=>{const{componentCls:t,iconCls:n,zIndexPopup:o,colorText:r,colorWarning:i,marginXS:l,fontSize:a,fontWeightStrong:s,lineHeight:c}=e;return{[t]:{zIndex:o,[`${t}-inner-content`]:{color:r},[`${t}-message`]:{position:"relative",marginBottom:l,color:r,fontSize:a,display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t}-message-icon ${n}`]:{color:i,fontSize:a,flex:"none",lineHeight:1,paddingTop:(Math.round(a*c)-a)/2},"&-title":{flex:"auto",marginInlineStart:l},"&-title-only":{fontWeight:s}},[`${t}-description`]:{position:"relative",marginInlineStart:a+l,marginBottom:l,color:r,fontSize:a},[`${t}-buttons`]:{textAlign:"end",button:{marginInlineStart:l}}}}},Rie=Ue("Popconfirm",e=>Aie(e),e=>{const{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}});var Die=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rm(m({},Fy()),{prefixCls:String,content:It(),title:It(),description:It(),okType:Ne("primary"),disabled:{type:Boolean,default:!1},okText:It(),cancelText:It(),icon:It(),okButtonProps:Be(),cancelButtonProps:Be(),showCancel:{type:Boolean,default:!0},onConfirm:Function,onCancel:Function}),Nie=re({compatConfig:{MODE:3},name:"APopconfirm",inheritAttrs:!1,props:Qe(Bie(),m(m({},V5()),{trigger:"click",placement:"top",mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0,okType:"primary",disabled:!1})),slots:Object,setup(e,t){let{slots:n,emit:o,expose:r,attrs:i}=t;const l=ne();Po(e.visible===void 0),r({getPopupDomNode:()=>{var O,x;return(x=(O=l.value)===null||O===void 0?void 0:O.getPopupDomNode)===null||x===void 0?void 0:x.call(O)}});const[a,s]=Dt(!1,{value:We(e,"open")}),c=(O,x)=>{e.open===void 0&&s(O),o("update:open",O),o("openChange",O,x)},u=O=>{c(!1,O)},d=O=>{var x;return(x=e.onConfirm)===null||x===void 0?void 0:x.call(e,O)},f=O=>{var x;c(!1,O),(x=e.onCancel)===null||x===void 0||x.call(e,O)},h=O=>{O.keyCode===Ie.ESC&&a&&c(!1,O)},v=O=>{const{disabled:x}=e;x||c(O)},{prefixCls:g,getPrefixCls:b}=Ee("popconfirm",e),y=P(()=>b()),S=P(()=>b("btn")),[$]=Rie(g),[w]=Uo("Popconfirm",eo.Popconfirm),C=()=>{var O,x,I,T,M;const{okButtonProps:E,cancelButtonProps:A,title:R=(O=n.title)===null||O===void 0?void 0:O.call(n),description:z=(x=n.description)===null||x===void 0?void 0:x.call(n),cancelText:_=(I=n.cancel)===null||I===void 0?void 0:I.call(n),okText:D=(T=n.okText)===null||T===void 0?void 0:T.call(n),okType:N,icon:k=((M=n.icon)===null||M===void 0?void 0:M.call(n))||p(hr,null,null),showCancel:F=!0}=e,{cancelButton:L,okButton:H}=n,j=m({onClick:f,size:"small"},A),Y=m(m(m({onClick:d},Wf(N)),{size:"small"}),E);return p("div",{class:`${g.value}-inner-content`},[p("div",{class:`${g.value}-message`},[k&&p("span",{class:`${g.value}-message-icon`},[k]),p("div",{class:[`${g.value}-message-title`,{[`${g.value}-message-title-only`]:!!z}]},[R])]),z&&p("div",{class:`${g.value}-description`},[z]),p("div",{class:`${g.value}-buttons`},[F?L?L(j):p(Wt,j,{default:()=>[_||w.value.cancelText]}):null,H?H(Y):p(M0,{buttonProps:m(m({size:"small"},Wf(N)),E),actionFn:d,close:u,prefixCls:S.value,quitOnNullishReturnValue:!0,emitEvent:!0},{default:()=>[D||w.value.okText]})])])};return()=>{var O;const{placement:x,overlayClassName:I,trigger:T="click"}=e,M=Die(e,["placement","overlayClassName","trigger"]),E=ot(M,["title","content","cancelText","okText","onUpdate:open","onConfirm","onCancel","prefixCls"]),A=le(g.value,I);return $(p(jy,B(B(B({},E),i),{},{trigger:T,placement:x,onOpenChange:v,open:a.value,overlayClassName:A,transitionName:Hn(y.value,"zoom-big",e.transitionName),ref:l,"data-popover-inject":!0}),{default:()=>[zN(((O=n.default)===null||O===void 0?void 0:O.call(n))||[],{onKeydown:R=>{h(R)}},!1)],content:C}))}}}),kie=Bt(Nie),Fie=["normal","exception","active","success"],Wh=()=>({prefixCls:String,type:Ne(),percent:Number,format:ve(),status:Ne(),showInfo:$e(),strokeWidth:Number,strokeLinecap:Ne(),strokeColor:It(),trailColor:String,width:Number,success:Be(),gapDegree:Number,gapPosition:Ne(),size:He([String,Number,Array]),steps:Number,successPercent:Number,title:String,progressStatus:Ne()});function Ml(e){return!e||e<0?0:e>100?100:e}function vp(e){let{success:t,successPercent:n}=e,o=n;return t&&"progress"in t&&(Mt(!1,"Progress","`success.progress` is deprecated. Please use `success.percent` instead."),o=t.progress),t&&"percent"in t&&(o=t.percent),o}function Lie(e){let{percent:t,success:n,successPercent:o}=e;const r=Ml(vp({success:n,successPercent:o}));return[r,Ml(Ml(t)-r)]}function zie(e){let{success:t={},strokeColor:n}=e;const{strokeColor:o}=t;return[o||Ra.green,n||null]}const Kh=(e,t,n)=>{var o,r,i,l;let a=-1,s=-1;if(t==="step"){const c=n.steps,u=n.strokeWidth;typeof e=="string"||typeof e>"u"?(a=e==="small"?2:14,s=u??8):typeof e=="number"?[a,s]=[e,e]:[a=14,s=8]=e,a*=c}else if(t==="line"){const c=n==null?void 0:n.strokeWidth;typeof e=="string"||typeof e>"u"?s=c||(e==="small"?6:8):typeof e=="number"?[a,s]=[e,e]:[a=-1,s=8]=e}else(t==="circle"||t==="dashboard")&&(typeof e=="string"||typeof e>"u"?[a,s]=e==="small"?[60,60]:[120,120]:typeof e=="number"?[a,s]=[e,e]:(a=(r=(o=e[0])!==null&&o!==void 0?o:e[1])!==null&&r!==void 0?r:120,s=(l=(i=e[0])!==null&&i!==void 0?i:e[1])!==null&&l!==void 0?l:120));return{width:a,height:s}};var Hie=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rm(m({},Wh()),{strokeColor:It(),direction:Ne()}),Vie=e=>{let t=[];return Object.keys(e).forEach(n=>{const o=parseFloat(n.replace(/%/g,""));isNaN(o)||t.push({key:o,value:e[n]})}),t=t.sort((n,o)=>n.key-o.key),t.map(n=>{let{key:o,value:r}=n;return`${r} ${o}%`}).join(", ")},Wie=(e,t)=>{const{from:n=Ra.blue,to:o=Ra.blue,direction:r=t==="rtl"?"to left":"to right"}=e,i=Hie(e,["from","to","direction"]);if(Object.keys(i).length!==0){const l=Vie(i);return{backgroundImage:`linear-gradient(${r}, ${l})`}}return{backgroundImage:`linear-gradient(${r}, ${n}, ${o})`}},Kie=re({compatConfig:{MODE:3},name:"ProgressLine",inheritAttrs:!1,props:jie(),setup(e,t){let{slots:n,attrs:o}=t;const r=P(()=>{const{strokeColor:h,direction:v}=e;return h&&typeof h!="string"?Wie(h,v):{backgroundColor:h}}),i=P(()=>e.strokeLinecap==="square"||e.strokeLinecap==="butt"?0:void 0),l=P(()=>e.trailColor?{backgroundColor:e.trailColor}:void 0),a=P(()=>{var h;return(h=e.size)!==null&&h!==void 0?h:[-1,e.strokeWidth||(e.size==="small"?6:8)]}),s=P(()=>Kh(a.value,"line",{strokeWidth:e.strokeWidth})),c=P(()=>{const{percent:h}=e;return m({width:`${Ml(h)}%`,height:`${s.value.height}px`,borderRadius:i.value},r.value)}),u=P(()=>vp(e)),d=P(()=>{const{success:h}=e;return{width:`${Ml(u.value)}%`,height:`${s.value.height}px`,borderRadius:i.value,backgroundColor:h==null?void 0:h.strokeColor}}),f={width:s.value.width<0?"100%":s.value.width,height:`${s.value.height}px`};return()=>{var h;return p(Le,null,[p("div",B(B({},o),{},{class:[`${e.prefixCls}-outer`,o.class],style:[o.style,f]}),[p("div",{class:`${e.prefixCls}-inner`,style:l.value},[p("div",{class:`${e.prefixCls}-bg`,style:c.value},null),u.value!==void 0?p("div",{class:`${e.prefixCls}-success-bg`,style:d.value},null):null])]),(h=n.default)===null||h===void 0?void 0:h.call(n)])}}}),Gie={percent:0,prefixCls:"vc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1},Uie=e=>{const t=ne(null);return jn(()=>{const n=Date.now();let o=!1;e.value.forEach(r=>{const i=(r==null?void 0:r.$el)||r;if(!i)return;o=!0;const l=i.style;l.transitionDuration=".3s, .3s, .3s, .06s",t.value&&n-t.value<100&&(l.transitionDuration="0s, 0s")}),o&&(t.value=Date.now())}),e},Xie={gapDegree:Number,gapPosition:{type:String},percent:{type:[Array,Number]},prefixCls:String,strokeColor:{type:[Object,String,Array]},strokeLinecap:{type:String},strokeWidth:Number,trailColor:String,trailWidth:Number,transition:String};var Yie=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r4&&arguments[4]!==void 0?arguments[4]:0,i=arguments.length>5?arguments[5]:void 0;const l=50-o/2;let a=0,s=-l,c=0,u=-2*l;switch(i){case"left":a=-l,s=0,c=2*l,u=0;break;case"right":a=l,s=0,c=-2*l,u=0;break;case"bottom":s=l,u=2*l;break}const d=`M 50,50 m ${a},${s} + a ${l},${l} 0 1 1 ${c},${-u} + a ${l},${l} 0 1 1 ${-c},${u}`,f=Math.PI*2*l,h={stroke:n,strokeDasharray:`${t/100*(f-r)}px ${f}px`,strokeDashoffset:`-${r/2+e/100*(f-r)}px`,transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s"};return{pathString:d,pathStyle:h}}const qie=re({compatConfig:{MODE:3},name:"VCCircle",props:Qe(Xie,Gie),setup(e){s4+=1;const t=ne(s4),n=P(()=>u4(e.percent)),o=P(()=>u4(e.strokeColor)),[r,i]=C1();Uie(i);const l=()=>{const{prefixCls:a,strokeWidth:s,strokeLinecap:c,gapDegree:u,gapPosition:d}=e;let f=0;return n.value.map((h,v)=>{const g=o.value[v]||o.value[o.value.length-1],b=Object.prototype.toString.call(g)==="[object Object]"?`url(#${a}-gradient-${t.value})`:"",{pathString:y,pathStyle:S}=d4(f,h,g,s,u,d);f+=h;const $={key:v,d:y,stroke:b,"stroke-linecap":c,"stroke-width":s,opacity:h===0?0:1,"fill-opacity":"0",class:`${a}-circle-path`,style:S};return p("path",B({ref:r(v)},$),null)})};return()=>{const{prefixCls:a,strokeWidth:s,trailWidth:c,gapDegree:u,gapPosition:d,trailColor:f,strokeLinecap:h,strokeColor:v}=e,g=Yie(e,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","strokeColor"]),{pathString:b,pathStyle:y}=d4(0,100,f,s,u,d);delete g.percent;const S=o.value.find(w=>Object.prototype.toString.call(w)==="[object Object]"),$={d:b,stroke:f,"stroke-linecap":h,"stroke-width":c||s,"fill-opacity":"0",class:`${a}-circle-trail`,style:y};return p("svg",B({class:`${a}-circle`,viewBox:"0 0 100 100"},g),[S&&p("defs",null,[p("linearGradient",{id:`${a}-gradient-${t.value}`,x1:"100%",y1:"0%",x2:"0%",y2:"0%"},[Object.keys(S).sort((w,C)=>c4(w)-c4(C)).map((w,C)=>p("stop",{key:C,offset:w,"stop-color":S[w]},null))])]),p("path",$,null),l().reverse()])}}}),Jie=()=>m(m({},Wh()),{strokeColor:It()}),Zie=3,Qie=e=>Zie/e*100,ele=re({compatConfig:{MODE:3},name:"ProgressCircle",inheritAttrs:!1,props:Qe(Jie(),{trailColor:null}),setup(e,t){let{slots:n,attrs:o}=t;const r=P(()=>{var g;return(g=e.width)!==null&&g!==void 0?g:120}),i=P(()=>{var g;return(g=e.size)!==null&&g!==void 0?g:[r.value,r.value]}),l=P(()=>Kh(i.value,"circle")),a=P(()=>{if(e.gapDegree||e.gapDegree===0)return e.gapDegree;if(e.type==="dashboard")return 75}),s=P(()=>({width:`${l.value.width}px`,height:`${l.value.height}px`,fontSize:`${l.value.width*.15+6}px`})),c=P(()=>{var g;return(g=e.strokeWidth)!==null&&g!==void 0?g:Math.max(Qie(l.value.width),6)}),u=P(()=>e.gapPosition||e.type==="dashboard"&&"bottom"||void 0),d=P(()=>Lie(e)),f=P(()=>Object.prototype.toString.call(e.strokeColor)==="[object Object]"),h=P(()=>zie({success:e.success,strokeColor:e.strokeColor})),v=P(()=>({[`${e.prefixCls}-inner`]:!0,[`${e.prefixCls}-circle-gradient`]:f.value}));return()=>{var g;const b=p(qie,{percent:d.value,strokeWidth:c.value,trailWidth:c.value,strokeColor:h.value,strokeLinecap:e.strokeLinecap,trailColor:e.trailColor,prefixCls:e.prefixCls,gapDegree:a.value,gapPosition:u.value},null);return p("div",B(B({},o),{},{class:[v.value,o.class],style:[o.style,s.value]}),[l.value.width<=20?p(co,null,{default:()=>[p("span",null,[b])],title:n.default}):p(Le,null,[b,(g=n.default)===null||g===void 0?void 0:g.call(n)])])}}}),tle=()=>m(m({},Wh()),{steps:Number,strokeColor:He(),trailColor:String}),nle=re({compatConfig:{MODE:3},name:"Steps",props:tle(),setup(e,t){let{slots:n}=t;const o=P(()=>Math.round(e.steps*((e.percent||0)/100))),r=P(()=>{var a;return(a=e.size)!==null&&a!==void 0?a:[e.size==="small"?2:14,e.strokeWidth||8]}),i=P(()=>Kh(r.value,"step",{steps:e.steps,strokeWidth:e.strokeWidth||8})),l=P(()=>{const{steps:a,strokeColor:s,trailColor:c,prefixCls:u}=e,d=[];for(let f=0;f{var a;return p("div",{class:`${e.prefixCls}-steps-outer`},[l.value,(a=n.default)===null||a===void 0?void 0:a.call(n)])}}}),ole=new it("antProgressActive",{"0%":{transform:"translateX(-100%) scaleX(0)",opacity:.1},"20%":{transform:"translateX(-100%) scaleX(0)",opacity:.5},to:{transform:"translateX(0) scaleX(1)",opacity:0}}),rle=e=>{const{componentCls:t,iconCls:n}=e;return{[t]:m(m({},qe(e)),{display:"inline-block","&-rtl":{direction:"rtl"},"&-line":{position:"relative",width:"100%",fontSize:e.fontSize,marginInlineEnd:e.marginXS,marginBottom:e.marginXS},[`${t}-outer`]:{display:"inline-block",width:"100%"},[`&${t}-show-info`]:{[`${t}-outer`]:{marginInlineEnd:`calc(-2em - ${e.marginXS}px)`,paddingInlineEnd:`calc(2em + ${e.paddingXS}px)`}},[`${t}-inner`]:{position:"relative",display:"inline-block",width:"100%",overflow:"hidden",verticalAlign:"middle",backgroundColor:e.progressRemainingColor,borderRadius:e.progressLineRadius},[`${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorInfo}},[`${t}-success-bg, ${t}-bg`]:{position:"relative",backgroundColor:e.colorInfo,borderRadius:e.progressLineRadius,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`},[`${t}-success-bg`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,backgroundColor:e.colorSuccess},[`${t}-text`]:{display:"inline-block",width:"2em",marginInlineStart:e.marginXS,color:e.progressInfoTextColor,lineHeight:1,whiteSpace:"nowrap",textAlign:"start",verticalAlign:"middle",wordBreak:"normal",[n]:{fontSize:e.fontSize}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:"absolute",inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.progressLineRadius,opacity:0,animationName:ole,animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:"infinite",content:'""'}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}},ile=e=>{const{componentCls:t,iconCls:n}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.progressRemainingColor},[`&${t}-circle ${t}-inner`]:{position:"relative",lineHeight:1,backgroundColor:"transparent"},[`&${t}-circle ${t}-text`]:{position:"absolute",insetBlockStart:"50%",insetInlineStart:0,width:"100%",margin:0,padding:0,color:e.colorText,lineHeight:1,whiteSpace:"normal",textAlign:"center",transform:"translateY(-50%)",[n]:{fontSize:`${e.fontSize/e.fontSizeSM}em`}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:"bottom"}}}},lle=e=>{const{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:"inline-block","&-outer":{display:"flex",flexDirection:"row",alignItems:"center"},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.progressRemainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.colorInfo}}}}}},ale=e=>{const{componentCls:t,iconCls:n}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${n}`]:{fontSize:e.fontSizeSM}}}},sle=Ue("Progress",e=>{const t=e.marginXXS/2,n=ze(e,{progressLineRadius:100,progressInfoTextColor:e.colorText,progressDefaultColor:e.colorInfo,progressRemainingColor:e.colorFillSecondary,progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:"2.4s"});return[rle(n),ile(n),lle(n),ale(n)]});var cle=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rArray.isArray(e.strokeColor)?e.strokeColor[0]:e.strokeColor),c=P(()=>{const{percent:v=0}=e,g=vp(e);return parseInt(g!==void 0?g.toString():v.toString(),10)}),u=P(()=>{const{status:v}=e;return!Fie.includes(v)&&c.value>=100?"success":v||"normal"}),d=P(()=>{const{type:v,showInfo:g,size:b}=e,y=r.value;return{[y]:!0,[`${y}-inline-circle`]:v==="circle"&&Kh(b,"circle").width<=20,[`${y}-${v==="dashboard"&&"circle"||v}`]:!0,[`${y}-status-${u.value}`]:!0,[`${y}-show-info`]:g,[`${y}-${b}`]:b,[`${y}-rtl`]:i.value==="rtl",[a.value]:!0}}),f=P(()=>typeof e.strokeColor=="string"||Array.isArray(e.strokeColor)?e.strokeColor:void 0),h=()=>{const{showInfo:v,format:g,type:b,percent:y,title:S}=e,$=vp(e);if(!v)return null;let w;const C=g||(n==null?void 0:n.format)||(x=>`${x}%`),O=b==="line";return g||n!=null&&n.format||u.value!=="exception"&&u.value!=="success"?w=C(Ml(y),Ml($)):u.value==="exception"?w=p(O?Wn:Vn,null,null):u.value==="success"&&(w=p(O?pr:Zl,null,null)),p("span",{class:`${r.value}-text`,title:S===void 0&&typeof w=="string"?w:void 0},[w])};return()=>{const{type:v,steps:g,title:b}=e,{class:y}=o,S=cle(o,["class"]),$=h();let w;return v==="line"?w=g?p(nle,B(B({},e),{},{strokeColor:f.value,prefixCls:r.value,steps:g}),{default:()=>[$]}):p(Kie,B(B({},e),{},{strokeColor:s.value,prefixCls:r.value,direction:i.value}),{default:()=>[$]}):(v==="circle"||v==="dashboard")&&(w=p(ele,B(B({},e),{},{prefixCls:r.value,strokeColor:s.value,progressStatus:u.value}),{default:()=>[$]})),l(p("div",B(B({role:"progressbar"},S),{},{class:[d.value,y],title:b}),[w]))}}}),aS=Bt(ule);function dle(e){let t=e.scrollX;const n="scrollLeft";if(typeof t!="number"){const o=e.document;t=o.documentElement[n],typeof t!="number"&&(t=o.body[n])}return t}function fle(e){let t,n;const o=e.ownerDocument,{body:r}=o,i=o&&o.documentElement,l=e.getBoundingClientRect();return t=l.left,n=l.top,t-=i.clientLeft||r.clientLeft||0,n-=i.clientTop||r.clientTop||0,{left:t,top:n}}function ple(e){const t=fle(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=dle(o),t.left}var hle={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"}}]},name:"star",theme:"filled"};function f4(e){for(var t=1;t{const{index:s}=e;n("hover",a,s)},r=a=>{const{index:s}=e;n("click",a,s)},i=a=>{const{index:s}=e;a.keyCode===13&&n("click",a,s)},l=P(()=>{const{prefixCls:a,index:s,value:c,allowHalf:u,focused:d}=e,f=s+1;let h=a;return c===0&&s===0&&d?h+=` ${a}-focused`:u&&c+.5>=f&&c{const{disabled:a,prefixCls:s,characterRender:c,character:u,index:d,count:f,value:h}=e,v=typeof u=="function"?u({disabled:a,prefixCls:s,index:d,count:f,value:h}):u;let g=p("li",{class:l.value},[p("div",{onClick:a?null:r,onKeydown:a?null:i,onMousemove:a?null:o,role:"radio","aria-checked":h>d?"true":"false","aria-posinset":d+1,"aria-setsize":f,tabindex:a?-1:0},[p("div",{class:`${s}-first`},[v]),p("div",{class:`${s}-second`},[v])])]);return c&&(g=c(g,e)),g}}}),ble=e=>{const{componentCls:t}=e;return{[`${t}-star`]:{position:"relative",display:"inline-block",color:"inherit",cursor:"pointer","&:not(:last-child)":{marginInlineEnd:e.marginXS},"> div":{transition:`all ${e.motionDurationMid}, outline 0s`,"&:hover":{transform:e.rateStarHoverScale},"&:focus":{outline:0},"&:focus-visible":{outline:`${e.lineWidth}px dashed ${e.rateStarColor}`,transform:e.rateStarHoverScale}},"&-first, &-second":{color:e.defaultColor,transition:`all ${e.motionDurationMid}`,userSelect:"none",[e.iconCls]:{verticalAlign:"middle"}},"&-first":{position:"absolute",top:0,insetInlineStart:0,width:"50%",height:"100%",overflow:"hidden",opacity:0},[`&-half ${t}-star-first, &-half ${t}-star-second`]:{opacity:1},[`&-half ${t}-star-first, &-full ${t}-star-second`]:{color:"inherit"}}}},yle=e=>({[`&-rtl${e.componentCls}`]:{direction:"rtl"}}),Sle=e=>{const{componentCls:t}=e;return{[t]:m(m(m(m(m({},qe(e)),{display:"inline-block",margin:0,padding:0,color:e.rateStarColor,fontSize:e.rateStarSize,lineHeight:"unset",listStyle:"none",outline:"none",[`&-disabled${t} ${t}-star`]:{cursor:"default","&:hover":{transform:"scale(1)"}}}),ble(e)),{[`+ ${t}-text`]:{display:"inline-block",marginInlineStart:e.marginXS,fontSize:e.fontSize}}),yle(e))}},$le=Ue("Rate",e=>{const{colorFillContent:t}=e,n=ze(e,{rateStarColor:e["yellow-6"],rateStarSize:e.controlHeightLG*.5,rateStarHoverScale:"scale(1.1)",defaultColor:t});return[Sle(n)]}),Cle=()=>({prefixCls:String,count:Number,value:Number,allowHalf:{type:Boolean,default:void 0},allowClear:{type:Boolean,default:void 0},tooltips:Array,disabled:{type:Boolean,default:void 0},character:K.any,autofocus:{type:Boolean,default:void 0},tabindex:K.oneOfType([K.number,K.string]),direction:String,id:String,onChange:Function,onHoverChange:Function,"onUpdate:value":Function,onFocus:Function,onBlur:Function,onKeydown:Function}),xle=re({compatConfig:{MODE:3},name:"ARate",inheritAttrs:!1,props:Qe(Cle(),{value:0,count:5,allowHalf:!1,allowClear:!0,tabindex:0,direction:"ltr"}),setup(e,t){let{slots:n,attrs:o,emit:r,expose:i}=t;const{prefixCls:l,direction:a}=Ee("rate",e),[s,c]=$le(l),u=an(),d=ne(),[f,h]=C1(),v=ft({value:e.value,focused:!1,cleanedValue:null,hoverValue:void 0});ye(()=>e.value,()=>{v.value=e.value});const g=E=>Jn(h.value.get(E)),b=(E,A)=>{const R=a.value==="rtl";let z=E+1;if(e.allowHalf){const _=g(E),D=ple(_),N=_.clientWidth;(R&&A-D>N/2||!R&&A-D{e.value===void 0&&(v.value=E),r("update:value",E),r("change",E),u.onFieldChange()},S=(E,A)=>{const R=b(A,E.pageX);R!==v.cleanedValue&&(v.hoverValue=R,v.cleanedValue=null),r("hoverChange",R)},$=()=>{v.hoverValue=void 0,v.cleanedValue=null,r("hoverChange",void 0)},w=(E,A)=>{const{allowClear:R}=e,z=b(A,E.pageX);let _=!1;R&&(_=z===v.value),$(),y(_?0:z),v.cleanedValue=_?z:null},C=E=>{v.focused=!0,r("focus",E)},O=E=>{v.focused=!1,r("blur",E),u.onFieldBlur()},x=E=>{const{keyCode:A}=E,{count:R,allowHalf:z}=e,_=a.value==="rtl";A===Ie.RIGHT&&v.value0&&!_||A===Ie.RIGHT&&v.value>0&&_?(z?v.value-=.5:v.value-=1,y(v.value),E.preventDefault()):A===Ie.LEFT&&v.value{e.disabled||d.value.focus()};i({focus:I,blur:()=>{e.disabled||d.value.blur()}}),Ke(()=>{const{autofocus:E,disabled:A}=e;E&&!A&&I()});const M=(E,A)=>{let{index:R}=A;const{tooltips:z}=e;return z?p(co,{title:z[R]},{default:()=>[E]}):E};return()=>{const{count:E,allowHalf:A,disabled:R,tabindex:z,id:_=u.id.value}=e,{class:D,style:N}=o,k=[],F=R?`${l.value}-disabled`:"",L=e.character||n.character||(()=>p(sS,null,null));for(let j=0;jp("svg",{width:"252",height:"294"},[p("defs",null,[p("path",{d:"M0 .387h251.772v251.772H0z"},null)]),p("g",{fill:"none","fill-rule":"evenodd"},[p("g",{transform:"translate(0 .012)"},[p("mask",{fill:"#fff"},null),p("path",{d:"M0 127.32v-2.095C0 56.279 55.892.387 124.838.387h2.096c68.946 0 124.838 55.892 124.838 124.838v2.096c0 68.946-55.892 124.838-124.838 124.838h-2.096C55.892 252.16 0 196.267 0 127.321",fill:"#E4EBF7",mask:"url(#b)"},null)]),p("path",{d:"M39.755 130.84a8.276 8.276 0 1 1-16.468-1.66 8.276 8.276 0 0 1 16.468 1.66",fill:"#FFF"},null),p("path",{d:"M36.975 134.297l10.482 5.943M48.373 146.508l-12.648 10.788",stroke:"#FFF","stroke-width":"2"},null),p("path",{d:"M39.875 159.352a5.667 5.667 0 1 1-11.277-1.136 5.667 5.667 0 0 1 11.277 1.136M57.588 143.247a5.708 5.708 0 1 1-11.358-1.145 5.708 5.708 0 0 1 11.358 1.145M99.018 26.875l29.82-.014a4.587 4.587 0 1 0-.003-9.175l-29.82.013a4.587 4.587 0 1 0 .003 9.176M110.424 45.211l29.82-.013a4.588 4.588 0 0 0-.004-9.175l-29.82.013a4.587 4.587 0 1 0 .004 9.175",fill:"#FFF"},null),p("path",{d:"M112.798 26.861v-.002l15.784-.006a4.588 4.588 0 1 0 .003 9.175l-15.783.007v-.002a4.586 4.586 0 0 0-.004-9.172M184.523 135.668c-.553 5.485-5.447 9.483-10.931 8.93-5.485-.553-9.483-5.448-8.93-10.932.552-5.485 5.447-9.483 10.932-8.93 5.485.553 9.483 5.447 8.93 10.932",fill:"#FFF"},null),p("path",{d:"M179.26 141.75l12.64 7.167M193.006 156.477l-15.255 13.011",stroke:"#FFF","stroke-width":"2"},null),p("path",{d:"M184.668 170.057a6.835 6.835 0 1 1-13.6-1.372 6.835 6.835 0 0 1 13.6 1.372M203.34 153.325a6.885 6.885 0 1 1-13.7-1.382 6.885 6.885 0 0 1 13.7 1.382",fill:"#FFF"},null),p("path",{d:"M151.931 192.324a2.222 2.222 0 1 1-4.444 0 2.222 2.222 0 0 1 4.444 0zM225.27 116.056a2.222 2.222 0 1 1-4.445 0 2.222 2.222 0 0 1 4.444 0zM216.38 151.08a2.223 2.223 0 1 1-4.446-.001 2.223 2.223 0 0 1 4.446 0zM176.917 107.636a2.223 2.223 0 1 1-4.445 0 2.223 2.223 0 0 1 4.445 0zM195.291 92.165a2.223 2.223 0 1 1-4.445 0 2.223 2.223 0 0 1 4.445 0zM202.058 180.711a2.223 2.223 0 1 1-4.446 0 2.223 2.223 0 0 1 4.446 0z",stroke:"#FFF","stroke-width":"2"},null),p("path",{stroke:"#FFF","stroke-width":"2",d:"M214.404 153.302l-1.912 20.184-10.928 5.99M173.661 174.792l-6.356 9.814h-11.36l-4.508 6.484M174.941 125.168v-15.804M220.824 117.25l-12.84 7.901-15.31-7.902V94.39"},null),p("path",{d:"M166.588 65.936h-3.951a4.756 4.756 0 0 1-4.743-4.742 4.756 4.756 0 0 1 4.743-4.743h3.951a4.756 4.756 0 0 1 4.743 4.743 4.756 4.756 0 0 1-4.743 4.742",fill:"#FFF"},null),p("path",{d:"M174.823 30.03c0-16.281 13.198-29.48 29.48-29.48 16.28 0 29.48 13.199 29.48 29.48 0 16.28-13.2 29.48-29.48 29.48-16.282 0-29.48-13.2-29.48-29.48",fill:"#1890FF"},null),p("path",{d:"M205.952 38.387c.5.5.785 1.142.785 1.928s-.286 1.465-.785 1.964c-.572.5-1.214.75-2 .75-.785 0-1.429-.285-1.929-.785-.572-.5-.82-1.143-.82-1.929s.248-1.428.82-1.928c.5-.5 1.144-.75 1.93-.75.785 0 1.462.25 1.999.75m4.285-19.463c1.428 1.249 2.143 2.963 2.143 5.142 0 1.712-.427 3.13-1.219 4.25-.067.096-.137.18-.218.265-.416.429-1.41 1.346-2.956 2.699a5.07 5.07 0 0 0-1.428 1.75 5.207 5.207 0 0 0-.536 2.357v.5h-4.107v-.5c0-1.357.215-2.536.714-3.5.464-.964 1.857-2.464 4.178-4.536l.43-.5c.643-.785.964-1.643.964-2.535 0-1.18-.358-2.108-1-2.785-.678-.68-1.643-1.001-2.858-1.001-1.536 0-2.642.464-3.357 1.43-.37.5-.621 1.135-.76 1.904a1.999 1.999 0 0 1-1.971 1.63h-.004c-1.277 0-2.257-1.183-1.98-2.43.337-1.518 1.02-2.78 2.073-3.784 1.536-1.5 3.607-2.25 6.25-2.25 2.32 0 4.214.607 5.642 1.894",fill:"#FFF"},null),p("path",{d:"M52.04 76.131s21.81 5.36 27.307 15.945c5.575 10.74-6.352 9.26-15.73 4.935-10.86-5.008-24.7-11.822-11.577-20.88",fill:"#FFB594"},null),p("path",{d:"M90.483 67.504l-.449 2.893c-.753.49-4.748-2.663-4.748-2.663l-1.645.748-1.346-5.684s6.815-4.589 8.917-5.018c2.452-.501 9.884.94 10.7 2.278 0 0 1.32.486-2.227.69-3.548.203-5.043.447-6.79 3.132-1.747 2.686-2.412 3.624-2.412 3.624",fill:"#FFC6A0"},null),p("path",{d:"M128.055 111.367c-2.627-7.724-6.15-13.18-8.917-15.478-3.5-2.906-9.34-2.225-11.366-4.187-1.27-1.231-3.215-1.197-3.215-1.197s-14.98-3.158-16.828-3.479c-2.37-.41-2.124-.714-6.054-1.405-1.57-1.907-2.917-1.122-2.917-1.122l-7.11-1.383c-.853-1.472-2.423-1.023-2.423-1.023l-2.468-.897c-1.645 9.976-7.74 13.796-7.74 13.796 1.795 1.122 15.703 8.3 15.703 8.3l5.107 37.11s-3.321 5.694 1.346 9.109c0 0 19.883-3.743 34.921-.329 0 0 3.047-2.546.972-8.806.523-3.01 1.394-8.263 1.736-11.622.385.772 2.019 1.918 3.14 3.477 0 0 9.407-7.365 11.052-14.012-.832-.723-1.598-1.585-2.267-2.453-.567-.736-.358-2.056-.765-2.717-.669-1.084-1.804-1.378-1.907-1.682",fill:"#FFF"},null),p("path",{d:"M101.09 289.998s4.295 2.041 7.354 1.021c2.821-.94 4.53.668 7.08 1.178 2.55.51 6.874 1.1 11.686-1.26-.103-5.51-6.889-3.98-11.96-6.713-2.563-1.38-3.784-4.722-3.598-8.799h-9.402s-1.392 10.52-1.16 14.573",fill:"#CBD1D1"},null),p("path",{d:"M101.067 289.826s2.428 1.271 6.759.653c3.058-.437 3.712.481 7.423 1.031 3.712.55 10.724-.069 11.823-.894.413 1.1-.343 2.063-.343 2.063s-1.512.603-4.812.824c-2.03.136-5.8.291-7.607-.503-1.787-1.375-5.247-1.903-5.728-.241-3.918.95-7.355-.286-7.355-.286l-.16-2.647z",fill:"#2B0849"},null),p("path",{d:"M108.341 276.044h3.094s-.103 6.702 4.536 8.558c-4.64.618-8.558-2.303-7.63-8.558",fill:"#A4AABA"},null),p("path",{d:"M57.542 272.401s-2.107 7.416-4.485 12.306c-1.798 3.695-4.225 7.492 5.465 7.492 6.648 0 8.953-.48 7.423-6.599-1.53-6.12.266-13.199.266-13.199h-8.669z",fill:"#CBD1D1"},null),p("path",{d:"M51.476 289.793s2.097 1.169 6.633 1.169c6.083 0 8.249-1.65 8.249-1.65s.602 1.114-.619 2.165c-.993.855-3.597 1.591-7.39 1.546-4.145-.048-5.832-.566-6.736-1.168-.825-.55-.687-1.58-.137-2.062",fill:"#2B0849"},null),p("path",{d:"M58.419 274.304s.033 1.519-.314 2.93c-.349 1.42-1.078 3.104-1.13 4.139-.058 1.151 4.537 1.58 5.155.034.62-1.547 1.294-6.427 1.913-7.252.619-.825-4.903-2.119-5.624.15",fill:"#A4AABA"},null),p("path",{d:"M99.66 278.514l13.378.092s1.298-54.52 1.853-64.403c.554-9.882 3.776-43.364 1.002-63.128l-12.547-.644-22.849.78s-.434 3.966-1.195 9.976c-.063.496-.682.843-.749 1.365-.075.585.423 1.354.32 1.966-2.364 14.08-6.377 33.104-8.744 46.677-.116.666-1.234 1.009-1.458 2.691-.04.302.211 1.525.112 1.795-6.873 18.744-10.949 47.842-14.277 61.885l14.607-.014s2.197-8.57 4.03-16.97c2.811-12.886 23.111-85.01 23.111-85.01l3.016-.521 1.043 46.35s-.224 1.234.337 2.02c.56.785-.56 1.123-.392 2.244l.392 1.794s-.449 7.178-.898 11.89c-.448 4.71-.092 39.165-.092 39.165",fill:"#7BB2F9"},null),p("path",{d:"M76.085 221.626c1.153.094 4.038-2.019 6.955-4.935M106.36 225.142s2.774-1.11 6.103-3.883",stroke:"#648BD8","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M107.275 222.1s2.773-1.11 6.102-3.884",stroke:"#648BD8","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M74.74 224.767s2.622-.591 6.505-3.365M86.03 151.634c-.27 3.106.3 8.525-4.336 9.123M103.625 149.88s.11 14.012-1.293 15.065c-2.219 1.664-2.99 1.944-2.99 1.944M99.79 150.438s.035 12.88-1.196 24.377M93.673 175.911s7.212-1.664 9.431-1.664M74.31 205.861a212.013 212.013 0 0 1-.979 4.56s-1.458 1.832-1.009 3.776c.449 1.944-.947 2.045-4.985 15.355-1.696 5.59-4.49 18.591-6.348 27.597l-.231 1.12M75.689 197.807a320.934 320.934 0 0 1-.882 4.754M82.591 152.233L81.395 162.7s-1.097.15-.5 2.244c.113 1.346-2.674 15.775-5.18 30.43M56.12 274.418h13.31",stroke:"#648BD8","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M116.241 148.22s-17.047-3.104-35.893.2c.158 2.514-.003 4.15-.003 4.15s14.687-2.818 35.67-.312c.252-2.355.226-4.038.226-4.038",fill:"#192064"},null),p("path",{d:"M106.322 151.165l.003-4.911a.81.81 0 0 0-.778-.815c-2.44-.091-5.066-.108-7.836-.014a.818.818 0 0 0-.789.815l-.003 4.906a.81.81 0 0 0 .831.813c2.385-.06 4.973-.064 7.73.017a.815.815 0 0 0 .842-.81",fill:"#FFF"},null),p("path",{d:"M105.207 150.233l.002-3.076a.642.642 0 0 0-.619-.646 94.321 94.321 0 0 0-5.866-.01.65.65 0 0 0-.63.647v3.072a.64.64 0 0 0 .654.644 121.12 121.12 0 0 1 5.794.011c.362.01.665-.28.665-.642",fill:"#192064"},null),p("path",{d:"M100.263 275.415h12.338M101.436 270.53c.006 3.387.042 5.79.111 6.506M101.451 264.548a915.75 915.75 0 0 0-.015 4.337M100.986 174.965l.898 44.642s.673 1.57-.225 2.692c-.897 1.122 2.468.673.898 2.243-1.57 1.57.897 1.122 0 3.365-.596 1.489-.994 21.1-1.096 35.146",stroke:"#648BD8","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M46.876 83.427s-.516 6.045 7.223 5.552c11.2-.712 9.218-9.345 31.54-21.655-.786-2.708-2.447-4.744-2.447-4.744s-11.068 3.11-22.584 8.046c-6.766 2.9-13.395 6.352-13.732 12.801M104.46 91.057l.941-5.372-8.884-11.43-5.037 5.372-1.74 7.834a.321.321 0 0 0 .108.32c.965.8 6.5 5.013 14.347 3.544a.332.332 0 0 0 .264-.268",fill:"#FFC6A0"},null),p("path",{d:"M93.942 79.387s-4.533-2.853-2.432-6.855c1.623-3.09 4.513 1.133 4.513 1.133s.52-3.642 3.121-3.642c.52-1.04 1.561-4.162 1.561-4.162s11.445 2.601 13.526 3.121c0 5.203-2.304 19.424-7.84 19.861-8.892.703-12.449-9.456-12.449-9.456",fill:"#FFC6A0"},null),p("path",{d:"M113.874 73.446c2.601-2.081 3.47-9.722 3.47-9.722s-2.479-.49-6.64-2.05c-4.683-2.081-12.798-4.747-17.48.976-9.668 3.223-2.05 19.823-2.05 19.823l2.713-3.021s-3.935-3.287-2.08-6.243c2.17-3.462 3.92 1.073 3.92 1.073s.637-2.387 3.581-3.342c.355-.71 1.036-2.674 1.432-3.85a1.073 1.073 0 0 1 1.263-.704c2.4.558 8.677 2.019 11.356 2.662.522.125.871.615.82 1.15l-.305 3.248z",fill:"#520038"},null),p("path",{d:"M104.977 76.064c-.103.61-.582 1.038-1.07.956-.489-.083-.801-.644-.698-1.254.103-.61.582-1.038 1.07-.956.488.082.8.644.698 1.254M112.132 77.694c-.103.61-.582 1.038-1.07.956-.488-.083-.8-.644-.698-1.254.103-.61.582-1.038 1.07-.956.488.082.8.643.698 1.254",fill:"#552950"},null),p("path",{stroke:"#DB836E","stroke-width":"1.118","stroke-linecap":"round","stroke-linejoin":"round",d:"M110.13 74.84l-.896 1.61-.298 4.357h-2.228"},null),p("path",{d:"M110.846 74.481s1.79-.716 2.506.537",stroke:"#5C2552","stroke-width":"1.118","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M92.386 74.282s.477-1.114 1.113-.716c.637.398 1.274 1.433.558 1.99-.717.556.159 1.67.159 1.67",stroke:"#DB836E","stroke-width":"1.118","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M103.287 72.93s1.83 1.113 4.137.954",stroke:"#5C2552","stroke-width":"1.118","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M103.685 81.762s2.227 1.193 4.376 1.193M104.64 84.308s.954.398 1.511.318M94.693 81.205s2.308 7.4 10.424 7.639",stroke:"#DB836E","stroke-width":"1.118","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M81.45 89.384s.45 5.647-4.935 12.787M69 82.654s-.726 9.282-8.204 14.206",stroke:"#E4EBF7","stroke-width":"1.101","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M129.405 122.865s-5.272 7.403-9.422 10.768",stroke:"#E4EBF7","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M119.306 107.329s.452 4.366-2.127 32.062",stroke:"#E4EBF7","stroke-width":"1.101","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M150.028 151.232h-49.837a1.01 1.01 0 0 1-1.01-1.01v-31.688c0-.557.452-1.01 1.01-1.01h49.837c.558 0 1.01.453 1.01 1.01v31.688a1.01 1.01 0 0 1-1.01 1.01",fill:"#F2D7AD"},null),p("path",{d:"M150.29 151.232h-19.863v-33.707h20.784v32.786a.92.92 0 0 1-.92.92",fill:"#F4D19D"},null),p("path",{d:"M123.554 127.896H92.917a.518.518 0 0 1-.425-.816l6.38-9.113c.193-.277.51-.442.85-.442h31.092l-7.26 10.371z",fill:"#F2D7AD"},null),p("path",{fill:"#CC9B6E",d:"M123.689 128.447H99.25v-.519h24.169l7.183-10.26.424.298z"},null),p("path",{d:"M158.298 127.896h-18.669a2.073 2.073 0 0 1-1.659-.83l-7.156-9.541h19.965c.49 0 .95.23 1.244.622l6.69 8.92a.519.519 0 0 1-.415.83",fill:"#F4D19D"},null),p("path",{fill:"#CC9B6E",d:"M157.847 128.479h-19.384l-7.857-10.475.415-.31 7.7 10.266h19.126zM130.554 150.685l-.032-8.177.519-.002.032 8.177z"},null),p("path",{fill:"#CC9B6E",d:"M130.511 139.783l-.08-21.414.519-.002.08 21.414zM111.876 140.932l-.498-.143 1.479-5.167.498.143zM108.437 141.06l-2.679-2.935 2.665-3.434.41.318-2.397 3.089 2.384 2.612zM116.607 141.06l-.383-.35 2.383-2.612-2.397-3.089.41-.318 2.665 3.434z"},null),p("path",{d:"M154.316 131.892l-3.114-1.96.038 3.514-1.043.092c-1.682.115-3.634.23-4.789.23-1.902 0-2.693 2.258 2.23 2.648l-2.645-.596s-2.168 1.317.504 2.3c0 0-1.58 1.217.561 2.58-.584 3.504 5.247 4.058 7.122 3.59 1.876-.47 4.233-2.359 4.487-5.16.28-3.085-.89-5.432-3.35-7.238",fill:"#FFC6A0"},null),p("path",{d:"M153.686 133.577s-6.522.47-8.36.372c-1.836-.098-1.904 2.19 2.359 2.264 3.739.15 5.451-.044 5.451-.044",stroke:"#DB836E","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M145.16 135.877c-1.85 1.346.561 2.355.561 2.355s3.478.898 6.73.617",stroke:"#DB836E","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M151.89 141.71s-6.28.111-6.73-2.132c-.223-1.346.45-1.402.45-1.402M146.114 140.868s-1.103 3.16 5.44 3.533M151.202 129.932v3.477M52.838 89.286c3.533-.337 8.423-1.248 13.582-7.754",stroke:"#DB836E","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M168.567 248.318a6.647 6.647 0 0 1-6.647-6.647v-66.466a6.647 6.647 0 1 1 13.294 0v66.466a6.647 6.647 0 0 1-6.647 6.647",fill:"#5BA02E"},null),p("path",{d:"M176.543 247.653a6.647 6.647 0 0 1-6.646-6.647v-33.232a6.647 6.647 0 1 1 13.293 0v33.232a6.647 6.647 0 0 1-6.647 6.647",fill:"#92C110"},null),p("path",{d:"M186.443 293.613H158.92a3.187 3.187 0 0 1-3.187-3.187v-46.134a3.187 3.187 0 0 1 3.187-3.187h27.524a3.187 3.187 0 0 1 3.187 3.187v46.134a3.187 3.187 0 0 1-3.187 3.187",fill:"#F2D7AD"},null),p("path",{d:"M88.979 89.48s7.776 5.384 16.6 2.842",stroke:"#E4EBF7","stroke-width":"1.101","stroke-linecap":"round","stroke-linejoin":"round"},null)])]),Tle=()=>p("svg",{width:"254",height:"294"},[p("defs",null,[p("path",{d:"M0 .335h253.49v253.49H0z"},null),p("path",{d:"M0 293.665h253.49V.401H0z"},null)]),p("g",{fill:"none","fill-rule":"evenodd"},[p("g",{transform:"translate(0 .067)"},[p("mask",{fill:"#fff"},null),p("path",{d:"M0 128.134v-2.11C0 56.608 56.273.334 125.69.334h2.11c69.416 0 125.69 56.274 125.69 125.69v2.11c0 69.417-56.274 125.69-125.69 125.69h-2.11C56.273 253.824 0 197.551 0 128.134",fill:"#E4EBF7",mask:"url(#b)"},null)]),p("path",{d:"M39.989 132.108a8.332 8.332 0 1 1-16.581-1.671 8.332 8.332 0 0 1 16.58 1.671",fill:"#FFF"},null),p("path",{d:"M37.19 135.59l10.553 5.983M48.665 147.884l-12.734 10.861",stroke:"#FFF","stroke-width":"2"},null),p("path",{d:"M40.11 160.816a5.706 5.706 0 1 1-11.354-1.145 5.706 5.706 0 0 1 11.354 1.145M57.943 144.6a5.747 5.747 0 1 1-11.436-1.152 5.747 5.747 0 0 1 11.436 1.153M99.656 27.434l30.024-.013a4.619 4.619 0 1 0-.004-9.238l-30.024.013a4.62 4.62 0 0 0 .004 9.238M111.14 45.896l30.023-.013a4.62 4.62 0 1 0-.004-9.238l-30.024.013a4.619 4.619 0 1 0 .004 9.238",fill:"#FFF"},null),p("path",{d:"M113.53 27.421v-.002l15.89-.007a4.619 4.619 0 1 0 .005 9.238l-15.892.007v-.002a4.618 4.618 0 0 0-.004-9.234M150.167 70.091h-3.979a4.789 4.789 0 0 1-4.774-4.775 4.788 4.788 0 0 1 4.774-4.774h3.979a4.789 4.789 0 0 1 4.775 4.774 4.789 4.789 0 0 1-4.775 4.775",fill:"#FFF"},null),p("path",{d:"M171.687 30.234c0-16.392 13.289-29.68 29.681-29.68 16.392 0 29.68 13.288 29.68 29.68 0 16.393-13.288 29.681-29.68 29.681s-29.68-13.288-29.68-29.68",fill:"#FF603B"},null),p("path",{d:"M203.557 19.435l-.676 15.035a1.514 1.514 0 0 1-3.026 0l-.675-15.035a2.19 2.19 0 1 1 4.377 0m-.264 19.378c.513.477.77 1.1.77 1.87s-.257 1.393-.77 1.907c-.55.476-1.21.733-1.943.733a2.545 2.545 0 0 1-1.87-.77c-.55-.514-.806-1.136-.806-1.87 0-.77.256-1.393.806-1.87.513-.513 1.137-.733 1.87-.733.77 0 1.43.22 1.943.733",fill:"#FFF"},null),p("path",{d:"M119.3 133.275c4.426-.598 3.612-1.204 4.079-4.778.675-5.18-3.108-16.935-8.262-25.118-1.088-10.72-12.598-11.24-12.598-11.24s4.312 4.895 4.196 16.199c1.398 5.243.804 14.45.804 14.45s5.255 11.369 11.78 10.487",fill:"#FFB594"},null),p("path",{d:"M100.944 91.61s1.463-.583 3.211.582c8.08 1.398 10.368 6.706 11.3 11.368 1.864 1.282 1.864 2.33 1.864 3.496.365.777 1.515 3.03 1.515 3.03s-7.225 1.748-10.954 6.758c-1.399-6.41-6.936-25.235-6.936-25.235",fill:"#FFF"},null),p("path",{d:"M94.008 90.5l1.019-5.815-9.23-11.874-5.233 5.581-2.593 9.863s8.39 5.128 16.037 2.246",fill:"#FFB594"},null),p("path",{d:"M82.931 78.216s-4.557-2.868-2.445-6.892c1.632-3.107 4.537 1.139 4.537 1.139s.524-3.662 3.139-3.662c.523-1.046 1.569-4.184 1.569-4.184s11.507 2.615 13.6 3.138c-.001 5.23-2.317 19.529-7.884 19.969-8.94.706-12.516-9.508-12.516-9.508",fill:"#FFC6A0"},null),p("path",{d:"M102.971 72.243c2.616-2.093 3.489-9.775 3.489-9.775s-2.492-.492-6.676-2.062c-4.708-2.092-12.867-4.771-17.575.982-9.54 4.41-2.062 19.93-2.062 19.93l2.729-3.037s-3.956-3.304-2.092-6.277c2.183-3.48 3.943 1.08 3.943 1.08s.64-2.4 3.6-3.36c.356-.714 1.04-2.69 1.44-3.872a1.08 1.08 0 0 1 1.27-.707c2.41.56 8.723 2.03 11.417 2.676.524.126.876.619.825 1.156l-.308 3.266z",fill:"#520038"},null),p("path",{d:"M101.22 76.514c-.104.613-.585 1.044-1.076.96-.49-.082-.805-.646-.702-1.26.104-.613.585-1.044 1.076-.961.491.083.805.647.702 1.26M94.26 75.074c-.104.613-.585 1.044-1.076.96-.49-.082-.805-.646-.702-1.26.104-.613.585-1.044 1.076-.96.491.082.805.646.702 1.26",fill:"#552950"},null),p("path",{stroke:"#DB836E","stroke-width":"1.063","stroke-linecap":"round","stroke-linejoin":"round",d:"M99.206 73.644l-.9 1.62-.3 4.38h-2.24"},null),p("path",{d:"M99.926 73.284s1.8-.72 2.52.54",stroke:"#5C2552","stroke-width":"1.117","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M81.367 73.084s.48-1.12 1.12-.72c.64.4 1.28 1.44.56 2s.16 1.68.16 1.68",stroke:"#DB836E","stroke-width":"1.117","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M92.326 71.724s1.84 1.12 4.16.96",stroke:"#5C2552","stroke-width":"1.117","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M92.726 80.604s2.24 1.2 4.4 1.2M93.686 83.164s.96.4 1.52.32M83.687 80.044s1.786 6.547 9.262 7.954",stroke:"#DB836E","stroke-width":"1.063","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M95.548 91.663s-1.068 2.821-8.298 2.105c-7.23-.717-10.29-5.044-10.29-5.044",stroke:"#E4EBF7","stroke-width":"1.136","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M78.126 87.478s6.526 4.972 16.47 2.486c0 0 9.577 1.02 11.536 5.322 5.36 11.77.543 36.835 0 39.962 3.496 4.055-.466 8.483-.466 8.483-15.624-3.548-35.81-.6-35.81-.6-4.849-3.546-1.223-9.044-1.223-9.044L62.38 110.32c-2.485-15.227.833-19.803 3.549-20.743 3.03-1.049 8.04-1.282 8.04-1.282.496-.058 1.08-.076 1.37-.233 2.36-1.282 2.787-.583 2.787-.583",fill:"#FFF"},null),p("path",{d:"M65.828 89.81s-6.875.465-7.59 8.156c-.466 8.857 3.03 10.954 3.03 10.954s6.075 22.102 16.796 22.957c8.39-2.176 4.758-6.702 4.661-11.42-.233-11.304-7.108-16.897-7.108-16.897s-4.212-13.75-9.789-13.75",fill:"#FFC6A0"},null),p("path",{d:"M71.716 124.225s.855 11.264 9.828 6.486c4.765-2.536 7.581-13.828 9.789-22.568 1.456-5.768 2.58-12.197 2.58-12.197l-4.973-1.709s-2.408 5.516-7.769 12.275c-4.335 5.467-9.144 11.11-9.455 17.713",fill:"#FFC6A0"},null),p("path",{d:"M108.463 105.191s1.747 2.724-2.331 30.535c2.376 2.216 1.053 6.012-.233 7.51",stroke:"#E4EBF7","stroke-width":"1.085","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M123.262 131.527s-.427 2.732-11.77 1.981c-15.187-1.006-25.326-3.25-25.326-3.25l.933-5.8s.723.215 9.71-.068c11.887-.373 18.714-6.07 24.964-1.022 4.039 3.263 1.489 8.16 1.489 8.16",fill:"#FFC6A0"},null),p("path",{d:"M70.24 90.974s-5.593-4.739-11.054 2.68c-3.318 7.223.517 15.284 2.664 19.578-.31 3.729 2.33 4.311 2.33 4.311s.108.895 1.516 2.68c4.078-7.03 6.72-9.166 13.711-12.546-.328-.656-1.877-3.265-1.825-3.767.175-1.69-1.282-2.623-1.282-2.623s-.286-.156-1.165-2.738c-.788-2.313-2.036-5.177-4.895-7.575",fill:"#FFF"},null),p("path",{d:"M90.232 288.027s4.855 2.308 8.313 1.155c3.188-1.063 5.12.755 8.002 1.331 2.881.577 7.769 1.243 13.207-1.424-.117-6.228-7.786-4.499-13.518-7.588-2.895-1.56-4.276-5.336-4.066-9.944H91.544s-1.573 11.89-1.312 16.47",fill:"#CBD1D1"},null),p("path",{d:"M90.207 287.833s2.745 1.437 7.639.738c3.456-.494 3.223.66 7.418 1.282 4.195.621 13.092-.194 14.334-1.126.466 1.242-.388 2.33-.388 2.33s-1.709.682-5.438.932c-2.295.154-8.098.276-10.14-.621-2.02-1.554-4.894-1.515-6.06-.234-4.427 1.075-7.184-.31-7.184-.31l-.181-2.991z",fill:"#2B0849"},null),p("path",{d:"M98.429 272.257h3.496s-.117 7.574 5.127 9.671c-5.244.7-9.672-2.602-8.623-9.671",fill:"#A4AABA"},null),p("path",{d:"M44.425 272.046s-2.208 7.774-4.702 12.899c-1.884 3.874-4.428 7.854 5.729 7.854 6.97 0 9.385-.503 7.782-6.917-1.604-6.415.279-13.836.279-13.836h-9.088z",fill:"#CBD1D1"},null),p("path",{d:"M38.066 290.277s2.198 1.225 6.954 1.225c6.376 0 8.646-1.73 8.646-1.73s.63 1.168-.649 2.27c-1.04.897-3.77 1.668-7.745 1.621-4.347-.05-6.115-.593-7.062-1.224-.864-.577-.72-1.657-.144-2.162",fill:"#2B0849"},null),p("path",{d:"M45.344 274.041s.035 1.592-.329 3.07c-.365 1.49-1.13 3.255-1.184 4.34-.061 1.206 4.755 1.657 5.403.036.65-1.622 1.357-6.737 2.006-7.602.648-.865-5.14-2.222-5.896.156",fill:"#A4AABA"},null),p("path",{d:"M89.476 277.57l13.899.095s1.349-56.643 1.925-66.909c.576-10.267 3.923-45.052 1.042-65.585l-13.037-.669-23.737.81s-.452 4.12-1.243 10.365c-.065.515-.708.874-.777 1.417-.078.608.439 1.407.332 2.044-2.455 14.627-5.797 32.736-8.256 46.837-.121.693-1.282 1.048-1.515 2.796-.042.314.22 1.584.116 1.865-7.14 19.473-12.202 52.601-15.66 67.19l15.176-.015s2.282-10.145 4.185-18.871c2.922-13.389 24.012-88.32 24.012-88.32l3.133-.954-.158 48.568s-.233 1.282.35 2.098c.583.815-.581 1.167-.408 2.331l.408 1.864s-.466 7.458-.932 12.352c-.467 4.895 1.145 40.69 1.145 40.69",fill:"#7BB2F9"},null),p("path",{d:"M64.57 218.881c1.197.099 4.195-2.097 7.225-5.127M96.024 222.534s2.881-1.152 6.34-4.034",stroke:"#648BD8","stroke-width":"1.085","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M96.973 219.373s2.882-1.153 6.34-4.034",stroke:"#648BD8","stroke-width":"1.032","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M63.172 222.144s2.724-.614 6.759-3.496M74.903 146.166c-.281 3.226.31 8.856-4.506 9.478M93.182 144.344s.115 14.557-1.344 15.65c-2.305 1.73-3.107 2.02-3.107 2.02M89.197 144.923s.269 13.144-1.01 25.088M83.525 170.71s6.81-1.051 9.116-1.051M46.026 270.045l-.892 4.538M46.937 263.289l-.815 4.157M62.725 202.503c-.33 1.618-.102 1.904-.449 3.438 0 0-2.756 1.903-2.29 3.923.466 2.02-.31 3.424-4.505 17.252-1.762 5.807-4.233 18.922-6.165 28.278-.03.144-.521 2.646-1.14 5.8M64.158 194.136c-.295 1.658-.6 3.31-.917 4.938M71.33 146.787l-1.244 10.877s-1.14.155-.519 2.33c.117 1.399-2.778 16.39-5.382 31.615M44.242 273.727H58.07",stroke:"#648BD8","stroke-width":"1.085","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M106.18 142.117c-3.028-.489-18.825-2.744-36.219.2a.625.625 0 0 0-.518.644c.063 1.307.044 2.343.015 2.995a.617.617 0 0 0 .716.636c3.303-.534 17.037-2.412 35.664-.266.347.04.66-.214.692-.56.124-1.347.16-2.425.17-3.029a.616.616 0 0 0-.52-.62",fill:"#192064"},null),p("path",{d:"M96.398 145.264l.003-5.102a.843.843 0 0 0-.809-.847 114.104 114.104 0 0 0-8.141-.014.85.85 0 0 0-.82.847l-.003 5.097c0 .476.388.857.864.845 2.478-.064 5.166-.067 8.03.017a.848.848 0 0 0 .876-.843",fill:"#FFF"},null),p("path",{d:"M95.239 144.296l.002-3.195a.667.667 0 0 0-.643-.672c-1.9-.061-3.941-.073-6.094-.01a.675.675 0 0 0-.654.672l-.002 3.192c0 .376.305.677.68.669 1.859-.042 3.874-.043 6.02.012.376.01.69-.291.691-.668",fill:"#192064"},null),p("path",{d:"M90.102 273.522h12.819M91.216 269.761c.006 3.519-.072 5.55 0 6.292M90.923 263.474c-.009 1.599-.016 2.558-.016 4.505M90.44 170.404l.932 46.38s.7 1.631-.233 2.796c-.932 1.166 2.564.7.932 2.33-1.63 1.633.933 1.166 0 3.497-.618 1.546-1.031 21.921-1.138 36.513",stroke:"#648BD8","stroke-width":"1.085","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M73.736 98.665l2.214 4.312s2.098.816 1.865 2.68l.816 2.214M64.297 116.611c.233-.932 2.176-7.147 12.585-10.488M77.598 90.042s7.691 6.137 16.547 2.72",stroke:"#E4EBF7","stroke-width":"1.085","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M91.974 86.954s5.476-.816 7.574-4.545c1.297-.345.72 2.212-.33 3.671-.7.971-1.01 1.554-1.01 1.554s.194.31.155.816c-.053.697-.175.653-.272 1.048-.081.335.108.657 0 1.049-.046.17-.198.5-.382.878-.12.249-.072.687-.2.948-.231.469-1.562 1.87-2.622 2.855-3.826 3.554-5.018 1.644-6.001-.408-.894-1.865-.661-5.127-.874-6.875-.35-2.914-2.622-3.03-1.923-4.429.343-.685 2.87.69 3.263 1.748.757 2.04 2.952 1.807 2.622 1.69",fill:"#FFC6A0"},null),p("path",{d:"M99.8 82.429c-.465.077-.35.272-.97 1.243-.622.971-4.817 2.932-6.39 3.224-2.589.48-2.278-1.56-4.254-2.855-1.69-1.107-3.562-.638-1.398 1.398.99.932.932 1.107 1.398 3.205.335 1.506-.64 3.67.7 5.593",stroke:"#DB836E","stroke-width":".774","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M79.543 108.673c-2.1 2.926-4.266 6.175-5.557 8.762",stroke:"#E59788","stroke-width":".774","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M87.72 124.768s-2.098-1.942-5.127-2.719c-3.03-.777-3.574-.155-5.516.078-1.942.233-3.885-.932-3.652.7.233 1.63 5.05 1.01 5.206 2.097.155 1.087-6.37 2.796-8.313 2.175-.777.777.466 1.864 2.02 2.175.233 1.554 2.253 1.554 2.253 1.554s.699 1.01 2.641 1.088c2.486 1.32 8.934-.7 10.954-1.554 2.02-.855-.466-5.594-.466-5.594",fill:"#FFC6A0"},null),p("path",{d:"M73.425 122.826s.66 1.127 3.167 1.418c2.315.27 2.563.583 2.563.583s-2.545 2.894-9.07 2.272M72.416 129.274s3.826.097 4.933-.718M74.98 130.75s1.961.136 3.36-.505M77.232 131.916s1.748.019 2.914-.505M73.328 122.321s-.595-1.032 1.262-.427c1.671.544 2.833.055 5.128.155 1.389.061 3.067-.297 3.982.15 1.606.784 3.632 2.181 3.632 2.181s10.526 1.204 19.033-1.127M78.864 108.104s-8.39 2.758-13.168 12.12",stroke:"#E59788","stroke-width":".774","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M109.278 112.533s3.38-3.613 7.575-4.662",stroke:"#E4EBF7","stroke-width":"1.085","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M107.375 123.006s9.697-2.745 11.445-.88",stroke:"#E59788","stroke-width":".774","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M194.605 83.656l3.971-3.886M187.166 90.933l3.736-3.655M191.752 84.207l-4.462-4.56M198.453 91.057l-4.133-4.225M129.256 163.074l3.718-3.718M122.291 170.039l3.498-3.498M126.561 163.626l-4.27-4.27M132.975 170.039l-3.955-3.955",stroke:"#BFCDDD","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M190.156 211.779h-1.604a4.023 4.023 0 0 1-4.011-4.011V175.68a4.023 4.023 0 0 1 4.01-4.01h1.605a4.023 4.023 0 0 1 4.011 4.01v32.088a4.023 4.023 0 0 1-4.01 4.01",fill:"#A3B4C6"},null),p("path",{d:"M237.824 212.977a4.813 4.813 0 0 1-4.813 4.813h-86.636a4.813 4.813 0 0 1 0-9.626h86.636a4.813 4.813 0 0 1 4.813 4.813",fill:"#A3B4C6"},null),p("mask",{fill:"#fff"},null),p("path",{fill:"#A3B4C6",mask:"url(#d)",d:"M154.098 190.096h70.513v-84.617h-70.513z"},null),p("path",{d:"M224.928 190.096H153.78a3.219 3.219 0 0 1-3.208-3.209V167.92a3.219 3.219 0 0 1 3.208-3.21h71.148a3.219 3.219 0 0 1 3.209 3.21v18.967a3.219 3.219 0 0 1-3.21 3.209M224.928 130.832H153.78a3.218 3.218 0 0 1-3.208-3.208v-18.968a3.219 3.219 0 0 1 3.208-3.209h71.148a3.219 3.219 0 0 1 3.209 3.21v18.967a3.218 3.218 0 0 1-3.21 3.208",fill:"#BFCDDD",mask:"url(#d)"},null),p("path",{d:"M159.563 120.546a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M166.98 120.546a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M174.397 120.546a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M222.539 120.546h-22.461a.802.802 0 0 1-.802-.802v-3.208c0-.443.359-.803.802-.803h22.46c.444 0 .803.36.803.803v3.208c0 .443-.36.802-.802.802",fill:"#FFF",mask:"url(#d)"},null),p("path",{d:"M224.928 160.464H153.78a3.218 3.218 0 0 1-3.208-3.209v-18.967a3.219 3.219 0 0 1 3.208-3.209h71.148a3.219 3.219 0 0 1 3.209 3.209v18.967a3.218 3.218 0 0 1-3.21 3.209",fill:"#BFCDDD",mask:"url(#d)"},null),p("path",{d:"M173.455 130.832h49.301M164.984 130.832h6.089M155.952 130.832h6.75M173.837 160.613h49.3M165.365 160.613h6.089M155.57 160.613h6.751",stroke:"#7C90A5","stroke-width":"1.124","stroke-linecap":"round","stroke-linejoin":"round",mask:"url(#d)"},null),p("path",{d:"M159.563 151.038a2.407 2.407 0 1 1 0-4.814 2.407 2.407 0 0 1 0 4.814M166.98 151.038a2.407 2.407 0 1 1 0-4.814 2.407 2.407 0 0 1 0 4.814M174.397 151.038a2.407 2.407 0 1 1 .001-4.814 2.407 2.407 0 0 1 0 4.814M222.539 151.038h-22.461a.802.802 0 0 1-.802-.802v-3.209c0-.443.359-.802.802-.802h22.46c.444 0 .803.36.803.802v3.209c0 .443-.36.802-.802.802M159.563 179.987a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M166.98 179.987a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M174.397 179.987a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M222.539 179.987h-22.461a.802.802 0 0 1-.802-.802v-3.209c0-.443.359-.802.802-.802h22.46c.444 0 .803.36.803.802v3.209c0 .443-.36.802-.802.802",fill:"#FFF",mask:"url(#d)"},null),p("path",{d:"M203.04 221.108h-27.372a2.413 2.413 0 0 1-2.406-2.407v-11.448a2.414 2.414 0 0 1 2.406-2.407h27.372a2.414 2.414 0 0 1 2.407 2.407V218.7a2.413 2.413 0 0 1-2.407 2.407",fill:"#BFCDDD",mask:"url(#d)"},null),p("path",{d:"M177.259 207.217v11.52M201.05 207.217v11.52",stroke:"#A3B4C6","stroke-width":"1.124","stroke-linecap":"round","stroke-linejoin":"round",mask:"url(#d)"},null),p("path",{d:"M162.873 267.894a9.422 9.422 0 0 1-9.422-9.422v-14.82a9.423 9.423 0 0 1 18.845 0v14.82a9.423 9.423 0 0 1-9.423 9.422",fill:"#5BA02E",mask:"url(#d)"},null),p("path",{d:"M171.22 267.83a9.422 9.422 0 0 1-9.422-9.423v-3.438a9.423 9.423 0 0 1 18.845 0v3.438a9.423 9.423 0 0 1-9.422 9.423",fill:"#92C110",mask:"url(#d)"},null),p("path",{d:"M181.31 293.666h-27.712a3.209 3.209 0 0 1-3.209-3.21V269.79a3.209 3.209 0 0 1 3.209-3.21h27.711a3.209 3.209 0 0 1 3.209 3.21v20.668a3.209 3.209 0 0 1-3.209 3.209",fill:"#F2D7AD",mask:"url(#d)"},null)])]),Ele=()=>p("svg",{width:"251",height:"294"},[p("g",{fill:"none","fill-rule":"evenodd"},[p("path",{d:"M0 129.023v-2.084C0 58.364 55.591 2.774 124.165 2.774h2.085c68.574 0 124.165 55.59 124.165 124.165v2.084c0 68.575-55.59 124.166-124.165 124.166h-2.085C55.591 253.189 0 197.598 0 129.023",fill:"#E4EBF7"},null),p("path",{d:"M41.417 132.92a8.231 8.231 0 1 1-16.38-1.65 8.231 8.231 0 0 1 16.38 1.65",fill:"#FFF"},null),p("path",{d:"M38.652 136.36l10.425 5.91M49.989 148.505l-12.58 10.73",stroke:"#FFF","stroke-width":"2"},null),p("path",{d:"M41.536 161.28a5.636 5.636 0 1 1-11.216-1.13 5.636 5.636 0 0 1 11.216 1.13M59.154 145.261a5.677 5.677 0 1 1-11.297-1.138 5.677 5.677 0 0 1 11.297 1.138M100.36 29.516l29.66-.013a4.562 4.562 0 1 0-.004-9.126l-29.66.013a4.563 4.563 0 0 0 .005 9.126M111.705 47.754l29.659-.013a4.563 4.563 0 1 0-.004-9.126l-29.66.013a4.563 4.563 0 1 0 .005 9.126",fill:"#FFF"},null),p("path",{d:"M114.066 29.503V29.5l15.698-.007a4.563 4.563 0 1 0 .004 9.126l-15.698.007v-.002a4.562 4.562 0 0 0-.004-9.122M185.405 137.723c-.55 5.455-5.418 9.432-10.873 8.882-5.456-.55-9.432-5.418-8.882-10.873.55-5.455 5.418-9.432 10.873-8.882 5.455.55 9.432 5.418 8.882 10.873",fill:"#FFF"},null),p("path",{d:"M180.17 143.772l12.572 7.129M193.841 158.42L178.67 171.36",stroke:"#FFF","stroke-width":"2"},null),p("path",{d:"M185.55 171.926a6.798 6.798 0 1 1-13.528-1.363 6.798 6.798 0 0 1 13.527 1.363M204.12 155.285a6.848 6.848 0 1 1-13.627-1.375 6.848 6.848 0 0 1 13.626 1.375",fill:"#FFF"},null),p("path",{d:"M152.988 194.074a2.21 2.21 0 1 1-4.42 0 2.21 2.21 0 0 1 4.42 0zM225.931 118.217a2.21 2.21 0 1 1-4.421 0 2.21 2.21 0 0 1 4.421 0zM217.09 153.051a2.21 2.21 0 1 1-4.421 0 2.21 2.21 0 0 1 4.42 0zM177.84 109.842a2.21 2.21 0 1 1-4.422 0 2.21 2.21 0 0 1 4.421 0zM196.114 94.454a2.21 2.21 0 1 1-4.421 0 2.21 2.21 0 0 1 4.421 0zM202.844 182.523a2.21 2.21 0 1 1-4.42 0 2.21 2.21 0 0 1 4.42 0z",stroke:"#FFF","stroke-width":"2"},null),p("path",{stroke:"#FFF","stroke-width":"2",d:"M215.125 155.262l-1.902 20.075-10.87 5.958M174.601 176.636l-6.322 9.761H156.98l-4.484 6.449M175.874 127.28V111.56M221.51 119.404l-12.77 7.859-15.228-7.86V96.668"},null),p("path",{d:"M180.68 29.32C180.68 13.128 193.806 0 210 0c16.193 0 29.32 13.127 29.32 29.32 0 16.194-13.127 29.322-29.32 29.322-16.193 0-29.32-13.128-29.32-29.321",fill:"#A26EF4"},null),p("path",{d:"M221.45 41.706l-21.563-.125a1.744 1.744 0 0 1-1.734-1.754l.071-12.23a1.744 1.744 0 0 1 1.754-1.734l21.562.125c.964.006 1.74.791 1.735 1.755l-.071 12.229a1.744 1.744 0 0 1-1.754 1.734",fill:"#FFF"},null),p("path",{d:"M215.106 29.192c-.015 2.577-2.049 4.654-4.543 4.64-2.494-.014-4.504-2.115-4.489-4.693l.04-6.925c.016-2.577 2.05-4.654 4.543-4.64 2.494.015 4.504 2.116 4.49 4.693l-.04 6.925zm-4.53-14.074a6.877 6.877 0 0 0-6.916 6.837l-.043 7.368a6.877 6.877 0 0 0 13.754.08l.042-7.368a6.878 6.878 0 0 0-6.837-6.917zM167.566 68.367h-3.93a4.73 4.73 0 0 1-4.717-4.717 4.73 4.73 0 0 1 4.717-4.717h3.93a4.73 4.73 0 0 1 4.717 4.717 4.73 4.73 0 0 1-4.717 4.717",fill:"#FFF"},null),p("path",{d:"M168.214 248.838a6.611 6.611 0 0 1-6.61-6.611v-66.108a6.611 6.611 0 0 1 13.221 0v66.108a6.611 6.611 0 0 1-6.61 6.61",fill:"#5BA02E"},null),p("path",{d:"M176.147 248.176a6.611 6.611 0 0 1-6.61-6.61v-33.054a6.611 6.611 0 1 1 13.221 0v33.053a6.611 6.611 0 0 1-6.61 6.611",fill:"#92C110"},null),p("path",{d:"M185.994 293.89h-27.376a3.17 3.17 0 0 1-3.17-3.17v-45.887a3.17 3.17 0 0 1 3.17-3.17h27.376a3.17 3.17 0 0 1 3.17 3.17v45.886a3.17 3.17 0 0 1-3.17 3.17",fill:"#F2D7AD"},null),p("path",{d:"M81.972 147.673s6.377-.927 17.566-1.28c11.729-.371 17.57 1.086 17.57 1.086s3.697-3.855.968-8.424c1.278-12.077 5.982-32.827.335-48.273-1.116-1.339-3.743-1.512-7.536-.62-1.337.315-7.147-.149-7.983-.1l-15.311-.347s-3.487-.17-8.035-.508c-1.512-.113-4.227-1.683-5.458-.338-.406.443-2.425 5.669-1.97 16.077l8.635 35.642s-3.141 3.61 1.219 7.085",fill:"#FFF"},null),p("path",{d:"M75.768 73.325l-.9-6.397 11.982-6.52s7.302-.118 8.038 1.205c.737 1.324-5.616.993-5.616.993s-1.836 1.388-2.615 2.5c-1.654 2.363-.986 6.471-8.318 5.986-1.708.284-2.57 2.233-2.57 2.233",fill:"#FFC6A0"},null),p("path",{d:"M52.44 77.672s14.217 9.406 24.973 14.444c1.061.497-2.094 16.183-11.892 11.811-7.436-3.318-20.162-8.44-21.482-14.496-.71-3.258 2.543-7.643 8.401-11.76M141.862 80.113s-6.693 2.999-13.844 6.876c-3.894 2.11-10.137 4.704-12.33 7.988-6.224 9.314 3.536 11.22 12.947 7.503 6.71-2.651 28.999-12.127 13.227-22.367",fill:"#FFB594"},null),p("path",{d:"M76.166 66.36l3.06 3.881s-2.783 2.67-6.31 5.747c-7.103 6.195-12.803 14.296-15.995 16.44-3.966 2.662-9.754 3.314-12.177-.118-3.553-5.032.464-14.628 31.422-25.95",fill:"#FFC6A0"},null),p("path",{d:"M64.674 85.116s-2.34 8.413-8.912 14.447c.652.548 18.586 10.51 22.144 10.056 5.238-.669 6.417-18.968 1.145-20.531-.702-.208-5.901-1.286-8.853-2.167-.87-.26-1.611-1.71-3.545-.936l-1.98-.869zM128.362 85.826s5.318 1.956 7.325 13.734c-.546.274-17.55 12.35-21.829 7.805-6.534-6.94-.766-17.393 4.275-18.61 4.646-1.121 5.03-1.37 10.23-2.929",fill:"#FFF"},null),p("path",{d:"M78.18 94.656s.911 7.41-4.914 13.078",stroke:"#E4EBF7","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M87.397 94.68s3.124 2.572 10.263 2.572c7.14 0 9.074-3.437 9.074-3.437",stroke:"#E4EBF7","stroke-width":".932","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M117.184 68.639l-6.781-6.177s-5.355-4.314-9.223-.893c-3.867 3.422 4.463 2.083 5.653 4.165 1.19 2.082.848 1.143-2.083.446-5.603-1.331-2.082.893 2.975 5.355 2.091 1.845 6.992.955 6.992.955l2.467-3.851z",fill:"#FFC6A0"},null),p("path",{d:"M105.282 91.315l-.297-10.937-15.918-.027-.53 10.45c-.026.403.17.788.515.999 2.049 1.251 9.387 5.093 15.799.424.287-.21.443-.554.431-.91",fill:"#FFB594"},null),p("path",{d:"M107.573 74.24c.817-1.147.982-9.118 1.015-11.928a1.046 1.046 0 0 0-.965-1.055l-4.62-.365c-7.71-1.044-17.071.624-18.253 6.346-5.482 5.813-.421 13.244-.421 13.244s1.963 3.566 4.305 6.791c.756 1.041.398-3.731 3.04-5.929 5.524-4.594 15.899-7.103 15.899-7.103",fill:"#5C2552"},null),p("path",{d:"M88.426 83.206s2.685 6.202 11.602 6.522c7.82.28 8.973-7.008 7.434-17.505l-.909-5.483c-6.118-2.897-15.478.54-15.478.54s-.576 2.044-.19 5.504c-2.276 2.066-1.824 5.618-1.824 5.618s-.905-1.922-1.98-2.321c-.86-.32-1.897.089-2.322 1.98-1.04 4.632 3.667 5.145 3.667 5.145",fill:"#FFC6A0"},null),p("path",{stroke:"#DB836E","stroke-width":"1.145","stroke-linecap":"round","stroke-linejoin":"round",d:"M100.843 77.099l1.701-.928-1.015-4.324.674-1.406"},null),p("path",{d:"M105.546 74.092c-.022.713-.452 1.279-.96 1.263-.51-.016-.904-.607-.882-1.32.021-.713.452-1.278.96-1.263.51.016.904.607.882 1.32M97.592 74.349c-.022.713-.452 1.278-.961 1.263-.509-.016-.904-.607-.882-1.32.022-.713.452-1.279.961-1.263.51.016.904.606.882 1.32",fill:"#552950"},null),p("path",{d:"M91.132 86.786s5.269 4.957 12.679 2.327",stroke:"#DB836E","stroke-width":"1.145","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M99.776 81.903s-3.592.232-1.44-2.79c1.59-1.496 4.897-.46 4.897-.46s1.156 3.906-3.457 3.25",fill:"#DB836E"},null),p("path",{d:"M102.88 70.6s2.483.84 3.402.715M93.883 71.975s2.492-1.144 4.778-1.073",stroke:"#5C2552","stroke-width":"1.526","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M86.32 77.374s.961.879 1.458 2.106c-.377.48-1.033 1.152-.236 1.809M99.337 83.719s1.911.151 2.509-.254",stroke:"#DB836E","stroke-width":"1.145","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M87.782 115.821l15.73-3.012M100.165 115.821l10.04-2.008",stroke:"#E4EBF7","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M66.508 86.763s-1.598 8.83-6.697 14.078",stroke:"#E4EBF7","stroke-width":"1.114","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M128.31 87.934s3.013 4.121 4.06 11.785",stroke:"#E4EBF7","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M64.09 84.816s-6.03 9.912-13.607 9.903",stroke:"#DB836E","stroke-width":".795","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M112.366 65.909l-.142 5.32s5.993 4.472 11.945 9.202c4.482 3.562 8.888 7.455 10.985 8.662 4.804 2.766 8.9 3.355 11.076 1.808 4.071-2.894 4.373-9.878-8.136-15.263-4.271-1.838-16.144-6.36-25.728-9.73",fill:"#FFC6A0"},null),p("path",{d:"M130.532 85.488s4.588 5.757 11.619 6.214",stroke:"#DB836E","stroke-width":".75","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M121.708 105.73s-.393 8.564-1.34 13.612",stroke:"#E4EBF7","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M115.784 161.512s-3.57-1.488-2.678-7.14",stroke:"#648BD8","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M101.52 290.246s4.326 2.057 7.408 1.03c2.842-.948 4.564.673 7.132 1.186 2.57.514 6.925 1.108 11.772-1.269-.104-5.551-6.939-4.01-12.048-6.763-2.582-1.39-3.812-4.757-3.625-8.863h-9.471s-1.402 10.596-1.169 14.68",fill:"#CBD1D1"},null),p("path",{d:"M101.496 290.073s2.447 1.281 6.809.658c3.081-.44 3.74.485 7.479 1.039 3.739.554 10.802-.07 11.91-.9.415 1.108-.347 2.077-.347 2.077s-1.523.608-4.847.831c-2.045.137-5.843.293-7.663-.507-1.8-1.385-5.286-1.917-5.77-.243-3.947.958-7.41-.288-7.41-.288l-.16-2.667z",fill:"#2B0849"},null),p("path",{d:"M108.824 276.19h3.116s-.103 6.751 4.57 8.62c-4.673.624-8.62-2.32-7.686-8.62",fill:"#A4AABA"},null),p("path",{d:"M57.65 272.52s-2.122 7.47-4.518 12.396c-1.811 3.724-4.255 7.548 5.505 7.548 6.698 0 9.02-.483 7.479-6.648-1.541-6.164.268-13.296.268-13.296H57.65z",fill:"#CBD1D1"},null),p("path",{d:"M51.54 290.04s2.111 1.178 6.682 1.178c6.128 0 8.31-1.662 8.31-1.662s.605 1.122-.624 2.18c-1 .862-3.624 1.603-7.444 1.559-4.177-.049-5.876-.57-6.786-1.177-.831-.554-.692-1.593-.138-2.078",fill:"#2B0849"},null),p("path",{d:"M58.533 274.438s.034 1.529-.315 2.95c-.352 1.431-1.087 3.127-1.139 4.17-.058 1.16 4.57 1.592 5.194.035.623-1.559 1.303-6.475 1.927-7.306.622-.831-4.94-2.135-5.667.15",fill:"#A4AABA"},null),p("path",{d:"M100.885 277.015l13.306.092s1.291-54.228 1.843-64.056c.552-9.828 3.756-43.13.997-62.788l-12.48-.64-22.725.776s-.433 3.944-1.19 9.921c-.062.493-.677.838-.744 1.358-.075.582.42 1.347.318 1.956-2.35 14.003-6.343 32.926-8.697 46.425-.116.663-1.227 1.004-1.45 2.677-.04.3.21 1.516.112 1.785-6.836 18.643-10.89 47.584-14.2 61.551l14.528-.014s2.185-8.524 4.008-16.878c2.796-12.817 22.987-84.553 22.987-84.553l3-.517 1.037 46.1s-.223 1.228.334 2.008c.558.782-.556 1.117-.39 2.233l.39 1.784s-.446 7.14-.892 11.826c-.446 4.685-.092 38.954-.092 38.954",fill:"#7BB2F9"},null),p("path",{d:"M77.438 220.434c1.146.094 4.016-2.008 6.916-4.91M107.55 223.931s2.758-1.103 6.069-3.862",stroke:"#648BD8","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M108.459 220.905s2.759-1.104 6.07-3.863",stroke:"#648BD8","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M76.099 223.557s2.608-.587 6.47-3.346M87.33 150.82c-.27 3.088.297 8.478-4.315 9.073M104.829 149.075s.11 13.936-1.286 14.983c-2.207 1.655-2.975 1.934-2.975 1.934M101.014 149.63s.035 12.81-1.19 24.245M94.93 174.965s7.174-1.655 9.38-1.655M75.671 204.754c-.316 1.55-.64 3.067-.973 4.535 0 0-1.45 1.822-1.003 3.756.446 1.934-.943 2.034-4.96 15.273-1.686 5.559-4.464 18.49-6.313 27.447-.078.38-4.018 18.06-4.093 18.423M77.043 196.743a313.269 313.269 0 0 1-.877 4.729M83.908 151.414l-1.19 10.413s-1.091.148-.496 2.23c.111 1.34-2.66 15.692-5.153 30.267M57.58 272.94h13.238",stroke:"#648BD8","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null),p("path",{d:"M117.377 147.423s-16.955-3.087-35.7.199c.157 2.501-.002 4.128-.002 4.128s14.607-2.802 35.476-.31c.251-2.342.226-4.017.226-4.017",fill:"#192064"},null),p("path",{d:"M107.511 150.353l.004-4.885a.807.807 0 0 0-.774-.81c-2.428-.092-5.04-.108-7.795-.014a.814.814 0 0 0-.784.81l-.003 4.88c0 .456.371.82.827.808a140.76 140.76 0 0 1 7.688.017.81.81 0 0 0 .837-.806",fill:"#FFF"},null),p("path",{d:"M106.402 149.426l.002-3.06a.64.64 0 0 0-.616-.643 94.135 94.135 0 0 0-5.834-.009.647.647 0 0 0-.626.643l-.001 3.056c0 .36.291.648.651.64 1.78-.04 3.708-.041 5.762.012.36.009.662-.279.662-.64",fill:"#192064"},null),p("path",{d:"M101.485 273.933h12.272M102.652 269.075c.006 3.368.04 5.759.11 6.47M102.667 263.125c-.009 1.53-.015 2.98-.016 4.313M102.204 174.024l.893 44.402s.669 1.561-.224 2.677c-.892 1.116 2.455.67.893 2.231-1.562 1.562.893 1.116 0 3.347-.592 1.48-.988 20.987-1.09 34.956",stroke:"#648BD8","stroke-width":"1.051","stroke-linecap":"round","stroke-linejoin":"round"},null)])]),_le=e=>{const{componentCls:t,lineHeightHeading3:n,iconCls:o,padding:r,paddingXL:i,paddingXS:l,paddingLG:a,marginXS:s,lineHeight:c}=e;return{[t]:{padding:`${a*2}px ${i}px`,"&-rtl":{direction:"rtl"}},[`${t} ${t}-image`]:{width:e.imageWidth,height:e.imageHeight,margin:"auto"},[`${t} ${t}-icon`]:{marginBottom:a,textAlign:"center",[`& > ${o}`]:{fontSize:e.resultIconFontSize}},[`${t} ${t}-title`]:{color:e.colorTextHeading,fontSize:e.resultTitleFontSize,lineHeight:n,marginBlock:s,textAlign:"center"},[`${t} ${t}-subtitle`]:{color:e.colorTextDescription,fontSize:e.resultSubtitleFontSize,lineHeight:c,textAlign:"center"},[`${t} ${t}-content`]:{marginTop:a,padding:`${a}px ${r*2.5}px`,backgroundColor:e.colorFillAlter},[`${t} ${t}-extra`]:{margin:e.resultExtraMargin,textAlign:"center","& > *":{marginInlineEnd:l,"&:last-child":{marginInlineEnd:0}}}}},Mle=e=>{const{componentCls:t,iconCls:n}=e;return{[`${t}-success ${t}-icon > ${n}`]:{color:e.resultSuccessIconColor},[`${t}-error ${t}-icon > ${n}`]:{color:e.resultErrorIconColor},[`${t}-info ${t}-icon > ${n}`]:{color:e.resultInfoIconColor},[`${t}-warning ${t}-icon > ${n}`]:{color:e.resultWarningIconColor}}},Ale=e=>[_le(e),Mle(e)],Rle=e=>Ale(e),Dle=Ue("Result",e=>{const{paddingLG:t,fontSizeHeading3:n}=e,o=e.fontSize,r=`${t}px 0 0 0`,i=e.colorInfo,l=e.colorError,a=e.colorSuccess,s=e.colorWarning,c=ze(e,{resultTitleFontSize:n,resultSubtitleFontSize:o,resultIconFontSize:n*3,resultExtraMargin:r,resultInfoIconColor:i,resultErrorIconColor:l,resultSuccessIconColor:a,resultWarningIconColor:s});return[Rle(c)]},{imageWidth:250,imageHeight:295}),Ble={success:pr,error:Wn,info:hr,warning:cS},vu={404:Ile,500:Tle,403:Ele},Nle=Object.keys(vu),kle=()=>({prefixCls:String,icon:K.any,status:{type:[Number,String],default:"info"},title:K.any,subTitle:K.any,extra:K.any}),Fle=(e,t)=>{let{status:n,icon:o}=t;if(Nle.includes(`${n}`)){const l=vu[n];return p("div",{class:`${e}-icon ${e}-image`},[p(l,null,null)])}const r=Ble[n],i=o||p(r,null,null);return p("div",{class:`${e}-icon`},[i])},Lle=(e,t)=>t&&p("div",{class:`${e}-extra`},[t]),Al=re({compatConfig:{MODE:3},name:"AResult",inheritAttrs:!1,props:kle(),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("result",e),[l,a]=Dle(r),s=P(()=>le(r.value,a.value,`${r.value}-${e.status}`,{[`${r.value}-rtl`]:i.value==="rtl"}));return()=>{var c,u,d,f,h,v,g,b;const y=(c=e.title)!==null&&c!==void 0?c:(u=n.title)===null||u===void 0?void 0:u.call(n),S=(d=e.subTitle)!==null&&d!==void 0?d:(f=n.subTitle)===null||f===void 0?void 0:f.call(n),$=(h=e.icon)!==null&&h!==void 0?h:(v=n.icon)===null||v===void 0?void 0:v.call(n),w=(g=e.extra)!==null&&g!==void 0?g:(b=n.extra)===null||b===void 0?void 0:b.call(n),C=r.value;return l(p("div",B(B({},o),{},{class:[s.value,o.class]}),[Fle(C,{status:e.status,icon:$}),p("div",{class:`${C}-title`},[y]),S&&p("div",{class:`${C}-subtitle`},[S]),Lle(C,w),n.default&&p("div",{class:`${C}-content`},[n.default()])]))}}});Al.PRESENTED_IMAGE_403=vu[403];Al.PRESENTED_IMAGE_404=vu[404];Al.PRESENTED_IMAGE_500=vu[500];Al.install=function(e){return e.component(Al.name,Al),e};const zle=Bt(D1),uS=(e,t)=>{let{attrs:n}=t;const{included:o,vertical:r,style:i,class:l}=n;let{length:a,offset:s,reverse:c}=n;a<0&&(c=!c,a=Math.abs(a),s=100-s);const u=r?{[c?"top":"bottom"]:`${s}%`,[c?"bottom":"top"]:"auto",height:`${a}%`}:{[c?"right":"left"]:`${s}%`,[c?"left":"right"]:"auto",width:`${a}%`},d=m(m({},i),u);return o?p("div",{class:l,style:d},null):null};uS.inheritAttrs=!1;const Hle=(e,t,n,o,r,i)=>{const l=Object.keys(t).map(parseFloat).sort((a,s)=>a-s);if(n&&o)for(let a=r;a<=i;a+=o)l.indexOf(a)===-1&&l.push(a);return l},a7=(e,t)=>{let{attrs:n}=t;const{prefixCls:o,vertical:r,reverse:i,marks:l,dots:a,step:s,included:c,lowerBound:u,upperBound:d,max:f,min:h,dotStyle:v,activeDotStyle:g}=n,b=f-h,y=Hle(r,l,a,s,h,f).map(S=>{const $=`${Math.abs(S-h)/b*100}%`,w=!c&&S===d||c&&S<=d&&S>=u;let C=r?m(m({},v),{[i?"top":"bottom"]:$}):m(m({},v),{[i?"right":"left"]:$});w&&(C=m(m({},C),g));const O=le({[`${o}-dot`]:!0,[`${o}-dot-active`]:w,[`${o}-dot-reverse`]:i});return p("span",{class:O,style:C,key:S},null)});return p("div",{class:`${o}-step`},[y])};a7.inheritAttrs=!1;const s7=(e,t)=>{let{attrs:n,slots:o}=t;const{class:r,vertical:i,reverse:l,marks:a,included:s,upperBound:c,lowerBound:u,max:d,min:f,onClickLabel:h}=n,v=Object.keys(a),g=o.mark,b=d-f,y=v.map(parseFloat).sort((S,$)=>S-$).map(S=>{const $=typeof a[S]=="function"?a[S]():a[S],w=typeof $=="object"&&!qt($);let C=w?$.label:$;if(!C&&C!==0)return null;g&&(C=g({point:S,label:C}));const O=!s&&S===c||s&&S<=c&&S>=u,x=le({[`${r}-text`]:!0,[`${r}-text-active`]:O}),I={marginBottom:"-50%",[l?"top":"bottom"]:`${(S-f)/b*100}%`},T={transform:`translateX(${l?"50%":"-50%"})`,msTransform:`translateX(${l?"50%":"-50%"})`,[l?"right":"left"]:`${(S-f)/b*100}%`},M=i?I:T,E=w?m(m({},M),$.style):M,A={[on?"onTouchstartPassive":"onTouchstart"]:R=>h(R,S)};return p("span",B({class:x,style:E,key:S,onMousedown:R=>h(R,S)},A),[C])});return p("div",{class:r},[y])};s7.inheritAttrs=!1;const c7=re({compatConfig:{MODE:3},name:"Handle",inheritAttrs:!1,props:{prefixCls:String,vertical:{type:Boolean,default:void 0},offset:Number,disabled:{type:Boolean,default:void 0},min:Number,max:Number,value:Number,tabindex:K.oneOfType([K.number,K.string]),reverse:{type:Boolean,default:void 0},ariaLabel:String,ariaLabelledBy:String,ariaValueTextFormatter:Function,onMouseenter:{type:Function},onMouseleave:{type:Function},onMousedown:{type:Function}},setup(e,t){let{attrs:n,emit:o,expose:r}=t;const i=oe(!1),l=oe(),a=()=>{document.activeElement===l.value&&(i.value=!0)},s=b=>{i.value=!1,o("blur",b)},c=()=>{i.value=!1},u=()=>{var b;(b=l.value)===null||b===void 0||b.focus()},d=()=>{var b;(b=l.value)===null||b===void 0||b.blur()},f=()=>{i.value=!0,u()},h=b=>{b.preventDefault(),u(),o("mousedown",b)};r({focus:u,blur:d,clickFocus:f,ref:l});let v=null;Ke(()=>{v=Nt(document,"mouseup",a)}),et(()=>{v==null||v.remove()});const g=P(()=>{const{vertical:b,offset:y,reverse:S}=e;return b?{[S?"top":"bottom"]:`${y}%`,[S?"bottom":"top"]:"auto",transform:S?null:"translateY(+50%)"}:{[S?"right":"left"]:`${y}%`,[S?"left":"right"]:"auto",transform:`translateX(${S?"+":"-"}50%)`}});return()=>{const{prefixCls:b,disabled:y,min:S,max:$,value:w,tabindex:C,ariaLabel:O,ariaLabelledBy:x,ariaValueTextFormatter:I,onMouseenter:T,onMouseleave:M}=e,E=le(n.class,{[`${b}-handle-click-focused`]:i.value}),A={"aria-valuemin":S,"aria-valuemax":$,"aria-valuenow":w,"aria-disabled":!!y},R=[n.style,g.value];let z=C||0;(y||C===null)&&(z=null);let _;I&&(_=I(w));const D=m(m(m(m({},n),{role:"slider",tabindex:z}),A),{class:E,onBlur:s,onKeydown:c,onMousedown:h,onMouseenter:T,onMouseleave:M,ref:l,style:R});return p("div",B(B({},D),{},{"aria-label":O,"aria-labelledby":x,"aria-valuetext":_}),null)}}});function jv(e,t){try{return Object.keys(t).some(n=>e.target===t[n].ref)}catch{return!1}}function u7(e,t){let{min:n,max:o}=t;return eo}function h4(e){return e.touches.length>1||e.type.toLowerCase()==="touchend"&&e.touches.length>0}function g4(e,t){let{marks:n,step:o,min:r,max:i}=t;const l=Object.keys(n).map(parseFloat);if(o!==null){const s=Math.pow(10,d7(o)),c=Math.floor((i*s-r*s)/(o*s)),u=Math.min((e-r)/o,c),d=Math.round(u)*o+r;l.push(d)}const a=l.map(s=>Math.abs(e-s));return l[a.indexOf(Math.min(...a))]}function d7(e){const t=e.toString();let n=0;return t.indexOf(".")>=0&&(n=t.length-t.indexOf(".")-1),n}function v4(e,t){let n=1;return window.visualViewport&&(n=+(window.visualViewport.width/document.body.getBoundingClientRect().width).toFixed(2)),(e?t.clientY:t.pageX)/n}function m4(e,t){let n=1;return window.visualViewport&&(n=+(window.visualViewport.width/document.body.getBoundingClientRect().width).toFixed(2)),(e?t.touches[0].clientY:t.touches[0].pageX)/n}function b4(e,t){const n=t.getBoundingClientRect();return e?n.top+n.height*.5:window.scrollX+n.left+n.width*.5}function dS(e,t){let{max:n,min:o}=t;return e<=o?o:e>=n?n:e}function f7(e,t){const{step:n}=t,o=isFinite(g4(e,t))?g4(e,t):0;return n===null?o:parseFloat(o.toFixed(d7(n)))}function ts(e){e.stopPropagation(),e.preventDefault()}function jle(e,t,n){const o={increase:(l,a)=>l+a,decrease:(l,a)=>l-a},r=o[e](Object.keys(n.marks).indexOf(JSON.stringify(t)),1),i=Object.keys(n.marks)[r];return n.step?o[e](t,n.step):Object.keys(n.marks).length&&n.marks[i]?n.marks[i]:t}function p7(e,t,n){const o="increase",r="decrease";let i=o;switch(e.keyCode){case Ie.UP:i=t&&n?r:o;break;case Ie.RIGHT:i=!t&&n?r:o;break;case Ie.DOWN:i=t&&n?o:r;break;case Ie.LEFT:i=!t&&n?o:r;break;case Ie.END:return(l,a)=>a.max;case Ie.HOME:return(l,a)=>a.min;case Ie.PAGE_UP:return(l,a)=>l+a.step*2;case Ie.PAGE_DOWN:return(l,a)=>l-a.step*2;default:return}return(l,a)=>jle(i,l,a)}var Vle=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{this.document=this.sliderRef&&this.sliderRef.ownerDocument;const{autofocus:n,disabled:o}=this;n&&!o&&this.focus()})},beforeUnmount(){this.$nextTick(()=>{this.removeDocumentEvents()})},methods:{defaultHandle(n){var{index:o,directives:r,className:i,style:l}=n,a=Vle(n,["index","directives","className","style"]);if(delete a.dragging,a.value===null)return null;const s=m(m({},a),{class:i,style:l,key:o});return p(c7,s,null)},onDown(n,o){let r=o;const{draggableTrack:i,vertical:l}=this.$props,{bounds:a}=this.$data,s=i&&this.positionGetValue?this.positionGetValue(r)||[]:[],c=jv(n,this.handlesRefs);if(this.dragTrack=i&&a.length>=2&&!c&&!s.map((u,d)=>{const f=d?!0:u>=a[d];return d===s.length-1?u<=a[d]:f}).some(u=>!u),this.dragTrack)this.dragOffset=r,this.startBounds=[...a];else{if(!c)this.dragOffset=0;else{const u=b4(l,n.target);this.dragOffset=r-u,r=u}this.onStart(r)}},onMouseDown(n){if(n.button!==0)return;this.removeDocumentEvents();const o=this.$props.vertical,r=v4(o,n);this.onDown(n,r),this.addDocumentMouseEvents()},onTouchStart(n){if(h4(n))return;const o=this.vertical,r=m4(o,n);this.onDown(n,r),this.addDocumentTouchEvents(),ts(n)},onFocus(n){const{vertical:o}=this;if(jv(n,this.handlesRefs)&&!this.dragTrack){const r=b4(o,n.target);this.dragOffset=0,this.onStart(r),ts(n),this.$emit("focus",n)}},onBlur(n){this.dragTrack||this.onEnd(),this.$emit("blur",n)},onMouseUp(){this.handlesRefs[this.prevMovedHandleIndex]&&this.handlesRefs[this.prevMovedHandleIndex].clickFocus()},onMouseMove(n){if(!this.sliderRef){this.onEnd();return}const o=v4(this.vertical,n);this.onMove(n,o-this.dragOffset,this.dragTrack,this.startBounds)},onTouchMove(n){if(h4(n)||!this.sliderRef){this.onEnd();return}const o=m4(this.vertical,n);this.onMove(n,o-this.dragOffset,this.dragTrack,this.startBounds)},onKeyDown(n){this.sliderRef&&jv(n,this.handlesRefs)&&this.onKeyboard(n)},onClickMarkLabel(n,o){n.stopPropagation(),this.onChange({sValue:o}),this.setState({sValue:o},()=>this.onEnd(!0))},getSliderStart(){const n=this.sliderRef,{vertical:o,reverse:r}=this,i=n.getBoundingClientRect();return o?r?i.bottom:i.top:window.scrollX+(r?i.right:i.left)},getSliderLength(){const n=this.sliderRef;if(!n)return 0;const o=n.getBoundingClientRect();return this.vertical?o.height:o.width},addDocumentTouchEvents(){this.onTouchMoveListener=Nt(this.document,"touchmove",this.onTouchMove),this.onTouchUpListener=Nt(this.document,"touchend",this.onEnd)},addDocumentMouseEvents(){this.onMouseMoveListener=Nt(this.document,"mousemove",this.onMouseMove),this.onMouseUpListener=Nt(this.document,"mouseup",this.onEnd)},removeDocumentEvents(){this.onTouchMoveListener&&this.onTouchMoveListener.remove(),this.onTouchUpListener&&this.onTouchUpListener.remove(),this.onMouseMoveListener&&this.onMouseMoveListener.remove(),this.onMouseUpListener&&this.onMouseUpListener.remove()},focus(){var n;this.$props.disabled||(n=this.handlesRefs[0])===null||n===void 0||n.focus()},blur(){this.$props.disabled||Object.keys(this.handlesRefs).forEach(n=>{var o,r;(r=(o=this.handlesRefs[n])===null||o===void 0?void 0:o.blur)===null||r===void 0||r.call(o)})},calcValue(n){const{vertical:o,min:r,max:i}=this,l=Math.abs(Math.max(n,0)/this.getSliderLength());return o?(1-l)*(i-r)+r:l*(i-r)+r},calcValueByPos(n){const r=(this.reverse?-1:1)*(n-this.getSliderStart());return this.trimAlignValue(this.calcValue(r))},calcOffset(n){const{min:o,max:r}=this,i=(n-o)/(r-o);return Math.max(0,i*100)},saveSlider(n){this.sliderRef=n},saveHandle(n,o){this.handlesRefs[n]=o}},render(){const{prefixCls:n,marks:o,dots:r,step:i,included:l,disabled:a,vertical:s,reverse:c,min:u,max:d,maximumTrackStyle:f,railStyle:h,dotStyle:v,activeDotStyle:g,id:b}=this,{class:y,style:S}=this.$attrs,{tracks:$,handles:w}=this.renderSlider(),C=le(n,y,{[`${n}-with-marks`]:Object.keys(o).length,[`${n}-disabled`]:a,[`${n}-vertical`]:s,[`${n}-horizontal`]:!s}),O={vertical:s,marks:o,included:l,lowerBound:this.getLowerBound(),upperBound:this.getUpperBound(),max:d,min:u,reverse:c,class:`${n}-mark`,onClickLabel:a?cl:this.onClickMarkLabel},x={[on?"onTouchstartPassive":"onTouchstart"]:a?cl:this.onTouchStart};return p("div",B(B({id:b,ref:this.saveSlider,tabindex:"-1",class:C},x),{},{onMousedown:a?cl:this.onMouseDown,onMouseup:a?cl:this.onMouseUp,onKeydown:a?cl:this.onKeyDown,onFocus:a?cl:this.onFocus,onBlur:a?cl:this.onBlur,style:S}),[p("div",{class:`${n}-rail`,style:m(m({},f),h)},null),$,p(a7,{prefixCls:n,vertical:s,reverse:c,marks:o,dots:r,step:i,included:l,lowerBound:this.getLowerBound(),upperBound:this.getUpperBound(),max:d,min:u,dotStyle:v,activeDotStyle:g},null),w,p(s7,O,{mark:this.$slots.mark}),Hp(this)])}})}const Wle=re({compatConfig:{MODE:3},name:"Slider",mixins:[Yl],inheritAttrs:!1,props:{defaultValue:Number,value:Number,disabled:{type:Boolean,default:void 0},autofocus:{type:Boolean,default:void 0},tabindex:K.oneOfType([K.number,K.string]),reverse:{type:Boolean,default:void 0},min:Number,max:Number,ariaLabelForHandle:String,ariaLabelledByForHandle:String,ariaValueTextFormatterForHandle:String,startPoint:Number},emits:["beforeChange","afterChange","change"],data(){const e=this.defaultValue!==void 0?this.defaultValue:this.min,t=this.value!==void 0?this.value:e;return{sValue:this.trimAlignValue(t),dragging:!1}},watch:{value:{handler(e){this.setChangeValue(e)},deep:!0},min(){const{sValue:e}=this;this.setChangeValue(e)},max(){const{sValue:e}=this;this.setChangeValue(e)}},methods:{setChangeValue(e){const t=e!==void 0?e:this.sValue,n=this.trimAlignValue(t,this.$props);n!==this.sValue&&(this.setState({sValue:n}),u7(t,this.$props)&&this.$emit("change",n))},onChange(e){const t=!Xr(this,"value"),n=e.sValue>this.max?m(m({},e),{sValue:this.max}):e;t&&this.setState(n);const o=n.sValue;this.$emit("change",o)},onStart(e){this.setState({dragging:!0});const{sValue:t}=this;this.$emit("beforeChange",t);const n=this.calcValueByPos(e);this.startValue=n,this.startPosition=e,n!==t&&(this.prevMovedHandleIndex=0,this.onChange({sValue:n}))},onEnd(e){const{dragging:t}=this;this.removeDocumentEvents(),(t||e)&&this.$emit("afterChange",this.sValue),this.setState({dragging:!1})},onMove(e,t){ts(e);const{sValue:n}=this,o=this.calcValueByPos(t);o!==n&&this.onChange({sValue:o})},onKeyboard(e){const{reverse:t,vertical:n}=this.$props,o=p7(e,n,t);if(o){ts(e);const{sValue:r}=this,i=o(r,this.$props),l=this.trimAlignValue(i);if(l===r)return;this.onChange({sValue:l}),this.$emit("afterChange",l),this.onEnd()}},getLowerBound(){const e=this.$props.startPoint||this.$props.min;return this.$data.sValue>e?e:this.$data.sValue},getUpperBound(){return this.$data.sValue1&&arguments[1]!==void 0?arguments[1]:{};if(e===null)return null;const n=m(m({},this.$props),t),o=dS(e,n);return f7(o,n)},getTrack(e){let{prefixCls:t,reverse:n,vertical:o,included:r,minimumTrackStyle:i,mergedTrackStyle:l,length:a,offset:s}=e;return p(uS,{class:`${t}-track`,vertical:o,included:r,offset:s,reverse:n,length:a,style:m(m({},i),l)},null)},renderSlider(){const{prefixCls:e,vertical:t,included:n,disabled:o,minimumTrackStyle:r,trackStyle:i,handleStyle:l,tabindex:a,ariaLabelForHandle:s,ariaLabelledByForHandle:c,ariaValueTextFormatterForHandle:u,min:d,max:f,startPoint:h,reverse:v,handle:g,defaultHandle:b}=this,y=g||b,{sValue:S,dragging:$}=this,w=this.calcOffset(S),C=y({class:`${e}-handle`,prefixCls:e,vertical:t,offset:w,value:S,dragging:$,disabled:o,min:d,max:f,reverse:v,index:0,tabindex:a,ariaLabel:s,ariaLabelledBy:c,ariaValueTextFormatter:u,style:l[0]||l,ref:I=>this.saveHandle(0,I),onFocus:this.onFocus,onBlur:this.onBlur}),O=h!==void 0?this.calcOffset(h):0,x=i[0]||i;return{tracks:this.getTrack({prefixCls:e,reverse:v,vertical:t,included:n,offset:O,minimumTrackStyle:r,mergedTrackStyle:x,length:w-O}),handles:C}}}}),Kle=h7(Wle),Ds=e=>{let{value:t,handle:n,bounds:o,props:r}=e;const{allowCross:i,pushable:l}=r,a=Number(l),s=dS(t,r);let c=s;return!i&&n!=null&&o!==void 0&&(n>0&&s<=o[n-1]+a&&(c=o[n-1]+a),n=o[n+1]-a&&(c=o[n+1]-a)),f7(c,r)},Gle={defaultValue:K.arrayOf(K.number),value:K.arrayOf(K.number),count:Number,pushable:SP(K.oneOfType([K.looseBool,K.number])),allowCross:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},reverse:{type:Boolean,default:void 0},tabindex:K.arrayOf(K.number),prefixCls:String,min:Number,max:Number,autofocus:{type:Boolean,default:void 0},ariaLabelGroupForHandles:Array,ariaLabelledByGroupForHandles:Array,ariaValueTextFormatterGroupForHandles:Array,draggableTrack:{type:Boolean,default:void 0}},Ule=re({compatConfig:{MODE:3},name:"Range",mixins:[Yl],inheritAttrs:!1,props:Qe(Gle,{count:1,allowCross:!0,pushable:!1,tabindex:[],draggableTrack:!1,ariaLabelGroupForHandles:[],ariaLabelledByGroupForHandles:[],ariaValueTextFormatterGroupForHandles:[]}),emits:["beforeChange","afterChange","change"],displayName:"Range",data(){const{count:e,min:t,max:n}=this,o=Array(...Array(e+1)).map(()=>t),r=Xr(this,"defaultValue")?this.defaultValue:o;let{value:i}=this;i===void 0&&(i=r);const l=i.map((s,c)=>Ds({value:s,handle:c,props:this.$props}));return{sHandle:null,recent:l[0]===n?0:l.length-1,bounds:l}},watch:{value:{handler(e){const{bounds:t}=this;this.setChangeValue(e||t)},deep:!0},min(){const{value:e}=this;this.setChangeValue(e||this.bounds)},max(){const{value:e}=this;this.setChangeValue(e||this.bounds)}},methods:{setChangeValue(e){const{bounds:t}=this;let n=e.map((o,r)=>Ds({value:o,handle:r,bounds:t,props:this.$props}));if(t.length===n.length){if(n.every((o,r)=>o===t[r]))return null}else n=e.map((o,r)=>Ds({value:o,handle:r,props:this.$props}));if(this.setState({bounds:n}),e.some(o=>u7(o,this.$props))){const o=e.map(r=>dS(r,this.$props));this.$emit("change",o)}},onChange(e){if(!Xr(this,"value"))this.setState(e);else{const r={};["sHandle","recent"].forEach(i=>{e[i]!==void 0&&(r[i]=e[i])}),Object.keys(r).length&&this.setState(r)}const o=m(m({},this.$data),e).bounds;this.$emit("change",o)},positionGetValue(e){const t=this.getValue(),n=this.calcValueByPos(e),o=this.getClosestBound(n),r=this.getBoundNeedMoving(n,o),i=t[r];if(n===i)return null;const l=[...t];return l[r]=n,l},onStart(e){const{bounds:t}=this;this.$emit("beforeChange",t);const n=this.calcValueByPos(e);this.startValue=n,this.startPosition=e;const o=this.getClosestBound(n);this.prevMovedHandleIndex=this.getBoundNeedMoving(n,o),this.setState({sHandle:this.prevMovedHandleIndex,recent:this.prevMovedHandleIndex});const r=t[this.prevMovedHandleIndex];if(n===r)return;const i=[...t];i[this.prevMovedHandleIndex]=n,this.onChange({bounds:i})},onEnd(e){const{sHandle:t}=this;this.removeDocumentEvents(),t||(this.dragTrack=!1),(t!==null||e)&&this.$emit("afterChange",this.bounds),this.setState({sHandle:null})},onMove(e,t,n,o){ts(e);const{$data:r,$props:i}=this,l=i.max||100,a=i.min||0;if(n){let f=i.vertical?-t:t;f=i.reverse?-f:f;const h=l-Math.max(...o),v=a-Math.min(...o),g=Math.min(Math.max(f/(this.getSliderLength()/100),v),h),b=o.map(y=>Math.floor(Math.max(Math.min(y+g,l),a)));r.bounds.map((y,S)=>y===b[S]).some(y=>!y)&&this.onChange({bounds:b});return}const{bounds:s,sHandle:c}=this,u=this.calcValueByPos(t),d=s[c];u!==d&&this.moveTo(u)},onKeyboard(e){const{reverse:t,vertical:n}=this.$props,o=p7(e,n,t);if(o){ts(e);const{bounds:r,sHandle:i}=this,l=r[i===null?this.recent:i],a=o(l,this.$props),s=Ds({value:a,handle:i,bounds:r,props:this.$props});if(s===l)return;this.moveTo(s,!0)}},getClosestBound(e){const{bounds:t}=this;let n=0;for(let o=1;o=t[o]&&(n=o);return Math.abs(t[n+1]-e)a-s),this.internalPointsCache={marks:e,step:t,points:l}}return this.internalPointsCache.points},moveTo(e,t){const n=[...this.bounds],{sHandle:o,recent:r}=this,i=o===null?r:o;n[i]=e;let l=i;this.$props.pushable!==!1?this.pushSurroundingHandles(n,l):this.$props.allowCross&&(n.sort((a,s)=>a-s),l=n.indexOf(e)),this.onChange({recent:l,sHandle:l,bounds:n}),t&&(this.$emit("afterChange",n),this.setState({},()=>{this.handlesRefs[l].focus()}),this.onEnd())},pushSurroundingHandles(e,t){const n=e[t],{pushable:o}=this,r=Number(o);let i=0;if(e[t+1]-n=o.length||i<0)return!1;const l=t+n,a=o[i],{pushable:s}=this,c=Number(s),u=n*(e[l]-a);return this.pushHandle(e,l,n,c-u)?(e[t]=a,!0):!1},trimAlignValue(e){const{sHandle:t,bounds:n}=this;return Ds({value:e,handle:t,bounds:n,props:this.$props})},ensureValueNotConflict(e,t,n){let{allowCross:o,pushable:r}=n;const i=this.$data||{},{bounds:l}=i;if(e=e===void 0?i.sHandle:e,r=Number(r),!o&&e!=null&&l!==void 0){if(e>0&&t<=l[e-1]+r)return l[e-1]+r;if(e=l[e+1]-r)return l[e+1]-r}return t},getTrack(e){let{bounds:t,prefixCls:n,reverse:o,vertical:r,included:i,offsets:l,trackStyle:a}=e;return t.slice(0,-1).map((s,c)=>{const u=c+1,d=le({[`${n}-track`]:!0,[`${n}-track-${u}`]:!0});return p(uS,{class:d,vertical:r,reverse:o,included:i,offset:l[u-1],length:l[u]-l[u-1],style:a[c],key:u},null)})},renderSlider(){const{sHandle:e,bounds:t,prefixCls:n,vertical:o,included:r,disabled:i,min:l,max:a,reverse:s,handle:c,defaultHandle:u,trackStyle:d,handleStyle:f,tabindex:h,ariaLabelGroupForHandles:v,ariaLabelledByGroupForHandles:g,ariaValueTextFormatterGroupForHandles:b}=this,y=c||u,S=t.map(C=>this.calcOffset(C)),$=`${n}-handle`,w=t.map((C,O)=>{let x=h[O]||0;(i||h[O]===null)&&(x=null);const I=e===O;return y({class:le({[$]:!0,[`${$}-${O+1}`]:!0,[`${$}-dragging`]:I}),prefixCls:n,vertical:o,dragging:I,offset:S[O],value:C,index:O,tabindex:x,min:l,max:a,reverse:s,disabled:i,style:f[O],ref:T=>this.saveHandle(O,T),onFocus:this.onFocus,onBlur:this.onBlur,ariaLabel:v[O],ariaLabelledBy:g[O],ariaValueTextFormatter:b[O]})});return{tracks:this.getTrack({bounds:t,prefixCls:n,reverse:s,vertical:o,included:r,offsets:S,trackStyle:d}),handles:w}}}}),Xle=h7(Ule),Yle=re({compatConfig:{MODE:3},name:"SliderTooltip",inheritAttrs:!1,props:j5(),setup(e,t){let{attrs:n,slots:o}=t;const r=ne(null),i=ne(null);function l(){Ze.cancel(i.value),i.value=null}function a(){i.value=Ze(()=>{var c;(c=r.value)===null||c===void 0||c.forcePopupAlign(),i.value=null})}const s=()=>{l(),e.open&&a()};return ye([()=>e.open,()=>e.title],()=>{s()},{flush:"post",immediate:!0}),Mp(()=>{s()}),et(()=>{l()}),()=>p(co,B(B({ref:r},e),n),o)}}),qle=e=>{const{componentCls:t,controlSize:n,dotSize:o,marginFull:r,marginPart:i,colorFillContentHover:l}=e;return{[t]:m(m({},qe(e)),{position:"relative",height:n,margin:`${i}px ${r}px`,padding:0,cursor:"pointer",touchAction:"none","&-vertical":{margin:`${r}px ${i}px`},[`${t}-rail`]:{position:"absolute",backgroundColor:e.colorFillTertiary,borderRadius:e.borderRadiusXS,transition:`background-color ${e.motionDurationMid}`},[`${t}-track`]:{position:"absolute",backgroundColor:e.colorPrimaryBorder,borderRadius:e.borderRadiusXS,transition:`background-color ${e.motionDurationMid}`},"&:hover":{[`${t}-rail`]:{backgroundColor:e.colorFillSecondary},[`${t}-track`]:{backgroundColor:e.colorPrimaryBorderHover},[`${t}-dot`]:{borderColor:l},[`${t}-handle::after`]:{boxShadow:`0 0 0 ${e.handleLineWidth}px ${e.colorPrimaryBorderHover}`},[`${t}-dot-active`]:{borderColor:e.colorPrimary}},[`${t}-handle`]:{position:"absolute",width:e.handleSize,height:e.handleSize,outline:"none",[`${t}-dragging`]:{zIndex:1},"&::before":{content:'""',position:"absolute",insetInlineStart:-e.handleLineWidth,insetBlockStart:-e.handleLineWidth,width:e.handleSize+e.handleLineWidth*2,height:e.handleSize+e.handleLineWidth*2,backgroundColor:"transparent"},"&::after":{content:'""',position:"absolute",insetBlockStart:0,insetInlineStart:0,width:e.handleSize,height:e.handleSize,backgroundColor:e.colorBgElevated,boxShadow:`0 0 0 ${e.handleLineWidth}px ${e.colorPrimaryBorder}`,borderRadius:"50%",cursor:"pointer",transition:` + inset-inline-start ${e.motionDurationMid}, + inset-block-start ${e.motionDurationMid}, + width ${e.motionDurationMid}, + height ${e.motionDurationMid}, + box-shadow ${e.motionDurationMid} + `},"&:hover, &:active, &:focus":{"&::before":{insetInlineStart:-((e.handleSizeHover-e.handleSize)/2+e.handleLineWidthHover),insetBlockStart:-((e.handleSizeHover-e.handleSize)/2+e.handleLineWidthHover),width:e.handleSizeHover+e.handleLineWidthHover*2,height:e.handleSizeHover+e.handleLineWidthHover*2},"&::after":{boxShadow:`0 0 0 ${e.handleLineWidthHover}px ${e.colorPrimary}`,width:e.handleSizeHover,height:e.handleSizeHover,insetInlineStart:(e.handleSize-e.handleSizeHover)/2,insetBlockStart:(e.handleSize-e.handleSizeHover)/2}}},[`${t}-mark`]:{position:"absolute",fontSize:e.fontSize},[`${t}-mark-text`]:{position:"absolute",display:"inline-block",color:e.colorTextDescription,textAlign:"center",wordBreak:"keep-all",cursor:"pointer",userSelect:"none","&-active":{color:e.colorText}},[`${t}-step`]:{position:"absolute",background:"transparent",pointerEvents:"none"},[`${t}-dot`]:{position:"absolute",width:o,height:o,backgroundColor:e.colorBgElevated,border:`${e.handleLineWidth}px solid ${e.colorBorderSecondary}`,borderRadius:"50%",cursor:"pointer",transition:`border-color ${e.motionDurationSlow}`,"&-active":{borderColor:e.colorPrimaryBorder}},[`&${t}-disabled`]:{cursor:"not-allowed",[`${t}-rail`]:{backgroundColor:`${e.colorFillSecondary} !important`},[`${t}-track`]:{backgroundColor:`${e.colorTextDisabled} !important`},[` + ${t}-dot + `]:{backgroundColor:e.colorBgElevated,borderColor:e.colorTextDisabled,boxShadow:"none",cursor:"not-allowed"},[`${t}-handle::after`]:{backgroundColor:e.colorBgElevated,cursor:"not-allowed",width:e.handleSize,height:e.handleSize,boxShadow:`0 0 0 ${e.handleLineWidth}px ${new vt(e.colorTextDisabled).onBackground(e.colorBgContainer).toHexString()}`,insetInlineStart:0,insetBlockStart:0},[` + ${t}-mark-text, + ${t}-dot + `]:{cursor:"not-allowed !important"}}})}},g7=(e,t)=>{const{componentCls:n,railSize:o,handleSize:r,dotSize:i}=e,l=t?"paddingBlock":"paddingInline",a=t?"width":"height",s=t?"height":"width",c=t?"insetBlockStart":"insetInlineStart",u=t?"top":"insetInlineStart";return{[l]:o,[s]:o*3,[`${n}-rail`]:{[a]:"100%",[s]:o},[`${n}-track`]:{[s]:o},[`${n}-handle`]:{[c]:(o*3-r)/2},[`${n}-mark`]:{insetInlineStart:0,top:0,[u]:r,[a]:"100%"},[`${n}-step`]:{insetInlineStart:0,top:0,[u]:o,[a]:"100%",[s]:o},[`${n}-dot`]:{position:"absolute",[c]:(o-i)/2}}},Jle=e=>{const{componentCls:t,marginPartWithMark:n}=e;return{[`${t}-horizontal`]:m(m({},g7(e,!0)),{[`&${t}-with-marks`]:{marginBottom:n}})}},Zle=e=>{const{componentCls:t}=e;return{[`${t}-vertical`]:m(m({},g7(e,!1)),{height:"100%"})}},Qle=Ue("Slider",e=>{const t=ze(e,{marginPart:(e.controlHeight-e.controlSize)/2,marginFull:e.controlSize/2,marginPartWithMark:e.controlHeightLG-e.controlSize});return[qle(t),Jle(t),Zle(t)]},e=>{const n=e.controlHeightLG/4,o=e.controlHeightSM/2,r=e.lineWidth+1,i=e.lineWidth+1*3;return{controlSize:n,railSize:4,handleSize:n,handleSizeHover:o,dotSize:8,handleLineWidth:r,handleLineWidthHover:i}});var y4=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rtypeof e=="number"?e.toString():"",tae=()=>({id:String,prefixCls:String,tooltipPrefixCls:String,range:He([Boolean,Object]),reverse:$e(),min:Number,max:Number,step:He([Object,Number]),marks:Be(),dots:$e(),value:He([Array,Number]),defaultValue:He([Array,Number]),included:$e(),disabled:$e(),vertical:$e(),tipFormatter:He([Function,Object],()=>eae),tooltipOpen:$e(),tooltipVisible:$e(),tooltipPlacement:Ne(),getTooltipPopupContainer:ve(),autofocus:$e(),handleStyle:He([Array,Object]),trackStyle:He([Array,Object]),onChange:ve(),onAfterChange:ve(),onFocus:ve(),onBlur:ve(),"onUpdate:value":ve()}),nae=re({compatConfig:{MODE:3},name:"ASlider",inheritAttrs:!1,props:tae(),slots:Object,setup(e,t){let{attrs:n,slots:o,emit:r,expose:i}=t;const{prefixCls:l,rootPrefixCls:a,direction:s,getPopupContainer:c,configProvider:u}=Ee("slider",e),[d,f]=Qle(l),h=an(),v=ne(),g=ne({}),b=(x,I)=>{g.value[x]=I},y=P(()=>e.tooltipPlacement?e.tooltipPlacement:e.vertical?s.value==="rtl"?"left":"right":"top"),S=()=>{var x;(x=v.value)===null||x===void 0||x.focus()},$=()=>{var x;(x=v.value)===null||x===void 0||x.blur()},w=x=>{r("update:value",x),r("change",x),h.onFieldChange()},C=x=>{r("blur",x)};i({focus:S,blur:$});const O=x=>{var{tooltipPrefixCls:I}=x,T=x.info,{value:M,dragging:E,index:A}=T,R=y4(T,["value","dragging","index"]);const{tipFormatter:z,tooltipOpen:_=e.tooltipVisible,getTooltipPopupContainer:D}=e,N=z?g.value[A]||E:!1,k=_||_===void 0&&N;return p(Yle,{prefixCls:I,title:z?z(M):"",open:k,placement:y.value,transitionName:`${a.value}-zoom-down`,key:A,overlayClassName:`${l.value}-tooltip`,getPopupContainer:D||(c==null?void 0:c.value)},{default:()=>[p(c7,B(B({},R),{},{value:M,onMouseenter:()=>b(A,!0),onMouseleave:()=>b(A,!1)}),null)]})};return()=>{const{tooltipPrefixCls:x,range:I,id:T=h.id.value}=e,M=y4(e,["tooltipPrefixCls","range","id"]),E=u.getPrefixCls("tooltip",x),A=le(n.class,{[`${l.value}-rtl`]:s.value==="rtl"},f.value);s.value==="rtl"&&!M.vertical&&(M.reverse=!M.reverse);let R;return typeof I=="object"&&(R=I.draggableTrack),d(I?p(Xle,B(B(B({},n),M),{},{step:M.step,draggableTrack:R,class:A,ref:v,handle:z=>O({tooltipPrefixCls:E,prefixCls:l.value,info:z}),prefixCls:l.value,onChange:w,onBlur:C}),{mark:o.mark}):p(Kle,B(B(B({},n),M),{},{id:T,step:M.step,class:A,ref:v,handle:z=>O({tooltipPrefixCls:E,prefixCls:l.value,info:z}),prefixCls:l.value,onChange:w,onBlur:C}),{mark:o.mark}))}}}),oae=Bt(nae);function S4(e){return typeof e=="string"}function rae(){}const v7=()=>({prefixCls:String,itemWidth:String,active:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},status:Ne(),iconPrefix:String,icon:K.any,adjustMarginRight:String,stepNumber:Number,stepIndex:Number,description:K.any,title:K.any,subTitle:K.any,progressDot:SP(K.oneOfType([K.looseBool,K.func])),tailContent:K.any,icons:K.shape({finish:K.any,error:K.any}).loose,onClick:ve(),onStepClick:ve(),stepIcon:ve(),itemRender:ve(),__legacy:$e()}),m7=re({compatConfig:{MODE:3},name:"Step",inheritAttrs:!1,props:v7(),setup(e,t){let{slots:n,emit:o,attrs:r}=t;const i=a=>{o("click",a),o("stepClick",e.stepIndex)},l=a=>{let{icon:s,title:c,description:u}=a;const{prefixCls:d,stepNumber:f,status:h,iconPrefix:v,icons:g,progressDot:b=n.progressDot,stepIcon:y=n.stepIcon}=e;let S;const $=le(`${d}-icon`,`${v}icon`,{[`${v}icon-${s}`]:s&&S4(s),[`${v}icon-check`]:!s&&h==="finish"&&(g&&!g.finish||!g),[`${v}icon-cross`]:!s&&h==="error"&&(g&&!g.error||!g)}),w=p("span",{class:`${d}-icon-dot`},null);return b?typeof b=="function"?S=p("span",{class:`${d}-icon`},[b({iconDot:w,index:f-1,status:h,title:c,description:u,prefixCls:d})]):S=p("span",{class:`${d}-icon`},[w]):s&&!S4(s)?S=p("span",{class:`${d}-icon`},[s]):g&&g.finish&&h==="finish"?S=p("span",{class:`${d}-icon`},[g.finish]):g&&g.error&&h==="error"?S=p("span",{class:`${d}-icon`},[g.error]):s||h==="finish"||h==="error"?S=p("span",{class:$},null):S=p("span",{class:`${d}-icon`},[f]),y&&(S=y({index:f-1,status:h,title:c,description:u,node:S})),S};return()=>{var a,s,c,u;const{prefixCls:d,itemWidth:f,active:h,status:v="wait",tailContent:g,adjustMarginRight:b,disabled:y,title:S=(a=n.title)===null||a===void 0?void 0:a.call(n),description:$=(s=n.description)===null||s===void 0?void 0:s.call(n),subTitle:w=(c=n.subTitle)===null||c===void 0?void 0:c.call(n),icon:C=(u=n.icon)===null||u===void 0?void 0:u.call(n),onClick:O,onStepClick:x}=e,I=v||"wait",T=le(`${d}-item`,`${d}-item-${I}`,{[`${d}-item-custom`]:C,[`${d}-item-active`]:h,[`${d}-item-disabled`]:y===!0}),M={};f&&(M.width=f),b&&(M.marginRight=b);const E={onClick:O||rae};x&&!y&&(E.role="button",E.tabindex=0,E.onClick=i);const A=p("div",B(B({},ot(r,["__legacy"])),{},{class:[T,r.class],style:[r.style,M]}),[p("div",B(B({},E),{},{class:`${d}-item-container`}),[p("div",{class:`${d}-item-tail`},[g]),p("div",{class:`${d}-item-icon`},[l({icon:C,title:S,description:$})]),p("div",{class:`${d}-item-content`},[p("div",{class:`${d}-item-title`},[S,w&&p("div",{title:typeof w=="string"?w:void 0,class:`${d}-item-subtitle`},[w])]),$&&p("div",{class:`${d}-item-description`},[$])])])]);return e.itemRender?e.itemRender(A):A}}});var iae=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r[]),icons:K.shape({finish:K.any,error:K.any}).loose,stepIcon:ve(),isInline:K.looseBool,itemRender:ve()},emits:["change"],setup(e,t){let{slots:n,emit:o}=t;const r=a=>{const{current:s}=e;s!==a&&o("change",a)},i=(a,s,c)=>{const{prefixCls:u,iconPrefix:d,status:f,current:h,initial:v,icons:g,stepIcon:b=n.stepIcon,isInline:y,itemRender:S,progressDot:$=n.progressDot}=e,w=y||$,C=m(m({},a),{class:""}),O=v+s,x={active:O===h,stepNumber:O+1,stepIndex:O,key:O,prefixCls:u,iconPrefix:d,progressDot:w,stepIcon:b,icons:g,onStepClick:r};return f==="error"&&s===h-1&&(C.class=`${u}-next-error`),C.status||(O===h?C.status=f:OS(C,I)),p(m7,B(B(B({},C),x),{},{__legacy:!1}),null))},l=(a,s)=>i(m({},a.props),s,c=>pt(a,c));return()=>{var a;const{prefixCls:s,direction:c,type:u,labelPlacement:d,iconPrefix:f,status:h,size:v,current:g,progressDot:b=n.progressDot,initial:y,icons:S,items:$,isInline:w,itemRender:C}=e,O=iae(e,["prefixCls","direction","type","labelPlacement","iconPrefix","status","size","current","progressDot","initial","icons","items","isInline","itemRender"]),x=u==="navigation",I=w||b,T=w?"horizontal":c,M=w?void 0:v,E=I?"vertical":d,A=le(s,`${s}-${c}`,{[`${s}-${M}`]:M,[`${s}-label-${E}`]:T==="horizontal",[`${s}-dot`]:!!I,[`${s}-navigation`]:x,[`${s}-inline`]:w});return p("div",B({class:A},O),[$.filter(R=>R).map((R,z)=>i(R,z)),kt((a=n.default)===null||a===void 0?void 0:a.call(n)).map(l)])}}}),aae=e=>{const{componentCls:t,stepsIconCustomTop:n,stepsIconCustomSize:o,stepsIconCustomFontSize:r}=e;return{[`${t}-item-custom`]:{[`> ${t}-item-container > ${t}-item-icon`]:{height:"auto",background:"none",border:0,[`> ${t}-icon`]:{top:n,width:o,height:o,fontSize:r,lineHeight:`${o}px`}}},[`&:not(${t}-vertical)`]:{[`${t}-item-custom`]:{[`${t}-item-icon`]:{width:"auto",background:"none"}}}}},sae=e=>{const{componentCls:t,stepsIconSize:n,lineHeight:o,stepsSmallIconSize:r}=e;return{[`&${t}-label-vertical`]:{[`${t}-item`]:{overflow:"visible","&-tail":{marginInlineStart:n/2+e.controlHeightLG,padding:`${e.paddingXXS}px ${e.paddingLG}px`},"&-content":{display:"block",width:(n/2+e.controlHeightLG)*2,marginTop:e.marginSM,textAlign:"center"},"&-icon":{display:"inline-block",marginInlineStart:e.controlHeightLG},"&-title":{paddingInlineEnd:0,paddingInlineStart:0,"&::after":{display:"none"}},"&-subtitle":{display:"block",marginBottom:e.marginXXS,marginInlineStart:0,lineHeight:o}},[`&${t}-small:not(${t}-dot)`]:{[`${t}-item`]:{"&-icon":{marginInlineStart:e.controlHeightLG+(n-r)/2}}}}}},cae=e=>{const{componentCls:t,stepsNavContentMaxWidth:n,stepsNavArrowColor:o,stepsNavActiveColor:r,motionDurationSlow:i}=e;return{[`&${t}-navigation`]:{paddingTop:e.paddingSM,[`&${t}-small`]:{[`${t}-item`]:{"&-container":{marginInlineStart:-e.marginSM}}},[`${t}-item`]:{overflow:"visible",textAlign:"center","&-container":{display:"inline-block",height:"100%",marginInlineStart:-e.margin,paddingBottom:e.paddingSM,textAlign:"start",transition:`opacity ${i}`,[`${t}-item-content`]:{maxWidth:n},[`${t}-item-title`]:m(m({maxWidth:"100%",paddingInlineEnd:0},Jt),{"&::after":{display:"none"}})},[`&:not(${t}-item-active)`]:{[`${t}-item-container[role='button']`]:{cursor:"pointer","&:hover":{opacity:.85}}},"&:last-child":{flex:1,"&::after":{display:"none"}},"&::after":{position:"absolute",top:`calc(50% - ${e.paddingSM/2}px)`,insetInlineStart:"100%",display:"inline-block",width:e.fontSizeIcon,height:e.fontSizeIcon,borderTop:`${e.lineWidth}px ${e.lineType} ${o}`,borderBottom:"none",borderInlineStart:"none",borderInlineEnd:`${e.lineWidth}px ${e.lineType} ${o}`,transform:"translateY(-50%) translateX(-50%) rotate(45deg)",content:'""'},"&::before":{position:"absolute",bottom:0,insetInlineStart:"50%",display:"inline-block",width:0,height:e.lineWidthBold,backgroundColor:r,transition:`width ${i}, inset-inline-start ${i}`,transitionTimingFunction:"ease-out",content:'""'}},[`${t}-item${t}-item-active::before`]:{insetInlineStart:0,width:"100%"}},[`&${t}-navigation${t}-vertical`]:{[`> ${t}-item`]:{marginInlineEnd:0,"&::before":{display:"none"},[`&${t}-item-active::before`]:{top:0,insetInlineEnd:0,insetInlineStart:"unset",display:"block",width:e.lineWidth*3,height:`calc(100% - ${e.marginLG}px)`},"&::after":{position:"relative",insetInlineStart:"50%",display:"block",width:e.controlHeight*.25,height:e.controlHeight*.25,marginBottom:e.marginXS,textAlign:"center",transform:"translateY(-50%) translateX(-50%) rotate(135deg)"},[`> ${t}-item-container > ${t}-item-tail`]:{visibility:"hidden"}}},[`&${t}-navigation${t}-horizontal`]:{[`> ${t}-item > ${t}-item-container > ${t}-item-tail`]:{visibility:"hidden"}}}},uae=e=>{const{antCls:t,componentCls:n}=e;return{[`&${n}-with-progress`]:{[`${n}-item`]:{paddingTop:e.paddingXXS,[`&-process ${n}-item-container ${n}-item-icon ${n}-icon`]:{color:e.processIconColor}},[`&${n}-vertical > ${n}-item `]:{paddingInlineStart:e.paddingXXS,[`> ${n}-item-container > ${n}-item-tail`]:{top:e.marginXXS,insetInlineStart:e.stepsIconSize/2-e.lineWidth+e.paddingXXS}},[`&, &${n}-small`]:{[`&${n}-horizontal ${n}-item:first-child`]:{paddingBottom:e.paddingXXS,paddingInlineStart:e.paddingXXS}},[`&${n}-small${n}-vertical > ${n}-item > ${n}-item-container > ${n}-item-tail`]:{insetInlineStart:e.stepsSmallIconSize/2-e.lineWidth+e.paddingXXS},[`&${n}-label-vertical`]:{[`${n}-item ${n}-item-tail`]:{top:e.margin-2*e.lineWidth}},[`${n}-item-icon`]:{position:"relative",[`${t}-progress`]:{position:"absolute",insetBlockStart:(e.stepsIconSize-e.stepsProgressSize-e.lineWidth*2)/2,insetInlineStart:(e.stepsIconSize-e.stepsProgressSize-e.lineWidth*2)/2}}}}},dae=e=>{const{componentCls:t,descriptionWidth:n,lineHeight:o,stepsCurrentDotSize:r,stepsDotSize:i,motionDurationSlow:l}=e;return{[`&${t}-dot, &${t}-dot${t}-small`]:{[`${t}-item`]:{"&-title":{lineHeight:o},"&-tail":{top:Math.floor((e.stepsDotSize-e.lineWidth*3)/2),width:"100%",marginTop:0,marginBottom:0,marginInline:`${n/2}px 0`,padding:0,"&::after":{width:`calc(100% - ${e.marginSM*2}px)`,height:e.lineWidth*3,marginInlineStart:e.marginSM}},"&-icon":{width:i,height:i,marginInlineStart:(e.descriptionWidth-i)/2,paddingInlineEnd:0,lineHeight:`${i}px`,background:"transparent",border:0,[`${t}-icon-dot`]:{position:"relative",float:"left",width:"100%",height:"100%",borderRadius:100,transition:`all ${l}`,"&::after":{position:"absolute",top:-e.marginSM,insetInlineStart:(i-e.controlHeightLG*1.5)/2,width:e.controlHeightLG*1.5,height:e.controlHeight,background:"transparent",content:'""'}}},"&-content":{width:n},[`&-process ${t}-item-icon`]:{position:"relative",top:(i-r)/2,width:r,height:r,lineHeight:`${r}px`,background:"none",marginInlineStart:(e.descriptionWidth-r)/2},[`&-process ${t}-icon`]:{[`&:first-child ${t}-icon-dot`]:{insetInlineStart:0}}}},[`&${t}-vertical${t}-dot`]:{[`${t}-item-icon`]:{marginTop:(e.controlHeight-i)/2,marginInlineStart:0,background:"none"},[`${t}-item-process ${t}-item-icon`]:{marginTop:(e.controlHeight-r)/2,top:0,insetInlineStart:(i-r)/2,marginInlineStart:0},[`${t}-item > ${t}-item-container > ${t}-item-tail`]:{top:(e.controlHeight-i)/2,insetInlineStart:0,margin:0,padding:`${i+e.paddingXS}px 0 ${e.paddingXS}px`,"&::after":{marginInlineStart:(i-e.lineWidth)/2}},[`&${t}-small`]:{[`${t}-item-icon`]:{marginTop:(e.controlHeightSM-i)/2},[`${t}-item-process ${t}-item-icon`]:{marginTop:(e.controlHeightSM-r)/2},[`${t}-item > ${t}-item-container > ${t}-item-tail`]:{top:(e.controlHeightSM-i)/2}},[`${t}-item:first-child ${t}-icon-dot`]:{insetInlineStart:0},[`${t}-item-content`]:{width:"inherit"}}}},fae=e=>{const{componentCls:t}=e;return{[`&${t}-rtl`]:{direction:"rtl",[`${t}-item`]:{"&-subtitle":{float:"left"}},[`&${t}-navigation`]:{[`${t}-item::after`]:{transform:"rotate(-45deg)"}},[`&${t}-vertical`]:{[`> ${t}-item`]:{"&::after":{transform:"rotate(225deg)"},[`${t}-item-icon`]:{float:"right"}}},[`&${t}-dot`]:{[`${t}-item-icon ${t}-icon-dot, &${t}-small ${t}-item-icon ${t}-icon-dot`]:{float:"right"}}}}},pae=e=>{const{componentCls:t,stepsSmallIconSize:n,fontSizeSM:o,fontSize:r,colorTextDescription:i}=e;return{[`&${t}-small`]:{[`&${t}-horizontal:not(${t}-label-vertical) ${t}-item`]:{paddingInlineStart:e.paddingSM,"&:first-child":{paddingInlineStart:0}},[`${t}-item-icon`]:{width:n,height:n,marginTop:0,marginBottom:0,marginInline:`0 ${e.marginXS}px`,fontSize:o,lineHeight:`${n}px`,textAlign:"center",borderRadius:n},[`${t}-item-title`]:{paddingInlineEnd:e.paddingSM,fontSize:r,lineHeight:`${n}px`,"&::after":{top:n/2}},[`${t}-item-description`]:{color:i,fontSize:r},[`${t}-item-tail`]:{top:n/2-e.paddingXXS},[`${t}-item-custom ${t}-item-icon`]:{width:"inherit",height:"inherit",lineHeight:"inherit",background:"none",border:0,borderRadius:0,[`> ${t}-icon`]:{fontSize:n,lineHeight:`${n}px`,transform:"none"}}}}},hae=e=>{const{componentCls:t,stepsSmallIconSize:n,stepsIconSize:o}=e;return{[`&${t}-vertical`]:{display:"flex",flexDirection:"column",[`> ${t}-item`]:{display:"block",flex:"1 0 auto",paddingInlineStart:0,overflow:"visible",[`${t}-item-icon`]:{float:"left",marginInlineEnd:e.margin},[`${t}-item-content`]:{display:"block",minHeight:e.controlHeight*1.5,overflow:"hidden"},[`${t}-item-title`]:{lineHeight:`${o}px`},[`${t}-item-description`]:{paddingBottom:e.paddingSM}},[`> ${t}-item > ${t}-item-container > ${t}-item-tail`]:{position:"absolute",top:0,insetInlineStart:e.stepsIconSize/2-e.lineWidth,width:e.lineWidth,height:"100%",padding:`${o+e.marginXXS*1.5}px 0 ${e.marginXXS*1.5}px`,"&::after":{width:e.lineWidth,height:"100%"}},[`> ${t}-item:not(:last-child) > ${t}-item-container > ${t}-item-tail`]:{display:"block"},[` > ${t}-item > ${t}-item-container > ${t}-item-content > ${t}-item-title`]:{"&::after":{display:"none"}},[`&${t}-small ${t}-item-container`]:{[`${t}-item-tail`]:{position:"absolute",top:0,insetInlineStart:e.stepsSmallIconSize/2-e.lineWidth,padding:`${n+e.marginXXS*1.5}px 0 ${e.marginXXS*1.5}px`},[`${t}-item-title`]:{lineHeight:`${n}px`}}}}},gae=e=>{const{componentCls:t,inlineDotSize:n,inlineTitleColor:o,inlineTailColor:r}=e,i=e.paddingXS+e.lineWidth,l={[`${t}-item-container ${t}-item-content ${t}-item-title`]:{color:o}};return{[`&${t}-inline`]:{width:"auto",display:"inline-flex",[`${t}-item`]:{flex:"none","&-container":{padding:`${i}px ${e.paddingXXS}px 0`,margin:`0 ${e.marginXXS/2}px`,borderRadius:e.borderRadiusSM,cursor:"pointer",transition:`background-color ${e.motionDurationMid}`,"&:hover":{background:e.controlItemBgHover},"&[role='button']:hover":{opacity:1}},"&-icon":{width:n,height:n,marginInlineStart:`calc(50% - ${n/2}px)`,[`> ${t}-icon`]:{top:0},[`${t}-icon-dot`]:{borderRadius:e.fontSizeSM/4}},"&-content":{width:"auto",marginTop:e.marginXS-e.lineWidth},"&-title":{color:o,fontSize:e.fontSizeSM,lineHeight:e.lineHeightSM,fontWeight:"normal",marginBottom:e.marginXXS/2},"&-description":{display:"none"},"&-tail":{marginInlineStart:0,top:i+n/2,transform:"translateY(-50%)","&:after":{width:"100%",height:e.lineWidth,borderRadius:0,marginInlineStart:0,background:r}},[`&:first-child ${t}-item-tail`]:{width:"50%",marginInlineStart:"50%"},[`&:last-child ${t}-item-tail`]:{display:"block",width:"50%"},"&-wait":m({[`${t}-item-icon ${t}-icon ${t}-icon-dot`]:{backgroundColor:e.colorBorderBg,border:`${e.lineWidth}px ${e.lineType} ${r}`}},l),"&-finish":m({[`${t}-item-tail::after`]:{backgroundColor:r},[`${t}-item-icon ${t}-icon ${t}-icon-dot`]:{backgroundColor:r,border:`${e.lineWidth}px ${e.lineType} ${r}`}},l),"&-error":l,"&-active, &-process":m({[`${t}-item-icon`]:{width:n,height:n,marginInlineStart:`calc(50% - ${n/2}px)`,top:0}},l),[`&:not(${t}-item-active) > ${t}-item-container[role='button']:hover`]:{[`${t}-item-title`]:{color:o}}}}}};var Pa;(function(e){e.wait="wait",e.process="process",e.finish="finish",e.error="error"})(Pa||(Pa={}));const nd=(e,t)=>{const n=`${t.componentCls}-item`,o=`${e}IconColor`,r=`${e}TitleColor`,i=`${e}DescriptionColor`,l=`${e}TailColor`,a=`${e}IconBgColor`,s=`${e}IconBorderColor`,c=`${e}DotColor`;return{[`${n}-${e} ${n}-icon`]:{backgroundColor:t[a],borderColor:t[s],[`> ${t.componentCls}-icon`]:{color:t[o],[`${t.componentCls}-icon-dot`]:{background:t[c]}}},[`${n}-${e}${n}-custom ${n}-icon`]:{[`> ${t.componentCls}-icon`]:{color:t[c]}},[`${n}-${e} > ${n}-container > ${n}-content > ${n}-title`]:{color:t[r],"&::after":{backgroundColor:t[l]}},[`${n}-${e} > ${n}-container > ${n}-content > ${n}-description`]:{color:t[i]},[`${n}-${e} > ${n}-container > ${n}-tail::after`]:{backgroundColor:t[l]}}},vae=e=>{const{componentCls:t,motionDurationSlow:n}=e,o=`${t}-item`;return m(m(m(m(m(m({[o]:{position:"relative",display:"inline-block",flex:1,overflow:"hidden",verticalAlign:"top","&:last-child":{flex:"none",[`> ${o}-container > ${o}-tail, > ${o}-container > ${o}-content > ${o}-title::after`]:{display:"none"}}},[`${o}-container`]:{outline:"none"},[`${o}-icon, ${o}-content`]:{display:"inline-block",verticalAlign:"top"},[`${o}-icon`]:{width:e.stepsIconSize,height:e.stepsIconSize,marginTop:0,marginBottom:0,marginInlineStart:0,marginInlineEnd:e.marginXS,fontSize:e.stepsIconFontSize,fontFamily:e.fontFamily,lineHeight:`${e.stepsIconSize}px`,textAlign:"center",borderRadius:e.stepsIconSize,border:`${e.lineWidth}px ${e.lineType} transparent`,transition:`background-color ${n}, border-color ${n}`,[`${t}-icon`]:{position:"relative",top:e.stepsIconTop,color:e.colorPrimary,lineHeight:1}},[`${o}-tail`]:{position:"absolute",top:e.stepsIconSize/2-e.paddingXXS,insetInlineStart:0,width:"100%","&::after":{display:"inline-block",width:"100%",height:e.lineWidth,background:e.colorSplit,borderRadius:e.lineWidth,transition:`background ${n}`,content:'""'}},[`${o}-title`]:{position:"relative",display:"inline-block",paddingInlineEnd:e.padding,color:e.colorText,fontSize:e.fontSizeLG,lineHeight:`${e.stepsTitleLineHeight}px`,"&::after":{position:"absolute",top:e.stepsTitleLineHeight/2,insetInlineStart:"100%",display:"block",width:9999,height:e.lineWidth,background:e.processTailColor,content:'""'}},[`${o}-subtitle`]:{display:"inline",marginInlineStart:e.marginXS,color:e.colorTextDescription,fontWeight:"normal",fontSize:e.fontSize},[`${o}-description`]:{color:e.colorTextDescription,fontSize:e.fontSize}},nd(Pa.wait,e)),nd(Pa.process,e)),{[`${o}-process > ${o}-container > ${o}-title`]:{fontWeight:e.fontWeightStrong}}),nd(Pa.finish,e)),nd(Pa.error,e)),{[`${o}${t}-next-error > ${t}-item-title::after`]:{background:e.colorError},[`${o}-disabled`]:{cursor:"not-allowed"}})},mae=e=>{const{componentCls:t,motionDurationSlow:n}=e;return{[`& ${t}-item`]:{[`&:not(${t}-item-active)`]:{[`& > ${t}-item-container[role='button']`]:{cursor:"pointer",[`${t}-item`]:{[`&-title, &-subtitle, &-description, &-icon ${t}-icon`]:{transition:`color ${n}`}},"&:hover":{[`${t}-item`]:{"&-title, &-subtitle, &-description":{color:e.colorPrimary}}}},[`&:not(${t}-item-process)`]:{[`& > ${t}-item-container[role='button']:hover`]:{[`${t}-item`]:{"&-icon":{borderColor:e.colorPrimary,[`${t}-icon`]:{color:e.colorPrimary}}}}}}},[`&${t}-horizontal:not(${t}-label-vertical)`]:{[`${t}-item`]:{paddingInlineStart:e.padding,whiteSpace:"nowrap","&:first-child":{paddingInlineStart:0},[`&:last-child ${t}-item-title`]:{paddingInlineEnd:0},"&-tail":{display:"none"},"&-description":{maxWidth:e.descriptionWidth,whiteSpace:"normal"}}}}},bae=e=>{const{componentCls:t}=e;return{[t]:m(m(m(m(m(m(m(m(m(m(m(m(m({},qe(e)),{display:"flex",width:"100%",fontSize:0,textAlign:"initial"}),vae(e)),mae(e)),aae(e)),pae(e)),hae(e)),sae(e)),dae(e)),cae(e)),fae(e)),uae(e)),gae(e))}},yae=Ue("Steps",e=>{const{wireframe:t,colorTextDisabled:n,fontSizeHeading3:o,fontSize:r,controlHeight:i,controlHeightLG:l,colorTextLightSolid:a,colorText:s,colorPrimary:c,colorTextLabel:u,colorTextDescription:d,colorTextQuaternary:f,colorFillContent:h,controlItemBgActive:v,colorError:g,colorBgContainer:b,colorBorderSecondary:y}=e,S=e.controlHeight,$=e.colorSplit,w=ze(e,{processTailColor:$,stepsNavArrowColor:n,stepsIconSize:S,stepsIconCustomSize:S,stepsIconCustomTop:0,stepsIconCustomFontSize:l/2,stepsIconTop:-.5,stepsIconFontSize:r,stepsTitleLineHeight:i,stepsSmallIconSize:o,stepsDotSize:i/4,stepsCurrentDotSize:l/4,stepsNavContentMaxWidth:"auto",processIconColor:a,processTitleColor:s,processDescriptionColor:s,processIconBgColor:c,processIconBorderColor:c,processDotColor:c,waitIconColor:t?n:u,waitTitleColor:d,waitDescriptionColor:d,waitTailColor:$,waitIconBgColor:t?b:h,waitIconBorderColor:t?n:"transparent",waitDotColor:n,finishIconColor:c,finishTitleColor:s,finishDescriptionColor:d,finishTailColor:c,finishIconBgColor:t?b:v,finishIconBorderColor:t?c:v,finishDotColor:c,errorIconColor:a,errorTitleColor:g,errorDescriptionColor:g,errorTailColor:$,errorIconBgColor:g,errorIconBorderColor:g,errorDotColor:g,stepsNavActiveColor:c,stepsProgressSize:l,inlineDotSize:6,inlineTitleColor:f,inlineTailColor:y});return[bae(w)]},{descriptionWidth:140}),Sae=()=>({prefixCls:String,iconPrefix:String,current:Number,initial:Number,percent:Number,responsive:$e(),items:ct(),labelPlacement:Ne(),status:Ne(),size:Ne(),direction:Ne(),progressDot:He([Boolean,Function]),type:Ne(),onChange:ve(),"onUpdate:current":ve()}),Vv=re({compatConfig:{MODE:3},name:"ASteps",inheritAttrs:!1,props:Qe(Sae(),{current:0,responsive:!0,labelPlacement:"horizontal"}),slots:Object,setup(e,t){let{attrs:n,slots:o,emit:r}=t;const{prefixCls:i,direction:l,configProvider:a}=Ee("steps",e),[s,c]=yae(i),[,u]=si(),d=ps(),f=P(()=>e.responsive&&d.value.xs?"vertical":e.direction),h=P(()=>a.getPrefixCls("",e.iconPrefix)),v=$=>{r("update:current",$),r("change",$)},g=P(()=>e.type==="inline"),b=P(()=>g.value?void 0:e.percent),y=$=>{let{node:w,status:C}=$;if(C==="process"&&e.percent!==void 0){const O=e.size==="small"?u.value.controlHeight:u.value.controlHeightLG;return p("div",{class:`${i.value}-progress-icon`},[p(aS,{type:"circle",percent:b.value,size:O,strokeWidth:4,format:()=>null},null),w])}return w},S=P(()=>({finish:p(Zl,{class:`${i.value}-finish-icon`},null),error:p(Vn,{class:`${i.value}-error-icon`},null)}));return()=>{const $=le({[`${i.value}-rtl`]:l.value==="rtl",[`${i.value}-with-progress`]:b.value!==void 0},n.class,c.value),w=(C,O)=>C.description?p(co,{title:C.description},{default:()=>[O]}):O;return s(p(lae,B(B(B({icons:S.value},n),ot(e,["percent","responsive"])),{},{items:e.items,direction:f.value,prefixCls:i.value,iconPrefix:h.value,class:$,onChange:v,isInline:g.value,itemRender:g.value?w:void 0}),m({stepIcon:y},o)))}}}),Jd=re(m(m({compatConfig:{MODE:3}},m7),{name:"AStep",props:v7()})),$ae=m(Vv,{Step:Jd,install:e=>(e.component(Vv.name,Vv),e.component(Jd.name,Jd),e)}),Cae=e=>{const{componentCls:t}=e,n=`${t}-inner`;return{[t]:{[`&${t}-small`]:{minWidth:e.switchMinWidthSM,height:e.switchHeightSM,lineHeight:`${e.switchHeightSM}px`,[`${t}-inner`]:{paddingInlineStart:e.switchInnerMarginMaxSM,paddingInlineEnd:e.switchInnerMarginMinSM,[`${n}-checked`]:{marginInlineStart:`calc(-100% + ${e.switchPinSizeSM+e.switchPadding*2}px - ${e.switchInnerMarginMaxSM*2}px)`,marginInlineEnd:`calc(100% - ${e.switchPinSizeSM+e.switchPadding*2}px + ${e.switchInnerMarginMaxSM*2}px)`},[`${n}-unchecked`]:{marginTop:-e.switchHeightSM,marginInlineStart:0,marginInlineEnd:0}},[`${t}-handle`]:{width:e.switchPinSizeSM,height:e.switchPinSizeSM},[`${t}-loading-icon`]:{top:(e.switchPinSizeSM-e.switchLoadingIconSize)/2,fontSize:e.switchLoadingIconSize},[`&${t}-checked`]:{[`${t}-inner`]:{paddingInlineStart:e.switchInnerMarginMinSM,paddingInlineEnd:e.switchInnerMarginMaxSM,[`${n}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${n}-unchecked`]:{marginInlineStart:`calc(100% - ${e.switchPinSizeSM+e.switchPadding*2}px + ${e.switchInnerMarginMaxSM*2}px)`,marginInlineEnd:`calc(-100% + ${e.switchPinSizeSM+e.switchPadding*2}px - ${e.switchInnerMarginMaxSM*2}px)`}},[`${t}-handle`]:{insetInlineStart:`calc(100% - ${e.switchPinSizeSM+e.switchPadding}px)`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${n}`]:{[`${n}-unchecked`]:{marginInlineStart:e.marginXXS/2,marginInlineEnd:-e.marginXXS/2}},[`&${t}-checked ${n}`]:{[`${n}-checked`]:{marginInlineStart:-e.marginXXS/2,marginInlineEnd:e.marginXXS/2}}}}}}},xae=e=>{const{componentCls:t}=e;return{[t]:{[`${t}-loading-icon${e.iconCls}`]:{position:"relative",top:(e.switchPinSize-e.fontSize)/2,color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${t}-checked ${t}-loading-icon`]:{color:e.switchColor}}}},wae=e=>{const{componentCls:t}=e,n=`${t}-handle`;return{[t]:{[n]:{position:"absolute",top:e.switchPadding,insetInlineStart:e.switchPadding,width:e.switchPinSize,height:e.switchPinSize,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:e.colorWhite,borderRadius:e.switchPinSize/2,boxShadow:e.switchHandleShadow,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${t}-checked ${n}`]:{insetInlineStart:`calc(100% - ${e.switchPinSize+e.switchPadding}px)`},[`&:not(${t}-disabled):active`]:{[`${n}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${t}-checked ${n}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},Oae=e=>{const{componentCls:t}=e,n=`${t}-inner`;return{[t]:{[n]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:e.switchInnerMarginMax,paddingInlineEnd:e.switchInnerMarginMin,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${n}-checked, ${n}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none"},[`${n}-checked`]:{marginInlineStart:`calc(-100% + ${e.switchPinSize+e.switchPadding*2}px - ${e.switchInnerMarginMax*2}px)`,marginInlineEnd:`calc(100% - ${e.switchPinSize+e.switchPadding*2}px + ${e.switchInnerMarginMax*2}px)`},[`${n}-unchecked`]:{marginTop:-e.switchHeight,marginInlineStart:0,marginInlineEnd:0}},[`&${t}-checked ${n}`]:{paddingInlineStart:e.switchInnerMarginMin,paddingInlineEnd:e.switchInnerMarginMax,[`${n}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${n}-unchecked`]:{marginInlineStart:`calc(100% - ${e.switchPinSize+e.switchPadding*2}px + ${e.switchInnerMarginMax*2}px)`,marginInlineEnd:`calc(-100% + ${e.switchPinSize+e.switchPadding*2}px - ${e.switchInnerMarginMax*2}px)`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${n}`]:{[`${n}-unchecked`]:{marginInlineStart:e.switchPadding*2,marginInlineEnd:-e.switchPadding*2}},[`&${t}-checked ${n}`]:{[`${n}-checked`]:{marginInlineStart:-e.switchPadding*2,marginInlineEnd:e.switchPadding*2}}}}}},Pae=e=>{const{componentCls:t}=e;return{[t]:m(m(m(m({},qe(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:e.switchMinWidth,height:e.switchHeight,lineHeight:`${e.switchHeight}px`,verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${t}-disabled)`]:{background:e.colorTextTertiary}}),oi(e)),{[`&${t}-checked`]:{background:e.switchColor,[`&:hover:not(${t}-disabled)`]:{background:e.colorPrimaryHover}},[`&${t}-loading, &${t}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${t}-rtl`]:{direction:"rtl"}})}},Iae=Ue("Switch",e=>{const t=e.fontSize*e.lineHeight,n=e.controlHeight/2,o=2,r=t-o*2,i=n-o*2,l=ze(e,{switchMinWidth:r*2+o*4,switchHeight:t,switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchInnerMarginMin:r/2,switchInnerMarginMax:r+o+o*2,switchPadding:o,switchPinSize:r,switchBg:e.colorBgContainer,switchMinWidthSM:i*2+o*2,switchHeightSM:n,switchInnerMarginMinSM:i/2,switchInnerMarginMaxSM:i+o+o*2,switchPinSizeSM:i,switchHandleShadow:`0 2px 4px 0 ${new vt("#00230b").setAlpha(.2).toRgbString()}`,switchLoadingIconSize:e.fontSizeIcon*.75,switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[Pae(l),Oae(l),wae(l),xae(l),Cae(l)]}),Tae=Mn("small","default"),Eae=()=>({id:String,prefixCls:String,size:K.oneOf(Tae),disabled:{type:Boolean,default:void 0},checkedChildren:K.any,unCheckedChildren:K.any,tabindex:K.oneOfType([K.string,K.number]),autofocus:{type:Boolean,default:void 0},loading:{type:Boolean,default:void 0},checked:K.oneOfType([K.string,K.number,K.looseBool]),checkedValue:K.oneOfType([K.string,K.number,K.looseBool]).def(!0),unCheckedValue:K.oneOfType([K.string,K.number,K.looseBool]).def(!1),onChange:{type:Function},onClick:{type:Function},onKeydown:{type:Function},onMouseup:{type:Function},"onUpdate:checked":{type:Function},onBlur:Function,onFocus:Function}),_ae=re({compatConfig:{MODE:3},name:"ASwitch",__ANT_SWITCH:!0,inheritAttrs:!1,props:Eae(),slots:Object,setup(e,t){let{attrs:n,slots:o,expose:r,emit:i}=t;const l=an(),a=po(),s=P(()=>{var T;return(T=e.disabled)!==null&&T!==void 0?T:a.value});Rp(()=>{});const c=ne(e.checked!==void 0?e.checked:n.defaultChecked),u=P(()=>c.value===e.checkedValue);ye(()=>e.checked,()=>{c.value=e.checked});const{prefixCls:d,direction:f,size:h}=Ee("switch",e),[v,g]=Iae(d),b=ne(),y=()=>{var T;(T=b.value)===null||T===void 0||T.focus()};r({focus:y,blur:()=>{var T;(T=b.value)===null||T===void 0||T.blur()}}),Ke(()=>{rt(()=>{e.autofocus&&!s.value&&b.value.focus()})});const $=(T,M)=>{s.value||(i("update:checked",T),i("change",T,M),l.onFieldChange())},w=T=>{i("blur",T)},C=T=>{y();const M=u.value?e.unCheckedValue:e.checkedValue;$(M,T),i("click",M,T)},O=T=>{T.keyCode===Ie.LEFT?$(e.unCheckedValue,T):T.keyCode===Ie.RIGHT&&$(e.checkedValue,T),i("keydown",T)},x=T=>{var M;(M=b.value)===null||M===void 0||M.blur(),i("mouseup",T)},I=P(()=>({[`${d.value}-small`]:h.value==="small",[`${d.value}-loading`]:e.loading,[`${d.value}-checked`]:u.value,[`${d.value}-disabled`]:s.value,[d.value]:!0,[`${d.value}-rtl`]:f.value==="rtl",[g.value]:!0}));return()=>{var T;return v(p(Vy,null,{default:()=>[p("button",B(B(B({},ot(e,["prefixCls","checkedChildren","unCheckedChildren","checked","autofocus","checkedValue","unCheckedValue","id","onChange","onUpdate:checked"])),n),{},{id:(T=e.id)!==null&&T!==void 0?T:l.id.value,onKeydown:O,onClick:C,onBlur:w,onMouseup:x,type:"button",role:"switch","aria-checked":c.value,disabled:s.value||e.loading,class:[n.class,I.value],ref:b}),[p("div",{class:`${d.value}-handle`},[e.loading?p(to,{class:`${d.value}-loading-icon`},null):null]),p("span",{class:`${d.value}-inner`},[p("span",{class:`${d.value}-inner-checked`},[ln(o,e,"checkedChildren")]),p("span",{class:`${d.value}-inner-unchecked`},[ln(o,e,"unCheckedChildren")])])])]}))}}}),Mae=Bt(_ae),b7=Symbol("TableContextProps"),Aae=e=>{Ye(b7,e)},Nr=()=>Ge(b7,{}),Rae="RC_TABLE_KEY";function y7(e){return e==null?[]:Array.isArray(e)?e:[e]}function S7(e,t){if(!t&&typeof t!="number")return e;const n=y7(t);let o=e;for(let r=0;r{const{key:r,dataIndex:i}=o||{};let l=r||y7(i).join("-")||Rae;for(;n[l];)l=`${l}_next`;n[l]=!0,t.push(l)}),t}function Dae(){const e={};function t(i,l){l&&Object.keys(l).forEach(a=>{const s=l[a];s&&typeof s=="object"?(i[a]=i[a]||{},t(i[a],s)):i[a]=s})}for(var n=arguments.length,o=new Array(n),r=0;r{t(e,i)}),e}function A0(e){return e!=null}const $7=Symbol("SlotsContextProps"),Bae=e=>{Ye($7,e)},fS=()=>Ge($7,P(()=>({}))),C7=Symbol("ContextProps"),Nae=e=>{Ye(C7,e)},kae=()=>Ge(C7,{onResizeColumn:()=>{}}),Wa="RC_TABLE_INTERNAL_COL_DEFINE",x7=Symbol("HoverContextProps"),Fae=e=>{Ye(x7,e)},Lae=()=>Ge(x7,{startRow:oe(-1),endRow:oe(-1),onHover(){}}),R0=oe(!1),zae=()=>{Ke(()=>{R0.value=R0.value||R1("position","sticky")})},Hae=()=>R0;var jae=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r=n}function Wae(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!Yt(e)}const Uh=re({name:"Cell",props:["prefixCls","record","index","renderIndex","dataIndex","customRender","component","colSpan","rowSpan","fixLeft","fixRight","firstFixLeft","lastFixLeft","firstFixRight","lastFixRight","appendNode","additionalProps","ellipsis","align","rowType","isSticky","column","cellType","transformCellText"],setup(e,t){let{slots:n}=t;const o=fS(),{onHover:r,startRow:i,endRow:l}=Lae(),a=P(()=>{var g,b,y,S;return(y=(g=e.colSpan)!==null&&g!==void 0?g:(b=e.additionalProps)===null||b===void 0?void 0:b.colSpan)!==null&&y!==void 0?y:(S=e.additionalProps)===null||S===void 0?void 0:S.colspan}),s=P(()=>{var g,b,y,S;return(y=(g=e.rowSpan)!==null&&g!==void 0?g:(b=e.additionalProps)===null||b===void 0?void 0:b.rowSpan)!==null&&y!==void 0?y:(S=e.additionalProps)===null||S===void 0?void 0:S.rowspan}),c=$o(()=>{const{index:g}=e;return Vae(g,s.value||1,i.value,l.value)}),u=Hae(),d=(g,b)=>{var y;const{record:S,index:$,additionalProps:w}=e;S&&r($,$+b-1),(y=w==null?void 0:w.onMouseenter)===null||y===void 0||y.call(w,g)},f=g=>{var b;const{record:y,additionalProps:S}=e;y&&r(-1,-1),(b=S==null?void 0:S.onMouseleave)===null||b===void 0||b.call(S,g)},h=g=>{const b=kt(g)[0];return Yt(b)?b.type===Ki?b.children:Array.isArray(b.children)?h(b.children):void 0:b},v=oe(null);return ye([c,()=>e.prefixCls,v],()=>{const g=Jn(v.value);g&&(c.value?Yf(g,`${e.prefixCls}-cell-row-hover`):qf(g,`${e.prefixCls}-cell-row-hover`))}),()=>{var g,b,y,S,$,w;const{prefixCls:C,record:O,index:x,renderIndex:I,dataIndex:T,customRender:M,component:E="td",fixLeft:A,fixRight:R,firstFixLeft:z,lastFixLeft:_,firstFixRight:D,lastFixRight:N,appendNode:k=(g=n.appendNode)===null||g===void 0?void 0:g.call(n),additionalProps:F={},ellipsis:L,align:H,rowType:j,isSticky:Y,column:Z={},cellType:X}=e,ee=`${C}-cell`;let U,Q;const J=(b=n.default)===null||b===void 0?void 0:b.call(n);if(A0(J)||X==="header")Q=J;else{const fe=S7(O,T);if(Q=fe,M){const de=M({text:fe,value:fe,record:O,index:x,renderIndex:I,column:Z.__originColumn__});Wae(de)?(Q=de.children,U=de.props):Q=de}if(!(Wa in Z)&&X==="body"&&o.value.bodyCell&&!(!((y=Z.slots)===null||y===void 0)&&y.customRender)){const de=Jp(o.value,"bodyCell",{text:fe,value:fe,record:O,index:x,column:Z.__originColumn__},()=>{const be=Q===void 0?fe:Q;return[typeof be=="object"&&qt(be)||typeof be!="object"?be:null]});Q=wt(de)}e.transformCellText&&(Q=e.transformCellText({text:Q,record:O,index:x,column:Z.__originColumn__}))}typeof Q=="object"&&!Array.isArray(Q)&&!Yt(Q)&&(Q=null),L&&(_||D)&&(Q=p("span",{class:`${ee}-content`},[Q])),Array.isArray(Q)&&Q.length===1&&(Q=Q[0]);const G=U||{},{colSpan:q,rowSpan:V,style:W,class:te}=G,ue=jae(G,["colSpan","rowSpan","style","class"]),ie=(S=q!==void 0?q:a.value)!==null&&S!==void 0?S:1,ae=($=V!==void 0?V:s.value)!==null&&$!==void 0?$:1;if(ie===0||ae===0)return null;const ce={},se=typeof A=="number"&&u.value,pe=typeof R=="number"&&u.value;se&&(ce.position="sticky",ce.left=`${A}px`),pe&&(ce.position="sticky",ce.right=`${R}px`);const he={};H&&(he.textAlign=H);let ge;const me=L===!0?{showTitle:!0}:L;me&&(me.showTitle||j==="header")&&(typeof Q=="string"||typeof Q=="number"?ge=Q.toString():Yt(Q)&&(ge=h([Q])));const xe=m(m(m({title:ge},ue),F),{colSpan:ie!==1?ie:null,rowSpan:ae!==1?ae:null,class:le(ee,{[`${ee}-fix-left`]:se&&u.value,[`${ee}-fix-left-first`]:z&&u.value,[`${ee}-fix-left-last`]:_&&u.value,[`${ee}-fix-right`]:pe&&u.value,[`${ee}-fix-right-first`]:D&&u.value,[`${ee}-fix-right-last`]:N&&u.value,[`${ee}-ellipsis`]:L,[`${ee}-with-append`]:k,[`${ee}-fix-sticky`]:(se||pe)&&Y&&u.value},F.class,te),onMouseenter:fe=>{d(fe,ae)},onMouseleave:f,style:[F.style,he,ce,W]});return p(E,B(B({},xe),{},{ref:v}),{default:()=>[k,Q,(w=n.dragHandle)===null||w===void 0?void 0:w.call(n)]})}}});function pS(e,t,n,o,r){const i=n[e]||{},l=n[t]||{};let a,s;i.fixed==="left"?a=o.left[e]:l.fixed==="right"&&(s=o.right[t]);let c=!1,u=!1,d=!1,f=!1;const h=n[t+1],v=n[e-1];return r==="rtl"?a!==void 0?f=!(v&&v.fixed==="left"):s!==void 0&&(d=!(h&&h.fixed==="right")):a!==void 0?c=!(h&&h.fixed==="left"):s!==void 0&&(u=!(v&&v.fixed==="right")),{fixLeft:a,fixRight:s,lastFixLeft:c,firstFixRight:u,lastFixRight:d,firstFixLeft:f,isSticky:o.isSticky}}const $4={mouse:{move:"mousemove",stop:"mouseup"},touch:{move:"touchmove",stop:"touchend"}},C4=50,Kae=re({compatConfig:{MODE:3},name:"DragHandle",props:{prefixCls:String,width:{type:Number,required:!0},minWidth:{type:Number,default:C4},maxWidth:{type:Number,default:1/0},column:{type:Object,default:void 0}},setup(e){let t=0,n={remove:()=>{}},o={remove:()=>{}};const r=()=>{n.remove(),o.remove()};wn(()=>{r()}),Ve(()=>{Mt(!isNaN(e.width),"Table","width must be a number when use resizable")});const{onResizeColumn:i}=kae(),l=P(()=>typeof e.minWidth=="number"&&!isNaN(e.minWidth)?e.minWidth:C4),a=P(()=>typeof e.maxWidth=="number"&&!isNaN(e.maxWidth)?e.maxWidth:1/0),s=On();let c=0;const u=oe(!1);let d;const f=$=>{let w=0;$.touches?$.touches.length?w=$.touches[0].pageX:w=$.changedTouches[0].pageX:w=$.pageX;const C=t-w;let O=Math.max(c-C,l.value);O=Math.min(O,a.value),Ze.cancel(d),d=Ze(()=>{i(O,e.column.__originColumn__)})},h=$=>{f($)},v=$=>{u.value=!1,f($),r()},g=($,w)=>{u.value=!0,r(),c=s.vnode.el.parentNode.getBoundingClientRect().width,!($ instanceof MouseEvent&&$.which!==1)&&($.stopPropagation&&$.stopPropagation(),t=$.touches?$.touches[0].pageX:$.pageX,n=Nt(document.documentElement,w.move,h),o=Nt(document.documentElement,w.stop,v))},b=$=>{$.stopPropagation(),$.preventDefault(),g($,$4.mouse)},y=$=>{$.stopPropagation(),$.preventDefault(),g($,$4.touch)},S=$=>{$.stopPropagation(),$.preventDefault()};return()=>{const{prefixCls:$}=e,w={[on?"onTouchstartPassive":"onTouchstart"]:C=>y(C)};return p("div",B(B({class:`${$}-resize-handle ${u.value?"dragging":""}`,onMousedown:b},w),{},{onClick:S}),[p("div",{class:`${$}-resize-handle-line`},null)])}}}),Gae=re({name:"HeaderRow",props:["cells","stickyOffsets","flattenColumns","rowComponent","cellComponent","index","customHeaderRow"],setup(e){const t=Nr();return()=>{const{prefixCls:n,direction:o}=t,{cells:r,stickyOffsets:i,flattenColumns:l,rowComponent:a,cellComponent:s,customHeaderRow:c,index:u}=e;let d;c&&(d=c(r.map(h=>h.column),u));const f=Gh(r.map(h=>h.column));return p(a,d,{default:()=>[r.map((h,v)=>{const{column:g}=h,b=pS(h.colStart,h.colEnd,l,i,o);let y;g&&g.customHeaderCell&&(y=h.column.customHeaderCell(g));const S=g;return p(Uh,B(B(B({},h),{},{cellType:"header",ellipsis:g.ellipsis,align:g.align,component:s,prefixCls:n,key:f[v]},b),{},{additionalProps:y,rowType:"header",column:g}),{default:()=>g.title,dragHandle:()=>S.resizable?p(Kae,{prefixCls:n,width:S.width,minWidth:S.minWidth,maxWidth:S.maxWidth,column:S},null):null})})]})}}});function Uae(e){const t=[];function n(r,i){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;t[l]=t[l]||[];let a=i;return r.filter(Boolean).map(c=>{const u={key:c.key,class:le(c.className,c.class),column:c,colStart:a};let d=1;const f=c.children;return f&&f.length>0&&(d=n(f,a,l+1).reduce((h,v)=>h+v,0),u.hasSubColumns=!0),"colSpan"in c&&({colSpan:d}=c),"rowSpan"in c&&(u.rowSpan=c.rowSpan),u.colSpan=d,u.colEnd=u.colStart+d-1,t[l].push(u),a+=d,d})}n(e,0);const o=t.length;for(let r=0;r{!("rowSpan"in i)&&!i.hasSubColumns&&(i.rowSpan=o-r)});return t}const x4=re({name:"TableHeader",inheritAttrs:!1,props:["columns","flattenColumns","stickyOffsets","customHeaderRow"],setup(e){const t=Nr(),n=P(()=>Uae(e.columns));return()=>{const{prefixCls:o,getComponent:r}=t,{stickyOffsets:i,flattenColumns:l,customHeaderRow:a}=e,s=r(["header","wrapper"],"thead"),c=r(["header","row"],"tr"),u=r(["header","cell"],"th");return p(s,{class:`${o}-thead`},{default:()=>[n.value.map((d,f)=>p(Gae,{key:f,flattenColumns:l,cells:d,stickyOffsets:i,rowComponent:c,cellComponent:u,customHeaderRow:a,index:f},null))]})}}}),w7=Symbol("ExpandedRowProps"),Xae=e=>{Ye(w7,e)},Yae=()=>Ge(w7,{}),O7=re({name:"ExpandedRow",inheritAttrs:!1,props:["prefixCls","component","cellComponent","expanded","colSpan","isEmpty"],setup(e,t){let{slots:n,attrs:o}=t;const r=Nr(),i=Yae(),{fixHeader:l,fixColumn:a,componentWidth:s,horizonScroll:c}=i;return()=>{const{prefixCls:u,component:d,cellComponent:f,expanded:h,colSpan:v,isEmpty:g}=e;return p(d,{class:o.class,style:{display:h?null:"none"}},{default:()=>[p(Uh,{component:f,prefixCls:u,colSpan:v},{default:()=>{var b;let y=(b=n.default)===null||b===void 0?void 0:b.call(n);return(g?c.value:a.value)&&(y=p("div",{style:{width:`${s.value-(l.value?r.scrollbarSize:0)}px`,position:"sticky",left:0,overflow:"hidden"},class:`${u}-expanded-row-fixed`},[y])),y}})]})}}}),qae=re({name:"MeasureCell",props:["columnKey"],setup(e,t){let{emit:n}=t;const o=ne();return Ke(()=>{o.value&&n("columnResize",e.columnKey,o.value.offsetWidth)}),()=>p(Vo,{onResize:r=>{let{offsetWidth:i}=r;n("columnResize",e.columnKey,i)}},{default:()=>[p("td",{ref:o,style:{padding:0,border:0,height:0}},[p("div",{style:{height:0,overflow:"hidden"}},[Pt(" ")])])]})}}),P7=Symbol("BodyContextProps"),Jae=e=>{Ye(P7,e)},I7=()=>Ge(P7,{}),Zae=re({name:"BodyRow",inheritAttrs:!1,props:["record","index","renderIndex","recordKey","expandedKeys","rowComponent","cellComponent","customRow","rowExpandable","indent","rowKey","getRowKey","childrenColumnName"],setup(e,t){let{attrs:n}=t;const o=Nr(),r=I7(),i=oe(!1),l=P(()=>e.expandedKeys&&e.expandedKeys.has(e.recordKey));Ve(()=>{l.value&&(i.value=!0)});const a=P(()=>r.expandableType==="row"&&(!e.rowExpandable||e.rowExpandable(e.record))),s=P(()=>r.expandableType==="nest"),c=P(()=>e.childrenColumnName&&e.record&&e.record[e.childrenColumnName]),u=P(()=>a.value||s.value),d=(b,y)=>{r.onTriggerExpand(b,y)},f=P(()=>{var b;return((b=e.customRow)===null||b===void 0?void 0:b.call(e,e.record,e.index))||{}}),h=function(b){var y,S;r.expandRowByClick&&u.value&&d(e.record,b);for(var $=arguments.length,w=new Array($>1?$-1:0),C=1;C<$;C++)w[C-1]=arguments[C];(S=(y=f.value)===null||y===void 0?void 0:y.onClick)===null||S===void 0||S.call(y,b,...w)},v=P(()=>{const{record:b,index:y,indent:S}=e,{rowClassName:$}=r;return typeof $=="string"?$:typeof $=="function"?$(b,y,S):""}),g=P(()=>Gh(r.flattenColumns));return()=>{const{class:b,style:y}=n,{record:S,index:$,rowKey:w,indent:C=0,rowComponent:O,cellComponent:x}=e,{prefixCls:I,fixedInfoList:T,transformCellText:M}=o,{flattenColumns:E,expandedRowClassName:A,indentSize:R,expandIcon:z,expandedRowRender:_,expandIconColumnIndex:D}=r,N=p(O,B(B({},f.value),{},{"data-row-key":w,class:le(b,`${I}-row`,`${I}-row-level-${C}`,v.value,f.value.class),style:[y,f.value.style],onClick:h}),{default:()=>[E.map((F,L)=>{const{customRender:H,dataIndex:j,className:Y}=F,Z=g[L],X=T[L];let ee;F.customCell&&(ee=F.customCell(S,$,F));const U=L===(D||0)&&s.value?p(Le,null,[p("span",{style:{paddingLeft:`${R*C}px`},class:`${I}-row-indent indent-level-${C}`},null),z({prefixCls:I,expanded:l.value,expandable:c.value,record:S,onExpand:d})]):null;return p(Uh,B(B({cellType:"body",class:Y,ellipsis:F.ellipsis,align:F.align,component:x,prefixCls:I,key:Z,record:S,index:$,renderIndex:e.renderIndex,dataIndex:j,customRender:H},X),{},{additionalProps:ee,column:F,transformCellText:M,appendNode:U}),null)})]});let k;if(a.value&&(i.value||l.value)){const F=_({record:S,index:$,indent:C+1,expanded:l.value}),L=A&&A(S,$,C);k=p(O7,{expanded:l.value,class:le(`${I}-expanded-row`,`${I}-expanded-row-level-${C+1}`,L),prefixCls:I,component:O,cellComponent:x,colSpan:E.length,isEmpty:!1},{default:()=>[F]})}return p(Le,null,[N,k])}}});function T7(e,t,n,o,r,i){const l=[];l.push({record:e,indent:t,index:i});const a=r(e),s=o==null?void 0:o.has(a);if(e&&Array.isArray(e[n])&&s)for(let c=0;c{const i=t.value,l=n.value,a=e.value;if(l!=null&&l.size){const s=[];for(let c=0;c<(a==null?void 0:a.length);c+=1){const u=a[c];s.push(...T7(u,0,i,l,o.value,c))}return s}return a==null?void 0:a.map((s,c)=>({record:s,indent:0,index:c}))})}const E7=Symbol("ResizeContextProps"),ese=e=>{Ye(E7,e)},tse=()=>Ge(E7,{onColumnResize:()=>{}}),nse=re({name:"TableBody",props:["data","getRowKey","measureColumnWidth","expandedKeys","customRow","rowExpandable","childrenColumnName"],setup(e,t){let{slots:n}=t;const o=tse(),r=Nr(),i=I7(),l=Qae(We(e,"data"),We(e,"childrenColumnName"),We(e,"expandedKeys"),We(e,"getRowKey")),a=oe(-1),s=oe(-1);let c;return Fae({startRow:a,endRow:s,onHover:(u,d)=>{clearTimeout(c),c=setTimeout(()=>{a.value=u,s.value=d},100)}}),()=>{var u;const{data:d,getRowKey:f,measureColumnWidth:h,expandedKeys:v,customRow:g,rowExpandable:b,childrenColumnName:y}=e,{onColumnResize:S}=o,{prefixCls:$,getComponent:w}=r,{flattenColumns:C}=i,O=w(["body","wrapper"],"tbody"),x=w(["body","row"],"tr"),I=w(["body","cell"],"td");let T;d.length?T=l.value.map((E,A)=>{const{record:R,indent:z,index:_}=E,D=f(R,A);return p(Zae,{key:D,rowKey:D,record:R,recordKey:D,index:A,renderIndex:_,rowComponent:x,cellComponent:I,expandedKeys:v,customRow:g,getRowKey:f,rowExpandable:b,childrenColumnName:y,indent:z},null)}):T=p(O7,{expanded:!0,class:`${$}-placeholder`,prefixCls:$,component:x,cellComponent:I,colSpan:C.length,isEmpty:!0},{default:()=>[(u=n.emptyNode)===null||u===void 0?void 0:u.call(n)]});const M=Gh(C);return p(O,{class:`${$}-tbody`},{default:()=>[h&&p("tr",{"aria-hidden":"true",class:`${$}-measure-row`,style:{height:0,fontSize:0}},[M.map(E=>p(qae,{key:E,columnKey:E,onColumnResize:S},null))]),T]})}}}),Pi={};var ose=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const{fixed:o}=n,r=o===!0?"left":o,i=n.children;return i&&i.length>0?[...t,...D0(i).map(l=>m({fixed:r},l))]:[...t,m(m({},n),{fixed:r})]},[])}function rse(e){return e.map(t=>{const{fixed:n}=t,o=ose(t,["fixed"]);let r=n;return n==="left"?r="right":n==="right"&&(r="left"),m({fixed:r},o)})}function ise(e,t){let{prefixCls:n,columns:o,expandable:r,expandedKeys:i,getRowKey:l,onTriggerExpand:a,expandIcon:s,rowExpandable:c,expandIconColumnIndex:u,direction:d,expandRowByClick:f,expandColumnWidth:h,expandFixed:v}=e;const g=fS(),b=P(()=>{if(r.value){let $=o.value.slice();if(!$.includes(Pi)){const R=u.value||0;R>=0&&$.splice(R,0,Pi)}const w=$.indexOf(Pi);$=$.filter((R,z)=>R!==Pi||z===w);const C=o.value[w];let O;(v.value==="left"||v.value)&&!u.value?O="left":(v.value==="right"||v.value)&&u.value===o.value.length?O="right":O=C?C.fixed:null;const x=i.value,I=c.value,T=s.value,M=n.value,E=f.value,A={[Wa]:{class:`${n.value}-expand-icon-col`,columnType:"EXPAND_COLUMN"},title:Jp(g.value,"expandColumnTitle",{},()=>[""]),fixed:O,class:`${n.value}-row-expand-icon-cell`,width:h.value,customRender:R=>{let{record:z,index:_}=R;const D=l.value(z,_),N=x.has(D),k=I?I(z):!0,F=T({prefixCls:M,expanded:N,expandable:k,record:z,onExpand:a});return E?p("span",{onClick:L=>L.stopPropagation()},[F]):F}};return $.map(R=>R===Pi?A:R)}return o.value.filter($=>$!==Pi)}),y=P(()=>{let $=b.value;return t.value&&($=t.value($)),$.length||($=[{customRender:()=>null}]),$}),S=P(()=>d.value==="rtl"?rse(D0(y.value)):D0(y.value));return[y,S]}function _7(e){const t=oe(e);let n;const o=oe([]);function r(i){o.value.push(i),Ze.cancel(n),n=Ze(()=>{const l=o.value;o.value=[],l.forEach(a=>{t.value=a(t.value)})})}return et(()=>{Ze.cancel(n)}),[t,r]}function lse(e){const t=ne(null),n=ne();function o(){clearTimeout(n.value)}function r(l){t.value=l,o(),n.value=setTimeout(()=>{t.value=null,n.value=void 0},100)}function i(){return t.value}return et(()=>{o()}),[r,i]}function ase(e,t,n){return P(()=>{const r=[],i=[];let l=0,a=0;const s=e.value,c=t.value,u=n.value;for(let d=0;d=0;a-=1){const s=t[a],c=n&&n[a],u=c&&c[Wa];if(s||u||l){const d=u||{},{columnType:f}=d,h=sse(d,["columnType"]);r.unshift(p("col",B({key:a,style:{width:typeof s=="number"?`${s}px`:s}},h),null)),l=!0}}return p("colgroup",null,[r])}function B0(e,t){let{slots:n}=t;var o;return p("div",null,[(o=n.default)===null||o===void 0?void 0:o.call(n)])}B0.displayName="Panel";let cse=0;const use=re({name:"TableSummary",props:["fixed"],setup(e,t){let{slots:n}=t;const o=Nr(),r=`table-summary-uni-key-${++cse}`,i=P(()=>e.fixed===""||e.fixed);return Ve(()=>{o.summaryCollect(r,i.value)}),et(()=>{o.summaryCollect(r,!1)}),()=>{var l;return(l=n.default)===null||l===void 0?void 0:l.call(n)}}}),dse=re({compatConfig:{MODE:3},name:"ATableSummaryRow",setup(e,t){let{slots:n}=t;return()=>{var o;return p("tr",null,[(o=n.default)===null||o===void 0?void 0:o.call(n)])}}}),A7=Symbol("SummaryContextProps"),fse=e=>{Ye(A7,e)},pse=()=>Ge(A7,{}),hse=re({name:"ATableSummaryCell",props:["index","colSpan","rowSpan","align"],setup(e,t){let{attrs:n,slots:o}=t;const r=Nr(),i=pse();return()=>{const{index:l,colSpan:a=1,rowSpan:s,align:c}=e,{prefixCls:u,direction:d}=r,{scrollColumnIndex:f,stickyOffsets:h,flattenColumns:v}=i,b=l+a-1+1===f?a+1:a,y=pS(l,l+b-1,v,h,d);return p(Uh,B({class:n.class,index:l,component:"td",prefixCls:u,record:null,dataIndex:null,align:c,colSpan:b,rowSpan:s,customRender:()=>{var S;return(S=o.default)===null||S===void 0?void 0:S.call(o)}},y),null)}}}),od=re({name:"TableFooter",inheritAttrs:!1,props:["stickyOffsets","flattenColumns"],setup(e,t){let{slots:n}=t;const o=Nr();return fse(ft({stickyOffsets:We(e,"stickyOffsets"),flattenColumns:We(e,"flattenColumns"),scrollColumnIndex:P(()=>{const r=e.flattenColumns.length-1,i=e.flattenColumns[r];return i!=null&&i.scrollbar?r:null})})),()=>{var r;const{prefixCls:i}=o;return p("tfoot",{class:`${i}-summary`},[(r=n.default)===null||r===void 0?void 0:r.call(n)])}}}),gse=use;function vse(e){let{prefixCls:t,record:n,onExpand:o,expanded:r,expandable:i}=e;const l=`${t}-row-expand-icon`;if(!i)return p("span",{class:[l,`${t}-row-spaced`]},null);const a=s=>{o(n,s),s.stopPropagation()};return p("span",{class:{[l]:!0,[`${t}-row-expanded`]:r,[`${t}-row-collapsed`]:!r},onClick:a},null)}function mse(e,t,n){const o=[];function r(i){(i||[]).forEach((l,a)=>{o.push(t(l,a)),r(l[n])})}return r(e),o}const bse=re({name:"StickyScrollBar",inheritAttrs:!1,props:["offsetScroll","container","scrollBodyRef","scrollBodySizeInfo"],emits:["scroll"],setup(e,t){let{emit:n,expose:o}=t;const r=Nr(),i=oe(0),l=oe(0),a=oe(0);Ve(()=>{i.value=e.scrollBodySizeInfo.scrollWidth||0,l.value=e.scrollBodySizeInfo.clientWidth||0,a.value=i.value&&l.value*(l.value/i.value)},{flush:"post"});const s=oe(),[c,u]=_7({scrollLeft:0,isHiddenScrollBar:!0}),d=ne({delta:0,x:0}),f=oe(!1),h=()=>{f.value=!1},v=x=>{d.value={delta:x.pageX-c.value.scrollLeft,x:0},f.value=!0,x.preventDefault()},g=x=>{const{buttons:I}=x||(window==null?void 0:window.event);if(!f.value||I===0){f.value&&(f.value=!1);return}let T=d.value.x+x.pageX-d.value.x-d.value.delta;T<=0&&(T=0),T+a.value>=l.value&&(T=l.value-a.value),n("scroll",{scrollLeft:T/l.value*(i.value+2)}),d.value.x=x.pageX},b=()=>{if(!e.scrollBodyRef.value)return;const x=Af(e.scrollBodyRef.value).top,I=x+e.scrollBodyRef.value.offsetHeight,T=e.container===window?document.documentElement.scrollTop+window.innerHeight:Af(e.container).top+e.container.clientHeight;I-Mf()<=T||x>=T-e.offsetScroll?u(M=>m(m({},M),{isHiddenScrollBar:!0})):u(M=>m(m({},M),{isHiddenScrollBar:!1}))};o({setScrollLeft:x=>{u(I=>m(m({},I),{scrollLeft:x/i.value*l.value||0}))}});let S=null,$=null,w=null,C=null;Ke(()=>{S=Nt(document.body,"mouseup",h,!1),$=Nt(document.body,"mousemove",g,!1),w=Nt(window,"resize",b,!1)}),Mp(()=>{rt(()=>{b()})}),Ke(()=>{setTimeout(()=>{ye([a,f],()=>{b()},{immediate:!0,flush:"post"})})}),ye(()=>e.container,()=>{C==null||C.remove(),C=Nt(e.container,"scroll",b,!1)},{immediate:!0,flush:"post"}),et(()=>{S==null||S.remove(),$==null||$.remove(),C==null||C.remove(),w==null||w.remove()}),ye(()=>m({},c.value),(x,I)=>{x.isHiddenScrollBar!==(I==null?void 0:I.isHiddenScrollBar)&&!x.isHiddenScrollBar&&u(T=>{const M=e.scrollBodyRef.value;return M?m(m({},T),{scrollLeft:M.scrollLeft/M.scrollWidth*M.clientWidth}):T})},{immediate:!0});const O=Mf();return()=>{if(i.value<=l.value||!a.value||c.value.isHiddenScrollBar)return null;const{prefixCls:x}=r;return p("div",{style:{height:`${O}px`,width:`${l.value}px`,bottom:`${e.offsetScroll}px`},class:`${x}-sticky-scroll`},[p("div",{onMousedown:v,ref:s,class:le(`${x}-sticky-scroll-bar`,{[`${x}-sticky-scroll-bar-active`]:f.value}),style:{width:`${a.value}px`,transform:`translate3d(${c.value.scrollLeft}px, 0, 0)`}},null)])}}}),w4=zn()?window:null;function yse(e,t){return P(()=>{const{offsetHeader:n=0,offsetSummary:o=0,offsetScroll:r=0,getContainer:i=()=>w4}=typeof e.value=="object"?e.value:{},l=i()||w4,a=!!e.value;return{isSticky:a,stickyClassName:a?`${t.value}-sticky-holder`:"",offsetHeader:n,offsetSummary:o,offsetScroll:r,container:l}})}function Sse(e,t){return P(()=>{const n=[],o=e.value,r=t.value;for(let i=0;ii.isSticky&&!e.fixHeader?0:i.scrollbarSize),a=ne(),s=g=>{const{currentTarget:b,deltaX:y}=g;y&&(r("scroll",{currentTarget:b,scrollLeft:b.scrollLeft+y}),g.preventDefault())},c=ne();Ke(()=>{rt(()=>{c.value=Nt(a.value,"wheel",s)})}),et(()=>{var g;(g=c.value)===null||g===void 0||g.remove()});const u=P(()=>e.flattenColumns.every(g=>g.width&&g.width!==0&&g.width!=="0px")),d=ne([]),f=ne([]);Ve(()=>{const g=e.flattenColumns[e.flattenColumns.length-1],b={fixed:g?g.fixed:null,scrollbar:!0,customHeaderCell:()=>({class:`${i.prefixCls}-cell-scrollbar`})};d.value=l.value?[...e.columns,b]:e.columns,f.value=l.value?[...e.flattenColumns,b]:e.flattenColumns});const h=P(()=>{const{stickyOffsets:g,direction:b}=e,{right:y,left:S}=g;return m(m({},g),{left:b==="rtl"?[...S.map($=>$+l.value),0]:S,right:b==="rtl"?y:[...y.map($=>$+l.value),0],isSticky:i.isSticky})}),v=Sse(We(e,"colWidths"),We(e,"columCount"));return()=>{var g;const{noData:b,columCount:y,stickyTopOffset:S,stickyBottomOffset:$,stickyClassName:w,maxContentScroll:C}=e,{isSticky:O}=i;return p("div",{style:m({overflow:"hidden"},O?{top:`${S}px`,bottom:`${$}px`}:{}),ref:a,class:le(n.class,{[w]:!!w})},[p("table",{style:{tableLayout:"fixed",visibility:b||v.value?null:"hidden"}},[(!b||!C||u.value)&&p(M7,{colWidths:v.value?[...v.value,l.value]:[],columCount:y+1,columns:f.value},null),(g=o.default)===null||g===void 0?void 0:g.call(o,m(m({},e),{stickyOffsets:h.value,columns:d.value,flattenColumns:f.value}))])])}}});function P4(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o[r,We(e,r)])))}const $se=[],Cse={},N0="rc-table-internal-hook",xse=re({name:"VcTable",inheritAttrs:!1,props:["prefixCls","data","columns","rowKey","tableLayout","scroll","rowClassName","title","footer","id","showHeader","components","customRow","customHeaderRow","direction","expandFixed","expandColumnWidth","expandedRowKeys","defaultExpandedRowKeys","expandedRowRender","expandRowByClick","expandIcon","onExpand","onExpandedRowsChange","onUpdate:expandedRowKeys","defaultExpandAllRows","indentSize","expandIconColumnIndex","expandedRowClassName","childrenColumnName","rowExpandable","sticky","transformColumns","internalHooks","internalRefs","canExpandable","onUpdateInternalRefs","transformCellText"],emits:["expand","expandedRowsChange","updateInternalRefs","update:expandedRowKeys"],setup(e,t){let{attrs:n,slots:o,emit:r}=t;const i=P(()=>e.data||$se),l=P(()=>!!i.value.length),a=P(()=>Dae(e.components,{})),s=(de,be)=>S7(a.value,de)||be,c=P(()=>{const de=e.rowKey;return typeof de=="function"?de:be=>be&&be[de]}),u=P(()=>e.expandIcon||vse),d=P(()=>e.childrenColumnName||"children"),f=P(()=>e.expandedRowRender?"row":e.canExpandable||i.value.some(de=>de&&typeof de=="object"&&de[d.value])?"nest":!1),h=oe([]);Ve(()=>{e.defaultExpandedRowKeys&&(h.value=e.defaultExpandedRowKeys),e.defaultExpandAllRows&&(h.value=mse(i.value,c.value,d.value))})();const g=P(()=>new Set(e.expandedRowKeys||h.value||[])),b=de=>{const be=c.value(de,i.value.indexOf(de));let we;const Te=g.value.has(be);Te?(g.value.delete(be),we=[...g.value]):we=[...g.value,be],h.value=we,r("expand",!Te,de),r("update:expandedRowKeys",we),r("expandedRowsChange",we)},y=ne(0),[S,$]=ise(m(m({},nr(e)),{expandable:P(()=>!!e.expandedRowRender),expandedKeys:g,getRowKey:c,onTriggerExpand:b,expandIcon:u}),P(()=>e.internalHooks===N0?e.transformColumns:null)),w=P(()=>({columns:S.value,flattenColumns:$.value})),C=ne(),O=ne(),x=ne(),I=ne({scrollWidth:0,clientWidth:0}),T=ne(),[M,E]=St(!1),[A,R]=St(!1),[z,_]=_7(new Map),D=P(()=>Gh($.value)),N=P(()=>D.value.map(de=>z.value.get(de))),k=P(()=>$.value.length),F=ase(N,k,We(e,"direction")),L=P(()=>e.scroll&&A0(e.scroll.y)),H=P(()=>e.scroll&&A0(e.scroll.x)||!!e.expandFixed),j=P(()=>H.value&&$.value.some(de=>{let{fixed:be}=de;return be})),Y=ne(),Z=yse(We(e,"sticky"),We(e,"prefixCls")),X=ft({}),ee=P(()=>{const de=Object.values(X)[0];return(L.value||Z.value.isSticky)&&de}),U=(de,be)=>{be?X[de]=be:delete X[de]},Q=ne({}),J=ne({}),G=ne({});Ve(()=>{L.value&&(J.value={overflowY:"scroll",maxHeight:pl(e.scroll.y)}),H.value&&(Q.value={overflowX:"auto"},L.value||(J.value={overflowY:"hidden"}),G.value={width:e.scroll.x===!0?"auto":pl(e.scroll.x),minWidth:"100%"})});const q=(de,be)=>{Zp(C.value)&&_(we=>{if(we.get(de)!==be){const Te=new Map(we);return Te.set(de,be),Te}return we})},[V,W]=lse();function te(de,be){if(!be)return;if(typeof be=="function"){be(de);return}const we=be.$el||be;we.scrollLeft!==de&&(we.scrollLeft=de)}const ue=de=>{let{currentTarget:be,scrollLeft:we}=de;var Te;const Re=e.direction==="rtl",Se=typeof we=="number"?we:be.scrollLeft,Ce=be||Cse;if((!W()||W()===Ce)&&(V(Ce),te(Se,O.value),te(Se,x.value),te(Se,T.value),te(Se,(Te=Y.value)===null||Te===void 0?void 0:Te.setScrollLeft)),be){const{scrollWidth:Pe,clientWidth:Me}=be;Re?(E(-Se0)):(E(Se>0),R(Se{H.value&&x.value?ue({currentTarget:x.value}):(E(!1),R(!1))};let ae;const ce=de=>{de!==y.value&&(ie(),y.value=C.value?C.value.offsetWidth:de)},se=de=>{let{width:be}=de;if(clearTimeout(ae),y.value===0){ce(be);return}ae=setTimeout(()=>{ce(be)},100)};ye([H,()=>e.data,()=>e.columns],()=>{H.value&&ie()},{flush:"post"});const[pe,he]=St(0);zae(),Ke(()=>{rt(()=>{var de,be;ie(),he(wL(x.value).width),I.value={scrollWidth:((de=x.value)===null||de===void 0?void 0:de.scrollWidth)||0,clientWidth:((be=x.value)===null||be===void 0?void 0:be.clientWidth)||0}})}),jn(()=>{rt(()=>{var de,be;const we=((de=x.value)===null||de===void 0?void 0:de.scrollWidth)||0,Te=((be=x.value)===null||be===void 0?void 0:be.clientWidth)||0;(I.value.scrollWidth!==we||I.value.clientWidth!==Te)&&(I.value={scrollWidth:we,clientWidth:Te})})}),Ve(()=>{e.internalHooks===N0&&e.internalRefs&&e.onUpdateInternalRefs({body:x.value?x.value.$el||x.value:null})},{flush:"post"});const ge=P(()=>e.tableLayout?e.tableLayout:j.value?e.scroll.x==="max-content"?"auto":"fixed":L.value||Z.value.isSticky||$.value.some(de=>{let{ellipsis:be}=de;return be})?"fixed":"auto"),me=()=>{var de;return l.value?null:((de=o.emptyText)===null||de===void 0?void 0:de.call(o))||"No Data"};Aae(ft(m(m({},nr(P4(e,"prefixCls","direction","transformCellText"))),{getComponent:s,scrollbarSize:pe,fixedInfoList:P(()=>$.value.map((de,be)=>pS(be,be,$.value,F.value,e.direction))),isSticky:P(()=>Z.value.isSticky),summaryCollect:U}))),Jae(ft(m(m({},nr(P4(e,"rowClassName","expandedRowClassName","expandRowByClick","expandedRowRender","expandIconColumnIndex","indentSize"))),{columns:S,flattenColumns:$,tableLayout:ge,expandIcon:u,expandableType:f,onTriggerExpand:b}))),ese({onColumnResize:q}),Xae({componentWidth:y,fixHeader:L,fixColumn:j,horizonScroll:H});const xe=()=>p(nse,{data:i.value,measureColumnWidth:L.value||H.value||Z.value.isSticky,expandedKeys:g.value,rowExpandable:e.rowExpandable,getRowKey:c.value,customRow:e.customRow,childrenColumnName:d.value},{emptyNode:me}),fe=()=>p(M7,{colWidths:$.value.map(de=>{let{width:be}=de;return be}),columns:$.value},null);return()=>{var de;const{prefixCls:be,scroll:we,tableLayout:Te,direction:Re,title:Se=o.title,footer:Ce=o.footer,id:Pe,showHeader:Me,customHeaderRow:De}=e,{isSticky:Ae,offsetHeader:Fe,offsetSummary:lt,offsetScroll:ht,stickyClassName:st,container:gt}=Z.value,yt=s(["table"],"table"),en=s(["body"]),sn=(de=o.summary)===null||de===void 0?void 0:de.call(o,{pageData:i.value});let hn=()=>null;const Gt={colWidths:N.value,columCount:$.value.length,stickyOffsets:F.value,customHeaderRow:De,fixHeader:L.value,scroll:we};if(L.value||Ae){let _o=()=>null;typeof en=="function"?(_o=()=>en(i.value,{scrollbarSize:pe.value,ref:x,onScroll:ue}),Gt.colWidths=$.value.map((oo,el)=>{let{width:_e}=oo;const Je=el===S.value.length-1?_e-pe.value:_e;return typeof Je=="number"&&!Number.isNaN(Je)?Je:0})):_o=()=>p("div",{style:m(m({},Q.value),J.value),onScroll:ue,ref:x,class:le(`${be}-body`)},[p(yt,{style:m(m({},G.value),{tableLayout:ge.value})},{default:()=>[fe(),xe(),!ee.value&&sn&&p(od,{stickyOffsets:F.value,flattenColumns:$.value},{default:()=>[sn]})]})]);const Yo=m(m(m({noData:!i.value.length,maxContentScroll:H.value&&we.x==="max-content"},Gt),w.value),{direction:Re,stickyClassName:st,onScroll:ue});hn=()=>p(Le,null,[Me!==!1&&p(O4,B(B({},Yo),{},{stickyTopOffset:Fe,class:`${be}-header`,ref:O}),{default:oo=>p(Le,null,[p(x4,oo,null),ee.value==="top"&&p(od,oo,{default:()=>[sn]})])}),_o(),ee.value&&ee.value!=="top"&&p(O4,B(B({},Yo),{},{stickyBottomOffset:lt,class:`${be}-summary`,ref:T}),{default:oo=>p(od,oo,{default:()=>[sn]})}),Ae&&x.value&&p(bse,{ref:Y,offsetScroll:ht,scrollBodyRef:x,onScroll:ue,container:gt,scrollBodySizeInfo:I.value},null)])}else hn=()=>p("div",{style:m(m({},Q.value),J.value),class:le(`${be}-content`),onScroll:ue,ref:x},[p(yt,{style:m(m({},G.value),{tableLayout:ge.value})},{default:()=>[fe(),Me!==!1&&p(x4,B(B({},Gt),w.value),null),xe(),sn&&p(od,{stickyOffsets:F.value,flattenColumns:$.value},{default:()=>[sn]})]})]);const An=Ui(n,{aria:!0,data:!0}),no=()=>p("div",B(B({},An),{},{class:le(be,{[`${be}-rtl`]:Re==="rtl",[`${be}-ping-left`]:M.value,[`${be}-ping-right`]:A.value,[`${be}-layout-fixed`]:Te==="fixed",[`${be}-fixed-header`]:L.value,[`${be}-fixed-column`]:j.value,[`${be}-scroll-horizontal`]:H.value,[`${be}-has-fix-left`]:$.value[0]&&$.value[0].fixed,[`${be}-has-fix-right`]:$.value[k.value-1]&&$.value[k.value-1].fixed==="right",[n.class]:n.class}),style:n.style,id:Pe,ref:C}),[Se&&p(B0,{class:`${be}-title`},{default:()=>[Se(i.value)]}),p("div",{class:`${be}-container`},[hn()]),Ce&&p(B0,{class:`${be}-footer`},{default:()=>[Ce(i.value)]})]);return H.value?p(Vo,{onResize:se},{default:no}):no()}}});function wse(){const e=m({},arguments.length<=0?void 0:arguments[0]);for(let t=1;t{const r=n[o];r!==void 0&&(e[o]=r)})}return e}const k0=10;function Ose(e,t){const n={current:e.current,pageSize:e.pageSize};return Object.keys(t&&typeof t=="object"?t:{}).forEach(r=>{const i=e[r];typeof i!="function"&&(n[r]=i)}),n}function Pse(e,t,n){const o=P(()=>t.value&&typeof t.value=="object"?t.value:{}),r=P(()=>o.value.total||0),[i,l]=St(()=>({current:"defaultCurrent"in o.value?o.value.defaultCurrent:1,pageSize:"defaultPageSize"in o.value?o.value.defaultPageSize:k0})),a=P(()=>{const u=wse(i.value,o.value,{total:r.value>0?r.value:e.value}),d=Math.ceil((r.value||e.value)/u.pageSize);return u.current>d&&(u.current=d||1),u}),s=(u,d)=>{t.value!==!1&&l({current:u??1,pageSize:d||a.value.pageSize})},c=(u,d)=>{var f,h;t.value&&((h=(f=o.value).onChange)===null||h===void 0||h.call(f,u,d)),s(u,d),n(u,d||a.value.pageSize)};return[P(()=>t.value===!1?{}:m(m({},a.value),{onChange:c})),s]}function Ise(e,t,n){const o=oe({});ye([e,t,n],()=>{const i=new Map,l=n.value,a=t.value;function s(c){c.forEach((u,d)=>{const f=l(u,d);i.set(f,u),u&&typeof u=="object"&&a in u&&s(u[a]||[])})}s(e.value),o.value={kvMap:i}},{deep:!0,immediate:!0});function r(i){return o.value.kvMap.get(i)}return[r]}const Wr={},F0="SELECT_ALL",L0="SELECT_INVERT",z0="SELECT_NONE",Tse=[];function R7(e,t){let n=[];return(t||[]).forEach(o=>{n.push(o),o&&typeof o=="object"&&e in o&&(n=[...n,...R7(e,o[e])])}),n}function Ese(e,t){const n=P(()=>{const T=e.value||{},{checkStrictly:M=!0}=T;return m(m({},T),{checkStrictly:M})}),[o,r]=Dt(n.value.selectedRowKeys||n.value.defaultSelectedRowKeys||Tse,{value:P(()=>n.value.selectedRowKeys)}),i=oe(new Map),l=T=>{if(n.value.preserveSelectedRowKeys){const M=new Map;T.forEach(E=>{let A=t.getRecordByKey(E);!A&&i.value.has(E)&&(A=i.value.get(E)),M.set(E,A)}),i.value=M}};Ve(()=>{l(o.value)});const a=P(()=>n.value.checkStrictly?null:du(t.data.value,{externalGetKey:t.getRowKey.value,childrenPropName:t.childrenColumnName.value}).keyEntities),s=P(()=>R7(t.childrenColumnName.value,t.pageData.value)),c=P(()=>{const T=new Map,M=t.getRowKey.value,E=n.value.getCheckboxProps;return s.value.forEach((A,R)=>{const z=M(A,R),_=(E?E(A):null)||{};T.set(z,_)}),T}),{maxLevel:u,levelEntities:d}=Rh(a),f=T=>{var M;return!!(!((M=c.value.get(t.getRowKey.value(T)))===null||M===void 0)&&M.disabled)},h=P(()=>{if(n.value.checkStrictly)return[o.value||[],[]];const{checkedKeys:T,halfCheckedKeys:M}=Ho(o.value,!0,a.value,u.value,d.value,f);return[T||[],M]}),v=P(()=>h.value[0]),g=P(()=>h.value[1]),b=P(()=>{const T=n.value.type==="radio"?v.value.slice(0,1):v.value;return new Set(T)}),y=P(()=>n.value.type==="radio"?new Set:new Set(g.value)),[S,$]=St(null),w=T=>{let M,E;l(T);const{preserveSelectedRowKeys:A,onChange:R}=n.value,{getRecordByKey:z}=t;A?(M=T,E=T.map(_=>i.value.get(_))):(M=[],E=[],T.forEach(_=>{const D=z(_);D!==void 0&&(M.push(_),E.push(D))})),r(M),R==null||R(M,E)},C=(T,M,E,A)=>{const{onSelect:R}=n.value,{getRecordByKey:z}=t||{};if(R){const _=E.map(D=>z(D));R(z(T),M,_,A)}w(E)},O=P(()=>{const{onSelectInvert:T,onSelectNone:M,selections:E,hideSelectAll:A}=n.value,{data:R,pageData:z,getRowKey:_,locale:D}=t;return!E||A?null:(E===!0?[F0,L0,z0]:E).map(k=>k===F0?{key:"all",text:D.value.selectionAll,onSelect(){w(R.value.map((F,L)=>_.value(F,L)).filter(F=>{const L=c.value.get(F);return!(L!=null&&L.disabled)||b.value.has(F)}))}}:k===L0?{key:"invert",text:D.value.selectInvert,onSelect(){const F=new Set(b.value);z.value.forEach((H,j)=>{const Y=_.value(H,j),Z=c.value.get(Y);Z!=null&&Z.disabled||(F.has(Y)?F.delete(Y):F.add(Y))});const L=Array.from(F);T&&(Mt(!1,"Table","`onSelectInvert` will be removed in future. Please use `onChange` instead."),T(L)),w(L)}}:k===z0?{key:"none",text:D.value.selectNone,onSelect(){M==null||M(),w(Array.from(b.value).filter(F=>{const L=c.value.get(F);return L==null?void 0:L.disabled}))}}:k)}),x=P(()=>s.value.length);return[T=>{var M;const{onSelectAll:E,onSelectMultiple:A,columnWidth:R,type:z,fixed:_,renderCell:D,hideSelectAll:N,checkStrictly:k}=n.value,{prefixCls:F,getRecordByKey:L,getRowKey:H,expandType:j,getPopupContainer:Y}=t;if(!e.value)return T.filter(ce=>ce!==Wr);let Z=T.slice();const X=new Set(b.value),ee=s.value.map(H.value).filter(ce=>!c.value.get(ce).disabled),U=ee.every(ce=>X.has(ce)),Q=ee.some(ce=>X.has(ce)),J=()=>{const ce=[];U?ee.forEach(pe=>{X.delete(pe),ce.push(pe)}):ee.forEach(pe=>{X.has(pe)||(X.add(pe),ce.push(pe))});const se=Array.from(X);E==null||E(!U,se.map(pe=>L(pe)),ce.map(pe=>L(pe))),w(se)};let G;if(z!=="radio"){let ce;if(O.value){const me=p(Xt,{getPopupContainer:Y.value},{default:()=>[O.value.map((xe,fe)=>{const{key:de,text:be,onSelect:we}=xe;return p(Xt.Item,{key:de||fe,onClick:()=>{we==null||we(ee)}},{default:()=>[be]})})]});ce=p("div",{class:`${F.value}-selection-extra`},[p(rr,{overlay:me,getPopupContainer:Y.value},{default:()=>[p("span",null,[p(Jl,null,null)])]})])}const se=s.value.map((me,xe)=>{const fe=H.value(me,xe),de=c.value.get(fe)||{};return m({checked:X.has(fe)},de)}).filter(me=>{let{disabled:xe}=me;return xe}),pe=!!se.length&&se.length===x.value,he=pe&&se.every(me=>{let{checked:xe}=me;return xe}),ge=pe&&se.some(me=>{let{checked:xe}=me;return xe});G=!N&&p("div",{class:`${F.value}-selection`},[p(jo,{checked:pe?he:!!x.value&&U,indeterminate:pe?!he&&ge:!U&&Q,onChange:J,disabled:x.value===0||pe,"aria-label":ce?"Custom selection":"Select all",skipGroup:!0},null),ce])}let q;z==="radio"?q=ce=>{let{record:se,index:pe}=ce;const he=H.value(se,pe),ge=X.has(he);return{node:p(Xn,B(B({},c.value.get(he)),{},{checked:ge,onClick:me=>me.stopPropagation(),onChange:me=>{X.has(he)||C(he,!0,[he],me.nativeEvent)}}),null),checked:ge}}:q=ce=>{let{record:se,index:pe}=ce;var he;const ge=H.value(se,pe),me=X.has(ge),xe=y.value.has(ge),fe=c.value.get(ge);let de;return j.value==="nest"?(de=xe,Mt(typeof(fe==null?void 0:fe.indeterminate)!="boolean","Table","set `indeterminate` using `rowSelection.getCheckboxProps` is not allowed with tree structured dataSource.")):de=(he=fe==null?void 0:fe.indeterminate)!==null&&he!==void 0?he:xe,{node:p(jo,B(B({},fe),{},{indeterminate:de,checked:me,skipGroup:!0,onClick:be=>be.stopPropagation(),onChange:be=>{let{nativeEvent:we}=be;const{shiftKey:Te}=we;let Re=-1,Se=-1;if(Te&&k){const Ce=new Set([S.value,ge]);ee.some((Pe,Me)=>{if(Ce.has(Pe))if(Re===-1)Re=Me;else return Se=Me,!0;return!1})}if(Se!==-1&&Re!==Se&&k){const Ce=ee.slice(Re,Se+1),Pe=[];me?Ce.forEach(De=>{X.has(De)&&(Pe.push(De),X.delete(De))}):Ce.forEach(De=>{X.has(De)||(Pe.push(De),X.add(De))});const Me=Array.from(X);A==null||A(!me,Me.map(De=>L(De)),Pe.map(De=>L(De))),w(Me)}else{const Ce=v.value;if(k){const Pe=me?$r(Ce,ge):jr(Ce,ge);C(ge,!me,Pe,we)}else{const Pe=Ho([...Ce,ge],!0,a.value,u.value,d.value,f),{checkedKeys:Me,halfCheckedKeys:De}=Pe;let Ae=Me;if(me){const Fe=new Set(Me);Fe.delete(ge),Ae=Ho(Array.from(Fe),{halfCheckedKeys:De},a.value,u.value,d.value,f).checkedKeys}C(ge,!me,Ae,we)}}$(ge)}}),null),checked:me}};const V=ce=>{let{record:se,index:pe}=ce;const{node:he,checked:ge}=q({record:se,index:pe});return D?D(ge,se,pe,he):he};if(!Z.includes(Wr))if(Z.findIndex(ce=>{var se;return((se=ce[Wa])===null||se===void 0?void 0:se.columnType)==="EXPAND_COLUMN"})===0){const[ce,...se]=Z;Z=[ce,Wr,...se]}else Z=[Wr,...Z];const W=Z.indexOf(Wr);Z=Z.filter((ce,se)=>ce!==Wr||se===W);const te=Z[W-1],ue=Z[W+1];let ie=_;ie===void 0&&((ue==null?void 0:ue.fixed)!==void 0?ie=ue.fixed:(te==null?void 0:te.fixed)!==void 0&&(ie=te.fixed)),ie&&te&&((M=te[Wa])===null||M===void 0?void 0:M.columnType)==="EXPAND_COLUMN"&&te.fixed===void 0&&(te.fixed=ie);const ae={fixed:ie,width:R,className:`${F.value}-selection-column`,title:n.value.columnTitle||G,customRender:V,[Wa]:{class:`${F.value}-selection-col`}};return Z.map(ce=>ce===Wr?ae:ce)},b]}var _se={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"outlined"};function I4(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:[];const t=wt(e),n=[];return t.forEach(o=>{var r,i,l,a;if(!o)return;const s=o.key,c=((r=o.props)===null||r===void 0?void 0:r.style)||{},u=((i=o.props)===null||i===void 0?void 0:i.class)||"",d=o.props||{};for(const[b,y]of Object.entries(d))d[rs(b)]=y;const f=o.children||{},{default:h}=f,v=Dse(f,["default"]),g=m(m(m({},v),d),{style:c,class:u});if(s&&(g.key=s),!((l=o.type)===null||l===void 0)&&l.__ANT_TABLE_COLUMN_GROUP)g.children=D7(typeof h=="function"?h():h);else{const b=(a=o.children)===null||a===void 0?void 0:a.default;g.customRender=g.customRender||b}n.push(g)}),n}const Zd="ascend",Wv="descend";function mp(e){return typeof e.sorter=="object"&&typeof e.sorter.multiple=="number"?e.sorter.multiple:!1}function E4(e){return typeof e=="function"?e:e&&typeof e=="object"&&e.compare?e.compare:!1}function Bse(e,t){return t?e[e.indexOf(t)+1]:e[0]}function H0(e,t,n){let o=[];function r(i,l){o.push({column:i,key:Hl(i,l),multiplePriority:mp(i),sortOrder:i.sortOrder})}return(e||[]).forEach((i,l)=>{const a=mu(l,n);i.children?("sortOrder"in i&&r(i,a),o=[...o,...H0(i.children,t,a)]):i.sorter&&("sortOrder"in i?r(i,a):t&&i.defaultSortOrder&&o.push({column:i,key:Hl(i,a),multiplePriority:mp(i),sortOrder:i.defaultSortOrder}))}),o}function B7(e,t,n,o,r,i,l,a){return(t||[]).map((s,c)=>{const u=mu(c,a);let d=s;if(d.sorter){const f=d.sortDirections||r,h=d.showSorterTooltip===void 0?l:d.showSorterTooltip,v=Hl(d,u),g=n.find(T=>{let{key:M}=T;return M===v}),b=g?g.sortOrder:null,y=Bse(f,b),S=f.includes(Zd)&&p(gS,{class:le(`${e}-column-sorter-up`,{active:b===Zd}),role:"presentation"},null),$=f.includes(Wv)&&p(hS,{role:"presentation",class:le(`${e}-column-sorter-down`,{active:b===Wv})},null),{cancelSort:w,triggerAsc:C,triggerDesc:O}=i||{};let x=w;y===Wv?x=O:y===Zd&&(x=C);const I=typeof h=="object"?h:{title:x};d=m(m({},d),{className:le(d.className,{[`${e}-column-sort`]:b}),title:T=>{const M=p("div",{class:`${e}-column-sorters`},[p("span",{class:`${e}-column-title`},[vS(s.title,T)]),p("span",{class:le(`${e}-column-sorter`,{[`${e}-column-sorter-full`]:!!(S&&$)})},[p("span",{class:`${e}-column-sorter-inner`},[S,$])])]);return h?p(co,I,{default:()=>[M]}):M},customHeaderCell:T=>{const M=s.customHeaderCell&&s.customHeaderCell(T)||{},E=M.onClick,A=M.onKeydown;return M.onClick=R=>{o({column:s,key:v,sortOrder:y,multiplePriority:mp(s)}),E&&E(R)},M.onKeydown=R=>{R.keyCode===Ie.ENTER&&(o({column:s,key:v,sortOrder:y,multiplePriority:mp(s)}),A==null||A(R))},b&&(M["aria-sort"]=b==="ascend"?"ascending":"descending"),M.class=le(M.class,`${e}-column-has-sorters`),M.tabindex=0,M}})}return"children"in d&&(d=m(m({},d),{children:B7(e,d.children,n,o,r,i,l,u)})),d})}function _4(e){const{column:t,sortOrder:n}=e;return{column:t,order:n,field:t.dataIndex,columnKey:t.key}}function M4(e){const t=e.filter(n=>{let{sortOrder:o}=n;return o}).map(_4);return t.length===0&&e.length?m(m({},_4(e[e.length-1])),{column:void 0}):t.length<=1?t[0]||{}:t}function j0(e,t,n){const o=t.slice().sort((l,a)=>a.multiplePriority-l.multiplePriority),r=e.slice(),i=o.filter(l=>{let{column:{sorter:a},sortOrder:s}=l;return E4(a)&&s});return i.length?r.sort((l,a)=>{for(let s=0;s{const a=l[n];return a?m(m({},l),{[n]:j0(a,t,n)}):l}):r}function Nse(e){let{prefixCls:t,mergedColumns:n,onSorterChange:o,sortDirections:r,tableLocale:i,showSorterTooltip:l}=e;const[a,s]=St(H0(n.value,!0)),c=P(()=>{let v=!0;const g=H0(n.value,!1);if(!g.length)return a.value;const b=[];function y($){v?b.push($):b.push(m(m({},$),{sortOrder:null}))}let S=null;return g.forEach($=>{S===null?(y($),$.sortOrder&&($.multiplePriority===!1?v=!1:S=!0)):(S&&$.multiplePriority!==!1||(v=!1),y($))}),b}),u=P(()=>{const v=c.value.map(g=>{let{column:b,sortOrder:y}=g;return{column:b,order:y}});return{sortColumns:v,sortColumn:v[0]&&v[0].column,sortOrder:v[0]&&v[0].order}});function d(v){let g;v.multiplePriority===!1||!c.value.length||c.value[0].multiplePriority===!1?g=[v]:g=[...c.value.filter(b=>{let{key:y}=b;return y!==v.key}),v],s(g),o(M4(g),g)}const f=v=>B7(t.value,v,c.value,d,r.value,i.value,l.value),h=P(()=>M4(c.value));return[f,c,u,h]}var kse={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}}]},name:"filter",theme:"filled"};function A4(e){for(var t=1;t{const{keyCode:t}=e;t===Ie.ENTER&&e.stopPropagation()},zse=(e,t)=>{let{slots:n}=t;var o;return p("div",{onClick:r=>r.stopPropagation(),onKeydown:Lse},[(o=n.default)===null||o===void 0?void 0:o.call(n)])},R4=re({compatConfig:{MODE:3},name:"FilterSearch",inheritAttrs:!1,props:{value:Ne(),onChange:ve(),filterSearch:He([Boolean,Function]),tablePrefixCls:Ne(),locale:Be()},setup(e){return()=>{const{value:t,onChange:n,filterSearch:o,tablePrefixCls:r,locale:i}=e;return o?p("div",{class:`${r}-filter-dropdown-search`},[p(un,{placeholder:i.filterSearchPlaceholder,onChange:n,value:t,htmlSize:1,class:`${r}-filter-dropdown-search-input`},{prefix:()=>p(Ar,null,null)})]):null}}});var D4=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);re.motion?e.motion:ru()),s=(c,u)=>{var d,f,h,v;u==="appear"?(f=(d=a.value)===null||d===void 0?void 0:d.onAfterEnter)===null||f===void 0||f.call(d,c):u==="leave"&&((v=(h=a.value)===null||h===void 0?void 0:h.onAfterLeave)===null||v===void 0||v.call(h,c)),l.value||e.onMotionEnd(),l.value=!0};return ye(()=>e.motionNodes,()=>{e.motionNodes&&e.motionType==="hide"&&r.value&&rt(()=>{r.value=!1})},{immediate:!0,flush:"post"}),Ke(()=>{e.motionNodes&&e.onMotionStart()}),et(()=>{e.motionNodes&&s()}),()=>{const{motion:c,motionNodes:u,motionType:d,active:f,eventKey:h}=e,v=D4(e,["motion","motionNodes","motionType","active","eventKey"]);return u?p(bn,B(B({},a.value),{},{appear:d==="show",onAfterAppear:g=>s(g,"appear"),onAfterLeave:g=>s(g,"leave")}),{default:()=>[Ln(p("div",{class:`${i.value.prefixCls}-treenode-motion`},[u.map(g=>{const b=D4(g.data,[]),{title:y,key:S,isStart:$,isEnd:w}=g;return delete b.children,p(f0,B(B({},b),{},{title:y,active:f,data:g.data,key:S,eventKey:S,isStart:$,isEnd:w}),o)})]),[[Qn,r.value]])]}):p(f0,B(B({class:n.class,style:n.style},v),{},{active:f,eventKey:h}),o)}}});function jse(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const n=e.length,o=t.length;if(Math.abs(n-o)!==1)return{add:!1,key:null};function r(i,l){const a=new Map;i.forEach(c=>{a.set(c,!0)});const s=l.filter(c=>!a.has(c));return s.length===1?s[0]:null}return nl.key===n),r=e[o+1],i=t.findIndex(l=>l.key===n);if(r){const l=t.findIndex(a=>a.key===r.key);return t.slice(i+1,l)}return t.slice(i+1)}var N4=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{},jl=`RC_TREE_MOTION_${Math.random()}`,V0={key:jl},N7={key:jl,level:0,index:0,pos:"0",node:V0,nodes:[V0]},F4={parent:null,children:[],pos:N7.pos,data:V0,title:null,key:jl,isStart:[],isEnd:[]};function L4(e,t,n,o){return t===!1||!n?e:e.slice(0,Math.ceil(n/o)+1)}function z4(e){const{key:t,pos:n}=e;return uu(t,n)}function Wse(e){let t=String(e.key),n=e;for(;n.parent;)n=n.parent,t=`${n.key} > ${t}`;return t}const Kse=re({compatConfig:{MODE:3},name:"NodeList",inheritAttrs:!1,props:YJ,setup(e,t){let{expose:n,attrs:o}=t;const r=ne(),i=ne(),{expandedKeys:l,flattenNodes:a}=pT();n({scrollTo:g=>{r.value.scrollTo(g)},getIndentWidth:()=>i.value.offsetWidth});const s=oe(a.value),c=oe([]),u=ne(null);function d(){s.value=a.value,c.value=[],u.value=null,e.onListChangeEnd()}const f=M1();ye([()=>l.value.slice(),a],(g,b)=>{let[y,S]=g,[$,w]=b;const C=jse($,y);if(C.key!==null){const{virtual:O,height:x,itemHeight:I}=e;if(C.add){const T=w.findIndex(A=>{let{key:R}=A;return R===C.key}),M=L4(B4(w,S,C.key),O,x,I),E=w.slice();E.splice(T+1,0,F4),s.value=E,c.value=M,u.value="show"}else{const T=S.findIndex(A=>{let{key:R}=A;return R===C.key}),M=L4(B4(S,w,C.key),O,x,I),E=S.slice();E.splice(T+1,0,F4),s.value=E,c.value=M,u.value="hide"}}else w!==S&&(s.value=S)}),ye(()=>f.value.dragging,g=>{g||d()});const h=P(()=>e.motion===void 0?s.value:a.value),v=()=>{e.onActiveChange(null)};return()=>{const g=m(m({},e),o),{prefixCls:b,selectable:y,checkable:S,disabled:$,motion:w,height:C,itemHeight:O,virtual:x,focusable:I,activeItem:T,focused:M,tabindex:E,onKeydown:A,onFocus:R,onBlur:z,onListChangeStart:_,onListChangeEnd:D}=g,N=N4(g,["prefixCls","selectable","checkable","disabled","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabindex","onKeydown","onFocus","onBlur","onListChangeStart","onListChangeEnd"]);return p(Le,null,[M&&T&&p("span",{style:k4,"aria-live":"assertive"},[Wse(T)]),p("div",null,[p("input",{style:k4,disabled:I===!1||$,tabindex:I!==!1?E:null,onKeydown:A,onFocus:R,onBlur:z,value:"",onChange:Vse,"aria-label":"for screen reader"},null)]),p("div",{class:`${b}-treenode`,"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden"}},[p("div",{class:`${b}-indent`},[p("div",{ref:i,class:`${b}-indent-unit`},null)])]),p(r5,B(B({},ot(N,["onActiveChange"])),{},{data:h.value,itemKey:z4,height:C,fullHeight:!1,virtual:x,itemHeight:O,prefixCls:`${b}-list`,ref:r,onVisibleChange:(k,F)=>{const L=new Set(k);F.filter(j=>!L.has(j)).some(j=>z4(j)===jl)&&d()}}),{default:k=>{const{pos:F}=k,L=N4(k.data,[]),{title:H,key:j,isStart:Y,isEnd:Z}=k,X=uu(j,F);return delete L.key,delete L.children,p(Hse,B(B({},L),{},{eventKey:X,title:H,active:!!T&&j===T.key,data:k.data,isStart:Y,isEnd:Z,motion:w,motionNodes:j===jl?c.value:null,motionType:u.value,onMotionStart:_,onMotionEnd:d,onMousemove:v}),null)}})])}}});function Gse(e){let{dropPosition:t,dropLevelOffset:n,indent:o}=e;const r={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:"2px"};switch(t){case-1:r.top=0,r.left=`${-n*o}px`;break;case 1:r.bottom=0,r.left=`${-n*o}px`;break;case 0:r.bottom=0,r.left=`${o}`;break}return p("div",{style:r},null)}const Use=10,k7=re({compatConfig:{MODE:3},name:"Tree",inheritAttrs:!1,props:Qe(gT(),{prefixCls:"vc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,expandAction:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:Gse,allowDrop:()=>!0}),setup(e,t){let{attrs:n,slots:o,expose:r}=t;const i=oe(!1);let l={};const a=oe(),s=oe([]),c=oe([]),u=oe([]),d=oe([]),f=oe([]),h=oe([]),v={},g=ft({draggingNodeKey:null,dragChildrenKeys:[],dropTargetKey:null,dropPosition:null,dropContainerKey:null,dropLevelOffset:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null}),b=oe([]);ye([()=>e.treeData,()=>e.children],()=>{b.value=e.treeData!==void 0?e.treeData.slice():h0(tt(e.children))},{immediate:!0,deep:!0});const y=oe({}),S=oe(!1),$=oe(null),w=oe(!1),C=P(()=>Eh(e.fieldNames)),O=oe();let x=null,I=null,T=null;const M=P(()=>({expandedKeysSet:E.value,selectedKeysSet:A.value,loadedKeysSet:R.value,loadingKeysSet:z.value,checkedKeysSet:_.value,halfCheckedKeysSet:D.value,dragOverNodeKey:g.dragOverNodeKey,dropPosition:g.dropPosition,keyEntities:y.value})),E=P(()=>new Set(h.value)),A=P(()=>new Set(s.value)),R=P(()=>new Set(d.value)),z=P(()=>new Set(f.value)),_=P(()=>new Set(c.value)),D=P(()=>new Set(u.value));Ve(()=>{if(b.value){const Se=du(b.value,{fieldNames:C.value});y.value=m({[jl]:N7},Se.keyEntities)}});let N=!1;ye([()=>e.expandedKeys,()=>e.autoExpandParent,y],(Se,Ce)=>{let[Pe,Me]=Se,[De,Ae]=Ce,Fe=h.value;if(e.expandedKeys!==void 0||N&&Me!==Ae)Fe=e.autoExpandParent||!N&&e.defaultExpandParent?p0(e.expandedKeys,y.value):e.expandedKeys;else if(!N&&e.defaultExpandAll){const lt=m({},y.value);delete lt[jl],Fe=Object.keys(lt).map(ht=>lt[ht].key)}else!N&&e.defaultExpandedKeys&&(Fe=e.autoExpandParent||e.defaultExpandParent?p0(e.defaultExpandedKeys,y.value):e.defaultExpandedKeys);Fe&&(h.value=Fe),N=!0},{immediate:!0});const k=oe([]);Ve(()=>{k.value=oZ(b.value,h.value,C.value)}),Ve(()=>{e.selectable&&(e.selectedKeys!==void 0?s.value=Jw(e.selectedKeys,e):!N&&e.defaultSelectedKeys&&(s.value=Jw(e.defaultSelectedKeys,e)))});const{maxLevel:F,levelEntities:L}=Rh(y);Ve(()=>{if(e.checkable){let Se;if(e.checkedKeys!==void 0?Se=Pv(e.checkedKeys)||{}:!N&&e.defaultCheckedKeys?Se=Pv(e.defaultCheckedKeys)||{}:b.value&&(Se=Pv(e.checkedKeys)||{checkedKeys:c.value,halfCheckedKeys:u.value}),Se){let{checkedKeys:Ce=[],halfCheckedKeys:Pe=[]}=Se;e.checkStrictly||({checkedKeys:Ce,halfCheckedKeys:Pe}=Ho(Ce,!0,y.value,F.value,L.value)),c.value=Ce,u.value=Pe}}}),Ve(()=>{e.loadedKeys&&(d.value=e.loadedKeys)});const H=()=>{m(g,{dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})},j=Se=>{O.value.scrollTo(Se)};ye(()=>e.activeKey,()=>{e.activeKey!==void 0&&($.value=e.activeKey)},{immediate:!0}),ye($,Se=>{rt(()=>{Se!==null&&j({key:Se})})},{immediate:!0,flush:"post"});const Y=Se=>{e.expandedKeys===void 0&&(h.value=Se)},Z=()=>{g.draggingNodeKey!==null&&m(g,{draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),x=null,T=null},X=(Se,Ce)=>{const{onDragend:Pe}=e;g.dragOverNodeKey=null,Z(),Pe==null||Pe({event:Se,node:Ce.eventData}),I=null},ee=Se=>{X(Se,null),window.removeEventListener("dragend",ee)},U=(Se,Ce)=>{const{onDragstart:Pe}=e,{eventKey:Me,eventData:De}=Ce;I=Ce,x={x:Se.clientX,y:Se.clientY};const Ae=$r(h.value,Me);g.draggingNodeKey=Me,g.dragChildrenKeys=QJ(Me,y.value),a.value=O.value.getIndentWidth(),Y(Ae),window.addEventListener("dragend",ee),Pe&&Pe({event:Se,node:De})},Q=(Se,Ce)=>{const{onDragenter:Pe,onExpand:Me,allowDrop:De,direction:Ae}=e,{pos:Fe,eventKey:lt}=Ce;if(T!==lt&&(T=lt),!I){H();return}const{dropPosition:ht,dropLevelOffset:st,dropTargetKey:gt,dropContainerKey:yt,dropTargetPos:en,dropAllowed:sn,dragOverNodeKey:hn}=qw(Se,I,Ce,a.value,x,De,k.value,y.value,E.value,Ae);if(g.dragChildrenKeys.indexOf(gt)!==-1||!sn){H();return}if(l||(l={}),Object.keys(l).forEach(Gt=>{clearTimeout(l[Gt])}),I.eventKey!==Ce.eventKey&&(l[Fe]=window.setTimeout(()=>{if(g.draggingNodeKey===null)return;let Gt=h.value.slice();const An=y.value[Ce.eventKey];An&&(An.children||[]).length&&(Gt=jr(h.value,Ce.eventKey)),Y(Gt),Me&&Me(Gt,{node:Ce.eventData,expanded:!0,nativeEvent:Se})},800)),I.eventKey===gt&&st===0){H();return}m(g,{dragOverNodeKey:hn,dropPosition:ht,dropLevelOffset:st,dropTargetKey:gt,dropContainerKey:yt,dropTargetPos:en,dropAllowed:sn}),Pe&&Pe({event:Se,node:Ce.eventData,expandedKeys:h.value})},J=(Se,Ce)=>{const{onDragover:Pe,allowDrop:Me,direction:De}=e;if(!I)return;const{dropPosition:Ae,dropLevelOffset:Fe,dropTargetKey:lt,dropContainerKey:ht,dropAllowed:st,dropTargetPos:gt,dragOverNodeKey:yt}=qw(Se,I,Ce,a.value,x,Me,k.value,y.value,E.value,De);g.dragChildrenKeys.indexOf(lt)!==-1||!st||(I.eventKey===lt&&Fe===0?g.dropPosition===null&&g.dropLevelOffset===null&&g.dropTargetKey===null&&g.dropContainerKey===null&&g.dropTargetPos===null&&g.dropAllowed===!1&&g.dragOverNodeKey===null||H():Ae===g.dropPosition&&Fe===g.dropLevelOffset&<===g.dropTargetKey&&ht===g.dropContainerKey&>===g.dropTargetPos&&st===g.dropAllowed&&yt===g.dragOverNodeKey||m(g,{dropPosition:Ae,dropLevelOffset:Fe,dropTargetKey:lt,dropContainerKey:ht,dropTargetPos:gt,dropAllowed:st,dragOverNodeKey:yt}),Pe&&Pe({event:Se,node:Ce.eventData}))},G=(Se,Ce)=>{T===Ce.eventKey&&!Se.currentTarget.contains(Se.relatedTarget)&&(H(),T=null);const{onDragleave:Pe}=e;Pe&&Pe({event:Se,node:Ce.eventData})},q=function(Se,Ce){let Pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;var Me;const{dragChildrenKeys:De,dropPosition:Ae,dropTargetKey:Fe,dropTargetPos:lt,dropAllowed:ht}=g;if(!ht)return;const{onDrop:st}=e;if(g.dragOverNodeKey=null,Z(),Fe===null)return;const gt=m(m({},Bd(Fe,tt(M.value))),{active:((Me=be.value)===null||Me===void 0?void 0:Me.key)===Fe,data:y.value[Fe].node});De.indexOf(Fe);const yt=A1(lt),en={event:Se,node:Nd(gt),dragNode:I?I.eventData:null,dragNodesKeys:[I.eventKey].concat(De),dropToGap:Ae!==0,dropPosition:Ae+Number(yt[yt.length-1])};Pe||st==null||st(en),I=null},V=(Se,Ce)=>{const{expanded:Pe,key:Me}=Ce,De=k.value.filter(Fe=>Fe.key===Me)[0],Ae=Nd(m(m({},Bd(Me,M.value)),{data:De.data}));Y(Pe?$r(h.value,Me):jr(h.value,Me)),me(Se,Ae)},W=(Se,Ce)=>{const{onClick:Pe,expandAction:Me}=e;Me==="click"&&V(Se,Ce),Pe&&Pe(Se,Ce)},te=(Se,Ce)=>{const{onDblclick:Pe,expandAction:Me}=e;(Me==="doubleclick"||Me==="dblclick")&&V(Se,Ce),Pe&&Pe(Se,Ce)},ue=(Se,Ce)=>{let Pe=s.value;const{onSelect:Me,multiple:De}=e,{selected:Ae}=Ce,Fe=Ce[C.value.key],lt=!Ae;lt?De?Pe=jr(Pe,Fe):Pe=[Fe]:Pe=$r(Pe,Fe);const ht=y.value,st=Pe.map(gt=>{const yt=ht[gt];return yt?yt.node:null}).filter(gt=>gt);e.selectedKeys===void 0&&(s.value=Pe),Me&&Me(Pe,{event:"select",selected:lt,node:Ce,selectedNodes:st,nativeEvent:Se})},ie=(Se,Ce,Pe)=>{const{checkStrictly:Me,onCheck:De}=e,Ae=Ce[C.value.key];let Fe;const lt={event:"check",node:Ce,checked:Pe,nativeEvent:Se},ht=y.value;if(Me){const st=Pe?jr(c.value,Ae):$r(c.value,Ae),gt=$r(u.value,Ae);Fe={checked:st,halfChecked:gt},lt.checkedNodes=st.map(yt=>ht[yt]).filter(yt=>yt).map(yt=>yt.node),e.checkedKeys===void 0&&(c.value=st)}else{let{checkedKeys:st,halfCheckedKeys:gt}=Ho([...c.value,Ae],!0,ht,F.value,L.value);if(!Pe){const yt=new Set(st);yt.delete(Ae),{checkedKeys:st,halfCheckedKeys:gt}=Ho(Array.from(yt),{halfCheckedKeys:gt},ht,F.value,L.value)}Fe=st,lt.checkedNodes=[],lt.checkedNodesPositions=[],lt.halfCheckedKeys=gt,st.forEach(yt=>{const en=ht[yt];if(!en)return;const{node:sn,pos:hn}=en;lt.checkedNodes.push(sn),lt.checkedNodesPositions.push({node:sn,pos:hn})}),e.checkedKeys===void 0&&(c.value=st,u.value=gt)}De&&De(Fe,lt)},ae=Se=>{const Ce=Se[C.value.key],Pe=new Promise((Me,De)=>{const{loadData:Ae,onLoad:Fe}=e;if(!Ae||R.value.has(Ce)||z.value.has(Ce))return null;Ae(Se).then(()=>{const ht=jr(d.value,Ce),st=$r(f.value,Ce);Fe&&Fe(ht,{event:"load",node:Se}),e.loadedKeys===void 0&&(d.value=ht),f.value=st,Me()}).catch(ht=>{const st=$r(f.value,Ce);if(f.value=st,v[Ce]=(v[Ce]||0)+1,v[Ce]>=Use){const gt=jr(d.value,Ce);e.loadedKeys===void 0&&(d.value=gt),Me()}De(ht)}),f.value=jr(f.value,Ce)});return Pe.catch(()=>{}),Pe},ce=(Se,Ce)=>{const{onMouseenter:Pe}=e;Pe&&Pe({event:Se,node:Ce})},se=(Se,Ce)=>{const{onMouseleave:Pe}=e;Pe&&Pe({event:Se,node:Ce})},pe=(Se,Ce)=>{const{onRightClick:Pe}=e;Pe&&(Se.preventDefault(),Pe({event:Se,node:Ce}))},he=Se=>{const{onFocus:Ce}=e;S.value=!0,Ce&&Ce(Se)},ge=Se=>{const{onBlur:Ce}=e;S.value=!1,de(null),Ce&&Ce(Se)},me=(Se,Ce)=>{let Pe=h.value;const{onExpand:Me,loadData:De}=e,{expanded:Ae}=Ce,Fe=Ce[C.value.key];if(w.value)return;Pe.indexOf(Fe);const lt=!Ae;if(lt?Pe=jr(Pe,Fe):Pe=$r(Pe,Fe),Y(Pe),Me&&Me(Pe,{node:Ce,expanded:lt,nativeEvent:Se}),lt&&De){const ht=ae(Ce);ht&&ht.then(()=>{}).catch(st=>{const gt=$r(h.value,Fe);Y(gt),Promise.reject(st)})}},xe=()=>{w.value=!0},fe=()=>{setTimeout(()=>{w.value=!1})},de=Se=>{const{onActiveChange:Ce}=e;$.value!==Se&&(e.activeKey!==void 0&&($.value=Se),Se!==null&&j({key:Se}),Ce&&Ce(Se))},be=P(()=>$.value===null?null:k.value.find(Se=>{let{key:Ce}=Se;return Ce===$.value})||null),we=Se=>{let Ce=k.value.findIndex(Me=>{let{key:De}=Me;return De===$.value});Ce===-1&&Se<0&&(Ce=k.value.length),Ce=(Ce+Se+k.value.length)%k.value.length;const Pe=k.value[Ce];if(Pe){const{key:Me}=Pe;de(Me)}else de(null)},Te=P(()=>Nd(m(m({},Bd($.value,M.value)),{data:be.value.data,active:!0}))),Re=Se=>{const{onKeydown:Ce,checkable:Pe,selectable:Me}=e;switch(Se.which){case Ie.UP:{we(-1),Se.preventDefault();break}case Ie.DOWN:{we(1),Se.preventDefault();break}}const De=be.value;if(De&&De.data){const Ae=De.data.isLeaf===!1||!!(De.data.children||[]).length,Fe=Te.value;switch(Se.which){case Ie.LEFT:{Ae&&E.value.has($.value)?me({},Fe):De.parent&&de(De.parent.key),Se.preventDefault();break}case Ie.RIGHT:{Ae&&!E.value.has($.value)?me({},Fe):De.children&&De.children.length&&de(De.children[0].key),Se.preventDefault();break}case Ie.ENTER:case Ie.SPACE:{Pe&&!Fe.disabled&&Fe.checkable!==!1&&!Fe.disableCheckbox?ie({},Fe,!_.value.has($.value)):!Pe&&Me&&!Fe.disabled&&Fe.selectable!==!1&&ue({},Fe);break}}}Ce&&Ce(Se)};return r({onNodeExpand:me,scrollTo:j,onKeydown:Re,selectedKeys:P(()=>s.value),checkedKeys:P(()=>c.value),halfCheckedKeys:P(()=>u.value),loadedKeys:P(()=>d.value),loadingKeys:P(()=>f.value),expandedKeys:P(()=>h.value)}),wn(()=>{window.removeEventListener("dragend",ee),i.value=!0}),UJ({expandedKeys:h,selectedKeys:s,loadedKeys:d,loadingKeys:f,checkedKeys:c,halfCheckedKeys:u,expandedKeysSet:E,selectedKeysSet:A,loadedKeysSet:R,loadingKeysSet:z,checkedKeysSet:_,halfCheckedKeysSet:D,flattenNodes:k}),()=>{const{draggingNodeKey:Se,dropLevelOffset:Ce,dropContainerKey:Pe,dropTargetKey:Me,dropPosition:De,dragOverNodeKey:Ae}=g,{prefixCls:Fe,showLine:lt,focusable:ht,tabindex:st=0,selectable:gt,showIcon:yt,icon:en=o.icon,switcherIcon:sn,draggable:hn,checkable:Gt,checkStrictly:An,disabled:no,motion:_o,loadData:Yo,filterTreeNode:oo,height:el,itemHeight:_e,virtual:Je,dropIndicatorRender:Xe,onContextmenu:Et,onScroll:cn,direction:Ut,rootClassName:ro,rootStyle:Pn}=e,{class:vr,style:ho}=n,Mo=Ui(m(m({},e),n),{aria:!0,data:!0});let Ft;return hn?typeof hn=="object"?Ft=hn:typeof hn=="function"?Ft={nodeDraggable:hn}:Ft={}:Ft=!1,p(GJ,{value:{prefixCls:Fe,selectable:gt,showIcon:yt,icon:en,switcherIcon:sn,draggable:Ft,draggingNodeKey:Se,checkable:Gt,customCheckable:o.checkable,checkStrictly:An,disabled:no,keyEntities:y.value,dropLevelOffset:Ce,dropContainerKey:Pe,dropTargetKey:Me,dropPosition:De,dragOverNodeKey:Ae,dragging:Se!==null,indent:a.value,direction:Ut,dropIndicatorRender:Xe,loadData:Yo,filterTreeNode:oo,onNodeClick:W,onNodeDoubleClick:te,onNodeExpand:me,onNodeSelect:ue,onNodeCheck:ie,onNodeLoad:ae,onNodeMouseEnter:ce,onNodeMouseLeave:se,onNodeContextMenu:pe,onNodeDragStart:U,onNodeDragEnter:Q,onNodeDragOver:J,onNodeDragLeave:G,onNodeDragEnd:X,onNodeDrop:q,slots:o}},{default:()=>[p("div",{role:"tree",class:le(Fe,vr,ro,{[`${Fe}-show-line`]:lt,[`${Fe}-focused`]:S.value,[`${Fe}-active-focused`]:$.value!==null}),style:Pn},[p(Kse,B({ref:O,prefixCls:Fe,style:ho,disabled:no,selectable:gt,checkable:!!Gt,motion:_o,height:el,itemHeight:_e,virtual:Je,focusable:ht,focused:S.value,tabindex:st,activeItem:be.value,onFocus:he,onBlur:ge,onKeydown:Re,onActiveChange:de,onListChangeStart:xe,onListChangeEnd:fe,onContextmenu:Et,onScroll:cn},Mo),null)])]})}}});var Xse={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file",theme:"outlined"};function H4(e){for(var t=1;t({[`.${e}-switcher-icon`]:{display:"inline-block",fontSize:10,verticalAlign:"baseline",svg:{transition:`transform ${t.motionDurationSlow}`}}}),ice=(e,t)=>({[`.${e}-drop-indicator`]:{position:"absolute",zIndex:1,height:2,backgroundColor:t.colorPrimary,borderRadius:1,pointerEvents:"none","&:after":{position:"absolute",top:-3,insetInlineStart:-6,width:8,height:8,backgroundColor:"transparent",border:`${t.lineWidthBold}px solid ${t.colorPrimary}`,borderRadius:"50%",content:'""'}}}),lce=(e,t)=>{const{treeCls:n,treeNodeCls:o,treeNodePadding:r,treeTitleHeight:i}=t,l=(i-t.fontSizeLG)/2,a=t.paddingXS;return{[n]:m(m({},qe(t)),{background:t.colorBgContainer,borderRadius:t.borderRadius,transition:`background-color ${t.motionDurationSlow}`,[`&${n}-rtl`]:{[`${n}-switcher`]:{"&_close":{[`${n}-switcher-icon`]:{svg:{transform:"rotate(90deg)"}}}}},[`&-focused:not(:hover):not(${n}-active-focused)`]:m({},ni(t)),[`${n}-list-holder-inner`]:{alignItems:"flex-start"},[`&${n}-block-node`]:{[`${n}-list-holder-inner`]:{alignItems:"stretch",[`${n}-node-content-wrapper`]:{flex:"auto"},[`${o}.dragging`]:{position:"relative","&:after":{position:"absolute",top:0,insetInlineEnd:0,bottom:r,insetInlineStart:0,border:`1px solid ${t.colorPrimary}`,opacity:0,animationName:oce,animationDuration:t.motionDurationSlow,animationPlayState:"running",animationFillMode:"forwards",content:'""',pointerEvents:"none"}}}},[`${o}`]:{display:"flex",alignItems:"flex-start",padding:`0 0 ${r}px 0`,outline:"none","&-rtl":{direction:"rtl"},"&-disabled":{[`${n}-node-content-wrapper`]:{color:t.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"}}},[`&-active ${n}-node-content-wrapper`]:m({},ni(t)),[`&:not(${o}-disabled).filter-node ${n}-title`]:{color:"inherit",fontWeight:500},"&-draggable":{[`${n}-draggable-icon`]:{width:i,lineHeight:`${i}px`,textAlign:"center",visibility:"visible",opacity:.2,transition:`opacity ${t.motionDurationSlow}`,[`${o}:hover &`]:{opacity:.45}},[`&${o}-disabled`]:{[`${n}-draggable-icon`]:{visibility:"hidden"}}}},[`${n}-indent`]:{alignSelf:"stretch",whiteSpace:"nowrap",userSelect:"none","&-unit":{display:"inline-block",width:i}},[`${n}-draggable-icon`]:{visibility:"hidden"},[`${n}-switcher`]:m(m({},rce(e,t)),{position:"relative",flex:"none",alignSelf:"stretch",width:i,margin:0,lineHeight:`${i}px`,textAlign:"center",cursor:"pointer",userSelect:"none","&-noop":{cursor:"default"},"&_close":{[`${n}-switcher-icon`]:{svg:{transform:"rotate(-90deg)"}}},"&-loading-icon":{color:t.colorPrimary},"&-leaf-line":{position:"relative",zIndex:1,display:"inline-block",width:"100%",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:i/2,bottom:-r,marginInlineStart:-1,borderInlineEnd:`1px solid ${t.colorBorder}`,content:'""'},"&:after":{position:"absolute",width:i/2*.8,height:i/2,borderBottom:`1px solid ${t.colorBorder}`,content:'""'}}}),[`${n}-checkbox`]:{top:"initial",marginInlineEnd:a,marginBlockStart:l},[`${n}-node-content-wrapper, ${n}-checkbox + span`]:{position:"relative",zIndex:"auto",minHeight:i,margin:0,padding:`0 ${t.paddingXS/2}px`,color:"inherit",lineHeight:`${i}px`,background:"transparent",borderRadius:t.borderRadius,cursor:"pointer",transition:`all ${t.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`,"&:hover":{backgroundColor:t.controlItemBgHover},[`&${n}-node-selected`]:{backgroundColor:t.controlItemBgActive},[`${n}-iconEle`]:{display:"inline-block",width:i,height:i,lineHeight:`${i}px`,textAlign:"center",verticalAlign:"top","&:empty":{display:"none"}}},[`${n}-unselectable ${n}-node-content-wrapper:hover`]:{backgroundColor:"transparent"},[`${n}-node-content-wrapper`]:m({lineHeight:`${i}px`,userSelect:"none"},ice(e,t)),[`${o}.drop-container`]:{"> [draggable]":{boxShadow:`0 0 0 2px ${t.colorPrimary}`}},"&-show-line":{[`${n}-indent`]:{"&-unit":{position:"relative",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:i/2,bottom:-r,borderInlineEnd:`1px solid ${t.colorBorder}`,content:'""'},"&-end":{"&:before":{display:"none"}}}},[`${n}-switcher`]:{background:"transparent","&-line-icon":{verticalAlign:"-0.15em"}}},[`${o}-leaf-last`]:{[`${n}-switcher`]:{"&-leaf-line":{"&:before":{top:"auto !important",bottom:"auto !important",height:`${i/2}px !important`}}}}})}},ace=e=>{const{treeCls:t,treeNodeCls:n,treeNodePadding:o}=e;return{[`${t}${t}-directory`]:{[n]:{position:"relative","&:before":{position:"absolute",top:0,insetInlineEnd:0,bottom:o,insetInlineStart:0,transition:`background-color ${e.motionDurationMid}`,content:'""',pointerEvents:"none"},"&:hover":{"&:before":{background:e.controlItemBgHover}},"> *":{zIndex:1},[`${t}-switcher`]:{transition:`color ${e.motionDurationMid}`},[`${t}-node-content-wrapper`]:{borderRadius:0,userSelect:"none","&:hover":{background:"transparent"},[`&${t}-node-selected`]:{color:e.colorTextLightSolid,background:"transparent"}},"&-selected":{"\n &:hover::before,\n &::before\n ":{background:e.colorPrimary},[`${t}-switcher`]:{color:e.colorTextLightSolid},[`${t}-node-content-wrapper`]:{color:e.colorTextLightSolid,background:"transparent"}}}}}},L7=(e,t)=>{const n=`.${e}`,o=`${n}-treenode`,r=t.paddingXS/2,i=t.controlHeightSM,l=ze(t,{treeCls:n,treeNodeCls:o,treeNodePadding:r,treeTitleHeight:i});return[lce(e,l),ace(l)]},sce=Ue("Tree",(e,t)=>{let{prefixCls:n}=t;return[{[e.componentCls]:kh(`${n}-checkbox`,e)},L7(n,e),nu(e)]}),z7=()=>{const e=gT();return m(m({},e),{showLine:He([Boolean,Object]),multiple:$e(),autoExpandParent:$e(),checkStrictly:$e(),checkable:$e(),disabled:$e(),defaultExpandAll:$e(),defaultExpandParent:$e(),defaultExpandedKeys:ct(),expandedKeys:ct(),checkedKeys:He([Array,Object]),defaultCheckedKeys:ct(),selectedKeys:ct(),defaultSelectedKeys:ct(),selectable:$e(),loadedKeys:ct(),draggable:$e(),showIcon:$e(),icon:ve(),switcherIcon:K.any,prefixCls:String,replaceFields:Be(),blockNode:$e(),openAnimation:K.any,onDoubleclick:e.onDblclick,"onUpdate:selectedKeys":ve(),"onUpdate:checkedKeys":ve(),"onUpdate:expandedKeys":ve()})},Qd=re({compatConfig:{MODE:3},name:"ATree",inheritAttrs:!1,props:Qe(z7(),{checkable:!1,selectable:!0,showIcon:!1,blockNode:!1}),slots:Object,setup(e,t){let{attrs:n,expose:o,emit:r,slots:i}=t;e.treeData===void 0&&i.default;const{prefixCls:l,direction:a,virtual:s}=Ee("tree",e),[c,u]=sce(l),d=ne();o({treeRef:d,onNodeExpand:function(){var b;(b=d.value)===null||b===void 0||b.onNodeExpand(...arguments)},scrollTo:b=>{var y;(y=d.value)===null||y===void 0||y.scrollTo(b)},selectedKeys:P(()=>{var b;return(b=d.value)===null||b===void 0?void 0:b.selectedKeys}),checkedKeys:P(()=>{var b;return(b=d.value)===null||b===void 0?void 0:b.checkedKeys}),halfCheckedKeys:P(()=>{var b;return(b=d.value)===null||b===void 0?void 0:b.halfCheckedKeys}),loadedKeys:P(()=>{var b;return(b=d.value)===null||b===void 0?void 0:b.loadedKeys}),loadingKeys:P(()=>{var b;return(b=d.value)===null||b===void 0?void 0:b.loadingKeys}),expandedKeys:P(()=>{var b;return(b=d.value)===null||b===void 0?void 0:b.expandedKeys})}),Ve(()=>{Mt(e.replaceFields===void 0,"Tree","`replaceFields` is deprecated, please use fieldNames instead")});const h=(b,y)=>{r("update:checkedKeys",b),r("check",b,y)},v=(b,y)=>{r("update:expandedKeys",b),r("expand",b,y)},g=(b,y)=>{r("update:selectedKeys",b),r("select",b,y)};return()=>{const{showIcon:b,showLine:y,switcherIcon:S=i.switcherIcon,icon:$=i.icon,blockNode:w,checkable:C,selectable:O,fieldNames:x=e.replaceFields,motion:I=e.openAnimation,itemHeight:T=28,onDoubleclick:M,onDblclick:E}=e,A=m(m(m({},n),ot(e,["onUpdate:checkedKeys","onUpdate:expandedKeys","onUpdate:selectedKeys","onDoubleclick"])),{showLine:!!y,dropIndicatorRender:nce,fieldNames:x,icon:$,itemHeight:T}),R=i.default?kt(i.default()):void 0;return c(p(k7,B(B({},A),{},{virtual:s.value,motion:I,ref:d,prefixCls:l.value,class:le({[`${l.value}-icon-hide`]:!b,[`${l.value}-block-node`]:w,[`${l.value}-unselectable`]:!O,[`${l.value}-rtl`]:a.value==="rtl"},n.class,u.value),direction:a.value,checkable:C,selectable:O,switcherIcon:z=>F7(l.value,S,z,i.leafIcon,y),onCheck:h,onExpand:v,onSelect:g,onDblclick:E||M,children:R}),m(m({},i),{checkable:()=>p("span",{class:`${l.value}-checkbox-inner`},null)})))}}});var cce={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"};function G4(e){for(var t=1;t{if(a===Kr.End)return!1;if(s(c)){if(l.push(c),a===Kr.None)a=Kr.Start;else if(a===Kr.Start)return a=Kr.End,!1}else a===Kr.Start&&l.push(c);return n.includes(c)}),l}function Kv(e,t,n){const o=[...t],r=[];return xS(e,n,(i,l)=>{const a=o.indexOf(i);return a!==-1&&(r.push(l),o.splice(a,1)),!!o.length}),r}var hce=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rm(m({},z7()),{expandAction:He([Boolean,String])});function vce(e){const{isLeaf:t,expanded:n}=e;return p(t?Xh:n?$S:CS,null,null)}const ef=re({compatConfig:{MODE:3},name:"ADirectoryTree",inheritAttrs:!1,props:Qe(gce(),{showIcon:!0,expandAction:"click"}),slots:Object,setup(e,t){let{attrs:n,slots:o,emit:r,expose:i}=t;var l;const a=ne(e.treeData||h0(kt((l=o.default)===null||l===void 0?void 0:l.call(o))));ye(()=>e.treeData,()=>{a.value=e.treeData}),jn(()=>{rt(()=>{var T;e.treeData===void 0&&o.default&&(a.value=h0(kt((T=o.default)===null||T===void 0?void 0:T.call(o))))})});const s=ne(),c=ne(),u=P(()=>Eh(e.fieldNames)),d=ne();i({scrollTo:T=>{var M;(M=d.value)===null||M===void 0||M.scrollTo(T)},selectedKeys:P(()=>{var T;return(T=d.value)===null||T===void 0?void 0:T.selectedKeys}),checkedKeys:P(()=>{var T;return(T=d.value)===null||T===void 0?void 0:T.checkedKeys}),halfCheckedKeys:P(()=>{var T;return(T=d.value)===null||T===void 0?void 0:T.halfCheckedKeys}),loadedKeys:P(()=>{var T;return(T=d.value)===null||T===void 0?void 0:T.loadedKeys}),loadingKeys:P(()=>{var T;return(T=d.value)===null||T===void 0?void 0:T.loadingKeys}),expandedKeys:P(()=>{var T;return(T=d.value)===null||T===void 0?void 0:T.expandedKeys})});const h=()=>{const{keyEntities:T}=du(a.value,{fieldNames:u.value});let M;return e.defaultExpandAll?M=Object.keys(T):e.defaultExpandParent?M=p0(e.expandedKeys||e.defaultExpandedKeys||[],T):M=e.expandedKeys||e.defaultExpandedKeys,M},v=ne(e.selectedKeys||e.defaultSelectedKeys||[]),g=ne(h());ye(()=>e.selectedKeys,()=>{e.selectedKeys!==void 0&&(v.value=e.selectedKeys)},{immediate:!0}),ye(()=>e.expandedKeys,()=>{e.expandedKeys!==void 0&&(g.value=e.expandedKeys)},{immediate:!0});const y=Ry((T,M)=>{const{isLeaf:E}=M;E||T.shiftKey||T.metaKey||T.ctrlKey||d.value.onNodeExpand(T,M)},200,{leading:!0}),S=(T,M)=>{e.expandedKeys===void 0&&(g.value=T),r("update:expandedKeys",T),r("expand",T,M)},$=(T,M)=>{const{expandAction:E}=e;E==="click"&&y(T,M),r("click",T,M)},w=(T,M)=>{const{expandAction:E}=e;(E==="dblclick"||E==="doubleclick")&&y(T,M),r("doubleclick",T,M),r("dblclick",T,M)},C=(T,M)=>{const{multiple:E}=e,{node:A,nativeEvent:R}=M,z=A[u.value.key],_=m(m({},M),{selected:!0}),D=(R==null?void 0:R.ctrlKey)||(R==null?void 0:R.metaKey),N=R==null?void 0:R.shiftKey;let k;E&&D?(k=T,s.value=z,c.value=k,_.selectedNodes=Kv(a.value,k,u.value)):E&&N?(k=Array.from(new Set([...c.value||[],...pce({treeData:a.value,expandedKeys:g.value,startKey:z,endKey:s.value,fieldNames:u.value})])),_.selectedNodes=Kv(a.value,k,u.value)):(k=[z],s.value=z,c.value=k,_.selectedNodes=Kv(a.value,k,u.value)),r("update:selectedKeys",k),r("select",k,_),e.selectedKeys===void 0&&(v.value=k)},O=(T,M)=>{r("update:checkedKeys",T),r("check",T,M)},{prefixCls:x,direction:I}=Ee("tree",e);return()=>{const T=le(`${x.value}-directory`,{[`${x.value}-directory-rtl`]:I.value==="rtl"},n.class),{icon:M=o.icon,blockNode:E=!0}=e,A=hce(e,["icon","blockNode"]);return p(Qd,B(B(B({},n),{},{icon:M||vce,ref:d,blockNode:E},A),{},{prefixCls:x.value,class:T,expandedKeys:g.value,selectedKeys:v.value,onSelect:C,onClick:$,onDblclick:w,onExpand:S,onCheck:O}),o)}}}),tf=f0,H7=m(Qd,{DirectoryTree:ef,TreeNode:tf,install:e=>(e.component(Qd.name,Qd),e.component(tf.name,tf),e.component(ef.name,ef),e)});function X4(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const o=new Set;function r(i,l){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const s=o.has(i);if(Db(!s,"Warning: There may be circular references"),s)return!1;if(i===l)return!0;if(n&&a>1)return!1;o.add(i);const c=a+1;if(Array.isArray(i)){if(!Array.isArray(l)||i.length!==l.length)return!1;for(let u=0;ur(i[d],l[d],c))}return!1}return r(e,t)}const{SubMenu:mce,Item:bce}=Xt;function yce(e){return e.some(t=>{let{children:n}=t;return n&&n.length>0})}function j7(e,t){return typeof t=="string"||typeof t=="number"?t==null?void 0:t.toString().toLowerCase().includes(e.trim().toLowerCase()):!1}function V7(e){let{filters:t,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:l}=e;return t.map((a,s)=>{const c=String(a.value);if(a.children)return p(mce,{key:c||s,title:a.text,popupClassName:`${n}-dropdown-submenu`},{default:()=>[V7({filters:a.children,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:l})]});const u=r?jo:Xn,d=p(bce,{key:a.value!==void 0?c:s},{default:()=>[p(u,{checked:o.includes(c)},null),p("span",null,[a.text])]});return i.trim()?typeof l=="function"?l(i,a)?d:void 0:j7(i,a.text)?d:void 0:d})}const Sce=re({name:"FilterDropdown",props:["tablePrefixCls","prefixCls","dropdownPrefixCls","column","filterState","filterMultiple","filterMode","filterSearch","columnKey","triggerFilter","locale","getPopupContainer"],setup(e,t){let{slots:n}=t;const o=fS(),r=P(()=>{var j;return(j=e.filterMode)!==null&&j!==void 0?j:"menu"}),i=P(()=>{var j;return(j=e.filterSearch)!==null&&j!==void 0?j:!1}),l=P(()=>e.column.filterDropdownOpen||e.column.filterDropdownVisible),a=P(()=>e.column.onFilterDropdownOpenChange||e.column.onFilterDropdownVisibleChange),s=oe(!1),c=P(()=>{var j;return!!(e.filterState&&(!((j=e.filterState.filteredKeys)===null||j===void 0)&&j.length||e.filterState.forceFiltered))}),u=P(()=>{var j;return Yh((j=e.column)===null||j===void 0?void 0:j.filters)}),d=P(()=>{const{filterDropdown:j,slots:Y={},customFilterDropdown:Z}=e.column;return j||Y.filterDropdown&&o.value[Y.filterDropdown]||Z&&o.value.customFilterDropdown}),f=P(()=>{const{filterIcon:j,slots:Y={}}=e.column;return j||Y.filterIcon&&o.value[Y.filterIcon]||o.value.customFilterIcon}),h=j=>{var Y;s.value=j,(Y=a.value)===null||Y===void 0||Y.call(a,j)},v=P(()=>typeof l.value=="boolean"?l.value:s.value),g=P(()=>{var j;return(j=e.filterState)===null||j===void 0?void 0:j.filteredKeys}),b=oe([]),y=j=>{let{selectedKeys:Y}=j;b.value=Y},S=(j,Y)=>{let{node:Z,checked:X}=Y;e.filterMultiple?y({selectedKeys:j}):y({selectedKeys:X&&Z.key?[Z.key]:[]})};ye(g,()=>{s.value&&y({selectedKeys:g.value||[]})},{immediate:!0});const $=oe([]),w=oe(),C=j=>{w.value=setTimeout(()=>{$.value=j})},O=()=>{clearTimeout(w.value)};et(()=>{clearTimeout(w.value)});const x=oe(""),I=j=>{const{value:Y}=j.target;x.value=Y};ye(s,()=>{s.value||(x.value="")});const T=j=>{const{column:Y,columnKey:Z,filterState:X}=e,ee=j&&j.length?j:null;if(ee===null&&(!X||!X.filteredKeys)||X4(ee,X==null?void 0:X.filteredKeys,!0))return null;e.triggerFilter({column:Y,key:Z,filteredKeys:ee})},M=()=>{h(!1),T(b.value)},E=function(){let{confirm:j,closeDropdown:Y}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{confirm:!1,closeDropdown:!1};j&&T([]),Y&&h(!1),x.value="",e.column.filterResetToDefaultFilteredValue?b.value=(e.column.defaultFilteredValue||[]).map(Z=>String(Z)):b.value=[]},A=function(){let{closeDropdown:j}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{closeDropdown:!0};j&&h(!1),T(b.value)},R=j=>{j&&g.value!==void 0&&(b.value=g.value||[]),h(j),!j&&!d.value&&M()},{direction:z}=Ee("",e),_=j=>{if(j.target.checked){const Y=u.value;b.value=Y}else b.value=[]},D=j=>{let{filters:Y}=j;return(Y||[]).map((Z,X)=>{const ee=String(Z.value),U={title:Z.text,key:Z.value!==void 0?ee:X};return Z.children&&(U.children=D({filters:Z.children})),U})},N=j=>{var Y;return m(m({},j),{text:j.title,value:j.key,children:((Y=j.children)===null||Y===void 0?void 0:Y.map(Z=>N(Z)))||[]})},k=P(()=>D({filters:e.column.filters})),F=P(()=>le({[`${e.dropdownPrefixCls}-menu-without-submenu`]:!yce(e.column.filters||[])})),L=()=>{const j=b.value,{column:Y,locale:Z,tablePrefixCls:X,filterMultiple:ee,dropdownPrefixCls:U,getPopupContainer:Q,prefixCls:J}=e;return(Y.filters||[]).length===0?p(Ei,{image:Ei.PRESENTED_IMAGE_SIMPLE,description:Z.filterEmptyText,imageStyle:{height:24},style:{margin:0,padding:"16px 0"}},null):r.value==="tree"?p(Le,null,[p(R4,{filterSearch:i.value,value:x.value,onChange:I,tablePrefixCls:X,locale:Z},null),p("div",{class:`${X}-filter-dropdown-tree`},[ee?p(jo,{class:`${X}-filter-dropdown-checkall`,onChange:_,checked:j.length===u.value.length,indeterminate:j.length>0&&j.length[Z.filterCheckall]}):null,p(H7,{checkable:!0,selectable:!1,blockNode:!0,multiple:ee,checkStrictly:!ee,class:`${U}-menu`,onCheck:S,checkedKeys:j,selectedKeys:j,showIcon:!1,treeData:k.value,autoExpandParent:!0,defaultExpandAll:!0,filterTreeNode:x.value.trim()?G=>typeof i.value=="function"?i.value(x.value,N(G)):j7(x.value,G.title):void 0},null)])]):p(Le,null,[p(R4,{filterSearch:i.value,value:x.value,onChange:I,tablePrefixCls:X,locale:Z},null),p(Xt,{multiple:ee,prefixCls:`${U}-menu`,class:F.value,onClick:O,onSelect:y,onDeselect:y,selectedKeys:j,getPopupContainer:Q,openKeys:$.value,onOpenChange:C},{default:()=>V7({filters:Y.filters||[],filterSearch:i.value,prefixCls:J,filteredKeys:b.value,filterMultiple:ee,searchValue:x.value})})])},H=P(()=>{const j=b.value;return e.column.filterResetToDefaultFilteredValue?X4((e.column.defaultFilteredValue||[]).map(Y=>String(Y)),j,!0):j.length===0});return()=>{var j;const{tablePrefixCls:Y,prefixCls:Z,column:X,dropdownPrefixCls:ee,locale:U,getPopupContainer:Q}=e;let J;typeof d.value=="function"?J=d.value({prefixCls:`${ee}-custom`,setSelectedKeys:V=>y({selectedKeys:V}),selectedKeys:b.value,confirm:A,clearFilters:E,filters:X.filters,visible:v.value,column:X.__originColumn__,close:()=>{h(!1)}}):d.value?J=d.value:J=p(Le,null,[L(),p("div",{class:`${Z}-dropdown-btns`},[p(Wt,{type:"link",size:"small",disabled:H.value,onClick:()=>E()},{default:()=>[U.filterReset]}),p(Wt,{type:"primary",size:"small",onClick:M},{default:()=>[U.filterConfirm]})])]);const G=p(zse,{class:`${Z}-dropdown`},{default:()=>[J]});let q;return typeof f.value=="function"?q=f.value({filtered:c.value,column:X.__originColumn__}):f.value?q=f.value:q=p(mS,null,null),p("div",{class:`${Z}-column`},[p("span",{class:`${Y}-column-title`},[(j=n.default)===null||j===void 0?void 0:j.call(n)]),p(rr,{overlay:G,trigger:["click"],open:v.value,onOpenChange:R,getPopupContainer:Q,placement:z.value==="rtl"?"bottomLeft":"bottomRight"},{default:()=>[p("span",{role:"button",tabindex:-1,class:le(`${Z}-trigger`,{active:c.value}),onClick:V=>{V.stopPropagation()}},[q])]})])}}});function W0(e,t,n){let o=[];return(e||[]).forEach((r,i)=>{var l,a;const s=mu(i,n),c=r.filterDropdown||((l=r==null?void 0:r.slots)===null||l===void 0?void 0:l.filterDropdown)||r.customFilterDropdown;if(r.filters||c||"onFilter"in r)if("filteredValue"in r){let u=r.filteredValue;c||(u=(a=u==null?void 0:u.map(String))!==null&&a!==void 0?a:u),o.push({column:r,key:Hl(r,s),filteredKeys:u,forceFiltered:r.filtered})}else o.push({column:r,key:Hl(r,s),filteredKeys:t&&r.defaultFilteredValue?r.defaultFilteredValue:void 0,forceFiltered:r.filtered});"children"in r&&(o=[...o,...W0(r.children,t,s)])}),o}function W7(e,t,n,o,r,i,l,a){return n.map((s,c)=>{var u;const d=mu(c,a),{filterMultiple:f=!0,filterMode:h,filterSearch:v}=s;let g=s;const b=s.filterDropdown||((u=s==null?void 0:s.slots)===null||u===void 0?void 0:u.filterDropdown)||s.customFilterDropdown;if(g.filters||b){const y=Hl(g,d),S=o.find($=>{let{key:w}=$;return y===w});g=m(m({},g),{title:$=>p(Sce,{tablePrefixCls:e,prefixCls:`${e}-filter`,dropdownPrefixCls:t,column:g,columnKey:y,filterState:S,filterMultiple:f,filterMode:h,filterSearch:v,triggerFilter:i,locale:r,getPopupContainer:l},{default:()=>[vS(s.title,$)]})})}return"children"in g&&(g=m(m({},g),{children:W7(e,t,g.children,o,r,i,l,d)})),g})}function Yh(e){let t=[];return(e||[]).forEach(n=>{let{value:o,children:r}=n;t.push(o),r&&(t=[...t,...Yh(r)])}),t}function Y4(e){const t={};return e.forEach(n=>{let{key:o,filteredKeys:r,column:i}=n;var l;const a=i.filterDropdown||((l=i==null?void 0:i.slots)===null||l===void 0?void 0:l.filterDropdown)||i.customFilterDropdown,{filters:s}=i;if(a)t[o]=r||null;else if(Array.isArray(r)){const c=Yh(s);t[o]=c.filter(u=>r.includes(String(u)))}else t[o]=null}),t}function q4(e,t){return t.reduce((n,o)=>{const{column:{onFilter:r,filters:i},filteredKeys:l}=o;return r&&l&&l.length?n.filter(a=>l.some(s=>{const c=Yh(i),u=c.findIndex(f=>String(f)===String(s)),d=u!==-1?c[u]:s;return r(d,a)})):n},e)}function K7(e){return e.flatMap(t=>"children"in t?[t,...K7(t.children||[])]:[t])}function $ce(e){let{prefixCls:t,dropdownPrefixCls:n,mergedColumns:o,locale:r,onFilterChange:i,getPopupContainer:l}=e;const a=P(()=>K7(o.value)),[s,c]=St(W0(a.value,!0)),u=P(()=>{const v=W0(a.value,!1);if(v.length===0)return v;let g=!0,b=!0;if(v.forEach(y=>{let{filteredKeys:S}=y;S!==void 0?g=!1:b=!1}),g){const y=(a.value||[]).map((S,$)=>Hl(S,mu($)));return s.value.filter(S=>{let{key:$}=S;return y.includes($)}).map(S=>{const $=a.value[y.findIndex(w=>w===S.key)];return m(m({},S),{column:m(m({},S.column),$),forceFiltered:$.filtered})})}return Mt(b,"Table","Columns should all contain `filteredValue` or not contain `filteredValue`."),v}),d=P(()=>Y4(u.value)),f=v=>{const g=u.value.filter(b=>{let{key:y}=b;return y!==v.key});g.push(v),c(g),i(Y4(g),g)};return[v=>W7(t.value,n.value,v,u.value,r.value,f,l.value),u,d]}function G7(e,t){return e.map(n=>{const o=m({},n);return o.title=vS(o.title,t),"children"in o&&(o.children=G7(o.children,t)),o})}function Cce(e){return[n=>G7(n,e.value)]}function xce(e){return function(n){let{prefixCls:o,onExpand:r,record:i,expanded:l,expandable:a}=n;const s=`${o}-row-expand-icon`;return p("button",{type:"button",onClick:c=>{r(i,c),c.stopPropagation()},class:le(s,{[`${s}-spaced`]:!a,[`${s}-expanded`]:a&&l,[`${s}-collapsed`]:a&&!l}),"aria-label":l?e.collapse:e.expand,"aria-expanded":l},null)}}function U7(e,t){const n=t.value;return e.map(o=>{var r;if(o===Wr||o===Pi)return o;const i=m({},o),{slots:l={}}=i;return i.__originColumn__=o,Mt(!("slots"in i),"Table","`column.slots` is deprecated. Please use `v-slot:headerCell` `v-slot:bodyCell` instead."),Object.keys(l).forEach(a=>{const s=l[a];i[a]===void 0&&n[s]&&(i[a]=n[s])}),t.value.headerCell&&!(!((r=o.slots)===null||r===void 0)&&r.title)&&(i.title=Jp(t.value,"headerCell",{title:o.title,column:o},()=>[o.title])),"children"in i&&Array.isArray(i.children)&&(i.children=U7(i.children,t)),i})}function wce(e){return[n=>U7(n,e)]}const Oce=e=>{const{componentCls:t}=e,n=`${e.lineWidth}px ${e.lineType} ${e.tableBorderColor}`,o=(r,i,l)=>({[`&${t}-${r}`]:{[`> ${t}-container`]:{[`> ${t}-content, > ${t}-body`]:{"> table > tbody > tr > td":{[`> ${t}-expanded-row-fixed`]:{margin:`-${i}px -${l+e.lineWidth}px`}}}}}});return{[`${t}-wrapper`]:{[`${t}${t}-bordered`]:m(m(m({[`> ${t}-title`]:{border:n,borderBottom:0},[`> ${t}-container`]:{borderInlineStart:n,[` + > ${t}-content, + > ${t}-header, + > ${t}-body, + > ${t}-summary + `]:{"> table":{"\n > thead > tr > th,\n > tbody > tr > td,\n > tfoot > tr > th,\n > tfoot > tr > td\n ":{borderInlineEnd:n},"> thead":{"> tr:not(:last-child) > th":{borderBottom:n},"> tr > th::before":{backgroundColor:"transparent !important"}},"\n > thead > tr,\n > tbody > tr,\n > tfoot > tr\n ":{[`> ${t}-cell-fix-right-first::after`]:{borderInlineEnd:n}},"> tbody > tr > td":{[`> ${t}-expanded-row-fixed`]:{margin:`-${e.tablePaddingVertical}px -${e.tablePaddingHorizontal+e.lineWidth}px`,"&::after":{position:"absolute",top:0,insetInlineEnd:e.lineWidth,bottom:0,borderInlineEnd:n,content:'""'}}}}},[` + > ${t}-content, + > ${t}-header + `]:{"> table":{borderTop:n}}},[`&${t}-scroll-horizontal`]:{[`> ${t}-container > ${t}-body`]:{"> table > tbody":{[` + > tr${t}-expanded-row, + > tr${t}-placeholder + `]:{"> td":{borderInlineEnd:0}}}}}},o("middle",e.tablePaddingVerticalMiddle,e.tablePaddingHorizontalMiddle)),o("small",e.tablePaddingVerticalSmall,e.tablePaddingHorizontalSmall)),{[`> ${t}-footer`]:{border:n,borderTop:0}}),[`${t}-cell`]:{[`${t}-container:first-child`]:{borderTop:0},"&-scrollbar:not([rowspan])":{boxShadow:`0 ${e.lineWidth}px 0 ${e.lineWidth}px ${e.tableHeaderBg}`}}}}},Pce=e=>{const{componentCls:t}=e;return{[`${t}-wrapper`]:{[`${t}-cell-ellipsis`]:m(m({},Jt),{wordBreak:"keep-all",[` + &${t}-cell-fix-left-last, + &${t}-cell-fix-right-first + `]:{overflow:"visible",[`${t}-cell-content`]:{display:"block",overflow:"hidden",textOverflow:"ellipsis"}},[`${t}-column-title`]:{overflow:"hidden",textOverflow:"ellipsis",wordBreak:"keep-all"}})}}},Ice=e=>{const{componentCls:t}=e;return{[`${t}-wrapper`]:{[`${t}-tbody > tr${t}-placeholder`]:{textAlign:"center",color:e.colorTextDisabled,"&:hover > td":{background:e.colorBgContainer}}}}},Tce=e=>{const{componentCls:t,antCls:n,controlInteractiveSize:o,motionDurationSlow:r,lineWidth:i,paddingXS:l,lineType:a,tableBorderColor:s,tableExpandIconBg:c,tableExpandColumnWidth:u,borderRadius:d,fontSize:f,fontSizeSM:h,lineHeight:v,tablePaddingVertical:g,tablePaddingHorizontal:b,tableExpandedRowBg:y,paddingXXS:S}=e,$=o/2-i,w=$*2+i*3,C=`${i}px ${a} ${s}`,O=S-i;return{[`${t}-wrapper`]:{[`${t}-expand-icon-col`]:{width:u},[`${t}-row-expand-icon-cell`]:{textAlign:"center",[`${t}-row-expand-icon`]:{display:"inline-flex",float:"none",verticalAlign:"sub"}},[`${t}-row-indent`]:{height:1,float:"left"},[`${t}-row-expand-icon`]:m(m({},Xp(e)),{position:"relative",float:"left",boxSizing:"border-box",width:w,height:w,padding:0,color:"inherit",lineHeight:`${w}px`,background:c,border:C,borderRadius:d,transform:`scale(${o/w})`,transition:`all ${r}`,userSelect:"none","&:focus, &:hover, &:active":{borderColor:"currentcolor"},"&::before, &::after":{position:"absolute",background:"currentcolor",transition:`transform ${r} ease-out`,content:'""'},"&::before":{top:$,insetInlineEnd:O,insetInlineStart:O,height:i},"&::after":{top:O,bottom:O,insetInlineStart:$,width:i,transform:"rotate(90deg)"},"&-collapsed::before":{transform:"rotate(-180deg)"},"&-collapsed::after":{transform:"rotate(0deg)"},"&-spaced":{"&::before, &::after":{display:"none",content:"none"},background:"transparent",border:0,visibility:"hidden"}}),[`${t}-row-indent + ${t}-row-expand-icon`]:{marginTop:(f*v-i*3)/2-Math.ceil((h*1.4-i*3)/2),marginInlineEnd:l},[`tr${t}-expanded-row`]:{"&, &:hover":{"> td":{background:y}},[`${n}-descriptions-view`]:{display:"flex",table:{flex:"auto",width:"auto"}}},[`${t}-expanded-row-fixed`]:{position:"relative",margin:`-${g}px -${b}px`,padding:`${g}px ${b}px`}}}},Ece=e=>{const{componentCls:t,antCls:n,iconCls:o,tableFilterDropdownWidth:r,tableFilterDropdownSearchWidth:i,paddingXXS:l,paddingXS:a,colorText:s,lineWidth:c,lineType:u,tableBorderColor:d,tableHeaderIconColor:f,fontSizeSM:h,tablePaddingHorizontal:v,borderRadius:g,motionDurationSlow:b,colorTextDescription:y,colorPrimary:S,tableHeaderFilterActiveBg:$,colorTextDisabled:w,tableFilterDropdownBg:C,tableFilterDropdownHeight:O,controlItemBgHover:x,controlItemBgActive:I,boxShadowSecondary:T}=e,M=`${n}-dropdown`,E=`${t}-filter-dropdown`,A=`${n}-tree`,R=`${c}px ${u} ${d}`;return[{[`${t}-wrapper`]:{[`${t}-filter-column`]:{display:"flex",justifyContent:"space-between"},[`${t}-filter-trigger`]:{position:"relative",display:"flex",alignItems:"center",marginBlock:-l,marginInline:`${l}px ${-v/2}px`,padding:`0 ${l}px`,color:f,fontSize:h,borderRadius:g,cursor:"pointer",transition:`all ${b}`,"&:hover":{color:y,background:$},"&.active":{color:S}}}},{[`${n}-dropdown`]:{[E]:m(m({},qe(e)),{minWidth:r,backgroundColor:C,borderRadius:g,boxShadow:T,[`${M}-menu`]:{maxHeight:O,overflowX:"hidden",border:0,boxShadow:"none","&:empty::after":{display:"block",padding:`${a}px 0`,color:w,fontSize:h,textAlign:"center",content:'"Not Found"'}},[`${E}-tree`]:{paddingBlock:`${a}px 0`,paddingInline:a,[A]:{padding:0},[`${A}-treenode ${A}-node-content-wrapper:hover`]:{backgroundColor:x},[`${A}-treenode-checkbox-checked ${A}-node-content-wrapper`]:{"&, &:hover":{backgroundColor:I}}},[`${E}-search`]:{padding:a,borderBottom:R,"&-input":{input:{minWidth:i},[o]:{color:w}}},[`${E}-checkall`]:{width:"100%",marginBottom:l,marginInlineStart:l},[`${E}-btns`]:{display:"flex",justifyContent:"space-between",padding:`${a-c}px ${a}px`,overflow:"hidden",backgroundColor:"inherit",borderTop:R}})}},{[`${n}-dropdown ${E}, ${E}-submenu`]:{[`${n}-checkbox-wrapper + span`]:{paddingInlineStart:a,color:s},"> ul":{maxHeight:"calc(100vh - 130px)",overflowX:"hidden",overflowY:"auto"}}}]},_ce=e=>{const{componentCls:t,lineWidth:n,colorSplit:o,motionDurationSlow:r,zIndexTableFixed:i,tableBg:l,zIndexTableSticky:a}=e,s=o;return{[`${t}-wrapper`]:{[` + ${t}-cell-fix-left, + ${t}-cell-fix-right + `]:{position:"sticky !important",zIndex:i,background:l},[` + ${t}-cell-fix-left-first::after, + ${t}-cell-fix-left-last::after + `]:{position:"absolute",top:0,right:{_skip_check_:!0,value:0},bottom:-n,width:30,transform:"translateX(100%)",transition:`box-shadow ${r}`,content:'""',pointerEvents:"none"},[`${t}-cell-fix-left-all::after`]:{display:"none"},[` + ${t}-cell-fix-right-first::after, + ${t}-cell-fix-right-last::after + `]:{position:"absolute",top:0,bottom:-n,left:{_skip_check_:!0,value:0},width:30,transform:"translateX(-100%)",transition:`box-shadow ${r}`,content:'""',pointerEvents:"none"},[`${t}-container`]:{"&::before, &::after":{position:"absolute",top:0,bottom:0,zIndex:a+1,width:30,transition:`box-shadow ${r}`,content:'""',pointerEvents:"none"},"&::before":{insetInlineStart:0},"&::after":{insetInlineEnd:0}},[`${t}-ping-left`]:{[`&:not(${t}-has-fix-left) ${t}-container`]:{position:"relative","&::before":{boxShadow:`inset 10px 0 8px -8px ${s}`}},[` + ${t}-cell-fix-left-first::after, + ${t}-cell-fix-left-last::after + `]:{boxShadow:`inset 10px 0 8px -8px ${s}`},[`${t}-cell-fix-left-last::before`]:{backgroundColor:"transparent !important"}},[`${t}-ping-right`]:{[`&:not(${t}-has-fix-right) ${t}-container`]:{position:"relative","&::after":{boxShadow:`inset -10px 0 8px -8px ${s}`}},[` + ${t}-cell-fix-right-first::after, + ${t}-cell-fix-right-last::after + `]:{boxShadow:`inset -10px 0 8px -8px ${s}`}}}}},Mce=e=>{const{componentCls:t,antCls:n}=e;return{[`${t}-wrapper`]:{[`${t}-pagination${n}-pagination`]:{margin:`${e.margin}px 0`},[`${t}-pagination`]:{display:"flex",flexWrap:"wrap",rowGap:e.paddingXS,"> *":{flex:"none"},"&-left":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-right":{justifyContent:"flex-end"}}}}},Ace=e=>{const{componentCls:t,tableRadius:n}=e;return{[`${t}-wrapper`]:{[t]:{[`${t}-title, ${t}-header`]:{borderRadius:`${n}px ${n}px 0 0`},[`${t}-title + ${t}-container`]:{borderStartStartRadius:0,borderStartEndRadius:0,table:{borderRadius:0,"> thead > tr:first-child":{"th:first-child":{borderRadius:0},"th:last-child":{borderRadius:0}}}},"&-container":{borderStartStartRadius:n,borderStartEndRadius:n,"table > thead > tr:first-child":{"> *:first-child":{borderStartStartRadius:n},"> *:last-child":{borderStartEndRadius:n}}},"&-footer":{borderRadius:`0 0 ${n}px ${n}px`}}}}},Rce=e=>{const{componentCls:t}=e;return{[`${t}-wrapper-rtl`]:{direction:"rtl",table:{direction:"rtl"},[`${t}-pagination-left`]:{justifyContent:"flex-end"},[`${t}-pagination-right`]:{justifyContent:"flex-start"},[`${t}-row-expand-icon`]:{"&::after":{transform:"rotate(-90deg)"},"&-collapsed::before":{transform:"rotate(180deg)"},"&-collapsed::after":{transform:"rotate(0deg)"}}}}},Dce=e=>{const{componentCls:t,antCls:n,iconCls:o,fontSizeIcon:r,paddingXS:i,tableHeaderIconColor:l,tableHeaderIconColorHover:a}=e;return{[`${t}-wrapper`]:{[`${t}-selection-col`]:{width:e.tableSelectionColumnWidth},[`${t}-bordered ${t}-selection-col`]:{width:e.tableSelectionColumnWidth+i*2},[` + table tr th${t}-selection-column, + table tr td${t}-selection-column + `]:{paddingInlineEnd:e.paddingXS,paddingInlineStart:e.paddingXS,textAlign:"center",[`${n}-radio-wrapper`]:{marginInlineEnd:0}},[`table tr th${t}-selection-column${t}-cell-fix-left`]:{zIndex:e.zIndexTableFixed+1},[`table tr th${t}-selection-column::after`]:{backgroundColor:"transparent !important"},[`${t}-selection`]:{position:"relative",display:"inline-flex",flexDirection:"column"},[`${t}-selection-extra`]:{position:"absolute",top:0,zIndex:1,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,marginInlineStart:"100%",paddingInlineStart:`${e.tablePaddingHorizontal/4}px`,[o]:{color:l,fontSize:r,verticalAlign:"baseline","&:hover":{color:a}}}}}},Bce=e=>{const{componentCls:t}=e,n=(o,r,i,l)=>({[`${t}${t}-${o}`]:{fontSize:l,[` + ${t}-title, + ${t}-footer, + ${t}-thead > tr > th, + ${t}-tbody > tr > td, + tfoot > tr > th, + tfoot > tr > td + `]:{padding:`${r}px ${i}px`},[`${t}-filter-trigger`]:{marginInlineEnd:`-${i/2}px`},[`${t}-expanded-row-fixed`]:{margin:`-${r}px -${i}px`},[`${t}-tbody`]:{[`${t}-wrapper:only-child ${t}`]:{marginBlock:`-${r}px`,marginInline:`${e.tableExpandColumnWidth-i}px -${i}px`}},[`${t}-selection-column`]:{paddingInlineStart:`${i/4}px`}}});return{[`${t}-wrapper`]:m(m({},n("middle",e.tablePaddingVerticalMiddle,e.tablePaddingHorizontalMiddle,e.tableFontSizeMiddle)),n("small",e.tablePaddingVerticalSmall,e.tablePaddingHorizontalSmall,e.tableFontSizeSmall))}},Nce=e=>{const{componentCls:t}=e;return{[`${t}-wrapper ${t}-resize-handle`]:{position:"absolute",top:0,height:"100% !important",bottom:0,left:" auto !important",right:" -8px",cursor:"col-resize",touchAction:"none",userSelect:"auto",width:"16px",zIndex:1,"&-line":{display:"block",width:"1px",marginLeft:"7px",height:"100% !important",backgroundColor:e.colorPrimary,opacity:0},"&:hover &-line":{opacity:1}},[`${t}-wrapper ${t}-resize-handle.dragging`]:{overflow:"hidden",[`${t}-resize-handle-line`]:{opacity:1},"&:before":{position:"absolute",top:0,bottom:0,content:'" "',width:"200vw",transform:"translateX(-50%)",opacity:0}}}},kce=e=>{const{componentCls:t,marginXXS:n,fontSizeIcon:o,tableHeaderIconColor:r,tableHeaderIconColorHover:i}=e;return{[`${t}-wrapper`]:{[`${t}-thead th${t}-column-has-sorters`]:{outline:"none",cursor:"pointer",transition:`all ${e.motionDurationSlow}`,"&:hover":{background:e.tableHeaderSortHoverBg,"&::before":{backgroundColor:"transparent !important"}},"&:focus-visible":{color:e.colorPrimary},[` + &${t}-cell-fix-left:hover, + &${t}-cell-fix-right:hover + `]:{background:e.tableFixedHeaderSortActiveBg}},[`${t}-thead th${t}-column-sort`]:{background:e.tableHeaderSortBg,"&::before":{backgroundColor:"transparent !important"}},[`td${t}-column-sort`]:{background:e.tableBodySortBg},[`${t}-column-title`]:{position:"relative",zIndex:1,flex:1},[`${t}-column-sorters`]:{display:"flex",flex:"auto",alignItems:"center",justifyContent:"space-between","&::after":{position:"absolute",inset:0,width:"100%",height:"100%",content:'""'}},[`${t}-column-sorter`]:{marginInlineStart:n,color:r,fontSize:0,transition:`color ${e.motionDurationSlow}`,"&-inner":{display:"inline-flex",flexDirection:"column",alignItems:"center"},"&-up, &-down":{fontSize:o,"&.active":{color:e.colorPrimary}},[`${t}-column-sorter-up + ${t}-column-sorter-down`]:{marginTop:"-0.3em"}},[`${t}-column-sorters:hover ${t}-column-sorter`]:{color:i}}}},Fce=e=>{const{componentCls:t,opacityLoading:n,tableScrollThumbBg:o,tableScrollThumbBgHover:r,tableScrollThumbSize:i,tableScrollBg:l,zIndexTableSticky:a}=e,s=`${e.lineWidth}px ${e.lineType} ${e.tableBorderColor}`;return{[`${t}-wrapper`]:{[`${t}-sticky`]:{"&-holder":{position:"sticky",zIndex:a,background:e.colorBgContainer},"&-scroll":{position:"sticky",bottom:0,height:`${i}px !important`,zIndex:a,display:"flex",alignItems:"center",background:l,borderTop:s,opacity:n,"&:hover":{transformOrigin:"center bottom"},"&-bar":{height:i,backgroundColor:o,borderRadius:100,transition:`all ${e.motionDurationSlow}, transform none`,position:"absolute",bottom:0,"&:hover, &-active":{backgroundColor:r}}}}}}},J4=e=>{const{componentCls:t,lineWidth:n,tableBorderColor:o}=e,r=`${n}px ${e.lineType} ${o}`;return{[`${t}-wrapper`]:{[`${t}-summary`]:{position:"relative",zIndex:e.zIndexTableFixed,background:e.tableBg,"> tr":{"> th, > td":{borderBottom:r}}},[`div${t}-summary`]:{boxShadow:`0 -${n}px 0 ${o}`}}}},Lce=e=>{const{componentCls:t,fontWeightStrong:n,tablePaddingVertical:o,tablePaddingHorizontal:r,lineWidth:i,lineType:l,tableBorderColor:a,tableFontSize:s,tableBg:c,tableRadius:u,tableHeaderTextColor:d,motionDurationMid:f,tableHeaderBg:h,tableHeaderCellSplitColor:v,tableRowHoverBg:g,tableSelectedRowBg:b,tableSelectedRowHoverBg:y,tableFooterTextColor:S,tableFooterBg:$,paddingContentVerticalLG:w}=e,C=`${i}px ${l} ${a}`;return{[`${t}-wrapper`]:m(m({clear:"both",maxWidth:"100%"},lr()),{[t]:m(m({},qe(e)),{fontSize:s,background:c,borderRadius:`${u}px ${u}px 0 0`}),table:{width:"100%",textAlign:"start",borderRadius:`${u}px ${u}px 0 0`,borderCollapse:"separate",borderSpacing:0},[` + ${t}-thead > tr > th, + ${t}-tbody > tr > td, + tfoot > tr > th, + tfoot > tr > td + `]:{position:"relative",padding:`${w}px ${r}px`,overflowWrap:"break-word"},[`${t}-title`]:{padding:`${o}px ${r}px`},[`${t}-thead`]:{"\n > tr > th,\n > tr > td\n ":{position:"relative",color:d,fontWeight:n,textAlign:"start",background:h,borderBottom:C,transition:`background ${f} ease`,"&[colspan]:not([colspan='1'])":{textAlign:"center"},[`&:not(:last-child):not(${t}-selection-column):not(${t}-row-expand-icon-cell):not([colspan])::before`]:{position:"absolute",top:"50%",insetInlineEnd:0,width:1,height:"1.6em",backgroundColor:v,transform:"translateY(-50%)",transition:`background-color ${f}`,content:'""'}},"> tr:not(:last-child) > th[colspan]":{borderBottom:0}},[`${t}:not(${t}-bordered)`]:{[`${t}-tbody`]:{"> tr":{"> td":{borderTop:C,borderBottom:"transparent"},"&:last-child > td":{borderBottom:C},[`&:first-child > td, + &${t}-measure-row + tr > td`]:{borderTop:"none",borderTopColor:"transparent"}}}},[`${t}${t}-bordered`]:{[`${t}-tbody`]:{"> tr":{"> td":{borderBottom:C}}}},[`${t}-tbody`]:{"> tr":{"> td":{transition:`background ${f}, border-color ${f}`,[` + > ${t}-wrapper:only-child, + > ${t}-expanded-row-fixed > ${t}-wrapper:only-child + `]:{[t]:{marginBlock:`-${o}px`,marginInline:`${e.tableExpandColumnWidth-r}px -${r}px`,[`${t}-tbody > tr:last-child > td`]:{borderBottom:0,"&:first-child, &:last-child":{borderRadius:0}}}}},[` + &${t}-row:hover > td, + > td${t}-cell-row-hover + `]:{background:g},[`&${t}-row-selected`]:{"> td":{background:b},"&:hover > td":{background:y}}}},[`${t}-footer`]:{padding:`${o}px ${r}px`,color:S,background:$}})}},zce=Ue("Table",e=>{const{controlItemBgActive:t,controlItemBgActiveHover:n,colorTextPlaceholder:o,colorTextHeading:r,colorSplit:i,colorBorderSecondary:l,fontSize:a,padding:s,paddingXS:c,paddingSM:u,controlHeight:d,colorFillAlter:f,colorIcon:h,colorIconHover:v,opacityLoading:g,colorBgContainer:b,borderRadiusLG:y,colorFillContent:S,colorFillSecondary:$,controlInteractiveSize:w}=e,C=new vt(h),O=new vt(v),x=t,I=2,T=new vt($).onBackground(b).toHexString(),M=new vt(S).onBackground(b).toHexString(),E=new vt(f).onBackground(b).toHexString(),A=ze(e,{tableFontSize:a,tableBg:b,tableRadius:y,tablePaddingVertical:s,tablePaddingHorizontal:s,tablePaddingVerticalMiddle:u,tablePaddingHorizontalMiddle:c,tablePaddingVerticalSmall:c,tablePaddingHorizontalSmall:c,tableBorderColor:l,tableHeaderTextColor:r,tableHeaderBg:E,tableFooterTextColor:r,tableFooterBg:E,tableHeaderCellSplitColor:l,tableHeaderSortBg:T,tableHeaderSortHoverBg:M,tableHeaderIconColor:C.clone().setAlpha(C.getAlpha()*g).toRgbString(),tableHeaderIconColorHover:O.clone().setAlpha(O.getAlpha()*g).toRgbString(),tableBodySortBg:E,tableFixedHeaderSortActiveBg:T,tableHeaderFilterActiveBg:S,tableFilterDropdownBg:b,tableRowHoverBg:E,tableSelectedRowBg:x,tableSelectedRowHoverBg:n,zIndexTableFixed:I,zIndexTableSticky:I+1,tableFontSizeMiddle:a,tableFontSizeSmall:a,tableSelectionColumnWidth:d,tableExpandIconBg:b,tableExpandColumnWidth:w+2*e.padding,tableExpandedRowBg:f,tableFilterDropdownWidth:120,tableFilterDropdownHeight:264,tableFilterDropdownSearchWidth:140,tableScrollThumbSize:8,tableScrollThumbBg:o,tableScrollThumbBgHover:r,tableScrollBg:i});return[Lce(A),Mce(A),J4(A),kce(A),Ece(A),Oce(A),Ace(A),Tce(A),J4(A),Ice(A),Dce(A),_ce(A),Fce(A),Pce(A),Bce(A),Nce(A),Rce(A)]}),Hce=[],X7=()=>({prefixCls:Ne(),columns:ct(),rowKey:He([String,Function]),tableLayout:Ne(),rowClassName:He([String,Function]),title:ve(),footer:ve(),id:Ne(),showHeader:$e(),components:Be(),customRow:ve(),customHeaderRow:ve(),direction:Ne(),expandFixed:He([Boolean,String]),expandColumnWidth:Number,expandedRowKeys:ct(),defaultExpandedRowKeys:ct(),expandedRowRender:ve(),expandRowByClick:$e(),expandIcon:ve(),onExpand:ve(),onExpandedRowsChange:ve(),"onUpdate:expandedRowKeys":ve(),defaultExpandAllRows:$e(),indentSize:Number,expandIconColumnIndex:Number,showExpandColumn:$e(),expandedRowClassName:ve(),childrenColumnName:Ne(),rowExpandable:ve(),sticky:He([Boolean,Object]),dropdownPrefixCls:String,dataSource:ct(),pagination:He([Boolean,Object]),loading:He([Boolean,Object]),size:Ne(),bordered:$e(),locale:Be(),onChange:ve(),onResizeColumn:ve(),rowSelection:Be(),getPopupContainer:ve(),scroll:Be(),sortDirections:ct(),showSorterTooltip:He([Boolean,Object],!0),transformCellText:ve()}),jce=re({name:"InternalTable",inheritAttrs:!1,props:Qe(m(m({},X7()),{contextSlots:Be()}),{rowKey:"key"}),setup(e,t){let{attrs:n,slots:o,expose:r,emit:i}=t;Mt(!(typeof e.rowKey=="function"&&e.rowKey.length>1),"Table","`index` parameter of `rowKey` function is deprecated. There is no guarantee that it will work as expected."),Bae(P(()=>e.contextSlots)),Nae({onResizeColumn:(ie,ae)=>{i("resizeColumn",ie,ae)}});const l=ps(),a=P(()=>{const ie=new Set(Object.keys(l.value).filter(ae=>l.value[ae]));return e.columns.filter(ae=>!ae.responsive||ae.responsive.some(ce=>ie.has(ce)))}),{size:s,renderEmpty:c,direction:u,prefixCls:d,configProvider:f}=Ee("table",e),[h,v]=zce(d),g=P(()=>{var ie;return e.transformCellText||((ie=f.transformCellText)===null||ie===void 0?void 0:ie.value)}),[b]=Uo("Table",eo.Table,We(e,"locale")),y=P(()=>e.dataSource||Hce),S=P(()=>f.getPrefixCls("dropdown",e.dropdownPrefixCls)),$=P(()=>e.childrenColumnName||"children"),w=P(()=>y.value.some(ie=>ie==null?void 0:ie[$.value])?"nest":e.expandedRowRender?"row":null),C=ft({body:null}),O=ie=>{m(C,ie)},x=P(()=>typeof e.rowKey=="function"?e.rowKey:ie=>ie==null?void 0:ie[e.rowKey]),[I]=Ise(y,$,x),T={},M=function(ie,ae){let ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{pagination:se,scroll:pe,onChange:he}=e,ge=m(m({},T),ie);ce&&(T.resetPagination(),ge.pagination.current&&(ge.pagination.current=1),se&&se.onChange&&se.onChange(1,ge.pagination.pageSize)),pe&&pe.scrollToFirstRowOnChange!==!1&&C.body&&Kb(0,{getContainer:()=>C.body}),he==null||he(ge.pagination,ge.filters,ge.sorter,{currentDataSource:q4(j0(y.value,ge.sorterStates,$.value),ge.filterStates),action:ae})},E=(ie,ae)=>{M({sorter:ie,sorterStates:ae},"sort",!1)},[A,R,z,_]=Nse({prefixCls:d,mergedColumns:a,onSorterChange:E,sortDirections:P(()=>e.sortDirections||["ascend","descend"]),tableLocale:b,showSorterTooltip:We(e,"showSorterTooltip")}),D=P(()=>j0(y.value,R.value,$.value)),N=(ie,ae)=>{M({filters:ie,filterStates:ae},"filter",!0)},[k,F,L]=$ce({prefixCls:d,locale:b,dropdownPrefixCls:S,mergedColumns:a,onFilterChange:N,getPopupContainer:We(e,"getPopupContainer")}),H=P(()=>q4(D.value,F.value)),[j]=wce(We(e,"contextSlots")),Y=P(()=>{const ie={},ae=L.value;return Object.keys(ae).forEach(ce=>{ae[ce]!==null&&(ie[ce]=ae[ce])}),m(m({},z.value),{filters:ie})}),[Z]=Cce(Y),X=(ie,ae)=>{M({pagination:m(m({},T.pagination),{current:ie,pageSize:ae})},"paginate")},[ee,U]=Pse(P(()=>H.value.length),We(e,"pagination"),X);Ve(()=>{T.sorter=_.value,T.sorterStates=R.value,T.filters=L.value,T.filterStates=F.value,T.pagination=e.pagination===!1?{}:Ose(ee.value,e.pagination),T.resetPagination=U});const Q=P(()=>{if(e.pagination===!1||!ee.value.pageSize)return H.value;const{current:ie=1,total:ae,pageSize:ce=k0}=ee.value;return Mt(ie>0,"Table","`current` should be positive number."),H.value.lengthce?H.value.slice((ie-1)*ce,ie*ce):H.value:H.value.slice((ie-1)*ce,ie*ce)});Ve(()=>{rt(()=>{const{total:ie,pageSize:ae=k0}=ee.value;H.value.lengthae&&Mt(!1,"Table","`dataSource` length is less than `pagination.total` but large than `pagination.pageSize`. Please make sure your config correct data with async mode.")})},{flush:"post"});const J=P(()=>e.showExpandColumn===!1?-1:w.value==="nest"&&e.expandIconColumnIndex===void 0?e.rowSelection?1:0:e.expandIconColumnIndex>0&&e.rowSelection?e.expandIconColumnIndex-1:e.expandIconColumnIndex),G=ne();ye(()=>e.rowSelection,()=>{G.value=e.rowSelection?m({},e.rowSelection):e.rowSelection},{deep:!0,immediate:!0});const[q,V]=Ese(G,{prefixCls:d,data:H,pageData:Q,getRowKey:x,getRecordByKey:I,expandType:w,childrenColumnName:$,locale:b,getPopupContainer:P(()=>e.getPopupContainer)}),W=(ie,ae,ce)=>{let se;const{rowClassName:pe}=e;return typeof pe=="function"?se=le(pe(ie,ae,ce)):se=le(pe),le({[`${d.value}-row-selected`]:V.value.has(x.value(ie,ae))},se)};r({selectedKeySet:V});const te=P(()=>typeof e.indentSize=="number"?e.indentSize:15),ue=ie=>Z(q(k(A(j(ie)))));return()=>{var ie;const{expandIcon:ae=o.expandIcon||xce(b.value),pagination:ce,loading:se,bordered:pe}=e;let he,ge;if(ce!==!1&&(!((ie=ee.value)===null||ie===void 0)&&ie.total)){let de;ee.value.size?de=ee.value.size:de=s.value==="small"||s.value==="middle"?"small":void 0;const be=Re=>p(Vh,B(B({},ee.value),{},{class:[`${d.value}-pagination ${d.value}-pagination-${Re}`,ee.value.class],size:de}),null),we=u.value==="rtl"?"left":"right",{position:Te}=ee.value;if(Te!==null&&Array.isArray(Te)){const Re=Te.find(Pe=>Pe.includes("top")),Se=Te.find(Pe=>Pe.includes("bottom")),Ce=Te.every(Pe=>`${Pe}`=="none");!Re&&!Se&&!Ce&&(ge=be(we)),Re&&(he=be(Re.toLowerCase().replace("top",""))),Se&&(ge=be(Se.toLowerCase().replace("bottom","")))}else ge=be(we)}let me;typeof se=="boolean"?me={spinning:se}:typeof se=="object"&&(me=m({spinning:!0},se));const xe=le(`${d.value}-wrapper`,{[`${d.value}-wrapper-rtl`]:u.value==="rtl"},n.class,v.value),fe=ot(e,["columns"]);return h(p("div",{class:xe,style:n.style},[p(_r,B({spinning:!1},me),{default:()=>[he,p(xse,B(B(B({},n),fe),{},{expandedRowKeys:e.expandedRowKeys,defaultExpandedRowKeys:e.defaultExpandedRowKeys,expandIconColumnIndex:J.value,indentSize:te.value,expandIcon:ae,columns:a.value,direction:u.value,prefixCls:d.value,class:le({[`${d.value}-middle`]:s.value==="middle",[`${d.value}-small`]:s.value==="small",[`${d.value}-bordered`]:pe,[`${d.value}-empty`]:y.value.length===0}),data:Q.value,rowKey:x.value,rowClassName:W,internalHooks:N0,internalRefs:C,onUpdateInternalRefs:O,transformColumns:ue,transformCellText:g.value}),m(m({},o),{emptyText:()=>{var de,be;return((de=o.emptyText)===null||de===void 0?void 0:de.call(o))||((be=e.locale)===null||be===void 0?void 0:be.emptyText)||c("Table")}})),ge]})]))}}}),Gv=re({name:"ATable",inheritAttrs:!1,props:Qe(X7(),{rowKey:"key"}),slots:Object,setup(e,t){let{attrs:n,slots:o,expose:r}=t;const i=ne();return r({table:i}),()=>{var l;const a=e.columns||D7((l=o.default)===null||l===void 0?void 0:l.call(o));return p(jce,B(B(B({ref:i},n),e),{},{columns:a||[],expandedRowRender:o.expandedRowRender||e.expandedRowRender,contextSlots:m({},o)}),o)}}}),nf=re({name:"ATableColumn",slots:Object,render(){return null}}),of=re({name:"ATableColumnGroup",slots:Object,__ANT_TABLE_COLUMN_GROUP:!0,render(){return null}}),bp=dse,yp=hse,rf=m(gse,{Cell:yp,Row:bp,name:"ATableSummary"}),Vce=m(Gv,{SELECTION_ALL:F0,SELECTION_INVERT:L0,SELECTION_NONE:z0,SELECTION_COLUMN:Wr,EXPAND_COLUMN:Pi,Column:nf,ColumnGroup:of,Summary:rf,install:e=>(e.component(rf.name,rf),e.component(yp.name,yp),e.component(bp.name,bp),e.component(Gv.name,Gv),e.component(nf.name,nf),e.component(of.name,of),e)}),Wce={prefixCls:String,placeholder:String,value:String,handleClear:Function,disabled:{type:Boolean,default:void 0},onChange:Function},Kce=re({compatConfig:{MODE:3},name:"Search",inheritAttrs:!1,props:Qe(Wce,{placeholder:""}),emits:["change"],setup(e,t){let{emit:n}=t;const o=r=>{var i;n("change",r),r.target.value===""&&((i=e.handleClear)===null||i===void 0||i.call(e))};return()=>{const{placeholder:r,value:i,prefixCls:l,disabled:a}=e;return p(un,{placeholder:r,class:l,value:i,onChange:o,disabled:a,allowClear:!0},{prefix:()=>p(Ar,null,null)})}}});var Gce={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};function Z4(e){for(var t=1;t{const{renderedText:o,renderedEl:r,item:i,checked:l,disabled:a,prefixCls:s,showRemove:c}=e,u=le({[`${s}-content-item`]:!0,[`${s}-content-item-disabled`]:a||i.disabled});let d;return(typeof o=="string"||typeof o=="number")&&(d=String(o)),p(Wl,{componentName:"Transfer",defaultLocale:eo.Transfer},{default:f=>{const h=p("span",{class:`${s}-content-item-text`},[r]);return c?p("li",{class:u,title:d},[h,p(gp,{disabled:a||i.disabled,class:`${s}-content-item-remove`,"aria-label":f.remove,onClick:()=>{n("remove",i)}},{default:()=>[p(qh,null,null)]})]):p("li",{class:u,title:d,onClick:a||i.disabled?Xce:()=>{n("click",i)}},[p(jo,{class:`${s}-checkbox`,checked:l,disabled:a||i.disabled},null),h])}})}}}),Jce={prefixCls:String,filteredRenderItems:K.array.def([]),selectedKeys:K.array,disabled:$e(),showRemove:$e(),pagination:K.any,onItemSelect:Function,onScroll:Function,onItemRemove:Function};function Zce(e){if(!e)return null;const t={pageSize:10,simple:!0,showSizeChanger:!1,showLessItems:!1};return typeof e=="object"?m(m({},t),e):t}const Qce=re({compatConfig:{MODE:3},name:"ListBody",inheritAttrs:!1,props:Jce,emits:["itemSelect","itemRemove","scroll"],setup(e,t){let{emit:n,expose:o}=t;const r=ne(1),i=d=>{const{selectedKeys:f}=e,h=f.indexOf(d.key)>=0;n("itemSelect",d.key,!h)},l=d=>{n("itemRemove",[d.key])},a=d=>{n("scroll",d)},s=P(()=>Zce(e.pagination));ye([s,()=>e.filteredRenderItems],()=>{if(s.value){const d=Math.ceil(e.filteredRenderItems.length/s.value.pageSize);r.value=Math.min(r.value,d)}},{immediate:!0});const c=P(()=>{const{filteredRenderItems:d}=e;let f=d;return s.value&&(f=d.slice((r.value-1)*s.value.pageSize,r.value*s.value.pageSize)),f}),u=d=>{r.value=d};return o({items:c}),()=>{const{prefixCls:d,filteredRenderItems:f,selectedKeys:h,disabled:v,showRemove:g}=e;let b=null;s.value&&(b=p(Vh,{simple:s.value.simple,showSizeChanger:s.value.showSizeChanger,showLessItems:s.value.showLessItems,size:"small",disabled:v,class:`${d}-pagination`,total:f.length,pageSize:s.value.pageSize,current:r.value,onChange:u},null));const y=c.value.map(S=>{let{renderedEl:$,renderedText:w,item:C}=S;const{disabled:O}=C,x=h.indexOf(C.key)>=0;return p(qce,{disabled:v||O,key:C.key,item:C,renderedText:w,renderedEl:$,checked:x,prefixCls:d,onClick:i,onRemove:l,showRemove:g},null)});return p(Le,null,[p("ul",{class:le(`${d}-content`,{[`${d}-content-show-remove`]:g}),onScroll:a},[y]),b])}}}),K0=e=>{const t=new Map;return e.forEach((n,o)=>{t.set(n,o)}),t},eue=e=>{const t=new Map;return e.forEach((n,o)=>{let{disabled:r,key:i}=n;r&&t.set(i,o)}),t},tue=()=>null;function nue(e){return!!(e&&!qt(e)&&Object.prototype.toString.call(e)==="[object Object]")}function rd(e){return e.filter(t=>!t.disabled).map(t=>t.key)}const oue={prefixCls:String,dataSource:ct([]),filter:String,filterOption:Function,checkedKeys:K.arrayOf(K.string),handleFilter:Function,handleClear:Function,renderItem:Function,showSearch:$e(!1),searchPlaceholder:String,notFoundContent:K.any,itemUnit:String,itemsUnit:String,renderList:K.any,disabled:$e(),direction:Ne(),showSelectAll:$e(),remove:String,selectAll:String,selectCurrent:String,selectInvert:String,removeAll:String,removeCurrent:String,selectAllLabel:K.any,showRemove:$e(),pagination:K.any,onItemSelect:Function,onItemSelectAll:Function,onItemRemove:Function,onScroll:Function},Q4=re({compatConfig:{MODE:3},name:"TransferList",inheritAttrs:!1,props:oue,slots:Object,setup(e,t){let{attrs:n,slots:o}=t;const r=ne(""),i=ne(),l=ne(),a=(C,O)=>{let x=C?C(O):null;const I=!!x&&kt(x).length>0;return I||(x=p(Qce,B(B({},O),{},{ref:l}),null)),{customize:I,bodyContent:x}},s=C=>{const{renderItem:O=tue}=e,x=O(C),I=nue(x);return{renderedText:I?x.value:x,renderedEl:I?x.label:x,item:C}},c=ne([]),u=ne([]);Ve(()=>{const C=[],O=[];e.dataSource.forEach(x=>{const I=s(x),{renderedText:T}=I;if(r.value&&r.value.trim()&&!y(T,x))return null;C.push(x),O.push(I)}),c.value=C,u.value=O});const d=P(()=>{const{checkedKeys:C}=e;if(C.length===0)return"none";const O=K0(C);return c.value.every(x=>O.has(x.key)||!!x.disabled)?"all":"part"}),f=P(()=>rd(c.value)),h=(C,O)=>Array.from(new Set([...C,...e.checkedKeys])).filter(x=>O.indexOf(x)===-1),v=C=>{let{disabled:O,prefixCls:x}=C;var I;const T=d.value==="all";return p(jo,{disabled:((I=e.dataSource)===null||I===void 0?void 0:I.length)===0||O,checked:T,indeterminate:d.value==="part",class:`${x}-checkbox`,onChange:()=>{const E=f.value;e.onItemSelectAll(h(T?[]:E,T?e.checkedKeys:[]))}},null)},g=C=>{var O;const{target:{value:x}}=C;r.value=x,(O=e.handleFilter)===null||O===void 0||O.call(e,C)},b=C=>{var O;r.value="",(O=e.handleClear)===null||O===void 0||O.call(e,C)},y=(C,O)=>{const{filterOption:x}=e;return x?x(r.value,O):C.includes(r.value)},S=(C,O)=>{const{itemsUnit:x,itemUnit:I,selectAllLabel:T}=e;if(T)return typeof T=="function"?T({selectedCount:C,totalCount:O}):T;const M=O>1?x:I;return p(Le,null,[(C>0?`${C}/`:"")+O,Pt(" "),M])},$=P(()=>Array.isArray(e.notFoundContent)?e.notFoundContent[e.direction==="left"?0:1]:e.notFoundContent),w=(C,O,x,I,T,M)=>{const E=T?p("div",{class:`${C}-body-search-wrapper`},[p(Kce,{prefixCls:`${C}-search`,onChange:g,handleClear:b,placeholder:O,value:r.value,disabled:M},null)]):null;let A;const{onEvents:R}=Eb(n),{bodyContent:z,customize:_}=a(I,m(m(m({},e),{filteredItems:c.value,filteredRenderItems:u.value,selectedKeys:x}),R));return _?A=p("div",{class:`${C}-body-customize-wrapper`},[z]):A=c.value.length?z:p("div",{class:`${C}-body-not-found`},[$.value]),p("div",{class:T?`${C}-body ${C}-body-with-search`:`${C}-body`,ref:i},[E,A])};return()=>{var C,O;const{prefixCls:x,checkedKeys:I,disabled:T,showSearch:M,searchPlaceholder:E,selectAll:A,selectCurrent:R,selectInvert:z,removeAll:_,removeCurrent:D,renderList:N,onItemSelectAll:k,onItemRemove:F,showSelectAll:L=!0,showRemove:H,pagination:j}=e,Y=(C=o.footer)===null||C===void 0?void 0:C.call(o,m({},e)),Z=le(x,{[`${x}-with-pagination`]:!!j,[`${x}-with-footer`]:!!Y}),X=w(x,E,I,N,M,T),ee=Y?p("div",{class:`${x}-footer`},[Y]):null,U=!H&&!j&&v({disabled:T,prefixCls:x});let Q=null;H?Q=p(Xt,null,{default:()=>[j&&p(Xt.Item,{key:"removeCurrent",onClick:()=>{const G=rd((l.value.items||[]).map(q=>q.item));F==null||F(G)}},{default:()=>[D]}),p(Xt.Item,{key:"removeAll",onClick:()=>{F==null||F(f.value)}},{default:()=>[_]})]}):Q=p(Xt,null,{default:()=>[p(Xt.Item,{key:"selectAll",onClick:()=>{const G=f.value;k(h(G,[]))}},{default:()=>[A]}),j&&p(Xt.Item,{onClick:()=>{const G=rd((l.value.items||[]).map(q=>q.item));k(h(G,[]))}},{default:()=>[R]}),p(Xt.Item,{key:"selectInvert",onClick:()=>{let G;j?G=rd((l.value.items||[]).map(te=>te.item)):G=f.value;const q=new Set(I),V=[],W=[];G.forEach(te=>{q.has(te)?W.push(te):V.push(te)}),k(h(V,W))}},{default:()=>[z]})]});const J=p(rr,{class:`${x}-header-dropdown`,overlay:Q,disabled:T},{default:()=>[p(Jl,null,null)]});return p("div",{class:Z,style:n.style},[p("div",{class:`${x}-header`},[L?p(Le,null,[U,J]):null,p("span",{class:`${x}-header-selected`},[p("span",null,[S(I.length,c.value.length)]),p("span",{class:`${x}-header-title`},[(O=o.titleText)===null||O===void 0?void 0:O.call(o)])])]),X,ee])}}});function e3(){}const wS=e=>{const{disabled:t,moveToLeft:n=e3,moveToRight:o=e3,leftArrowText:r="",rightArrowText:i="",leftActive:l,rightActive:a,class:s,style:c,direction:u,oneWay:d}=e;return p("div",{class:s,style:c},[p(Wt,{type:"primary",size:"small",disabled:t||!a,onClick:o,icon:p(u!=="rtl"?Eo:Dr,null,null)},{default:()=>[i]}),!d&&p(Wt,{type:"primary",size:"small",disabled:t||!l,onClick:n,icon:p(u!=="rtl"?Dr:Eo,null,null)},{default:()=>[r]})])};wS.displayName="Operation";wS.inheritAttrs=!1;const rue=e=>{const{antCls:t,componentCls:n,listHeight:o,controlHeightLG:r,marginXXS:i,margin:l}=e,a=`${t}-table`,s=`${t}-input`;return{[`${n}-customize-list`]:{[`${n}-list`]:{flex:"1 1 50%",width:"auto",height:"auto",minHeight:o},[`${a}-wrapper`]:{[`${a}-small`]:{border:0,borderRadius:0,[`${a}-selection-column`]:{width:r,minWidth:r}},[`${a}-pagination${a}-pagination`]:{margin:`${l}px 0 ${i}px`}},[`${s}[disabled]`]:{backgroundColor:"transparent"}}}},t3=(e,t)=>{const{componentCls:n,colorBorder:o}=e;return{[`${n}-list`]:{borderColor:t,"&-search:not([disabled])":{borderColor:o}}}},iue=e=>{const{componentCls:t}=e;return{[`${t}-status-error`]:m({},t3(e,e.colorError)),[`${t}-status-warning`]:m({},t3(e,e.colorWarning))}},lue=e=>{const{componentCls:t,colorBorder:n,colorSplit:o,lineWidth:r,transferItemHeight:i,transferHeaderHeight:l,transferHeaderVerticalPadding:a,transferItemPaddingVertical:s,controlItemBgActive:c,controlItemBgActiveHover:u,colorTextDisabled:d,listHeight:f,listWidth:h,listWidthLG:v,fontSizeIcon:g,marginXS:b,paddingSM:y,lineType:S,iconCls:$,motionDurationSlow:w}=e;return{display:"flex",flexDirection:"column",width:h,height:f,border:`${r}px ${S} ${n}`,borderRadius:e.borderRadiusLG,"&-with-pagination":{width:v,height:"auto"},"&-search":{[`${$}-search`]:{color:d}},"&-header":{display:"flex",flex:"none",alignItems:"center",height:l,padding:`${a-r}px ${y}px ${a}px`,color:e.colorText,background:e.colorBgContainer,borderBottom:`${r}px ${S} ${o}`,borderRadius:`${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`,"> *:not(:last-child)":{marginInlineEnd:4},"> *":{flex:"none"},"&-title":m(m({},Jt),{flex:"auto",textAlign:"end"}),"&-dropdown":m(m({},Kl()),{fontSize:g,transform:"translateY(10%)",cursor:"pointer","&[disabled]":{cursor:"not-allowed"}})},"&-body":{display:"flex",flex:"auto",flexDirection:"column",overflow:"hidden",fontSize:e.fontSize,"&-search-wrapper":{position:"relative",flex:"none",padding:y}},"&-content":{flex:"auto",margin:0,padding:0,overflow:"auto",listStyle:"none","&-item":{display:"flex",alignItems:"center",minHeight:i,padding:`${s}px ${y}px`,transition:`all ${w}`,"> *:not(:last-child)":{marginInlineEnd:b},"> *":{flex:"none"},"&-text":m(m({},Jt),{flex:"auto"}),"&-remove":{position:"relative",color:n,cursor:"pointer",transition:`all ${w}`,"&:hover":{color:e.colorLinkHover},"&::after":{position:"absolute",insert:`-${s}px -50%`,content:'""'}},[`&:not(${t}-list-content-item-disabled)`]:{"&:hover":{backgroundColor:e.controlItemBgHover,cursor:"pointer"},[`&${t}-list-content-item-checked:hover`]:{backgroundColor:u}},"&-checked":{backgroundColor:c},"&-disabled":{color:d,cursor:"not-allowed"}},[`&-show-remove ${t}-list-content-item:not(${t}-list-content-item-disabled):hover`]:{background:"transparent",cursor:"default"}},"&-pagination":{padding:`${e.paddingXS}px 0`,textAlign:"end",borderTop:`${r}px ${S} ${o}`},"&-body-not-found":{flex:"none",width:"100%",margin:"auto 0",color:d,textAlign:"center"},"&-footer":{borderTop:`${r}px ${S} ${o}`},"&-checkbox":{lineHeight:1}}},aue=e=>{const{antCls:t,iconCls:n,componentCls:o,transferHeaderHeight:r,marginXS:i,marginXXS:l,fontSizeIcon:a,fontSize:s,lineHeight:c}=e;return{[o]:m(m({},qe(e)),{position:"relative",display:"flex",alignItems:"stretch",[`${o}-disabled`]:{[`${o}-list`]:{background:e.colorBgContainerDisabled}},[`${o}-list`]:lue(e),[`${o}-operation`]:{display:"flex",flex:"none",flexDirection:"column",alignSelf:"center",margin:`0 ${i}px`,verticalAlign:"middle",[`${t}-btn`]:{display:"block","&:first-child":{marginBottom:l},[n]:{fontSize:a}}},[`${t}-empty-image`]:{maxHeight:r/2-Math.round(s*c)}})}},sue=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},cue=Ue("Transfer",e=>{const{fontSize:t,lineHeight:n,lineWidth:o,controlHeightLG:r,controlHeight:i}=e,l=Math.round(t*n),a=r,s=i,c=ze(e,{transferItemHeight:s,transferHeaderHeight:a,transferHeaderVerticalPadding:Math.ceil((a-o-l)/2),transferItemPaddingVertical:(s-l)/2});return[aue(c),rue(c),iue(c),sue(c)]},{listWidth:180,listHeight:200,listWidthLG:250}),uue=()=>({id:String,prefixCls:String,dataSource:ct([]),disabled:$e(),targetKeys:ct(),selectedKeys:ct(),render:ve(),listStyle:He([Function,Object],()=>({})),operationStyle:Be(void 0),titles:ct(),operations:ct(),showSearch:$e(!1),filterOption:ve(),searchPlaceholder:String,notFoundContent:K.any,locale:Be(),rowKey:ve(),showSelectAll:$e(),selectAllLabels:ct(),children:ve(),oneWay:$e(),pagination:He([Object,Boolean]),status:Ne(),onChange:ve(),onSelectChange:ve(),onSearch:ve(),onScroll:ve(),"onUpdate:targetKeys":ve(),"onUpdate:selectedKeys":ve()}),due=re({compatConfig:{MODE:3},name:"ATransfer",inheritAttrs:!1,props:uue(),slots:Object,setup(e,t){let{emit:n,attrs:o,slots:r,expose:i}=t;const{configProvider:l,prefixCls:a,direction:s}=Ee("transfer",e),[c,u]=cue(a),d=ne([]),f=ne([]),h=an(),v=yn.useInject(),g=P(()=>fr(v.status,e.status));ye(()=>e.selectedKeys,()=>{var X,ee;d.value=((X=e.selectedKeys)===null||X===void 0?void 0:X.filter(U=>e.targetKeys.indexOf(U)===-1))||[],f.value=((ee=e.selectedKeys)===null||ee===void 0?void 0:ee.filter(U=>e.targetKeys.indexOf(U)>-1))||[]},{immediate:!0});const b=(X,ee)=>{const U={notFoundContent:ee("Transfer")},Q=ln(r,e,"notFoundContent");return Q&&(U.notFoundContent=Q),e.searchPlaceholder!==void 0&&(U.searchPlaceholder=e.searchPlaceholder),m(m(m({},X),U),e.locale)},y=X=>{const{targetKeys:ee=[],dataSource:U=[]}=e,Q=X==="right"?d.value:f.value,J=eue(U),G=Q.filter(te=>!J.has(te)),q=K0(G),V=X==="right"?G.concat(ee):ee.filter(te=>!q.has(te)),W=X==="right"?"left":"right";X==="right"?d.value=[]:f.value=[],n("update:targetKeys",V),x(W,[]),n("change",V,X,G),h.onFieldChange()},S=()=>{y("left")},$=()=>{y("right")},w=(X,ee)=>{x(X,ee)},C=X=>w("left",X),O=X=>w("right",X),x=(X,ee)=>{X==="left"?(e.selectedKeys||(d.value=ee),n("update:selectedKeys",[...ee,...f.value]),n("selectChange",ee,tt(f.value))):(e.selectedKeys||(f.value=ee),n("update:selectedKeys",[...ee,...d.value]),n("selectChange",tt(d.value),ee))},I=(X,ee)=>{const U=ee.target.value;n("search",X,U)},T=X=>{I("left",X)},M=X=>{I("right",X)},E=X=>{n("search",X,"")},A=()=>{E("left")},R=()=>{E("right")},z=(X,ee,U)=>{const Q=X==="left"?[...d.value]:[...f.value],J=Q.indexOf(ee);J>-1&&Q.splice(J,1),U&&Q.push(ee),x(X,Q)},_=(X,ee)=>z("left",X,ee),D=(X,ee)=>z("right",X,ee),N=X=>{const{targetKeys:ee=[]}=e,U=ee.filter(Q=>!X.includes(Q));n("update:targetKeys",U),n("change",U,"left",[...X])},k=(X,ee)=>{n("scroll",X,ee)},F=X=>{k("left",X)},L=X=>{k("right",X)},H=(X,ee)=>typeof X=="function"?X({direction:ee}):X,j=ne([]),Y=ne([]);Ve(()=>{const{dataSource:X,rowKey:ee,targetKeys:U=[]}=e,Q=[],J=new Array(U.length),G=K0(U);X.forEach(q=>{ee&&(q.key=ee(q)),G.has(q.key)?J[G.get(q.key)]=q:Q.push(q)}),j.value=Q,Y.value=J}),i({handleSelectChange:x});const Z=X=>{var ee,U,Q,J,G,q;const{disabled:V,operations:W=[],showSearch:te,listStyle:ue,operationStyle:ie,filterOption:ae,showSelectAll:ce,selectAllLabels:se=[],oneWay:pe,pagination:he,id:ge=h.id.value}=e,{class:me,style:xe}=o,fe=r.children,de=!fe&&he,be=l.renderEmpty,we=b(X,be),{footer:Te}=r,Re=e.render||r.render,Se=f.value.length>0,Ce=d.value.length>0,Pe=le(a.value,me,{[`${a.value}-disabled`]:V,[`${a.value}-customize-list`]:!!fe,[`${a.value}-rtl`]:s.value==="rtl"},Fn(a.value,g.value,v.hasFeedback),u.value),Me=e.titles,De=(Q=(ee=Me&&Me[0])!==null&&ee!==void 0?ee:(U=r.leftTitle)===null||U===void 0?void 0:U.call(r))!==null&&Q!==void 0?Q:(we.titles||["",""])[0],Ae=(q=(J=Me&&Me[1])!==null&&J!==void 0?J:(G=r.rightTitle)===null||G===void 0?void 0:G.call(r))!==null&&q!==void 0?q:(we.titles||["",""])[1];return p("div",B(B({},o),{},{class:Pe,style:xe,id:ge}),[p(Q4,B({key:"leftList",prefixCls:`${a.value}-list`,dataSource:j.value,filterOption:ae,style:H(ue,"left"),checkedKeys:d.value,handleFilter:T,handleClear:A,onItemSelect:_,onItemSelectAll:C,renderItem:Re,showSearch:te,renderList:fe,onScroll:F,disabled:V,direction:s.value==="rtl"?"right":"left",showSelectAll:ce,selectAllLabel:se[0]||r.leftSelectAllLabel,pagination:de},we),{titleText:()=>De,footer:Te}),p(wS,{key:"operation",class:`${a.value}-operation`,rightActive:Ce,rightArrowText:W[0],moveToRight:$,leftActive:Se,leftArrowText:W[1],moveToLeft:S,style:ie,disabled:V,direction:s.value,oneWay:pe},null),p(Q4,B({key:"rightList",prefixCls:`${a.value}-list`,dataSource:Y.value,filterOption:ae,style:H(ue,"right"),checkedKeys:f.value,handleFilter:M,handleClear:R,onItemSelect:D,onItemSelectAll:O,onItemRemove:N,renderItem:Re,showSearch:te,renderList:fe,onScroll:L,disabled:V,direction:s.value==="rtl"?"left":"right",showSelectAll:ce,selectAllLabel:se[1]||r.rightSelectAllLabel,showRemove:pe,pagination:de},we),{titleText:()=>Ae,footer:Te})])};return()=>c(p(Wl,{componentName:"Transfer",defaultLocale:eo.Transfer,children:Z},null))}}),fue=Bt(due);function pue(e){return Array.isArray(e)?e:e!==void 0?[e]:[]}function hue(e){const{label:t,value:n,children:o}=e||{},r=n||"value";return{_title:t?[t]:["title","label"],value:r,key:r,children:o||"children"}}function G0(e){return e.disabled||e.disableCheckbox||e.checkable===!1}function gue(e,t){const n=[];function o(r){r.forEach(i=>{n.push(i[t.value]);const l=i[t.children];l&&o(l)})}return o(e),n}function n3(e){return e==null}const Y7=Symbol("TreeSelectContextPropsKey");function vue(e){return Ye(Y7,e)}function mue(){return Ge(Y7,{})}const bue={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},yue=re({compatConfig:{MODE:3},name:"OptionList",inheritAttrs:!1,setup(e,t){let{slots:n,expose:o}=t;const r=Qc(),i=ih(),l=mue(),a=ne(),s=gy(()=>l.treeData,[()=>r.open,()=>l.treeData],C=>C[0]),c=P(()=>{const{checkable:C,halfCheckedKeys:O,checkedKeys:x}=i;return C?{checked:x,halfChecked:O}:null});ye(()=>r.open,()=>{rt(()=>{var C;r.open&&!r.multiple&&i.checkedKeys.length&&((C=a.value)===null||C===void 0||C.scrollTo({key:i.checkedKeys[0]}))})},{immediate:!0,flush:"post"});const u=P(()=>String(r.searchValue).toLowerCase()),d=C=>u.value?String(C[i.treeNodeFilterProp]).toLowerCase().includes(u.value):!1,f=oe(i.treeDefaultExpandedKeys),h=oe(null);ye(()=>r.searchValue,()=>{r.searchValue&&(h.value=gue(tt(l.treeData),tt(l.fieldNames)))},{immediate:!0});const v=P(()=>i.treeExpandedKeys?i.treeExpandedKeys.slice():r.searchValue?h.value:f.value),g=C=>{var O;f.value=C,h.value=C,(O=i.onTreeExpand)===null||O===void 0||O.call(i,C)},b=C=>{C.preventDefault()},y=(C,O)=>{let{node:x}=O;var I,T;const{checkable:M,checkedKeys:E}=i;M&&G0(x)||((I=l.onSelect)===null||I===void 0||I.call(l,x.key,{selected:!E.includes(x.key)}),r.multiple||(T=r.toggleOpen)===null||T===void 0||T.call(r,!1))},S=ne(null),$=P(()=>i.keyEntities[S.value]),w=C=>{S.value=C};return o({scrollTo:function(){for(var C,O,x=arguments.length,I=new Array(x),T=0;T{var O;const{which:x}=C;switch(x){case Ie.UP:case Ie.DOWN:case Ie.LEFT:case Ie.RIGHT:(O=a.value)===null||O===void 0||O.onKeydown(C);break;case Ie.ENTER:{if($.value){const{selectable:I,value:T}=$.value.node||{};I!==!1&&y(null,{node:{key:S.value},selected:!i.checkedKeys.includes(T)})}break}case Ie.ESC:r.toggleOpen(!1)}},onKeyup:()=>{}}),()=>{var C;const{prefixCls:O,multiple:x,searchValue:I,open:T,notFoundContent:M=(C=n.notFoundContent)===null||C===void 0?void 0:C.call(n)}=r,{listHeight:E,listItemHeight:A,virtual:R,dropdownMatchSelectWidth:z,treeExpandAction:_}=l,{checkable:D,treeDefaultExpandAll:N,treeIcon:k,showTreeIcon:F,switcherIcon:L,treeLine:H,loadData:j,treeLoadedKeys:Y,treeMotion:Z,onTreeLoad:X,checkedKeys:ee}=i;if(s.value.length===0)return p("div",{role:"listbox",class:`${O}-empty`,onMousedown:b},[M]);const U={fieldNames:l.fieldNames};return Y&&(U.loadedKeys=Y),v.value&&(U.expandedKeys=v.value),p("div",{onMousedown:b},[$.value&&T&&p("span",{style:bue,"aria-live":"assertive"},[$.value.node.value]),p(k7,B(B({ref:a,focusable:!1,prefixCls:`${O}-tree`,treeData:s.value,height:E,itemHeight:A,virtual:R!==!1&&z!==!1,multiple:x,icon:k,showIcon:F,switcherIcon:L,showLine:H,loadData:I?null:j,motion:Z,activeKey:S.value,checkable:D,checkStrictly:!0,checkedKeys:c.value,selectedKeys:D?[]:ee,defaultExpandAll:N},U),{},{onActiveChange:w,onSelect:y,onCheck:y,onExpand:g,onLoad:X,filterTreeNode:d,expandAction:_}),m(m({},n),{checkable:i.customSlots.treeCheckable}))])}}}),Sue="SHOW_ALL",q7="SHOW_PARENT",OS="SHOW_CHILD";function o3(e,t,n,o){const r=new Set(e);return t===OS?e.filter(i=>{const l=n[i];return!(l&&l.children&&l.children.some(a=>{let{node:s}=a;return r.has(s[o.value])})&&l.children.every(a=>{let{node:s}=a;return G0(s)||r.has(s[o.value])}))}):t===q7?e.filter(i=>{const l=n[i],a=l?l.parent:null;return!(a&&!G0(a.node)&&r.has(a.key))}):e}const ms=()=>null;ms.inheritAttrs=!1;ms.displayName="ATreeSelectNode";ms.isTreeSelectNode=!0;var $ue=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r0&&arguments[0]!==void 0?arguments[0]:[];return kt(n).map(o=>{var r,i,l;if(!Cue(o))return null;const a=o.children||{},s=o.key,c={};for(const[x,I]of Object.entries(o.props))c[rs(x)]=I;const{isLeaf:u,checkable:d,selectable:f,disabled:h,disableCheckbox:v}=c,g={isLeaf:u||u===""||void 0,checkable:d||d===""||void 0,selectable:f||f===""||void 0,disabled:h||h===""||void 0,disableCheckbox:v||v===""||void 0},b=m(m({},c),g),{title:y=(r=a.title)===null||r===void 0?void 0:r.call(a,b),switcherIcon:S=(i=a.switcherIcon)===null||i===void 0?void 0:i.call(a,b)}=c,$=$ue(c,["title","switcherIcon"]),w=(l=a.default)===null||l===void 0?void 0:l.call(a),C=m(m(m({},$),{title:y,switcherIcon:S,key:s,isLeaf:u}),g),O=t(w);return O.length&&(C.children=O),C})}return t(e)}function U0(e){if(!e)return e;const t=m({},e);return"props"in t||Object.defineProperty(t,"props",{get(){return t}}),t}function wue(e,t,n,o,r,i){let l=null,a=null;function s(){function c(u){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.map((h,v)=>{const g=`${d}-${v}`,b=h[i.value],y=n.includes(b),S=c(h[i.children]||[],g,y),$=p(ms,h,{default:()=>[S.map(w=>w.node)]});if(t===b&&(l=$),y){const w={pos:g,node:$,children:S};return f||a.push(w),w}return null}).filter(h=>h)}a||(a=[],c(o),a.sort((u,d)=>{let{node:{props:{value:f}}}=u,{node:{props:{value:h}}}=d;const v=n.indexOf(f),g=n.indexOf(h);return v-g}))}Object.defineProperty(e,"triggerNode",{get(){return s(),l}}),Object.defineProperty(e,"allCheckedNodes",{get(){return s(),r?a:a.map(c=>{let{node:u}=c;return u})}})}function Oue(e,t){let{id:n,pId:o,rootPId:r}=t;const i={},l=[];return e.map(s=>{const c=m({},s),u=c[n];return i[u]=c,c.key=c.key||u,c}).forEach(s=>{const c=s[o],u=i[c];u&&(u.children=u.children||[],u.children.push(s)),(c===r||!u&&r===null)&&l.push(s)}),l}function Pue(e,t,n){const o=oe();return ye([n,e,t],()=>{const r=n.value;e.value?o.value=n.value?Oue(tt(e.value),m({id:"id",pId:"pId",rootPId:null},r!==!0?r:{})):tt(e.value).slice():o.value=xue(tt(t.value))},{immediate:!0,deep:!0}),o}const Iue=e=>{const t=oe({valueLabels:new Map}),n=oe();return ye(e,()=>{n.value=tt(e.value)},{immediate:!0}),[P(()=>{const{valueLabels:r}=t.value,i=new Map,l=n.value.map(a=>{var s;const{value:c}=a,u=(s=a.label)!==null&&s!==void 0?s:r.get(c);return i.set(c,u),m(m({},a),{label:u})});return t.value.valueLabels=i,l})]},Tue=(e,t)=>{const n=oe(new Map),o=oe({});return Ve(()=>{const r=t.value,i=du(e.value,{fieldNames:r,initWrapper:l=>m(m({},l),{valueEntities:new Map}),processEntity:(l,a)=>{const s=l.node[r.value];a.valueEntities.set(s,l)}});n.value=i.valueEntities,o.value=i.keyEntities}),{valueEntities:n,keyEntities:o}},Eue=(e,t,n,o,r,i)=>{const l=oe([]),a=oe([]);return Ve(()=>{let s=e.value.map(d=>{let{value:f}=d;return f}),c=t.value.map(d=>{let{value:f}=d;return f});const u=s.filter(d=>!o.value[d]);n.value&&({checkedKeys:s,halfCheckedKeys:c}=Ho(s,!0,o.value,r.value,i.value)),l.value=Array.from(new Set([...u,...s])),a.value=c}),[l,a]},_ue=(e,t,n)=>{let{treeNodeFilterProp:o,filterTreeNode:r,fieldNames:i}=n;return P(()=>{const{children:l}=i.value,a=t.value,s=o==null?void 0:o.value;if(!a||r.value===!1)return e.value;let c;if(typeof r.value=="function")c=r.value;else{const d=a.toUpperCase();c=(f,h)=>{const v=h[s];return String(v).toUpperCase().includes(d)}}function u(d){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const h=[];for(let v=0,g=d.length;ve.treeCheckable&&!e.treeCheckStrictly),a=P(()=>e.treeCheckable||e.treeCheckStrictly),s=P(()=>e.treeCheckStrictly||e.labelInValue),c=P(()=>a.value||e.multiple),u=P(()=>hue(e.fieldNames)),[d,f]=Dt("",{value:P(()=>e.searchValue!==void 0?e.searchValue:e.inputValue),postState:ge=>ge||""}),h=ge=>{var me;f(ge),(me=e.onSearch)===null||me===void 0||me.call(e,ge)},v=Pue(We(e,"treeData"),We(e,"children"),We(e,"treeDataSimpleMode")),{keyEntities:g,valueEntities:b}=Tue(v,u),y=ge=>{const me=[],xe=[];return ge.forEach(fe=>{b.value.has(fe)?xe.push(fe):me.push(fe)}),{missingRawValues:me,existRawValues:xe}},S=_ue(v,d,{fieldNames:u,treeNodeFilterProp:We(e,"treeNodeFilterProp"),filterTreeNode:We(e,"filterTreeNode")}),$=ge=>{if(ge){if(e.treeNodeLabelProp)return ge[e.treeNodeLabelProp];const{_title:me}=u.value;for(let xe=0;xepue(ge).map(xe=>Mue(xe)?{value:xe}:xe),C=ge=>w(ge).map(xe=>{let{label:fe}=xe;const{value:de,halfChecked:be}=xe;let we;const Te=b.value.get(de);return Te&&(fe=fe??$(Te.node),we=Te.node.disabled),{label:fe,value:de,halfChecked:be,disabled:we}}),[O,x]=Dt(e.defaultValue,{value:We(e,"value")}),I=P(()=>w(O.value)),T=oe([]),M=oe([]);Ve(()=>{const ge=[],me=[];I.value.forEach(xe=>{xe.halfChecked?me.push(xe):ge.push(xe)}),T.value=ge,M.value=me});const E=P(()=>T.value.map(ge=>ge.value)),{maxLevel:A,levelEntities:R}=Rh(g),[z,_]=Eue(T,M,l,g,A,R),D=P(()=>{const xe=o3(z.value,e.showCheckedStrategy,g.value,u.value).map(be=>{var we,Te,Re;return(Re=(Te=(we=g.value[be])===null||we===void 0?void 0:we.node)===null||Te===void 0?void 0:Te[u.value.value])!==null&&Re!==void 0?Re:be}).map(be=>{const we=T.value.find(Te=>Te.value===be);return{value:be,label:we==null?void 0:we.label}}),fe=C(xe),de=fe[0];return!c.value&&de&&n3(de.value)&&n3(de.label)?[]:fe.map(be=>{var we;return m(m({},be),{label:(we=be.label)!==null&&we!==void 0?we:be.value})})}),[N]=Iue(D),k=(ge,me,xe)=>{const fe=C(ge);if(x(fe),e.autoClearSearchValue&&f(""),e.onChange){let de=ge;l.value&&(de=o3(ge,e.showCheckedStrategy,g.value,u.value).map(De=>{const Ae=b.value.get(De);return Ae?Ae.node[u.value.value]:De}));const{triggerValue:be,selected:we}=me||{triggerValue:void 0,selected:void 0};let Te=de;if(e.treeCheckStrictly){const Me=M.value.filter(De=>!de.includes(De.value));Te=[...Te,...Me]}const Re=C(Te),Se={preValue:T.value,triggerValue:be};let Ce=!0;(e.treeCheckStrictly||xe==="selection"&&!we)&&(Ce=!1),wue(Se,be,ge,v.value,Ce,u.value),a.value?Se.checked=we:Se.selected=we;const Pe=s.value?Re:Re.map(Me=>Me.value);e.onChange(c.value?Pe:Pe[0],s.value?null:Re.map(Me=>Me.label),Se)}},F=(ge,me)=>{let{selected:xe,source:fe}=me;var de,be,we;const Te=tt(g.value),Re=tt(b.value),Se=Te[ge],Ce=Se==null?void 0:Se.node,Pe=(de=Ce==null?void 0:Ce[u.value.value])!==null&&de!==void 0?de:ge;if(!c.value)k([Pe],{selected:!0,triggerValue:Pe},"option");else{let Me=xe?[...E.value,Pe]:z.value.filter(De=>De!==Pe);if(l.value){const{missingRawValues:De,existRawValues:Ae}=y(Me),Fe=Ae.map(ht=>Re.get(ht).key);let lt;xe?{checkedKeys:lt}=Ho(Fe,!0,Te,A.value,R.value):{checkedKeys:lt}=Ho(Fe,{halfCheckedKeys:_.value},Te,A.value,R.value),Me=[...De,...lt.map(ht=>Te[ht].node[u.value.value])]}k(Me,{selected:xe,triggerValue:Pe},fe||"option")}xe||!c.value?(be=e.onSelect)===null||be===void 0||be.call(e,Pe,U0(Ce)):(we=e.onDeselect)===null||we===void 0||we.call(e,Pe,U0(Ce))},L=ge=>{if(e.onDropdownVisibleChange){const me={};Object.defineProperty(me,"documentClickClose",{get(){return!1}}),e.onDropdownVisibleChange(ge,me)}},H=(ge,me)=>{const xe=ge.map(fe=>fe.value);if(me.type==="clear"){k(xe,{},"selection");return}me.values.length&&F(me.values[0].value,{selected:!1,source:"selection"})},{treeNodeFilterProp:j,loadData:Y,treeLoadedKeys:Z,onTreeLoad:X,treeDefaultExpandAll:ee,treeExpandedKeys:U,treeDefaultExpandedKeys:Q,onTreeExpand:J,virtual:G,listHeight:q,listItemHeight:V,treeLine:W,treeIcon:te,showTreeIcon:ue,switcherIcon:ie,treeMotion:ae,customSlots:ce,dropdownMatchSelectWidth:se,treeExpandAction:pe}=nr(e);YL(Rf({checkable:a,loadData:Y,treeLoadedKeys:Z,onTreeLoad:X,checkedKeys:z,halfCheckedKeys:_,treeDefaultExpandAll:ee,treeExpandedKeys:U,treeDefaultExpandedKeys:Q,onTreeExpand:J,treeIcon:te,treeMotion:ae,showTreeIcon:ue,switcherIcon:ie,treeLine:W,treeNodeFilterProp:j,keyEntities:g,customSlots:ce})),vue(Rf({virtual:G,listHeight:q,listItemHeight:V,treeData:S,fieldNames:u,onSelect:F,dropdownMatchSelectWidth:se,treeExpandAction:pe}));const he=ne();return o({focus(){var ge;(ge=he.value)===null||ge===void 0||ge.focus()},blur(){var ge;(ge=he.value)===null||ge===void 0||ge.blur()},scrollTo(ge){var me;(me=he.value)===null||me===void 0||me.scrollTo(ge)}}),()=>{var ge;const me=ot(e,["id","prefixCls","customSlots","value","defaultValue","onChange","onSelect","onDeselect","searchValue","inputValue","onSearch","autoClearSearchValue","filterTreeNode","treeNodeFilterProp","showCheckedStrategy","treeNodeLabelProp","multiple","treeCheckable","treeCheckStrictly","labelInValue","fieldNames","treeDataSimpleMode","treeData","children","loadData","treeLoadedKeys","onTreeLoad","treeDefaultExpandAll","treeExpandedKeys","treeDefaultExpandedKeys","onTreeExpand","virtual","listHeight","listItemHeight","onDropdownVisibleChange","treeLine","treeIcon","showTreeIcon","switcherIcon","treeMotion"]);return p(hy,B(B(B({ref:he},n),me),{},{id:i,prefixCls:e.prefixCls,mode:c.value?"multiple":void 0,displayValues:N.value,onDisplayValuesChange:H,searchValue:d.value,onSearch:h,OptionList:yue,emptyOptions:!v.value.length,onDropdownVisibleChange:L,tagRender:e.tagRender||r.tagRender,dropdownMatchSelectWidth:(ge=e.dropdownMatchSelectWidth)!==null&&ge!==void 0?ge:!0}),r)}}}),Rue=e=>{const{componentCls:t,treePrefixCls:n,colorBgElevated:o}=e,r=`.${n}`;return[{[`${t}-dropdown`]:[{padding:`${e.paddingXS}px ${e.paddingXS/2}px`},L7(n,ze(e,{colorBgContainer:o})),{[r]:{borderRadius:0,"&-list-holder-inner":{alignItems:"stretch",[`${r}-treenode`]:{[`${r}-node-content-wrapper`]:{flex:"auto"}}}}},kh(`${n}-checkbox`,e),{"&-rtl":{direction:"rtl",[`${r}-switcher${r}-switcher_close`]:{[`${r}-switcher-icon svg`]:{transform:"rotate(90deg)"}}}}]}]};function Due(e,t){return Ue("TreeSelect",n=>{const o=ze(n,{treePrefixCls:t.value});return[Rue(o)]})(e)}const r3=(e,t,n)=>n!==void 0?n:`${e}-${t}`;function Bue(){return m(m({},ot(J7(),["showTreeIcon","treeMotion","inputIcon","getInputElement","treeLine","customSlots"])),{suffixIcon:K.any,size:Ne(),bordered:$e(),treeLine:He([Boolean,Object]),replaceFields:Be(),placement:Ne(),status:Ne(),popupClassName:String,dropdownClassName:String,"onUpdate:value":ve(),"onUpdate:treeExpandedKeys":ve(),"onUpdate:searchValue":ve()})}const Uv=re({compatConfig:{MODE:3},name:"ATreeSelect",inheritAttrs:!1,props:Qe(Bue(),{choiceTransitionName:"",listHeight:256,treeIcon:!1,listItemHeight:26,bordered:!0}),slots:Object,setup(e,t){let{attrs:n,slots:o,expose:r,emit:i}=t;e.treeData===void 0&&o.default,Mt(e.multiple!==!1||!e.treeCheckable,"TreeSelect","`multiple` will always be `true` when `treeCheckable` is true"),Mt(e.replaceFields===void 0,"TreeSelect","`replaceFields` is deprecated, please use fieldNames instead"),Mt(!e.dropdownClassName,"TreeSelect","`dropdownClassName` is deprecated. Please use `popupClassName` instead.");const l=an(),a=yn.useInject(),s=P(()=>fr(a.status,e.status)),{prefixCls:c,renderEmpty:u,direction:d,virtual:f,dropdownMatchSelectWidth:h,size:v,getPopupContainer:g,getPrefixCls:b,disabled:y}=Ee("select",e),{compactSize:S,compactItemClassnames:$}=Yi(c,d),w=P(()=>S.value||v.value),C=po(),O=P(()=>{var Z;return(Z=y.value)!==null&&Z!==void 0?Z:C.value}),x=P(()=>b()),I=P(()=>e.placement!==void 0?e.placement:d.value==="rtl"?"bottomRight":"bottomLeft"),T=P(()=>r3(x.value,uy(I.value),e.transitionName)),M=P(()=>r3(x.value,"",e.choiceTransitionName)),E=P(()=>b("select-tree",e.prefixCls)),A=P(()=>b("tree-select",e.prefixCls)),[R,z]=Ny(c),[_]=Due(A,E),D=P(()=>le(e.popupClassName||e.dropdownClassName,`${A.value}-dropdown`,{[`${A.value}-dropdown-rtl`]:d.value==="rtl"},z.value)),N=P(()=>!!(e.treeCheckable||e.multiple)),k=P(()=>e.showArrow!==void 0?e.showArrow:e.loading||!N.value),F=ne();r({focus(){var Z,X;(X=(Z=F.value).focus)===null||X===void 0||X.call(Z)},blur(){var Z,X;(X=(Z=F.value).blur)===null||X===void 0||X.call(Z)}});const L=function(){for(var Z=arguments.length,X=new Array(Z),ee=0;ee{i("update:treeExpandedKeys",Z),i("treeExpand",Z)},j=Z=>{i("update:searchValue",Z),i("search",Z)},Y=Z=>{i("blur",Z),l.onFieldBlur()};return()=>{var Z,X,ee;const{notFoundContent:U=(Z=o.notFoundContent)===null||Z===void 0?void 0:Z.call(o),prefixCls:Q,bordered:J,listHeight:G,listItemHeight:q,multiple:V,treeIcon:W,treeLine:te,showArrow:ue,switcherIcon:ie=(X=o.switcherIcon)===null||X===void 0?void 0:X.call(o),fieldNames:ae=e.replaceFields,id:ce=l.id.value,placeholder:se=(ee=o.placeholder)===null||ee===void 0?void 0:ee.call(o)}=e,{isFormItemInput:pe,hasFeedback:he,feedbackIcon:ge}=a,{suffixIcon:me,removeIcon:xe,clearIcon:fe}=$y(m(m({},e),{multiple:N.value,showArrow:k.value,hasFeedback:he,feedbackIcon:ge,prefixCls:c.value}),o);let de;U!==void 0?de=U:de=u("Select");const be=ot(e,["suffixIcon","itemIcon","removeIcon","clearIcon","switcherIcon","bordered","status","onUpdate:value","onUpdate:treeExpandedKeys","onUpdate:searchValue"]),we=le(!Q&&A.value,{[`${c.value}-lg`]:w.value==="large",[`${c.value}-sm`]:w.value==="small",[`${c.value}-rtl`]:d.value==="rtl",[`${c.value}-borderless`]:!J,[`${c.value}-in-form-item`]:pe},Fn(c.value,s.value,he),$.value,n.class,z.value),Te={};return e.treeData===void 0&&o.default&&(Te.children=wt(o.default())),R(_(p(Aue,B(B(B(B({},n),be),{},{disabled:O.value,virtual:f.value,dropdownMatchSelectWidth:h.value,id:ce,fieldNames:ae,ref:F,prefixCls:c.value,class:we,listHeight:G,listItemHeight:q,treeLine:!!te,inputIcon:me,multiple:V,removeIcon:xe,clearIcon:fe,switcherIcon:Re=>F7(E.value,ie,Re,o.leafIcon,te),showTreeIcon:W,notFoundContent:de,getPopupContainer:g==null?void 0:g.value,treeMotion:null,dropdownClassName:D.value,choiceTransitionName:M.value,onChange:L,onBlur:Y,onSearch:j,onTreeExpand:H},Te),{},{transitionName:T.value,customSlots:m(m({},o),{treeCheckable:()=>p("span",{class:`${c.value}-tree-checkbox-inner`},null)}),maxTagPlaceholder:e.maxTagPlaceholder||o.maxTagPlaceholder,placement:I.value,showArrow:he||ue,placeholder:se}),m(m({},o),{treeCheckable:()=>p("span",{class:`${c.value}-tree-checkbox-inner`},null)}))))}}}),X0=ms,Nue=m(Uv,{TreeNode:ms,SHOW_ALL:Sue,SHOW_PARENT:q7,SHOW_CHILD:OS,install:e=>(e.component(Uv.name,Uv),e.component(X0.displayName,X0),e)}),Xv=()=>({format:String,showNow:$e(),showHour:$e(),showMinute:$e(),showSecond:$e(),use12Hours:$e(),hourStep:Number,minuteStep:Number,secondStep:Number,hideDisabledOptions:$e(),popupClassName:String,status:Ne()});function kue(e){const t=pE(e,m(m({},Xv()),{order:{type:Boolean,default:!0}})),{TimePicker:n,RangePicker:o}=t,r=re({name:"ATimePicker",inheritAttrs:!1,props:m(m(m(m({},sp()),uE()),Xv()),{addon:{type:Function}}),slots:Object,setup(l,a){let{slots:s,expose:c,emit:u,attrs:d}=a;const f=l,h=an();Mt(!(s.addon||f.addon),"TimePicker","`addon` is deprecated. Please use `v-slot:renderExtraFooter` instead.");const v=ne();c({focus:()=>{var w;(w=v.value)===null||w===void 0||w.focus()},blur:()=>{var w;(w=v.value)===null||w===void 0||w.blur()}});const g=(w,C)=>{u("update:value",w),u("change",w,C),h.onFieldChange()},b=w=>{u("update:open",w),u("openChange",w)},y=w=>{u("focus",w)},S=w=>{u("blur",w),h.onFieldBlur()},$=w=>{u("ok",w)};return()=>{const{id:w=h.id.value}=f;return p(n,B(B(B({},d),ot(f,["onUpdate:value","onUpdate:open"])),{},{id:w,dropdownClassName:f.popupClassName,mode:void 0,ref:v,renderExtraFooter:f.addon||s.addon||f.renderExtraFooter||s.renderExtraFooter,onChange:g,onOpenChange:b,onFocus:y,onBlur:S,onOk:$}),s)}}}),i=re({name:"ATimeRangePicker",inheritAttrs:!1,props:m(m(m(m({},sp()),dE()),Xv()),{order:{type:Boolean,default:!0}}),slots:Object,setup(l,a){let{slots:s,expose:c,emit:u,attrs:d}=a;const f=l,h=ne(),v=an();c({focus:()=>{var O;(O=h.value)===null||O===void 0||O.focus()},blur:()=>{var O;(O=h.value)===null||O===void 0||O.blur()}});const g=(O,x)=>{u("update:value",O),u("change",O,x),v.onFieldChange()},b=O=>{u("update:open",O),u("openChange",O)},y=O=>{u("focus",O)},S=O=>{u("blur",O),v.onFieldBlur()},$=(O,x)=>{u("panelChange",O,x)},w=O=>{u("ok",O)},C=(O,x,I)=>{u("calendarChange",O,x,I)};return()=>{const{id:O=v.id.value}=f;return p(o,B(B(B({},d),ot(f,["onUpdate:open","onUpdate:value"])),{},{id:O,dropdownClassName:f.popupClassName,picker:"time",mode:void 0,ref:h,onChange:g,onOpenChange:b,onFocus:y,onBlur:S,onPanelChange:$,onOk:w,onCalendarChange:C}),s)}}});return{TimePicker:r,TimeRangePicker:i}}const{TimePicker:id,TimeRangePicker:lf}=kue(qy),Fue=m(id,{TimePicker:id,TimeRangePicker:lf,install:e=>(e.component(id.name,id),e.component(lf.name,lf),e)}),Lue=()=>({prefixCls:String,color:String,dot:K.any,pending:$e(),position:K.oneOf(Mn("left","right","")).def(""),label:K.any}),Vc=re({compatConfig:{MODE:3},name:"ATimelineItem",props:Qe(Lue(),{color:"blue",pending:!1}),slots:Object,setup(e,t){let{slots:n}=t;const{prefixCls:o}=Ee("timeline",e),r=P(()=>({[`${o.value}-item`]:!0,[`${o.value}-item-pending`]:e.pending})),i=P(()=>/blue|red|green|gray/.test(e.color||"")?void 0:e.color||"blue"),l=P(()=>({[`${o.value}-item-head`]:!0,[`${o.value}-item-head-${e.color||"blue"}`]:!i.value}));return()=>{var a,s,c;const{label:u=(a=n.label)===null||a===void 0?void 0:a.call(n),dot:d=(s=n.dot)===null||s===void 0?void 0:s.call(n)}=e;return p("li",{class:r.value},[u&&p("div",{class:`${o.value}-item-label`},[u]),p("div",{class:`${o.value}-item-tail`},null),p("div",{class:[l.value,!!d&&`${o.value}-item-head-custom`],style:{borderColor:i.value,color:i.value}},[d]),p("div",{class:`${o.value}-item-content`},[(c=n.default)===null||c===void 0?void 0:c.call(n)])])}}}),zue=e=>{const{componentCls:t}=e;return{[t]:m(m({},qe(e)),{margin:0,padding:0,listStyle:"none",[`${t}-item`]:{position:"relative",margin:0,paddingBottom:e.timeLineItemPaddingBottom,fontSize:e.fontSize,listStyle:"none","&-tail":{position:"absolute",insetBlockStart:e.timeLineItemHeadSize,insetInlineStart:(e.timeLineItemHeadSize-e.timeLineItemTailWidth)/2,height:`calc(100% - ${e.timeLineItemHeadSize}px)`,borderInlineStart:`${e.timeLineItemTailWidth}px ${e.lineType} ${e.colorSplit}`},"&-pending":{[`${t}-item-head`]:{fontSize:e.fontSizeSM,backgroundColor:"transparent"},[`${t}-item-tail`]:{display:"none"}},"&-head":{position:"absolute",width:e.timeLineItemHeadSize,height:e.timeLineItemHeadSize,backgroundColor:e.colorBgContainer,border:`${e.timeLineHeadBorderWidth}px ${e.lineType} transparent`,borderRadius:"50%","&-blue":{color:e.colorPrimary,borderColor:e.colorPrimary},"&-red":{color:e.colorError,borderColor:e.colorError},"&-green":{color:e.colorSuccess,borderColor:e.colorSuccess},"&-gray":{color:e.colorTextDisabled,borderColor:e.colorTextDisabled}},"&-head-custom":{position:"absolute",insetBlockStart:e.timeLineItemHeadSize/2,insetInlineStart:e.timeLineItemHeadSize/2,width:"auto",height:"auto",marginBlockStart:0,paddingBlock:e.timeLineItemCustomHeadPaddingVertical,lineHeight:1,textAlign:"center",border:0,borderRadius:0,transform:"translate(-50%, -50%)"},"&-content":{position:"relative",insetBlockStart:-(e.fontSize*e.lineHeight-e.fontSize)+e.lineWidth,marginInlineStart:e.margin+e.timeLineItemHeadSize,marginInlineEnd:0,marginBlockStart:0,marginBlockEnd:0,wordBreak:"break-word"},"&-last":{[`> ${t}-item-tail`]:{display:"none"},[`> ${t}-item-content`]:{minHeight:e.controlHeightLG*1.2}}},[`&${t}-alternate, + &${t}-right, + &${t}-label`]:{[`${t}-item`]:{"&-tail, &-head, &-head-custom":{insetInlineStart:"50%"},"&-head":{marginInlineStart:`-${e.marginXXS}px`,"&-custom":{marginInlineStart:e.timeLineItemTailWidth/2}},"&-left":{[`${t}-item-content`]:{insetInlineStart:`calc(50% - ${e.marginXXS}px)`,width:`calc(50% - ${e.marginSM}px)`,textAlign:"start"}},"&-right":{[`${t}-item-content`]:{width:`calc(50% - ${e.marginSM}px)`,margin:0,textAlign:"end"}}}},[`&${t}-right`]:{[`${t}-item-right`]:{[`${t}-item-tail, + ${t}-item-head, + ${t}-item-head-custom`]:{insetInlineStart:`calc(100% - ${(e.timeLineItemHeadSize+e.timeLineItemTailWidth)/2}px)`},[`${t}-item-content`]:{width:`calc(100% - ${e.timeLineItemHeadSize+e.marginXS}px)`}}},[`&${t}-pending + ${t}-item-last + ${t}-item-tail`]:{display:"block",height:`calc(100% - ${e.margin}px)`,borderInlineStart:`${e.timeLineItemTailWidth}px dotted ${e.colorSplit}`},[`&${t}-reverse + ${t}-item-last + ${t}-item-tail`]:{display:"none"},[`&${t}-reverse ${t}-item-pending`]:{[`${t}-item-tail`]:{insetBlockStart:e.margin,display:"block",height:`calc(100% - ${e.margin}px)`,borderInlineStart:`${e.timeLineItemTailWidth}px dotted ${e.colorSplit}`},[`${t}-item-content`]:{minHeight:e.controlHeightLG*1.2}},[`&${t}-label`]:{[`${t}-item-label`]:{position:"absolute",insetBlockStart:-(e.fontSize*e.lineHeight-e.fontSize)+e.timeLineItemTailWidth,width:`calc(50% - ${e.marginSM}px)`,textAlign:"end"},[`${t}-item-right`]:{[`${t}-item-label`]:{insetInlineStart:`calc(50% + ${e.marginSM}px)`,width:`calc(50% - ${e.marginSM}px)`,textAlign:"start"}}},"&-rtl":{direction:"rtl",[`${t}-item-head-custom`]:{transform:"translate(50%, -50%)"}}})}},Hue=Ue("Timeline",e=>{const t=ze(e,{timeLineItemPaddingBottom:e.padding*1.25,timeLineItemHeadSize:10,timeLineItemCustomHeadPaddingVertical:e.paddingXXS,timeLinePaddingInlineEnd:2,timeLineItemTailWidth:e.lineWidthBold,timeLineHeadBorderWidth:e.wireframe?e.lineWidthBold:e.lineWidth*3});return[zue(t)]}),jue=()=>({prefixCls:String,pending:K.any,pendingDot:K.any,reverse:$e(),mode:K.oneOf(Mn("left","alternate","right",""))}),dc=re({compatConfig:{MODE:3},name:"ATimeline",inheritAttrs:!1,props:Qe(jue(),{reverse:!1,mode:""}),slots:Object,setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("timeline",e),[l,a]=Hue(r),s=(c,u)=>{const d=c.props||{};return e.mode==="alternate"?d.position==="right"?`${r.value}-item-right`:d.position==="left"?`${r.value}-item-left`:u%2===0?`${r.value}-item-left`:`${r.value}-item-right`:e.mode==="left"?`${r.value}-item-left`:e.mode==="right"?`${r.value}-item-right`:d.position==="right"?`${r.value}-item-right`:""};return()=>{var c,u,d;const{pending:f=(c=n.pending)===null||c===void 0?void 0:c.call(n),pendingDot:h=(u=n.pendingDot)===null||u===void 0?void 0:u.call(n),reverse:v,mode:g}=e,b=typeof f=="boolean"?null:f,y=kt((d=n.default)===null||d===void 0?void 0:d.call(n)),S=f?p(Vc,{pending:!!f,dot:h||p(to,null,null)},{default:()=>[b]}):null;S&&y.push(S);const $=v?y.reverse():y,w=$.length,C=`${r.value}-item-last`,O=$.map((T,M)=>{const E=M===w-2?C:"",A=M===w-1?C:"";return mn(T,{class:le([!v&&f?E:A,s(T,M)])})}),x=$.some(T=>{var M,E;return!!(!((M=T.props)===null||M===void 0)&&M.label||!((E=T.children)===null||E===void 0)&&E.label)}),I=le(r.value,{[`${r.value}-pending`]:!!f,[`${r.value}-reverse`]:!!v,[`${r.value}-${g}`]:!!g&&!x,[`${r.value}-label`]:x,[`${r.value}-rtl`]:i.value==="rtl"},o.class,a.value);return l(p("ul",B(B({},o),{},{class:I}),[O]))}}});dc.Item=Vc;dc.install=function(e){return e.component(dc.name,dc),e.component(Vc.name,Vc),e};var Vue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"}}]},name:"enter",theme:"outlined"};function i3(e){for(var t=1;t{const{sizeMarginHeadingVerticalEnd:r,fontWeightStrong:i}=o;return{marginBottom:r,color:n,fontWeight:i,fontSize:e,lineHeight:t}},Gue=e=>{const t=[1,2,3,4,5],n={};return t.forEach(o=>{n[` + h${o}&, + div&-h${o}, + div&-h${o} > textarea, + h${o} + `]=Kue(e[`fontSizeHeading${o}`],e[`lineHeightHeading${o}`],e.colorTextHeading,e)}),n},Uue=e=>{const{componentCls:t}=e;return{"a&, a":m(m({},Xp(e)),{textDecoration:e.linkDecoration,"&:active, &:hover":{textDecoration:e.linkHoverDecoration},[`&[disabled], &${t}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:active, &:hover":{color:e.colorTextDisabled},"&:active":{pointerEvents:"none"}}})}},Xue=()=>({code:{margin:"0 0.2em",paddingInline:"0.4em",paddingBlock:"0.2em 0.1em",fontSize:"85%",background:"rgba(150, 150, 150, 0.1)",border:"1px solid rgba(100, 100, 100, 0.2)",borderRadius:3},kbd:{margin:"0 0.2em",paddingInline:"0.4em",paddingBlock:"0.15em 0.1em",fontSize:"90%",background:"rgba(150, 150, 150, 0.06)",border:"1px solid rgba(100, 100, 100, 0.2)",borderBottomWidth:2,borderRadius:3},mark:{padding:0,backgroundColor:JD[2]},"u, ins":{textDecoration:"underline",textDecorationSkipInk:"auto"},"s, del":{textDecoration:"line-through"},strong:{fontWeight:600},"ul, ol":{marginInline:0,marginBlock:"0 1em",padding:0,li:{marginInline:"20px 0",marginBlock:0,paddingInline:"4px 0",paddingBlock:0}},ul:{listStyleType:"circle",ul:{listStyleType:"disc"}},ol:{listStyleType:"decimal"},"pre, blockquote":{margin:"1em 0"},pre:{padding:"0.4em 0.6em",whiteSpace:"pre-wrap",wordWrap:"break-word",background:"rgba(150, 150, 150, 0.1)",border:"1px solid rgba(100, 100, 100, 0.2)",borderRadius:3,code:{display:"inline",margin:0,padding:0,fontSize:"inherit",fontFamily:"inherit",background:"transparent",border:0}},blockquote:{paddingInline:"0.6em 0",paddingBlock:0,borderInlineStart:"4px solid rgba(100, 100, 100, 0.2)",opacity:.85}}),Yue=e=>{const{componentCls:t}=e,o=na(e).inputPaddingVertical+1;return{"&-edit-content":{position:"relative","div&":{insetInlineStart:-e.paddingSM,marginTop:-o,marginBottom:`calc(1em - ${o}px)`},[`${t}-edit-content-confirm`]:{position:"absolute",insetInlineEnd:e.marginXS+2,insetBlockEnd:e.marginXS,color:e.colorTextDescription,fontWeight:"normal",fontSize:e.fontSize,fontStyle:"normal",pointerEvents:"none"},textarea:{margin:"0!important",MozTransition:"none",height:"1em"}}}},que=e=>({"&-copy-success":{"\n &,\n &:hover,\n &:focus":{color:e.colorSuccess}}}),Jue=()=>({"\n a&-ellipsis,\n span&-ellipsis\n ":{display:"inline-block",maxWidth:"100%"},"&-single-line":{whiteSpace:"nowrap"},"&-ellipsis-single-line":{overflow:"hidden",textOverflow:"ellipsis","a&, span&":{verticalAlign:"bottom"}},"&-ellipsis-multiple-line":{display:"-webkit-box",overflow:"hidden",WebkitLineClamp:3,WebkitBoxOrient:"vertical"}}),Zue=e=>{const{componentCls:t,sizeMarginHeadingVerticalStart:n}=e;return{[t]:m(m(m(m(m(m(m(m(m({color:e.colorText,wordBreak:"break-word",lineHeight:e.lineHeight,[`&${t}-secondary`]:{color:e.colorTextDescription},[`&${t}-success`]:{color:e.colorSuccess},[`&${t}-warning`]:{color:e.colorWarning},[`&${t}-danger`]:{color:e.colorError,"a&:active, a&:focus":{color:e.colorErrorActive},"a&:hover":{color:e.colorErrorHover}},[`&${t}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed",userSelect:"none"},"\n div&,\n p\n ":{marginBottom:"1em"}},Gue(e)),{[` + & + h1${t}, + & + h2${t}, + & + h3${t}, + & + h4${t}, + & + h5${t} + `]:{marginTop:n},"\n div,\n ul,\n li,\n p,\n h1,\n h2,\n h3,\n h4,\n h5":{"\n + h1,\n + h2,\n + h3,\n + h4,\n + h5\n ":{marginTop:n}}}),Xue()),Uue(e)),{[` + ${t}-expand, + ${t}-edit, + ${t}-copy + `]:m(m({},Xp(e)),{marginInlineStart:e.marginXXS})}),Yue(e)),que(e)),Jue()),{"&-rtl":{direction:"rtl"}})}},Z7=Ue("Typography",e=>[Zue(e)],{sizeMarginHeadingVerticalStart:"1.2em",sizeMarginHeadingVerticalEnd:"0.5em"}),Que=()=>({prefixCls:String,value:String,maxlength:Number,autoSize:{type:[Boolean,Object]},onSave:Function,onCancel:Function,onEnd:Function,onChange:Function,originContent:String,direction:String,component:String}),ede=re({compatConfig:{MODE:3},name:"Editable",inheritAttrs:!1,props:Que(),setup(e,t){let{emit:n,slots:o,attrs:r}=t;const{prefixCls:i}=nr(e),l=ft({current:e.value||"",lastKeyCode:void 0,inComposition:!1,cancelFlag:!1});ye(()=>e.value,S=>{l.current=S});const a=ne();Ke(()=>{var S;if(a.value){const $=(S=a.value)===null||S===void 0?void 0:S.resizableTextArea,w=$==null?void 0:$.textArea;w.focus();const{length:C}=w.value;w.setSelectionRange(C,C)}});function s(S){a.value=S}function c(S){let{target:{value:$}}=S;l.current=$.replace(/[\r\n]/g,""),n("change",l.current)}function u(){l.inComposition=!0}function d(){l.inComposition=!1}function f(S){const{keyCode:$}=S;$===Ie.ENTER&&S.preventDefault(),!l.inComposition&&(l.lastKeyCode=$)}function h(S){const{keyCode:$,ctrlKey:w,altKey:C,metaKey:O,shiftKey:x}=S;l.lastKeyCode===$&&!l.inComposition&&!w&&!C&&!O&&!x&&($===Ie.ENTER?(g(),n("end")):$===Ie.ESC&&(l.current=e.originContent,n("cancel")))}function v(){g()}function g(){n("save",l.current.trim())}const[b,y]=Z7(i);return()=>{const S=le({[`${i.value}`]:!0,[`${i.value}-edit-content`]:!0,[`${i.value}-rtl`]:e.direction==="rtl",[e.component?`${i.value}-${e.component}`:""]:!0},r.class,y.value);return b(p("div",B(B({},r),{},{class:S}),[p(K1,{ref:s,maxlength:e.maxlength,value:l.current,onChange:c,onKeydown:f,onKeyup:h,onCompositionstart:u,onCompositionend:d,onBlur:v,rows:1,autoSize:e.autoSize===void 0||e.autoSize},null),o.enterIcon?o.enterIcon({className:`${e.prefixCls}-edit-content-confirm`}):p(PS,{class:`${e.prefixCls}-edit-content-confirm`},null)]))}}}),tde=3,nde=8;let lo;const Yv={padding:0,margin:0,display:"inline",lineHeight:"inherit"};function Q7(e,t){e.setAttribute("aria-hidden","true");const n=window.getComputedStyle(t),o=BL(n);e.setAttribute("style",o),e.style.position="fixed",e.style.left="0",e.style.height="auto",e.style.minHeight="auto",e.style.maxHeight="auto",e.style.paddingTop="0",e.style.paddingBottom="0",e.style.borderTopWidth="0",e.style.borderBottomWidth="0",e.style.top="-999999px",e.style.zIndex="-1000",e.style.textOverflow="clip",e.style.whiteSpace="normal",e.style.webkitLineClamp="none"}function ode(e){const t=document.createElement("div");Q7(t,e),t.appendChild(document.createTextNode("text")),document.body.appendChild(t);const n=t.getBoundingClientRect().height;return document.body.removeChild(t),n}const rde=(e,t,n,o,r)=>{lo||(lo=document.createElement("div"),lo.setAttribute("aria-hidden","true"),document.body.appendChild(lo));const{rows:i,suffix:l=""}=t,a=ode(e),s=Math.round(a*i*100)/100;Q7(lo,e);const c=lO({render(){return p("div",{style:Yv},[p("span",{style:Yv},[n,l]),p("span",{style:Yv},[o])])}});c.mount(lo);function u(){return Math.round(lo.getBoundingClientRect().height*100)/100-.1<=s}if(u())return c.unmount(),{content:n,text:lo.innerHTML,ellipsis:!1};const d=Array.prototype.slice.apply(lo.childNodes[0].childNodes[0].cloneNode(!0).childNodes).filter($=>{let{nodeType:w,data:C}=$;return w!==nde&&C!==""}),f=Array.prototype.slice.apply(lo.childNodes[0].childNodes[1].cloneNode(!0).childNodes);c.unmount();const h=[];lo.innerHTML="";const v=document.createElement("span");lo.appendChild(v);const g=document.createTextNode(r+l);v.appendChild(g),f.forEach($=>{lo.appendChild($)});function b($){v.insertBefore($,g)}function y($,w){let C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,O=arguments.length>3&&arguments[3]!==void 0?arguments[3]:w.length,x=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;const I=Math.floor((C+O)/2),T=w.slice(0,I);if($.textContent=T,C>=O-1)for(let M=O;M>=C;M-=1){const E=w.slice(0,M);if($.textContent=E,u()||!E)return M===w.length?{finished:!1,vNode:w}:{finished:!0,vNode:E}}return u()?y($,w,I,O,I):y($,w,C,I,x)}function S($){if($.nodeType===tde){const C=$.textContent||"",O=document.createTextNode(C);return b(O),y(O,C)}return{finished:!1,vNode:null}}return d.some($=>{const{finished:w,vNode:C}=S($);return C&&h.push(C),w}),{content:h,text:lo.innerHTML,ellipsis:!0}};var ide=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r({prefixCls:String,direction:String,component:String}),ao=re({name:"ATypography",inheritAttrs:!1,props:lde(),setup(e,t){let{slots:n,attrs:o}=t;const{prefixCls:r,direction:i}=Ee("typography",e),[l,a]=Z7(r);return()=>{var s;const c=m(m({},e),o),{prefixCls:u,direction:d,component:f="article"}=c,h=ide(c,["prefixCls","direction","component"]);return l(p(f,B(B({},h),{},{class:le(r.value,{[`${r.value}-rtl`]:i.value==="rtl"},o.class,a.value)}),{default:()=>[(s=n.default)===null||s===void 0?void 0:s.call(n)]}))}}}),ade=()=>{const e=document.getSelection();if(!e.rangeCount)return function(){};let t=document.activeElement;const n=[];for(let o=0;o"u"){s&&console.warn("unable to use e.clipboardData"),s&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();const d=l3[t.format]||l3.default;window.clipboardData.setData(d,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(l),r.selectNodeContents(l),i.addRange(r),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");a=!0}catch(c){s&&console.error("unable to copy using execCommand: ",c),s&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(u){s&&console.error("unable to copy using clipboardData: ",u),s&&console.error("falling back to prompt"),n=cde("message"in t?t.message:sde),window.prompt(n,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(r):i.removeAllRanges()),l&&document.body.removeChild(l),o()}return a}var dde={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"}}]},name:"copy",theme:"outlined"};function a3(e){for(var t=1;t({editable:{type:[Boolean,Object],default:void 0},copyable:{type:[Boolean,Object],default:void 0},prefixCls:String,component:String,type:String,disabled:{type:Boolean,default:void 0},ellipsis:{type:[Boolean,Object],default:void 0},code:{type:Boolean,default:void 0},mark:{type:Boolean,default:void 0},underline:{type:Boolean,default:void 0},delete:{type:Boolean,default:void 0},strong:{type:Boolean,default:void 0},keyboard:{type:Boolean,default:void 0},content:String,"onUpdate:content":Function}),Su=re({compatConfig:{MODE:3},name:"TypographyBase",inheritAttrs:!1,props:yu(),setup(e,t){let{slots:n,attrs:o,emit:r}=t;const{prefixCls:i,direction:l}=Ee("typography",e),a=ft({copied:!1,ellipsisText:"",ellipsisContent:null,isEllipsis:!1,expanded:!1,clientRendered:!1,expandStr:"",copyStr:"",copiedStr:"",editStr:"",copyId:void 0,rafId:void 0,prevProps:void 0,originContent:""}),s=ne(),c=ne(),u=P(()=>{const _=e.ellipsis;return _?m({rows:1,expandable:!1},typeof _=="object"?_:null):{}});Ke(()=>{a.clientRendered=!0,I()}),et(()=>{clearTimeout(a.copyId),Ze.cancel(a.rafId)}),ye([()=>u.value.rows,()=>e.content],()=>{rt(()=>{O()})},{flush:"post",deep:!0}),Ve(()=>{e.content===void 0&&(Po(!e.editable),Po(!e.ellipsis))});function d(){var _;return e.ellipsis||e.editable?e.content:(_=Jn(s.value))===null||_===void 0?void 0:_.innerText}function f(_){const{onExpand:D}=u.value;a.expanded=!0,D==null||D(_)}function h(_){_.preventDefault(),a.originContent=e.content,C(!0)}function v(_){g(_),C(!1)}function g(_){const{onChange:D}=S.value;_!==e.content&&(r("update:content",_),D==null||D(_))}function b(){var _,D;(D=(_=S.value).onCancel)===null||D===void 0||D.call(_),C(!1)}function y(_){_.preventDefault(),_.stopPropagation();const{copyable:D}=e,N=m({},typeof D=="object"?D:null);N.text===void 0&&(N.text=d()),ude(N.text||""),a.copied=!0,rt(()=>{N.onCopy&&N.onCopy(_),a.copyId=setTimeout(()=>{a.copied=!1},3e3)})}const S=P(()=>{const _=e.editable;return _?m({},typeof _=="object"?_:null):{editing:!1}}),[$,w]=Dt(!1,{value:P(()=>S.value.editing)});function C(_){const{onStart:D}=S.value;_&&D&&D(),w(_)}ye($,_=>{var D;_||(D=c.value)===null||D===void 0||D.focus()},{flush:"post"});function O(_){if(_){const{width:D,height:N}=_;if(!D||!N)return}Ze.cancel(a.rafId),a.rafId=Ze(()=>{I()})}const x=P(()=>{const{rows:_,expandable:D,suffix:N,onEllipsis:k,tooltip:F}=u.value;return N||F||e.editable||e.copyable||D||k?!1:_===1?mde:vde}),I=()=>{const{ellipsisText:_,isEllipsis:D}=a,{rows:N,suffix:k,onEllipsis:F}=u.value;if(!N||N<0||!Jn(s.value)||a.expanded||e.content===void 0||x.value)return;const{content:L,text:H,ellipsis:j}=rde(Jn(s.value),{rows:N,suffix:k},e.content,z(!0),c3);(_!==H||a.isEllipsis!==j)&&(a.ellipsisText=H,a.ellipsisContent=L,a.isEllipsis=j,D!==j&&F&&F(j))};function T(_,D){let{mark:N,code:k,underline:F,delete:L,strong:H,keyboard:j}=_,Y=D;function Z(X,ee){if(!X)return;const U=function(){return Y}();Y=p(ee,null,{default:()=>[U]})}return Z(H,"strong"),Z(F,"u"),Z(L,"del"),Z(k,"code"),Z(N,"mark"),Z(j,"kbd"),Y}function M(_){const{expandable:D,symbol:N}=u.value;if(!D||!_&&(a.expanded||!a.isEllipsis))return null;const k=(n.ellipsisSymbol?n.ellipsisSymbol():N)||a.expandStr;return p("a",{key:"expand",class:`${i.value}-expand`,onClick:f,"aria-label":a.expandStr},[k])}function E(){if(!e.editable)return;const{tooltip:_,triggerType:D=["icon"]}=e.editable,N=n.editableIcon?n.editableIcon():p(IS,{role:"button"},null),k=n.editableTooltip?n.editableTooltip():a.editStr,F=typeof k=="string"?k:"";return D.indexOf("icon")!==-1?p(co,{key:"edit",title:_===!1?"":k},{default:()=>[p(gp,{ref:c,class:`${i.value}-edit`,onClick:h,"aria-label":F},{default:()=>[N]})]}):null}function A(){if(!e.copyable)return;const{tooltip:_}=e.copyable,D=a.copied?a.copiedStr:a.copyStr,N=n.copyableTooltip?n.copyableTooltip({copied:a.copied}):D,k=typeof N=="string"?N:"",F=a.copied?p(Zl,null,null):p(bu,null,null),L=n.copyableIcon?n.copyableIcon({copied:!!a.copied}):F;return p(co,{key:"copy",title:_===!1?"":N},{default:()=>[p(gp,{class:[`${i.value}-copy`,{[`${i.value}-copy-success`]:a.copied}],onClick:y,"aria-label":k},{default:()=>[L]})]})}function R(){const{class:_,style:D}=o,{maxlength:N,autoSize:k,onEnd:F}=S.value;return p(ede,{class:_,style:D,prefixCls:i.value,value:e.content,originContent:a.originContent,maxlength:N,autoSize:k,onSave:v,onChange:g,onCancel:b,onEnd:F,direction:l.value,component:e.component},{enterIcon:n.editableEnterIcon})}function z(_){return[M(_),E(),A()].filter(D=>D)}return()=>{var _;const{triggerType:D=["icon"]}=S.value,N=e.ellipsis||e.editable?e.content!==void 0?e.content:(_=n.default)===null||_===void 0?void 0:_.call(n):n.default?n.default():e.content;return $.value?R():p(Wl,{componentName:"Text",children:k=>{const F=m(m({},e),o),{type:L,disabled:H,content:j,class:Y,style:Z}=F,X=gde(F,["type","disabled","content","class","style"]),{rows:ee,suffix:U,tooltip:Q}=u.value,{edit:J,copy:G,copied:q,expand:V}=k;a.editStr=J,a.copyStr=G,a.copiedStr=q,a.expandStr=V;const W=ot(X,["prefixCls","editable","copyable","ellipsis","mark","code","delete","underline","strong","keyboard","onUpdate:content"]),te=x.value,ue=ee===1&&te,ie=ee&&ee>1&&te;let ae=N,ce;if(ee&&a.isEllipsis&&!a.expanded&&!te){const{title:he}=X;let ge=he||"";!he&&(typeof N=="string"||typeof N=="number")&&(ge=String(N)),ge=ge==null?void 0:ge.slice(String(a.ellipsisContent||"").length),ae=p(Le,null,[tt(a.ellipsisContent),p("span",{title:ge,"aria-hidden":"true"},[c3]),U])}else ae=p(Le,null,[N,U]);ae=T(e,ae);const se=Q&&ee&&a.isEllipsis&&!a.expanded&&!te,pe=n.ellipsisTooltip?n.ellipsisTooltip():Q;return p(Vo,{onResize:O,disabled:!ee},{default:()=>[p(ao,B({ref:s,class:[{[`${i.value}-${L}`]:L,[`${i.value}-disabled`]:H,[`${i.value}-ellipsis`]:ee,[`${i.value}-single-line`]:ee===1&&!a.isEllipsis,[`${i.value}-ellipsis-single-line`]:ue,[`${i.value}-ellipsis-multiple-line`]:ie},Y],style:m(m({},Z),{WebkitLineClamp:ie?ee:void 0}),"aria-label":ce,direction:l.value,onClick:D.indexOf("text")!==-1?h:()=>{}},W),{default:()=>[se?p(co,{title:Q===!0?N:pe},{default:()=>[p("span",null,[ae])]}):ae,z()]})]})}},null)}}});var bde=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rot(m(m({},yu()),{ellipsis:{type:Boolean,default:void 0}}),["component"]),bs=(e,t)=>{let{slots:n,attrs:o}=t;const r=m(m({},e),o),{ellipsis:i,rel:l}=r,a=bde(r,["ellipsis","rel"]),s=m(m({},a),{rel:l===void 0&&a.target==="_blank"?"noopener noreferrer":l,ellipsis:!!i,component:"a"});return delete s.navigate,p(Su,s,n)};bs.displayName="ATypographyLink";bs.inheritAttrs=!1;bs.props=yde();const Sde=()=>ot(yu(),["component"]),ys=(e,t)=>{let{slots:n,attrs:o}=t;const r=m(m(m({},e),{component:"div"}),o);return p(Su,r,n)};ys.displayName="ATypographyParagraph";ys.inheritAttrs=!1;ys.props=Sde();const $de=()=>m(m({},ot(yu(),["component"])),{ellipsis:{type:[Boolean,Object],default:void 0}}),Ss=(e,t)=>{let{slots:n,attrs:o}=t;const{ellipsis:r}=e,i=m(m(m({},e),{ellipsis:r&&typeof r=="object"?ot(r,["expandable","rows"]):r,component:"span"}),o);return p(Su,i,n)};Ss.displayName="ATypographyText";Ss.inheritAttrs=!1;Ss.props=$de();var Cde=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rm(m({},ot(yu(),["component","strong"])),{level:Number}),$s=(e,t)=>{let{slots:n,attrs:o}=t;const{level:r=1}=e,i=Cde(e,["level"]);let l;xde.includes(r)?l=`h${r}`:l="h1";const a=m(m(m({},i),{component:l}),o);return p(Su,a,n)};$s.displayName="ATypographyTitle";$s.inheritAttrs=!1;$s.props=wde();ao.Text=Ss;ao.Title=$s;ao.Paragraph=ys;ao.Link=bs;ao.Base=Su;ao.install=function(e){return e.component(ao.name,ao),e.component(ao.Text.displayName,Ss),e.component(ao.Title.displayName,$s),e.component(ao.Paragraph.displayName,ys),e.component(ao.Link.displayName,bs),e};function Ode(e,t){const n=`cannot ${e.method} ${e.action} ${t.status}'`,o=new Error(n);return o.status=t.status,o.method=e.method,o.url=e.action,o}function u3(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch{return t}}function Pde(e){const t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=function(i){i.total>0&&(i.percent=i.loaded/i.total*100),e.onProgress(i)});const n=new FormData;e.data&&Object.keys(e.data).forEach(r=>{const i=e.data[r];if(Array.isArray(i)){i.forEach(l=>{n.append(`${r}[]`,l)});return}n.append(r,i)}),e.file instanceof Blob?n.append(e.filename,e.file,e.file.name):n.append(e.filename,e.file),t.onerror=function(i){e.onError(i)},t.onload=function(){return t.status<200||t.status>=300?e.onError(Ode(e,t),u3(t)):e.onSuccess(u3(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const o=e.headers||{};return o["X-Requested-With"]!==null&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach(r=>{o[r]!==null&&t.setRequestHeader(r,o[r])}),t.send(n),{abort(){t.abort()}}}const Ide=+new Date;let Tde=0;function qv(){return`vc-upload-${Ide}-${++Tde}`}const Jv=(e,t)=>{if(e&&t){const n=Array.isArray(t)?t:t.split(","),o=e.name||"",r=e.type||"",i=r.replace(/\/.*$/,"");return n.some(l=>{const a=l.trim();if(/^\*(\/\*)?$/.test(l))return!0;if(a.charAt(0)==="."){const s=o.toLowerCase(),c=a.toLowerCase();let u=[c];return(c===".jpg"||c===".jpeg")&&(u=[".jpg",".jpeg"]),u.some(d=>s.endsWith(d))}return/\/\*$/.test(a)?i===a.replace(/\/.*$/,""):!!(r===a||/^\w+$/.test(a))})}return!0};function Ede(e,t){const n=e.createReader();let o=[];function r(){n.readEntries(i=>{const l=Array.prototype.slice.apply(i);o=o.concat(l),!l.length?t(o):r()})}r()}const _de=(e,t,n)=>{const o=(r,i)=>{r.path=i||"",r.isFile?r.file(l=>{n(l)&&(r.fullPath&&!l.webkitRelativePath&&(Object.defineProperties(l,{webkitRelativePath:{writable:!0}}),l.webkitRelativePath=r.fullPath.replace(/^\//,""),Object.defineProperties(l,{webkitRelativePath:{writable:!1}})),t([l]))}):r.isDirectory&&Ede(r,l=>{l.forEach(a=>{o(a,`${i}${r.name}/`)})})};e.forEach(r=>{o(r.webkitGetAsEntry())})},e_=()=>({capture:[Boolean,String],multipart:{type:Boolean,default:void 0},name:String,disabled:{type:Boolean,default:void 0},componentTag:String,action:[String,Function],method:String,directory:{type:Boolean,default:void 0},data:[Object,Function],headers:Object,accept:String,multiple:{type:Boolean,default:void 0},onBatchStart:Function,onReject:Function,onStart:Function,onError:Function,onSuccess:Function,onProgress:Function,beforeUpload:Function,customRequest:Function,withCredentials:{type:Boolean,default:void 0},openFileDialogOnClick:{type:Boolean,default:void 0},prefixCls:String,id:String,onMouseenter:Function,onMouseleave:Function,onClick:Function});var Mde=function(e,t,n,o){function r(i){return i instanceof n?i:new n(function(l){l(i)})}return new(n||(n=Promise))(function(i,l){function a(u){try{c(o.next(u))}catch(d){l(d)}}function s(u){try{c(o.throw(u))}catch(d){l(d)}}function c(u){u.done?i(u.value):r(u.value).then(a,s)}c((o=o.apply(e,t||[])).next())})},Ade=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);rMde(this,void 0,void 0,function*(){const{beforeUpload:w}=e;let C=S;if(w){try{C=yield w(S,$)}catch{C=!1}if(C===!1)return{origin:S,parsedFile:null,action:null,data:null}}const{action:O}=e;let x;typeof O=="function"?x=yield O(S):x=O;const{data:I}=e;let T;typeof I=="function"?T=yield I(S):T=I;const M=(typeof C=="object"||typeof C=="string")&&C?C:S;let E;M instanceof File?E=M:E=new File([M],S.name,{type:S.type});const A=E;return A.uid=S.uid,{origin:S,data:T,parsedFile:A,action:x}}),u=S=>{let{data:$,origin:w,action:C,parsedFile:O}=S;if(!s)return;const{onStart:x,customRequest:I,name:T,headers:M,withCredentials:E,method:A}=e,{uid:R}=w,z=I||Pde,_={action:C,filename:T,data:$,file:O,headers:M,withCredentials:E,method:A||"post",onProgress:D=>{const{onProgress:N}=e;N==null||N(D,O)},onSuccess:(D,N)=>{const{onSuccess:k}=e;k==null||k(D,O,N),delete l[R]},onError:(D,N)=>{const{onError:k}=e;k==null||k(D,N,O),delete l[R]}};x(w),l[R]=z(_)},d=()=>{i.value=qv()},f=S=>{if(S){const $=S.uid?S.uid:S;l[$]&&l[$].abort&&l[$].abort(),delete l[$]}else Object.keys(l).forEach($=>{l[$]&&l[$].abort&&l[$].abort(),delete l[$]})};Ke(()=>{s=!0}),et(()=>{s=!1,f()});const h=S=>{const $=[...S],w=$.map(C=>(C.uid=qv(),c(C,$)));Promise.all(w).then(C=>{const{onBatchStart:O}=e;O==null||O(C.map(x=>{let{origin:I,parsedFile:T}=x;return{file:I,parsedFile:T}})),C.filter(x=>x.parsedFile!==null).forEach(x=>{u(x)})})},v=S=>{const{accept:$,directory:w}=e,{files:C}=S.target,O=[...C].filter(x=>!w||Jv(x,$));h(O),d()},g=S=>{const $=a.value;if(!$)return;const{onClick:w}=e;$.click(),w&&w(S)},b=S=>{S.key==="Enter"&&g(S)},y=S=>{const{multiple:$}=e;if(S.preventDefault(),S.type!=="dragover")if(e.directory)_de(Array.prototype.slice.call(S.dataTransfer.items),h,w=>Jv(w,e.accept));else{const w=zW(Array.prototype.slice.call(S.dataTransfer.files),x=>Jv(x,e.accept));let C=w[0];const O=w[1];$===!1&&(C=C.slice(0,1)),h(C),O.length&&e.onReject&&e.onReject(O)}};return r({abort:f}),()=>{var S;const{componentTag:$,prefixCls:w,disabled:C,id:O,multiple:x,accept:I,capture:T,directory:M,openFileDialogOnClick:E,onMouseenter:A,onMouseleave:R}=e,z=Ade(e,["componentTag","prefixCls","disabled","id","multiple","accept","capture","directory","openFileDialogOnClick","onMouseenter","onMouseleave"]),_={[w]:!0,[`${w}-disabled`]:C,[o.class]:!!o.class},D=M?{directory:"directory",webkitdirectory:"webkitdirectory"}:{};return p($,B(B({},C?{}:{onClick:E?g:()=>{},onKeydown:E?b:()=>{},onMouseenter:A,onMouseleave:R,onDrop:y,onDragover:y,tabindex:"0"}),{},{class:_,role:"button",style:o.style}),{default:()=>[p("input",B(B(B({},Ui(z,{aria:!0,data:!0})),{},{id:O,type:"file",ref:a,onClick:k=>k.stopPropagation(),onCancel:k=>k.stopPropagation(),key:i.value,style:{display:"none"},accept:I},D),{},{multiple:x,onChange:v},T!=null?{capture:T}:{}),null),(S=n.default)===null||S===void 0?void 0:S.call(n)]})}}});function Zv(){}const d3=re({compatConfig:{MODE:3},name:"Upload",inheritAttrs:!1,props:Qe(e_(),{componentTag:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:Zv,onError:Zv,onSuccess:Zv,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0}),setup(e,t){let{slots:n,attrs:o,expose:r}=t;const i=ne();return r({abort:a=>{var s;(s=i.value)===null||s===void 0||s.abort(a)}}),()=>p(Rde,B(B(B({},e),o),{},{ref:i}),n)}});var Dde={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"};function f3(e){for(var t=1;t{let{uid:i}=r;return i===e.uid});return o===-1?n.push(e):n[o]=e,n}function Qv(e,t){const n=e.uid!==void 0?"uid":"name";return t.filter(o=>o[n]===e[n])[0]}function Hde(e,t){const n=e.uid!==void 0?"uid":"name",o=t.filter(r=>r[n]!==e[n]);return o.length===t.length?null:o}const jde=function(){const t=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:"").split("/"),o=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(o)||[""])[0]},n_=e=>e.indexOf("image/")===0,Vde=e=>{if(e.type&&!e.thumbUrl)return n_(e.type);const t=e.thumbUrl||e.url||"",n=jde(t);return/^data:image\//.test(t)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(n)?!0:!(/^data:/.test(t)||n)},mi=200;function Wde(e){return new Promise(t=>{if(!e.type||!n_(e.type)){t("");return}const n=document.createElement("canvas");n.width=mi,n.height=mi,n.style.cssText=`position: fixed; left: 0; top: 0; width: ${mi}px; height: ${mi}px; z-index: 9999; display: none;`,document.body.appendChild(n);const o=n.getContext("2d"),r=new Image;if(r.onload=()=>{const{width:i,height:l}=r;let a=mi,s=mi,c=0,u=0;i>l?(s=l*(mi/i),u=-(s-a)/2):(a=i*(mi/l),c=-(a-s)/2),o.drawImage(r,c,u,a,s);const d=n.toDataURL();document.body.removeChild(n),t(d)},r.crossOrigin="anonymous",e.type.startsWith("image/svg+xml")){const i=new FileReader;i.addEventListener("load",()=>{i.result&&(r.src=i.result)}),i.readAsDataURL(e)}else r.src=window.URL.createObjectURL(e)})}var Kde={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"};function g3(e){for(var t=1;t({prefixCls:String,locale:Be(void 0),file:Be(),items:ct(),listType:Ne(),isImgUrl:ve(),showRemoveIcon:$e(),showDownloadIcon:$e(),showPreviewIcon:$e(),removeIcon:ve(),downloadIcon:ve(),previewIcon:ve(),iconRender:ve(),actionIconRender:ve(),itemRender:ve(),onPreview:ve(),onClose:ve(),onDownload:ve(),progress:Be()}),Xde=re({compatConfig:{MODE:3},name:"ListItem",inheritAttrs:!1,props:Ude(),setup(e,t){let{slots:n,attrs:o}=t;var r;const i=oe(!1),l=oe();Ke(()=>{l.value=setTimeout(()=>{i.value=!0},300)}),et(()=>{clearTimeout(l.value)});const a=oe((r=e.file)===null||r===void 0?void 0:r.status);ye(()=>{var u;return(u=e.file)===null||u===void 0?void 0:u.status},u=>{u!=="removed"&&(a.value=u)});const{rootPrefixCls:s}=Ee("upload",e),c=P(()=>Go(`${s.value}-fade`));return()=>{var u,d;const{prefixCls:f,locale:h,listType:v,file:g,items:b,progress:y,iconRender:S=n.iconRender,actionIconRender:$=n.actionIconRender,itemRender:w=n.itemRender,isImgUrl:C,showPreviewIcon:O,showRemoveIcon:x,showDownloadIcon:I,previewIcon:T=n.previewIcon,removeIcon:M=n.removeIcon,downloadIcon:E=n.downloadIcon,onPreview:A,onDownload:R,onClose:z}=e,{class:_,style:D}=o,N=S({file:g});let k=p("div",{class:`${f}-text-icon`},[N]);if(v==="picture"||v==="picture-card")if(a.value==="uploading"||!g.thumbUrl&&!g.url){const W={[`${f}-list-item-thumbnail`]:!0,[`${f}-list-item-file`]:a.value!=="uploading"};k=p("div",{class:W},[N])}else{const W=C!=null&&C(g)?p("img",{src:g.thumbUrl||g.url,alt:g.name,class:`${f}-list-item-image`,crossorigin:g.crossOrigin},null):N,te={[`${f}-list-item-thumbnail`]:!0,[`${f}-list-item-file`]:C&&!C(g)};k=p("a",{class:te,onClick:ue=>A(g,ue),href:g.url||g.thumbUrl,target:"_blank",rel:"noopener noreferrer"},[W])}const F={[`${f}-list-item`]:!0,[`${f}-list-item-${a.value}`]:!0},L=typeof g.linkProps=="string"?JSON.parse(g.linkProps):g.linkProps,H=x?$({customIcon:M?M({file:g}):p(qh,null,null),callback:()=>z(g),prefixCls:f,title:h.removeFile}):null,j=I&&a.value==="done"?$({customIcon:E?E({file:g}):p(Jh,null,null),callback:()=>R(g),prefixCls:f,title:h.downloadFile}):null,Y=v!=="picture-card"&&p("span",{key:"download-delete",class:[`${f}-list-item-actions`,{picture:v==="picture"}]},[j,H]),Z=`${f}-list-item-name`,X=g.url?[p("a",B(B({key:"view",target:"_blank",rel:"noopener noreferrer",class:Z,title:g.name},L),{},{href:g.url,onClick:W=>A(g,W)}),[g.name]),Y]:[p("span",{key:"view",class:Z,onClick:W=>A(g,W),title:g.name},[g.name]),Y],ee={pointerEvents:"none",opacity:.5},U=O?p("a",{href:g.url||g.thumbUrl,target:"_blank",rel:"noopener noreferrer",style:g.url||g.thumbUrl?void 0:ee,onClick:W=>A(g,W),title:h.previewFile},[T?T({file:g}):p(hu,null,null)]):null,Q=v==="picture-card"&&a.value!=="uploading"&&p("span",{class:`${f}-list-item-actions`},[U,a.value==="done"&&j,H]),J=p("div",{class:F},[k,X,Q,i.value&&p(bn,c.value,{default:()=>[Ln(p("div",{class:`${f}-list-item-progress`},["percent"in g?p(aS,B(B({},y),{},{type:"line",percent:g.percent}),null):null]),[[Qn,a.value==="uploading"]])]})]),G={[`${f}-list-item-container`]:!0,[`${_}`]:!!_},q=g.response&&typeof g.response=="string"?g.response:((u=g.error)===null||u===void 0?void 0:u.statusText)||((d=g.error)===null||d===void 0?void 0:d.message)||h.uploadError,V=a.value==="error"?p(co,{title:q,getPopupContainer:W=>W.parentNode},{default:()=>[J]}):J;return p("div",{class:G,style:D},[w?w({originNode:V,file:g,fileList:b,actions:{download:R.bind(null,g),preview:A.bind(null,g),remove:z.bind(null,g)}}):V])}}}),Yde=(e,t)=>{let{slots:n}=t;var o;return kt((o=n.default)===null||o===void 0?void 0:o.call(n))[0]},qde=re({compatConfig:{MODE:3},name:"AUploadList",props:Qe(zde(),{listType:"text",progress:{strokeWidth:2,showInfo:!1},showRemoveIcon:!0,showDownloadIcon:!1,showPreviewIcon:!0,previewFile:Wde,isImageUrl:Vde,items:[],appendActionVisible:!0}),setup(e,t){let{slots:n,expose:o}=t;const r=oe(!1);Ke(()=>{r.value==!0});const i=oe([]);ye(()=>e.items,function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.value=g.slice()},{immediate:!0,deep:!0}),Ve(()=>{if(e.listType!=="picture"&&e.listType!=="picture-card")return;let g=!1;(e.items||[]).forEach((b,y)=>{typeof document>"u"||typeof window>"u"||!window.FileReader||!window.File||!(b.originFileObj instanceof File||b.originFileObj instanceof Blob)||b.thumbUrl!==void 0||(b.thumbUrl="",e.previewFile&&e.previewFile(b.originFileObj).then(S=>{const $=S||"";$!==b.thumbUrl&&(i.value[y].thumbUrl=$,g=!0)}))}),g&&a6(i)});const l=(g,b)=>{if(e.onPreview)return b==null||b.preventDefault(),e.onPreview(g)},a=g=>{typeof e.onDownload=="function"?e.onDownload(g):g.url&&window.open(g.url)},s=g=>{var b;(b=e.onRemove)===null||b===void 0||b.call(e,g)},c=g=>{let{file:b}=g;const y=e.iconRender||n.iconRender;if(y)return y({file:b,listType:e.listType});const S=b.status==="uploading",$=e.isImageUrl&&e.isImageUrl(b)?p(ES,null,null):p(_S,null,null);let w=p(S?to:TS,null,null);return e.listType==="picture"?w=S?p(to,null,null):$:e.listType==="picture-card"&&(w=S?e.locale.uploading:$),w},u=g=>{const{customIcon:b,callback:y,prefixCls:S,title:$}=g,w={type:"text",size:"small",title:$,onClick:()=>{y()},class:`${S}-list-item-action`};return qt(b)?p(Wt,w,{icon:()=>b}):p(Wt,w,{default:()=>[p("span",null,[b])]})};o({handlePreview:l,handleDownload:a});const{prefixCls:d,rootPrefixCls:f}=Ee("upload",e),h=P(()=>({[`${d.value}-list`]:!0,[`${d.value}-list-${e.listType}`]:!0})),v=P(()=>{const g=m({},ru(`${f.value}-motion-collapse`));delete g.onAfterAppear,delete g.onAfterEnter,delete g.onAfterLeave;const b=m(m({},rh(`${d.value}-${e.listType==="picture-card"?"animate-inline":"animate"}`)),{class:h.value,appear:r.value});return e.listType!=="picture-card"?m(m({},g),b):b});return()=>{const{listType:g,locale:b,isImageUrl:y,showPreviewIcon:S,showRemoveIcon:$,showDownloadIcon:w,removeIcon:C,previewIcon:O,downloadIcon:x,progress:I,appendAction:T,itemRender:M,appendActionVisible:E}=e,A=T==null?void 0:T(),R=i.value;return p(Fp,B(B({},v.value),{},{tag:"div"}),{default:()=>[R.map(z=>{const{uid:_}=z;return p(Xde,{key:_,locale:b,prefixCls:d.value,file:z,items:R,progress:I,listType:g,isImgUrl:y,showPreviewIcon:S,showRemoveIcon:$,showDownloadIcon:w,onPreview:l,onDownload:a,onClose:s,removeIcon:C,previewIcon:O,downloadIcon:x,itemRender:M},m(m({},n),{iconRender:c,actionIconRender:u}))}),T?Ln(p(Yde,{key:"__ant_upload_appendAction"},{default:()=>A}),[[Qn,!!E]]):null]})}}}),Jde=e=>{const{componentCls:t,iconCls:n}=e;return{[`${t}-wrapper`]:{[`${t}-drag`]:{position:"relative",width:"100%",height:"100%",textAlign:"center",background:e.colorFillAlter,border:`${e.lineWidth}px dashed ${e.colorBorder}`,borderRadius:e.borderRadiusLG,cursor:"pointer",transition:`border-color ${e.motionDurationSlow}`,[t]:{padding:`${e.padding}px 0`},[`${t}-btn`]:{display:"table",width:"100%",height:"100%",outline:"none"},[`${t}-drag-container`]:{display:"table-cell",verticalAlign:"middle"},[`&:not(${t}-disabled):hover`]:{borderColor:e.colorPrimaryHover},[`p${t}-drag-icon`]:{marginBottom:e.margin,[n]:{color:e.colorPrimary,fontSize:e.uploadThumbnailSize}},[`p${t}-text`]:{margin:`0 0 ${e.marginXXS}px`,color:e.colorTextHeading,fontSize:e.fontSizeLG},[`p${t}-hint`]:{color:e.colorTextDescription,fontSize:e.fontSize},[`&${t}-disabled`]:{cursor:"not-allowed",[`p${t}-drag-icon ${n}, + p${t}-text, + p${t}-hint + `]:{color:e.colorTextDisabled}}}}}},Zde=e=>{const{componentCls:t,antCls:n,iconCls:o,fontSize:r,lineHeight:i}=e,l=`${t}-list-item`,a=`${l}-actions`,s=`${l}-action`,c=Math.round(r*i);return{[`${t}-wrapper`]:{[`${t}-list`]:m(m({},lr()),{lineHeight:e.lineHeight,[l]:{position:"relative",height:e.lineHeight*r,marginTop:e.marginXS,fontSize:r,display:"flex",alignItems:"center",transition:`background-color ${e.motionDurationSlow}`,"&:hover":{backgroundColor:e.controlItemBgHover},[`${l}-name`]:m(m({},Jt),{padding:`0 ${e.paddingXS}px`,lineHeight:i,flex:"auto",transition:`all ${e.motionDurationSlow}`}),[a]:{[s]:{opacity:0},[`${s}${n}-btn-sm`]:{height:c,border:0,lineHeight:1,"> span":{transform:"scale(1)"}},[` + ${s}:focus, + &.picture ${s} + `]:{opacity:1},[o]:{color:e.colorTextDescription,transition:`all ${e.motionDurationSlow}`},[`&:hover ${o}`]:{color:e.colorText}},[`${t}-icon ${o}`]:{color:e.colorTextDescription,fontSize:r},[`${l}-progress`]:{position:"absolute",bottom:-e.uploadProgressOffset,width:"100%",paddingInlineStart:r+e.paddingXS,fontSize:r,lineHeight:0,pointerEvents:"none","> div":{margin:0}}},[`${l}:hover ${s}`]:{opacity:1,color:e.colorText},[`${l}-error`]:{color:e.colorError,[`${l}-name, ${t}-icon ${o}`]:{color:e.colorError},[a]:{[`${o}, ${o}:hover`]:{color:e.colorError},[s]:{opacity:1}}},[`${t}-list-item-container`]:{transition:`opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,"&::before":{display:"table",width:0,height:0,content:'""'}}})}}},v3=new it("uploadAnimateInlineIn",{from:{width:0,height:0,margin:0,padding:0,opacity:0}}),m3=new it("uploadAnimateInlineOut",{to:{width:0,height:0,margin:0,padding:0,opacity:0}}),Qde=e=>{const{componentCls:t}=e,n=`${t}-animate-inline`;return[{[`${t}-wrapper`]:{[`${n}-appear, ${n}-enter, ${n}-leave`]:{animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseInOutCirc,animationFillMode:"forwards"},[`${n}-appear, ${n}-enter`]:{animationName:v3},[`${n}-leave`]:{animationName:m3}}},v3,m3]},efe=e=>{const{componentCls:t,iconCls:n,uploadThumbnailSize:o,uploadProgressOffset:r}=e,i=`${t}-list`,l=`${i}-item`;return{[`${t}-wrapper`]:{[`${i}${i}-picture, ${i}${i}-picture-card`]:{[l]:{position:"relative",height:o+e.lineWidth*2+e.paddingXS*2,padding:e.paddingXS,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusLG,"&:hover":{background:"transparent"},[`${l}-thumbnail`]:m(m({},Jt),{width:o,height:o,lineHeight:`${o+e.paddingSM}px`,textAlign:"center",flex:"none",[n]:{fontSize:e.fontSizeHeading2,color:e.colorPrimary},img:{display:"block",width:"100%",height:"100%",overflow:"hidden"}}),[`${l}-progress`]:{bottom:r,width:`calc(100% - ${e.paddingSM*2}px)`,marginTop:0,paddingInlineStart:o+e.paddingXS}},[`${l}-error`]:{borderColor:e.colorError,[`${l}-thumbnail ${n}`]:{"svg path[fill='#e6f7ff']":{fill:e.colorErrorBg},"svg path[fill='#1890ff']":{fill:e.colorError}}},[`${l}-uploading`]:{borderStyle:"dashed",[`${l}-name`]:{marginBottom:r}}}}}},tfe=e=>{const{componentCls:t,iconCls:n,fontSizeLG:o,colorTextLightSolid:r}=e,i=`${t}-list`,l=`${i}-item`,a=e.uploadPicCardSize;return{[`${t}-wrapper${t}-picture-card-wrapper`]:m(m({},lr()),{display:"inline-block",width:"100%",[`${t}${t}-select`]:{width:a,height:a,marginInlineEnd:e.marginXS,marginBottom:e.marginXS,textAlign:"center",verticalAlign:"top",backgroundColor:e.colorFillAlter,border:`${e.lineWidth}px dashed ${e.colorBorder}`,borderRadius:e.borderRadiusLG,cursor:"pointer",transition:`border-color ${e.motionDurationSlow}`,[`> ${t}`]:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",textAlign:"center"},[`&:not(${t}-disabled):hover`]:{borderColor:e.colorPrimary}},[`${i}${i}-picture-card`]:{[`${i}-item-container`]:{display:"inline-block",width:a,height:a,marginBlock:`0 ${e.marginXS}px`,marginInline:`0 ${e.marginXS}px`,verticalAlign:"top"},"&::after":{display:"none"},[l]:{height:"100%",margin:0,"&::before":{position:"absolute",zIndex:1,width:`calc(100% - ${e.paddingXS*2}px)`,height:`calc(100% - ${e.paddingXS*2}px)`,backgroundColor:e.colorBgMask,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'" "'}},[`${l}:hover`]:{[`&::before, ${l}-actions`]:{opacity:1}},[`${l}-actions`]:{position:"absolute",insetInlineStart:0,zIndex:10,width:"100%",whiteSpace:"nowrap",textAlign:"center",opacity:0,transition:`all ${e.motionDurationSlow}`,[`${n}-eye, ${n}-download, ${n}-delete`]:{zIndex:10,width:o,margin:`0 ${e.marginXXS}px`,fontSize:o,cursor:"pointer",transition:`all ${e.motionDurationSlow}`}},[`${l}-actions, ${l}-actions:hover`]:{[`${n}-eye, ${n}-download, ${n}-delete`]:{color:new vt(r).setAlpha(.65).toRgbString(),"&:hover":{color:r}}},[`${l}-thumbnail, ${l}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${l}-name`]:{display:"none",textAlign:"center"},[`${l}-file + ${l}-name`]:{position:"absolute",bottom:e.margin,display:"block",width:`calc(100% - ${e.paddingXS*2}px)`},[`${l}-uploading`]:{[`&${l}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${n}-eye, ${n}-download, ${n}-delete`]:{display:"none"}},[`${l}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${e.paddingXS*2}px)`,paddingInlineStart:0}}})}},nfe=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},ofe=e=>{const{componentCls:t,colorTextDisabled:n}=e;return{[`${t}-wrapper`]:m(m({},qe(e)),{[t]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${t}-select`]:{display:"inline-block"},[`${t}-disabled`]:{color:n,cursor:"not-allowed"}})}},rfe=Ue("Upload",e=>{const{fontSizeHeading3:t,fontSize:n,lineHeight:o,lineWidth:r,controlHeightLG:i}=e,l=Math.round(n*o),a=ze(e,{uploadThumbnailSize:t*2,uploadProgressOffset:l/2+r,uploadPicCardSize:i*2.55});return[ofe(a),Jde(a),efe(a),tfe(a),Zde(a),Qde(a),nfe(a),nu(a)]});var ife=function(e,t,n,o){function r(i){return i instanceof n?i:new n(function(l){l(i)})}return new(n||(n=Promise))(function(i,l){function a(u){try{c(o.next(u))}catch(d){l(d)}}function s(u){try{c(o.throw(u))}catch(d){l(d)}}function c(u){u.done?i(u.value):r(u.value).then(a,s)}c((o=o.apply(e,t||[])).next())})},lfe=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{var E;return(E=s.value)!==null&&E!==void 0?E:d.value}),[h,v]=Dt(e.defaultFileList||[],{value:We(e,"fileList"),postState:E=>{const A=Date.now();return(E??[]).map((R,z)=>(!R.uid&&!Object.isFrozen(R)&&(R.uid=`__AUTO__${A}_${z}__`),R))}}),g=ne("drop"),b=ne(null);Ke(()=>{Mt(e.fileList!==void 0||o.value===void 0,"Upload","`value` is not a valid prop, do you mean `fileList`?"),Mt(e.transformFile===void 0,"Upload","`transformFile` is deprecated. Please use `beforeUpload` directly."),Mt(e.remove===void 0,"Upload","`remove` props is deprecated. Please use `remove` event.")});const y=(E,A,R)=>{var z,_;let D=[...A];e.maxCount===1?D=D.slice(-1):e.maxCount&&(D=D.slice(0,e.maxCount)),v(D);const N={file:E,fileList:D};R&&(N.event=R),(z=e["onUpdate:fileList"])===null||z===void 0||z.call(e,N.fileList),(_=e.onChange)===null||_===void 0||_.call(e,N),i.onFieldChange()},S=(E,A)=>ife(this,void 0,void 0,function*(){const{beforeUpload:R,transformFile:z}=e;let _=E;if(R){const D=yield R(E,A);if(D===!1)return!1;if(delete E[js],D===js)return Object.defineProperty(E,js,{value:!0,configurable:!0}),!1;typeof D=="object"&&D&&(_=D)}return z&&(_=yield z(_)),_}),$=E=>{const A=E.filter(_=>!_.file[js]);if(!A.length)return;const R=A.map(_=>ld(_.file));let z=[...h.value];R.forEach(_=>{z=ad(_,z)}),R.forEach((_,D)=>{let N=_;if(A[D].parsedFile)_.status="uploading";else{const{originFileObj:k}=_;let F;try{F=new File([k],k.name,{type:k.type})}catch{F=new Blob([k],{type:k.type}),F.name=k.name,F.lastModifiedDate=new Date,F.lastModified=new Date().getTime()}F.uid=_.uid,N=F}y(N,z)})},w=(E,A,R)=>{try{typeof E=="string"&&(E=JSON.parse(E))}catch{}if(!Qv(A,h.value))return;const z=ld(A);z.status="done",z.percent=100,z.response=E,z.xhr=R;const _=ad(z,h.value);y(z,_)},C=(E,A)=>{if(!Qv(A,h.value))return;const R=ld(A);R.status="uploading",R.percent=E.percent;const z=ad(R,h.value);y(R,z,E)},O=(E,A,R)=>{if(!Qv(R,h.value))return;const z=ld(R);z.error=E,z.response=A,z.status="error";const _=ad(z,h.value);y(z,_)},x=E=>{let A;const R=e.onRemove||e.remove;Promise.resolve(typeof R=="function"?R(E):R).then(z=>{var _,D;if(z===!1)return;const N=Hde(E,h.value);N&&(A=m(m({},E),{status:"removed"}),(_=h.value)===null||_===void 0||_.forEach(k=>{const F=A.uid!==void 0?"uid":"name";k[F]===A[F]&&!Object.isFrozen(k)&&(k.status="removed")}),(D=b.value)===null||D===void 0||D.abort(A),y(A,N))})},I=E=>{var A;g.value=E.type,E.type==="drop"&&((A=e.onDrop)===null||A===void 0||A.call(e,E))};r({onBatchStart:$,onSuccess:w,onProgress:C,onError:O,fileList:h,upload:b});const[T]=Uo("Upload",eo.Upload,P(()=>e.locale)),M=(E,A)=>{const{removeIcon:R,previewIcon:z,downloadIcon:_,previewFile:D,onPreview:N,onDownload:k,isImageUrl:F,progress:L,itemRender:H,iconRender:j,showUploadList:Y}=e,{showDownloadIcon:Z,showPreviewIcon:X,showRemoveIcon:ee}=typeof Y=="boolean"?{}:Y;return Y?p(qde,{prefixCls:l.value,listType:e.listType,items:h.value,previewFile:D,onPreview:N,onDownload:k,onRemove:x,showRemoveIcon:!f.value&&ee,showPreviewIcon:X,showDownloadIcon:Z,removeIcon:R,previewIcon:z,downloadIcon:_,iconRender:j,locale:T.value,isImageUrl:F,progress:L,itemRender:H,appendActionVisible:A,appendAction:E},m({},n)):E==null?void 0:E()};return()=>{var E,A,R;const{listType:z,type:_}=e,{class:D,style:N}=o,k=lfe(o,["class","style"]),F=m(m(m({onBatchStart:$,onError:O,onProgress:C,onSuccess:w},k),e),{id:(E=e.id)!==null&&E!==void 0?E:i.id.value,prefixCls:l.value,beforeUpload:S,onChange:void 0,disabled:f.value});delete F.remove,(!n.default||f.value)&&delete F.id;const L={[`${l.value}-rtl`]:a.value==="rtl"};if(_==="drag"){const Z=le(l.value,{[`${l.value}-drag`]:!0,[`${l.value}-drag-uploading`]:h.value.some(X=>X.status==="uploading"),[`${l.value}-drag-hover`]:g.value==="dragover",[`${l.value}-disabled`]:f.value,[`${l.value}-rtl`]:a.value==="rtl"},o.class,u.value);return c(p("span",B(B({},o),{},{class:le(`${l.value}-wrapper`,L,D,u.value)}),[p("div",{class:Z,onDrop:I,onDragover:I,onDragleave:I,style:o.style},[p(d3,B(B({},F),{},{ref:b,class:`${l.value}-btn`}),B({default:()=>[p("div",{class:`${l.value}-drag-container`},[(A=n.default)===null||A===void 0?void 0:A.call(n)])]},n))]),M()]))}const H=le(l.value,{[`${l.value}-select`]:!0,[`${l.value}-select-${z}`]:!0,[`${l.value}-disabled`]:f.value,[`${l.value}-rtl`]:a.value==="rtl"}),j=wt((R=n.default)===null||R===void 0?void 0:R.call(n)),Y=Z=>p("div",{class:H,style:Z},[p(d3,B(B({},F),{},{ref:b}),n)]);return c(z==="picture-card"?p("span",B(B({},o),{},{class:le(`${l.value}-wrapper`,`${l.value}-picture-card-wrapper`,L,o.class,u.value)}),[M(Y,!!(j&&j.length))]):p("span",B(B({},o),{},{class:le(`${l.value}-wrapper`,L,o.class,u.value)}),[Y(j&&j.length?void 0:{display:"none"}),M()]))}}});var b3=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const{height:r}=e,i=b3(e,["height"]),{style:l}=o,a=b3(o,["style"]),s=m(m(m({},i),a),{type:"drag",style:m(m({},l),{height:typeof r=="number"?`${r}px`:r})});return p(af,s,n)}}}),afe=sf,sfe=m(af,{Dragger:sf,LIST_IGNORE:js,install(e){return e.component(af.name,af),e.component(sf.name,sf),e}});function cfe(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function ufe(e){return Object.keys(e).map(t=>`${cfe(t)}: ${e[t]};`).join(" ")}function y3(){return window.devicePixelRatio||1}function em(e,t,n,o){e.translate(t,n),e.rotate(Math.PI/180*Number(o)),e.translate(-t,-n)}const dfe=(e,t)=>{let n=!1;return e.removedNodes.length&&(n=Array.from(e.removedNodes).some(o=>o===t)),e.type==="attributes"&&e.target===t&&(n=!0),n};var ffe=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r2&&arguments[2]!==void 0?arguments[2]:{};const{window:o=RI}=n,r=ffe(n,["window"]);let i;const l=MI(()=>o&&"MutationObserver"in o),a=()=>{i&&(i.disconnect(),i=void 0)},s=ye(()=>v1(e),u=>{a(),l.value&&o&&u&&(i=new MutationObserver(t),i.observe(u,r))},{immediate:!0}),c=()=>{a(),s()};return _I(c),{isSupported:l,stop:c}}const tm=2,S3=3,hfe=()=>({zIndex:Number,rotate:Number,width:Number,height:Number,image:String,content:He([String,Array]),font:Be(),rootClassName:String,gap:ct(),offset:ct()}),gfe=re({name:"AWatermark",inheritAttrs:!1,props:Qe(hfe(),{zIndex:9,rotate:-22,font:{},gap:[100,100]}),setup(e,t){let{slots:n,attrs:o}=t;const[,r]=si(),i=oe(),l=oe(),a=oe(!1),s=P(()=>{var M,E;return(E=(M=e.gap)===null||M===void 0?void 0:M[0])!==null&&E!==void 0?E:100}),c=P(()=>{var M,E;return(E=(M=e.gap)===null||M===void 0?void 0:M[1])!==null&&E!==void 0?E:100}),u=P(()=>s.value/2),d=P(()=>c.value/2),f=P(()=>{var M,E;return(E=(M=e.offset)===null||M===void 0?void 0:M[0])!==null&&E!==void 0?E:u.value}),h=P(()=>{var M,E;return(E=(M=e.offset)===null||M===void 0?void 0:M[1])!==null&&E!==void 0?E:d.value}),v=P(()=>{var M,E;return(E=(M=e.font)===null||M===void 0?void 0:M.fontSize)!==null&&E!==void 0?E:r.value.fontSizeLG}),g=P(()=>{var M,E;return(E=(M=e.font)===null||M===void 0?void 0:M.fontWeight)!==null&&E!==void 0?E:"normal"}),b=P(()=>{var M,E;return(E=(M=e.font)===null||M===void 0?void 0:M.fontStyle)!==null&&E!==void 0?E:"normal"}),y=P(()=>{var M,E;return(E=(M=e.font)===null||M===void 0?void 0:M.fontFamily)!==null&&E!==void 0?E:"sans-serif"}),S=P(()=>{var M,E;return(E=(M=e.font)===null||M===void 0?void 0:M.color)!==null&&E!==void 0?E:r.value.colorFill}),$=P(()=>{var M;const E={zIndex:(M=e.zIndex)!==null&&M!==void 0?M:9,position:"absolute",left:0,top:0,width:"100%",height:"100%",pointerEvents:"none",backgroundRepeat:"repeat"};let A=f.value-u.value,R=h.value-d.value;return A>0&&(E.left=`${A}px`,E.width=`calc(100% - ${A}px)`,A=0),R>0&&(E.top=`${R}px`,E.height=`calc(100% - ${R}px)`,R=0),E.backgroundPosition=`${A}px ${R}px`,E}),w=()=>{l.value&&(l.value.remove(),l.value=void 0)},C=(M,E)=>{var A;i.value&&l.value&&(a.value=!0,l.value.setAttribute("style",ufe(m(m({},$.value),{backgroundImage:`url('${M}')`,backgroundSize:`${(s.value+E)*tm}px`}))),(A=i.value)===null||A===void 0||A.append(l.value),setTimeout(()=>{a.value=!1}))},O=M=>{let E=120,A=64;const R=e.content,z=e.image,_=e.width,D=e.height;if(!z&&M.measureText){M.font=`${Number(v.value)}px ${y.value}`;const N=Array.isArray(R)?R:[R],k=N.map(F=>M.measureText(F).width);E=Math.ceil(Math.max(...k)),A=Number(v.value)*N.length+(N.length-1)*S3}return[_??E,D??A]},x=(M,E,A,R,z)=>{const _=y3(),D=e.content,N=Number(v.value)*_;M.font=`${b.value} normal ${g.value} ${N}px/${z}px ${y.value}`,M.fillStyle=S.value,M.textAlign="center",M.textBaseline="top",M.translate(R/2,0);const k=Array.isArray(D)?D:[D];k==null||k.forEach((F,L)=>{M.fillText(F??"",E,A+L*(N+S3*_))})},I=()=>{var M;const E=document.createElement("canvas"),A=E.getContext("2d"),R=e.image,z=(M=e.rotate)!==null&&M!==void 0?M:-22;if(A){l.value||(l.value=document.createElement("div"));const _=y3(),[D,N]=O(A),k=(s.value+D)*_,F=(c.value+N)*_;E.setAttribute("width",`${k*tm}px`),E.setAttribute("height",`${F*tm}px`);const L=s.value*_/2,H=c.value*_/2,j=D*_,Y=N*_,Z=(j+s.value*_)/2,X=(Y+c.value*_)/2,ee=L+k,U=H+F,Q=Z+k,J=X+F;if(A.save(),em(A,Z,X,z),R){const G=new Image;G.onload=()=>{A.drawImage(G,L,H,j,Y),A.restore(),em(A,Q,J,z),A.drawImage(G,ee,U,j,Y),C(E.toDataURL(),D)},G.crossOrigin="anonymous",G.referrerPolicy="no-referrer",G.src=R}else x(A,L,H,j,Y),A.restore(),em(A,Q,J,z),x(A,ee,U,j,Y),C(E.toDataURL(),D)}};return Ke(()=>{I()}),ye(()=>[e,r.value.colorFill,r.value.fontSizeLG],()=>{I()},{deep:!0,flush:"post"}),et(()=>{w()}),pfe(i,M=>{a.value||M.forEach(E=>{dfe(E,l.value)&&(w(),I())})},{attributes:!0,subtree:!0,childList:!0,attributeFilter:["style","class"]}),()=>{var M;return p("div",B(B({},o),{},{ref:i,class:[o.class,e.rootClassName],style:[{position:"relative"},o.style]}),[(M=n.default)===null||M===void 0?void 0:M.call(n)])}}}),vfe=Bt(gfe);function $3(e,t){return{[`${e}, ${e}:hover, ${e}:focus`]:{color:t.colorTextDisabled,cursor:"not-allowed"}}}function C3(e){return{backgroundColor:e.bgColorSelected,boxShadow:e.boxShadow}}const mfe=m({overflow:"hidden"},Jt),bfe=e=>{const{componentCls:t}=e;return{[t]:m(m(m(m(m({},qe(e)),{display:"inline-block",padding:e.segmentedContainerPadding,color:e.labelColor,backgroundColor:e.bgColor,borderRadius:e.borderRadius,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,[`${t}-group`]:{position:"relative",display:"flex",alignItems:"stretch",justifyItems:"flex-start",width:"100%"},[`&${t}-rtl`]:{direction:"rtl"},[`&${t}-block`]:{display:"flex"},[`&${t}-block ${t}-item`]:{flex:1,minWidth:0},[`${t}-item`]:{position:"relative",textAlign:"center",cursor:"pointer",transition:`color ${e.motionDurationMid} ${e.motionEaseInOut}`,borderRadius:e.borderRadiusSM,"&-selected":m(m({},C3(e)),{color:e.labelColorHover}),"&::after":{content:'""',position:"absolute",width:"100%",height:"100%",top:0,insetInlineStart:0,borderRadius:"inherit",transition:`background-color ${e.motionDurationMid}`,pointerEvents:"none"},[`&:hover:not(${t}-item-selected):not(${t}-item-disabled)`]:{color:e.labelColorHover,"&::after":{backgroundColor:e.bgColorHover}},"&-label":m({minHeight:e.controlHeight-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeight-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontal}px`},mfe),"&-icon + *":{marginInlineStart:e.marginSM/2},"&-input":{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:0,opacity:0,pointerEvents:"none"}},[`${t}-thumb`]:m(m({},C3(e)),{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:"100%",padding:`${e.paddingXXS}px 0`,borderRadius:e.borderRadiusSM,[`& ~ ${t}-item:not(${t}-item-selected):not(${t}-item-disabled)::after`]:{backgroundColor:"transparent"}}),[`&${t}-lg`]:{borderRadius:e.borderRadiusLG,[`${t}-item-label`]:{minHeight:e.controlHeightLG-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeightLG-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontal}px`,fontSize:e.fontSizeLG},[`${t}-item, ${t}-thumb`]:{borderRadius:e.borderRadius}},[`&${t}-sm`]:{borderRadius:e.borderRadiusSM,[`${t}-item-label`]:{minHeight:e.controlHeightSM-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeightSM-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontalSM}px`},[`${t}-item, ${t}-thumb`]:{borderRadius:e.borderRadiusXS}}}),$3(`&-disabled ${t}-item`,e)),$3(`${t}-item-disabled`,e)),{[`${t}-thumb-motion-appear-active`]:{transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOut}, width ${e.motionDurationSlow} ${e.motionEaseInOut}`,willChange:"transform, width"}})}},yfe=Ue("Segmented",e=>{const{lineWidthBold:t,lineWidth:n,colorTextLabel:o,colorText:r,colorFillSecondary:i,colorBgLayout:l,colorBgElevated:a}=e,s=ze(e,{segmentedPaddingHorizontal:e.controlPaddingHorizontal-n,segmentedPaddingHorizontalSM:e.controlPaddingHorizontalSM-n,segmentedContainerPadding:t,labelColor:o,labelColorHover:r,bgColor:l,bgColorHover:i,bgColorSelected:a});return[bfe(s)]}),x3=e=>e?{left:e.offsetLeft,right:e.parentElement.clientWidth-e.clientWidth-e.offsetLeft,width:e.clientWidth}:null,pa=e=>e!==void 0?`${e}px`:void 0,Sfe=re({props:{value:It(),getValueIndex:It(),prefixCls:It(),motionName:It(),onMotionStart:It(),onMotionEnd:It(),direction:It(),containerRef:It()},emits:["motionStart","motionEnd"],setup(e,t){let{emit:n}=t;const o=ne(),r=v=>{var g;const b=e.getValueIndex(v),y=(g=e.containerRef.value)===null||g===void 0?void 0:g.querySelectorAll(`.${e.prefixCls}-item`)[b];return(y==null?void 0:y.offsetParent)&&y},i=ne(null),l=ne(null);ye(()=>e.value,(v,g)=>{const b=r(g),y=r(v),S=x3(b),$=x3(y);i.value=S,l.value=$,n(b&&y?"motionStart":"motionEnd")},{flush:"post"});const a=P(()=>{var v,g;return e.direction==="rtl"?pa(-((v=i.value)===null||v===void 0?void 0:v.right)):pa((g=i.value)===null||g===void 0?void 0:g.left)}),s=P(()=>{var v,g;return e.direction==="rtl"?pa(-((v=l.value)===null||v===void 0?void 0:v.right)):pa((g=l.value)===null||g===void 0?void 0:g.left)});let c;const u=v=>{clearTimeout(c),rt(()=>{v&&(v.style.transform="translateX(var(--thumb-start-left))",v.style.width="var(--thumb-start-width)")})},d=v=>{c=setTimeout(()=>{v&&(Yf(v,`${e.motionName}-appear-active`),v.style.transform="translateX(var(--thumb-active-left))",v.style.width="var(--thumb-active-width)")})},f=v=>{i.value=null,l.value=null,v&&(v.style.transform=null,v.style.width=null,qf(v,`${e.motionName}-appear-active`)),n("motionEnd")},h=P(()=>{var v,g;return{"--thumb-start-left":a.value,"--thumb-start-width":pa((v=i.value)===null||v===void 0?void 0:v.width),"--thumb-active-left":s.value,"--thumb-active-width":pa((g=l.value)===null||g===void 0?void 0:g.width)}});return et(()=>{clearTimeout(c)}),()=>{const v={ref:o,style:h.value,class:[`${e.prefixCls}-thumb`]};return p(bn,{appear:!0,onBeforeEnter:u,onEnter:d,onAfterEnter:f},{default:()=>[!i.value||!l.value?null:p("div",v,null)]})}}});function $fe(e){return e.map(t=>typeof t=="object"&&t!==null?t:{label:t==null?void 0:t.toString(),title:t==null?void 0:t.toString(),value:t})}const Cfe=()=>({prefixCls:String,options:ct(),block:$e(),disabled:$e(),size:Ne(),value:m(m({},He([String,Number])),{required:!0}),motionName:String,onChange:ve(),"onUpdate:value":ve()}),o_=(e,t)=>{let{slots:n,emit:o}=t;const{value:r,disabled:i,payload:l,title:a,prefixCls:s,label:c=n.label,checked:u,className:d}=e,f=h=>{i||o("change",h,r)};return p("label",{class:le({[`${s}-item-disabled`]:i},d)},[p("input",{class:`${s}-item-input`,type:"radio",disabled:i,checked:u,onChange:f},null),p("div",{class:`${s}-item-label`,title:typeof a=="string"?a:""},[typeof c=="function"?c({value:r,disabled:i,payload:l,title:a}):c??r])])};o_.inheritAttrs=!1;const xfe=re({name:"ASegmented",inheritAttrs:!1,props:Qe(Cfe(),{options:[],motionName:"thumb-motion"}),slots:Object,setup(e,t){let{emit:n,slots:o,attrs:r}=t;const{prefixCls:i,direction:l,size:a}=Ee("segmented",e),[s,c]=yfe(i),u=oe(),d=oe(!1),f=P(()=>$fe(e.options)),h=(v,g)=>{e.disabled||(n("update:value",g),n("change",g))};return()=>{const v=i.value;return s(p("div",B(B({},r),{},{class:le(v,{[c.value]:!0,[`${v}-block`]:e.block,[`${v}-disabled`]:e.disabled,[`${v}-lg`]:a.value=="large",[`${v}-sm`]:a.value=="small",[`${v}-rtl`]:l.value==="rtl"},r.class),ref:u}),[p("div",{class:`${v}-group`},[p(Sfe,{containerRef:u,prefixCls:v,value:e.value,motionName:`${v}-${e.motionName}`,direction:l.value,getValueIndex:g=>f.value.findIndex(b=>b.value===g),onMotionStart:()=>{d.value=!0},onMotionEnd:()=>{d.value=!1}},null),f.value.map(g=>p(o_,B(B({key:g.value,prefixCls:v,checked:g.value===e.value,onChange:h},g),{},{className:le(g.className,`${v}-item`,{[`${v}-item-selected`]:g.value===e.value&&!d.value}),disabled:!!e.disabled||!!g.disabled}),o))])]))}}}),wfe=Bt(xfe),Ofe=e=>{const{componentCls:t}=e;return{[t]:m(m({},qe(e)),{display:"flex",justifyContent:"center",alignItems:"center",padding:e.paddingSM,backgroundColor:e.colorWhite,borderRadius:e.borderRadiusLG,border:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,position:"relative",width:"100%",height:"100%",overflow:"hidden",[`& > ${t}-mask`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:10,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",color:e.colorText,lineHeight:e.lineHeight,background:e.QRCodeMaskBackgroundColor,textAlign:"center",[`& > ${t}-expired , & > ${t}-scanned`]:{color:e.QRCodeTextColor}},"&-icon":{marginBlockEnd:e.marginXS,fontSize:e.controlHeight}}),[`${t}-borderless`]:{borderColor:"transparent"}}},Pfe=Ue("QRCode",e=>Ofe(ze(e,{QRCodeTextColor:"rgba(0, 0, 0, 0.88)",QRCodeMaskBackgroundColor:"rgba(255, 255, 255, 0.96)"})));var Ife={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"};function w3(e){for(var t=1;t({size:{type:Number,default:160},value:{type:String,required:!0},type:Ne("canvas"),color:String,bgColor:String,includeMargin:Boolean,imageSettings:Be()}),ppe=()=>m(m({},FS()),{errorLevel:Ne("M"),icon:String,iconSize:{type:Number,default:40},status:Ne("active"),bordered:{type:Boolean,default:!0}});/** + * @license QR Code generator library (TypeScript) + * Copyright (c) Project Nayuki. + * SPDX-License-Identifier: MIT + */var Lo;(function(e){class t{static encodeText(a,s){const c=e.QrSegment.makeSegments(a);return t.encodeSegments(c,s)}static encodeBinary(a,s){const c=e.QrSegment.makeBytes(a);return t.encodeSegments([c],s)}static encodeSegments(a,s){let c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:40,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1,f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;if(!(t.MIN_VERSION<=c&&c<=u&&u<=t.MAX_VERSION)||d<-1||d>7)throw new RangeError("Invalid value");let h,v;for(h=c;;h++){const S=t.getNumDataCodewords(h,s)*8,$=i.getTotalBits(a,h);if($<=S){v=$;break}if(h>=u)throw new RangeError("Data too long")}for(const S of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])f&&v<=t.getNumDataCodewords(h,S)*8&&(s=S);const g=[];for(const S of a){n(S.mode.modeBits,4,g),n(S.numChars,S.mode.numCharCountBits(h),g);for(const $ of S.getData())g.push($)}r(g.length==v);const b=t.getNumDataCodewords(h,s)*8;r(g.length<=b),n(0,Math.min(4,b-g.length),g),n(0,(8-g.length%8)%8,g),r(g.length%8==0);for(let S=236;g.lengthy[$>>>3]|=S<<7-($&7)),new t(h,s,y,d)}constructor(a,s,c,u){if(this.version=a,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],at.MAX_VERSION)throw new RangeError("Version value out of range");if(u<-1||u>7)throw new RangeError("Mask value out of range");this.size=a*4+17;const d=[];for(let h=0;h>>9)*1335;const u=(s<<10|c)^21522;r(u>>>15==0);for(let d=0;d<=5;d++)this.setFunctionModule(8,d,o(u,d));this.setFunctionModule(8,7,o(u,6)),this.setFunctionModule(8,8,o(u,7)),this.setFunctionModule(7,8,o(u,8));for(let d=9;d<15;d++)this.setFunctionModule(14-d,8,o(u,d));for(let d=0;d<8;d++)this.setFunctionModule(this.size-1-d,8,o(u,d));for(let d=8;d<15;d++)this.setFunctionModule(8,this.size-15+d,o(u,d));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let c=0;c<12;c++)a=a<<1^(a>>>11)*7973;const s=this.version<<12|a;r(s>>>18==0);for(let c=0;c<18;c++){const u=o(s,c),d=this.size-11+c%3,f=Math.floor(c/3);this.setFunctionModule(d,f,u),this.setFunctionModule(f,d,u)}}drawFinderPattern(a,s){for(let c=-4;c<=4;c++)for(let u=-4;u<=4;u++){const d=Math.max(Math.abs(u),Math.abs(c)),f=a+u,h=s+c;0<=f&&f{(S!=v-d||w>=h)&&y.push($[S])});return r(y.length==f),y}drawCodewords(a){if(a.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let u=0;u>>3],7-(s&7)),s++)}}r(s==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let s=0;s5&&a++):(this.finderPenaltyAddHistory(h,v),f||(a+=this.finderPenaltyCountPatterns(v)*t.PENALTY_N3),f=this.modules[d][g],h=1);a+=this.finderPenaltyTerminateAndCount(f,h,v)*t.PENALTY_N3}for(let d=0;d5&&a++):(this.finderPenaltyAddHistory(h,v),f||(a+=this.finderPenaltyCountPatterns(v)*t.PENALTY_N3),f=this.modules[g][d],h=1);a+=this.finderPenaltyTerminateAndCount(f,h,v)*t.PENALTY_N3}for(let d=0;df+(h?1:0),s);const c=this.size*this.size,u=Math.ceil(Math.abs(s*20-c*10)/c)-1;return r(0<=u&&u<=9),a+=u*t.PENALTY_N4,r(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,s=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2,c=[6];for(let u=this.size-7;c.lengtht.MAX_VERSION)throw new RangeError("Version number out of range");let s=(16*a+128)*a+64;if(a>=2){const c=Math.floor(a/7)+2;s-=(25*c-10)*c-55,a>=7&&(s-=36)}return r(208<=s&&s<=29648),s}static getNumDataCodewords(a,s){return Math.floor(t.getNumRawDataModules(a)/8)-t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][a]*t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");const s=[];for(let u=0;u0);for(const u of a){const d=u^c.shift();c.push(0),s.forEach((f,h)=>c[h]^=t.reedSolomonMultiply(f,d))}return c}static reedSolomonMultiply(a,s){if(a>>>8||s>>>8)throw new RangeError("Byte out of range");let c=0;for(let u=7;u>=0;u--)c=c<<1^(c>>>7)*285,c^=(s>>>u&1)*a;return r(c>>>8==0),c}finderPenaltyCountPatterns(a){const s=a[1];r(s<=this.size*3);const c=s>0&&a[2]==s&&a[3]==s*3&&a[4]==s&&a[5]==s;return(c&&a[0]>=s*4&&a[6]>=s?1:0)+(c&&a[6]>=s*4&&a[0]>=s?1:0)}finderPenaltyTerminateAndCount(a,s,c){return a&&(this.finderPenaltyAddHistory(s,c),s=0),s+=this.size,this.finderPenaltyAddHistory(s,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(a,s){s[0]==0&&(a+=this.size),s.pop(),s.unshift(a)}}t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,a,s){if(a<0||a>31||l>>>a)throw new RangeError("Value out of range");for(let c=a-1;c>=0;c--)s.push(l>>>c&1)}function o(l,a){return(l>>>a&1)!=0}function r(l){if(!l)throw new Error("Assertion error")}class i{static makeBytes(a){const s=[];for(const c of a)n(c,8,s);return new i(i.Mode.BYTE,a.length,s)}static makeNumeric(a){if(!i.isNumeric(a))throw new RangeError("String contains non-numeric characters");const s=[];for(let c=0;c=1<1&&arguments[1]!==void 0?arguments[1]:0;const n=[];return e.forEach(function(o,r){let i=null;o.forEach(function(l,a){if(!l&&i!==null){n.push(`M${i+t} ${r+t}h${a-i}v1H${i+t}z`),i=null;return}if(a===o.length-1){if(!l)return;i===null?n.push(`M${a+t},${r+t} h1v1H${a+t}z`):n.push(`M${i+t},${r+t} h${a+1-i}v1H${i+t}z`);return}l&&i===null&&(i=a)})}),n.join("")}function u_(e,t){return e.slice().map((n,o)=>o=t.y+t.h?n:n.map((r,i)=>i=t.x+t.w?r:!1))}function d_(e,t,n,o){if(o==null)return null;const r=e.length+n*2,i=Math.floor(t*vpe),l=r/t,a=(o.width||i)*l,s=(o.height||i)*l,c=o.x==null?e.length/2-a/2:o.x*l,u=o.y==null?e.length/2-s/2:o.y*l;let d=null;if(o.excavate){const f=Math.floor(c),h=Math.floor(u),v=Math.ceil(a+c-f),g=Math.ceil(s+u-h);d={x:f,y:h,w:v,h:g}}return{x:c,y:u,h:s,w:a,excavation:d}}function f_(e,t){return t!=null?Math.floor(t):e?hpe:gpe}const mpe=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),bpe=re({name:"QRCodeCanvas",inheritAttrs:!1,props:m(m({},FS()),{level:String,bgColor:String,fgColor:String,marginSize:Number}),setup(e,t){let{attrs:n,expose:o}=t;const r=P(()=>{var s;return(s=e.imageSettings)===null||s===void 0?void 0:s.src}),i=oe(null),l=oe(null),a=oe(!1);return o({toDataURL:(s,c)=>{var u;return(u=i.value)===null||u===void 0?void 0:u.toDataURL(s,c)}}),Ve(()=>{const{value:s,size:c=Y0,level:u=i_,bgColor:d=l_,fgColor:f=a_,includeMargin:h=s_,marginSize:v,imageSettings:g}=e;if(i.value!=null){const b=i.value,y=b.getContext("2d");if(!y)return;let S=Lo.QrCode.encodeText(s,r_[u]).getModules();const $=f_(h,v),w=S.length+$*2,C=d_(S,c,$,g),O=l.value,x=a.value&&C!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;x&&C.excavation!=null&&(S=u_(S,C.excavation));const I=window.devicePixelRatio||1;b.height=b.width=c*I;const T=c/w*I;y.scale(T,T),y.fillStyle=d,y.fillRect(0,0,w,w),y.fillStyle=f,mpe?y.fill(new Path2D(c_(S,$))):S.forEach(function(M,E){M.forEach(function(A,R){A&&y.fillRect(R+$,E+$,1,1)})}),x&&y.drawImage(O,C.x+$,C.y+$,C.w,C.h)}},{flush:"post"}),ye(r,()=>{a.value=!1}),()=>{var s;const c=(s=e.size)!==null&&s!==void 0?s:Y0,u={height:`${c}px`,width:`${c}px`};let d=null;return r.value!=null&&(d=p("img",{src:r.value,key:r.value,style:{display:"none"},onLoad:()=>{a.value=!0},ref:l},null)),p(Le,null,[p("canvas",B(B({},n),{},{style:[u,n.style],ref:i}),null),d])}}}),ype=re({name:"QRCodeSVG",inheritAttrs:!1,props:m(m({},FS()),{color:String,level:String,bgColor:String,fgColor:String,marginSize:Number,title:String}),setup(e){let t=null,n=null,o=null,r=null,i=null,l=null;return Ve(()=>{const{value:a,size:s=Y0,level:c=i_,includeMargin:u=s_,marginSize:d,imageSettings:f}=e;t=Lo.QrCode.encodeText(a,r_[c]).getModules(),n=f_(u,d),o=t.length+n*2,r=d_(t,s,n,f),f!=null&&r!=null&&(r.excavation!=null&&(t=u_(t,r.excavation)),l=p("image",{"xlink:href":f.src,height:r.h,width:r.w,x:r.x+n,y:r.y+n,preserveAspectRatio:"none"},null)),i=c_(t,n)}),()=>{const a=e.bgColor&&l_,s=e.fgColor&&a_;return p("svg",{height:e.size,width:e.size,viewBox:`0 0 ${o} ${o}`},[!!e.title&&p("title",null,[e.title]),p("path",{fill:a,d:`M0,0 h${o}v${o}H0z`,"shape-rendering":"crispEdges"},null),p("path",{fill:s,d:i,"shape-rendering":"crispEdges"},null),l])}}}),Spe=re({name:"AQrcode",inheritAttrs:!1,props:ppe(),emits:["refresh"],setup(e,t){let{emit:n,attrs:o,expose:r}=t;const[i]=Uo("QRCode"),{prefixCls:l}=Ee("qrcode",e),[a,s]=Pfe(l),[,c]=si(),u=ne();r({toDataURL:(f,h)=>{var v;return(v=u.value)===null||v===void 0?void 0:v.toDataURL(f,h)}});const d=P(()=>{const{value:f,icon:h="",size:v=160,iconSize:g=40,color:b=c.value.colorText,bgColor:y="transparent",errorLevel:S="M"}=e,$={src:h,x:void 0,y:void 0,height:g,width:g,excavate:!0};return{value:f,size:v-(c.value.paddingSM+c.value.lineWidth)*2,level:S,bgColor:y,fgColor:b,imageSettings:h?$:void 0}});return()=>{const f=l.value;return a(p("div",B(B({},o),{},{style:[o.style,{width:`${e.size}px`,height:`${e.size}px`,backgroundColor:d.value.bgColor}],class:[s.value,f,{[`${f}-borderless`]:!e.bordered}]}),[e.status!=="active"&&p("div",{class:`${f}-mask`},[e.status==="loading"&&p(_r,null,null),e.status==="expired"&&p(Le,null,[p("p",{class:`${f}-expired`},[i.value.expired]),p(Wt,{type:"link",onClick:h=>n("refresh",h)},{default:()=>[i.value.refresh],icon:()=>p(NS,null,null)})]),e.status==="scanned"&&p("p",{class:`${f}-scanned`},[i.value.scanned])]),e.type==="canvas"?p(bpe,B({ref:u},d.value),null):p(ype,d.value,null)]))}}}),$pe=Bt(Spe);function Cpe(e){const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:o,right:r,bottom:i,left:l}=e.getBoundingClientRect();return o>=0&&l>=0&&r<=t&&i<=n}function xpe(e,t,n,o){const[r,i]=St(void 0);Ve(()=>{const u=typeof e.value=="function"?e.value():e.value;i(u||null)},{flush:"post"});const[l,a]=St(null),s=()=>{if(!t.value){a(null);return}if(r.value){!Cpe(r.value)&&t.value&&r.value.scrollIntoView(o.value);const{left:u,top:d,width:f,height:h}=r.value.getBoundingClientRect(),v={left:u,top:d,width:f,height:h,radius:0};JSON.stringify(l.value)!==JSON.stringify(v)&&a(v)}else a(null)};return Ke(()=>{ye([t,r],()=>{s()},{flush:"post",immediate:!0}),window.addEventListener("resize",s)}),et(()=>{window.removeEventListener("resize",s)}),[P(()=>{var u,d;if(!l.value)return l.value;const f=((u=n.value)===null||u===void 0?void 0:u.offset)||6,h=((d=n.value)===null||d===void 0?void 0:d.radius)||2;return{left:l.value.left-f,top:l.value.top-f,width:l.value.width+f*2,height:l.value.height+f*2,radius:h}}),r]}const wpe=()=>({arrow:He([Boolean,Object]),target:He([String,Function,Object]),title:He([String,Object]),description:He([String,Object]),placement:Ne(),mask:He([Object,Boolean],!0),className:{type:String},style:Be(),scrollIntoViewOptions:He([Boolean,Object])}),LS=()=>m(m({},wpe()),{prefixCls:{type:String},total:{type:Number},current:{type:Number},onClose:ve(),onFinish:ve(),renderPanel:ve(),onPrev:ve(),onNext:ve()}),Ope=re({name:"DefaultPanel",inheritAttrs:!1,props:LS(),setup(e,t){let{attrs:n}=t;return()=>{const{prefixCls:o,current:r,total:i,title:l,description:a,onClose:s,onPrev:c,onNext:u,onFinish:d}=e;return p("div",B(B({},n),{},{class:le(`${o}-content`,n.class)}),[p("div",{class:`${o}-inner`},[p("button",{type:"button",onClick:s,"aria-label":"Close",class:`${o}-close`},[p("span",{class:`${o}-close-x`},[Pt("×")])]),p("div",{class:`${o}-header`},[p("div",{class:`${o}-title`},[l])]),p("div",{class:`${o}-description`},[a]),p("div",{class:`${o}-footer`},[p("div",{class:`${o}-sliders`},[i>1?[...Array.from({length:i}).keys()].map((f,h)=>p("span",{key:f,class:h===r?"active":""},null)):null]),p("div",{class:`${o}-buttons`},[r!==0?p("button",{class:`${o}-prev-btn`,onClick:c},[Pt("Prev")]):null,r===i-1?p("button",{class:`${o}-finish-btn`,onClick:d},[Pt("Finish")]):p("button",{class:`${o}-next-btn`,onClick:u},[Pt("Next")])])])])])}}}),Ppe=re({name:"TourStep",inheritAttrs:!1,props:LS(),setup(e,t){let{attrs:n}=t;return()=>{const{current:o,renderPanel:r}=e;return p(Le,null,[typeof r=="function"?r(m(m({},n),e),o):p(Ope,B(B({},n),e),null)])}}});let W3=0;const Ipe=zn();function Tpe(){let e;return Ipe?(e=W3,W3+=1):e="TEST_OR_SSR",e}function Epe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ne("");const t=`vc_unique_${Tpe()}`;return e.value||t}const sd={fill:"transparent","pointer-events":"auto"},_pe=re({name:"TourMask",props:{prefixCls:{type:String},pos:Be(),rootClassName:{type:String},showMask:$e(),fill:{type:String,default:"rgba(0,0,0,0.5)"},open:$e(),animated:He([Boolean,Object]),zIndex:{type:Number}},setup(e,t){let{attrs:n}=t;const o=Epe();return()=>{const{prefixCls:r,open:i,rootClassName:l,pos:a,showMask:s,fill:c,animated:u,zIndex:d}=e,f=`${r}-mask-${o}`,h=typeof u=="object"?u==null?void 0:u.placeholder:u;return p(Zc,{visible:i,autoLock:!0},{default:()=>i&&p("div",B(B({},n),{},{class:le(`${r}-mask`,l,n.class),style:[{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},n.style]}),[s?p("svg",{style:{width:"100%",height:"100%"}},[p("defs",null,[p("mask",{id:f},[p("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"},null),a&&p("rect",{x:a.left,y:a.top,rx:a.radius,width:a.width,height:a.height,fill:"black",class:h?`${r}-placeholder-animated`:""},null)])]),p("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:c,mask:`url(#${f})`},null),a&&p(Le,null,[p("rect",B(B({},sd),{},{x:"0",y:"0",width:"100%",height:a.top}),null),p("rect",B(B({},sd),{},{x:"0",y:"0",width:a.left,height:"100%"}),null),p("rect",B(B({},sd),{},{x:"0",y:a.top+a.height,width:"100%",height:`calc(100vh - ${a.top+a.height}px)`}),null),p("rect",B(B({},sd),{},{x:a.left+a.width,y:"0",width:`calc(100vw - ${a.left+a.width}px)`,height:"100%"}),null)])]):null])})}}}),Mpe=[0,0],K3={left:{points:["cr","cl"],offset:[-8,0]},right:{points:["cl","cr"],offset:[8,0]},top:{points:["bc","tc"],offset:[0,-8]},bottom:{points:["tc","bc"],offset:[0,8]},topLeft:{points:["bl","tl"],offset:[0,-8]},leftTop:{points:["tr","tl"],offset:[-8,0]},topRight:{points:["br","tr"],offset:[0,-8]},rightTop:{points:["tl","tr"],offset:[8,0]},bottomRight:{points:["tr","br"],offset:[0,8]},rightBottom:{points:["bl","br"],offset:[8,0]},bottomLeft:{points:["tl","bl"],offset:[0,8]},leftBottom:{points:["br","bl"],offset:[-8,0]}};function p_(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const t={};return Object.keys(K3).forEach(n=>{t[n]=m(m({},K3[n]),{autoArrow:e,targetOffset:Mpe})}),t}p_();var Ape=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const{builtinPlacements:e,popupAlign:t}=xP();return{builtinPlacements:e,popupAlign:t,steps:ct(),open:$e(),defaultCurrent:{type:Number},current:{type:Number},onChange:ve(),onClose:ve(),onFinish:ve(),mask:He([Boolean,Object],!0),arrow:He([Boolean,Object],!0),rootClassName:{type:String},placement:Ne("bottom"),prefixCls:{type:String,default:"rc-tour"},renderPanel:ve(),gap:Be(),animated:He([Boolean,Object]),scrollIntoViewOptions:He([Boolean,Object],!0),zIndex:{type:Number,default:1001}}},Rpe=re({name:"Tour",inheritAttrs:!1,props:Qe(h_(),{}),setup(e){const{defaultCurrent:t,placement:n,mask:o,scrollIntoViewOptions:r,open:i,gap:l,arrow:a}=nr(e),s=ne(),[c,u]=Dt(0,{value:P(()=>e.current),defaultValue:t.value}),[d,f]=Dt(void 0,{value:P(()=>e.open),postState:x=>c.value<0||c.value>=e.steps.length?!1:x??!0}),h=oe(d.value);Ve(()=>{d.value&&!h.value&&u(0),h.value=d.value});const v=P(()=>e.steps[c.value]||{}),g=P(()=>{var x;return(x=v.value.placement)!==null&&x!==void 0?x:n.value}),b=P(()=>{var x;return d.value&&((x=v.value.mask)!==null&&x!==void 0?x:o.value)}),y=P(()=>{var x;return(x=v.value.scrollIntoViewOptions)!==null&&x!==void 0?x:r.value}),[S,$]=xpe(P(()=>v.value.target),i,l,y),w=P(()=>$.value?typeof v.value.arrow>"u"?a.value:v.value.arrow:!1),C=P(()=>typeof w.value=="object"?w.value.pointAtCenter:!1);ye(C,()=>{var x;(x=s.value)===null||x===void 0||x.forcePopupAlign()}),ye(c,()=>{var x;(x=s.value)===null||x===void 0||x.forcePopupAlign()});const O=x=>{var I;u(x),(I=e.onChange)===null||I===void 0||I.call(e,x)};return()=>{var x;const{prefixCls:I,steps:T,onClose:M,onFinish:E,rootClassName:A,renderPanel:R,animated:z,zIndex:_}=e,D=Ape(e,["prefixCls","steps","onClose","onFinish","rootClassName","renderPanel","animated","zIndex"]);if($.value===void 0)return null;const N=()=>{f(!1),M==null||M(c.value)},k=typeof b.value=="boolean"?b.value:!!b.value,F=typeof b.value=="boolean"?void 0:b.value,L=()=>$.value||document.body,H=()=>p(Ppe,B({arrow:w.value,key:"content",prefixCls:I,total:T.length,renderPanel:R,onPrev:()=>{O(c.value-1)},onNext:()=>{O(c.value+1)},onClose:N,current:c.value,onFinish:()=>{N(),E==null||E()}},v.value),null),j=P(()=>{const Y=S.value||nm,Z={};return Object.keys(Y).forEach(X=>{typeof Y[X]=="number"?Z[X]=`${Y[X]}px`:Z[X]=Y[X]}),Z});return d.value?p(Le,null,[p(_pe,{zIndex:_,prefixCls:I,pos:S.value,showMask:k,style:F==null?void 0:F.style,fill:F==null?void 0:F.color,open:d.value,animated:z,rootClassName:A},null),p(ql,B(B({},D),{},{arrow:!!D.arrow,builtinPlacements:v.value.target?(x=D.builtinPlacements)!==null&&x!==void 0?x:p_(C.value):void 0,ref:s,popupStyle:v.value.target?v.value.style:m(m({},v.value.style),{position:"fixed",left:nm.left,top:nm.top,transform:"translate(-50%, -50%)"}),popupPlacement:g.value,popupVisible:d.value,popupClassName:le(A,v.value.className),prefixCls:I,popup:H,forceRender:!1,destroyPopupOnHide:!0,zIndex:_,mask:!1,getTriggerDOMNode:L}),{default:()=>[p(Zc,{visible:d.value,autoLock:!0},{default:()=>[p("div",{class:le(A,`${I}-target-placeholder`),style:m(m({},j.value),{position:"fixed",pointerEvents:"none"})},null)]})]})]):null}}}),Dpe=()=>m(m({},h_()),{steps:{type:Array},prefixCls:{type:String},current:{type:Number},type:{type:String},"onUpdate:current":Function}),Bpe=()=>m(m({},LS()),{cover:{type:Object},nextButtonProps:{type:Object},prevButtonProps:{type:Object},current:{type:Number},type:{type:String}}),Npe=re({name:"ATourPanel",inheritAttrs:!1,props:Bpe(),setup(e,t){let{attrs:n,slots:o}=t;const{current:r,total:i}=nr(e),l=P(()=>r.value===i.value-1),a=c=>{var u;const d=e.prevButtonProps;(u=e.onPrev)===null||u===void 0||u.call(e,c),typeof(d==null?void 0:d.onClick)=="function"&&(d==null||d.onClick())},s=c=>{var u,d;const f=e.nextButtonProps;l.value?(u=e.onFinish)===null||u===void 0||u.call(e,c):(d=e.onNext)===null||d===void 0||d.call(e,c),typeof(f==null?void 0:f.onClick)=="function"&&(f==null||f.onClick())};return()=>{const{prefixCls:c,title:u,onClose:d,cover:f,description:h,type:v,arrow:g}=e,b=e.prevButtonProps,y=e.nextButtonProps;let S;u&&(S=p("div",{class:`${c}-header`},[p("div",{class:`${c}-title`},[u])]));let $;h&&($=p("div",{class:`${c}-description`},[h]));let w;f&&(w=p("div",{class:`${c}-cover`},[f]));let C;o.indicatorsRender?C=o.indicatorsRender({current:r.value,total:i}):C=[...Array.from({length:i.value}).keys()].map((I,T)=>p("span",{key:I,class:le(T===r.value&&`${c}-indicator-active`,`${c}-indicator`)},null));const O=v==="primary"?"default":"primary",x={type:"default",ghost:v==="primary"};return p(Wl,{componentName:"Tour",defaultLocale:eo.Tour},{default:I=>{var T;return p("div",B(B({},n),{},{class:le(v==="primary"?`${c}-primary`:"",n.class,`${c}-content`)}),[g&&p("div",{class:`${c}-arrow`,key:"arrow"},null),p("div",{class:`${c}-inner`},[p(Vn,{class:`${c}-close`,onClick:d},null),w,S,$,p("div",{class:`${c}-footer`},[i.value>1&&p("div",{class:`${c}-indicators`},[C]),p("div",{class:`${c}-buttons`},[r.value!==0?p(Wt,B(B(B({},x),b),{},{onClick:a,size:"small",class:le(`${c}-prev-btn`,b==null?void 0:b.className)}),{default:()=>[wm(b==null?void 0:b.children)?b.children():(T=b==null?void 0:b.children)!==null&&T!==void 0?T:I.Previous]}):null,p(Wt,B(B({type:O},y),{},{onClick:s,size:"small",class:le(`${c}-next-btn`,y==null?void 0:y.className)}),{default:()=>[wm(y==null?void 0:y.children)?y==null?void 0:y.children():l.value?I.Finish:I.Next]})])])])])}})}}}),kpe=e=>{let{defaultType:t,steps:n,current:o,defaultCurrent:r}=e;const i=ne(r==null?void 0:r.value),l=P(()=>o==null?void 0:o.value);ye(l,u=>{i.value=u??(r==null?void 0:r.value)},{immediate:!0});const a=u=>{i.value=u},s=P(()=>{var u,d;return typeof i.value=="number"?n&&((d=(u=n.value)===null||u===void 0?void 0:u[i.value])===null||d===void 0?void 0:d.type):t==null?void 0:t.value});return{currentMergedType:P(()=>{var u;return(u=s.value)!==null&&u!==void 0?u:t==null?void 0:t.value}),updateInnerCurrent:a}},Fpe=e=>{const{componentCls:t,lineHeight:n,padding:o,paddingXS:r,borderRadius:i,borderRadiusXS:l,colorPrimary:a,colorText:s,colorFill:c,indicatorHeight:u,indicatorWidth:d,boxShadowTertiary:f,tourZIndexPopup:h,fontSize:v,colorBgContainer:g,fontWeightStrong:b,marginXS:y,colorTextLightSolid:S,tourBorderRadius:$,colorWhite:w,colorBgTextHover:C,tourCloseSize:O,motionDurationSlow:x,antCls:I}=e;return[{[t]:m(m({},qe(e)),{color:s,position:"absolute",zIndex:h,display:"block",visibility:"visible",fontSize:v,lineHeight:n,width:520,"--antd-arrow-background-color":g,"&-pure":{maxWidth:"100%",position:"relative"},[`&${t}-hidden`]:{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{textAlign:"start",textDecoration:"none",borderRadius:$,boxShadow:f,position:"relative",backgroundColor:g,border:"none",backgroundClip:"padding-box",[`${t}-close`]:{position:"absolute",top:o,insetInlineEnd:o,color:e.colorIcon,outline:"none",width:O,height:O,borderRadius:e.borderRadiusSM,transition:`background-color ${e.motionDurationMid}, color ${e.motionDurationMid}`,display:"flex",alignItems:"center",justifyContent:"center","&:hover":{color:e.colorIconHover,backgroundColor:e.wireframe?"transparent":e.colorFillContent}},[`${t}-cover`]:{textAlign:"center",padding:`${o+O+r}px ${o}px 0`,img:{width:"100%"}},[`${t}-header`]:{padding:`${o}px ${o}px ${r}px`,[`${t}-title`]:{lineHeight:n,fontSize:v,fontWeight:b}},[`${t}-description`]:{padding:`0 ${o}px`,lineHeight:n,wordWrap:"break-word"},[`${t}-footer`]:{padding:`${r}px ${o}px ${o}px`,textAlign:"end",borderRadius:`0 0 ${l}px ${l}px`,display:"flex",[`${t}-indicators`]:{display:"inline-block",[`${t}-indicator`]:{width:d,height:u,display:"inline-block",borderRadius:"50%",background:c,"&:not(:last-child)":{marginInlineEnd:u},"&-active":{background:a}}},[`${t}-buttons`]:{marginInlineStart:"auto",[`${I}-btn`]:{marginInlineStart:y}}}},[`${t}-primary, &${t}-primary`]:{"--antd-arrow-background-color":a,[`${t}-inner`]:{color:S,textAlign:"start",textDecoration:"none",backgroundColor:a,borderRadius:i,boxShadow:f,[`${t}-close`]:{color:S},[`${t}-indicators`]:{[`${t}-indicator`]:{background:new vt(S).setAlpha(.15).toRgbString(),"&-active":{background:S}}},[`${t}-prev-btn`]:{color:S,borderColor:new vt(S).setAlpha(.15).toRgbString(),backgroundColor:a,"&:hover":{backgroundColor:new vt(S).setAlpha(.15).toRgbString(),borderColor:"transparent"}},[`${t}-next-btn`]:{color:a,borderColor:"transparent",background:w,"&:hover":{background:new vt(C).onBackground(w).toRgbString()}}}}}),[`${t}-mask`]:{[`${t}-placeholder-animated`]:{transition:`all ${x}`}},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${t}-inner`]:{borderRadius:Math.min($,zy)}}},Hy(e,{colorBg:"var(--antd-arrow-background-color)",contentRadius:$,limitVerticalRadius:!0})]},Lpe=Ue("Tour",e=>{const{borderRadiusLG:t,fontSize:n,lineHeight:o}=e,r=ze(e,{tourZIndexPopup:e.zIndexPopupBase+70,indicatorWidth:6,indicatorHeight:6,tourBorderRadius:t,tourCloseSize:n*o});return[Fpe(r)]});var zpe=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const{steps:g,current:b,type:y,rootClassName:S}=e,$=zpe(e,["steps","current","type","rootClassName"]),w=le({[`${c.value}-primary`]:h.value==="primary",[`${c.value}-rtl`]:u.value==="rtl"},f.value,S),C=(I,T)=>p(Npe,B(B({},I),{},{type:y,current:T}),{indicatorsRender:r.indicatorsRender}),O=I=>{v(I),o("update:current",I),o("change",I)},x=P(()=>Ly({arrowPointAtCenter:!0,autoAdjustOverflow:!0}));return d(p(Rpe,B(B(B({},n),$),{},{rootClassName:w,prefixCls:c.value,current:b,defaultCurrent:e.defaultCurrent,animated:!0,renderPanel:C,onChange:O,steps:g,builtinPlacements:x.value}),null))}}}),jpe=Bt(Hpe),g_=Symbol("appConfigContext"),Vpe=e=>Ye(g_,e),Wpe=()=>Ge(g_,{}),v_=Symbol("appContext"),Kpe=e=>Ye(v_,e),Gpe=ft({message:{},notification:{},modal:{}}),Upe=()=>Ge(v_,Gpe),Xpe=e=>{const{componentCls:t,colorText:n,fontSize:o,lineHeight:r,fontFamily:i}=e;return{[t]:{color:n,fontSize:o,lineHeight:r,fontFamily:i}}},Ype=Ue("App",e=>[Xpe(e)]),qpe=()=>({rootClassName:String,message:Be(),notification:Be()}),Jpe=()=>Upe(),fc=re({name:"AApp",props:Qe(qpe(),{}),setup(e,t){let{slots:n}=t;const{prefixCls:o}=Ee("app",e),[r,i]=Ype(o),l=P(()=>le(i.value,o.value,e.rootClassName)),a=Wpe(),s=P(()=>({message:m(m({},a.message),e.message),notification:m(m({},a.notification),e.notification)}));Vpe(s.value);const[c,u]=HT(s.value.message),[d,f]=QT(s.value.notification),[h,v]=o7(),g=P(()=>({message:c,notification:d,modal:h}));return Kpe(g.value),()=>{var b;return r(p("div",{class:l.value},[v(),u(),f(),(b=n.default)===null||b===void 0?void 0:b.call(n)]))}}});fc.useApp=Jpe;fc.install=function(e){e.component(fc.name,fc)};const m_=["wrap","nowrap","wrap-reverse"],b_=["flex-start","flex-end","start","end","center","space-between","space-around","space-evenly","stretch","normal","left","right"],y_=["center","start","end","flex-start","flex-end","self-start","self-end","baseline","normal","stretch"],Zpe=(e,t)=>{const n={};return m_.forEach(o=>{n[`${e}-wrap-${o}`]=t.wrap===o}),n},Qpe=(e,t)=>{const n={};return y_.forEach(o=>{n[`${e}-align-${o}`]=t.align===o}),n[`${e}-align-stretch`]=!t.align&&!!t.vertical,n},ehe=(e,t)=>{const n={};return b_.forEach(o=>{n[`${e}-justify-${o}`]=t.justify===o}),n};function the(e,t){return le(m(m(m({},Zpe(e,t)),Qpe(e,t)),ehe(e,t)))}const nhe=e=>{const{componentCls:t}=e;return{[t]:{display:"flex","&-vertical":{flexDirection:"column"},"&-rtl":{direction:"rtl"},"&:empty":{display:"none"}}}},ohe=e=>{const{componentCls:t}=e;return{[t]:{"&-gap-small":{gap:e.flexGapSM},"&-gap-middle":{gap:e.flexGap},"&-gap-large":{gap:e.flexGapLG}}}},rhe=e=>{const{componentCls:t}=e,n={};return m_.forEach(o=>{n[`${t}-wrap-${o}`]={flexWrap:o}}),n},ihe=e=>{const{componentCls:t}=e,n={};return y_.forEach(o=>{n[`${t}-align-${o}`]={alignItems:o}}),n},lhe=e=>{const{componentCls:t}=e,n={};return b_.forEach(o=>{n[`${t}-justify-${o}`]={justifyContent:o}}),n},ahe=Ue("Flex",e=>{const t=ze(e,{flexGapSM:e.paddingXS,flexGap:e.padding,flexGapLG:e.paddingLG});return[nhe(t),ohe(t),rhe(t),ihe(t),lhe(t)]});function G3(e){return["small","middle","large"].includes(e)}const she=()=>({prefixCls:Ne(),vertical:$e(),wrap:Ne(),justify:Ne(),align:Ne(),flex:He([Number,String]),gap:He([Number,String]),component:It()});var che=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{var u;return[l.value,s.value,the(l.value,e),{[`${l.value}-rtl`]:i.value==="rtl",[`${l.value}-gap-${e.gap}`]:G3(e.gap),[`${l.value}-vertical`]:(u=e.vertical)!==null&&u!==void 0?u:r==null?void 0:r.value.vertical}]});return()=>{var u;const{flex:d,gap:f,component:h="div"}=e,v=che(e,["flex","gap","component"]),g={};return d&&(g.flex=d),f&&!G3(f)&&(g.gap=`${f}px`),a(p(h,B({class:[o.class,c.value],style:[o.style,g]},ot(v,["justify","wrap","align","vertical"])),{default:()=>[(u=n.default)===null||u===void 0?void 0:u.call(n)]}))}}}),dhe=Bt(uhe),U3=Object.freeze(Object.defineProperty({__proto__:null,Affix:sP,Alert:cG,Anchor:gl,AnchorLink:Gb,App:fc,AutoComplete:FK,AutoCompleteOptGroup:kK,AutoCompleteOption:NK,Avatar:Il,AvatarGroup:Hf,BackTop:dp,Badge:oc,BadgeRibbon:jf,Breadcrumb:Tl,BreadcrumbItem:Bc,BreadcrumbSeparator:Jf,Button:Wt,ButtonGroup:Uf,Calendar:nq,Card:La,CardGrid:np,CardMeta:tp,Carousel:jJ,Cascader:oee,CheckableTag:ap,Checkbox:jo,CheckboxGroup:ip,Col:cee,Collapse:ic,CollapsePanel:op,Comment:hee,Compact:Lf,ConfigProvider:_l,DatePicker:Mte,Descriptions:ya,DescriptionsItem:hE,DirectoryTree:ef,Divider:Wte,Drawer:ine,Dropdown:rr,DropdownButton:Dc,Empty:Ei,Flex:dhe,FloatButton:zi,FloatButtonGroup:up,Form:_i,FormItem:RT,FormItemRest:Nf,Grid:see,Image:ml,ImagePreviewGroup:kE,Input:un,InputGroup:wE,InputNumber:Noe,InputPassword:IE,InputSearch:OE,Layout:Yoe,LayoutContent:Xoe,LayoutFooter:Goe,LayoutHeader:Koe,LayoutSider:Uoe,List:Ci,ListItem:VE,ListItemMeta:HE,LocaleProvider:kT,Mentions:tie,MentionsOption:qd,Menu:Xt,MenuDivider:kc,MenuItem:Er,MenuItemGroup:Nc,Modal:rn,MonthPicker:Hd,PageHeader:Mie,Pagination:Vh,Popconfirm:kie,Popover:jy,Progress:aS,QRCode:$pe,QuarterPicker:jd,Radio:Xn,RadioButton:Qf,RadioGroup:m1,RangePicker:Vd,Rate:wle,Result:Al,Row:zle,Segmented:wfe,Select:Cn,SelectOptGroup:RK,SelectOption:AK,Skeleton:Rn,SkeletonAvatar:I1,SkeletonButton:w1,SkeletonImage:P1,SkeletonInput:O1,SkeletonTitle:Oh,Slider:oae,Space:Va,Spin:_r,Statistic:Yr,StatisticCountdown:mie,Step:Jd,Steps:$ae,SubMenu:zl,Switch:Mae,TabPane:ep,Table:Vce,TableColumn:nf,TableColumnGroup:of,TableSummary:rf,TableSummaryCell:yp,TableSummaryRow:bp,Tabs:El,Tag:ja,Textarea:K1,TimePicker:Fue,TimeRangePicker:lf,Timeline:dc,TimelineItem:Vc,Tooltip:co,Tour:jpe,Transfer:fue,Tree:H7,TreeNode:tf,TreeSelect:Nue,TreeSelectNode:X0,Typography:ao,TypographyLink:bs,TypographyParagraph:ys,TypographyText:Ss,TypographyTitle:$s,Upload:sfe,UploadDragger:afe,Watermark:vfe,WeekPicker:zd,message:Zn,notification:cr},Symbol.toStringTag,{value:"Module"})),bi=(e,t)=>new vt(e).setAlpha(t).toRgbString(),ha=(e,t)=>new vt(e).lighten(t).toHexString(),fhe=e=>{const t=ti(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},phe=(e,t)=>{const n=e||"#000",o=t||"#fff";return{colorBgBase:n,colorTextBase:o,colorText:bi(o,.85),colorTextSecondary:bi(o,.65),colorTextTertiary:bi(o,.45),colorTextQuaternary:bi(o,.25),colorFill:bi(o,.18),colorFillSecondary:bi(o,.12),colorFillTertiary:bi(o,.08),colorFillQuaternary:bi(o,.04),colorBgElevated:ha(n,12),colorBgContainer:ha(n,8),colorBgLayout:ha(n,0),colorBgSpotlight:ha(n,26),colorBorder:ha(n,26),colorBorderSecondary:ha(n,19)}},hhe=(e,t)=>{const n=Object.keys(kb).map(r=>{const i=ti(e[r],{theme:"dark"});return new Array(10).fill(1).reduce((l,a,s)=>(l[`${r}-${s+1}`]=i[s],l),{})}).reduce((r,i)=>(r=m(m({},r),i),r),{}),o=t??Fb(e);return m(m(m({},o),n),tP(e,{generateColorPalettes:fhe,generateNeutralColorPalettes:phe}))},X3={defaultSeed:zb.token,defaultAlgorithm:Fb,darkAlgorithm:hhe},ghe=function(e){return Object.keys(U3).forEach(t=>{const n=U3[t];n.install&&e.use(n)}),e.use(DD.StyleProvider),e.config.globalProperties.$message=Zn,e.config.globalProperties.$notification=cr,e.config.globalProperties.$info=rn.info,e.config.globalProperties.$success=rn.success,e.config.globalProperties.$error=rn.error,e.config.globalProperties.$warning=rn.warning,e.config.globalProperties.$confirm=rn.confirm,e.config.globalProperties.$destroyAll=rn.destroyAll,e},vhe={version:JO,install:ghe},mhe={locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",yearFormat:"YYYY年",dayFormat:"D日",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH时mm分ss秒",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"},S_={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},q0={lang:m({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},mhe),timePickerLocale:m({},S_)};q0.lang.ok="确定";const bo="${label}不是一个有效的${type}",bhe={locale:"zh-cn",Pagination:zE,DatePicker:q0,TimePicker:S_,Calendar:q0,global:{placeholder:"请选择"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckall:"全选",filterSearchPlaceholder:"在筛选项中搜索",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开"},PageHeader:{back:"返回"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:bo,method:bo,array:bo,object:bo,number:bo,date:bo,boolean:bo,integer:bo,float:bo,regexp:bo,email:bo,url:bo,hex:bo},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码已过期",refresh:"点击刷新",scanned:"已扫描"}},Y3="agent_admin_theme",q3="agent_admin_notify",dg=dO("app",()=>{const e=ne(localStorage.getItem(Y3)||"dark");t(e.value);function t(x){document.documentElement.dataset.theme=x}function n(){e.value=e.value==="dark"?"light":"dark",localStorage.setItem(Y3,e.value),t(e.value)}const o=ne(!1),r=ne(0);function i(x){r.value=Number(x),o.value=!0}function l(){o.value=!1}const a=ne(!1),s=ne(!1),c=ne(0),u=ne(0),d=ne(-1),f=ne(localStorage.getItem(q3)!=="0");function h(){f.value=!f.value,localStorage.setItem(q3,f.value?"1":"0")}function v(){u.value=0}const g=ne(null);function b(x){g.value=x}function y(){const x=g.value;return g.value=null,x}const S=ne(null);function $(x){S.value=x}function w(){const x=S.value;return S.value=null,x}const C=ne(!1);function O(){C.value=!0}return{theme:e,toggleTheme:n,runDrawerOpen:o,runDrawerId:r,openRun:i,closeRun:l,paletteOpen:a,offline:s,offlineSince:c,alarmCount:u,lastFailedTotal:d,notifyEnabled:f,toggleNotify:h,clearAlarm:v,replayPayload:g,setReplay:b,consumeReplay:y,injectContext:S,setInject:$,consumeInject:w,tourOpen:C,startTour:O}});/*! + * vue-router v4.5.1 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */const Sa=typeof document<"u";function $_(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function yhe(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&$_(e.default)}const At=Object.assign;function om(e,t){const n={};for(const o in t){const r=t[o];n[o]=ur(r)?r.map(e):e(r)}return n}const pc=()=>{},ur=Array.isArray,C_=/#/g,She=/&/g,$he=/\//g,Che=/=/g,xhe=/\?/g,x_=/\+/g,whe=/%5B/g,Ohe=/%5D/g,w_=/%5E/g,Phe=/%60/g,O_=/%7B/g,Ihe=/%7C/g,P_=/%7D/g,The=/%20/g;function zS(e){return encodeURI(""+e).replace(Ihe,"|").replace(whe,"[").replace(Ohe,"]")}function Ehe(e){return zS(e).replace(O_,"{").replace(P_,"}").replace(w_,"^")}function J0(e){return zS(e).replace(x_,"%2B").replace(The,"+").replace(C_,"%23").replace(She,"%26").replace(Phe,"`").replace(O_,"{").replace(P_,"}").replace(w_,"^")}function _he(e){return J0(e).replace(Che,"%3D")}function Mhe(e){return zS(e).replace(C_,"%23").replace(xhe,"%3F")}function Ahe(e){return e==null?"":Mhe(e).replace($he,"%2F")}function Wc(e){try{return decodeURIComponent(""+e)}catch{}return""+e}const Rhe=/\/$/,Dhe=e=>e.replace(Rhe,"");function rm(e,t,n="/"){let o,r={},i="",l="";const a=t.indexOf("#");let s=t.indexOf("?");return a=0&&(s=-1),s>-1&&(o=t.slice(0,s),i=t.slice(s+1,a>-1?a:t.length),r=e(i)),a>-1&&(o=o||t.slice(0,a),l=t.slice(a,t.length)),o=Fhe(o??t,n),{fullPath:o+(i&&"?")+i+l,path:o,query:r,hash:Wc(l)}}function Bhe(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function J3(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Nhe(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&ns(t.matched[o],n.matched[r])&&I_(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ns(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function I_(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!khe(e[n],t[n]))return!1;return!0}function khe(e,t){return ur(e)?Z3(e,t):ur(t)?Z3(t,e):e===t}function Z3(e,t){return ur(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function Fhe(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),r=o[o.length-1];(r===".."||r===".")&&o.push("");let i=n.length-1,l,a;for(l=0;l1&&i--;else break;return n.slice(0,i).join("/")+"/"+o.slice(l).join("/")}const yi={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var Kc;(function(e){e.pop="pop",e.push="push"})(Kc||(Kc={}));var hc;(function(e){e.back="back",e.forward="forward",e.unknown=""})(hc||(hc={}));function Lhe(e){if(!e)if(Sa){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Dhe(e)}const zhe=/^[^#]+#/;function Hhe(e,t){return e.replace(zhe,"#")+t}function jhe(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const fg=()=>({left:window.scrollX,top:window.scrollY});function Vhe(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=jhe(r,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Q3(e,t){return(history.state?history.state.position-t:-1)+e}const Z0=new Map;function Whe(e,t){Z0.set(e,t)}function Khe(e){const t=Z0.get(e);return Z0.delete(e),t}let Ghe=()=>location.protocol+"//"+location.host;function T_(e,t){const{pathname:n,search:o,hash:r}=t,i=e.indexOf("#");if(i>-1){let a=r.includes(e.slice(i))?e.slice(i).length:1,s=r.slice(a);return s[0]!=="/"&&(s="/"+s),J3(s,"")}return J3(n,e)+o+r}function Uhe(e,t,n,o){let r=[],i=[],l=null;const a=({state:f})=>{const h=T_(e,location),v=n.value,g=t.value;let b=0;if(f){if(n.value=h,t.value=f,l&&l===v){l=null;return}b=g?f.position-g.position:0}else o(h);r.forEach(y=>{y(n.value,v,{delta:b,type:Kc.pop,direction:b?b>0?hc.forward:hc.back:hc.unknown})})};function s(){l=n.value}function c(f){r.push(f);const h=()=>{const v=r.indexOf(f);v>-1&&r.splice(v,1)};return i.push(h),h}function u(){const{history:f}=window;f.state&&f.replaceState(At({},f.state,{scroll:fg()}),"")}function d(){for(const f of i)f();i=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:s,listen:c,destroy:d}}function e8(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?fg():null}}function Xhe(e){const{history:t,location:n}=window,o={value:T_(e,n)},r={value:t.state};r.value||i(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(s,c,u){const d=e.indexOf("#"),f=d>-1?(n.host&&document.querySelector("base")?e:e.slice(d))+s:Ghe()+e+s;try{t[u?"replaceState":"pushState"](c,"",f),r.value=c}catch(h){console.error(h),n[u?"replace":"assign"](f)}}function l(s,c){const u=At({},t.state,e8(r.value.back,s,r.value.forward,!0),c,{position:r.value.position});i(s,u,!0),o.value=s}function a(s,c){const u=At({},r.value,t.state,{forward:s,scroll:fg()});i(u.current,u,!0);const d=At({},e8(o.value,s,null),{position:u.position+1},c);i(s,d,!1),o.value=s}return{location:o,state:r,push:a,replace:l}}function Yhe(e){e=Lhe(e);const t=Xhe(e),n=Uhe(e,t.state,t.location,t.replace);function o(i,l=!0){l||n.pauseListeners(),history.go(i)}const r=At({location:"",base:e,go:o,createHref:Hhe.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}function qhe(e){return typeof e=="string"||e&&typeof e=="object"}function E_(e){return typeof e=="string"||typeof e=="symbol"}const __=Symbol("");var t8;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(t8||(t8={}));function os(e,t){return At(new Error,{type:e,[__]:!0},t)}function Hr(e,t){return e instanceof Error&&__ in e&&(t==null||!!(e.type&t))}const n8="[^/]+?",Jhe={sensitive:!1,strict:!1,start:!0,end:!0},Zhe=/[.+*?^${}()[\]/\\]/g;function Qhe(e,t){const n=At({},Jhe,t),o=[];let r=n.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[90];n.strict&&!c.length&&(r+="/");for(let d=0;dt.length?t.length===1&&t[0]===80?1:-1:0}function M_(e,t){let n=0;const o=e.score,r=t.score;for(;n0&&t[t.length-1]<0}const tge={type:0,value:""},nge=/[a-zA-Z0-9_]/;function oge(e){if(!e)return[[]];if(e==="/")return[[tge]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(h){throw new Error(`ERR (${n})/"${c}": ${h}`)}let n=0,o=n;const r=[];let i;function l(){i&&r.push(i),i=[]}let a=0,s,c="",u="";function d(){c&&(n===0?i.push({type:0,value:c}):n===1||n===2||n===3?(i.length>1&&(s==="*"||s==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:1,value:c,regexp:u,repeatable:s==="*"||s==="+",optional:s==="*"||s==="?"})):t("Invalid state to consume buffer"),c="")}function f(){c+=s}for(;a{l($)}:pc}function l(d){if(E_(d)){const f=o.get(d);f&&(o.delete(d),n.splice(n.indexOf(f),1),f.children.forEach(l),f.alias.forEach(l))}else{const f=n.indexOf(d);f>-1&&(n.splice(f,1),d.record.name&&o.delete(d.record.name),d.children.forEach(l),d.alias.forEach(l))}}function a(){return n}function s(d){const f=sge(d,n);n.splice(f,0,d),d.record.name&&!l8(d)&&o.set(d.record.name,d)}function c(d,f){let h,v={},g,b;if("name"in d&&d.name){if(h=o.get(d.name),!h)throw os(1,{location:d});b=h.record.name,v=At(r8(f.params,h.keys.filter($=>!$.optional).concat(h.parent?h.parent.keys.filter($=>$.optional):[]).map($=>$.name)),d.params&&r8(d.params,h.keys.map($=>$.name))),g=h.stringify(v)}else if(d.path!=null)g=d.path,h=n.find($=>$.re.test(g)),h&&(v=h.parse(g),b=h.record.name);else{if(h=f.name?o.get(f.name):n.find($=>$.re.test(f.path)),!h)throw os(1,{location:d,currentLocation:f});b=h.record.name,v=At({},f.params,d.params),g=h.stringify(v)}const y=[];let S=h;for(;S;)y.unshift(S.record),S=S.parent;return{name:b,path:g,params:v,matched:y,meta:age(y)}}e.forEach(d=>i(d));function u(){n.length=0,o.clear()}return{addRoute:i,resolve:c,removeRoute:l,clearRoutes:u,getRoutes:a,getRecordMatcher:r}}function r8(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function i8(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:lge(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function lge(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function l8(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function age(e){return e.reduce((t,n)=>At(t,n.meta),{})}function a8(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}function sge(e,t){let n=0,o=t.length;for(;n!==o;){const i=n+o>>1;M_(e,t[i])<0?o=i:n=i+1}const r=cge(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function cge(e){let t=e;for(;t=t.parent;)if(A_(t)&&M_(e,t)===0)return t}function A_({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function uge(e){const t={};if(e===""||e==="?")return t;const o=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;ri&&J0(i)):[o&&J0(o)]).forEach(i=>{i!==void 0&&(t+=(t.length?"&":"")+n,i!=null&&(t+="="+i))})}return t}function dge(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=ur(o)?o.map(r=>r==null?null:""+r):o==null?o:""+o)}return t}const fge=Symbol(""),c8=Symbol(""),pg=Symbol(""),HS=Symbol(""),Q0=Symbol("");function Bs(){let e=[];function t(o){return e.push(o),()=>{const r=e.indexOf(o);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Ii(e,t,n,o,r,i=l=>l()){const l=o&&(o.enterCallbacks[r]=o.enterCallbacks[r]||[]);return()=>new Promise((a,s)=>{const c=f=>{f===!1?s(os(4,{from:n,to:t})):f instanceof Error?s(f):qhe(f)?s(os(2,{from:t,to:f})):(l&&o.enterCallbacks[r]===l&&typeof f=="function"&&l.push(f),a())},u=i(()=>e.call(o&&o.instances[r],t,n,c));let d=Promise.resolve(u);e.length<3&&(d=d.then(c)),d.catch(f=>s(f))})}function im(e,t,n,o,r=i=>i()){const i=[];for(const l of e)for(const a in l.components){let s=l.components[a];if(!(t!=="beforeRouteEnter"&&!l.instances[a]))if($_(s)){const u=(s.__vccOpts||s)[t];u&&i.push(Ii(u,n,o,l,a,r))}else{let c=s();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${l.path}"`);const d=yhe(u)?u.default:u;l.mods[a]=u,l.components[a]=d;const h=(d.__vccOpts||d)[t];return h&&Ii(h,n,o,l,a,r)()}))}}return i}function u8(e){const t=Ge(pg),n=Ge(HS),o=P(()=>{const s=je(e.to);return t.resolve(s)}),r=P(()=>{const{matched:s}=o.value,{length:c}=s,u=s[c-1],d=n.matched;if(!u||!d.length)return-1;const f=d.findIndex(ns.bind(null,u));if(f>-1)return f;const h=d8(s[c-2]);return c>1&&d8(u)===h&&d[d.length-1].path!==h?d.findIndex(ns.bind(null,s[c-2])):f}),i=P(()=>r.value>-1&&mge(n.params,o.value.params)),l=P(()=>r.value>-1&&r.value===n.matched.length-1&&I_(n.params,o.value.params));function a(s={}){if(vge(s)){const c=t[je(e.replace)?"replace":"push"](je(e.to)).catch(pc);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:o,href:P(()=>o.value.href),isActive:i,isExactActive:l,navigate:a}}function pge(e){return e.length===1?e[0]:e}const hge=re({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:u8,setup(e,{slots:t}){const n=ft(u8(e)),{options:o}=Ge(pg),r=P(()=>({[f8(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[f8(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=t.default&&pge(t.default(n));return e.custom?i:tn("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},i)}}}),gge=hge;function vge(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function mge(e,t){for(const n in t){const o=t[n],r=e[n];if(typeof o=="string"){if(o!==r)return!1}else if(!ur(r)||r.length!==o.length||o.some((i,l)=>i!==r[l]))return!1}return!0}function d8(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const f8=(e,t,n)=>e??t??n,bge=re({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Ge(Q0),r=P(()=>e.route||o.value),i=Ge(c8,0),l=P(()=>{let c=je(i);const{matched:u}=r.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),a=P(()=>r.value.matched[l.value]);Ye(c8,P(()=>l.value+1)),Ye(fge,a),Ye(Q0,r);const s=ne();return ye(()=>[s.value,a.value,e.name],([c,u,d],[f,h,v])=>{u&&(u.instances[d]=c,h&&h!==u&&c&&c===f&&(u.leaveGuards.size||(u.leaveGuards=h.leaveGuards),u.updateGuards.size||(u.updateGuards=h.updateGuards))),c&&u&&(!h||!ns(u,h)||!f)&&(u.enterCallbacks[d]||[]).forEach(g=>g(c))},{flush:"post"}),()=>{const c=r.value,u=e.name,d=a.value,f=d&&d.components[u];if(!f)return p8(n.default,{Component:f,route:c});const h=d.props[u],v=h?h===!0?c.params:typeof h=="function"?h(c):h:null,b=tn(f,At({},v,t,{onVnodeUnmounted:y=>{y.component.isUnmounted&&(d.instances[u]=null)},ref:s}));return p8(n.default,{Component:b,route:c})||b}}});function p8(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const yge=bge;function Sge(e){const t=ige(e.routes,e),n=e.parseQuery||uge,o=e.stringifyQuery||s8,r=e.history,i=Bs(),l=Bs(),a=Bs(),s=oe(yi);let c=yi;Sa&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=om.bind(null,U=>""+U),d=om.bind(null,Ahe),f=om.bind(null,Wc);function h(U,Q){let J,G;return E_(U)?(J=t.getRecordMatcher(U),G=Q):G=U,t.addRoute(G,J)}function v(U){const Q=t.getRecordMatcher(U);Q&&t.removeRoute(Q)}function g(){return t.getRoutes().map(U=>U.record)}function b(U){return!!t.getRecordMatcher(U)}function y(U,Q){if(Q=At({},Q||s.value),typeof U=="string"){const te=rm(n,U,Q.path),ue=t.resolve({path:te.path},Q),ie=r.createHref(te.fullPath);return At(te,ue,{params:f(ue.params),hash:Wc(te.hash),redirectedFrom:void 0,href:ie})}let J;if(U.path!=null)J=At({},U,{path:rm(n,U.path,Q.path).path});else{const te=At({},U.params);for(const ue in te)te[ue]==null&&delete te[ue];J=At({},U,{params:d(te)}),Q.params=d(Q.params)}const G=t.resolve(J,Q),q=U.hash||"";G.params=u(f(G.params));const V=Bhe(o,At({},U,{hash:Ehe(q),path:G.path})),W=r.createHref(V);return At({fullPath:V,hash:q,query:o===s8?dge(U.query):U.query||{}},G,{redirectedFrom:void 0,href:W})}function S(U){return typeof U=="string"?rm(n,U,s.value.path):At({},U)}function $(U,Q){if(c!==U)return os(8,{from:Q,to:U})}function w(U){return x(U)}function C(U){return w(At(S(U),{replace:!0}))}function O(U){const Q=U.matched[U.matched.length-1];if(Q&&Q.redirect){const{redirect:J}=Q;let G=typeof J=="function"?J(U):J;return typeof G=="string"&&(G=G.includes("?")||G.includes("#")?G=S(G):{path:G},G.params={}),At({query:U.query,hash:U.hash,params:G.path!=null?{}:U.params},G)}}function x(U,Q){const J=c=y(U),G=s.value,q=U.state,V=U.force,W=U.replace===!0,te=O(J);if(te)return x(At(S(te),{state:typeof te=="object"?At({},q,te.state):q,force:V,replace:W}),Q||J);const ue=J;ue.redirectedFrom=Q;let ie;return!V&&Nhe(o,G,J)&&(ie=os(16,{to:ue,from:G}),H(G,G,!0,!1)),(ie?Promise.resolve(ie):M(ue,G)).catch(ae=>Hr(ae)?Hr(ae,2)?ae:L(ae):k(ae,ue,G)).then(ae=>{if(ae){if(Hr(ae,2))return x(At({replace:W},S(ae.to),{state:typeof ae.to=="object"?At({},q,ae.to.state):q,force:V}),Q||ue)}else ae=A(ue,G,!0,W,q);return E(ue,G,ae),ae})}function I(U,Q){const J=$(U,Q);return J?Promise.reject(J):Promise.resolve()}function T(U){const Q=Z.values().next().value;return Q&&typeof Q.runWithContext=="function"?Q.runWithContext(U):U()}function M(U,Q){let J;const[G,q,V]=$ge(U,Q);J=im(G.reverse(),"beforeRouteLeave",U,Q);for(const te of G)te.leaveGuards.forEach(ue=>{J.push(Ii(ue,U,Q))});const W=I.bind(null,U,Q);return J.push(W),ee(J).then(()=>{J=[];for(const te of i.list())J.push(Ii(te,U,Q));return J.push(W),ee(J)}).then(()=>{J=im(q,"beforeRouteUpdate",U,Q);for(const te of q)te.updateGuards.forEach(ue=>{J.push(Ii(ue,U,Q))});return J.push(W),ee(J)}).then(()=>{J=[];for(const te of V)if(te.beforeEnter)if(ur(te.beforeEnter))for(const ue of te.beforeEnter)J.push(Ii(ue,U,Q));else J.push(Ii(te.beforeEnter,U,Q));return J.push(W),ee(J)}).then(()=>(U.matched.forEach(te=>te.enterCallbacks={}),J=im(V,"beforeRouteEnter",U,Q,T),J.push(W),ee(J))).then(()=>{J=[];for(const te of l.list())J.push(Ii(te,U,Q));return J.push(W),ee(J)}).catch(te=>Hr(te,8)?te:Promise.reject(te))}function E(U,Q,J){a.list().forEach(G=>T(()=>G(U,Q,J)))}function A(U,Q,J,G,q){const V=$(U,Q);if(V)return V;const W=Q===yi,te=Sa?history.state:{};J&&(G||W?r.replace(U.fullPath,At({scroll:W&&te&&te.scroll},q)):r.push(U.fullPath,q)),s.value=U,H(U,Q,J,W),L()}let R;function z(){R||(R=r.listen((U,Q,J)=>{if(!X.listening)return;const G=y(U),q=O(G);if(q){x(At(q,{replace:!0,force:!0}),G).catch(pc);return}c=G;const V=s.value;Sa&&Whe(Q3(V.fullPath,J.delta),fg()),M(G,V).catch(W=>Hr(W,12)?W:Hr(W,2)?(x(At(S(W.to),{force:!0}),G).then(te=>{Hr(te,20)&&!J.delta&&J.type===Kc.pop&&r.go(-1,!1)}).catch(pc),Promise.reject()):(J.delta&&r.go(-J.delta,!1),k(W,G,V))).then(W=>{W=W||A(G,V,!1),W&&(J.delta&&!Hr(W,8)?r.go(-J.delta,!1):J.type===Kc.pop&&Hr(W,20)&&r.go(-1,!1)),E(G,V,W)}).catch(pc)}))}let _=Bs(),D=Bs(),N;function k(U,Q,J){L(U);const G=D.list();return G.length?G.forEach(q=>q(U,Q,J)):console.error(U),Promise.reject(U)}function F(){return N&&s.value!==yi?Promise.resolve():new Promise((U,Q)=>{_.add([U,Q])})}function L(U){return N||(N=!U,z(),_.list().forEach(([Q,J])=>U?J(U):Q()),_.reset()),U}function H(U,Q,J,G){const{scrollBehavior:q}=e;if(!Sa||!q)return Promise.resolve();const V=!J&&Khe(Q3(U.fullPath,0))||(G||!J)&&history.state&&history.state.scroll||null;return rt().then(()=>q(U,Q,V)).then(W=>W&&Vhe(W)).catch(W=>k(W,U,Q))}const j=U=>r.go(U);let Y;const Z=new Set,X={currentRoute:s,listening:!0,addRoute:h,removeRoute:v,clearRoutes:t.clearRoutes,hasRoute:b,getRoutes:g,resolve:y,options:e,push:w,replace:C,go:j,back:()=>j(-1),forward:()=>j(1),beforeEach:i.add,beforeResolve:l.add,afterEach:a.add,onError:D.add,isReady:F,install(U){const Q=this;U.component("RouterLink",gge),U.component("RouterView",yge),U.config.globalProperties.$router=Q,Object.defineProperty(U.config.globalProperties,"$route",{enumerable:!0,get:()=>je(s)}),Sa&&!Y&&s.value===yi&&(Y=!0,w(r.location).catch(q=>{}));const J={};for(const q in yi)Object.defineProperty(J,q,{get:()=>s.value[q],enumerable:!0});U.provide(pg,Q),U.provide(HS,r6(J)),U.provide(Q0,s);const G=U.unmount;Z.add(U),U.unmount=function(){Z.delete(U),Z.size<1&&(c=yi,R&&R(),R=null,s.value=yi,Y=!1,N=!1),G()}}};function ee(U){return U.reduce((Q,J)=>Q.then(()=>T(J)),Promise.resolve())}return X}function $ge(e,t){const n=[],o=[],r=[],i=Math.max(t.matched.length,e.matched.length);for(let l=0;lns(c,a))?o.push(a):n.push(a));const s=e.matched[l];s&&(t.matched.find(c=>ns(c,s))||r.push(s))}return[n,o,r]}function jS(){return Ge(pg)}function Cge(e){return Ge(HS)}function R_(e,t){return function(){return e.apply(t,arguments)}}const{toString:xge}=Object.prototype,{getPrototypeOf:VS}=Object,{iterator:hg,toStringTag:D_}=Symbol,gg=(e=>t=>{const n=xge.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),gr=e=>(e=e.toLowerCase(),t=>gg(t)===e),vg=e=>t=>typeof t===e,{isArray:Cs}=Array,Gc=vg("undefined");function wge(e){return e!==null&&!Gc(e)&&e.constructor!==null&&!Gc(e.constructor)&&uo(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const B_=gr("ArrayBuffer");function Oge(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&B_(e.buffer),t}const Pge=vg("string"),uo=vg("function"),N_=vg("number"),mg=e=>e!==null&&typeof e=="object",Ige=e=>e===!0||e===!1,cf=e=>{if(gg(e)!=="object")return!1;const t=VS(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(D_ in e)&&!(hg in e)},Tge=gr("Date"),Ege=gr("File"),_ge=gr("Blob"),Mge=gr("FileList"),Age=e=>mg(e)&&uo(e.pipe),Rge=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||uo(e.append)&&((t=gg(e))==="formdata"||t==="object"&&uo(e.toString)&&e.toString()==="[object FormData]"))},Dge=gr("URLSearchParams"),[Bge,Nge,kge,Fge]=["ReadableStream","Request","Response","Headers"].map(gr),Lge=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $u(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let o,r;if(typeof e!="object"&&(e=[e]),Cs(e))for(o=0,r=e.length;o0;)if(r=n[o],t===r.toLowerCase())return r;return null}const Cl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,F_=e=>!Gc(e)&&e!==Cl;function eb(){const{caseless:e}=F_(this)&&this||{},t={},n=(o,r)=>{const i=e&&k_(t,r)||r;cf(t[i])&&cf(o)?t[i]=eb(t[i],o):cf(o)?t[i]=eb({},o):Cs(o)?t[i]=o.slice():t[i]=o};for(let o=0,r=arguments.length;o($u(t,(r,i)=>{n&&uo(r)?e[i]=R_(r,n):e[i]=r},{allOwnKeys:o}),e),Hge=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),jge=(e,t,n,o)=>{e.prototype=Object.create(t.prototype,o),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Vge=(e,t,n,o)=>{let r,i,l;const a={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),i=r.length;i-- >0;)l=r[i],(!o||o(l,e,t))&&!a[l]&&(t[l]=e[l],a[l]=!0);e=n!==!1&&VS(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Wge=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const o=e.indexOf(t,n);return o!==-1&&o===n},Kge=e=>{if(!e)return null;if(Cs(e))return e;let t=e.length;if(!N_(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Gge=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&VS(Uint8Array)),Uge=(e,t)=>{const o=(e&&e[hg]).call(e);let r;for(;(r=o.next())&&!r.done;){const i=r.value;t.call(e,i[0],i[1])}},Xge=(e,t)=>{let n;const o=[];for(;(n=e.exec(t))!==null;)o.push(n);return o},Yge=gr("HTMLFormElement"),qge=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,o,r){return o.toUpperCase()+r}),h8=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Jge=gr("RegExp"),L_=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),o={};$u(n,(r,i)=>{let l;(l=t(r,i,e))!==!1&&(o[i]=l||r)}),Object.defineProperties(e,o)},Zge=e=>{L_(e,(t,n)=>{if(uo(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const o=e[n];if(uo(o)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Qge=(e,t)=>{const n={},o=r=>{r.forEach(i=>{n[i]=!0})};return Cs(e)?o(e):o(String(e).split(t)),n},eve=()=>{},tve=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function nve(e){return!!(e&&uo(e.append)&&e[D_]==="FormData"&&e[hg])}const ove=e=>{const t=new Array(10),n=(o,r)=>{if(mg(o)){if(t.indexOf(o)>=0)return;if(!("toJSON"in o)){t[r]=o;const i=Cs(o)?[]:{};return $u(o,(l,a)=>{const s=n(l,r+1);!Gc(s)&&(i[a]=s)}),t[r]=void 0,i}}return o};return n(e,0)},rve=gr("AsyncFunction"),ive=e=>e&&(mg(e)||uo(e))&&uo(e.then)&&uo(e.catch),z_=((e,t)=>e?setImmediate:t?((n,o)=>(Cl.addEventListener("message",({source:r,data:i})=>{r===Cl&&i===n&&o.length&&o.shift()()},!1),r=>{o.push(r),Cl.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",uo(Cl.postMessage)),lve=typeof queueMicrotask<"u"?queueMicrotask.bind(Cl):typeof process<"u"&&process.nextTick||z_,ave=e=>e!=null&&uo(e[hg]),Oe={isArray:Cs,isArrayBuffer:B_,isBuffer:wge,isFormData:Rge,isArrayBufferView:Oge,isString:Pge,isNumber:N_,isBoolean:Ige,isObject:mg,isPlainObject:cf,isReadableStream:Bge,isRequest:Nge,isResponse:kge,isHeaders:Fge,isUndefined:Gc,isDate:Tge,isFile:Ege,isBlob:_ge,isRegExp:Jge,isFunction:uo,isStream:Age,isURLSearchParams:Dge,isTypedArray:Gge,isFileList:Mge,forEach:$u,merge:eb,extend:zge,trim:Lge,stripBOM:Hge,inherits:jge,toFlatObject:Vge,kindOf:gg,kindOfTest:gr,endsWith:Wge,toArray:Kge,forEachEntry:Uge,matchAll:Xge,isHTMLForm:Yge,hasOwnProperty:h8,hasOwnProp:h8,reduceDescriptors:L_,freezeMethods:Zge,toObjectSet:Qge,toCamelCase:qge,noop:eve,toFiniteNumber:tve,findKey:k_,global:Cl,isContextDefined:F_,isSpecCompliantForm:nve,toJSONObject:ove,isAsyncFn:rve,isThenable:ive,setImmediate:z_,asap:lve,isIterable:ave};function mt(e,t,n,o,r){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),o&&(this.request=o),r&&(this.response=r,this.status=r.status?r.status:null)}Oe.inherits(mt,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:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const H_=mt.prototype,j_={};["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=>{j_[e]={value:e}});Object.defineProperties(mt,j_);Object.defineProperty(H_,"isAxiosError",{value:!0});mt.from=(e,t,n,o,r,i)=>{const l=Object.create(H_);return Oe.toFlatObject(e,l,function(s){return s!==Error.prototype},a=>a!=="isAxiosError"),mt.call(l,e.message,t,n,o,r),l.cause=e,l.name=e.name,i&&Object.assign(l,i),l};const sve=null;function tb(e){return Oe.isPlainObject(e)||Oe.isArray(e)}function V_(e){return Oe.endsWith(e,"[]")?e.slice(0,-2):e}function g8(e,t,n){return e?e.concat(t).map(function(r,i){return r=V_(r),!n&&i?"["+r+"]":r}).join(n?".":""):t}function cve(e){return Oe.isArray(e)&&!e.some(tb)}const uve=Oe.toFlatObject(Oe,{},null,function(t){return/^is[A-Z]/.test(t)});function bg(e,t,n){if(!Oe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=Oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,b){return!Oe.isUndefined(b[g])});const o=n.metaTokens,r=n.visitor||u,i=n.dots,l=n.indexes,s=(n.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(t);if(!Oe.isFunction(r))throw new TypeError("visitor must be a function");function c(v){if(v===null)return"";if(Oe.isDate(v))return v.toISOString();if(!s&&Oe.isBlob(v))throw new mt("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(v)||Oe.isTypedArray(v)?s&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function u(v,g,b){let y=v;if(v&&!b&&typeof v=="object"){if(Oe.endsWith(g,"{}"))g=o?g:g.slice(0,-2),v=JSON.stringify(v);else if(Oe.isArray(v)&&cve(v)||(Oe.isFileList(v)||Oe.endsWith(g,"[]"))&&(y=Oe.toArray(v)))return g=V_(g),y.forEach(function($,w){!(Oe.isUndefined($)||$===null)&&t.append(l===!0?g8([g],w,i):l===null?g:g+"[]",c($))}),!1}return tb(v)?!0:(t.append(g8(b,g,i),c(v)),!1)}const d=[],f=Object.assign(uve,{defaultVisitor:u,convertValue:c,isVisitable:tb});function h(v,g){if(!Oe.isUndefined(v)){if(d.indexOf(v)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(v),Oe.forEach(v,function(y,S){(!(Oe.isUndefined(y)||y===null)&&r.call(t,y,Oe.isString(S)?S.trim():S,g,f))===!0&&h(y,g?g.concat(S):[S])}),d.pop()}}if(!Oe.isObject(e))throw new TypeError("data must be an object");return h(e),t}function v8(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(o){return t[o]})}function WS(e,t){this._pairs=[],e&&bg(e,this,t)}const W_=WS.prototype;W_.append=function(t,n){this._pairs.push([t,n])};W_.toString=function(t){const n=t?function(o){return t.call(this,o,v8)}:v8;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function dve(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function K_(e,t,n){if(!t)return e;const o=n&&n.encode||dve;Oe.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let i;if(r?i=r(t,n):i=Oe.isURLSearchParams(t)?t.toString():new WS(t,n).toString(o),i){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class m8{constructor(){this.handlers=[]}use(t,n,o){return this.handlers.push({fulfilled:t,rejected:n,synchronous:o?o.synchronous:!1,runWhen:o?o.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Oe.forEach(this.handlers,function(o){o!==null&&t(o)})}}const G_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fve=typeof URLSearchParams<"u"?URLSearchParams:WS,pve=typeof FormData<"u"?FormData:null,hve=typeof Blob<"u"?Blob:null,gve={isBrowser:!0,classes:{URLSearchParams:fve,FormData:pve,Blob:hve},protocols:["http","https","file","blob","url","data"]},KS=typeof window<"u"&&typeof document<"u",nb=typeof navigator=="object"&&navigator||void 0,vve=KS&&(!nb||["ReactNative","NativeScript","NS"].indexOf(nb.product)<0),mve=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bve=KS&&window.location.href||"http://localhost",yve=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:KS,hasStandardBrowserEnv:vve,hasStandardBrowserWebWorkerEnv:mve,navigator:nb,origin:bve},Symbol.toStringTag,{value:"Module"})),kn={...yve,...gve};function Sve(e,t){return bg(e,new kn.classes.URLSearchParams,Object.assign({visitor:function(n,o,r,i){return kn.isNode&&Oe.isBuffer(n)?(this.append(o,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function $ve(e){return Oe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Cve(e){const t={},n=Object.keys(e);let o;const r=n.length;let i;for(o=0;o=n.length;return l=!l&&Oe.isArray(r)?r.length:l,s?(Oe.hasOwnProp(r,l)?r[l]=[r[l],o]:r[l]=o,!a):((!r[l]||!Oe.isObject(r[l]))&&(r[l]=[]),t(n,o,r[l],i)&&Oe.isArray(r[l])&&(r[l]=Cve(r[l])),!a)}if(Oe.isFormData(e)&&Oe.isFunction(e.entries)){const n={};return Oe.forEachEntry(e,(o,r)=>{t($ve(o),r,n,0)}),n}return null}function xve(e,t,n){if(Oe.isString(e))try{return(t||JSON.parse)(e),Oe.trim(e)}catch(o){if(o.name!=="SyntaxError")throw o}return(n||JSON.stringify)(e)}const Cu={transitional:G_,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const o=n.getContentType()||"",r=o.indexOf("application/json")>-1,i=Oe.isObject(t);if(i&&Oe.isHTMLForm(t)&&(t=new FormData(t)),Oe.isFormData(t))return r?JSON.stringify(U_(t)):t;if(Oe.isArrayBuffer(t)||Oe.isBuffer(t)||Oe.isStream(t)||Oe.isFile(t)||Oe.isBlob(t)||Oe.isReadableStream(t))return t;if(Oe.isArrayBufferView(t))return t.buffer;if(Oe.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(o.indexOf("application/x-www-form-urlencoded")>-1)return Sve(t,this.formSerializer).toString();if((a=Oe.isFileList(t))||o.indexOf("multipart/form-data")>-1){const s=this.env&&this.env.FormData;return bg(a?{"files[]":t}:t,s&&new s,this.formSerializer)}}return i||r?(n.setContentType("application/json",!1),xve(t)):t}],transformResponse:[function(t){const n=this.transitional||Cu.transitional,o=n&&n.forcedJSONParsing,r=this.responseType==="json";if(Oe.isResponse(t)||Oe.isReadableStream(t))return t;if(t&&Oe.isString(t)&&(o&&!this.responseType||r)){const l=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(a){if(l)throw a.name==="SyntaxError"?mt.from(a,mt.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:kn.classes.FormData,Blob:kn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],e=>{Cu.headers[e]={}});const wve=Oe.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"]),Ove=e=>{const t={};let n,o,r;return e&&e.split(` +`).forEach(function(l){r=l.indexOf(":"),n=l.substring(0,r).trim().toLowerCase(),o=l.substring(r+1).trim(),!(!n||t[n]&&wve[n])&&(n==="set-cookie"?t[n]?t[n].push(o):t[n]=[o]:t[n]=t[n]?t[n]+", "+o:o)}),t},b8=Symbol("internals");function Ns(e){return e&&String(e).trim().toLowerCase()}function uf(e){return e===!1||e==null?e:Oe.isArray(e)?e.map(uf):String(e)}function Pve(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let o;for(;o=n.exec(e);)t[o[1]]=o[2];return t}const Ive=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function lm(e,t,n,o,r){if(Oe.isFunction(o))return o.call(this,t,n);if(r&&(t=n),!!Oe.isString(t)){if(Oe.isString(o))return t.indexOf(o)!==-1;if(Oe.isRegExp(o))return o.test(t)}}function Tve(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,o)=>n.toUpperCase()+o)}function Eve(e,t){const n=Oe.toCamelCase(" "+t);["get","set","has"].forEach(o=>{Object.defineProperty(e,o+n,{value:function(r,i,l){return this[o].call(this,t,r,i,l)},configurable:!0})})}let fo=class{constructor(t){t&&this.set(t)}set(t,n,o){const r=this;function i(a,s,c){const u=Ns(s);if(!u)throw new Error("header name must be a non-empty string");const d=Oe.findKey(r,u);(!d||r[d]===void 0||c===!0||c===void 0&&r[d]!==!1)&&(r[d||s]=uf(a))}const l=(a,s)=>Oe.forEach(a,(c,u)=>i(c,u,s));if(Oe.isPlainObject(t)||t instanceof this.constructor)l(t,n);else if(Oe.isString(t)&&(t=t.trim())&&!Ive(t))l(Ove(t),n);else if(Oe.isObject(t)&&Oe.isIterable(t)){let a={},s,c;for(const u of t){if(!Oe.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(s=a[c])?Oe.isArray(s)?[...s,u[1]]:[s,u[1]]:u[1]}l(a,n)}else t!=null&&i(n,t,o);return this}get(t,n){if(t=Ns(t),t){const o=Oe.findKey(this,t);if(o){const r=this[o];if(!n)return r;if(n===!0)return Pve(r);if(Oe.isFunction(n))return n.call(this,r,o);if(Oe.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ns(t),t){const o=Oe.findKey(this,t);return!!(o&&this[o]!==void 0&&(!n||lm(this,this[o],o,n)))}return!1}delete(t,n){const o=this;let r=!1;function i(l){if(l=Ns(l),l){const a=Oe.findKey(o,l);a&&(!n||lm(o,o[a],a,n))&&(delete o[a],r=!0)}}return Oe.isArray(t)?t.forEach(i):i(t),r}clear(t){const n=Object.keys(this);let o=n.length,r=!1;for(;o--;){const i=n[o];(!t||lm(this,this[i],i,t,!0))&&(delete this[i],r=!0)}return r}normalize(t){const n=this,o={};return Oe.forEach(this,(r,i)=>{const l=Oe.findKey(o,i);if(l){n[l]=uf(r),delete n[i];return}const a=t?Tve(i):String(i).trim();a!==i&&delete n[i],n[a]=uf(r),o[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return Oe.forEach(this,(o,r)=>{o!=null&&o!==!1&&(n[r]=t&&Oe.isArray(o)?o.join(", "):o)}),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 o=new this(t);return n.forEach(r=>o.set(r)),o}static accessor(t){const o=(this[b8]=this[b8]={accessors:{}}).accessors,r=this.prototype;function i(l){const a=Ns(l);o[a]||(Eve(r,l),o[a]=!0)}return Oe.isArray(t)?t.forEach(i):i(t),this}};fo.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Oe.reduceDescriptors(fo.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(o){this[n]=o}}});Oe.freezeMethods(fo);function am(e,t){const n=this||Cu,o=t||n,r=fo.from(o.headers);let i=o.data;return Oe.forEach(e,function(a){i=a.call(n,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function X_(e){return!!(e&&e.__CANCEL__)}function xs(e,t,n){mt.call(this,e??"canceled",mt.ERR_CANCELED,t,n),this.name="CanceledError"}Oe.inherits(xs,mt,{__CANCEL__:!0});function Y_(e,t,n){const o=n.config.validateStatus;!n.status||!o||o(n.status)?e(n):t(new mt("Request failed with status code "+n.status,[mt.ERR_BAD_REQUEST,mt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function _ve(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Mve(e,t){e=e||10;const n=new Array(e),o=new Array(e);let r=0,i=0,l;return t=t!==void 0?t:1e3,function(s){const c=Date.now(),u=o[i];l||(l=c),n[r]=s,o[r]=c;let d=i,f=0;for(;d!==r;)f+=n[d++],d=d%e;if(r=(r+1)%e,r===i&&(i=(i+1)%e),c-l{n=u,r=null,i&&(clearTimeout(i),i=null),e.apply(null,c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=o?l(c,u):(r=c,i||(i=setTimeout(()=>{i=null,l(r)},o-d)))},()=>r&&l(r)]}const Sp=(e,t,n=3)=>{let o=0;const r=Mve(50,250);return Ave(i=>{const l=i.loaded,a=i.lengthComputable?i.total:void 0,s=l-o,c=r(s),u=l<=a;o=l;const d={loaded:l,total:a,progress:a?l/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&u?(a-l)/c:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},n)},y8=(e,t)=>{const n=e!=null;return[o=>t[0]({lengthComputable:n,total:e,loaded:o}),t[1]]},S8=e=>(...t)=>Oe.asap(()=>e(...t)),Rve=kn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,kn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(kn.origin),kn.navigator&&/(msie|trident)/i.test(kn.navigator.userAgent)):()=>!0,Dve=kn.hasStandardBrowserEnv?{write(e,t,n,o,r,i){const l=[e+"="+encodeURIComponent(t)];Oe.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),Oe.isString(o)&&l.push("path="+o),Oe.isString(r)&&l.push("domain="+r),i===!0&&l.push("secure"),document.cookie=l.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Bve(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Nve(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function q_(e,t,n){let o=!Bve(t);return e&&(o||n==!1)?Nve(e,t):t}const $8=e=>e instanceof fo?{...e}:e;function Vl(e,t){t=t||{};const n={};function o(c,u,d,f){return Oe.isPlainObject(c)&&Oe.isPlainObject(u)?Oe.merge.call({caseless:f},c,u):Oe.isPlainObject(u)?Oe.merge({},u):Oe.isArray(u)?u.slice():u}function r(c,u,d,f){if(Oe.isUndefined(u)){if(!Oe.isUndefined(c))return o(void 0,c,d,f)}else return o(c,u,d,f)}function i(c,u){if(!Oe.isUndefined(u))return o(void 0,u)}function l(c,u){if(Oe.isUndefined(u)){if(!Oe.isUndefined(c))return o(void 0,c)}else return o(void 0,u)}function a(c,u,d){if(d in t)return o(c,u);if(d in e)return o(void 0,c)}const s={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:a,headers:(c,u,d)=>r($8(c),$8(u),d,!0)};return Oe.forEach(Object.keys(Object.assign({},e,t)),function(u){const d=s[u]||r,f=d(e[u],t[u],u);Oe.isUndefined(f)&&d!==a||(n[u]=f)}),n}const J_=e=>{const t=Vl({},e);let{data:n,withXSRFToken:o,xsrfHeaderName:r,xsrfCookieName:i,headers:l,auth:a}=t;t.headers=l=fo.from(l),t.url=K_(q_(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&l.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let s;if(Oe.isFormData(n)){if(kn.hasStandardBrowserEnv||kn.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if((s=l.getContentType())!==!1){const[c,...u]=s?s.split(";").map(d=>d.trim()).filter(Boolean):[];l.setContentType([c||"multipart/form-data",...u].join("; "))}}if(kn.hasStandardBrowserEnv&&(o&&Oe.isFunction(o)&&(o=o(t)),o||o!==!1&&Rve(t.url))){const c=r&&i&&Dve.read(i);c&&l.set(r,c)}return t},kve=typeof XMLHttpRequest<"u",Fve=kve&&function(e){return new Promise(function(n,o){const r=J_(e);let i=r.data;const l=fo.from(r.headers).normalize();let{responseType:a,onUploadProgress:s,onDownloadProgress:c}=r,u,d,f,h,v;function g(){h&&h(),v&&v(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(r.method.toUpperCase(),r.url,!0),b.timeout=r.timeout;function y(){if(!b)return;const $=fo.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:$,config:e,request:b};Y_(function(x){n(x),g()},function(x){o(x),g()},C),b=null}"onloadend"in b?b.onloadend=y:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(y)},b.onabort=function(){b&&(o(new mt("Request aborted",mt.ECONNABORTED,e,b)),b=null)},b.onerror=function(){o(new mt("Network Error",mt.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let w=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const C=r.transitional||G_;r.timeoutErrorMessage&&(w=r.timeoutErrorMessage),o(new mt(w,C.clarifyTimeoutError?mt.ETIMEDOUT:mt.ECONNABORTED,e,b)),b=null},i===void 0&&l.setContentType(null),"setRequestHeader"in b&&Oe.forEach(l.toJSON(),function(w,C){b.setRequestHeader(C,w)}),Oe.isUndefined(r.withCredentials)||(b.withCredentials=!!r.withCredentials),a&&a!=="json"&&(b.responseType=r.responseType),c&&([f,v]=Sp(c,!0),b.addEventListener("progress",f)),s&&b.upload&&([d,h]=Sp(s),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",h)),(r.cancelToken||r.signal)&&(u=$=>{b&&(o(!$||$.type?new xs(null,e,b):$),b.abort(),b=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const S=_ve(r.url);if(S&&kn.protocols.indexOf(S)===-1){o(new mt("Unsupported protocol "+S+":",mt.ERR_BAD_REQUEST,e));return}b.send(i||null)})},Lve=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let o=new AbortController,r;const i=function(c){if(!r){r=!0,a();const u=c instanceof Error?c:this.reason;o.abort(u instanceof mt?u:new xs(u instanceof Error?u.message:u))}};let l=t&&setTimeout(()=>{l=null,i(new mt(`timeout ${t} of ms exceeded`,mt.ETIMEDOUT))},t);const a=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),e=null)};e.forEach(c=>c.addEventListener("abort",i));const{signal:s}=o;return s.unsubscribe=()=>Oe.asap(a),s}},zve=function*(e,t){let n=e.byteLength;if(n{const r=Hve(e,t);let i=0,l,a=s=>{l||(l=!0,o&&o(s))};return new ReadableStream({async pull(s){try{const{done:c,value:u}=await r.next();if(c){a(),s.close();return}let d=u.byteLength;if(n){let f=i+=d;n(f)}s.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(s){return a(s),r.return()}},{highWaterMark:2})},yg=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Z_=yg&&typeof ReadableStream=="function",Vve=yg&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Q_=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Wve=Z_&&Q_(()=>{let e=!1;const t=new Request(kn.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),x8=64*1024,ob=Z_&&Q_(()=>Oe.isReadableStream(new Response("").body)),$p={stream:ob&&(e=>e.body)};yg&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!$p[t]&&($p[t]=Oe.isFunction(e[t])?n=>n[t]():(n,o)=>{throw new mt(`Response type '${t}' is not supported`,mt.ERR_NOT_SUPPORT,o)})})})(new Response);const Kve=async e=>{if(e==null)return 0;if(Oe.isBlob(e))return e.size;if(Oe.isSpecCompliantForm(e))return(await new Request(kn.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(e)||Oe.isArrayBuffer(e))return e.byteLength;if(Oe.isURLSearchParams(e)&&(e=e+""),Oe.isString(e))return(await Vve(e)).byteLength},Gve=async(e,t)=>{const n=Oe.toFiniteNumber(e.getContentLength());return n??Kve(t)},Uve=yg&&(async e=>{let{url:t,method:n,data:o,signal:r,cancelToken:i,timeout:l,onDownloadProgress:a,onUploadProgress:s,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:f}=J_(e);c=c?(c+"").toLowerCase():"text";let h=Lve([r,i&&i.toAbortSignal()],l),v;const g=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let b;try{if(s&&Wve&&n!=="get"&&n!=="head"&&(b=await Gve(u,o))!==0){let C=new Request(t,{method:"POST",body:o,duplex:"half"}),O;if(Oe.isFormData(o)&&(O=C.headers.get("content-type"))&&u.setContentType(O),C.body){const[x,I]=y8(b,Sp(S8(s)));o=C8(C.body,x8,x,I)}}Oe.isString(d)||(d=d?"include":"omit");const y="credentials"in Request.prototype;v=new Request(t,{...f,signal:h,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:o,duplex:"half",credentials:y?d:void 0});let S=await fetch(v);const $=ob&&(c==="stream"||c==="response");if(ob&&(a||$&&g)){const C={};["status","statusText","headers"].forEach(T=>{C[T]=S[T]});const O=Oe.toFiniteNumber(S.headers.get("content-length")),[x,I]=a&&y8(O,Sp(S8(a),!0))||[];S=new Response(C8(S.body,x8,x,()=>{I&&I(),g&&g()}),C)}c=c||"text";let w=await $p[Oe.findKey($p,c)||"text"](S,e);return!$&&g&&g(),await new Promise((C,O)=>{Y_(C,O,{data:w,headers:fo.from(S.headers),status:S.status,statusText:S.statusText,config:e,request:v})})}catch(y){throw g&&g(),y&&y.name==="TypeError"&&/Load failed|fetch/i.test(y.message)?Object.assign(new mt("Network Error",mt.ERR_NETWORK,e,v),{cause:y.cause||y}):mt.from(y,y&&y.code,e,v)}}),rb={http:sve,xhr:Fve,fetch:Uve};Oe.forEach(rb,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const w8=e=>`- ${e}`,Xve=e=>Oe.isFunction(e)||e===null||e===!1,eM={getAdapter:e=>{e=Oe.isArray(e)?e:[e];const{length:t}=e;let n,o;const r={};for(let i=0;i`adapter ${a} `+(s===!1?"is not supported by the environment":"is not available in the build"));let l=t?i.length>1?`since : +`+i.map(w8).join(` +`):" "+w8(i[0]):"as no adapter specified";throw new mt("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:rb};function sm(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new xs(null,e)}function O8(e){return sm(e),e.headers=fo.from(e.headers),e.data=am.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),eM.getAdapter(e.adapter||Cu.adapter)(e).then(function(o){return sm(e),o.data=am.call(e,e.transformResponse,o),o.headers=fo.from(o.headers),o},function(o){return X_(o)||(sm(e),o&&o.response&&(o.response.data=am.call(e,e.transformResponse,o.response),o.response.headers=fo.from(o.response.headers))),Promise.reject(o)})}const tM="1.9.0",Sg={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Sg[e]=function(o){return typeof o===e||"a"+(t<1?"n ":" ")+e}});const P8={};Sg.transitional=function(t,n,o){function r(i,l){return"[Axios v"+tM+"] Transitional option '"+i+"'"+l+(o?". "+o:"")}return(i,l,a)=>{if(t===!1)throw new mt(r(l," has been removed"+(n?" in "+n:"")),mt.ERR_DEPRECATED);return n&&!P8[l]&&(P8[l]=!0,console.warn(r(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,l,a):!0}};Sg.spelling=function(t){return(n,o)=>(console.warn(`${o} is likely a misspelling of ${t}`),!0)};function Yve(e,t,n){if(typeof e!="object")throw new mt("options must be an object",mt.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let r=o.length;for(;r-- >0;){const i=o[r],l=t[i];if(l){const a=e[i],s=a===void 0||l(a,i,e);if(s!==!0)throw new mt("option "+i+" must be "+s,mt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new mt("Unknown option "+i,mt.ERR_BAD_OPTION)}}const df={assertOptions:Yve,validators:Sg},br=df.validators;let Rl=class{constructor(t){this.defaults=t||{},this.interceptors={request:new m8,response:new m8}}async request(t,n){try{return await this._request(t,n)}catch(o){if(o instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const i=r.stack?r.stack.replace(/^.+\n/,""):"";try{o.stack?i&&!String(o.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(o.stack+=` +`+i):o.stack=i}catch{}}throw o}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Vl(this.defaults,n);const{transitional:o,paramsSerializer:r,headers:i}=n;o!==void 0&&df.assertOptions(o,{silentJSONParsing:br.transitional(br.boolean),forcedJSONParsing:br.transitional(br.boolean),clarifyTimeoutError:br.transitional(br.boolean)},!1),r!=null&&(Oe.isFunction(r)?n.paramsSerializer={serialize:r}:df.assertOptions(r,{encode:br.function,serialize:br.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),df.assertOptions(n,{baseUrl:br.spelling("baseURL"),withXsrfToken:br.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&Oe.merge(i.common,i[n.method]);i&&Oe.forEach(["delete","get","head","post","put","patch","common"],v=>{delete i[v]}),n.headers=fo.concat(l,i);const a=[];let s=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(s=s&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,f;if(!s){const v=[O8.bind(this),void 0];for(v.unshift.apply(v,a),v.push.apply(v,c),f=v.length,u=Promise.resolve(n);d{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](r);o._listeners=null}),this.promise.then=r=>{let i;const l=new Promise(a=>{o.subscribe(a),i=a}).then(r);return l.cancel=function(){o.unsubscribe(i)},l},t(function(i,l,a){o.reason||(o.reason=new xs(i,l,a),n(o.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=o=>{t.abort(o)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new nM(function(r){t=r}),cancel:t}}};function Jve(e){return function(n){return e.apply(null,n)}}function Zve(e){return Oe.isObject(e)&&e.isAxiosError===!0}const ib={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};Object.entries(ib).forEach(([e,t])=>{ib[t]=e});function oM(e){const t=new Rl(e),n=R_(Rl.prototype.request,t);return Oe.extend(n,Rl.prototype,t,{allOwnKeys:!0}),Oe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return oM(Vl(e,r))},n}const Zt=oM(Cu);Zt.Axios=Rl;Zt.CanceledError=xs;Zt.CancelToken=qve;Zt.isCancel=X_;Zt.VERSION=tM;Zt.toFormData=bg;Zt.AxiosError=mt;Zt.Cancel=Zt.CanceledError;Zt.all=function(t){return Promise.all(t)};Zt.spread=Jve;Zt.isAxiosError=Zve;Zt.mergeConfig=Vl;Zt.AxiosHeaders=fo;Zt.formToJSON=e=>U_(Oe.isHTMLForm(e)?new FormData(e):e);Zt.getAdapter=eM.getAdapter;Zt.HttpStatusCode=ib;Zt.default=Zt;const{Axios:b0e,AxiosError:y0e,CanceledError:S0e,isCancel:$0e,CancelToken:C0e,VERSION:x0e,all:w0e,Cancel:O0e,isAxiosError:P0e,spread:I0e,toFormData:T0e,AxiosHeaders:E0e,HttpStatusCode:_0e,formToJSON:M0e,getAdapter:A0e,mergeConfig:R0e}=Zt,Ia="agent_admin_token",oa=Zt.create({baseURL:"/api/v1",timeout:15e4});oa.interceptors.request.use(e=>{const t=localStorage.getItem(Ia);return t&&(e.headers.Authorization=`Bearer ${t}`),e});function I8(){localStorage.removeItem(Ia),localStorage.removeItem("agent_admin_user");const e="/admin/";if(window.location.pathname.startsWith(e+"login"))return;const t=encodeURIComponent(window.location.pathname+window.location.search);window.location.href=`${e}login?redirect=${t}`}oa.interceptors.response.use(e=>{const t=e.data;if(typeof t!="object"||t===null)return t;const{code:n,message:o}=t;return n===void 0||n===200?t:n===401?(e.config.url||"").includes("/auth/login")?Promise.reject(new Error(o||"登录失败")):(I8(),Promise.reject(new Error(o||"会话失效"))):(e.config.silentError||Zn.error(o||`请求失败(${n})`),Promise.reject(new Error(o||`请求失败(${n})`)))},e=>{var t,n,o;return e.response&&e.response.status===401?I8():e.response&&e.response.data&&e.response.data.message?(t=e.config)!=null&&t.silentError||Zn.error(e.response.data.message):(n=e.config)!=null&&n.silentError||Zn.error((o=e.message)!=null&&o.includes("timeout")?"请求超时":"网络异常,服务可能不可达"),Promise.reject(e)});function xu(e={}){const{silent:t,...n}=e;return{silentError:!!t,...n}}const Xo=(e,t={},n={})=>oa.get(e,{params:t,...xu(n)}),Qi=(e,t={},n={})=>oa.post(e,t,xu(n)),D0e=(e,t={},n={})=>oa.put(e,t,xu(n)),B0e=(e,t={})=>oa.delete(e,xu(t)),N0e=(e,t,n={})=>oa.post(e,t,{headers:{"Content-Type":"multipart/form-data"},...xu(n)}),Qve=()=>Zt.get("/health",{timeout:5e3}),eme=(e,t)=>Xo("/agent/runs",e,t),tme=(e,t)=>Xo(`/agent/runs/${e}`,{},t),nme=e=>Xo("/agent/stats",{},e),k0e=(e,t)=>Xo("/agent/logs",e,t),F0e=e=>Xo("/agent/system",{},e),L0e=e=>Xo("/agent/config",{},e),z0e=e=>Qi("/agent/guard-test",{text:e}),H0e=e=>Qi("/agent/kb-test",e),j0e=e=>Qi("/agent/enhance",e),V0e=e=>Xo("/agent/history",e),W0e=e=>Xo(`/agent/history/${e}`),K0e=()=>Xo("/agent/history/scenes",{},{silent:!0});function rM(e){if(!e)return"-";const t=new Date(e*1e3),n=o=>String(o).padStart(2,"0");return`${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function ome(e){if(!e)return"-";const t=new Date(e*1e3),n=o=>String(o).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function iM(e){return e==null?"-":e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m${Math.round(e%6e4/1e3)}s`}function G0e(e){if(!e)return"-";const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return t>0?`${t}d${n}h`:n>0?`${n}h${o}m`:`${o}m${e%60}s`}function U0e(e){return e==null?"var(--text-2)":e<5e3?"var(--ok)":e<2e4?"var(--warn)":"var(--err)"}const rme={medical_record:"病历生成",prescription:"处方生成",prescription_validate:"处方校验",knowledge_qa:"知识问答","emr-generator":"病历(Go)","knowledge-qa":"问答(Go)"},X0e=[{label:"病历生成",value:"medical_record"},{label:"处方生成",value:"prescription"},{label:"处方校验",value:"prescription_validate"},{label:"知识问答",value:"knowledge_qa"}];function lM(e){return rme[e]||e||"-"}const ime={1:{label:"成功",color:"success"},2:{label:"失败",color:"error"},3:{label:"拦截",color:"warning"}},lme={0:{label:"进行中",color:"processing"},1:{label:"成功",color:"success"},2:{label:"失败",color:"error"}},T8={spark:{in:.001,out:.001},deepseek:{in:.001,out:.002},qwen:{in:8e-4,out:.002},openai:{in:.018,out:.072},ollama:{in:0,out:0},default:{in:.002,out:.004}};function ame(e,t=0,n=0){const o=T8[e]||T8.default;return t/1e3*o.in+n/1e3*o.out}function sme(e){return e==null||isNaN(e)?"-":e===0?"¥0":e<.01?`¥${e.toFixed(4)}`:`¥${e.toFixed(2)}`}const cme={plan:"计划",kb_retrieval:"知识检索",llm_call:"LLM 调用",tool_call:"工具调用",reflection:"反思审核",medical_guard:"医疗守卫",json_repair:"JSON 修复"};function ume(e){return cme[e]||e}function dme(e,t){const n=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=t,r.click(),URL.revokeObjectURL(o)}async function aM(e){try{return await navigator.clipboard.writeText(e),!0}catch{const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}}const fme={__name:"StatusTag",props:{status:{type:Number,required:!0},kind:{type:String,default:"run"}},setup(e){const t=e,n=P(()=>(t.kind==="gen"?lme:ime)[t.status]||{label:`状态${t.status}`,color:"default"});return(o,r)=>{const i=Ot("a-tag");return bt(),dn(i,{color:n.value.color,bordered:!0},{default:nt(()=>[Pt(Tt(n.value.label),1)]),_:1},8,["color"])}}},pme={key:0,class:"text-center py-6 text-xs",style:{color:"var(--text-3)"}},hme={key:1,class:"relative pl-5"},gme={class:"flex items-center gap-2 flex-wrap"},vme={key:0,class:"text-xs mono",style:{color:"var(--text-2)"}},mme={class:"text-xs mono",style:{color:"var(--text-3)"}},bme={key:1,class:"text-xs mono",style:{color:"var(--text-3)"}},yme={key:3,class:"text-xs",style:{color:"var(--text-3)"}},Sme=["onClick"],$me={key:0,class:"text-xs",style:{color:"var(--primary)"}},Cme={__name:"StepTimeline",props:{steps:{type:Array,default:()=>[]}},setup(e){const t=ne(new Set);function n(i){const l=new Set(t.value);l.has(i)?l.delete(i):l.add(i),t.value=l}const o={plan:"var(--run)",kb_retrieval:"var(--accent)",llm_call:"var(--primary)",tool_call:"#a855f7",reflection:"var(--ok)",medical_guard:"var(--warn)"};function r(i){return i.status===2?"var(--err)":i.status===0?"var(--run)":o[i.step_type]||"var(--text-3)"}return(i,l)=>{const a=Ot("a-tag");return e.steps.length?(bt(),nn("div",hme,[l[1]||(l[1]=Ct("div",{class:"absolute left-[5px] top-1 bottom-1 w-px",style:{background:"var(--glass-border)"}},null,-1)),(bt(!0),nn(Le,null,xb(e.steps,(s,c)=>(bt(),nn("div",{key:c,class:"relative mb-3 last:mb-0"},[Ct("span",{class:"absolute -left-5 top-1 w-[11px] h-[11px] rounded-full border-2",style:Bi({background:r(s),borderColor:"var(--bg-base)"})},null,4),Ct("div",gme,[Ct("span",{class:"text-xs font-medium",style:Bi({color:r(s)})},[Pt(Tt(je(ume)(s.step_type)),1),s.tool_name?(bt(),nn(Le,{key:0},[Pt("·"+Tt(s.tool_name),1)],64)):$n("",!0)],4),s.provider?(bt(),nn("span",vme,Tt(s.provider)+"/"+Tt(s.model),1)):$n("",!0),Ct("span",mme,Tt(je(iM)(s.duration_ms)),1),s.total_tokens?(bt(),nn("span",bme,Tt(s.total_tokens)+" tok",1)):$n("",!0),s.status===2?(bt(),dn(a,{key:2,color:"error",size:"small"},{default:nt(()=>l[0]||(l[0]=[Pt("失败")])),_:1})):$n("",!0),s.started_at?(bt(),nn("span",yme,Tt(je(rM)(s.started_at)),1)):$n("",!0)]),s.detail?(bt(),nn("div",{key:0,class:"text-xs mt-1 rounded px-2 py-1 cursor-pointer",style:{color:"var(--text-2)",background:"rgba(0,0,0,0.15)",border:"1px solid var(--glass-border)"},onClick:u=>n(c)},[Ct("span",{class:Uc(t.value.has(c)?"":"line-clamp-2"),style:Bi([{"white-space":"pre-wrap","word-break":"break-all",display:"block"},t.value.has(c)?"":"display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden"])},Tt(s.detail),7),s.detail.length>80?(bt(),nn("span",$me,Tt(t.value.has(c)?"收起":"展开"),1)):$n("",!0)],8,Sme)):$n("",!0)]))),128))])):(bt(),nn("div",pme,"无步骤记录"))}}},xme={class:"relative group"},E8={__name:"JsonViewer",props:{value:{type:[Object,Array,String,Number,Boolean],default:null},maxHeight:{type:String,default:"360px"}},setup(e){const t=e,n=P(()=>{if(t.value==null)return"";if(typeof t.value=="string")try{return JSON.stringify(JSON.parse(t.value),null,2)}catch{return t.value}try{return JSON.stringify(t.value,null,2)}catch{return String(t.value)}}),o=ne(!1);async function r(){await aM(n.value)&&(o.value=!0,Zn.success("已复制"),setTimeout(()=>o.value=!1,1500))}return(i,l)=>{const a=Ot("a-button");return bt(),nn("div",xme,[p(a,{size:"small",class:"!absolute right-2 top-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity",onClick:r},{icon:nt(()=>[o.value?(bt(),dn(je(Zl),{key:0})):(bt(),dn(je(bu),{key:1}))]),_:1}),Ct("pre",{class:"mono text-xs p-3 m-0 rounded-lg overflow-auto",style:Bi({maxHeight:e.maxHeight,background:"rgba(0,0,0,0.25)",border:"1px solid var(--glass-border)",color:"var(--text-2)"})},Tt(n.value||"(空)"),5)])}}},wme={class:"flex items-center gap-2 mb-4 flex-wrap"},Ome={class:"mono text-xs",style:{color:"var(--text-2)"}},Pme={class:"mono"},Ime={class:"mono"},Tme={class:"mono"},Eme={style:{color:"var(--err)"}},_me={class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},Mme={class:"glass p-3 mb-4"},Ame={class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},Rme={class:"flex gap-2 justify-end"},Dme={__name:"RunDetailDrawer",setup(e){const t=dg(),n=jS(),o=ne(!1),r=ne(null),i=P(()=>{var f;if(!((f=r.value)!=null&&f.request_snapshot))return null;try{return JSON.parse(r.value.request_snapshot)}catch{return null}}),l=P(()=>{var f;return(((f=r.value)==null?void 0:f.steps)||[]).some(h=>h.step_type==="kb_retrieval")}),a=P(()=>r.value?ame(r.value.provider,r.value.prompt_tokens,r.value.completion_tokens):0);ye(()=>[t.runDrawerOpen,t.runDrawerId],async([f,h])=>{if(!(!f||!h)){o.value=!0,r.value=null;try{const v=await tme(h,{silent:!0});r.value=v.data}catch(v){Zn.warning(v.message||"记录不存在(可能已被环形缓冲覆盖或服务重启)"),t.closeRun()}finally{o.value=!1}}});async function s(){await aM(JSON.stringify(r.value,null,2))&&Zn.success("已复制完整 JSON")}function c(){dme(r.value,`agent-run-${r.value.id}.json`)}function u(){if(!i.value){Zn.warning("该运行没有请求快照(旧版本记录),无法重放");return}t.setReplay({fromRunId:r.value.id,...i.value}),t.closeRun(),n.push("/debug")}function d(){var h;const f=((h=i.value)==null?void 0:h.context)||"";t.closeRun(),n.push({path:"/kb-search",query:f?{q:f}:{}})}return(f,h)=>{const v=Ot("a-skeleton"),g=Ot("a-tag"),b=Ot("a-descriptions-item"),y=Ot("a-descriptions"),S=Ot("a-button"),$=Ot("a-tooltip"),w=Ot("a-drawer");return bt(),dn(w,{open:je(t).runDrawerOpen,width:720,title:`运行详情 #${je(t).runDrawerId}`,placement:"right",onClose:h[0]||(h[0]=C=>je(t).closeRun())},{footer:nt(()=>[Ct("div",Rme,[l.value?(bt(),dn(S,{key:0,onClick:d},{icon:nt(()=>[p(je(Ar))]),default:nt(()=>[h[4]||(h[4]=Pt("检索复现"))]),_:1})):$n("",!0),p(S,{onClick:s},{icon:nt(()=>[p(je(bu))]),default:nt(()=>[h[5]||(h[5]=Pt("复制"))]),_:1}),p(S,{onClick:c},{icon:nt(()=>[p(je(Jh))]),default:nt(()=>[h[6]||(h[6]=Pt("导出"))]),_:1}),p($,{title:i.value?"把入参回填到 Enhance 调试台重跑":"该记录无请求快照"},{default:nt(()=>[p(S,{type:"primary",disabled:!i.value,onClick:u},{icon:nt(()=>[p(je(BS))]),default:nt(()=>[h[7]||(h[7]=Pt("重放 "))]),_:1},8,["disabled"])]),_:1},8,["title"])])]),default:nt(()=>[o.value?(bt(),dn(v,{key:0,active:"",paragraph:{rows:8}})):r.value?(bt(),nn(Le,{key:1},[Ct("div",wme,[p(fme,{status:r.value.status},null,8,["status"]),p(g,{color:"gold"},{default:nt(()=>[Pt(Tt(je(lM)(r.value.scene)),1)]),_:1}),Ct("span",Ome,Tt(r.value.provider)+"/"+Tt(r.value.model),1),r.value.cfg_source?(bt(),dn(g,{key:0,bordered:!1},{default:nt(()=>[Pt(Tt(r.value.cfg_source),1)]),_:1})):$n("",!0)]),p(y,{column:2,size:"small",bordered:"",class:"mb-4"},{default:nt(()=>[p(b,{label:"开始时间"},{default:nt(()=>[Pt(Tt(je(ome)(r.value.started_at)),1)]),_:1}),p(b,{label:"总耗时"},{default:nt(()=>[Ct("span",Pme,Tt(je(iM)(r.value.total_ms)),1)]),_:1}),p(b,{label:"tokens"},{default:nt(()=>[Ct("span",Ime,Tt(r.value.prompt_tokens)+" + "+Tt(r.value.completion_tokens)+" = "+Tt(r.value.total_tokens),1)]),_:1}),p(b,{label:"估算成本"},{default:nt(()=>[Ct("span",Tme,Tt(je(sme)(a.value)),1)]),_:1}),r.value.error?(bt(),dn(b,{key:0,label:"失败原因",span:2},{default:nt(()=>[Ct("span",Eme,Tt(r.value.error),1)]),_:1})):$n("",!0)]),_:1}),Ct("h4",_me,"步骤时间线("+Tt((r.value.steps||[]).length)+" 步)",1),Ct("div",Mme,[p(Cme,{steps:r.value.steps||[]},null,8,["steps"])]),i.value?(bt(),nn(Le,{key:0},[Ct("h4",Ame,[h[2]||(h[2]=Pt(" 请求快照 ")),i.value.truncated?(bt(),dn(g,{key:0,color:"warning",class:"ml-1"},{default:nt(()=>h[1]||(h[1]=[Pt("已截断")])),_:1})):$n("",!0)]),p(E8,{value:i.value,"max-height":"240px",class:"mb-4"},null,8,["value"])],64)):$n("",!0),h[3]||(h[3]=Ct("h4",{class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},"原始 JSON",-1)),p(E8,{value:r.value,"max-height":"260px"},null,8,["value"])],64)):$n("",!0)]),_:1},8,["open","title"])}}},Bme=e=>Qi("/auth/login",e),Nme=()=>Qi("/auth/refresh"),kme=()=>Xo("/auth/profile",{},{silent:!0}),cm="agent_admin_user",cd="agent_admin_expire",GS=dO("user",()=>{const e=ne(localStorage.getItem(Ia)||""),t=ne(r(localStorage.getItem(cm))),n=ne(Number(localStorage.getItem(cd)||0)),o=P(()=>!!e.value);function r(c){try{return c?JSON.parse(c):null}catch{return null}}async function i({username:c,password:u,captcha:d}){const h=(await Bme({username:c,password:u,captcha:d})).data;return e.value=h.token,t.value={nick_name:h.nick_name,role_name:h.role_name,role:h.role},n.value=h.expire_at||0,localStorage.setItem(Ia,h.token),localStorage.setItem(cm,JSON.stringify(t.value)),localStorage.setItem(cd,String(n.value)),cr.success({message:"登录成功",description:`欢迎回来,${h.nick_name}`}),h}async function l(){if(!e.value)return!1;try{const c=await kme();return t.value={...t.value,...c.data},!0}catch{return!1}}async function a(){if(!e.value||!n.value)return;const c=n.value-Math.floor(Date.now()/1e3);if(!(c>24*3600||c<=0))try{const u=await Nme();e.value=u.data.token,n.value=u.data.expire_at||0,localStorage.setItem(Ia,e.value),localStorage.setItem(cd,String(n.value))}catch{}}function s(){e.value="",t.value=null,n.value=0,localStorage.removeItem(Ia),localStorage.removeItem(cm),localStorage.removeItem(cd)}return{token:e,user:t,expireAt:n,isAuthenticated:o,login:i,logout:s,checkSession:l,maybeRefresh:a}}),Y0e=e=>Xo("/models/routes",{},e),q0e=e=>Qi("/models/route",e),J0e=e=>Qi("/models/test",e),Fme=()=>Qi("/models/invalidate-cache"),Z0e=e=>Xo("/models/active-config",{},e),Lme={class:"max-h-[46vh] overflow-auto"},zme=["onMouseenter","onClick"],Hme={class:"text-sm",style:{color:"var(--text-1)"}},jme={key:0,class:"ml-auto text-xs mono",style:{color:"var(--text-3)"}},Vme={key:0,class:"text-center py-6 text-xs",style:{color:"var(--text-3)"}},Wme={__name:"CommandPalette",setup(e){const t=dg(),n=GS(),o=jS(),r=ne(""),i=ne(0),l=ne(null),a=[{icon:og,label:"仪表盘",keywords:"dashboard yibiao",to:"/dashboard"},{icon:ug,label:"运行记录",keywords:"runs yunxing",to:"/runs"},{icon:lg,label:"历史记录",keywords:"history lishi db",to:"/history"},{icon:Qh,label:"统计分析",keywords:"stats tongji",to:"/stats"},{icon:vs,label:"实时日志",keywords:"logs rizhi",to:"/logs"},{icon:ig,label:"系统状态",keywords:"system xitong",to:"/system"},{icon:eg,label:"调试工具",keywords:"debug tiaoshi enhance",to:"/debug"},{icon:Zh,label:"模型管理",keywords:"models moxing route",to:"/models"},{icon:sg,label:"配置总览",keywords:"config peizhi",to:"/config"},{icon:rg,label:"知识库管理",keywords:"kb zhishiku import",to:"/kb"},{icon:Ar,label:"知识库检索",keywords:"search jiansuo",to:"/kb-search"},{icon:ng,label:"药品抓取",keywords:"crawl yaopin zhuaqu spider",to:"/kb-crawl"}],s=[{icon:cg,label:"动作:失效 LLM 配置缓存",keywords:"invalidate cache huancun shixiao",run:async()=>{const f=await Fme();Zn.success(f.message||"缓存已失效")}},{icon:tg,label:"动作:切换亮/暗主题",keywords:"theme zhuti dark light",run:()=>t.toggleTheme()},{icon:pu,label:"动作:重新播放新手引导",keywords:"tour yindao help",run:()=>{o.push("/dashboard"),setTimeout(()=>t.startTour(),400)}},{icon:ag,label:"动作:退出登录",keywords:"logout tuichu",run:()=>rn.confirm({title:"确定退出登录?",onOk:()=>{n.logout(),o.push("/login")}})}],c=P(()=>{const f=r.value.trim().toLowerCase(),h=[];/^\d+$/.test(f)&&h.push({icon:DS,label:`打开运行详情 #${f}`,run:()=>t.openRun(Number(f))});const v=[...a,...s];return f?[...h,...v.filter(g=>g.label.toLowerCase().includes(f)||(g.keywords||"").includes(f))]:[...h,...v]});ye(()=>t.paletteOpen,async f=>{var h;f&&(r.value="",i.value=0,await rt(),(h=l.value)==null||h.focus())}),ye(r,()=>{i.value=0});function u(f){t.paletteOpen=!1,f.to?o.push(f.to):f.run&&f.run()}function d(f){if(f.key==="ArrowDown")f.preventDefault(),i.value=Math.min(i.value+1,c.value.length-1);else if(f.key==="ArrowUp")f.preventDefault(),i.value=Math.max(i.value-1,0);else if(f.key==="Enter"){const h=c.value[i.value];h&&u(h)}else f.key==="Escape"&&(t.paletteOpen=!1)}return(f,h)=>{const v=Ot("a-tag"),g=Ot("a-input"),b=Ot("a-divider"),y=Ot("a-modal");return bt(),dn(y,{open:je(t).paletteOpen,footer:null,closable:!1,width:560,style:{top:"12vh"},onCancel:h[1]||(h[1]=S=>je(t).paletteOpen=!1)},{default:nt(()=>[p(g,{ref_key:"inputRef",ref:l,value:r.value,"onUpdate:value":h[0]||(h[0]=S=>r.value=S),size:"large",placeholder:"搜索页面 / 动作 / 输入运行 ID…",bordered:!1,onKeydown:d},{prefix:nt(()=>[p(je(Ar),{style:{color:"var(--text-3)"}})]),suffix:nt(()=>[p(v,{bordered:!1,class:"mono"},{default:nt(()=>h[2]||(h[2]=[Pt("Esc")])),_:1})]),_:1},8,["value"]),p(b,{class:"!my-2"}),Ct("div",Lme,[(bt(!0),nn(Le,null,xb(c.value,(S,$)=>(bt(),nn("div",{key:S.label,class:"flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer transition-colors",style:Bi($===i.value?"background: rgba(245,158,11,0.12)":""),onMouseenter:w=>i.value=$,onClick:w=>u(S)},[(bt(),dn(bA(S.icon),{style:{color:"var(--primary)"}})),Ct("span",Hme,Tt(S.label),1),$===i.value?(bt(),nn("span",jme,"Enter")):$n("",!0)],44,zme))),128)),c.value.length?$n("",!0):(bt(),nn("div",Vme,"无匹配项"))])]),_:1},8,["open"])}}},Kme={__name:"App",setup(e){const t=dg(),n=P(()=>{const o=t.theme==="dark";return{algorithm:o?X3.darkAlgorithm:X3.defaultAlgorithm,token:{colorPrimary:o?"#f59e0b":"#4361ee",colorInfo:o?"#f59e0b":"#4361ee",colorSuccess:"#22c55e",colorError:"#ef4444",colorWarning:"#f59e0b",borderRadius:8,colorBgContainer:o?"rgba(43,32,19,0.55)":"rgba(255,255,255,0.8)",colorBgElevated:o?"#2b2013":"#ffffff",colorBgLayout:"transparent",colorBorder:o?"rgba(245,158,11,0.18)":"rgba(67,97,238,0.16)",colorBorderSecondary:o?"rgba(245,158,11,0.10)":"rgba(67,97,238,0.08)",colorText:o?"#f3e9d6":"#1e2433",colorTextSecondary:o?"#bfae8d":"#5a6478",colorTextTertiary:o?"#8d7c60":"#98a1b3",fontSize:13},components:{Table:{cellPaddingBlockSM:6},Card:{paddingLG:16}}}});return(o,r)=>{const i=Ot("router-view"),l=Ot("a-config-provider");return bt(),dn(l,{theme:n.value,locale:je(bhe)},{default:nt(()=>[p(i),p(Dme),p(Wme)]),_:1},8,["theme","locale"])}}},Gme="modulepreload",Ume=function(e){return"/admin/"+e},_8={},yo=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),s=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=l(n.map(c=>{if(c=Ume(c),c in _8)return;_8[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Gme,u||(f.as="script"),f.crossOrigin="",f.href=c,s&&f.setAttribute("nonce",s),document.head.appendChild(f),u)return new Promise((h,v)=>{f.addEventListener("load",h),f.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(l){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=l,window.dispatchEvent(a),!a.defaultPrevented)throw l}return r.then(l=>{for(const a of l||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};function ud(e,t,{immediate:n=!0,enabled:o=!0}={}){let r=null;const i=ne(!1);let l=!o;async function a(){try{await e()}catch{}}function s(){r||l||(i.value=!0,r=setInterval(()=>{document.visibilityState!=="hidden"&&a()},t))}function c(){r&&(clearInterval(r),r=null),i.value=!1}function u(){l=!0,c()}function d({runNow:f=!0}={}){l=!1,f&&a(),s()}return Ke(()=>{n&&!l&&a(),s()}),wn(c),{pause:u,resume:d,running:i,tick:a}}const Xme=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},Yme={class:"flex items-center gap-2 px-4 h-14",style:{"border-bottom":"1px solid var(--glass-border)"}},qme={key:0,class:"font-semibold text-sm whitespace-nowrap",style:{color:"var(--primary)"}},Jme={class:"w-72"},Zme={class:"flex items-center justify-between mb-2"},Qme={key:0,class:"text-xs text-center py-4",style:{color:"var(--text-3)"}},e0e=["onClick"],t0e={class:"mono",style:{color:"var(--text-3)"}},n0e={class:"ml-auto",style:{color:"var(--text-3)"}},o0e={class:"flex items-center gap-2 cursor-pointer px-2"},r0e={class:"text-sm",style:{color:"var(--text-1)"}},i0e={class:"text-xs"},M8="agent_admin_sider_collapsed",A8="agent_admin_tour_done",l0e={__name:"AdminLayout",setup(e){const t=dg(),n=GS(),o=Cge(),r=jS(),i=ne(localStorage.getItem(M8)==="1");function l(){i.value=!i.value,localStorage.setItem(M8,i.value?"1":"0")}const a=[{type:"group",label:"监控",children:[{key:"/dashboard",icon:()=>tn(og),label:"仪表盘"},{key:"/runs",icon:()=>tn(ug),label:"运行记录"},{key:"/history",icon:()=>tn(lg),label:"历史记录"},{key:"/stats",icon:()=>tn(Qh),label:"统计分析"},{key:"/logs",icon:()=>tn(vs),label:"实时日志"},{key:"/system",icon:()=>tn(ig),label:"系统状态"}]},{type:"group",label:"AI 管理",children:[{key:"/debug",icon:()=>tn(eg),label:"调试工具"},{key:"/models",icon:()=>tn(Zh),label:"模型管理"},{key:"/config",icon:()=>tn(sg),label:"配置总览"}]},{type:"group",label:"知识库",children:[{key:"/kb",icon:()=>tn(rg),label:"知识库管理"},{key:"/kb-search",icon:()=>tn(Ar),label:"知识库检索"},{key:"/kb-crawl",icon:()=>tn(ng),label:"药品抓取"}]}],s=P(()=>["/"+o.path.split("/")[1]]);function c({key:A}){r.push(A)}let u=0;ud(async()=>{try{await Qve(),u=0,t.offline&&(t.offline=!1,cr.success({message:"服务已恢复",description:"Agent 服务重新可达"}))}catch{u++,u>=2&&!t.offline&&(t.offline=!0,t.offlineSince=Date.now())}},1e4);const d=ne(!1),f=ne([]);ud(async()=>{try{const A=await nme({silent:!0}),R=A.data.failed+A.data.blocked;if(t.lastFailedTotal>=0&&R>t.lastFailedTotal){const z=R-t.lastFailedTotal;t.alarmCount+=z,t.notifyEnabled&&(cr.warning({message:`新增 ${z} 条失败/拦截运行`,description:A.data.last_error?A.data.last_error.slice(0,80):"",onClick:()=>r.push("/runs?status=2")}),"Notification"in window&&Notification.permission==="granted"&&new Notification("TCM Agent 告警",{body:`新增 ${z} 条失败运行`}))}t.lastFailedTotal=R}catch{}},15e3);async function h(){d.value=!0,t.clearAlarm();try{const A=await eme({limit:50},{silent:!0});f.value=(A.data||[]).filter(R=>R.status>=2).slice(0,8)}catch{f.value=[]}}function v(){t.toggleNotify(),t.notifyEnabled&&"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()}ud(()=>n.maybeRefresh(),6e5,{immediate:!0});function g(A){(A.ctrlKey||A.metaKey)&&A.key.toLowerCase()==="k"&&(A.preventDefault(),t.paletteOpen=!t.paletteOpen)}Ke(()=>window.addEventListener("keydown",g)),wn(()=>window.removeEventListener("keydown",g));const b=ne(null),y=ne(null),S=ne(null),$=ne(null),w=ne(null),C=ne(null);function O(A){const R=(A==null?void 0:A.$el)??A;return R instanceof HTMLElement?R:null}const x=[{title:"侧边菜单",description:"功能按「监控 / AI 管理 / 知识库」三组划分:看运行去监控,调模型去 AI 管理,管语料去知识库。",target:()=>O(b.value)},{title:"服务健康点",description:"绿点=Go 服务在线,红点=不可达(会弹出全局横幅并自动重连)。",target:()=>O(y.value)},{title:"失败告警",description:"出现新的失败/拦截运行时这里会亮红点,可开关浏览器通知;点开可直达失败详情。",target:()=>O(S.value)},{title:"命令面板",description:"按 Ctrl+K 随时唤起:搜页面、执行快捷动作、输入运行 ID 直达详情。",target:()=>O($.value)},{title:"主题切换",description:"暗色暖调是默认主题,也可以切到亮色,偏好会记住。",target:()=>O(w.value)},{title:"随时回看引导",description:"点这里可以重新播放本引导。先去「调试工具」发一条测试请求,再回仪表盘看数据流动起来!",target:()=>O(C.value)}];function I(){t.tourOpen=!1,localStorage.setItem(A8,"1")}Ke(()=>{localStorage.getItem(A8)!=="1"&&setTimeout(()=>t.startTour(),800)});function T(){rn.confirm({title:"确定退出登录?",onOk:()=>{n.logout(),r.push("/login")}})}const M=ne(Date.now());ud(()=>{M.value=Date.now()},1e3);const E=P(()=>10-Math.floor((M.value-t.offlineSince)/1e3)%10);return(A,R)=>{const z=Ot("a-menu"),_=Ot("a-layout-sider"),D=Ot("a-button"),N=Ot("a-breadcrumb-item"),k=Ot("a-breadcrumb"),F=Ot("a-tooltip"),L=Ot("a-switch"),H=Ot("a-badge"),j=Ot("a-popover"),Y=Ot("a-avatar"),Z=Ot("a-menu-item"),X=Ot("a-menu-divider"),ee=Ot("a-dropdown"),U=Ot("a-layout-header"),Q=Ot("a-alert"),J=Ot("router-view"),G=Ot("a-layout-content"),q=Ot("a-layout"),V=Ot("a-tour");return bt(),dn(q,{class:"min-h-screen",style:{background:"transparent"}},{default:nt(()=>[p(_,{ref_key:"refSider",ref:b,collapsed:i.value,"onUpdate:collapsed":R[0]||(R[0]=W=>i.value=W),trigger:null,collapsible:"",width:224,"collapsed-width":64,class:"!sticky top-0 h-screen glass-strong !rounded-none border-r",style:{"border-color":"var(--glass-border)","z-index":"20"}},{default:nt(()=>[Ct("div",Yme,[R[7]||(R[7]=Ct("span",{class:"text-xl"},"🌿",-1)),i.value?$n("",!0):(bt(),nn("span",qme,"TCM Agent 控制台"))]),p(z,{"selected-keys":s.value,mode:"inline",items:a,style:{background:"transparent","border-inline-end":"none"},onClick:c},null,8,["selected-keys"])]),_:1},8,["collapsed"]),p(q,{style:{background:"transparent"}},{default:nt(()=>[p(U,{class:"!px-4 !h-14 flex items-center gap-3 sticky top-0 glass-strong !rounded-none",style:{"z-index":"19","line-height":"normal","border-bottom":"1px solid var(--glass-border)",background:"var(--glass-bg-strong)"}},{default:nt(()=>[p(D,{type:"text",onClick:l},{default:nt(()=>[i.value?(bt(),dn(je(RS),{key:0})):(bt(),dn(je(AS),{key:1}))]),_:1}),p(k,null,{default:nt(()=>[p(N,null,{default:nt(()=>[Pt(Tt(je(o).meta.group||"TCM Agent"),1)]),_:1}),p(N,null,{default:nt(()=>[Pt(Tt(je(o).meta.title),1)]),_:1})]),_:1}),R[11]||(R[11]=Ct("div",{class:"flex-1"},null,-1)),p(F,{title:je(t).offline?"服务不可达":"服务在线(10s 轮询 /health)"},{default:nt(()=>[Ct("span",{ref_key:"refHealth",ref:y,class:"flex items-center gap-1.5 text-xs",style:{color:"var(--text-2)"}},[Ct("span",{class:Uc(["health-dot",{down:je(t).offline}])},null,2),Pt(" "+Tt(je(t).offline?"离线":"在线"),1)],512)]),_:1},8,["title"]),p(j,{open:d.value,"onUpdate:open":R[2]||(R[2]=W=>d.value=W),trigger:"click",placement:"bottomRight",onOpenChange:R[3]||(R[3]=W=>W&&h())},{content:nt(()=>[Ct("div",Jme,[Ct("div",Zme,[R[8]||(R[8]=Ct("span",{class:"text-sm font-medium"},"最近失败运行",-1)),p(L,{checked:je(t).notifyEnabled,size:"small","checked-children":"通知开","un-checked-children":"通知关",onClick:v},null,8,["checked"])]),f.value.length?$n("",!0):(bt(),nn("div",Qme,"暂无失败记录")),(bt(!0),nn(Le,null,xb(f.value,W=>(bt(),nn("div",{key:W.id,class:"py-1.5 px-2 rounded cursor-pointer text-xs glass-hover flex items-center gap-2",onClick:te=>{d.value=!1,je(t).openRun(W.id)}},[Ct("span",t0e,"#"+Tt(W.id),1),Ct("span",null,Tt(je(lM)(W.scene)),1),Ct("span",n0e,Tt(je(rM)(W.started_at)),1)],8,e0e))),128)),p(D,{block:"",size:"small",class:"mt-2",onClick:R[1]||(R[1]=W=>{d.value=!1,je(r).push("/runs?status=2")})},{default:nt(()=>R[9]||(R[9]=[Pt("查看全部失败")])),_:1})])]),default:nt(()=>[p(H,{ref_key:"refBell",ref:S,count:je(t).alarmCount,offset:[-2,4],size:"small"},{default:nt(()=>[p(D,{type:"text"},{default:nt(()=>[p(je(MS))]),_:1})]),_:1},8,["count"])]),_:1},8,["open"]),p(F,{title:"命令面板(Ctrl+K)"},{default:nt(()=>[p(D,{ref_key:"refPalette",ref:$,type:"text",onClick:R[4]||(R[4]=W=>je(t).paletteOpen=!0)},{default:nt(()=>[p(je(cg))]),_:1},512)]),_:1}),p(F,{title:je(t).theme==="dark"?"切换到亮色":"切换到暗色"},{default:nt(()=>[p(D,{ref_key:"refTheme",ref:w,type:"text",onClick:R[5]||(R[5]=W=>je(t).toggleTheme())},{default:nt(()=>[p(je(tg))]),_:1},512)]),_:1},8,["title"]),p(F,{title:"重播新手引导"},{default:nt(()=>[p(D,{ref_key:"refHelp",ref:C,type:"text",onClick:R[6]||(R[6]=W=>je(t).startTour())},{default:nt(()=>[p(je(pu))]),_:1},512)]),_:1}),p(ee,null,{overlay:nt(()=>[p(z,null,{default:nt(()=>[p(Z,{disabled:""},{default:nt(()=>{var W;return[Ct("span",i0e,Tt(((W=je(n).user)==null?void 0:W.role_name)||"面板管理员"),1)]}),_:1}),p(X),p(Z,{onClick:T},{default:nt(()=>[p(je(ag)),R[10]||(R[10]=Pt(" 退出登录"))]),_:1})]),_:1})]),default:nt(()=>{var W;return[Ct("span",o0e,[p(Y,{size:"small",style:{background:"var(--primary)"}},{icon:nt(()=>[p(je(kS))]),_:1}),Ct("span",r0e,Tt(((W=je(n).user)==null?void 0:W.nick_name)||"管理员"),1)])]}),_:1})]),_:1}),je(t).offline?(bt(),dn(Q,{key:0,banner:"",type:"error",class:"!rounded-none",message:`Agent 服务不可达 —— 正在自动重连(${E.value}s 后重试),服务恢复后本横幅自动消失`},null,8,["message"])):$n("",!0),p(G,{class:"p-5"},{default:nt(()=>[p(J)]),_:1})]),_:1}),p(V,{open:je(t).tourOpen,steps:x,onClose:I,onFinish:I},null,8,["open"])]),_:1})}}},a0e=Xme(l0e,[["__scopeId","data-v-3893b830"]]),s0e=[{path:"/login",name:"Login",component:()=>yo(()=>import("./index-D_jM3jWS.js"),__vite__mapDeps([0,1])),meta:{title:"登录"}},{path:"/",component:a0e,redirect:"/dashboard",meta:{requiresAuth:!0},children:[{path:"dashboard",name:"Dashboard",component:()=>yo(()=>import("./index-CEBsoH6M.js"),__vite__mapDeps([2,3,4,5,6,7,8])),meta:{title:"仪表盘",group:"监控"}},{path:"runs",name:"Runs",component:()=>yo(()=>import("./index-BpsYeRRg.js"),__vite__mapDeps([9,3,5,6])),meta:{title:"运行记录",group:"监控"}},{path:"history",name:"History",component:()=>yo(()=>import("./index-_NPq9xvG.js"),__vite__mapDeps([10,3,5,6,11])),meta:{title:"历史记录",group:"监控"}},{path:"stats",name:"Stats",component:()=>yo(()=>import("./index-BJrl7dSL.js"),__vite__mapDeps([12,3,4,13,6])),meta:{title:"统计分析",group:"监控"}},{path:"logs",name:"Logs",component:()=>yo(()=>import("./index-DTdNJDlS.js"),__vite__mapDeps([14,3,15])),meta:{title:"实时日志",group:"监控"}},{path:"system",name:"System",component:()=>yo(()=>import("./index-CZFMEA6j.js"),__vite__mapDeps([16,3,13,7,8])),meta:{title:"系统状态",group:"监控"}},{path:"debug",name:"Debug",component:()=>yo(()=>import("./index-CIfwmCYV.js"),__vite__mapDeps([17,3,11,1,18])),meta:{title:"调试工具",group:"AI 管理"}},{path:"models",name:"Models",component:()=>yo(()=>import("./index-Cu6gPumw.js"),__vite__mapDeps([19,3,13,11,15])),meta:{title:"模型管理",group:"AI 管理"}},{path:"config",name:"Config",component:()=>yo(()=>import("./index-hxBpkaUb.js"),__vite__mapDeps([20,3,7,15])),meta:{title:"配置总览",group:"AI 管理"}},{path:"kb",name:"Kb",component:()=>yo(()=>import("./index-DTh94Lw7.js"),__vite__mapDeps([21,22,3,11,6])),meta:{title:"知识库管理",group:"知识库"}},{path:"kb-search",name:"KbSearch",component:()=>yo(()=>import("./index-9-ZULY9z.js"),__vite__mapDeps([23,22,3,11,6,24])),meta:{title:"知识库检索",group:"知识库"}},{path:"kb-crawl",name:"KbCrawl",component:()=>yo(()=>import("./index-Din2I8-x.js"),__vite__mapDeps([25,22,3,11,6])),meta:{title:"药品抓取",group:"知识库"}}]},{path:"/:pathMatch(.*)*",redirect:"/dashboard"}],US=Sge({history:Yhe("/admin/"),routes:s0e,scrollBehavior(e,t,n){return n||{top:0}}});US.beforeEach(e=>{const t=GS();if(e.meta.requiresAuth&&!t.isAuthenticated)return{name:"Login",query:{redirect:e.fullPath}};if(e.name==="Login"&&t.isAuthenticated)return{path:"/dashboard"}});US.afterEach(e=>{document.title=e.meta.title?`${e.meta.title} · TCM Agent 控制台`:"TCM Agent 控制台"});const $g=lO(Kme);$g.use(V9());$g.use(US);$g.use(vhe);$g.mount("#app");export{dme as $,rM as A,Z0e as B,xb as C,Tt as D,Bi as E,Le as F,U0e as G,Zh as H,ke as I,nme as J,eme as K,F0e as L,Fme as M,J0e as N,ye as O,Ke as P,fp as Q,NS as R,X0e as S,cg as T,kS as U,Jh as V,k$ as W,ume as X,lM as Y,tme as Z,fme as _,ne as a,K0e as a0,V0e as a1,ome as a2,Cme as a3,E8 as a4,W0e as a5,d0e as a6,k0e as a7,rt as a8,L0e as a9,Xme as aa,Y0e as ab,z0e as ac,H0e as ad,j0e as ae,x1 as af,q0e as ag,wn as ah,f0e as ai,p0e as aj,IS as ak,rn as al,ng as am,qh as an,vs as ao,iS as ap,Ar as aq,rg as ar,to as as,lg as at,Xo as au,Qi as av,B0e as aw,N0e as ax,D0e as ay,nn as b,p as c,Ct as d,h0e as e,g0e as f,Ot as g,Cge as h,jS as i,je as j,Pt as k,Zn as l,dg as m,Uc as n,bt as o,P as p,sme as q,ft as r,ame as s,ud as t,GS as u,G0e as v,nt as w,dn as x,$n as y,iM as z}; diff --git a/view/admin-dist/assets/index-CEBsoH6M.js b/view/admin-dist/assets/index-CEBsoH6M.js new file mode 100644 index 0000000..191c8b3 --- /dev/null +++ b/view/admin-dist/assets/index-CEBsoH6M.js @@ -0,0 +1 @@ +import{m as Q,a as m,p as x,q as W,s as X,t as Y,v as Z,b as f,c as a,d as i,x as g,y as ee,j as o,i as te,z as R,A as E,g as $,w as n,B as le,o as u,F as ae,C as se,D as d,E as oe,G as ne,_ as ie,k,T as ue,H as re,R as ce,J as de,K as ve,L as me,M as pe,l as T,N as _e}from"./index-C0Houbmd.js";import{_ as fe}from"./PageHeader-BlIlnAwG.js";import{_ as C}from"./StatCard--WvCkpAN.js";import{_ as ge}from"./SceneTag-B1Rekn1Q.js";import{_ as ke}from"./EmptyHint-2CB843hO.js";import{_ as N}from"./GlassCard-CqhSlns9.js";import{_ as I}from"./KvGrid-B8WhLf5u.js";const ye={class:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-4"},be={class:"grid grid-cols-1 xl:grid-cols-3 gap-4"},xe={key:1},$e=["onClick"],Ce={class:"mono w-10",style:{color:"var(--text-3)"}},he={class:"w-24",style:{color:"var(--text-3)"}},we={class:"mono hidden md:inline",style:{color:"var(--text-2)"}},ze={class:"mono hidden sm:inline",style:{color:"var(--text-3)"}},Ae={class:"flex flex-col gap-4"},Be={key:1,class:"text-xs mb-3",style:{color:"var(--text-3)"}},Re={class:"flex gap-2"},qe={__name:"index",setup(Te){const r=te(),L=Q(),s=m(null),h=m([]),w=m(null),_=m(null),p=m(!0),S=x(()=>!s.value||!s.value.total?"-":(s.value.success/s.value.total*100).toFixed(1)),P=x(()=>{var t;return s.value?W(X(((t=_.value)==null?void 0:t.provider)||"default",s.value.total_tokens*.7,s.value.total_tokens*.3)):"-"});async function j(){const[t,e,v]=await Promise.allSettled([de({silent:!0}),ve({limit:10},{silent:!0}),me({silent:!0})]);t.status==="fulfilled"&&(s.value=t.value.data),e.status==="fulfilled"&&(h.value=e.value.data||[]),v.status==="fulfilled"&&(w.value=v.value.data),p.value=!1}Y(j,1e4);async function z(){try{const t=await le({silent:!0});_.value=t.data}catch{_.value=null}}z();const A=m(!1);async function G(){A.value=!0;try{const t=await pe();T.success(t.message||"缓存已失效"),z()}finally{A.value=!1}}const B=m(!1);async function H(){B.value=!0;try{const e=(await _e({})).data;e.ok?T.success(`连通正常:${e.provider}/${e.model}(${R(e.duration_ms)})`):T.error(`连通失败:${e.error}`)}finally{B.value=!1}}const J=x(()=>{var c,y,b;const t=w.value;if(!t)return[];const e=((c=t.enhance_concurrency)==null?void 0:c.used)??0,v=((y=t.enhance_concurrency)==null?void 0:y.capacity)??16;return[{label:"运行时长",value:Z(t.uptime_seconds)},{label:"enhance 并发",value:`${e} / ${v}`,color:e/v>.8?"var(--warn)":"var(--ok)"},{label:"堆内存",value:`${(b=t.heap_alloc_mb)==null?void 0:b.toFixed(1)} MB`},{label:"goroutines",value:t.goroutines}]}),K=x(()=>{const t=_.value;return t?[{key:"provider",label:"provider",value:t.provider},{label:"model",value:t.model},{label:"key 尾号",value:t.api_key_tail?`****${t.api_key_tail}`:"-"},{key:"source",label:"来源",value:t.source}]:[]});return(t,e)=>{var F,M,V,D,O,q;const v=$("a-alert"),c=$("a-button"),y=$("a-skeleton"),b=$("a-tag");return u(),f("div",null,[a(fe,{title:"仪表盘",desc:"Agent 运行概况(内存缓冲最近 200 次运行,10s 自动刷新)"}),i("div",ye,[a(C,{label:"缓冲内运行数",value:((F=s.value)==null?void 0:F.total)??"-",hint:`容量 ${((M=s.value)==null?void 0:M.buffer_size)||200} 条 · 点击查看列表`,clickable:"",loading:p.value,onClick:e[0]||(e[0]=l=>o(r).push("/runs"))},null,8,["value","hint","loading"]),a(C,{label:"成功率",value:S.value,unit:"%",tone:Number(S.value)>=90?"ok":"warn",hint:`失败 ${((V=s.value)==null?void 0:V.failed)??0} · 拦截 ${((D=s.value)==null?void 0:D.blocked)??0} · 点击看失败`,clickable:"",loading:p.value,onClick:e[1]||(e[1]=l=>o(r).push("/runs?status=2"))},null,8,["value","tone","hint","loading"]),a(C,{label:"平均耗时(成功)",value:s.value?o(R)(s.value.avg_ms):"-",hint:"点击看趋势",clickable:"",loading:p.value,onClick:e[2]||(e[2]=l=>o(r).push("/stats"))},null,8,["value","loading"]),a(C,{label:"token 消耗",value:((O=s.value)==null?void 0:O.total_tokens)??"-",hint:`估算 ${P.value} · 点击看用量分析`,clickable:"",loading:p.value,onClick:e[3]||(e[3]=l=>o(r).push("/stats"))},null,8,["value","hint","loading"])]),(q=s.value)!=null&&q.last_error?(u(),g(v,{key:0,type:"warning","show-icon":"",class:"!mb-4",message:`最近失败(${o(E)(s.value.last_error_at)}):${s.value.last_error}`},null,8,["message"])):ee("",!0),i("div",be,[a(N,{class:"xl:col-span-2",title:"最近运行"},{extra:n(()=>[a(c,{size:"small",type:"link",onClick:e[4]||(e[4]=l=>o(r).push("/runs"))},{default:n(()=>e[8]||(e[8]=[k("全部 →")])),_:1})]),default:n(()=>[!h.value.length&&!p.value?(u(),g(ke,{key:0,text:"还没有任何运行记录","action-text":"去调试工具发一条测试请求",onAction:e[5]||(e[5]=l=>o(r).push("/debug"))})):(u(),f("div",xe,[(u(!0),f(ae,null,se(h.value,l=>(u(),f("div",{key:l.id,class:"flex items-center gap-3 py-2 px-2 rounded-lg cursor-pointer glass-hover text-xs",style:{"border-bottom":"1px solid var(--glass-border)"},onClick:U=>o(L).openRun(l.id)},[i("span",Ce,"#"+d(l.id),1),i("span",he,d(o(E)(l.started_at)),1),a(ge,{scene:l.scene,clickable:!1},null,8,["scene"]),i("span",we,d(l.provider)+"/"+d(l.model),1),i("span",{class:"ml-auto mono",style:oe({color:o(ne)(l.total_ms)})},d(o(R)(l.total_ms)),5),i("span",ze,d(l.total_tokens)+" tok",1),a(ie,{status:l.status},null,8,["status"])],8,$e))),128))]))]),_:1}),i("div",Ae,[a(N,{title:"服务状态"},{extra:n(()=>[a(c,{size:"small",type:"link",onClick:e[6]||(e[6]=l=>o(r).push("/system"))},{default:n(()=>e[9]||(e[9]=[k("详情 →")])),_:1})]),default:n(()=>[w.value?(u(),g(I,{key:0,items:J.value},null,8,["items"])):(u(),g(y,{key:1,active:"",paragraph:{rows:3},title:!1}))]),_:1}),a(N,{title:"生效模型"},{extra:n(()=>[a(c,{size:"small",type:"text",onClick:z},{default:n(()=>[a(o(ce))]),_:1})]),default:n(()=>[_.value?(u(),g(I,{key:0,items:K.value,class:"mb-3"},{provider:n(({item:l})=>[i("span",{class:"cursor-pointer",style:{color:"var(--primary)"},onClick:e[7]||(e[7]=U=>o(r).push("/models"))},d(l.value),1)]),source:n(({item:l})=>[a(b,{bordered:!1},{default:n(()=>[k(d(l.value),1)]),_:2},1024)]),_:1},8,["items"])):(u(),f("div",Be,"配置加载失败(DB 未就绪?)")),i("div",Re,[a(c,{size:"small",loading:A.value,onClick:G},{icon:n(()=>[a(o(ue))]),default:n(()=>[e[10]||(e[10]=k("失效缓存 "))]),_:1},8,["loading"]),a(c,{size:"small",loading:B.value,onClick:H},{icon:n(()=>[a(o(re))]),default:n(()=>[e[11]||(e[11]=k("连通测试 "))]),_:1},8,["loading"])])]),_:1})])])])}}};export{qe as default}; diff --git a/view/admin-dist/assets/index-CIfwmCYV.js b/view/admin-dist/assets/index-CIfwmCYV.js new file mode 100644 index 0000000..c125bcc --- /dev/null +++ b/view/admin-dist/assets/index-CIfwmCYV.js @@ -0,0 +1,4 @@ +import{c as s,I as Q,aa as re,m as ae,r as E,a as q,O as H,P as oe,b as x,w as c,g as _,ab as ie,l as O,o as d,d as o,y as g,F as w,C as K,k as f,D as p,x as M,j as k,z as P,H as ue,S as ce,a3 as de,a4 as pe,ac as me,ad as xe,N as ve,ae as fe}from"./index-C0Houbmd.js";import{_ as ye}from"./PageHeader-BlIlnAwG.js";import{_ as ge}from"./HelpTip-C9tfcO7G.js";import{S as be}from"./SafetyOutlined-CY7qTfTh.js";var _e={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm144 452H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm445.7 51.5l-93.3-93.3C814.7 780.7 828 743.9 828 704c0-97.2-78.8-176-176-176s-176 78.8-176 176 78.8 176 176 176c35.8 0 69-10.7 96.8-29l94.7 94.7c1.6 1.6 3.6 2.3 5.6 2.3s4.1-.8 5.6-2.3l31-31a7.9 7.9 0 000-11.2zM652 816c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"file-search",theme:"outlined"};function L(v){for(var i=1;i{try{return JSON.parse(localStorage.getItem(G)||"{}")}catch{return{}}})();function y(){localStorage.setItem(G,JSON.stringify({guardText:a.text,kbQuery:m.query,kbTopK:m.topK,mtProvider:u.provider,mtMessage:u.message,enhScene:t.scene,enhContext:t.context,enhKB:t.kbEnabled,enhTopK:t.topK,enhMessages:t.messagesText}))}const a=E({text:r.guardText||"",loading:!1,result:null}),Y=[{label:"病历样例",text:"患者胃疼一月有余,时轻时重,伴干呕,舌淡红苔白,脉弦细,请辨证。"},{label:"处方样例",text:"脾胃虚寒证,拟温中健脾,请开一副中药饮片方。"},{label:"无关文本",text:"帮我写一份项目管理计划,包括甘特图和资源分配。"}];async function W(){if(!a.text.trim()){O.warning("请输入测试文本");return}a.loading=!0,y();try{const n=await me(a.text);a.result=n.data}finally{a.loading=!1}}const m=E({query:r.kbQuery||"",topK:r.kbTopK||5,loading:!1,result:null});async function j(){if(!m.query.trim()){O.warning("请输入检索词");return}m.loading=!0,y();try{const n=await xe({query:m.query,top_k:m.topK});m.result=n.data}finally{m.loading=!1}}const u=E({provider:r.mtProvider||"",message:r.mtMessage||"",loading:!1,result:null}),V=q([{label:"当前生效配置",value:""}]);async function X(){try{const n=await ie({silent:!0}),e=new Set(Object.values(n.routes||{}));V.value=[{label:"当前生效配置",value:""},...[...e].map(b=>({label:b,value:b}))]}catch{}}async function Z(){u.loading=!0,y();try{const n=await ve({provider:u.provider,message:u.message});u.result=n.data}finally{u.loading=!1}}const C={medical_record:JSON.stringify([{role:"system",content:"你是资深中医师,请根据患者主诉生成结构化病历 JSON。"},{role:"user",content:"患者男,23 岁,主诉:胃疼一月有余,时轻时重,有干呕。请生成完整病历。"}],null,2),prescription:JSON.stringify([{role:"system",content:"你是资深中医师与方剂学专家,请辨证论治并开出完整中药饮片方,只输出 JSON。"},{role:"user",content:"患者女,35 岁,脾胃虚寒证,症见胃脘冷痛、喜温喜按、泛吐清水。请开方。"}],null,2)},t=E({scene:r.enhScene||"medical_record",context:r.enhContext||"",kbEnabled:r.enhKB??!1,topK:r.enhTopK||5,messagesText:r.enhMessages||C.medical_record,loading:!1,result:null,error:"",replayFrom:0});function A(n){t.scene=n,t.messagesText=C[n]||C.medical_record,O.success("已填充样例模板")}async function ee(){let n;try{if(n=JSON.parse(t.messagesText),!Array.isArray(n)||!n.length)throw new Error}catch{O.error("messages 必须是非空 JSON 数组([{role, content}])");return}t.loading=!0,t.result=null,t.error="",y();try{const e={scene:t.scene,messages:n,kb_enabled:t.kbEnabled};t.kbEnabled&&(e.context=t.context,e.top_k=t.topK);const b=await fe(e);t.result=b.data}catch(e){t.error=e.message||"调用失败"}finally{t.loading=!1}}const S=q(["enhance"]);function B(n){n&&(t.scene=n.scene||"medical_record",t.context=n.context||"",t.kbEnabled=!!n.kb_enabled,t.topK=n.top_k||5,t.messagesText=JSON.stringify(n.messages||[],null,2),t.replayFrom=n.fromRunId||0,S.value=["enhance"],O.info(`已从运行 #${n.fromRunId} 回填入参,点击「执行」即可重跑`))}function F(n){if(!n)return;t.kbEnabled=!0,t.context=n.query||"";const e=[{role:"system",content:"你是资深中医师,请结合参考资料回答。"},{role:"user",content:`参考资料: +${n.content} + +请基于以上内容生成建议。`}];t.messagesText=JSON.stringify(e,null,2),S.value=["enhance"],O.info("已把检索结果注入 Enhance 测试台")}return H(()=>i.replayPayload,n=>{n&&B(i.consumeReplay())}),H(()=>i.injectContext,n=>{n&&F(i.consumeInject())}),oe(()=>{X(),B(i.consumeReplay()),F(i.consumeInject())}),(n,e)=>{const b=_("a-button"),I=_("a-textarea"),h=_("a-tag"),T=_("a-collapse-panel"),N=_("a-input"),te=_("a-slider"),J=_("a-select"),R=_("a-alert"),se=_("a-switch"),le=_("a-input-number"),ne=_("a-collapse");return d(),x("div",null,[s(ye,{title:"调试工具",desc:"四个测试台覆盖 Agent 全链路:守卫 → 检索 → 模型 → Enhance;入参自动保存"}),s(ge,{id:"debug",text:"不知道从哪开始?展开「Enhance 全链路」点一下样例模板再点执行,就能看到 Agent 完整跑一遍的每个步骤。"}),s(ne,{"active-key":S.value,"onUpdate:activeKey":e[13]||(e[13]=l=>S.value=l),"expand-icon-position":"end",class:"glass !border-0"},{default:c(()=>[s(T,{key:"guard"},{header:c(()=>[o("span",we,[s(k(be),{style:{color:"var(--warn)"}}),e[14]||(e[14]=f("医疗守卫测试 ")),e[15]||(e[15]=o("span",{class:"text-xs",style:{color:"var(--text-3)"}},"判断文本是否医疗相关(拦截跑题请求)",-1))])]),default:c(()=>[o("div",Se,[(d(),x(w,null,K(Y,l=>s(b,{key:l.label,size:"small",onClick:U=>a.text=l.text},{default:c(()=>[f(p(l.label),1)]),_:2},1032,["onClick"])),64))]),s(I,{value:a.text,"onUpdate:value":e[0]||(e[0]=l=>a.text=l),rows:3,placeholder:"输入要检测的文本…",class:"mb-2"},null,8,["value"]),s(b,{type:"primary",loading:a.loading,onClick:W},{default:c(()=>e[16]||(e[16]=[f("测试")])),_:1},8,["loading"]),a.result?(d(),x("div",Te,[s(h,{color:a.result.passed?"success":"error",class:"!text-sm"},{default:c(()=>[f(p(a.result.passed?"放行":"拦截"),1)]),_:1},8,["color"]),a.result.reason?(d(),x("span",Ee,p(a.result.reason),1)):g("",!0),(a.result.hit_whitelist||[]).length?(d(),x("div",Ke,[e[17]||(e[17]=o("span",{class:"text-xs",style:{color:"var(--text-3)"}},"命中白名单:",-1)),(d(!0),x(w,null,K(a.result.hit_whitelist,l=>(d(),M(h,{key:l,color:"success",bordered:!1},{default:c(()=>[f(p(l),1)]),_:2},1024))),128))])):g("",!0),(a.result.hit_blacklist||[]).length?(d(),x("div",Ce,[e[18]||(e[18]=o("span",{class:"text-xs",style:{color:"var(--text-3)"}},"命中黑名单:",-1)),(d(!0),x(w,null,K(a.result.hit_blacklist,l=>(d(),M(h,{key:l,color:"error",bordered:!1},{default:c(()=>[f(p(l),1)]),_:2},1024))),128))])):g("",!0)])):g("",!0)]),_:1}),s(T,{key:"kb"},{header:c(()=>[o("span",Ne,[s(k(z),{style:{color:"var(--accent)"}}),e[19]||(e[19]=f("KB 检索测试 ")),e[20]||(e[20]=o("span",{class:"text-xs",style:{color:"var(--text-3)"}},"回答「Agent 实际会检索到什么」(走 enhance 同款路径)",-1))])]),default:c(()=>[o("div",Me,[s(N,{value:m.query,"onUpdate:value":e[1]||(e[1]=l=>m.query=l),placeholder:"检索词,如:脾胃虚寒 温中健脾",style:{width:"300px"},onPressEnter:j},null,8,["value"]),e[22]||(e[22]=o("span",{class:"text-xs",style:{color:"var(--text-3)"}},"TopK",-1)),s(te,{value:m.topK,"onUpdate:value":e[2]||(e[2]=l=>m.topK=l),min:1,max:10,style:{width:"140px"}},null,8,["value"]),s(b,{type:"primary",loading:m.loading,onClick:j},{default:c(()=>e[21]||(e[21]=[f("检索")])),_:1},8,["loading"])]),m.result?(d(),x("div",Pe,[o("div",ze,p(m.result.source)+" · "+p(k(P)(m.result.duration_ms)),1),m.result.error?(d(),x("div",$e,p(m.result.error),1)):(m.result.docs||[]).length?g("",!0):(d(),x("div",je,"未命中任何文档")),(d(!0),x(w,null,K(m.result.docs||[],(l,U)=>(d(),x("div",{key:U,class:"text-xs p-2 mb-1.5 rounded",style:{background:"rgba(0,0,0,0.15)",color:"var(--text-2)","white-space":"pre-wrap"}},p(l),1))),128))])):g("",!0)]),_:1}),s(T,{key:"model"},{header:c(()=>[o("span",Ve,[s(k(ue),{style:{color:"var(--run)"}}),e[23]||(e[23]=f("模型连通测试 ")),e[24]||(e[24]=o("span",{class:"text-xs",style:{color:"var(--text-3)"}},"真实调一次 LLM(max_tokens 64,成本可忽略)",-1))])]),default:c(()=>[o("div",Ae,[s(J,{value:u.provider,"onUpdate:value":e[3]||(e[3]=l=>u.provider=l),options:V.value,style:{width:"180px"}},null,8,["value","options"]),s(N,{value:u.message,"onUpdate:value":e[4]||(e[4]=l=>u.message=l),placeholder:"测试消息(留空用默认)",style:{width:"280px"}},null,8,["value"]),s(b,{type:"primary",loading:u.loading,onClick:Z},{default:c(()=>e[25]||(e[25]=[f("测试")])),_:1},8,["loading"])]),u.result?(d(),x("div",Be,[o("div",Fe,[s(h,{color:u.result.ok?"success":"error"},{default:c(()=>[f(p(u.result.ok?"连通正常":"连通失败"),1)]),_:1},8,["color"]),o("span",Ie,p(u.result.provider)+"/"+p(u.result.model),1),s(h,{bordered:!1},{default:c(()=>[f(p(u.result.cfg_source),1)]),_:1}),o("span",Je,p(k(P)(u.result.duration_ms)),1),o("span",Re,"key#"+p(u.result.api_key_id),1)]),u.result.reply?(d(),x("div",Ue,"回复:"+p(u.result.reply),1)):g("",!0),u.result.error?(d(),x("div",qe,p(u.result.error),1)):g("",!0)])):g("",!0)]),_:1}),s(T,{key:"enhance"},{header:c(()=>[o("span",He,[s(k($),{style:{color:"var(--primary)"}}),e[26]||(e[26]=f("Enhance 全链路测试 ")),e[27]||(e[27]=o("span",{class:"text-xs",style:{color:"var(--text-3)"}},"跑一遍完整 Agent 流程(守卫 → KB → 计划 → LLM → 反思)",-1))])]),default:c(()=>[t.replayFrom?(d(),M(R,{key:0,type:"info","show-icon":"",closable:"",class:"!mb-3",message:`当前入参来自运行 #${t.replayFrom} 的快照重放(可能被截断)`,onClose:e[5]||(e[5]=l=>t.replayFrom=0)},null,8,["message"])):g("",!0),o("div",Le,[s(J,{value:t.scene,"onUpdate:value":e[6]||(e[6]=l=>t.scene=l),options:k(ce),style:{width:"140px"}},null,8,["value","options"]),s(b,{size:"small",onClick:e[7]||(e[7]=l=>A("medical_record"))},{default:c(()=>e[28]||(e[28]=[f("病历模板")])),_:1}),s(b,{size:"small",onClick:e[8]||(e[8]=l=>A("prescription"))},{default:c(()=>e[29]||(e[29]=[f("处方模板")])),_:1}),e[31]||(e[31]=o("span",{class:"text-xs ml-2",style:{color:"var(--text-3)"}},"知识库",-1)),s(se,{checked:t.kbEnabled,"onUpdate:checked":e[9]||(e[9]=l=>t.kbEnabled=l),size:"small"},null,8,["checked"]),t.kbEnabled?(d(),x(w,{key:0},[s(N,{value:t.context,"onUpdate:value":e[10]||(e[10]=l=>t.context=l),placeholder:"检索关键词 context",style:{width:"200px"}},null,8,["value"]),e[30]||(e[30]=o("span",{class:"text-xs",style:{color:"var(--text-3)"}},"TopK",-1)),s(le,{value:t.topK,"onUpdate:value":e[11]||(e[11]=l=>t.topK=l),min:1,max:10,size:"small"},null,8,["value"])],64)):g("",!0)]),e[35]||(e[35]=o("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"messages(JSON 数组)",-1)),s(I,{value:t.messagesText,"onUpdate:value":e[12]||(e[12]=l=>t.messagesText=l),rows:8,class:"mono !text-xs mb-2"},null,8,["value"]),s(b,{type:"primary",loading:t.loading,onClick:ee},{default:c(()=>[f(" 执行"+p(t.loading?"中(最长 2 分钟)":""),1)]),_:1},8,["loading"]),t.error?(d(),x("div",De,[s(R,{type:"error",message:t.error,"show-icon":""},null,8,["message"])])):g("",!0),t.result?(d(),x("div",Ge,[o("div",Qe,[s(h,{color:"success"},{default:c(()=>e[32]||(e[32]=[f("完成")])),_:1}),o("span",Ye,p(t.result.provider)+"/"+p(t.result.model),1),o("span",We,p(k(P)(t.result.total_ms)),1)]),o("div",Xe,[e[33]||(e[33]=o("div",{class:"text-xs font-medium mb-2",style:{color:"var(--text-1)"}},"步骤时间线",-1)),s(de,{steps:t.result.steps||[]},null,8,["steps"])]),e[34]||(e[34]=o("div",{class:"text-xs font-medium mb-1",style:{color:"var(--text-1)"}},"生成内容",-1)),s(pe,{value:t.result.content,"max-height":"300px"},null,8,["value"])])):g("",!0)]),_:1})]),_:1},8,["active-key"])])}}},nt=re(Ze,[["__scopeId","data-v-b5090fa0"]]);export{nt as default}; diff --git a/view/admin-dist/assets/index-CZFMEA6j.js b/view/admin-dist/assets/index-CZFMEA6j.js new file mode 100644 index 0000000..37924b9 --- /dev/null +++ b/view/admin-dist/assets/index-CZFMEA6j.js @@ -0,0 +1 @@ +import{m as G,a as w,t as R,a9 as j,p as u,a2 as q,v as D,b as B,c as o,x as p,y as A,d as b,w as a,g as d,i as I,o as n,j as N,k as $,D as v,L as O}from"./index-C0Houbmd.js";import{_ as T}from"./PageHeader-BlIlnAwG.js";import{_ as U}from"./EChart-BGQ5HH9D.js";import{_ as y}from"./GlassCard-CqhSlns9.js";import{_ as z}from"./KvGrid-B8WhLf5u.js";const E={class:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-4"},H={class:"flex flex-col items-center justify-center"},K={class:"mono text-sm"},J={key:0,class:"text-xs mono",style:{color:"var(--text-2)"}},te={__name:"index",setup(Q){const S=I(),F=G(),l=w(null),x=w(null),c=w([]);async function L(){const e=await O({silent:!0});l.value=e.data,c.value.push(Number(e.data.heap_alloc_mb.toFixed(1))),c.value.length>60&&c.value.shift()}R(L,5e3),j({silent:!0}).then(e=>{x.value=e.data}).catch(()=>{});const k=u(()=>{var e,t;return((t=(e=l.value)==null?void 0:e.enhance_concurrency)==null?void 0:t.used)??0}),h=u(()=>{var e,t;return((t=(e=l.value)==null?void 0:e.enhance_concurrency)==null?void 0:t.capacity)??16}),i=u(()=>Math.round(k.value/Math.max(h.value,1)*100)),M=u(()=>{var t,s;const e=l.value;return e?[{label:"启动时间",value:q(e.started_at)},{label:"运行时长",value:D(e.uptime_seconds),color:"var(--ok)"},{label:"Go 版本",value:e.go_version},{label:"goroutines",value:e.goroutines},{label:"RunLog 缓冲",value:`${(t=e.runlog_usage)==null?void 0:t.used} / ${(s=e.runlog_usage)==null?void 0:s.capacity}`}]:[]}),P=u(()=>{var t,s,r,m,_,f;const e=x.value;return e?[{label:"ReAct 引擎",value:(t=e.react)!=null&&t.enabled?"开启":"关闭",mono:!1},{label:"医疗守卫",value:(s=e.medical_guard)!=null&&s.enabled?"开启":"关闭",mono:!1},{label:"token 预算",value:(r=e.token_budget)!=null&&r.enabled?"开启":"关闭",mono:!1},{label:"debug 日志",value:(m=e.debug)!=null&&m.log_request_body?"开(含请求体)":"关",mono:!1,color:(_=e.debug)!=null&&_.log_request_body?"var(--warn)":void 0},{label:"KB 来源",value:(f=e.kb)==null?void 0:f.source}]:[]}),V=u(()=>{const e=F.theme==="dark",t=e?"#f59e0b":"#4361ee";return{backgroundColor:"transparent",grid:{left:36,right:8,top:8,bottom:18},tooltip:{trigger:"axis"},xAxis:{type:"category",data:c.value.map((s,r)=>r),show:!1},yAxis:{type:"value",axisLabel:{color:e?"#8d7c60":"#98a1b3",fontSize:10},splitLine:{lineStyle:{color:"rgba(128,128,128,0.1)"}}},series:[{type:"line",data:c.value,smooth:!0,showSymbol:!1,areaStyle:{opacity:.25},itemStyle:{color:t}}]}});return(e,t)=>{const s=d("a-button"),r=d("a-alert"),m=d("a-skeleton"),_=d("a-progress"),f=d("a-tag");return n(),B("div",null,[o(T,{title:"系统状态",desc:"Go 进程运行时指标(5s 轮询,零外部依赖)"}),i.value>=80?(n(),p(r,{key:0,type:"warning","show-icon":"",class:"!mb-4",message:`enhance 并发已占用 ${k.value}/${h.value}(${i.value}%),接近限流阈值`},{action:a(()=>[o(s,{size:"small",onClick:t[0]||(t[0]=g=>N(S).push("/runs"))},{default:a(()=>t[2]||(t[2]=[$("查看运行中请求")])),_:1})]),_:1},8,["message"])):A("",!0),b("div",E,[o(y,{title:"进程"},{default:a(()=>[l.value?(n(),p(z,{key:0,items:M.value},null,8,["items"])):(n(),p(m,{key:1,active:"",paragraph:{rows:4},title:!1}))]),_:1}),o(y,{title:"enhance 并发信号量"},{default:a(()=>[b("div",H,[o(_,{type:"circle",percent:i.value,size:120,"stroke-color":i.value>=80?"var(--err)":i.value>=50?"var(--warn)":"var(--ok)"},{format:a(()=>[b("span",K,v(k.value)+"/"+v(h.value),1)]),_:1},8,["percent","stroke-color"]),t[3]||(t[3]=b("div",{class:"text-xs mt-3",style:{color:"var(--text-3)"}},"满载时新请求快速失败(503),PHP 端自动降级直连",-1))])]),_:1}),o(y,{title:"运行时开关"},{extra:a(()=>[o(f,{bordered:!1,color:"default"},{default:a(()=>t[4]||(t[4]=[$("只读")])),_:1})]),default:a(()=>[x.value?(n(),p(z,{key:0,items:P.value},null,8,["items"])):(n(),p(m,{key:1,active:"",paragraph:{rows:4},title:!1})),o(s,{size:"small",type:"link",class:"!px-0 mt-2",onClick:t[1]||(t[1]=g=>N(S).push("/config"))},{default:a(()=>t[5]||(t[5]=[$("完整配置 →")])),_:1})]),_:1})]),o(y,{title:"堆内存趋势(前端采样 5 分钟窗口)"},{extra:a(()=>{var g,C;return[l.value?(n(),B("span",J," heap "+v((g=l.value.heap_alloc_mb)==null?void 0:g.toFixed(1))+" MB · OS "+v((C=l.value.sys_mb)==null?void 0:C.toFixed(0))+" MB · GC "+v(l.value.num_gc)+" 次 ",1)):A("",!0)]}),default:a(()=>[o(U,{option:V.value,height:"200px"},null,8,["option"])]),_:1})])}}};export{te as default}; diff --git a/view/admin-dist/assets/index-Cu6gPumw.js b/view/admin-dist/assets/index-Cu6gPumw.js new file mode 100644 index 0000000..52ad498 --- /dev/null +++ b/view/admin-dist/assets/index-Cu6gPumw.js @@ -0,0 +1 @@ +import{m as re,a as g,p as M,r as H,z as b,P as ne,b as c,c as s,d as o,w as l,x as A,y as k,g as m,D as i,F as S,C as ie,k as v,j as f,B as de,ab as ue,N as K,l as w,o as p,R as ve,H as pe,E as me,T as ce,af as fe,Y as ge,M as ye,ag as _e}from"./index-C0Houbmd.js";import{_ as xe}from"./PageHeader-BlIlnAwG.js";import{_ as be}from"./EChart-BGQ5HH9D.js";import{_ as ke}from"./HelpTip-C9tfcO7G.js";import{C as we}from"./ClearOutlined-n8aZ-G2p.js";const Ce={class:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-4"},$e={class:"glass p-4"},Me={class:"flex items-center justify-between mb-3"},Le={key:1,class:"grid grid-cols-2 gap-y-2 text-xs"},Oe={class:"mono text-right",style:{color:"var(--primary)"}},Pe={class:"mono text-right"},Re=["title"],he={class:"mono text-right"},Ae={class:"text-right"},Se={class:"glass p-4"},ze={key:0,class:"flex items-center gap-2 flex-wrap"},Be={class:"text-[10px] mt-0.5",style:{color:"var(--text-3)"}},Ne={key:0,style:{color:"var(--text-3)"}},je={key:1,class:"text-xs",style:{color:"var(--text-3)"}},Ie={class:"glass p-4 mb-4"},Te={class:"flex items-center justify-between mb-3"},Ue={class:"mono text-xs ml-1",style:{color:"var(--text-3)"}},Fe={key:1,class:"mono"},Ve={class:"py-6 text-xs",style:{color:"var(--text-3)"}},qe={class:"glass p-4"},De={class:"flex items-center gap-3 flex-wrap mb-3"},Ee={class:"flex gap-6 mb-2 text-xs mono flex-wrap"},He={style:{color:"var(--ok)"}},Ke={style:{color:"var(--primary)"}},We={style:{color:"var(--warn)"}},Ye={style:{color:"var(--err)"}},ot={__name:"index",setup(Ge){const W=re(),d=g(null),z=g(!1);async function B(){z.value=!0;try{const t=await de({silent:!0});d.value=t.data}finally{z.value=!1}}async function Y(){await ye(),w.success("LLM 配置缓存已失效,下次调用将重新读取数据库"),B()}const N=g({}),j=g({}),C=g(""),L=g(!1);async function I(){L.value=!0;try{const t=await ue({silent:!0});N.value=t.routes||{},j.value=t.fallbacks||{},C.value=t.default_provider||""}finally{L.value=!1}}const G=M(()=>Object.entries(N.value).map(([t,e])=>({scene:t,provider:e}))),O=g("");async function U(t){O.value=t;try{const r=(await K({provider:t})).data;r.ok?w.success(`${r.provider}/${r.model} 连通正常(${b(r.duration_ms)})`):w.error(`${r.provider} 连通失败:${r.error||"未知错误"}`)}finally{O.value=""}}const P=g(!1),y=H({scene:"",provider:""}),T=g(!1);async function J(){if(!y.scene.trim()||!y.provider.trim()){w.warning("scene 与 provider 都必填");return}T.value=!0;try{await _e({scene:y.scene.trim(),provider:y.provider.trim()}),w.success("路由已热更新(重启后失效,持久化请改 config.yaml)"),P.value=!1,I()}finally{T.value=!1}}const R=M(()=>{var x;const t=((x=d.value)==null?void 0:x.provider)||C.value,e=j.value[t]||j.value[C.value]||[],r=new Set([t]),_=e.filter(h=>r.has(h)?!1:(r.add(h),!0));return t?[t,..._]:_}),a=H({provider:"",times:5,running:!1,done:0,samples:[],error:""}),Q=M(()=>[...new Set([C.value,...Object.values(N.value),...R.value].filter(Boolean))].map(e=>({label:e,value:e})));async function X(){if(!a.provider){w.warning("请选择要测试的 provider");return}a.running=!0,a.samples=[],a.done=0,a.error="";try{for(let t=0;t{const t=[...a.samples].sort((_,x)=>_-x);if(!t.length)return null;const e=t.reduce((_,x)=>_+x,0)/t.length,r=t[Math.min(t.length-1,Math.ceil(t.length*.95)-1)];return{min:t[0],avg:Math.round(e),p95:r,max:t[t.length-1]}}),Z=M(()=>{const t=W.theme==="dark";return{backgroundColor:"transparent",grid:{left:48,right:12,top:20,bottom:24},tooltip:{trigger:"axis",valueFormatter:e=>b(e)},xAxis:{type:"category",data:a.samples.map((e,r)=>`#${r+1}`),axisLabel:{color:t?"#8d7c60":"#98a1b3"}},yAxis:{type:"value",name:"ms",axisLabel:{color:t?"#8d7c60":"#98a1b3"},splitLine:{lineStyle:{color:"rgba(128,128,128,0.1)"}}},series:[{type:"bar",data:a.samples,barMaxWidth:28,itemStyle:{color:t?"#f59e0b":"#4361ee",borderRadius:[4,4,0,0]}}]}}),ee=[{title:"场景",dataIndex:"scene",key:"scene",width:220},{title:"Provider",dataIndex:"provider",key:"provider"},{title:"操作",key:"action",width:120}];return ne(()=>{B(),I()}),(t,e)=>{var E;const r=m("a-button"),_=m("a-popconfirm"),x=m("a-skeleton"),h=m("a-tag"),te=m("a-table"),oe=m("a-select"),F=m("a-radio-button"),se=m("a-radio-group"),V=m("a-alert"),q=m("a-input"),D=m("a-form-item"),ae=m("a-form"),le=m("a-modal");return p(),c("div",null,[s(xe,{title:"模型管理",desc:"生效配置、场景路由与降级链;路由注册为热更新(重启失效)"},{actions:l(()=>[s(r,{loading:L.value,onClick:e[0]||(e[0]=n=>{I(),B()})},{icon:l(()=>[s(f(ve))]),default:l(()=>[e[8]||(e[8]=v("刷新"))]),_:1},8,["loading"]),s(_,{title:"确认失效 LLM 配置缓存?","ok-text":"失效","cancel-text":"取消",onConfirm:Y},{default:l(()=>[s(r,{danger:""},{icon:l(()=>[s(f(we))]),default:l(()=>[e[9]||(e[9]=v("失效缓存"))]),_:1})]),_:1})]),_:1}),s(ke,{id:"models",text:"改了后台的模型配置后点「失效缓存」立即生效;「场景路由」决定每个业务场景用哪个模型(热更新,重启失效);不确定模型通不通就点「连通测试」或跑一次基准测试。"}),o("div",Ce,[o("div",$e,[o("div",Me,[e[11]||(e[11]=o("span",{class:"text-sm font-medium",style:{color:"var(--text-1)"}},"当前生效配置(脱敏)",-1)),s(r,{size:"small",loading:O.value===(((E=d.value)==null?void 0:E.provider)||""),onClick:e[1]||(e[1]=n=>{var u;return U(((u=d.value)==null?void 0:u.provider)||"")})},{icon:l(()=>[s(f(pe))]),default:l(()=>[e[10]||(e[10]=v("连通测试 "))]),_:1},8,["loading"])]),z.value&&!d.value?(p(),A(x,{key:0,active:"",paragraph:{rows:4},title:!1})):d.value?(p(),c("div",Le,[e[12]||(e[12]=o("span",{style:{color:"var(--text-3)"}},"Provider",-1)),o("span",Oe,i(d.value.provider),1),e[13]||(e[13]=o("span",{style:{color:"var(--text-3)"}},"Model",-1)),o("span",Pe,i(d.value.model),1),e[14]||(e[14]=o("span",{style:{color:"var(--text-3)"}},"API 地址",-1)),o("span",{class:"mono text-right truncate",title:d.value.api_url},i(d.value.api_url||"-"),9,Re),e[15]||(e[15]=o("span",{style:{color:"var(--text-3)"}},"API Key",-1)),o("span",he,i(d.value.api_key_tail?"****"+d.value.api_key_tail:"-")+"(#"+i(d.value.api_key_id)+")",1),e[16]||(e[16]=o("span",{style:{color:"var(--text-3)"}},"配置来源",-1)),o("span",Ae,[s(h,{bordered:!1,color:d.value.source==="db_active"?"processing":"default"},{default:l(()=>[v(i(d.value.source),1)]),_:1},8,["color"])])])):k("",!0)]),o("div",Se,[e[17]||(e[17]=o("div",{class:"text-sm font-medium mb-3",style:{color:"var(--text-1)"}},"降级链(fallback)",-1)),R.value.length?(p(),c("div",ze,[(p(!0),c(S,null,ie(R.value,(n,u)=>(p(),c(S,{key:n},[o("div",{class:"px-3 py-2 rounded-lg text-xs mono",style:me(u===0?"background: rgba(245,158,11,0.15); border: 1px solid var(--primary); color: var(--primary)":"background: rgba(128,128,128,0.08); border: 1px solid var(--glass-border); color: var(--text-2)")},[u===0?(p(),A(f(ce),{key:0,class:"mr-1"})):k("",!0),v(i(n)+" ",1),o("div",Be,i(u===0?"当前生效":`降级 ${u}`),1)],4),uP.value=!0)},{icon:l(()=>[s(f(fe))]),default:l(()=>[e[19]||(e[19]=v("注册路由"))]),_:1})]),s(te,{columns:ee,"data-source":G.value,loading:L.value,pagination:!1,size:"small","row-key":"scene"},{bodyCell:l(({column:n,record:u})=>[n.key==="scene"?(p(),c(S,{key:0},[o("span",null,i(f(ge)(u.scene)),1),o("span",Ue,i(u.scene),1)],64)):n.key==="provider"?(p(),c("span",Fe,i(u.provider),1)):n.key==="action"?(p(),A(r,{key:2,size:"small",type:"link",loading:O.value===u.provider,onClick:Je=>U(u.provider)},{default:l(()=>e[21]||(e[21]=[v("测试")])),_:2},1032,["loading","onClick"])):k("",!0)]),emptyText:l(()=>[o("div",Ve,"未配置场景级路由,所有场景走默认 provider「"+i(C.value||"-")+"」",1)]),_:1},8,["data-source","loading"])]),o("div",qe,[e[28]||(e[28]=o("div",{class:"text-sm font-medium mb-1",style:{color:"var(--text-1)"}},"延迟基准测试",-1)),e[29]||(e[29]=o("div",{class:"text-xs mb-3",style:{color:"var(--text-3)"}},"串行真实调用 N 次(max_tokens 64),评估换模型前后的延迟差异;不要在生产高峰跑大批量",-1)),o("div",De,[s(oe,{value:a.provider,"onUpdate:value":e[3]||(e[3]=n=>a.provider=n),options:Q.value,placeholder:"选择 provider",style:{width:"180px"}},null,8,["value","options"]),s(se,{value:a.times,"onUpdate:value":e[4]||(e[4]=n=>a.times=n),"button-style":"solid",size:"small"},{default:l(()=>[s(F,{value:5},{default:l(()=>e[22]||(e[22]=[v("5 次")])),_:1}),s(F,{value:10},{default:l(()=>e[23]||(e[23]=[v("10 次")])),_:1})]),_:1},8,["value"]),s(r,{type:"primary",loading:a.running,onClick:X},{default:l(()=>[v(i(a.running?`测试中 ${a.done}/${a.times}`:"开始测试"),1)]),_:1},8,["loading"])]),a.error?(p(),A(V,{key:0,type:"error",message:a.error,"show-icon":"",class:"!mb-3"},null,8,["message"])):k("",!0),$.value?(p(),c(S,{key:1},[o("div",Ee,[o("span",null,[e[24]||(e[24]=v("min ")),o("b",He,i(f(b)($.value.min)),1)]),o("span",null,[e[25]||(e[25]=v("avg ")),o("b",Ke,i(f(b)($.value.avg)),1)]),o("span",null,[e[26]||(e[26]=v("p95 ")),o("b",We,i(f(b)($.value.p95)),1)]),o("span",null,[e[27]||(e[27]=v("max ")),o("b",Ye,i(f(b)($.value.max)),1)])]),s(be,{option:Z.value,height:"200px"},null,8,["option"])],64)):k("",!0)]),s(le,{open:P.value,"onUpdate:open":e[7]||(e[7]=n=>P.value=n),title:"注册场景路由","confirm-loading":T.value,onOk:J},{default:l(()=>[s(V,{type:"warning","show-icon":"",message:"热更新仅存于内存,服务重启后失效;持久化请修改 config.yaml 的 llm.model_routes",class:"!mb-4"}),s(ae,{layout:"vertical"},{default:l(()=>[s(D,{label:"场景 scene",required:""},{default:l(()=>[s(q,{value:y.scene,"onUpdate:value":e[5]||(e[5]=n=>y.scene=n),placeholder:"如 medical_record / prescription"},null,8,["value"])]),_:1}),s(D,{label:"Provider",required:""},{default:l(()=>[s(q,{value:y.provider,"onUpdate:value":e[6]||(e[6]=n=>y.provider=n),placeholder:"如 spark / deepseek / qwen"},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["open","confirm-loading"])])}}};export{ot as default}; diff --git a/view/admin-dist/assets/index-DTdNJDlS.js b/view/admin-dist/assets/index-DTdNJDlS.js new file mode 100644 index 0000000..c646dcb --- /dev/null +++ b/view/admin-dist/assets/index-DTdNJDlS.js @@ -0,0 +1,2 @@ +import{c as i,I as L,a as p,t as Y,p as J,P as Q,b as h,d,w as u,g as P,D as f,x as R,y as z,F as S,C as Z,i as K,o as c,k as O,j as y,V as ee,n as te,a7 as ne,a8 as E,l as ae}from"./index-C0Houbmd.js";import{_ as le}from"./PageHeader-BlIlnAwG.js";import{C as re}from"./ClearOutlined-n8aZ-G2p.js";var oe={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"}}]},name:"caret-right",theme:"outlined"};function I(n){for(var t=1;tT&&(e.value=e.value.slice(e.value.length-T)))}Y(F,2e3);function k(){x.value&&(x.value.scrollTop=x.value.scrollHeight)}function A(){a.value=!a.value,a.value||(g.value=0,E(k))}function H(){e.value=[],g.value=0}function q(){const o=b.value.map(j=>j.line).join(` +`),r=new Blob([o],{type:"text/plain"}),v=URL.createObjectURL(r),_=document.createElement("a");_.href=v,_.download=`agent-log-${Date.now()}.log`,_.click(),URL.revokeObjectURL(v),ae.success(`已导出 ${b.value.length} 行`)}function N(o){return/失败|错误|ERROR|PANIC|panic|⚠️.*失败/.test(o)?"error":/⚠️|警告|WARN|拦截|降级|重试/.test(o)?"warn":"info"}const b=J(()=>{const o=w.value.trim().toLowerCase();return localStorage.setItem(U,w.value),e.value.filter(r=>!(!C.value.includes(N(r.line))||o&&!r.line.toLowerCase().includes(o)))});function m(o){const r=o.match(/scene=([a-z_-]+)/);return r?r[1]:null}function G(o){t.push({path:"/runs",query:{scene:o}})}const W={warn:"log-warn",error:"log-err",info:""};return Q(k),(o,r)=>{const v=P("a-button"),_=P("a-badge"),j=P("a-checkbox-group"),X=P("a-input");return c(),h("div",null,[i(le,{title:"实时日志",desc:"Go 进程内存日志缓冲(最近 500 行,2s 增量轮询);行内 scene 可点击跳运行记录"},{actions:u(()=>[i(_,{count:g.value,size:"small"},{default:u(()=>[i(v,{onClick:A},{icon:u(()=>[a.value?(c(),R(y(B),{key:0})):(c(),R(y(V),{key:1}))]),default:u(()=>[O(" "+f(a.value?"继续":"暂停"),1)]),_:1})]),_:1},8,["count"]),i(v,{onClick:H},{icon:u(()=>[i(y(re))]),default:u(()=>[r[2]||(r[2]=O("清屏"))]),_:1}),i(v,{onClick:q},{icon:u(()=>[i(y(ee))]),default:u(()=>[r[3]||(r[3]=O("导出"))]),_:1})]),_:1}),d("div",ve,[i(j,{value:C.value,"onUpdate:value":r[0]||(r[0]=s=>C.value=s),options:[{label:"信息",value:"info"},{label:"警告",value:"warn"},{label:"错误",value:"error"}]},null,8,["value"]),i(X,{value:w.value,"onUpdate:value":r[1]||(r[1]=s=>w.value=s),placeholder:"关键词过滤(如 Spark / enhance / 500)",style:{width:"260px"},"allow-clear":""},null,8,["value"]),d("span",pe,f(b.value.length)+" / "+f(e.value.length)+" 行",1)]),d("div",de,[d("div",{ref_key:"scrollRef",ref:x,class:"log-terminal p-4 h-[62vh] overflow-auto"},[b.value.length?z("",!0):(c(),h("div",ge,"暂无日志(等待服务产生输出…)")),(c(!0),h(S,null,Z(b.value,s=>(c(),h("div",{key:s.id,class:te(W[N(s.line)])},[m(s.line)?(c(),h(S,{key:0},[d("span",null,f(s.line.split("scene="+m(s.line))[0]),1),d("span",{class:"underline cursor-pointer",style:{color:"var(--primary)"},onClick:he=>G(m(s.line))},"scene="+f(m(s.line)),9,me),d("span",null,f(s.line.split("scene="+m(s.line)).slice(1).join("scene="+m(s.line))),1)],64)):(c(),h(S,{key:1},[O(f(s.line),1)],64))],2))),128))],512),a.value&&g.value?(c(),R(v,{key:0,type:"primary",shape:"round",size:"small",class:"!absolute bottom-4 right-6",onClick:A},{icon:u(()=>[i(y($))]),default:u(()=>[O(" "+f(g.value)+" 条新日志 ",1)]),_:1})):z("",!0)])])}}};export{ye as default}; diff --git a/view/admin-dist/assets/index-DTh94Lw7.js b/view/admin-dist/assets/index-DTh94Lw7.js new file mode 100644 index 0000000..922c765 --- /dev/null +++ b/view/admin-dist/assets/index-DTh94Lw7.js @@ -0,0 +1,3 @@ +import{c as t,I as ne,ai as R,aj as X,a as z,r as K,g as f,x as S,o as p,w as n,k,l as j,O as Y,p as te,b as L,y as E,d,D as y,F as Q,j as M,ak as Pe,al as Le,a2 as Me,h as je,P as De,C as ue,af as de,i as Ue,am as Be,W as ce,an as pe,ao as me,ap as Te,aq as Ie,A as Ve}from"./index-C0Houbmd.js";import{c as Ne,u as ye,g as Ae,b as Ee,a as Fe,r as He,d as Re,e as Qe,f as Je,h as We,i as Ge}from"./kb-DlfA6vCV.js";import{_ as ve}from"./PageHeader-BlIlnAwG.js";import{_ as Xe}from"./HelpTip-C9tfcO7G.js";import{_ as fe}from"./EmptyHint-2CB843hO.js";var Ye={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"};function xe(u){for(var l=1;l{const w=f("a-input"),h=f("a-form-item"),P=f("a-textarea"),D=f("a-radio"),q=f("a-radio-group"),T=f("a-form"),c=f("a-modal");return p(),S(c,{open:o.value,"onUpdate:open":x[3]||(x[3]=m=>o.value=m),title:"新建知识库","confirm-loading":_.value,onOk:r},{default:n(()=>[t(T,{layout:"vertical"},{default:n(()=>[t(h,{label:"名称",required:""},{default:n(()=>[t(w,{value:g.name,"onUpdate:value":x[0]||(x[0]=m=>g.name=m),placeholder:"如:中医方剂知识库",maxlength:50,"show-count":"",onPressEnter:r},null,8,["value"])]),_:1}),t(h,{label:"描述"},{default:n(()=>[t(P,{value:g.description,"onUpdate:value":x[1]||(x[1]=m=>g.description=m),rows:2,placeholder:"这个库放什么内容(可选)",maxlength:200},null,8,["value"])]),_:1}),t(h,{label:"来源标记"},{default:n(()=>[t(q,{value:g.source,"onUpdate:value":x[2]||(x[2]=m=>g.source=m)},{default:n(()=>[t(D,{value:"manual"},{default:n(()=>x[4]||(x[4]=[k("手动维护")])),_:1}),t(D,{value:"import"},{default:n(()=>x[5]||(x[5]=[k("批量导入")])),_:1})]),_:1},8,["value"])]),_:1})]),_:1})]),_:1},8,["open","confirm-loading"])}}},ot={__name:"ChunkEditModal",props:R({chunk:{type:Object,default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:R(["saved"],["update:open"]),setup(u,{emit:l}){const o=X(u,"open"),i=u,_=l,g=z(!1),r=K({title:"",content:"",questions:""});Y(()=>i.chunk,x=>{if(!x)return;r.title=x.title||"",r.content=x.content||"";let w=[];try{w=JSON.parse(x.meta_json||"{}").related_questions||[]}catch{}r.questions=w.join(` +`)},{immediate:!0});async function b(){if(!r.content.trim()){j.warning("内容不能为空");return}g.value=!0;try{await ye(i.chunk.id,{title:r.title.trim(),content:r.content,related_questions:r.questions.split(` +`).map(x=>x.trim()).filter(Boolean)}),j.success("已保存"),o.value=!1,_("saved")}finally{g.value=!1}}return(x,w)=>{var c;const h=f("a-input"),P=f("a-form-item"),D=f("a-textarea"),q=f("a-form"),T=f("a-modal");return p(),S(T,{open:o.value,"onUpdate:open":w[3]||(w[3]=m=>o.value=m),title:`编辑分段 #${((c=u.chunk)==null?void 0:c.id)||""}`,width:"640px","confirm-loading":g.value,onOk:b},{default:n(()=>[t(q,{layout:"vertical"},{default:n(()=>[t(P,{label:"标题"},{default:n(()=>[t(h,{value:r.title,"onUpdate:value":w[0]||(w[0]=m=>r.title=m),maxlength:100},null,8,["value"])]),_:1}),t(P,{label:"内容",required:""},{default:n(()=>[t(D,{value:r.content,"onUpdate:value":w[1]||(w[1]=m=>r.content=m),rows:8,class:"mono !text-xs"},null,8,["value"])]),_:1}),t(P,{label:"关联问题(每行一个,会参与检索命中)"},{default:n(()=>[t(D,{value:r.questions,"onUpdate:value":w[2]||(w[2]=m=>r.questions=m),rows:3,placeholder:"如:脾胃虚寒怎么调理?"},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["open","title","confirm-loading"])}}},lt={class:"flex items-center gap-2"},st={class:"text-xs",style:{color:"var(--text-3)"}},rt={key:0,class:"glass p-2.5 mb-3 flex items-center gap-2"},it={class:"text-xs",style:{color:"var(--text-2)"}},ut={key:0,class:"mono text-xs",style:{color:"var(--text-3)"}},dt={class:"text-xs font-medium mb-0.5 truncate",style:{color:"var(--text-1)","max-width":"480px"}},ct={class:"text-xs",style:{color:"var(--text-3)",display:"-webkit-box","-webkit-line-clamp":"2","-webkit-box-orient":"vertical",overflow:"hidden"}},pt={__name:"ChunkListDrawer",props:R({doc:{type:Object,default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:R(["changed"],["update:open"]),setup(u,{emit:l}){const o=X(u,"open"),i=u,_=l,g=z([]),r=z(!1),b=z([]),x=z(!1),w=z(null),h=z(0);async function P(){var C;if((C=i.doc)!=null&&C.id){r.value=!0;try{const v=await Ae(i.doc.id);g.value=v.data||[],b.value=[]}finally{r.value=!1}}}Y([o,()=>{var C;return(C=i.doc)==null?void 0:C.id}],([C])=>{C&&P()});async function D(C,v){h.value=C.id;try{await ye(C.id,{is_active:v?1:0}),C.is_active=v?1:0,j.success(v?"已启用":"已禁用(不再参与检索)"),_("changed")}finally{h.value=0}}const q=z(!1);async function T(C){const v={enable:"启用",disable:"禁用",delete:"删除"},N=async()=>{var F;q.value=!0;try{const G=await Ee({ids:b.value,action:C});j.success(`已${v[C]} ${((F=G.data)==null?void 0:F.affected)??b.value.length} 个分段`),P(),_("changed")}finally{q.value=!1}};C==="delete"?Le.confirm({title:`确认删除选中的 ${b.value.length} 个分段?`,content:"软删除后不再参与检索,且不可在面板恢复",okText:"删除",okType:"danger",cancelText:"取消",onOk:N}):await N()}function c(C){w.value=C,x.value=!0}const m=te(()=>g.value.filter(C=>C.is_active===1).length),V=[{title:"#",dataIndex:"chunk_index",key:"idx",width:52},{title:"内容",key:"content"},{title:"启用",key:"active",width:70},{title:"",key:"action",width:46}];return(C,v)=>{const N=f("a-button"),F=f("a-switch"),G=f("a-table"),ee=f("a-drawer");return p(),S(ee,{open:o.value,"onUpdate:open":v[6]||(v[6]=$=>o.value=$),width:"800",placement:"right"},{title:n(()=>{var $;return[d("div",lt,[v[7]||(v[7]=d("span",null,"分段管理",-1)),d("span",st,y(($=u.doc)==null?void 0:$.title)+" · "+y(m.value)+"/"+y(g.value.length)+" 启用",1)])]}),default:n(()=>[b.value.length?(p(),L("div",rt,[d("span",it,"已选 "+y(b.value.length)+" 项",1),t(N,{size:"small",loading:q.value,onClick:v[0]||(v[0]=$=>T("enable"))},{default:n(()=>v[8]||(v[8]=[k("批量启用")])),_:1},8,["loading"]),t(N,{size:"small",loading:q.value,onClick:v[1]||(v[1]=$=>T("disable"))},{default:n(()=>v[9]||(v[9]=[k("批量禁用")])),_:1},8,["loading"]),t(N,{size:"small",danger:"",loading:q.value,onClick:v[2]||(v[2]=$=>T("delete"))},{default:n(()=>v[10]||(v[10]=[k("批量删除")])),_:1},8,["loading"]),t(N,{size:"small",type:"text",onClick:v[3]||(v[3]=$=>b.value=[])},{default:n(()=>v[11]||(v[11]=[k("取消选择")])),_:1})])):E("",!0),t(G,{columns:V,"data-source":g.value,loading:r.value,"row-key":"id",size:"small",pagination:{pageSize:20,size:"small",showTotal:$=>`共 ${$} 段`},"row-selection":{selectedRowKeys:b.value,onChange:$=>b.value=$}},{bodyCell:n(({column:$,record:I})=>[$.key==="idx"?(p(),L("span",ut,y(I.chunk_index+1),1)):$.key==="content"?(p(),L(Q,{key:1},[d("div",dt,y(I.title||"(无标题)"),1),d("div",ct,y(I.content),1)],64)):$.key==="active"?(p(),S(F,{key:2,checked:I.is_active===1,size:"small",loading:h.value===I.id,onChange:J=>D(I,J)},null,8,["checked","loading","onChange"])):$.key==="action"?(p(),S(N,{key:3,size:"small",type:"text",onClick:J=>c(I)},{icon:n(()=>[t(M(Pe))]),_:2},1032,["onClick"])):E("",!0)]),emptyText:n(()=>v[12]||(v[12]=[d("div",{class:"py-8 text-xs",style:{color:"var(--text-3)"}},"该文档暂无分段",-1)])),_:1},8,["data-source","loading","pagination","row-selection"]),t(ot,{open:x.value,"onUpdate:open":v[4]||(v[4]=$=>x.value=$),chunk:w.value,onSaved:v[5]||(v[5]=$=>{P(),_("changed")})},null,8,["open","chunk"])]),_:1},8,["open"])}}},mt={class:"flex gap-2 mb-3 flex-wrap text-xs",style:{color:"var(--text-3)"}},vt={class:"mono text-xs p-3 rounded-lg overflow-auto",style:{background:"rgba(0,0,0,0.15)",color:"var(--text-2)","max-height":"calc(100vh - 180px)","white-space":"pre-wrap"}},ft={__name:"DocPreviewDrawer",props:R({docId:{type:Number,default:0}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:["update:open"],setup(u){const l=X(u,"open"),o=u,i=z(null),_=z(!1);return Y([l,()=>o.docId],async([g,r])=>{if(!(!g||!r)){_.value=!0,i.value=null;try{const b=await Fe(r);i.value=b.data}finally{_.value=!1}}}),(g,r)=>{const b=f("a-skeleton"),x=f("a-tag"),w=f("a-drawer");return p(),S(w,{open:l.value,"onUpdate:open":r[0]||(r[0]=h=>l.value=h),title:i.value?i.value.title:"文档原文",width:"640",placement:"right"},{default:n(()=>[_.value?(p(),S(b,{key:0,active:"",paragraph:{rows:10}})):i.value?(p(),L(Q,{key:1},[d("div",mt,[t(x,{bordered:!1},{default:n(()=>[k(y(i.value.source_type||"text"),1)]),_:1}),d("span",null,y(i.value.chunk_count)+" 个分段",1),d("span",null,y((i.value.content||"").length)+" 字",1),d("span",null,y(M(Me)(i.value.created_at)),1)]),d("div",vt,y(i.value.content),1)],64)):E("",!0)]),_:1},8,["open","title"])}}},xt={class:"grid grid-cols-2 gap-4"},_t={key:0,class:"glass p-3 mt-2 text-xs",style:{color:"var(--text-2)"}},gt={__name:"RechunkModal",props:R({doc:{type:Object,default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:R(["done"],["update:open"]),setup(u,{emit:l}){const o=X(u,"open"),i=u,_=l,g=z(!1),r=K({max_len:500,overlap:50}),b=z(null);Y(o,w=>{w&&(b.value=null)});async function x(){var w,h;if(r.overlap>=r.max_len){j.warning("overlap 必须小于 max_len");return}g.value=!0;try{const P=await He(i.doc.id,{max_len:r.max_len,overlap:r.overlap});b.value={...P.data,max_len:r.max_len,overlap:r.overlap},j.success(`重切完成:${((w=P.data)==null?void 0:w.old_count)??"?"} 段 → ${((h=P.data)==null?void 0:h.chunk_count)??"?"} 段`),_("done")}finally{g.value=!1}}return(w,h)=>{var m;const P=f("a-alert"),D=f("a-input-number"),q=f("a-form-item"),T=f("a-form"),c=f("a-modal");return p(),S(c,{open:o.value,"onUpdate:open":h[2]||(h[2]=V=>o.value=V),title:`重新分段:${((m=u.doc)==null?void 0:m.title)||""}`,"confirm-loading":g.value,"ok-text":"覆盖并重切","ok-button-props":{danger:!0},onOk:x},{default:n(()=>[t(P,{type:"warning","show-icon":"",class:"!mb-4",message:"将用文档原文按新参数重新切分,原有全部分段(含人工编辑过的内容与启停状态)会被替换"}),t(T,{layout:"vertical"},{default:n(()=>[d("div",xt,[t(q,{label:"分段长度 max_len(100~2000 字)"},{default:n(()=>[t(D,{value:r.max_len,"onUpdate:value":h[0]||(h[0]=V=>r.max_len=V),min:100,max:2e3,step:50,class:"!w-full"},null,8,["value"])]),_:1}),t(q,{label:"重叠长度 overlap(0~200 字)"},{default:n(()=>[t(D,{value:r.overlap,"onUpdate:value":h[1]||(h[1]=V=>r.overlap=V),min:0,max:200,step:10,class:"!w-full"},null,8,["value"])]),_:1})]),h[3]||(h[3]=d("div",{class:"text-xs",style:{color:"var(--text-3)"}},"经验值:结构化条目类 300~500 / 长文叙述类 600~800;overlap 取 max_len 的 10% 左右",-1))]),_:1}),b.value?(p(),L("div",_t," 完成:旧 "+y(b.value.old_count)+" 段 → 新 "+y(b.value.chunk_count)+" 段(max_len="+y(b.value.max_len)+" / overlap="+y(b.value.overlap)+") ",1)):E("",!0)]),_:1},8,["open","title","confirm-loading"])}}},yt={key:2,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4"},kt=["onClick"],bt={class:"flex items-start justify-between"},wt={class:"text-sm font-medium truncate",style:{color:"var(--text-1)"}},ht={class:"text-xs mt-1 h-8 overflow-hidden",style:{color:"var(--text-3)"}},$t={class:"flex items-center gap-4 mt-3 text-xs",style:{color:"var(--text-2)"}},Ot={class:"flex items-center gap-1"},Ct={class:"flex items-center gap-1"},zt={class:"glass p-4 mb-4"},qt={class:"!mb-1"},St={key:0,class:"mt-3"},Pt={class:"flex items-center gap-3 mb-2 flex-wrap"},Lt={class:"text-xs",style:{color:"var(--text-2)"}},Mt={style:{color:"var(--ok)"}},jt={style:{color:"var(--err)"}},Dt={class:"max-h-44 overflow-auto rounded-lg",style:{border:"1px solid var(--glass-border)"}},Ut={class:"truncate max-w-[280px]",style:{color:"var(--text-1)"}},Bt={class:"mono",style:{color:"var(--text-3)"}},Tt={class:"ml-auto flex items-center gap-2"},It={class:"flex items-center gap-6 flex-wrap"},Vt={class:"flex items-center gap-2"},Nt={class:"flex items-center gap-2"},At={class:"glass p-4"},Et=["onClick"],Ft={class:"text-[11px] mono",style:{color:"var(--text-3)"}},Ht={key:2,class:"mono"},Rt={key:3,class:"mono text-xs",style:{color:"var(--text-3)"}},Qt={key:4,class:"flex gap-1"},Jt=".txt,.md,.markdown,.html,.htm,.pdf,.docx,.xlsx,.xls,.csv",Kt={__name:"index",setup(u){const l=je(),o=Ue(),i=z([]),_=z(!1),g=z(!1);async function r(){_.value=!0;try{const a=await Re({silent:!0});i.value=a.data||[]}finally{_.value=!1}}async function b(a){await Je(a.id),j.success(`已删除「${a.name}」`),r()}const x=te(()=>i.value.find(a=>a.id===Number(l.query.lib))||null);function w(a){o.push({query:{lib:a.id}})}function h(){o.push({query:{}}),r()}const P=z([]),D=z(!1);async function q(){if(l.query.lib){D.value=!0;try{const a=await Qe(Number(l.query.lib));P.value=a.data||[]}finally{D.value=!1}}}Y(()=>l.query.lib,a=>{a&&q()});async function T(a){await We(a.id),j.success(`已删除「${a.title}」`),q(),r()}const c=K({maxLen:500,overlap:50,autoStart:!0,importing:!1,queue:[]}),m=te(()=>{const a=c.queue;return{total:a.length,pending:a.filter(e=>e.status==="pending").length,success:a.filter(e=>e.status==="success").length,error:a.filter(e=>e.status==="error").length}});let V=null;function C(a){return c.queue.some(e=>e.name===a.name&&e.size===a.size)?!1:a.size>50*1024*1024?(j.warning(`「${a.name}」超过 50MB,已跳过`),!1):(c.queue.push({uid:a.uid||`${Date.now()}_${a.name}`,file:a,name:a.name,size:a.size,status:"pending",chunkCount:0,error:""}),c.autoStart&&!c.importing&&(clearTimeout(V),V=setTimeout(F,400)),!1)}function v(a){a.status!=="uploading"&&(c.queue=c.queue.filter(e=>e.uid!==a.uid))}function N(){c.queue=c.queue.filter(a=>a.status==="uploading")}async function F(){var e;if(c.importing)return;if(c.overlap>=c.maxLen){j.warning("overlap 必须小于 max_len");return}if(c.queue.forEach(O=>{O.status==="error"&&(O.status="pending",O.error="")}),!c.queue.some(O=>O.status==="pending"))return;const a=Number(l.query.lib);if(!a){j.warning("请先进入目标知识库");return}c.importing=!0;try{for(;;){const A=c.queue.find(B=>B.status==="pending");if(!A)break;A.status="uploading",A.error="";try{const B=new FormData;B.append("library_id",String(a)),B.append("file",A.file),B.append("max_len",String(c.maxLen)),B.append("overlap",String(c.overlap));const H=await Ge(B,{silent:!0});A.status="success",A.chunkCount=((e=H.data)==null?void 0:e.chunk_count)??0}catch(B){A.status="error",A.error=B.message||"导入失败"}}const O=m.value;O.error?j.warning(`批量导入完成:成功 ${O.success}、失败 ${O.error}(失败项可点重试)`):j.success(`批量导入完成:${O.success} 个文件全部成功`),q(),r()}finally{c.importing=!1}}async function G(a){a.status="pending",F()}function ee(a){return a<1024?a+" B":a<1024*1024?(a/1024).toFixed(0)+" KB":(a/1024/1024).toFixed(1)+" MB"}const $=z(!1),I=z(!1),J=z(!1),W=z(null);function se(a){W.value=a,$.value=!0}function ke(a){W.value=a,I.value=!0}function be(a){W.value=a,J.value=!0}const we=[{title:"文档",key:"title"},{title:"类型",dataIndex:"source_type",key:"type",width:80},{title:"分段",dataIndex:"chunk_count",key:"chunks",width:70},{title:"导入时间",key:"time",width:130},{title:"操作",key:"action",width:230}];return De(()=>{r(),l.query.lib&&q()}),(a,e)=>{var ie;const O=f("a-button"),A=f("a-skeleton"),B=f("a-popconfirm"),H=f("a-tag"),he=f("a-upload-dragger"),$e=f("a-progress"),Oe=f("a-switch"),Ce=f("a-tooltip"),re=f("a-input-number"),ze=f("a-collapse-panel"),qe=f("a-collapse"),Se=f("a-table");return p(),L("div",null,[x.value?(p(),L(Q,{key:1},[t(ve,{title:x.value.name,desc:`${x.value.doc_count} 文档 · ${x.value.chunk_count} 分段 · 来源 ${x.value.source}`},{actions:n(()=>[t(O,{onClick:h},{icon:n(()=>[t(M(Te))]),default:n(()=>[e[18]||(e[18]=k("返回库列表"))]),_:1}),t(O,{onClick:e[5]||(e[5]=s=>M(o).push({path:"/kb/search",query:{lib:x.value.id}}))},{icon:n(()=>[t(M(Ie))]),default:n(()=>[e[19]||(e[19]=k("去检索 "))]),_:1})]),_:1},8,["title","desc"]),d("div",zt,[t(he,{"before-upload":C,"show-upload-list":!1,accept:Jt,multiple:""},{default:n(()=>[d("p",qt,[t(M(ae),{class:"text-2xl",style:{color:"var(--primary)"}})]),e[20]||(e[20]=d("p",{class:"text-sm",style:{color:"var(--text-1)"}},"点击或拖拽文件导入(可一次选多个)",-1)),e[21]||(e[21]=d("p",{class:"text-xs",style:{color:"var(--text-3)"}},"支持 txt / md / html / pdf / docx / xlsx / csv 混合批量,单文件 ≤ 50MB,自动分段",-1))]),_:1}),c.queue.length?(p(),L("div",St,[d("div",Pt,[d("span",Lt,[k(" 队列 "+y(m.value.total)+" 个:成功 ",1),d("span",Mt,y(m.value.success),1),e[22]||(e[22]=k(" · 失败 ")),d("span",jt,y(m.value.error),1),k(" · 待导入 "+y(m.value.pending),1)]),c.importing||m.value.success+m.value.error>0?(p(),S($e,{key:0,class:"flex-1 min-w-[140px] !mb-0",percent:Math.round((m.value.success+m.value.error)/Math.max(m.value.total,1)*100),size:"small",status:c.importing?"active":m.value.error?"exception":"success"},null,8,["percent","status"])):E("",!0),t(Oe,{checked:c.autoStart,"onUpdate:checked":e[6]||(e[6]=s=>c.autoStart=s),size:"small","checked-children":"自动导入","un-checked-children":"手动"},null,8,["checked"]),m.value.pending||m.value.error?(p(),S(O,{key:1,size:"small",type:"primary",loading:c.importing,onClick:F},{default:n(()=>[k(y(m.value.error&&!m.value.pending?"重试失败项":"开始导入"),1)]),_:1},8,["loading"])):E("",!0),t(O,{size:"small",disabled:c.importing,onClick:N},{default:n(()=>e[23]||(e[23]=[k("清空列表")])),_:1},8,["disabled"])]),d("div",Dt,[(p(!0),L(Q,null,ue(c.queue,s=>(p(),L("div",{key:s.uid,class:"flex items-center gap-2 px-3 py-1.5 text-xs",style:{"border-bottom":"1px solid var(--glass-border)"}},[t(M(me),{style:{color:"var(--text-3)"}}),d("span",Ut,y(s.name),1),d("span",Bt,y(ee(s.size)),1),d("span",Tt,[s.status==="pending"?(p(),S(H,{key:0,bordered:!1},{default:n(()=>e[24]||(e[24]=[k("等待")])),_:1})):s.status==="uploading"?(p(),S(H,{key:1,color:"processing",bordered:!1},{default:n(()=>e[25]||(e[25]=[k("导入中…")])),_:1})):s.status==="success"?(p(),S(H,{key:2,color:"success",bordered:!1},{default:n(()=>[k("成功 · "+y(s.chunkCount)+" 段",1)]),_:2},1024)):(p(),S(Ce,{key:3,title:s.error},{default:n(()=>[t(H,{color:"error",bordered:!1,class:"cursor-help"},{default:n(()=>e[26]||(e[26]=[k("失败")])),_:1})]),_:2},1032,["title"])),s.status==="error"?(p(),S(O,{key:4,size:"small",type:"link",class:"!px-0",onClick:U=>G(s)},{default:n(()=>e[27]||(e[27]=[k("重试")])),_:2},1032,["onClick"])):E("",!0),s.status!=="uploading"?(p(),S(O,{key:5,size:"small",type:"text",class:"!px-1",onClick:U=>v(s)},{default:n(()=>[t(M(pe),{style:{"font-size":"11px"}})]),_:2},1032,["onClick"])):E("",!0)])]))),128))])])):E("",!0),t(qe,{ghost:"",size:"small",class:"mt-2"},{default:n(()=>[t(ze,{key:"params",header:"分段参数(高级选项,默认 500/50 即可,对整批生效)"},{default:n(()=>[d("div",It,[d("div",Vt,[e[28]||(e[28]=d("span",{class:"text-xs",style:{color:"var(--text-3)"}},"分段长度 max_len",-1)),t(re,{value:c.maxLen,"onUpdate:value":e[7]||(e[7]=s=>c.maxLen=s),min:100,max:2e3,step:50,size:"small"},null,8,["value"])]),d("div",Nt,[e[29]||(e[29]=d("span",{class:"text-xs",style:{color:"var(--text-3)"}},"重叠 overlap",-1)),t(re,{value:c.overlap,"onUpdate:value":e[8]||(e[8]=s=>c.overlap=s),min:0,max:200,step:10,size:"small"},null,8,["value"])]),e[30]||(e[30]=d("span",{class:"text-xs",style:{color:"var(--text-3)"}},"条目类知识 300~500;长文 600~800;overlap 约取 10%;想改参数先关掉「自动导入」",-1))])]),_:1})]),_:1})]),d("div",At,[t(Se,{columns:we,"data-source":P.value,loading:D.value,"row-key":"id",size:"small",pagination:{pageSize:15,size:"small",showTotal:s=>`共 ${s} 篇`}},{bodyCell:n(({column:s,record:U})=>[s.key==="title"?(p(),L(Q,{key:0},[d("div",{class:"text-xs font-medium cursor-pointer hover:underline",style:{color:"var(--text-1)"},onClick:Z=>se(U)},y(U.title),9,Et),d("div",Ft,y(U.source_file||"-"),1)],64)):s.key==="type"?(p(),S(H,{key:1,bordered:!1},{default:n(()=>[k(y(U.source_type||"text"),1)]),_:2},1024)):s.key==="chunks"?(p(),L("span",Ht,y(U.chunk_count),1)):s.key==="time"?(p(),L("span",Rt,y(M(Ve)(U.created_at)),1)):s.key==="action"?(p(),L("div",Qt,[t(O,{size:"small",type:"link",onClick:Z=>se(U)},{default:n(()=>e[31]||(e[31]=[k("分段")])),_:2},1032,["onClick"]),t(O,{size:"small",type:"link",onClick:Z=>ke(U)},{default:n(()=>e[32]||(e[32]=[k("原文")])),_:2},1032,["onClick"]),t(O,{size:"small",type:"link",onClick:Z=>be(U)},{default:n(()=>[t(M(le)),e[33]||(e[33]=k("重切"))]),_:2},1032,["onClick"]),t(B,{title:"删除文档及其全部分段?","ok-text":"删除","cancel-text":"取消",onConfirm:Z=>T(U)},{default:n(()=>[t(O,{size:"small",type:"link",danger:""},{default:n(()=>e[34]||(e[34]=[k("删除")])),_:1})]),_:2},1032,["onConfirm"])])):E("",!0)]),emptyText:n(()=>[t(fe,{text:"库还是空的,导入第一个文档让它变得有用。","action-text":""})]),_:1},8,["data-source","loading","pagination"])])],64)):(p(),L(Q,{key:0},[t(ve,{title:"知识库管理",desc:"库 → 文档 → 分段 三级结构;支持 txt/md/html/pdf/docx/xlsx/csv 多格式批量导入自动分段"},{actions:n(()=>[t(O,{onClick:e[0]||(e[0]=s=>M(o).push("/kb-crawl"))},{icon:n(()=>[t(M(Be))]),default:n(()=>[e[15]||(e[15]=k("药品抓取"))]),_:1}),t(O,{type:"primary",onClick:e[1]||(e[1]=s=>g.value=!0)},{icon:n(()=>[t(M(de))]),default:n(()=>[e[16]||(e[16]=k("新建知识库"))]),_:1})]),_:1}),t(Xe,{id:"kb",text:"点击库卡片进入文档管理;导入文档时可展开「分段参数」自定义切分粒度,导入后还能对单个文档重新分段。"}),_.value&&!i.value.length?(p(),S(A,{key:0,active:"",paragraph:{rows:4}})):i.value.length?(p(),L("div",yt,[(p(!0),L(Q,null,ue(i.value,s=>(p(),L("div",{key:s.id,class:"glass glass-hover p-4 cursor-pointer",onClick:U=>w(s)},[d("div",bt,[d("div",wt,y(s.name),1),t(B,{title:"删除库会连带删除全部文档与分段,确认?","ok-text":"删除","cancel-text":"取消",onConfirm:ce(U=>b(s),["stop"])},{default:n(()=>[t(O,{size:"small",type:"text",danger:"",onClick:e[3]||(e[3]=ce(()=>{},["stop"]))},{icon:n(()=>[t(M(pe))]),_:1})]),_:2},1032,["onConfirm"])]),d("div",ht,y(s.description||"(无描述)"),1),d("div",$t,[d("span",Ot,[t(M(me)),k(y(s.doc_count)+" 文档",1)]),d("span",Ct,[t(M(oe)),k(y(s.chunk_count)+" 分段",1)]),t(H,{bordered:!1,class:"!ml-auto !mr-0"},{default:n(()=>[k(y(s.source),1)]),_:2},1024)])],8,kt))),128)),d("div",{class:"p-4 rounded-xl cursor-pointer flex flex-col items-center justify-center min-h-[124px] transition-colors",style:{border:"1.5px dashed var(--glass-border)",color:"var(--text-3)"},onClick:e[4]||(e[4]=s=>g.value=!0)},[t(M(de),{class:"text-xl mb-1"}),e[17]||(e[17]=d("span",{class:"text-xs"},"新建知识库",-1))])])):(p(),S(fe,{key:1,text:"还没有知识库。建一个库并导入第一个文档,Agent 就能引用你的私有知识出方。","action-text":"新建知识库",onAction:e[2]||(e[2]=s=>g.value=!0)}))],64)),t(at,{open:g.value,"onUpdate:open":e[9]||(e[9]=s=>g.value=s),onCreated:r},null,8,["open"]),t(pt,{open:$.value,"onUpdate:open":e[10]||(e[10]=s=>$.value=s),doc:W.value,onChanged:e[11]||(e[11]=s=>{q(),r()})},null,8,["open","doc"]),t(ft,{open:I.value,"onUpdate:open":e[12]||(e[12]=s=>I.value=s),"doc-id":((ie=W.value)==null?void 0:ie.id)||0},null,8,["open","doc-id"]),t(gt,{open:J.value,"onUpdate:open":e[13]||(e[13]=s=>J.value=s),doc:W.value,onDone:e[14]||(e[14]=s=>{q(),r()})},null,8,["open","doc"])])}}};export{Kt as default}; diff --git a/view/admin-dist/assets/index-D_jM3jWS.js b/view/admin-dist/assets/index-D_jM3jWS.js new file mode 100644 index 0000000..fda7f8d --- /dev/null +++ b/view/admin-dist/assets/index-D_jM3jWS.js @@ -0,0 +1 @@ +import{c as r,I as S,u as z,r as V,a as y,b as j,d as u,e as U,w as o,f as C,g as d,n as N,h as P,i as B,o as L,j as v,U as M,k as H,l as h}from"./index-C0Houbmd.js";import{S as T}from"./SafetyOutlined-CY7qTfTh.js";var A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};function _(l){for(var a=1;af.value=!1,500),h.error(c.message||"账号、密码或验证码错误")}finally{p.value=!1}}return(c,e)=>{const b=d("a-input"),m=d("a-form-item"),w=d("a-input-password"),O=d("a-button"),k=d("a-form");return L(),j("div",I,[u("div",{class:N(["glass-strong flex overflow-hidden max-w-3xl w-full",{shake:f.value}]),style:{"border-radius":"16px"}},[e[7]||(e[7]=U('',1)),u("div",R,[e[4]||(e[4]=u("h2",{class:"text-lg font-semibold mb-1",style:{color:"var(--text-1)"}},"欢迎回来",-1)),e[5]||(e[5]=u("p",{class:"text-xs mb-6",style:{color:"var(--text-3)"}},"请使用管理员账号登录",-1)),r(k,{layout:"vertical",onKeyup:C(x,["enter"])},{default:o(()=>[r(m,{label:"账号"},{default:o(()=>[r(b,{value:t.username,"onUpdate:value":e[0]||(e[0]=i=>t.username=i),size:"large",placeholder:"请输入账号",autocomplete:"username"},{prefix:o(()=>[r(v(M),{style:{color:"var(--text-3)"}})]),_:1},8,["value"])]),_:1}),r(m,{label:"密码"},{default:o(()=>[r(w,{value:t.password,"onUpdate:value":e[1]||(e[1]=i=>t.password=i),size:"large",placeholder:"请输入密码",autocomplete:"current-password"},{prefix:o(()=>[r(v(g),{style:{color:"var(--text-3)"}})]),_:1},8,["value"])]),_:1}),r(m,{label:"验证码"},{default:o(()=>[r(b,{value:t.captcha,"onUpdate:value":e[2]||(e[2]=i=>t.captcha=i),size:"large",placeholder:"请输入验证码",maxlength:6},{prefix:o(()=>[r(v(T),{style:{color:"var(--text-3)"}})]),_:1},8,["value"])]),_:1}),r(O,{type:"primary",size:"large",block:"",loading:p.value,onClick:x},{default:o(()=>e[3]||(e[3]=[H(" 登 录 ")])),_:1},8,["loading"])]),_:1}),e[6]||(e[6]=u("p",{class:"text-xs mt-6 mb-0 text-center",style:{color:"var(--text-3)"}}," 内部系统 · 连续失败 5 次将锁定 10 分钟 ",-1))])],2)])}}};export{W as default}; diff --git a/view/admin-dist/assets/index-Din2I8-x.js b/view/admin-dist/assets/index-Din2I8-x.js new file mode 100644 index 0000000..6a436d7 --- /dev/null +++ b/view/admin-dist/assets/index-Din2I8-x.js @@ -0,0 +1 @@ +import{c as l,I as me,a as m,P as ye,t as fe,r as ge,p as be,b as v,x as w,y as x,w as o,g as p,F,C as H,i as xe,o as r,j as d,k as g,ar as ke,af as W,d as s,am as we,D as i,as as he,A as Y,at as Ce,ak as Oe,an as $e,z as Se,E as ze,l as h}from"./index-C0Houbmd.js";import{j as Pe,d as Le,l as Te,c as Ue,m as G,n as je,o as De,p as Ee,q as Ne}from"./kb-DlfA6vCV.js";import{_ as Me}from"./PageHeader-BlIlnAwG.js";import{_ as Ae}from"./HelpTip-C9tfcO7G.js";import{_ as J}from"./EmptyHint-2CB843hO.js";var Be={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"};function Q(b){for(var c=1;c{var e;return((e=f.value.find(_=>_.id===a))==null?void 0:e.name)||`库#${a}`},Z=a=>{var e;return((e=y.value.find(_=>_.name===a))==null?void 0:e.label)||a},q=["周日","周一","周二","周三","周四","周五","周六"];function K(a){switch(a.schedule_type){case"interval":return`每 ${a.interval_hours} 小时`;case"daily":return`每天 ${String(a.run_at_hour).padStart(2,"0")}:00`;case"weekly":return`${q[a.run_at_weekday]||"周一"} ${String(a.run_at_hour).padStart(2,"0")}:00`;default:return"仅手动"}}const $={running:{color:"processing",label:"运行中"},success:{color:"success",label:"成功"},partial:{color:"warning",label:"部分成功"},failed:{color:"error",label:"失败"}},S=m(!1),C=m(0),L=m(!1),n=ge({name:"",source:"zhongyoo",library_id:void 0,schedule_type:"daily",interval_hours:24,run_at_hour:3,run_at_weekday:1,items_per_run:50,status:1});function I(){var a,e;C.value=0,Object.assign(n,{name:"中药药材库每日增量",source:((a=y.value[0])==null?void 0:a.name)||"zhongyoo",library_id:(e=f.value[0])==null?void 0:e.id,schedule_type:"daily",interval_hours:24,run_at_hour:3,run_at_weekday:1,items_per_run:50,status:1}),S.value=!0}function ee(a){C.value=a.id,Object.assign(n,{name:a.name,source:a.source,library_id:a.library_id,schedule_type:a.schedule_type,interval_hours:a.interval_hours,run_at_hour:a.run_at_hour,run_at_weekday:a.run_at_weekday,items_per_run:a.items_per_run,status:a.status}),S.value=!0}async function te(){if(!n.name.trim()){h.warning("请填写任务名称");return}if(!n.library_id){h.warning("请选择目标知识库");return}L.value=!0;try{C.value?await G(C.value,{...n}):await Ne({...n}),h.success(C.value?"任务已更新":"任务已创建"),S.value=!1,O()}finally{L.value=!1}}const T=m(!1);async function ae(){var a,e;T.value=!0;try{const _=await Ue({name:"中药药材库",description:"定时抓取的中药材知识(含别名/性味归经/功效/禁忌)",source:"manual"});h.success("已创建「中药药材库」"),await V(),n.library_id=((a=_.data)==null?void 0:a.id)||((e=f.value.find(z=>z.name==="中药药材库"))==null?void 0:e.id)}finally{T.value=!1}}async function se(a){const e=await je(a.id);h.success(e.message||"已启动抓取"),O()}async function le(a){await G(a.id,{name:a.name,source:a.source,library_id:a.library_id,schedule_type:a.schedule_type,interval_hours:a.interval_hours,run_at_hour:a.run_at_hour,run_at_weekday:a.run_at_weekday,items_per_run:a.items_per_run,status:a.status===1?0:1}),h.success(a.status===1?"任务已停用":"任务已启用"),O()}async function ne(a){await Ee(a.id),h.success("任务已删除"),O()}const U=m(!1),j=m(!1),D=m([]),E=m(null);async function oe(a){E.value=a,U.value=!0,j.value=!0;try{const e=await De(a.id,30);D.value=e.data||[]}finally{j.value=!1}}const re=be(()=>u.value.some(a=>a.running));return(a,e)=>{const _=p("a-button"),z=p("a-alert"),R=p("a-skeleton"),P=p("a-tag"),ie=p("a-switch"),ue=p("a-popconfirm"),de=p("a-input"),N=p("a-select"),ce=p("a-tooltip"),_e=p("a-segmented"),M=p("a-input-number"),ve=p("a-modal"),pe=p("a-drawer");return r(),v("div",null,[l(Me,{title:"药品抓取",desc:"定时从公开药典站点抓取中药材与别名信息入知识库;断点续抓、按药名去重更新"},{actions:o(()=>[l(_,{onClick:e[0]||(e[0]=t=>d(c).push("/kb"))},{icon:o(()=>[l(d(ke))]),default:o(()=>[e[11]||(e[11]=g("知识库管理"))]),_:1}),l(_,{type:"primary",onClick:I},{icon:o(()=>[l(d(W))]),default:o(()=>[e[12]||(e[12]=g("新建抓取任务"))]),_:1})]),_:1}),l(Ae,{id:"kb-crawl",text:"任务按「单次限量」分批抓取(默认每次 50 味药,约 1-3 分钟),游标自动续接,抓完一轮转为增量更新。抓到的药材按药名去重:已存在则刷新内容,检索时按别名也能命中。"}),re.value?(r(),w(z,{key:0,type:"info","show-icon":"",class:"!mb-4",message:"有任务正在抓取中,本页 5 秒自动刷新;完整结果看「运行历史」"})):x("",!0),B.value&&!u.value.length?(r(),w(R,{key:1,active:"",paragraph:{rows:4}})):u.value.length?(r(),v("div",qe,[(r(!0),v(F,null,H(u.value,t=>(r(),v("div",{key:t.id,class:"glass p-4"},[s("div",Ie,[l(d(we),{style:{color:"var(--primary)"}}),s("span",Re,i(t.name),1),t.running?(r(),w(P,{key:0,color:"processing",bordered:!1},{default:o(()=>[l(d(he),{class:"mr-1"}),e[13]||(e[13]=g("抓取中 "))]),_:1})):t.last_status&&$[t.last_status]?(r(),w(P,{key:1,color:$[t.last_status].color,bordered:!1},{default:o(()=>[g(i($[t.last_status].label),1)]),_:2},1032,["color"])):x("",!0),l(ie,{class:"!ml-auto",checked:t.status===1,size:"small","checked-children":"启用","un-checked-children":"停用",disabled:t.running,onClick:k=>le(t)},null,8,["checked","disabled","onClick"])]),s("div",Fe,[e[14]||(e[14]=s("span",{style:{color:"var(--text-3)"}},"抓取源",-1)),s("span",He,i(Z(t.source)),1),e[15]||(e[15]=s("span",{style:{color:"var(--text-3)"}},"目标库",-1)),s("span",{class:"text-right cursor-pointer hover:underline",style:{color:"var(--primary)"},onClick:k=>d(c).push({path:"/kb",query:{lib:t.library_id}})},i(X(t.library_id)),9,We),e[16]||(e[16]=s("span",{style:{color:"var(--text-3)"}},"调度",-1)),s("span",Ye,i(K(t))+" · 每批 "+i(t.items_per_run)+" 条",1),e[17]||(e[17]=s("span",{style:{color:"var(--text-3)"}},"断点游标",-1)),s("span",Ge,i(t.progress_offset),1),e[18]||(e[18]=s("span",{style:{color:"var(--text-3)"}},"上次运行",-1)),s("span",Je,i(t.last_run_at?d(Y)(t.last_run_at):"从未运行"),1)]),t.last_message?(r(),v("div",Qe,i(t.last_message),1)):x("",!0),s("div",Xe,[l(_,{size:"small",type:"primary",loading:t.running,disabled:t.status!==1,onClick:k=>se(t)},{icon:o(()=>[l(d(A))]),default:o(()=>[g(i(t.running?"抓取中":"立即抓取"),1)]),_:2},1032,["loading","disabled","onClick"]),l(_,{size:"small",onClick:k=>oe(t)},{icon:o(()=>[l(d(Ce))]),default:o(()=>[e[19]||(e[19]=g("运行历史"))]),_:2},1032,["onClick"]),l(_,{size:"small",onClick:k=>ee(t)},{icon:o(()=>[l(d(Oe))]),default:o(()=>[e[20]||(e[20]=g("编辑"))]),_:2},1032,["onClick"]),l(ue,{title:"删除任务不会删除已抓取的知识库内容,确认?","ok-text":"删除","cancel-text":"取消",onConfirm:k=>ne(t)},{default:o(()=>[l(_,{size:"small",danger:"",disabled:t.running},{icon:o(()=>[l(d($e))]),_:2},1032,["disabled"])]),_:2},1032,["onConfirm"])])]))),128))])):(r(),w(J,{key:2,text:"还没有抓取任务。建一个定时任务,让中药材和别名信息自动流进知识库。","action-text":"新建抓取任务",onAction:I})),l(ve,{open:S.value,"onUpdate:open":e[9]||(e[9]=t=>S.value=t),title:C.value?"编辑抓取任务":"新建抓取任务","confirm-loading":L.value,width:560,onOk:te},{default:o(()=>[s("div",Ze,[s("div",null,[e[21]||(e[21]=s("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"任务名称",-1)),l(de,{value:n.name,"onUpdate:value":e[1]||(e[1]=t=>n.name=t),placeholder:"如:中药药材库每日增量",maxlength:50},null,8,["value"])]),s("div",null,[e[22]||(e[22]=s("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"抓取源",-1)),l(N,{value:n.source,"onUpdate:value":e[2]||(e[2]=t=>n.source=t),class:"w-full",options:y.value.map(t=>({label:t.label,value:t.name}))},null,8,["value","options"])]),s("div",null,[e[24]||(e[24]=s("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"目标知识库(抓到的药材写进这个库)",-1)),s("div",Ke,[l(N,{value:n.library_id,"onUpdate:value":e[3]||(e[3]=t=>n.library_id=t),class:"flex-1",placeholder:"选择知识库",options:f.value.map(t=>({label:`${t.name}(${t.doc_count} 文档)`,value:t.id}))},null,8,["value","options"]),l(ce,{title:"快速创建一个「中药药材库」"},{default:o(()=>[l(_,{loading:T.value,onClick:ae},{default:o(()=>[l(d(W)),e[23]||(e[23]=g("快速建库"))]),_:1},8,["loading"])]),_:1})])]),s("div",null,[e[25]||(e[25]=s("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"调度方式",-1)),l(_e,{value:n.schedule_type,"onUpdate:value":e[4]||(e[4]=t=>n.schedule_type=t),block:"",options:[{label:"仅手动",value:"manual"},{label:"每N小时",value:"interval"},{label:"每天",value:"daily"},{label:"每周",value:"weekly"}]},null,8,["value"])]),s("div",et,[n.schedule_type==="interval"?(r(),v("div",tt,[e[26]||(e[26]=s("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"间隔小时",-1)),l(M,{value:n.interval_hours,"onUpdate:value":e[5]||(e[5]=t=>n.interval_hours=t),min:1,max:168},null,8,["value"])])):x("",!0),n.schedule_type==="weekly"?(r(),v("div",at,[e[27]||(e[27]=s("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"星期",-1)),l(N,{value:n.run_at_weekday,"onUpdate:value":e[6]||(e[6]=t=>n.run_at_weekday=t),style:{width:"100px"},options:q.map((t,k)=>({label:t,value:k}))},null,8,["value","options"])])):x("",!0),n.schedule_type==="daily"||n.schedule_type==="weekly"?(r(),v("div",st,[e[28]||(e[28]=s("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"整点(24时制)",-1)),l(M,{value:n.run_at_hour,"onUpdate:value":e[7]||(e[7]=t=>n.run_at_hour=t),min:0,max:23},null,8,["value"])])):x("",!0),s("div",null,[e[29]||(e[29]=s("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"单次限量(礼貌抓取)",-1)),l(M,{value:n.items_per_run,"onUpdate:value":e[8]||(e[8]=t=>n.items_per_run=t),min:1,max:500,step:10},null,8,["value"])])]),l(z,{type:"info","show-icon":"",message:"建议保持默认:每天凌晨 3 点抓 50 条,约 18 天抓完全量(899 味),之后自动转增量更新。"})])]),_:1},8,["open","title","confirm-loading"]),l(pe,{open:U.value,"onUpdate:open":e[10]||(e[10]=t=>U.value=t),width:640,title:E.value?`运行历史 —— ${E.value.name}`:"运行历史"},{default:o(()=>[j.value?(r(),w(R,{key:0,active:"",paragraph:{rows:6}})):D.value.length?(r(),v("div",lt,[(r(!0),v(F,null,H(D.value,t=>(r(),v("div",{key:t.id,class:"glass p-3 text-xs"},[s("div",nt,[l(P,{color:($[t.status]||{}).color||"default",bordered:!1},{default:o(()=>[g(i(($[t.status]||{}).label||t.status),1)]),_:2},1032,["color"]),l(P,{bordered:!1},{default:o(()=>[g(i(t.trigger_type==="schedule"?"定时":"手动"),1)]),_:2},1024),s("span",ot,i(d(Y)(t.started_at)),1),t.finished_at?(r(),v("span",rt," 耗时 "+i(d(Se)((t.finished_at-t.started_at)*1e3)),1)):x("",!0)]),s("div",it,[s("span",null,"抓取 "+i(t.total_fetched),1),s("span",ut,"新建 "+i(t.created_docs),1),s("span",dt,"更新 "+i(t.updated_docs),1),s("span",{style:ze({color:t.failed_items?"var(--err)":"var(--text-3)"})},"失败 "+i(t.failed_items),5)]),t.message?(r(),v("div",ct,i(t.message),1)):x("",!0)]))),128))])):(r(),w(J,{key:1,text:"还没有运行记录,点「立即抓取」跑一次试试"}))]),_:1},8,["open","title"])])}}};export{ft as default}; diff --git a/view/admin-dist/assets/index-_NPq9xvG.js b/view/admin-dist/assets/index-_NPq9xvG.js new file mode 100644 index 0000000..fc3d335 --- /dev/null +++ b/view/admin-dist/assets/index-_NPq9xvG.js @@ -0,0 +1 @@ +import{a as d,r as S,P as E,a0 as I,Y as q,b as p,c as l,d as e,g as c,w as u,x as y,F as f,C as Y,a1 as J,o as i,k as h,D as n,j as _,A as K,q as Q,s as R,E as W,G as X,z as D,_ as U,y as b,a2 as Z,a3 as ee,a4 as j,a5 as te,l as ae}from"./index-C0Houbmd.js";import{_ as se}from"./PageHeader-BlIlnAwG.js";import{_ as B}from"./SceneTag-B1Rekn1Q.js";import{_ as le}from"./EmptyHint-2CB843hO.js";import{_ as oe}from"./HelpTip-C9tfcO7G.js";const ne={class:"glass p-3 mb-4 flex items-center gap-3 flex-wrap"},ie={class:"glass overflow-hidden"},re={class:"overflow-auto"},ue={class:"w-full text-xs",style:{"border-collapse":"collapse"}},ce=["onClick"],de={class:"px-3 py-2 mono",style:{color:"var(--text-3)"}},pe={class:"px-3 py-2",style:{color:"var(--text-2)"}},_e={class:"px-3 py-2"},me={class:"px-3 py-2 max-w-[140px] truncate",style:{color:"var(--text-2)"}},ve={class:"px-3 py-2 mono",style:{color:"var(--text-2)"}},fe={class:"px-3 py-2"},ge={class:"px-3 py-2 mono",style:{color:"var(--text-3)"}},xe={class:"px-3 py-2 mono text-right",style:{color:"var(--text-3)"}},ye={class:"px-3 py-2 mono text-right",style:{color:"var(--text-3)"}},he={class:"px-3 py-2"},be={class:"flex justify-end p-3"},ke={class:"flex items-center gap-2 mb-4 flex-wrap"},we={class:"mono text-xs",style:{color:"var(--text-2)"}},Ce={class:"mono"},ze={class:"mono"},$e={class:"mono"},Pe={style:{color:"var(--err)"}},He={class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},Oe={class:"glass p-3 mb-4"},Ne={__name:"index",setup(Ae){const g=d([]),P=d(0),k=d(!1),H=d([]),o=S({page:1,size:20,scene:"",status:-1,via_agent:-1,range:null});async function w(){k.value=!0;try{const r={page:o.page,size:o.size,scene:o.scene||"",status:o.status,via_agent:o.via_agent};o.range&&o.range.length===2&&(r.date_start=Math.floor(o.range[0].startOf("day").valueOf()/1e3),r.date_end=Math.floor(o.range[1].endOf("day").valueOf()/1e3));const t=await J(r);g.value=t.data.list||[],P.value=t.data.total||0}finally{k.value=!1}}function m(){o.page=1,w()}function G(r,t){o.page=r,o.size=t,w()}E(async()=>{w();try{const r=await I();H.value=(r.data||[]).map(t=>({label:q(t),value:t}))}catch{}});const x=d(!1),C=d(!1),s=d(null),z=d([]);async function M(r){x.value=!0,C.value=!0;try{const t=await te(r.id);s.value=t.data.generation,z.value=t.data.steps||[]}catch(t){ae.error(t.message||"加载详情失败"),x.value=!1}finally{C.value=!1}}return(r,t)=>{const $=c("a-select"),N=c("a-range-picker"),T=c("a-button"),O=c("a-skeleton"),A=c("a-tag"),V=c("a-pagination"),v=c("a-descriptions-item"),F=c("a-descriptions"),L=c("a-drawer");return i(),p("div",null,[l(se,{title:"历史记录",desc:"AI 生成历史(数据库长期数据,PHP 侧每次生成落库;只读)"}),l(oe,{id:"history",text:"这里是数据库里的权威审计数据(重启不丢)。「运行记录」页看的是 Go 内存里最近 200 条实时轨迹,两者互补。"}),e("div",ne,[l($,{value:o.scene,"onUpdate:value":t[0]||(t[0]=a=>o.scene=a),style:{width:"130px"},placeholder:"全部场景",options:[{label:"全部场景",value:""},...H.value],onChange:m},null,8,["value","options"]),l($,{value:o.status,"onUpdate:value":t[1]||(t[1]=a=>o.status=a),style:{width:"110px"},options:[{label:"全部状态",value:-1},{label:"进行中",value:0},{label:"成功",value:1},{label:"失败",value:2}],onChange:m},null,8,["value"]),l($,{value:o.via_agent,"onUpdate:value":t[2]||(t[2]=a=>o.via_agent=a),style:{width:"130px"},options:[{label:"全部路径",value:-1},{label:"Go Agent",value:1},{label:"PHP 直连",value:0}],onChange:m},null,8,["value"]),l(N,{value:o.range,"onUpdate:value":t[3]||(t[3]=a=>o.range=a),onChange:m},null,8,["value"]),l(T,{type:"primary",onClick:m},{default:u(()=>t[5]||(t[5]=[h("查询")])),_:1})]),e("div",ie,[k.value&&!g.value.length?(i(),y(O,{key:0,active:"",class:"p-4"})):g.value.length?(i(),p(f,{key:2},[e("div",re,[e("table",ue,[t[6]||(t[6]=e("thead",null,[e("tr",{style:{color:"var(--text-3)","border-bottom":"1px solid var(--glass-border)"}},[e("th",{class:"text-left px-3 py-2 font-medium"},"ID"),e("th",{class:"text-left px-3 py-2 font-medium"},"时间"),e("th",{class:"text-left px-3 py-2 font-medium"},"场景"),e("th",{class:"text-left px-3 py-2 font-medium"},"名称"),e("th",{class:"text-left px-3 py-2 font-medium"},"provider/model"),e("th",{class:"text-left px-3 py-2 font-medium"},"路径"),e("th",{class:"text-left px-3 py-2 font-medium"},"步骤"),e("th",{class:"text-right px-3 py-2 font-medium"},"tokens"),e("th",{class:"text-right px-3 py-2 font-medium"},"成本"),e("th",{class:"text-right px-3 py-2 font-medium"},"耗时"),e("th",{class:"text-left px-3 py-2 font-medium"},"状态")])],-1)),e("tbody",null,[(i(!0),p(f,null,Y(g.value,a=>(i(),p("tr",{key:a.id,class:"cursor-pointer glass-hover",style:{"border-bottom":"1px solid var(--glass-border)"},onClick:De=>M(a)},[e("td",de,n(a.id),1),e("td",pe,n(_(K)(a.created_at)),1),e("td",_e,[l(B,{scene:a.scene,clickable:!1},null,8,["scene"])]),e("td",me,n(a.name||"-"),1),e("td",ve,n(a.provider)+"/"+n(a.model),1),e("td",fe,[l(A,{color:a.via_agent?"gold":"default",bordered:!1},{default:u(()=>[h(n(a.via_agent?"Agent":"直连"),1)]),_:2},1032,["color"])]),e("td",ge,n(a.step_count),1),e("td",xe,n(a.total_tokens),1),e("td",ye,n(_(Q)(_(R)(a.provider,a.prompt_tokens,a.completion_tokens))),1),e("td",{class:"px-3 py-2 mono text-right",style:W({color:_(X)(a.duration_ms)})},n(_(D)(a.duration_ms)),5),e("td",he,[l(U,{status:a.status,kind:"gen"},null,8,["status"])])],8,ce))),128))])])]),e("div",be,[l(V,{current:o.page,"page-size":o.size,total:P.value,"show-size-changer":"","page-size-options":["20","50","100"],"show-total":a=>`共 ${a} 条`,onChange:G},null,8,["current","page-size","total","show-total"])])],64)):(i(),y(le,{key:1,text:"没有符合条件的历史记录"}))]),l(L,{open:x.value,"onUpdate:open":t[4]||(t[4]=a=>x.value=a),width:720,title:s.value?`生成记录 #${s.value.id}`:"详情"},{default:u(()=>[C.value?(i(),y(O,{key:0,active:"",paragraph:{rows:8}})):s.value?(i(),p(f,{key:1},[e("div",ke,[l(U,{status:s.value.status,kind:"gen"},null,8,["status"]),l(B,{scene:s.value.scene,clickable:!1},null,8,["scene"]),l(A,{color:s.value.via_agent?"gold":"default",bordered:!1},{default:u(()=>[h(n(s.value.via_agent?"Go Agent":"PHP 直连"),1)]),_:1},8,["color"]),e("span",we,n(s.value.provider)+"/"+n(s.value.model),1)]),l(F,{column:2,size:"small",bordered:"",class:"mb-4"},{default:u(()=>[l(v,{label:"创建时间"},{default:u(()=>[h(n(_(Z)(s.value.created_at)),1)]),_:1}),l(v,{label:"耗时"},{default:u(()=>[e("span",Ce,n(_(D)(s.value.duration_ms)),1)]),_:1}),l(v,{label:"tokens"},{default:u(()=>[e("span",ze,n(s.value.prompt_tokens)+"+"+n(s.value.completion_tokens)+"="+n(s.value.total_tokens),1)]),_:1}),l(v,{label:"门店/医生"},{default:u(()=>[e("span",$e,n(s.value.store_id)+" / "+n(s.value.doctor_id),1)]),_:1}),s.value.error_msg?(i(),y(v,{key:0,label:"失败原因",span:2},{default:u(()=>[e("span",Pe,n(s.value.error_msg),1)]),_:1})):b("",!0)]),_:1}),e("h4",He,"步骤明细("+n(z.value.length)+" 步)",1),e("div",Oe,[l(ee,{steps:z.value},null,8,["steps"])]),s.value.input_snapshot?(i(),p(f,{key:0},[t[7]||(t[7]=e("h4",{class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},"输入快照",-1)),l(j,{value:s.value.input_snapshot,"max-height":"220px",class:"mb-4"},null,8,["value"])],64)):b("",!0),s.value.result_json?(i(),p(f,{key:1},[t[8]||(t[8]=e("h4",{class:"text-sm font-medium mb-2",style:{color:"var(--text-1)"}},"生成结果",-1)),l(j,{value:s.value.result_json,"max-height":"260px"},null,8,["value"])],64)):b("",!0)],64)):b("",!0)]),_:1},8,["open","title"])])}}};export{Ne as default}; diff --git a/view/admin-dist/assets/index-hxBpkaUb.js b/view/admin-dist/assets/index-hxBpkaUb.js new file mode 100644 index 0000000..1b0899c --- /dev/null +++ b/view/admin-dist/assets/index-hxBpkaUb.js @@ -0,0 +1 @@ +import{u as F,a as L,p as O,a2 as j,P as K,b as k,c as a,d as r,w as e,a9 as $,B as H,g as p,o as _,k as u,j as h,R as J,x as v,D as l,y as M,F as z,E as U,C as B,M as G,l as Q}from"./index-C0Houbmd.js";import{_ as W}from"./PageHeader-BlIlnAwG.js";import{_ as C}from"./GlassCard-CqhSlns9.js";import{C as X}from"./ClearOutlined-n8aZ-G2p.js";const Y={class:"grid grid-cols-1 lg:grid-cols-2 gap-4"},Z={class:"mono",style:{color:"var(--primary)"}},ee={class:"mono"},ae={class:"mono text-xs"},le={class:"mono"},te={key:2,class:"text-xs",style:{color:"var(--text-3)"}},se={class:"mono"},oe={class:"mono"},ne={class:"mono"},de={key:0,class:"mono text-xs ml-1"},re={class:"text-xs mb-1.5",style:{color:"var(--text-3)"}},ue={class:"mb-2"},ie={class:"mono text-xs"},ve={__name:"index",setup(_e){const P=F(),t=L(null),c=L(null),b=L(!1);async function A(){b.value=!0;try{const[f,n]=await Promise.allSettled([$({silent:!0}),H({silent:!0})]);f.status==="fulfilled"&&(t.value=f.value.data),n.status==="fulfilled"&&(c.value=n.value.data)}finally{b.value=!1}}async function T(){await G(),Q.success("LLM 配置缓存已失效"),A()}const V=O(()=>{const f=Number(localStorage.getItem("agent_admin_expire")||0);return f?j(f):"-"}),g=f=>f?"开启":"关闭";return K(A),(f,n)=>{const x=p("a-tag"),N=p("a-button"),q=p("a-popconfirm"),I=p("a-skeleton"),o=p("a-descriptions-item"),w=p("a-descriptions"),D=p("a-collapse-panel"),E=p("a-collapse");return _(),k("div",null,[a(W,{title:"配置总览",desc:"全部只读;开关修改统一走 PHP 管理后台(xk_system_config),避免双写冲突"},{actions:e(()=>[a(x,{color:"default",bordered:!1},{default:e(()=>n[0]||(n[0]=[u("只读")])),_:1}),a(N,{loading:b.value,onClick:A},{icon:e(()=>[a(h(J))]),default:e(()=>[n[1]||(n[1]=u("刷新"))]),_:1},8,["loading"]),a(q,{title:"确认失效 LLM 配置缓存?","ok-text":"失效","cancel-text":"取消",onConfirm:T},{default:e(()=>[a(N,{danger:""},{icon:e(()=>[a(h(X))]),default:e(()=>[n[2]||(n[2]=u("失效缓存"))]),_:1})]),_:1})]),_:1}),r("div",Y,[a(C,{title:"LLM(当前生效,脱敏)"},{default:e(()=>[b.value&&!c.value?(_(),v(I,{key:0,active:"",paragraph:{rows:4},title:!1})):c.value?(_(),v(w,{key:1,column:1,size:"small",bordered:""},{default:e(()=>[a(o,{label:"Provider"},{default:e(()=>[r("span",Z,l(c.value.provider),1)]),_:1}),a(o,{label:"Model"},{default:e(()=>[r("span",ee,l(c.value.model),1)]),_:1}),a(o,{label:"API 地址"},{default:e(()=>[r("span",ae,l(c.value.api_url||"-"),1)]),_:1}),a(o,{label:"API Key"},{default:e(()=>[r("span",le,l(c.value.api_key_tail?"****"+c.value.api_key_tail:"-")+"(#"+l(c.value.api_key_id)+")",1)]),_:1}),a(o,{label:"配置来源"},{default:e(()=>[a(x,{bordered:!1,color:c.value.source==="db_active"?"processing":"default"},{default:e(()=>[u(l(c.value.source),1)]),_:1},8,["color"])]),_:1})]),_:1})):(_(),k("div",te,"读取失败(数据库不可达时不影响其他卡片)"))]),_:1}),a(C,{title:"知识库"},{default:e(()=>[b.value&&!t.value?(_(),v(I,{key:0,active:"",paragraph:{rows:4},title:!1})):t.value?(_(),v(w,{key:1,column:1,size:"small",bordered:""},{default:e(()=>[a(o,{label:"检索来源"},{default:e(()=>{var s;return[r("span",se,l((s=t.value.kb)==null?void 0:s.source),1)]}),_:1}),a(o,{label:"检索模式"},{default:e(()=>{var s;return[r("span",oe,l(((s=t.value.kb)==null?void 0:s.search_mode)||"-"),1)]}),_:1}),a(o,{label:"TopK 默认值"},{default:e(()=>{var s;return[u(l((s=t.value.kb)==null?void 0:s.top_k),1)]}),_:1}),a(o,{label:"Embedding"},{default:e(()=>{var s;return[r("span",ne,l(((s=t.value.kb)==null?void 0:s.embedding_provider)||"-"),1)]}),_:1})]),_:1})):M("",!0)]),_:1}),a(C,{title:"Agent 行为(xk_system_config 实时值,30s 缓存)"},{default:e(()=>{var s,y,R;return[b.value&&!t.value?(_(),v(I,{key:0,active:"",paragraph:{rows:6},title:!1})):t.value?(_(),k(z,{key:1},[a(w,{column:1,size:"small",bordered:"",class:"mb-3"},{default:e(()=>[a(o,{label:"ReAct 引擎"},{default:e(()=>{var d,i;return[u(l(g((d=t.value.react)==null?void 0:d.enabled))+"(最多 "+l((i=t.value.react)==null?void 0:i.max_iterations)+" 轮)",1)]}),_:1}),a(o,{label:"Planning / Reflection"},{default:e(()=>{var d,i;return[u(l(g((d=t.value.react)==null?void 0:d.planning_enabled))+" / "+l(g((i=t.value.react)==null?void 0:i.reflection_enabled)),1)]}),_:1}),a(o,{label:"JSON 修复"},{default:e(()=>{var d;return[u(l(g((d=t.value.react)==null?void 0:d.json_repair_enabled)),1)]}),_:1}),a(o,{label:"Token 预算"},{default:e(()=>{var d,i,m,S;return[u(l(g((d=t.value.token_budget)==null?void 0:d.enabled))+" ",1),(i=t.value.token_budget)!=null&&i.enabled?(_(),k("span",de,"单请求 "+l((m=t.value.token_budget)==null?void 0:m.per_request)+" / 单次 "+l((S=t.value.token_budget)==null?void 0:S.max_tokens_per_call),1)):M("",!0)]}),_:1}),a(o,{label:"Debug 日志"},{default:e(()=>{var d,i;return[r("span",{style:U({color:(d=t.value.debug)!=null&&d.log_request_body?"var(--warn)":""})},l((i=t.value.debug)!=null&&i.log_request_body?"开(含请求体,排查完记得关)":"关"),5)]}),_:1})]),_:1}),r("div",re,"医疗守卫 "+l(g((s=t.value.medical_guard)==null?void 0:s.enabled))+" · 白名单 "+l((((y=t.value.medical_guard)==null?void 0:y.whitelist)||[]).length)+" 词 · 黑名单 "+l((((R=t.value.medical_guard)==null?void 0:R.blacklist)||[]).length)+" 词",1),a(E,{ghost:"",size:"small"},{default:e(()=>[a(D,{key:"words",header:"展开守卫词表"},{default:e(()=>{var d,i;return[r("div",ue,[n[3]||(n[3]=r("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"白名单(命中即放行)",-1)),(_(!0),k(z,null,B(((d=t.value.medical_guard)==null?void 0:d.whitelist)||[],m=>(_(),v(x,{key:m,color:"success",bordered:!1,class:"!mb-1"},{default:e(()=>[u(l(m),1)]),_:2},1024))),128))]),r("div",null,[n[4]||(n[4]=r("div",{class:"text-xs mb-1",style:{color:"var(--text-3)"}},"黑名单(命中即拦截)",-1)),(_(!0),k(z,null,B(((i=t.value.medical_guard)==null?void 0:i.blacklist)||[],m=>(_(),v(x,{key:m,color:"error",bordered:!1,class:"!mb-1"},{default:e(()=>[u(l(m),1)]),_:2},1024))),128))])]}),_:1})]),_:1})],64)):M("",!0)]}),_:1}),a(C,{title:"面板会话"},{default:e(()=>[a(w,{column:1,size:"small",bordered:""},{default:e(()=>[a(o,{label:"登录账号"},{default:e(()=>{var s,y;return[u(l(((s=h(P).userInfo)==null?void 0:s.nick_name)||((y=h(P).userInfo)==null?void 0:y.username)||"-"),1)]}),_:1}),a(o,{label:"角色"},{default:e(()=>[a(x,{bordered:!1,color:"processing"},{default:e(()=>{var s;return[u(l(((s=h(P).userInfo)==null?void 0:s.role_name)||"panel_admin"),1)]}),_:1})]),_:1}),a(o,{label:"会话过期"},{default:e(()=>[r("span",ie,l(V.value),1)]),_:1}),a(o,{label:"续签策略"},{default:e(()=>n[5]||(n[5]=[u("剩余 < 24h 时自动静默续签")])),_:1}),a(o,{label:"旧面板"},{default:e(()=>n[6]||(n[6]=[u("/ 与 /kb/view 口令鉴权,不受本面板影响")])),_:1})]),_:1})]),_:1})])])}}};export{ve as default}; diff --git a/view/admin-dist/assets/index-pwcmFmkx.css b/view/admin-dist/assets/index-pwcmFmkx.css new file mode 100644 index 0000000..07b2a79 --- /dev/null +++ b/view/admin-dist/assets/index-pwcmFmkx.css @@ -0,0 +1 @@ +html,body{width:100%;height:100%}input::-ms-clear,input::-ms-reveal{display:none}*,*:before,*:after{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:rgba(0,0,0,0)}@-ms-viewport{width:device-width}body{margin:0}[tabindex="-1"]:focus{outline:none}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5em;font-weight:500}p{margin-top:0;margin-bottom:1em}abbr[title],abbr[data-original-title]{-webkit-text-decoration:underline dotted;text-decoration:underline;text-decoration:underline dotted;border-bottom:0;cursor:help}address{margin-bottom:1em;font-style:normal;line-height:inherit}input[type=text],input[type=password],input[type=number],textarea{-webkit-appearance:none}ol,ul,dl{margin-top:0;margin-bottom:1em}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:500}dd{margin-bottom:.5em;margin-left:0}blockquote{margin:0 0 1em}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}pre,code,kbd,samp{font-size:1em;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace}pre{margin-top:0;margin-bottom:1em;overflow:auto}figure{margin:0 0 1em}img{vertical-align:middle;border-style:none}a,area,button,[role=button],input:not([type=range]),label,select,summary,textarea{touch-action:manipulation}table{border-collapse:collapse}caption{padding-top:.75em;padding-bottom:.3em;text-align:left;caption-side:bottom}input,button,select,optgroup,textarea{margin:0;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}button,html [type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{padding:0;border-style:none}input[type=radio],input[type=checkbox]{box-sizing:border-box;padding:0}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;margin:0;padding:0;border:0}legend{display:block;width:100%;max-width:100%;margin-bottom:.5em;padding:0;color:inherit;font-size:1.5em;line-height:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item}template{display:none}[hidden]{display:none!important}mark{padding:.2em;background-color:#feffe6}/*! tailwindcss v4.1.4 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-relaxed:1.625;--radius-lg:.5rem;--radius-xl:.75rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}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;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.visible{visibility:visible}.\!absolute{position:absolute!important}.\!sticky{position:sticky!important}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:calc(var(--spacing)*0)}.top-1{top:calc(var(--spacing)*1)}.top-2{top:calc(var(--spacing)*2)}.right-2{right:calc(var(--spacing)*2)}.bottom-1{bottom:calc(var(--spacing)*1)}.-left-5{left:calc(var(--spacing)*-5)}.left-\[5px\]{left:5px}.z-10{z-index:10}.m-0{margin:calc(var(--spacing)*0)}.\!my-2{margin-block:calc(var(--spacing)*2)!important}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-6{margin-top:calc(var(--spacing)*6)}.\!mr-0{margin-right:calc(var(--spacing)*0)!important}.mr-1{margin-right:calc(var(--spacing)*1)}.\!mb-0{margin-bottom:calc(var(--spacing)*0)!important}.\!mb-1{margin-bottom:calc(var(--spacing)*1)!important}.\!mb-2{margin-bottom:calc(var(--spacing)*2)!important}.\!mb-3{margin-bottom:calc(var(--spacing)*3)!important}.\!mb-4{margin-bottom:calc(var(--spacing)*4)!important}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.\!ml-auto{margin-left:auto!important}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.\!h-14{height:calc(var(--spacing)*14)!important}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-8{height:calc(var(--spacing)*8)}.h-14{height:calc(var(--spacing)*14)}.h-\[11px\]{height:11px}.h-full{height:100%}.h-screen{height:100vh}.max-h-44{max-height:calc(var(--spacing)*44)}.max-h-\[46vh\]{max-height:46vh}.max-h-\[62vh\]{max-height:62vh}.min-h-\[124px\]{min-height:124px}.min-h-screen{min-height:100vh}.\!w-full{width:100%!important}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-8{width:calc(var(--spacing)*8)}.w-10{width:calc(var(--spacing)*10)}.w-24{width:calc(var(--spacing)*24)}.w-72{width:calc(var(--spacing)*72)}.w-80{width:calc(var(--spacing)*80)}.w-\[11px\]{width:11px}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[140px\]{max-width:140px}.max-w-\[280px\]{max-width:280px}.min-w-\[140px\]{min-width:140px}.flex-1{flex:1}.border-collapse{border-collapse:collapse}.cursor-help{cursor:help}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-y-1{row-gap:calc(var(--spacing)*1)}.gap-y-1\.5{row-gap:calc(var(--spacing)*1.5)}.gap-y-2{row-gap:calc(var(--spacing)*2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.\!rounded-none{border-radius:0!important}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.\!border-0{border-style:var(--tw-border-style)!important;border-width:0!important}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-8{padding:calc(var(--spacing)*8)}.p-10{padding:calc(var(--spacing)*10)}.\!px-0{padding-inline:calc(var(--spacing)*0)!important}.\!px-1{padding-inline:calc(var(--spacing)*1)!important}.\!px-4{padding-inline:calc(var(--spacing)*4)!important}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.pr-2{padding-right:calc(var(--spacing)*2)}.pl-5{padding-left:calc(var(--spacing)*5)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.\!text-sm{font-size:var(--text-sm)!important;line-height:var(--tw-leading,var(--text-sm--line-height))!important}.\!text-xs{font-size:var(--text-xs)!important;line-height:var(--tw-leading,var(--text-xs--line-height))!important}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\!text-\[10px\]{font-size:10px!important}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-nowrap{white-space:nowrap}.opacity-0{opacity:0}.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{--tw-backdrop-blur:blur(8px);-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-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing)*0)}@media (hover:hover){.hover\:underline:hover{text-decoration-line:underline}}@media (min-width:40rem){.sm\:inline{display:inline}}@media (min-width:48rem){.md\:flex{display:flex}.md\:inline{display:inline}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:p-10{padding:calc(var(--spacing)*10)}}@media (min-width:64rem){.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))}}@media (min-width:80rem){.xl\:col-span-2{grid-column:span 2/span 2}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}}:root[data-theme=dark]{--bg-base:#16100a;--bg-grad-1:#1c1409;--bg-grad-2:#22150b;--glass-bg:#2b20138c;--glass-bg-strong:#322616d1;--glass-border:#f59e0b29;--glass-hover:#f59e0b12;--text-1:#f3e9d6;--text-2:#bfae8d;--text-3:#8d7c60;--primary:#f59e0b;--primary-strong:#fbbf24;--accent:#fb923c;--ok:#22c55e;--err:#ef4444;--run:#3b82f6;--warn:#f59e0b;--shadow-glow:0 0 24px #f59e0b14}:root[data-theme=light]{--bg-base:#f2f4fb;--bg-grad-1:#eef1fa;--bg-grad-2:#e8ecf9;--glass-bg:#ffffffb8;--glass-bg-strong:#ffffffeb;--glass-border:#4361ee24;--glass-hover:#4361ee0d;--text-1:#1e2433;--text-2:#5a6478;--text-3:#98a1b3;--primary:#4361ee;--primary-strong:#3651d4;--accent:#7c3aed;--ok:#16a34a;--err:#dc2626;--run:#2563eb;--warn:#d97706;--shadow-glow:0 6px 24px #4361ee14}:root{--mono:ui-monospace,"JetBrains Mono","Cascadia Mono",Consolas,monospace}html,body,#app{height:100%}body{color:var(--text-1);background-color:var(--bg-base);background-image:radial-gradient(1100px 500px at 85% -10%,#f59e0b1a,transparent 60%),radial-gradient(900px 460px at -10% 100%,#fb923c12,transparent 55%),linear-gradient(160deg,var(--bg-grad-1),var(--bg-base)55%,var(--bg-grad-2)),repeating-linear-gradient(0deg,transparent 0 39px,#f59e0b06 39px 40px),repeating-linear-gradient(90deg,transparent 0 39px,#f59e0b06 39px 40px);background-attachment:fixed;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;transition:background-color .25s}:root[data-theme=light] body{background-image:radial-gradient(1100px 500px at 85% -10%,#4361ee14,transparent 60%),linear-gradient(160deg,var(--bg-grad-1),var(--bg-base)55%,var(--bg-grad-2))}.glass{background:var(--glass-bg);border:1px solid var(--glass-border);-webkit-backdrop-filter:blur(14px);box-shadow:var(--shadow-glow);border-radius:12px}.glass-strong{background:var(--glass-bg-strong);border:1px solid var(--glass-border);-webkit-backdrop-filter:blur(18px);border-radius:12px}.glass-hover:hover{background:var(--glass-hover);cursor:pointer;border-color:#f59e0b4d}.mono{font-family:var(--mono)}.text-1{color:var(--text-1)}.text-2{color:var(--text-2)}.text-3{color:var(--text-3)}.health-dot{background:var(--ok);width:10px;height:10px;box-shadow:0 0 8px var(--ok);border-radius:50%;animation:2.4s ease-in-out infinite pulse-glow;display:inline-block}.health-dot.down{background:var(--err);box-shadow:0 0 8px var(--err);animation:none}@keyframes pulse-glow{0%,to{box-shadow:0 0 4px var(--ok)}50%{box-shadow:0 0 12px var(--ok)}}@keyframes shake-x{0%,to{transform:translate(0)}20%,60%{transform:translate(-8px)}40%,80%{transform:translate(8px)}}.shake{animation:.45s shake-x}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms!important;animation-duration:.01ms!important}}.ant-modal .ant-modal-content,.ant-drawer .ant-drawer-content{-webkit-backdrop-filter:blur(18px)}:root[data-theme=dark] .ant-table-tbody>tr:hover>td{background:#f59e0b0f!important}.log-terminal{font-family:var(--mono);white-space:pre-wrap;word-break:break-all;font-size:12px;line-height:1.75}.log-terminal .log-warn{color:var(--warn)}.log-terminal .log-err{color:var(--err)}.log-terminal .log-ok{color:var(--ok)}:root[data-theme=dark] ::-webkit-scrollbar{width:8px;height:8px}:root[data-theme=dark] ::-webkit-scrollbar-thumb{background:#f59e0b2e;border-radius:4px}:root[data-theme=dark] ::-webkit-scrollbar-thumb:hover{background:#f59e0b52}:root[data-theme=dark] ::-webkit-scrollbar-track{background:0 0}mark.kw-hl{color:var(--primary-strong);background:#f59e0b47;border-radius:3px;padding:0 2px}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}[data-v-3893b830] .ant-menu-item-selected{background:#f59e0b24!important}[data-v-3893b830] .ant-menu-item-group-title{font-size:11px;color:var(--text-3)} diff --git a/view/admin-dist/assets/index-uTmFjKcv.css b/view/admin-dist/assets/index-uTmFjKcv.css new file mode 100644 index 0000000..9eb4934 --- /dev/null +++ b/view/admin-dist/assets/index-uTmFjKcv.css @@ -0,0 +1 @@ +.kb-content[data-v-3963b792] mark{background:#f59e0b59;color:inherit;border-radius:2px;padding:0 1px} diff --git a/view/admin-dist/assets/kb-DlfA6vCV.js b/view/admin-dist/assets/kb-DlfA6vCV.js new file mode 100644 index 0000000..b5041d1 --- /dev/null +++ b/view/admin-dist/assets/kb-DlfA6vCV.js @@ -0,0 +1 @@ +import{au as c,av as t,aw as n,ax as o,ay as r}from"./index-C0Houbmd.js";const e=a=>c("/kb/admin/libraries",{},a),i=a=>t("/kb/admin/libraries",a),d=a=>n(`/kb/admin/libraries/${a}`),b=a=>c(`/kb/admin/libraries/${a}/docs`),l=a=>c(`/kb/admin/docs/${a}`),m=a=>n(`/kb/admin/docs/${a}`),u=(a,s)=>o("/kb/admin/docs/import",a,{timeout:3e5,...s}),w=()=>c("/kb/admin/crawl/sources"),h=a=>c("/kb/admin/crawl/tasks",{},a),g=a=>t("/kb/admin/crawl/tasks",a),$=(a,s)=>r(`/kb/admin/crawl/tasks/${a}`,s),p=a=>n(`/kb/admin/crawl/tasks/${a}`),C=a=>t(`/kb/admin/crawl/tasks/${a}/run`),D=(a,s=20)=>c(`/kb/admin/crawl/tasks/${a}/logs`,{limit:s}),T=(a,s)=>t(`/kb/admin/docs/${a}/rechunk`,s),L=a=>c(`/kb/admin/docs/${a}/chunks`),y=(a,s)=>r(`/kb/admin/chunks/${a}`,s),f=a=>r("/kb/admin/chunks/batch",a),x=a=>t("/kb/admin/search",a);export{l as a,f as b,i as c,e as d,b as e,d as f,L as g,m as h,u as i,w as j,x as k,h as l,$ as m,C as n,D as o,p,g as q,T as r,y as u}; diff --git a/view/admin-dist/index.html b/view/admin-dist/index.html new file mode 100644 index 0000000..c6259b6 --- /dev/null +++ b/view/admin-dist/index.html @@ -0,0 +1,19 @@ + + + + + + + + TCM Agent 控制台 + + + + + +
+ + diff --git a/view/admin-dist/vite.svg b/view/admin-dist/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/view/admin-dist/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/view/agent.html b/view/agent.html new file mode 100644 index 0000000..8212f87 --- /dev/null +++ b/view/agent.html @@ -0,0 +1,1999 @@ + + + + + + Agent 控制台 · 萧康云医 TCM Agent + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + +
+
+
{{ currentMenuLabel }}
+
+ + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ + + + + +
+ + +
+
+
{{ stats.total ?? 0 }}
+
总运行数(最近 {{ bufferSize }} 条内)
+
+
+
{{ successRate }}
+
成功率(失败 {{ stats.failed ?? 0 }} / 拦截 {{ stats.blocked ?? 0 }})
+
+
+
{{ fmtMs(stats.avg_ms ?? 0) }}
+
平均耗时(成功请求)
+
+
+
{{ stats.total_tokens ?? 0 }}
+
Token 消耗合计
+
+
+ + +
+
+ 最近运行 + 查看全部 + + +
+ + + + + + + + + + + + + + + +
+ + +
+
快捷操作
+
+ + 模型连通性测试 + + + 守卫测试台 + + + 失效配置缓存 + + + 知识库管理 + +
+
+
+ + +
+
+
+ + + + + + + + + 刷新 + 内存环形缓冲,最多保留最近 {{ bufferSize }} 条;服务重启后清空(历史明细在 PHP xk_ai_generation_step 表) +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+
+
{{ stats.total ?? 0 }}
+
总运行数(最近 {{ bufferSize }} 条内)
+
+
+
{{ successRate }}
+
成功率(成功 {{ stats.success ?? 0 }} / 失败 {{ stats.failed ?? 0 }} / 拦截 {{ stats.blocked ?? 0 }})
+
+
+
{{ fmtMs(stats.avg_ms ?? 0) }}
+
平均耗时(成功请求)
+
+
+
{{ stats.total_tokens ?? 0 }}
+
Token 消耗合计
+
+
+
+
耗时趋势(最近 {{ runs.length }} 次运行,红点为失败/拦截)
+
+
+
+
Token 消耗
+
+
+
+
按场景分布
+ +
暂无数据
+
+
+
最近一次失败
+
{{ fmtTime(stats.last_error_at) }}
+
{{ stats.last_error }}
+
+
+ + +
+
+
+ + + 清空视图 + 内存缓冲最近 500 行 · 2s 增量轮询 · debug 开关打开时日志含请求体(注意隐私) +
+
+
+
暂无日志(或全部被过滤)
+
+
+
+ + +
+
+
+
{{ fmtUptime(sys.uptime_seconds) }}
+
运行时长({{ fmtTime(sys.started_at) }} 启动)
+
+
+
+ {{ sys.enhance_concurrency ? sys.enhance_concurrency.used + ' / ' + sys.enhance_concurrency.capacity : '-' }} +
+
enhance 当前并发 / 上限(满载时新请求 503)
+
+
+
{{ sys.heap_alloc_mb != null ? sys.heap_alloc_mb.toFixed(1) + ' MB' : '-' }}
+
堆内存占用(OS 共 {{ sys.sys_mb != null ? sys.sys_mb.toFixed(0) : '-' }} MB · GC {{ sys.num_gc ?? '-' }} 次)
+
+
+
{{ sys.goroutines ?? '-' }}
+
Goroutine 数({{ sys.go_version || '' }})
+
+
+
{{ sys.runlog_usage ? sys.runlog_usage.used + ' / ' + sys.runlog_usage.capacity : '-' }}
+
RunLog 缓冲占用
+
+
+
+
服务健康(/health)
+ +
加载中…
+
+
+ + +
+ + + +
+ +
+ 测试 +
+ +
+
+ + + +
+
+ + + 发送测试 + 会真实调用一次 LLM(max_tokens 64,成本可忽略) +
+ +
+
+ + + +
+
+ + + 检索 + 走 enhance 同款检索路径(含 ai_kb_source 分流),看 Agent 实际检索到什么 +
+ +
+
+ + + +
+
+ + + + + + 发起请求 + 走真实 /agent/enhance:守卫 → 检索 → ReAct 完整链路(消耗真实 token) +
+ + + +
+
+
+
+ + +
+
+
+ 刷新 + 失效配置缓存 + 面板只读:开关修改统一在 PHP 后台(避免双写入口);「失效缓存」让 Go 立即重读 DB 配置 +
+
生效模型(/models/active-config,DB 实时解析)
+ +
{{ cfgError || '加载中…' }}
+
+ +
+
Agent 行为配置(xk_system_config 只读视图)
+ +
加载中…
+
+ +
+
守卫关键词表
+
白名单(命中任一放行):
+
+ {{ w }} +
+
黑名单(白名单未命中且命中任一则拦截):
+
+ {{ b }} +
+
+ +
+
场景路由表(/models/routes)
+ +
加载中…
+
+
+ + +
+ +
+
+ 共 {{ libraries.length }} 个知识库 · V1 全文检索(MySQL ngram) + + 新建知识库 + +
+
+
+
+
+
+

还没有任何知识库

+

点击右上角「新建知识库」创建第一个库

+
+
+
+
+
+ + + + +
+
{{ lib.name }}
+
{{ lib.description || '暂无描述' }}
+
+
{{ lib.doc_count }}
文档
+
{{ lib.chunk_count }}
分段
+
{{ lib.vectorized_count }}
已向量
+
+ +
+
+
+ + +
+
+ + 返回列表 + + {{ currentLib.name }} + {{ currentLib.doc_count }} 篇文档 · {{ currentLib.chunk_count }} 个分段 + + 检索测试 + +
+
+ +
+ +
正在解析与入库…
+
+ +
+
+
+
+
{{ doc.title }}
+
+ {{ doc.source_file }} + {{ doc.source_type }} + {{ doc.chunk_count }} 个分段 + {{ fmtDate(doc.created_at) }} +
+
+
+ + 查看分段 + + + + +
+
+
+
+

该库还没有任何文档

+

把文件拖到上面的上传区即可导入

+
+
+
+
+ + +
+
+ + + + + + + + + + + + +
+ 返回条数: + + 检索模式: + + 全文 + 向量 + 混合 + +
+
+
+
+
+
+ 检索结果({{ searchResults.length }} 条) + 耗时 {{ searchDurationMs }}ms · 排序按 BM25 相关度 +
+
+
+ #{{ idx + 1 }} + {{ r.title || '(无标题)' }} + + 分词回退 +
+
{{ r.content }}
+
+ 相关度 + + {{ r.score.toFixed(3) }} +
+
+
+
+
+

没有找到相关内容

+

换个关键词试试。短词走精确子串匹配;长句/整段会自动分词做相关度检索,仍无结果说明库内确实没有相关内容

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + 手动建立 + 从 MaxKB 导出 + + + + V1 默认不做向量化,检索走 MySQL FULLTEXT(ngram 2-gram 中文分词)。 + + + + + + + +
+
+
+ {{ chunk.chunk_index + 1 }} + {{ chunk.title || '(无标题)' }} + + + 编辑 + +
+
{{ chunk.content }}
+ +
+
+
+ +
+

无分段

+
+
+
+ + + + + + + + + + + +
+
+ + + + +
+ + 添加关联问题 + +
+
+
+ +
+
+ + + + diff --git a/view/index.html b/view/index.html new file mode 100644 index 0000000..6d6defd --- /dev/null +++ b/view/index.html @@ -0,0 +1,1383 @@ + + + + + + 本地知识库 · 萧康云医 TCM Agent + + + + + + + + + + + + +
+ + + + +
+ + +
+ + +
+ + + + +
+ + +
+
+
+ +
+
+ +
+

还没有任何知识库

+

点击右下角的「+」按钮创建你的第一个知识库

+
+ +
+
+
+
+ +
+ + + + +
+
{{ lib.name }}
+
{{ lib.description || '暂无描述' }}
+
+
+
{{ lib.doc_count }}
+
文档
+
+
+
{{ lib.chunk_count }}
+
分段
+
+
+
{{ lib.vectorized_count }}
+
已向量
+
+
+ +
+
+
+ + + + +
+ + + +
+
+
{{ currentLib.name }}
+
{{ currentLib.description || '暂无描述' }}
+
+ + 检索测试 + +
+ + +
+ +
+ +
正在解析与入库…
+
+ +
+ + +
+
+
+
{{ doc.title }}
+
+ {{ doc.source_file }} + · + {{ doc.source_type }} + · + {{ doc.chunk_count }} 个分段 + · + {{ formatTime(doc.created_at) }} +
+
+
+ + 查看分段 + + + + +
+
+
+
+ +
+

该库还没有任何文档

+

把文件拖到上面的上传区即可导入

+
+
+
+ + + + +
+ + +
+ + + + + + + + + + + + + + + 返回条数: + + + + 检索模式: + + 全文 + 向量 + 混合 + + + + + +
+ +
+
+

检索结果({{ searchResults.length }} 条)

+ 耗时 {{ searchDurationMs }}ms · 排序按 BM25 相关度 +
+
+
+ #{{ idx + 1 }} + {{ r.title || '(无标题)' }} +
+
{{ r.content }}
+
+ 相关度 + + {{ r.score.toFixed(3) }} +
+
+
+ +
+
+ +
+

没有找到相关内容

+

换个关键词试试,V1 走 2-gram 全文检索,建议关键词 2-4 字效果最好

+
+
+
+ + + + + + + + + + + + + + + 手动建立 + 从 MaxKB 导出 + + + + V1 默认不做向量化,检索走 MySQL FULLTEXT(ngram 2-gram 中文分词)。 + + + + + + + +
+
+
+ {{ chunk.chunk_index + 1 }} + {{ chunk.title || '(无标题)' }} + + + 编辑 + +
+
{{ chunk.content }}
+ +
+
+
+ +
+

无分段

+
+
+
+ + + + + + + + + + + +
+
+ + + + +
+ + 添加关联问题 + +
+
+ + 内容不能为空 + +
+ +
+ + + +
+
+ +
+

请输入管理员口令以继续

+
+ +
+ 口令在 config.yamlkb.admin_password 配置。 +
+ +
+
+ + + + diff --git a/生命周期流程图.md b/生命周期流程图.md new file mode 100644 index 0000000..0e47459 --- /dev/null +++ b/生命周期流程图.md @@ -0,0 +1,502 @@ +# AI 生成全链路生命周期流程图 + +> **文档目的**:把"用户从前端发起 AI 生成请求 → PHP xk-api 拼装提示词 → Go Agent 增强(MaxKB 检索 + LLM 调用)→ 落库回写"的完整链路画清楚,方便新人快速理解系统协作关系、定位故障节点。 +> +> **更新时间**:2026-08-09 +> **覆盖范围**:以"病历生成(走 Go Agent 路径)"为代表性场景,处方生成除 `scene` 不同外流程完全一致。 + +--- + +## 一、整体时序图(前端 → PHP → Go Agent → LLM) + +```mermaid +sequenceDiagram + autonumber + participant FE as 前端 + participant PHP as PHP xk-api + participant DB as MySQL z_xk + participant Go as Go Agent + participant MaxKB as MaxKB 知识库 + participant LLM as LLM 厂商 + participant Step as xk_ai_generation_step + + Note over FE,DB: ① 接入层(请求 + 鉴权) + FE->>PHP: POST ai-generate-medical-record-via-agent + PHP->>PHP: Controller 鉴权 / VIP 校验 + PHP->>DB: loadPatientContext 取挂号 + 患者信息 + PHP->>PHP: assertPatientDemographicsForAi 年龄性别必须有 + + Note over PHP,DB: ② 落库 + 拼装 messages + PHP->>DB: beginGeneration 写入 xk_ai_generation status=0 via_agent=1 + PHP->>PHP: 拼 system + user messages + Note right of PHP: via_agent=provider=agent, AiRuntimeConfigService 走短路, 不查 xk_ai_platform 表 + + Note over PHP,LLM: ③ 走 TcmAgentClient(替代 SparkAiAgent) + PHP->>PHP: AiAgentFactory make agent 返回 TcmAgentClient + PHP->>Go: POST api v1 agent enhance + Note right of Go: body 含 scene / messages / kb_enabled / context + + Note over Go,DB: ④ Go Agent 启动期(启动时已发生) + Note right of Go: 启动时已 dao.Init 和 dao.LoadLLMConfigsFromDB, 读取 xk_ai_platform/model/api_key 并 xkaes.Decrypt 解密 api_key + + Note over Go,MaxKB: ⑤ MaxKB 知识库检索(可选) + Go->>DB: 读 xk_system_config 中 ai_agent_kb_enabled_medical_record + alt kb_enabled 等于 true + Go->>MaxKB: Search context top_k=5 + MaxKB-->>Go: 返回 TopK 文档片段 + Go->>Go: injectKBContext 把检索结果拼成 system 消息 + else kb_enabled 等于 false + Note right of Go: 跳过检索, 直接用原 messages + end + + Note over Go,LLM: ⑥ 调用 LLM(按 scene 路由) + Go->>Go: resolveClient medical_record 路由到 spark + Go->>LLM: POST chat completions + LLM-->>Go: 返回 content + usage + + Note over Go,PHP: ⑦ 返回增强结果 + 步骤明细 + Go->>Go: 组装 EnhanceResponse 含 content provider model steps + Go-->>PHP: code 200 data + + Note over PHP,Step: ⑧ 双表落库(主表 + 子表) + PHP->>PHP: AiChatResult raw 透传 steps, finishGenerationSuccess + PHP->>DB: UPDATE xk_ai_generation status=1 写 token 与 step_count + PHP->>Step: AiGenerationStepService recordSteps 批量写入 step 子表 + + Note over PHP,FE: ⑨ 返回前端 + PHP-->>FE: jok ok generation_id fields + FE->>FE: 渲染病历字段 / 错误提示 +``` + +--- + +## 二、各阶段耗时分解(典型值) + +> mermaid 的 gantt 不适合表达"几秒内的耗时分解",用表格更直观。 + +| 阶段 | 阶段名 | 典型耗时 | 说明 | +|------|--------|---------|------| +| ① | 鉴权 + 患者数据加载 | 50~150ms | VIP 校验 + loadPatientContext | +| ② | `beginGeneration` 写库 | 10~30ms | INSERT xk_ai_generation | +| ② | 拼装 messages | 20~80ms | 多个 buildXxxPromptHint 拼接 | +| ③ | HTTP 网络(PHP → Go) | 1~10ms | 同机房内网,建议同 Pod 同节点 | +| ⑤ | MaxKB 检索(开启时) | 200~1500ms | 取决于 KB 规模、TopK、网络 RTT | +| ⑥ | LLM 调用 | **1500~5000ms** | 最大瓶颈,Spark/DeepSeek 单次生成 | +| ⑦ | HTTP 返回(Go → PHP) | 1~10ms | 内网 | +| ⑧ | 双表落库 | 30~100ms | 主表 UPDATE + 子表批量 INSERT | +| ⑨ | HTTP 返回(PHP → FE) | 1~10ms | 内网 | +| | **总耗时** | **3~6 秒** | 不开 KB 时更短 | + +耗时分布条形(粗略可视化): + +``` +鉴权+加载 ▏ 100ms +begin 写库 ▏ 20ms +拼 messages ▏ 50ms +HTTP→Go ▏ 5ms +MaxKB 检索 ▎ 800ms +LLM 调用 ▇▇▇▇▇▇▇ 2500ms ← 主要瓶颈 +HTTP→PHP ▏ 5ms +双表落库 ▏ 60ms +HTTP→FE ▏ 5ms +``` + +--- + +## 三、Go Agent 内部组件协作图 + +```mermaid +flowchart LR + subgraph PHP["PHP xk-api 进程"] + Ctrl["MedicalRecordController
aiGenerateMedicalRecordViaAgent"] + Svc["AiMedicalAssistService
generateMedicalRecord"] + Fac["AiAgentFactory
make agent"] + Client["TcmAgentClient
extends BaseClientHttp"] + StepSvc["AiGenerationStepService
recordSteps"] + end + + subgraph Go["Go Agent 进程 tcm-agent"] + Handler["EnhancerHandler
POST api v1 agent enhance"] + Enhancer["EnhancerService
Enhance"] + Dao["dao 包
启动时已加载 LLM 配置"] + Router["llm ModelRouter
按 scene 路由"] + Spark["SparkClient 讯飞星火"] + DS["DeepSeekClient"] + Qwen["QwenClient 通义千问"] + MaxKB["tool MaxKBClient Search"] + end + + subgraph DB["MySQL z_xk 库"] + Tbl1[("xk_ai_platform xk_ai_model xk_ai_api_key")] + Tbl2[("xk_system_config ai_agent_kb_enabled")] + Tbl3[("xk_ai_generation")] + Tbl4[("xk_ai_generation_step")] + end + + subgraph External["外部依赖"] + MaxKBSrv["MaxKB 服务 HTTP RAG 检索"] + SparkAPI["讯飞星火 OpenAPI"] + DSAPI["DeepSeek API"] + end + + Ctrl --> Svc --> Fac --> Client + Client -. HTTP .-> Handler + Handler --> Enhancer + Enhancer --> Dao + Enhancer --> Router + Router --> Spark + Router --> DS + Router --> Qwen + Enhancer -. "kb_enabled=true" .-> MaxKB + MaxKB -. HTTP .-> MaxKBSrv + Spark -. HTTPS .-> SparkAPI + DS -. HTTPS .-> DSAPI + Dao -. "启动时只读" .-> Tbl1 + Enhancer -. "运行时只读" .-> Tbl2 + Svc -. "落主表" .-> Tbl3 + StepSvc -. "落子表" .-> Tbl4 +``` + +--- + +## 四、关键代码定位 + +| 阶段 | 文件 | 关键方法 | +|------|------|---------| +| ① 控制器入口 | `app/Http/Controllers/admin/medicalRecord/MedicalRecordController.php` | `aiGenerateMedicalRecordViaAgent()` | +| ① 业务编排 | `app/Service/common/ai/AiMedicalAssistService.php` | `generateMedicalRecord()` | +| ② 主表 begin | 同上 | `beginGeneration()` | +| ② 工厂分发 | `app/Service/common/ai/AiAgentFactory.php` | `make('agent')` → `TcmAgentClient` | +| ② 配置解析 | `app/Service/common/ai/AiRuntimeConfigService.php` | `resolve('agent')` 走短路 | +| ③ HTTP 中转 | `app/Service/common/ai/TcmAgentClient.php` | `chatCompletions()` | +| ④ Go 启动加载 | `internal/dao/dao.go` | `Init()` + `LoadLLMConfigsFromDB()` | +| ④ AES 解密 | `internal/security/xkaes/xkaes.go` | `Decrypt()` | +| ⑤ HTTP 入口 | `internal/router/router.go` | `POST /api/v1/agent/enhance` 注册 | +| ⑤ 业务核心 | `internal/service/enhancer.go` | `Enhance()` | +| ⑤ MaxKB 检索 | `internal/tool/maxkb.go` | `Search()` | +| ⑥ LLM 调用 | `internal/llm/spark.go` 等 | `Chat()` | +| ⑦ 步骤汇总 | `internal/service/enhancer.go` | `EnhanceResponse.Steps` | +| ⑧ 主表 finish | `AiMedicalAssistService.php` | `finishGenerationSuccess()` | +| ⑧ 子表批量写 | `app/Service/common/ai/AiGenerationStepService.php` | `recordSteps()` | + +--- + +## 五、失败分支与降级策略 + +```mermaid +flowchart TD + Start([请求进入]) --> P1{"PHP 鉴权
VIP 挂号"} + P1 -- 失败 --> P1E([jerr 抛错]) + P1 -- 成功 --> P2{"患者信息完整?"} + P2 -- 否 --> P2E([提示补全就诊人]) + P2 -- 是 --> P3["begin 落库 status=0"] + P3 --> Go1{"Go Agent 可达?"} + Go1 -- "否 网络/进程挂" --> Go1E["finishGenerationFail
error_msg=Go Agent 请求失败"] + Go1 -- 是 --> Go2{"MaxKB 可达?"} + Go2 -- 失败 --> Go3["记步骤 status=2
降级用原 messages"] + Go2 -- 成功 --> Go4["检索成功
记步骤 status=1"] + Go3 --> LLM1 + Go4 --> LLM1 + LLM1{"LLM 调用成功?"} + LLM1 -- "超时/限流" --> LLM2{"有降级链 FallbackChain?"} + LLM2 -- 有 --> LLM3["切下一个 provider 再试"] + LLM3 --> LLM1 + LLM2 -- 无 --> LLM4[返回 error] + LLM4 --> Fail + LLM1 -- 成功 --> OK["返回 content 和 steps"] + OK --> Php1["finishGenerationSuccess
落主表 status=1"] + Php1 --> Php2[recordSteps 落子表] + Php2 --> Return([返回前端 ok=true]) + Go1E --> Fail + LLM4 --> Fail + Fail["finishGenerationFail
落主表 status=2
已收集的步骤仍落子表"] + Fail --> Return2(["返回前端 ok=false
message=AI生成未完成"]) +``` + +### 关键降级点 + +1. **MaxKB 不可用**:不影响主流程,Go Agent 用原 messages 调 LLM,步骤表记录 `step_type=kb_retrieval, status=2` +2. **LLM 主供应商故障**:Go Agent 的 `FallbackChain` 按配置切换(如 spark → deepseek → ollama),每次切换都生成新 step +3. **Go Agent 进程挂**:PHP 端 `finishGenerationFail` 落 status=2 + error_msg,前端走"软失败",可重试 +4. **数据库不可用**:`beginGeneration` 失败直接 jerr 抛错,不入主表(避免脏数据) + +--- + +## 六、数据落库结构对照 + +```mermaid +erDiagram + xk_ai_generation ||--o{ xk_ai_generation_step : "1:N 步骤明细" + xk_ai_generation { + bigint id PK + int store_id + int register_id + int doctor_id + varchar scene + tinyint prescription_type + varchar provider + varchar model + tinyint status + int api_key_id + tinyint via_agent + int step_count + int prompt_tokens + int completion_tokens + int total_tokens + json usage_json + json input_snapshot + json result_json + text raw_response + int started_at + int finished_at + int duration_ms + } + xk_ai_generation_step { + bigint id PK + bigint generation_id FK + int step_no + varchar step_type + varchar tool_name + varchar provider + varchar model + int api_key_id + int prompt_tokens + int completion_tokens + int total_tokens + json usage_json + int duration_ms + int started_at + int finished_at + tinyint status + varchar detail + } +``` + +字段含义说明: + +- `xk_ai_generation.scene`:`medical_record` / `prescription` +- `xk_ai_generation.provider`:`spark` / `deepseek` / `agent` +- `xk_ai_generation.status`:0 进行中 1 成功 2 失败 +- `xk_ai_generation.via_agent`:0 走 PHP 工厂 1 走 Go Agent +- `xk_ai_generation_step.step_type`:`kb_retrieval` / `llm_call` / `tool_call` +- `xk_ai_generation_step.status`:同主表 + +### 典型步骤记录示例(一次开 KB 的病历生成) + +`xk_ai_generation_step` 表通常会有 2 行: + +| step_no | step_type | provider | model | tokens | duration_ms | detail | +|---------|-----------|----------|-------|--------|------------|--------| +| 1 | kb_retrieval | (空) | (空) | 0 | 320 | 命中 5 条相关文档 | +| 2 | llm_call | spark | spark-max | prompt=1850 completion=920 total=2770 | 2980 | 成功 | + +主表 `xk_ai_generation` 的 `usage_json` 汇总为: + +```json +{ + "prompt_tokens": 1850, + "completion_tokens": 920, + "total_tokens": 2770, + "aggregated": true, + "step_count": 2 +} +``` + +--- + +## 七、配置项速查 + +### Go Agent 端(`manifest/config/config.yaml`) + +```yaml +llm: + default_provider: "spark" + routes: + medical_record: "spark" # 病历场景用讯飞星火 + prescription: "deepseek" # 处方场景用 DeepSeek + fallback: "ollama" # 降级用本地 ollama + fallback_chains: + medical_record: ["spark", "deepseek"] +maxkb: + base_url: "http://maxkb-host:8080" + api_key: "application-xxxx" + app_id: "xxxx-xxxx" +db: + dsn: "root:xxx@tcp(host:3306)/z_xk?charset=utf8mb4&parseTime=true&loc=Local" + encrypt_key: "" # 通过 env ENCRYPT_KEY 注入 +``` + +### PHP 端(`.env`) + +```bash +# Go Agent 连接 +AI_AGENT_BASE_URL=http://go-agent-svc:8080 +AI_AGENT_TIMEOUT=120 +AI_AGENT_TOKEN= # 内网可空 + +# 与 Go Agent 共用的 AES 主密钥(必须同值,否则解密失败) +ENCRYPT_KEY=your-production-key-here +``` + +### 数据库开关(`xk_system_config`) + +| config_key | 默认 | 作用 | +|-----------|------|------| +| `ai_active_provider` | `spark` | PHP 直连路径的默认 provider(不影响 via_agent 路径) | +| `ai_agent_kb_enabled_medical_record` | `0` | 病历场景是否启用 Go Agent 的 MaxKB 检索 | +| `ai_agent_kb_enabled_prescription` | `0` | 处方场景是否启用 | +| `ai_agent_kb_enabled_knowledge_qa` | `0` | 知识问答场景是否启用 | +| `ai_agent_base_url` | (env 兜底) | 运行时覆盖 Go Agent 地址(无需重启 php-fpm) | +| `ai_agent_timeout` | (env 兜底) | 运行时覆盖超时秒数 | +| `ai_agent_token` | (env 兜底) | 运行时覆盖鉴权 token | + +--- + +## 八、灰度切换路径 + +```mermaid +flowchart LR + subgraph Now["当前现状 PHP 直连"] + A1[前端] -->|"POST ai-generate-medical-record"| B1["PHP AiAgentFactory make spark"] + B1 --> C1["SparkAiAgent 讯飞"] + end + + subgraph Gray["灰度阶段 双轨并行"] + A2[前端按场景切] -->|"POST ai-generate-medical-record"| B2[PHP 直连 Spark] + A2 -->|"POST ai-generate-medical-record-via-agent"| C2[PHP TcmAgentClient] + C2 --> D2[Go Agent] + end + + subgraph Full["全量切换 Go Agent"] + A3[前端默认] -->|"POST ai-generate-medical-record-via-agent"| B3[Go Agent 路径] + C3["后台开关 ai_active_provider=agent"] -. "可选全局" .-> B3 + end + + Now -. "灰度推进" .-> Gray -. "验证稳定" .-> Full +``` + +**优势**:新旧路径共存,可按门店 / 医生 / 场景逐步切流,出问题秒级回滚。 + +--- + +## 九、AI Agent 高级能力开关流转(ReAct / Token 预算 / 影子流量) + +本次扩展新增 3 个高级能力,统一开关存 `xk_system_config`,前端在「系统配置 → AI Agent」Tab 维护。 + +### 9.1 配置项速查(13 个 key) + +| config_key | 默认 | 作用 | +|-----------|------|------| +| `ai_react_enabled` | `0` | ReAct 多轮推理循环总开关 | +| `ai_react_max_iterations` | `3` | 单任务最多 Think-Act-Observe 轮数 | +| `ai_react_planning_enabled` | `0` | 启用任务开始前的 Planning 阶段 | +| `ai_react_reflection_enabled` | `0` | 启用生成后的反思自检 | +| `ai_react_reflection_temperature` | `0.2` | 反思步骤温度(低于生成温度 0.3) | +| `ai_react_json_repair_enabled` | `1` | JSON 解析失败时让模型自动修复 | +| `ai_token_budget_enabled` | `1` | Token 预算管理总开关 | +| `ai_token_budget_per_request` | `8000` | 单次任务总 token 上限 | +| `ai_token_max_per_call` | `2048` | 单次 LLM 调用输出上限(透传厂商 `max_tokens`) | +| `ai_shadow_traffic_enabled` | `0` | 影子流量总开关 | +| `ai_shadow_traffic_ratio` | `0` | 影子流量百分比 0-100 | +| `ai_ab_test_enabled` | `0` | A/B Test 总开关 | +| `ai_ab_test_experiment_ratio` | `10` | 实验组流量百分比 0-100 | + +### 9.2 请求处理流程 + +```mermaid +flowchart TB + Req([前端发起 AI 生成请求]) --> AbCheck{A B Test 开启} + AbCheck -->|"是 且随机命中"| ForceAgent[provider 强制改为 agent] + AbCheck -->|"否 或未命中"| Keep[provider 保持原值] + ForceAgent --> Begin[beginGeneration 落主表] + Keep --> Begin + Begin --> Call[调 LLM 主链路] + Call --> Finish[finishGenerationSuccess 落 tokens duration] + + Finish --> ShadowCheck{影子流量开启 且主链路非 agent} + ShadowCheck -->|"是 且随机命中"| Dispatch[dispatch ShadowTrafficJob 到 ai-shadow 队列] + ShadowCheck -->|"否"| Return([返回用户]) + + Dispatch -.->|"异步不阻塞"| Return + + subgraph ShadowJob[ShadowTrafficJob 异步执行] + S1[从 xk_ai_generation 取主链路指标] --> S2[AiAgentFactory make agent 调 Go Agent] + S2 --> S3[计算 content diff hash + 相似度] + S3 --> S4[写 xk_ai_shadow_compare] + end + Dispatch -.-> ShadowJob +``` + +### 9.3 Go Agent 端 ReactLoop + Token 预算内部控制 + +```mermaid +flowchart TB + PHP[PHP TcmAgentClient] -->|"POST api v1 agent enhance"| Enh[EnhancerService Enhance] + Enh --> LoadCfg[读 agentcfg Get 60s 缓存] + LoadCfg --> ReactSwitch{react_enabled} + ReactSwitch -->|"否"| Single[单次 Chat 透传 max_tokens] + ReactSwitch -->|"是"| Loop[runReactLoop] + + subgraph Loop[ReactLoop 内部循环] + L0[Planning 可选] --> For[for i 0 maxIter] + For --> Budget{预算超限} + Budget -->|"是"| Abort[软中止 返回已生成部分] + Budget -->|"否"| Chat[ChatWithOpts 带 tools] + Chat --> Consume[budget Consume 累加 token] + Consume --> ToolCall{模型触发工具} + ToolCall -->|"是"| Exec[executeToolCall 执行工具] + Exec --> For + ToolCall -->|"否"| Reflect[Reflection 可选 自检] + Reflect --> JsonCheck{JSON 合法} + JsonCheck -->|"否 且开启修复"| Repair[JSON 修复 最多 2 次] + Repair --> Done([返回 Content + Steps]) + JsonCheck -->|"是"| Done + end +``` + +### 9.4 影子对比表关系 + +```mermaid +erDiagram + ai_generation ||--o| ai_shadow_compare : "primary_generation_id" + ai_generation { + bigint id PK + string provider + string model + int total_tokens + int duration_ms + } + ai_shadow_compare { + bigint id PK + bigint primary_generation_id FK + string primary_provider + int primary_tokens + int primary_duration_ms + string shadow_provider + int shadow_tokens + int shadow_duration_ms + decimal content_similarity + } +``` + +### 9.5 后台菜单与路由 + +| 后台路径 | 对应路由 | 用途 | +|---------|---------|------| +| 系统配置 → AI Agent Tab | `/system/system-config` | 维护 13 个开关与阈值 | +| 影子流量对比 | `/system/ai-shadow` | 查看主链路 vs 影子的 token/耗时/质量 | + +> 影子对比页路由需在 `xk_menu` 表新增菜单项(component = `/system/ai-shadow/index`,name = `AiShadowCompare`,pid = 系统管理父菜单 id)。 + +### 9.6 关键容错策略 + +| 场景 | 容错策略 | +|------|---------| +| Go Agent 配置缓存 60s 内不感知改动 | 文档说明:后台改完最多 1 分钟生效;后续可加 admin/agent/invalidate-cache 主动失效 | +| ReactLoop 多轮导致延迟升高 | max_iterations 默认 3;reflect_temperature 低;超时降级回单次 Chat | +| 影子流量翻倍成本 | shadow_ratio 默认 0;shadow_compare 表监控;运营每周看一次 | +| JSON 修复可能死循环 | 单独限制 max 2 次修复 | +| ToolCall 工具不存在 | executeToolCall 返回错误 step,LLM 下一轮看到错误会自我修正 | +| A/B 命中后 Go Agent 挂 | 走 AiAgentFactory → TcmAgentClient 抛异常 → finishGenerationFail 兜底 | +| 影子 Job 失败 | Job 内部 catch 所有异常,绝不影响主流程,只打日志 | +