From 3b942fd7a41ec603d40fa31e92d4b9b2c4a3acdb Mon Sep 17 00:00:00 2001 From: Alex-larget <33240357+Alex-larget@users.noreply.github.com> Date: Tue, 10 Mar 2026 18:11:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=8C=E5=90=91=E7=AB=A0=E8=8A=82=E8=A1=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20hot=5Fscore=20=E5=AD=97=E6=AE=B5=E4=BB=A5?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=89=8D=E7=AB=AF=E4=BF=9D=E5=AD=98=E7=AB=A0?= =?UTF-8?q?=E8=8A=82=E6=97=B6=E7=9A=84=201054=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E3=80=82=E5=90=8C=E6=97=B6=EF=BC=8C=E5=AE=9E=E6=96=BD=20Toast?= =?UTF-8?q?=20=E9=80=9A=E7=9F=A5=E7=B3=BB=E7=BB=9F=EF=BC=8C=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E5=85=A8=E7=B3=BB=E7=BB=9F=E7=9A=84=20alert=20?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=8C=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BD=93=E9=AA=8C=E3=80=82=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E4=BB=A5=E5=8F=8D=E6=98=A0=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=B8=8E=E6=9C=80=E4=BD=B3=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent/后端工程师/evolution/2026-03-10.md | 31 + .cursor/agent/团队/evolution/2026-03-10.md | 26 + .cursor/agent/开发助理/经验清单.md | 5 +- .cursor/agent/开发助理/项目索引/后端.md | 3 +- .cursor/agent/开发助理/项目索引/管理端.md | 3 +- .../管理端开发工程师/evolution/2026-03-10.md | 38 + .../2026-03-10_Toast通知系统全局落地.md | 103 +++ .cursor/meeting/README.md | 1 + .cursor/skills/admin-dev/SKILL.md | 38 +- miniprogram/app.js | 4 +- soul-admin/dist/assets/index-CXOwdtCt.css | 1 - soul-admin/dist/assets/index-DsLRWYbk.js | 774 ----------------- soul-admin/dist/assets/index-GNzyAsgf.js | 779 ++++++++++++++++++ soul-admin/dist/assets/index-hM2iAGkr.css | 1 + soul-admin/dist/index.html | 4 +- soul-admin/tsconfig.tsbuildinfo | 2 +- 16 files changed, 1028 insertions(+), 785 deletions(-) create mode 100644 .cursor/meeting/2026-03-10_Toast通知系统全局落地.md delete mode 100644 soul-admin/dist/assets/index-CXOwdtCt.css delete mode 100644 soul-admin/dist/assets/index-DsLRWYbk.js create mode 100644 soul-admin/dist/assets/index-GNzyAsgf.js create mode 100644 soul-admin/dist/assets/index-hM2iAGkr.css diff --git a/.cursor/agent/后端工程师/evolution/2026-03-10.md b/.cursor/agent/后端工程师/evolution/2026-03-10.md index 3e1bff57..8755e1dd 100644 --- a/.cursor/agent/后端工程师/evolution/2026-03-10.md +++ b/.cursor/agent/后端工程师/evolution/2026-03-10.md @@ -34,3 +34,34 @@ > 详见会议纪要:`.cursor/meeting/2026-03-10_小程序新旧版对比与dashboard接口新增.md` +--- + +## chapters 表新增 hot_score 字段 + +### 问题 + +前端 `ContentPage.tsx` 保存章节时传递 `hotScore` 字段,但后端 model 和数据库均缺少该列,导致: +``` +Error 1054 (42S22): Unknown column 'hot_score' in 'field list' +``` + +### 修复步骤 + +1. 执行迁移 SQL(`soul-api/scripts/add-hot-score.sql`): + ```sql + ALTER TABLE chapters ADD COLUMN hot_score INT NOT NULL DEFAULT 0; + ``` +2. 同步 model(`internal/model/chapter.go`): + ```go + HotScore int `gorm:"column:hot_score;default:0" json:"hotScore"` + ``` +3. 重启后端服务生效 + +### 规则沉淀 + +- **model 与 DB 必须同步**:前端传入新字段时,必须先确认 DB 列存在,再确认 model struct 中有对应字段,缺一不可 +- **变更流程**:前端加字段 → ALTER TABLE → 更新 model struct → 重启服务 +- 迁移 SQL 统一放 `soul-api/scripts/` 目录,文件名格式 `add-{描述}.sql` + +> 详见会议纪要:`.cursor/meeting/2026-03-10_Toast通知系统全局落地.md` + diff --git a/.cursor/agent/团队/evolution/2026-03-10.md b/.cursor/agent/团队/evolution/2026-03-10.md index d8f773c2..c4077cbf 100644 --- a/.cursor/agent/团队/evolution/2026-03-10.md +++ b/.cursor/agent/团队/evolution/2026-03-10.md @@ -116,3 +116,29 @@ > 同时影响:小程序开发工程师、后端工程师 > 详见会议纪要:`.cursor/meeting/2026-03-10_小程序新旧版对比与dashboard接口新增.md` +--- + +## Toast 通知系统 & DB 变更 SOP(团队共享) + +### Toast 批量替换方法论 + +使用 PowerShell 正则脚本批量替换 alert → toast,**替换后必须人工复查 `toast.info()`**: +- 验证提示类("请输入/请填写/密码至少/ID已存在")被脚本误判为 info,应改为 error +- 核查方式:`grep -r "toast.info(" src/` 逐条确认语义 + +### DB 变更 SOP(前后端联动) + +当前端新增字段时,完整变更流程: + +| 步骤 | 执行方 | 操作 | +|------|--------|------| +| 1 | 后端 | 执行 `ALTER TABLE` 或用 `db-exec` 脚本 | +| 2 | 后端 | 更新 `internal/model/*.go` struct | +| 3 | 后端 | 重启服务验证 | +| 4 | 管理端 | 确认保存请求不再报 1054 | + +若跳过任一步骤,GORM 写入时必报 `Unknown column`。 + +> 同时影响:管理端开发工程师、后端工程师 +> 详见会议纪要:`.cursor/meeting/2026-03-10_Toast通知系统全局落地.md` + diff --git a/.cursor/agent/开发助理/经验清单.md b/.cursor/agent/开发助理/经验清单.md index 52aabb9a..5b6445a8 100644 --- a/.cursor/agent/开发助理/经验清单.md +++ b/.cursor/agent/开发助理/经验清单.md @@ -29,6 +29,9 @@ | 2026-03-10 | 小程序 | 最佳实践 | miniprogram-dev SKILL §my | my.js 阅读统计改为后端接口(loadDashboardStats),禁止用随机数时间/标题占位 | | 2026-03-10 | 后端 | bug 修复 | api-dev SKILL | 聚合接口三处修复:recentChapters 去重、totalReadMinutes 最小1分钟、DB 错误返回 500 | | 2026-03-10 | 团队 | 方法论 | - | 新旧版代码对比:以功能完整性为基准,批量 diff + 分类取舍,不以日期判优劣 | +| 2026-03-10 | 管理端 | 最佳实践 | admin-dev SKILL §toast | Toast 通知系统落地:utils/toast.ts 纯原生实现,全系统 18 文件 alert → toast 批量替换 | +| 2026-03-10 | 后端 | bug 修复 | api-dev SKILL | chapters 表新增 hot_score 列,修复 1054 Unknown column 错误;DB 变更 SOP:ALTER→model→重启 | +| 2026-03-10 | 团队 | 方法论 | - | DB 变更 SOP + Toast 批量替换方法论(脚本替换后必须人工复查 toast.info 语义) | --- @@ -39,4 +42,4 @@ --- -**最后更新**:2026-03-10 +**最后更新**:2026-03-10(Toast + hot_score 经验入库) diff --git a/.cursor/agent/开发助理/项目索引/后端.md b/.cursor/agent/开发助理/项目索引/后端.md index 3825886c..58334191 100644 --- a/.cursor/agent/开发助理/项目索引/后端.md +++ b/.cursor/agent/开发助理/项目索引/后端.md @@ -22,9 +22,10 @@ soul-api(Go + Gin + GORM + MySQL)提供三组路由:`/api/miniprogram/*` | 2026-03-05 | 文章详情@某人加好友方案讨论:content 内嵌 @ 标记、miniprogram 添加好友接口 | 待续 | | 2026-03-10 | 会议:管理端迁移 Mycontent-temp;后端接口边界不变,overview 聚合接口可选但需降级 | 待续 | | 2026-03-10 | 新增 GET /api/miniprogram/user/dashboard-stats:聚合阅读统计接口,含去重、min1分钟、500错误码修复 | 已完成 | +| 2026-03-10 | chapters 表新增 hot_score 列(ALTER TABLE + model 同步),修复前端保存章节报 1054 错误 | 已完成 | > **格式说明**:每次开发后在此追加一行,日期格式 YYYY-MM-DD,状态用:已完成 / 进行中 / 待续 / 搁置 --- -**最后更新**:2026-03-10(dashboard-stats 接口新增完成) +**最后更新**:2026-03-10(hot_score 迁移完成) diff --git a/.cursor/agent/开发助理/项目索引/管理端.md b/.cursor/agent/开发助理/项目索引/管理端.md index 56124aa8..445c04b4 100644 --- a/.cursor/agent/开发助理/项目索引/管理端.md +++ b/.cursor/agent/开发助理/项目索引/管理端.md @@ -21,9 +21,10 @@ | 2026-03-05 | 分支冲突后功能完整性分析会议:全功能自测,记录 404/异常接口 | 待续 | | 2026-03-05 | 文章详情@某人加好友方案讨论:编辑页插入 @用户、保存约定 content 格式 | 待续 | | 2026-03-10 | 会议:管理端迁移 Mycontent-temp 新菜单/布局;主导航收敛、author/admin 并入 Settings Tab | 待续 | +| 2026-03-10 | Toast 通知系统落地:创建 utils/toast.ts(纯原生),全系统 18 文件约 90 处 alert 全部替换为 toast.success/error/info | 已完成 | > **格式说明**:每次开发后在此追加一行,日期格式 YYYY-MM-DD,状态用:已完成 / 进行中 / 待续 / 搁置 --- -**最后更新**:2026-03-10 +**最后更新**:2026-03-10(Toast 系统全局落地) diff --git a/.cursor/agent/管理端开发工程师/evolution/2026-03-10.md b/.cursor/agent/管理端开发工程师/evolution/2026-03-10.md index a4ae6c58..b292829c 100644 --- a/.cursor/agent/管理端开发工程师/evolution/2026-03-10.md +++ b/.cursor/agent/管理端开发工程师/evolution/2026-03-10.md @@ -16,3 +16,41 @@ > 详见会议纪要:`.cursor/meeting/2026-03-10_管理端迁移Mycontent-temp菜单布局讨论.md` +--- + +## Toast 通知系统全局落地 + +### 背景 + +管理端全部操作反馈使用原生 `alert()`,体验差、阻断操作流程、需点 OK 才能继续。 + +### 解决方案 + +创建 `soul-admin/src/utils/toast.ts`(**纯原生 DOM 实现**,无第三方依赖): + +```typescript +// 用法 +import toast from '@/utils/toast' +toast.success('已保存:标题') // 绿色,3s 消失 +toast.error('保存失败: ...') // 红色,3s 消失 +toast.info('暂无数据') // 蓝色,3s 消失 +``` + +### 全系统替换 + +使用 PowerShell 批量脚本处理 **18 个文件、约 90 处 alert**,替换规则: +- 含"失败/错误/请填/不一致/必填" → `toast.error()` +- 含"成功/已保存/已删除/已创建" → `toast.success()` +- 其余 → `toast.info()` + +替换后人工复查 `toast.info()` 调用,修正 5 处语义误判(验证提示类应为 error)。 + +### 规则沉淀 + +1. **管理端禁用 `alert()`**,统一使用 `@/utils/toast` +2. 新增页面/组件时,操作反馈一律用 toast +3. 批量脚本替换后,**必须**人工复查 `toast.info()` 是否有应为 `toast.error()` 的验证提示 +4. toast 自动消失(3s),不阻断流程;若需用户确认,仍使用 `confirm()` + +> 详见会议纪要:`.cursor/meeting/2026-03-10_Toast通知系统全局落地.md` + diff --git a/.cursor/meeting/2026-03-10_Toast通知系统全局落地.md b/.cursor/meeting/2026-03-10_Toast通知系统全局落地.md new file mode 100644 index 00000000..6089db46 --- /dev/null +++ b/.cursor/meeting/2026-03-10_Toast通知系统全局落地.md @@ -0,0 +1,103 @@ +# 会议纪要 - 2026-03-10 | Toast 通知系统全局落地 & hot_score 数据库迁移 + +> 本文件由**助理橙子**在会议结束后自动生成。 + +--- + +## 基本信息 + +- **时间**:2026-03-10 +- **议题**:1) 文章保存后添加成功提示;2) 数据库缺失 hot_score 字段报错修复;3) 全系统 alert 替换为 toast 组件 +- **触发方式**:用户反馈 → 逐步扩展到全系统改造 +- **参与角色**:管理端开发工程师、后端开发、助理橙子 + +--- + +## 各角色发言 + +### 【管理端开发工程师】 + +当前管理端所有操作反馈都使用原生 `alert()`,体验差,阻断操作流程,用户必须手动点 OK 才能继续。需要一个统一的 toast 通知系统:非阻塞、自动消失、视觉语义化(绿色=成功、红色=错误、蓝色=信息)。 + +考虑到项目没有现成 toast 依赖(sonner 安装失败),选择纯原生 DOM 实现 `src/utils/toast.ts`,无需第三方库,全量兼容现有项目。 + +### 【后端开发】 + +保存文章时报 `Error 1054 (42S22): Unknown column 'hot_score' in 'field list'`,原因是前端 `ContentPage.tsx` 已在 `handleSaveSection` 中传递 `hotScore` 字段,但后端 `Chapter` model 缺少该字段,且数据库 `chapters` 表也未建列。 + +需要两步修复:① ALTER TABLE 新增列;② 同步 model struct。 + +### 【助理橙子】 + +全系统 18 个文件约 90 处 alert 经 PowerShell 脚本批量替换。替换规则: +- 含"失败/错误/请填/不一致/必填"→ `toast.error()` +- 含"成功/已保存/已删除/已创建"→ `toast.success()` +- 其余→ `toast.info()` + +事后人工复查,修正 5 处语义误判(info 改 error)。 + +--- + +## 讨论过程 + +1. 用户提出"文章保存了要提示保存成功" +2. 管理端工程师创建 `src/utils/toast.ts`(纯原生,无依赖),替换 `ContentPage.tsx` 的 alert +3. 用户截图报错 `Unknown column 'hot_score'` +4. 后端工程师执行 `ALTER TABLE chapters ADD COLUMN hot_score INT NOT NULL DEFAULT 0`,更新 `chapter.go` model +5. 用户提出"整个系统的 alert 都可以改为 toast" +6. 助理橙子编写 PowerShell 批量替换脚本,处理 18 个文件 +7. 人工复查 `toast.info()` 调用,将 5 处验证提示修正为 `toast.error()` + +--- + +## 会议决议 + +1. **Toast 系统统一规范**:管理端所有用户反馈统一使用 `@/utils/toast`,禁止使用 `alert()` +2. **toast 类型语义**: + - `toast.success()` → 操作成功、保存成功、删除成功 + - `toast.error()` → 操作失败、表单验证不通过、接口报错 + - `toast.info()` → 中性提示(无数据、当前状态说明) +3. **hot_score 字段**:`chapters` 表已新增,`Chapter` model 已同步,热度分功能可正常保存 +4. **数据库变更流程**:model 字段与 DB 列必须同步维护,ALTER TABLE 后立即更新 model struct + +--- + +## 待办事项 + +| 责任角色 | 任务 | 优先级 | 截止建议 | +|---------|------|--------|---------| +| 管理端开发工程师 | 新增页面/组件时使用 toast 而非 alert(已有规范) | 高 | 持续 | +| 后端开发 | hot_score 排名算法接口(若有)按此字段排序 | 低 | 待需求 | + +--- + +## 问题与作答区 + +| # | 问题 | 责任角色 | 作答 | +|---|------|---------|------| +| 1 | hot_score 热度分的计算逻辑和更新时机是什么? | 产品经理/后端开发 | (待补充) | +| 2 | toast 是否需要支持持久化(不自动消失)的场景? | 管理端开发工程师 | (待补充) | + +--- + +## 各角色经验与业务理解更新 + +### 后端开发 + +- `chapters` 表新增 `hot_score INT NOT NULL DEFAULT 0`,用于热度排名算法 +- model struct 字段须与 DB 列同步,否则 GORM 写入报 1054 错误 + +### 管理端开发工程师 + +- 创建 `src/utils/toast.ts`:纯原生 DOM toast,无第三方依赖,支持 success/error/info +- 全系统 18 个文件约 90 处 `alert()` 已替换;替换按语义分类,info 类需人工复查 +- 新规范:管理端禁用 `alert()`,统一使用 `toast.*` + +### 团队共享 + +- **Toast 替换脚本方法论**:用 PowerShell 正则 + 语义关键词批量替换,替换后人工复查 `toast.info()` 是否应为 `toast.error()`(验证提示类常被误判) +- **DB 变更 SOP**:前端传新字段 → 后端先执行 ALTER TABLE → 再更新 model → 重启服务 + +--- + +*会议纪要由助理橙子生成 | 各角色经验已同步至 `agent/{角色}/evolution/2026-03-10.md`* diff --git a/.cursor/meeting/README.md b/.cursor/meeting/README.md index c57e0e3e..4dc7455a 100644 --- a/.cursor/meeting/README.md +++ b/.cursor/meeting/README.md @@ -71,3 +71,4 @@ YYYY-MM-DD_会议主题.md | 2026-03-10 | 管理端迁移 Mycontent-temp 菜单/布局讨论 | 产品、后端、管理端、小程序、测试 | [2026-03-10_管理端迁移Mycontent-temp菜单布局讨论.md](2026-03-10_管理端迁移Mycontent-temp菜单布局讨论.md) | | 2026-03-10 | 小程序新旧版对比分析与 dashboard-stats 接口新增 | 小程序、后端、团队 | [2026-03-10_小程序新旧版对比与dashboard接口新增.md](2026-03-10_小程序新旧版对比与dashboard接口新增.md) | | 2026-03-10 | 文章详情三端功能对齐与开发(@mention/#linkTag/图片) | 产品、后端、管理端、小程序 | [2026-03-10_文章详情三端功能对齐与开发.md](2026-03-10_文章详情三端功能对齐与开发.md) | +| 2026-03-10 | Toast 通知系统全局落地 & hot_score 数据库迁移 | 管理端、后端、团队 | [2026-03-10_Toast通知系统全局落地.md](2026-03-10_Toast通知系统全局落地.md) | diff --git a/.cursor/skills/admin-dev/SKILL.md b/.cursor/skills/admin-dev/SKILL.md index 8208ed40..17895041 100644 --- a/.cursor/skills/admin-dev/SKILL.md +++ b/.cursor/skills/admin-dev/SKILL.md @@ -57,7 +57,7 @@ description: Soul 创业派对管理端开发规范。在 soul-admin/ 下编辑 **可选**:导出 CSV、列头排序、批量操作。 -**禁止**:不得用原生 `alert` 做加载失败提示;不得调用 `/api/miniprogram/*`。 +**禁止**:不得用原生 `alert` 做任何提示(包括成功、失败、验证);不得调用 `/api/miniprogram/*`。 **检查清单**:分页、搜索防抖、刷新、loading、空状态、错误条、仅 admin/db 路径。详见 `开发文档/列表标准与角色分工.md`。 @@ -65,7 +65,41 @@ description: Soul 创业派对管理端开发规范。在 soul-admin/ 下编辑 **口诀**:外边包 div/view,内部 input width 100%。设置 input 的 padding、背景、边框时,用 div 包裹 input;padding 写在容器上,input 仅做文字样式(`width: 100%`)。禁止在 input 自身上设 padding,可避免光标截断、布局异常。React:`
`。 -### 4.2 表单弹窗与「可选择+可手动填写」(吸收 SetVipModal 经验) +### 4.2 用户操作反馈:统一使用 Toast(禁止 alert) + +**规则**:管理端所有操作反馈(保存成功、操作失败、表单验证提示等)**必须使用 `@/utils/toast`**,严禁使用原生 `window.alert()`。 + +```typescript +import toast from '@/utils/toast' + +// ✅ 正确 +toast.success('已保存') +toast.success(`章节「${title}」创建成功`) +toast.error('保存失败: ' + (res?.error || '未知错误')) +toast.error('请填写章节ID和标题') // 表单验证也用 error +toast.info('暂无数据可导出') // 中性说明用 info + +// ❌ 错误 +alert('已保存') +alert('保存失败') +``` + +**类型语义**: + +| 方法 | 使用场景 | 颜色 | +|------|---------|------| +| `toast.success()` | 操作成功、保存成功、创建/删除成功 | 绿色 | +| `toast.error()` | 接口报错、表单验证不通过、操作失败 | 红色 | +| `toast.info()` | 中性提示(无数据、当前状态说明) | 蓝色 | + +**注意**: +- `confirm()` 仍可用于删除等破坏性操作的二次确认 +- toast 自动 3 秒消失,不阻断流程;若需用户强制确认才能继续,使用 `confirm()` +- 新增页面/组件时,**不得引入新的 `alert()`** + +> 来源:2026-03-10 全系统 alert → toast 改造(18 文件约 90 处) + +### 4.4 表单弹窗与「可选择+可手动填写」(吸收 SetVipModal 经验) 当表单需支持「从预设选项选择」或「手动填写自定义值」时: diff --git a/miniprogram/app.js b/miniprogram/app.js index 4528dd53..58b88341 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -9,8 +9,8 @@ App({ globalData: { // API基础地址 - 连接真实后端 // baseUrl: 'https://soulapi.quwanzhi.com', - // baseUrl: 'https://souldev.quwanzhi.com', - baseUrl: 'http://localhost:8080', + baseUrl: 'https://souldev.quwanzhi.com', + // baseUrl: 'http://localhost:8080', // 小程序配置 - 真实AppID diff --git a/soul-admin/dist/assets/index-CXOwdtCt.css b/soul-admin/dist/assets/index-CXOwdtCt.css deleted file mode 100644 index 1ff5eb7c..00000000 --- a/soul-admin/dist/assets/index-CXOwdtCt.css +++ /dev/null @@ -1 +0,0 @@ -.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:300px;max-height:500px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}/*! tailwindcss v4.1.18 | 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-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--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;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--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-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--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}::-webkit-calendar-picker-indicator{line-height:1}:-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{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-auto{margin-right:auto}.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-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-\[70vh\]{height:70vh}.h-\[75vh\]{height:75vh}.h-auto{height:auto}.h-full{height:100%}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[200px\]{max-height:200px}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-36{width:calc(var(--spacing)*36)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.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-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.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-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.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-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.py-24{padding-block:calc(var(--spacing)*24)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--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}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.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-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);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,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));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,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.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,)!important}.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,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.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))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-amber-500\/40:hover{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.hover\:border-amber-500\/40:hover{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-400\/10:hover{background-color:#fcbb001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-400\/10:hover{background-color:color-mix(in oklab,var(--color-amber-400)10%,transparent)}}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-400\/10:hover{background-color:#fac8001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-400\/10:hover{background-color:color-mix(in oklab,var(--color-yellow-400)10%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:text-yellow-400:hover{color:var(--color-yellow-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@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}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/assets/index-DsLRWYbk.js b/soul-admin/dist/assets/index-DsLRWYbk.js deleted file mode 100644 index 5e31d155..00000000 --- a/soul-admin/dist/assets/index-DsLRWYbk.js +++ /dev/null @@ -1,774 +0,0 @@ -function a3(t,e){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function yN(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lm={exports:{}},Jl={},cm={exports:{}},lt={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var lb;function o3(){if(lb)return lt;lb=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(L){return L===null||typeof L!="object"?null:(L=m&&L[m]||L["@@iterator"],typeof L=="function"?L:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,j={};function w(L,H,ue){this.props=L,this.context=H,this.refs=j,this.updater=ue||y}w.prototype.isReactComponent={},w.prototype.setState=function(L,H){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,H,"setState")},w.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function k(){}k.prototype=w.prototype;function E(L,H,ue){this.props=L,this.context=H,this.refs=j,this.updater=ue||y}var C=E.prototype=new k;C.constructor=E,v(C,w.prototype),C.isPureReactComponent=!0;var M=Array.isArray,D=Object.prototype.hasOwnProperty,F={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function I(L,H,ue){var U,he={},Q=null,ee=null;if(H!=null)for(U in H.ref!==void 0&&(ee=H.ref),H.key!==void 0&&(Q=""+H.key),H)D.call(H,U)&&!R.hasOwnProperty(U)&&(he[U]=H[U]);var de=arguments.length-2;if(de===1)he.children=ue;else if(1>>1,H=V[L];if(0>>1;Ls(he,Y))Qs(ee,he)?(V[L]=ee,V[Q]=Y,L=Q):(V[L]=he,V[U]=Y,L=U);else if(Qs(ee,Y))V[L]=ee,V[Q]=Y,L=Q;else break e}}return ae}function s(V,ae){var Y=V.sortIndex-ae.sortIndex;return Y!==0?Y:V.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,y=!1,v=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(V){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=V)r(h),ae.sortIndex=ae.expirationTime,e(u,ae);else break;ae=n(h)}}function M(V){if(j=!1,C(V),!v)if(n(u)!==null)v=!0,$(D);else{var ae=n(h);ae!==null&&oe(M,ae.startTime-V)}}function D(V,ae){v=!1,j&&(j=!1,k(I),I=-1),y=!0;var Y=g;try{for(C(ae),m=n(u);m!==null&&(!(m.expirationTime>ae)||V&&!W());){var L=m.callback;if(typeof L=="function"){m.callback=null,g=m.priorityLevel;var H=L(m.expirationTime<=ae);ae=t.unstable_now(),typeof H=="function"?m.callback=H:m===n(u)&&r(u),C(ae)}else r(u);m=n(u)}if(m!==null)var ue=!0;else{var U=n(h);U!==null&&oe(M,U.startTime-ae),ue=!1}return ue}finally{m=null,g=Y,y=!1}}var F=!1,R=null,I=-1,A=5,O=-1;function W(){return!(t.unstable_now()-OV||125L?(V.sortIndex=Y,e(h,V),n(u)===null&&V===n(h)&&(j?(k(I),I=-1):j=!0,oe(M,Y-L))):(V.sortIndex=H,e(u,V),v||y||(v=!0,$(D))),V},t.unstable_shouldYield=W,t.unstable_wrapCallback=function(V){var ae=g;return function(){var Y=g;g=ae;try{return V.apply(this,arguments)}finally{g=Y}}}})(hm)),hm}var fb;function u3(){return fb||(fb=1,um.exports=d3()),um.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var pb;function h3(){if(pb)return cr;pb=1;var t=Fc(),e=u3();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function y(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,d,p,x){if(d===null||typeof d>"u"||y(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,N,S,T){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=N,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=T}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];w[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new j(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){w[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var N=w.hasOwnProperty(d)?w[d]:null;(N!==null?N.type!==0:x||!(2z||N[T]!==S[z]){var K=` -`+N[T].replace(" at new "," at ");return l.displayName&&K.includes("")&&(K=K.replace("",l.displayName)),K}while(1<=T&&0<=z);break}}}finally{ue=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?H(l):""}function he(l){switch(l.tag){case 5:return H(l.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return l=U(l.type,!1),l;case 11:return l=U(l.type.render,!1),l;case 1:return l=U(l.type,!0),l;default:return""}}function Q(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case R:return"Fragment";case F:return"Portal";case A:return"Profiler";case I:return"StrictMode";case q:return"Suspense";case Z:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case W:return(l.displayName||"Context")+".Consumer";case O:return(l._context.displayName||"Context")+".Provider";case X:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case _:return d=l.displayName||null,d!==null?d:Q(l.type)||"Memo";case $:d=l._payload,l=l._init;try{return Q(l(d))}catch{}}return null}function ee(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(d);case 8:return d===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function de(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Ce(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function B(l){var d=Ce(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var N=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return N.call(this)},set:function(T){x=""+T,S.call(this,T)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(T){x=""+T},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function me(l){l._valueTracker||(l._valueTracker=B(l))}function Se(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=Ce(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function rt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Ye(l,d){var p=d.checked;return Y({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function st(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=de(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function Qe(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function Xe(l,d){Qe(l,d);var p=de(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Pt(l,d.type,p):d.hasOwnProperty("defaultValue")&&Pt(l,d.type,de(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function ft(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Pt(l,d,p){(d!=="number"||rt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Jt=Array.isArray;function Kn(l,d,p,x){if(l=l.options,d){d={};for(var N=0;N"+d.valueOf().toString()+"",d=pn.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Br(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var Gn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fe=["Webkit","ms","Moz","O"];Object.keys(Gn).forEach(function(l){fe.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),Gn[d]=Gn[l]})});function ge(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||Gn.hasOwnProperty(l)&&Gn[l]?(""+d).trim():d+"px"}function kn(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,N=ge(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,N):l[p]=N}}var ri=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ms(l,d){if(d){if(ri[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function ha(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Jn=null;function as(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var pt=null,Sn=null,Yn=null;function Dn(l){if(l=Ol(l)){if(typeof pt!="function")throw Error(n(280));var d=l.stateNode;d&&(d=vd(d),pt(l.stateNode,l.type,d))}}function fa(l){Sn?Yn?Yn.push(l):Yn=[l]:Sn=l}function si(){if(Sn){var l=Sn,d=Yn;if(Yn=Sn=null,Dn(l),d)for(l=0;l>>=0,l===0?32:31-(P(l)/ie|0)|0}var Re=64,Ot=4194304;function Vt(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Ln(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,N=l.suspendedLanes,S=l.pingedLanes,T=p&268435455;if(T!==0){var z=T&~N;z!==0?x=Vt(z):(S&=T,S!==0&&(x=Vt(S)))}else T=p&~N,T!==0?x=Vt(T):S!==0&&(x=Vt(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&N)===0&&(N=x&-x,S=d&-d,N>=S||N===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function li(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-rr(d),l[d]=p}function EE(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=Sl),ty=" ",ny=!1;function ry(l,d){switch(l){case"keyup":return t4.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var co=!1;function r4(l,d){switch(l){case"compositionend":return sy(d);case"keypress":return d.which!==32?null:(ny=!0,ty);case"textInput":return l=d.data,l===ty&&ny?null:l;default:return null}}function s4(l,d){if(co)return l==="compositionend"||!Vf&&ry(l,d)?(l=J0(),ld=Lf=fi=null,co=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=uy(p)}}function fy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?fy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function py(){for(var l=window,d=rt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=rt(l.document)}return d}function Uf(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function f4(l){var d=py(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&fy(p.ownerDocument.documentElement,p)){if(x!==null&&Uf(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var N=p.textContent.length,S=Math.min(x.start,N);x=x.end===void 0?S:Math.min(x.end,N),!l.extend&&S>x&&(N=x,x=S,S=N),N=hy(p,S);var T=hy(p,x);N&&T&&(l.rangeCount!==1||l.anchorNode!==N.node||l.anchorOffset!==N.offset||l.focusNode!==T.node||l.focusOffset!==T.offset)&&(d=d.createRange(),d.setStart(N.node,N.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(T.node,T.offset)):(d.setEnd(T.node,T.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,uo=null,Kf=null,Ml=null,qf=!1;function my(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;qf||uo==null||uo!==rt(x)||(x=uo,"selectionStart"in x&&Uf(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Ml&&Tl(Ml,x)||(Ml=x,x=gd(Kf,"onSelect"),0go||(l.current=ip[go],ip[go]=null,go--)}function kt(l,d){go++,ip[go]=l.current,l.current=d}var xi={},_n=gi(xi),sr=gi(!1),xa=xi;function xo(l,d){var p=l.type.contextTypes;if(!p)return xi;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var N={},S;for(S in p)N[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=N),N}function ir(l){return l=l.childContextTypes,l!=null}function bd(){Tt(sr),Tt(_n)}function Ay(l,d,p){if(_n.current!==xi)throw Error(n(168));kt(_n,d),kt(sr,p)}function Ry(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var N in x)if(!(N in d))throw Error(n(108,ee(l)||"Unknown",N));return Y({},p,x)}function wd(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||xi,xa=_n.current,kt(_n,l),kt(sr,sr.current),!0}function Iy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Ry(l,d,xa),x.__reactInternalMemoizedMergedChildContext=l,Tt(sr),Tt(_n),kt(_n,l)):Tt(sr),kt(sr,p)}var Is=null,Nd=!1,ap=!1;function Py(l){Is===null?Is=[l]:Is.push(l)}function S4(l){Nd=!0,Py(l)}function yi(){if(!ap&&Is!==null){ap=!0;var l=0,d=yt;try{var p=Is;for(yt=1;l>=T,N-=T,Ps=1<<32-rr(d)+N|p<Je?(yn=Ue,Ue=null):yn=Ue.sibling;var ut=xe(ne,Ue,se[Je],Ne);if(ut===null){Ue===null&&(Ue=yn);break}l&&Ue&&ut.alternate===null&&d(ne,Ue),J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut,Ue=yn}if(Je===se.length)return p(ne,Ue),Dt&&va(ne,Je),ze;if(Ue===null){for(;JeJe?(yn=Ue,Ue=null):yn=Ue.sibling;var Ei=xe(ne,Ue,ut.value,Ne);if(Ei===null){Ue===null&&(Ue=yn);break}l&&Ue&&Ei.alternate===null&&d(ne,Ue),J=S(Ei,J,Je),We===null?ze=Ei:We.sibling=Ei,We=Ei,Ue=yn}if(ut.done)return p(ne,Ue),Dt&&va(ne,Je),ze;if(Ue===null){for(;!ut.done;Je++,ut=se.next())ut=be(ne,ut.value,Ne),ut!==null&&(J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut);return Dt&&va(ne,Je),ze}for(Ue=x(ne,Ue);!ut.done;Je++,ut=se.next())ut=Ie(Ue,ne,Je,ut.value,Ne),ut!==null&&(l&&ut.alternate!==null&&Ue.delete(ut.key===null?Je:ut.key),J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut);return l&&Ue.forEach(function(i3){return d(ne,i3)}),Dt&&va(ne,Je),ze}function Yt(ne,J,se,Ne){if(typeof se=="object"&&se!==null&&se.type===R&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case D:e:{for(var ze=se.key,We=J;We!==null;){if(We.key===ze){if(ze=se.type,ze===R){if(We.tag===7){p(ne,We.sibling),J=N(We,se.props.children),J.return=ne,ne=J;break e}}else if(We.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===$&&$y(ze)===We.type){p(ne,We.sibling),J=N(We,se.props),J.ref=Dl(ne,We,se),J.return=ne,ne=J;break e}p(ne,We);break}else d(ne,We);We=We.sibling}se.type===R?(J=Ea(se.props.children,ne.mode,Ne,se.key),J.return=ne,ne=J):(Ne=Yd(se.type,se.key,se.props,null,ne.mode,Ne),Ne.ref=Dl(ne,J,se),Ne.return=ne,ne=Ne)}return T(ne);case F:e:{for(We=se.key;J!==null;){if(J.key===We)if(J.tag===4&&J.stateNode.containerInfo===se.containerInfo&&J.stateNode.implementation===se.implementation){p(ne,J.sibling),J=N(J,se.children||[]),J.return=ne,ne=J;break e}else{p(ne,J);break}else d(ne,J);J=J.sibling}J=rm(se,ne.mode,Ne),J.return=ne,ne=J}return T(ne);case $:return We=se._init,Yt(ne,J,We(se._payload),Ne)}if(Jt(se))return Oe(ne,J,se,Ne);if(ae(se))return _e(ne,J,se,Ne);Cd(ne,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,J!==null&&J.tag===6?(p(ne,J.sibling),J=N(J,se),J.return=ne,ne=J):(p(ne,J),J=nm(se,ne.mode,Ne),J.return=ne,ne=J),T(ne)):p(ne,J)}return Yt}var wo=Fy(!0),By=Fy(!1),Ed=gi(null),Td=null,No=null,hp=null;function fp(){hp=No=Td=null}function pp(l){var d=Ed.current;Tt(Ed),l._currentValue=d}function mp(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function jo(l,d){Td=l,hp=No=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(ar=!0),l.firstContext=null)}function Ar(l){var d=l._currentValue;if(hp!==l)if(l={context:l,memoizedValue:d,next:null},No===null){if(Td===null)throw Error(n(308));No=l,Td.dependencies={lanes:0,firstContext:l}}else No=No.next=l;return d}var ba=null;function gp(l){ba===null?ba=[l]:ba.push(l)}function Vy(l,d,p,x){var N=d.interleaved;return N===null?(p.next=p,gp(d)):(p.next=N.next,N.next=p),d.interleaved=p,Ds(l,x)}function Ds(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var vi=!1;function xp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hy(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function Ls(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function bi(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(dt&2)!==0){var N=x.pending;return N===null?d.next=d:(d.next=N.next,N.next=d),x.pending=d,Ds(l,p)}return N=x.interleaved,N===null?(d.next=d,gp(x)):(d.next=N.next,N.next=d),x.interleaved=d,Ds(l,p)}function Md(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Rf(l,p)}}function Wy(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var N=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var T={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?N=S=T:S=S.next=T,p=p.next}while(p!==null);S===null?N=S=d:S=S.next=d}else N=S=d;p={baseState:x.baseState,firstBaseUpdate:N,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function Ad(l,d,p,x){var N=l.updateQueue;vi=!1;var S=N.firstBaseUpdate,T=N.lastBaseUpdate,z=N.shared.pending;if(z!==null){N.shared.pending=null;var K=z,le=K.next;K.next=null,T===null?S=le:T.next=le,T=K;var ye=l.alternate;ye!==null&&(ye=ye.updateQueue,z=ye.lastBaseUpdate,z!==T&&(z===null?ye.firstBaseUpdate=le:z.next=le,ye.lastBaseUpdate=K))}if(S!==null){var be=N.baseState;T=0,ye=le=K=null,z=S;do{var xe=z.lane,Ie=z.eventTime;if((x&xe)===xe){ye!==null&&(ye=ye.next={eventTime:Ie,lane:0,tag:z.tag,payload:z.payload,callback:z.callback,next:null});e:{var Oe=l,_e=z;switch(xe=d,Ie=p,_e.tag){case 1:if(Oe=_e.payload,typeof Oe=="function"){be=Oe.call(Ie,be,xe);break e}be=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=_e.payload,xe=typeof Oe=="function"?Oe.call(Ie,be,xe):Oe,xe==null)break e;be=Y({},be,xe);break e;case 2:vi=!0}}z.callback!==null&&z.lane!==0&&(l.flags|=64,xe=N.effects,xe===null?N.effects=[z]:xe.push(z))}else Ie={eventTime:Ie,lane:xe,tag:z.tag,payload:z.payload,callback:z.callback,next:null},ye===null?(le=ye=Ie,K=be):ye=ye.next=Ie,T|=xe;if(z=z.next,z===null){if(z=N.shared.pending,z===null)break;xe=z,z=xe.next,xe.next=null,N.lastBaseUpdate=xe,N.shared.pending=null}}while(!0);if(ye===null&&(K=be),N.baseState=K,N.firstBaseUpdate=le,N.lastBaseUpdate=ye,d=N.shared.interleaved,d!==null){N=d;do T|=N.lane,N=N.next;while(N!==d)}else S===null&&(N.shared.lanes=0);ja|=T,l.lanes=T,l.memoizedState=be}}function Uy(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Np.transition;Np.transition={};try{l(!1),d()}finally{yt=p,Np.transition=x}}function dv(){return Rr().memoizedState}function M4(l,d,p){var x=ki(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},uv(l))hv(d,p);else if(p=Vy(l,d,p,x),p!==null){var N=Xn();Gr(p,l,x,N),fv(p,d,x)}}function A4(l,d,p){var x=ki(l),N={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(uv(l))hv(d,N);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var T=d.lastRenderedState,z=S(T,p);if(N.hasEagerState=!0,N.eagerState=z,Hr(z,T)){var K=d.interleaved;K===null?(N.next=N,gp(d)):(N.next=K.next,K.next=N),d.interleaved=N;return}}catch{}finally{}p=Vy(l,d,N,x),p!==null&&(N=Xn(),Gr(p,l,x,N),fv(p,d,x))}}function uv(l){var d=l.alternate;return l===Bt||d!==null&&d===Bt}function hv(l,d){$l=Pd=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function fv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Rf(l,p)}}var Ld={readContext:Ar,useCallback:zn,useContext:zn,useEffect:zn,useImperativeHandle:zn,useInsertionEffect:zn,useLayoutEffect:zn,useMemo:zn,useReducer:zn,useRef:zn,useState:zn,useDebugValue:zn,useDeferredValue:zn,useTransition:zn,useMutableSource:zn,useSyncExternalStore:zn,useId:zn,unstable_isNewReconciler:!1},R4={readContext:Ar,useCallback:function(l,d){return ms().memoizedState=[l,d===void 0?null:d],l},useContext:Ar,useEffect:nv,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Od(4194308,4,iv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Od(4194308,4,l,d)},useInsertionEffect:function(l,d){return Od(4,2,l,d)},useMemo:function(l,d){var p=ms();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=ms();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=M4.bind(null,Bt,l),[x.memoizedState,l]},useRef:function(l){var d=ms();return l={current:l},d.memoizedState=l},useState:ev,useDebugValue:Mp,useDeferredValue:function(l){return ms().memoizedState=l},useTransition:function(){var l=ev(!1),d=l[0];return l=T4.bind(null,l[1]),ms().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=Bt,N=ms();if(Dt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),xn===null)throw Error(n(349));(Na&30)!==0||Jy(x,d,p)}N.memoizedState=p;var S={value:p,getSnapshot:d};return N.queue=S,nv(Qy.bind(null,x,S,l),[l]),x.flags|=2048,Vl(9,Yy.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=ms(),d=xn.identifierPrefix;if(Dt){var p=Os,x=Ps;p=(x&~(1<<32-rr(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=Fl++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=T.createElement(p,{is:x.is}):(l=T.createElement(p),p==="select"&&(T=l,x.multiple?T.multiple=!0:x.size&&(T.size=x.size))):l=T.createElementNS(l,p),l[fs]=d,l[Pl]=x,Pv(l,d,!1,!1),d.stateNode=l;e:{switch(T=ha(p,x),p){case"dialog":Et("cancel",l),Et("close",l),N=x;break;case"iframe":case"object":case"embed":Et("load",l),N=x;break;case"video":case"audio":for(N=0;NTo&&(d.flags|=128,x=!0,Hl(S,!1),d.lanes=4194304)}else{if(!x)if(l=Rd(T),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Hl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!T.alternate&&!Dt)return $n(d),null}else 2*$t()-S.renderingStartTime>To&&p!==1073741824&&(d.flags|=128,x=!0,Hl(S,!1),d.lanes=4194304);S.isBackwards?(T.sibling=d.child,d.child=T):(p=S.last,p!==null?p.sibling=T:d.child=T,S.last=T)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=$t(),d.sibling=null,p=Ft.current,kt(Ft,x?p&1|2:p&1),d):($n(d),null);case 22:case 23:return Zp(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(br&1073741824)!==0&&($n(d),d.subtreeFlags&6&&(d.flags|=8192)):$n(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function $4(l,d){switch(lp(d),d.tag){case 1:return ir(d.type)&&bd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return ko(),Tt(sr),Tt(_n),wp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return vp(d),null;case 13:if(Tt(Ft),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));bo()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Tt(Ft),null;case 4:return ko(),null;case 10:return pp(d.type._context),null;case 22:case 23:return Zp(),null;case 24:return null;default:return null}}var Fd=!1,Fn=!1,F4=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function Co(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){Ht(l,d,x)}else p.current=null}function Bp(l,d,p){try{p()}catch(x){Ht(l,d,x)}}var Lv=!1;function B4(l,d){if(Zf=ad,l=py(),Uf(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var N=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var T=0,z=-1,K=-1,le=0,ye=0,be=l,xe=null;t:for(;;){for(var Ie;be!==p||N!==0&&be.nodeType!==3||(z=T+N),be!==S||x!==0&&be.nodeType!==3||(K=T+x),be.nodeType===3&&(T+=be.nodeValue.length),(Ie=be.firstChild)!==null;)xe=be,be=Ie;for(;;){if(be===l)break t;if(xe===p&&++le===N&&(z=T),xe===S&&++ye===x&&(K=T),(Ie=be.nextSibling)!==null)break;be=xe,xe=be.parentNode}be=Ie}p=z===-1||K===-1?null:{start:z,end:K}}else p=null}p=p||{start:0,end:0}}else p=null;for(ep={focusedElem:l,selectionRange:p},ad=!1,Pe=d;Pe!==null;)if(d=Pe,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Pe=l;else for(;Pe!==null;){d=Pe;try{var Oe=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Oe!==null){var _e=Oe.memoizedProps,Yt=Oe.memoizedState,ne=d.stateNode,J=ne.getSnapshotBeforeUpdate(d.elementType===d.type?_e:Ur(d.type,_e),Yt);ne.__reactInternalSnapshotBeforeUpdate=J}break;case 3:var se=d.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ne){Ht(d,d.return,Ne)}if(l=d.sibling,l!==null){l.return=d.return,Pe=l;break}Pe=d.return}return Oe=Lv,Lv=!1,Oe}function Wl(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var N=x=x.next;do{if((N.tag&l)===l){var S=N.destroy;N.destroy=void 0,S!==void 0&&Bp(d,p,S)}N=N.next}while(N!==x)}}function Bd(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function Vp(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function _v(l){var d=l.alternate;d!==null&&(l.alternate=null,_v(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[fs],delete d[Pl],delete d[sp],delete d[j4],delete d[k4])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function zv(l){return l.tag===5||l.tag===3||l.tag===4}function $v(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||zv(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Hp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=yd));else if(x!==4&&(l=l.child,l!==null))for(Hp(l,d,p),l=l.sibling;l!==null;)Hp(l,d,p),l=l.sibling}function Wp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(Wp(l,d,p),l=l.sibling;l!==null;)Wp(l,d,p),l=l.sibling}var En=null,Kr=!1;function wi(l,d,p){for(p=p.child;p!==null;)Fv(l,d,p),p=p.sibling}function Fv(l,d,p){if(gr&&typeof gr.onCommitFiberUnmount=="function")try{gr.onCommitFiberUnmount(ma,p)}catch{}switch(p.tag){case 5:Fn||Co(p,d);case 6:var x=En,N=Kr;En=null,wi(l,d,p),En=x,Kr=N,En!==null&&(Kr?(l=En,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):En.removeChild(p.stateNode));break;case 18:En!==null&&(Kr?(l=En,p=p.stateNode,l.nodeType===8?rp(l.parentNode,p):l.nodeType===1&&rp(l,p),Nl(l)):rp(En,p.stateNode));break;case 4:x=En,N=Kr,En=p.stateNode.containerInfo,Kr=!0,wi(l,d,p),En=x,Kr=N;break;case 0:case 11:case 14:case 15:if(!Fn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){N=x=x.next;do{var S=N,T=S.destroy;S=S.tag,T!==void 0&&((S&2)!==0||(S&4)!==0)&&Bp(p,d,T),N=N.next}while(N!==x)}wi(l,d,p);break;case 1:if(!Fn&&(Co(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(z){Ht(p,d,z)}wi(l,d,p);break;case 21:wi(l,d,p);break;case 22:p.mode&1?(Fn=(x=Fn)||p.memoizedState!==null,wi(l,d,p),Fn=x):wi(l,d,p);break;default:wi(l,d,p)}}function Bv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new F4),d.forEach(function(x){var N=Y4.bind(null,l,x);p.has(x)||(p.add(x),x.then(N,N))})}}function qr(l,d){var p=d.deletions;if(p!==null)for(var x=0;xN&&(N=T),x&=~S}if(x=N,x=$t()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*H4(x/1960))-x,10l?16:l,ji===null)var x=!1;else{if(l=ji,ji=null,Kd=0,(dt&6)!==0)throw Error(n(331));var N=dt;for(dt|=4,Pe=l.current;Pe!==null;){var S=Pe,T=S.child;if((Pe.flags&16)!==0){var z=S.deletions;if(z!==null){for(var K=0;K$t()-qp?Sa(l,0):Kp|=p),lr(l,d)}function eb(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ot,Ot<<=1,(Ot&130023424)===0&&(Ot=4194304)));var p=Xn();l=Ds(l,d),l!==null&&(li(l,d,p),lr(l,p))}function J4(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),eb(l,p)}function Y4(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,N=l.memoizedState;N!==null&&(p=N.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),eb(l,p)}var tb;tb=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||sr.current)ar=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return ar=!1,_4(l,d,p);ar=(l.flags&131072)!==0}else ar=!1,Dt&&(d.flags&1048576)!==0&&Oy(d,kd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;$d(l,d),l=d.pendingProps;var N=xo(d,_n.current);jo(d,p),N=kp(null,d,x,l,N,p);var S=Sp();return d.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,ir(x)?(S=!0,wd(d)):S=!1,d.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,xp(d),N.updater=_d,d.stateNode=N,N._reactInternals=d,Rp(d,x,l,p),d=Dp(null,d,x,!0,S,p)):(d.tag=0,Dt&&S&&op(d),Qn(null,d,N,p),d=d.child),d;case 16:x=d.elementType;e:{switch($d(l,d),l=d.pendingProps,N=x._init,x=N(x._payload),d.type=x,N=d.tag=X4(x),l=Ur(x,l),N){case 0:d=Op(null,d,x,l,p);break e;case 1:d=Ev(null,d,x,l,p);break e;case 11:d=Nv(null,d,x,l,p);break e;case 14:d=jv(null,d,x,Ur(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),Op(l,d,x,N,p);case 1:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),Ev(l,d,x,N,p);case 3:e:{if(Tv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,N=S.element,Hy(l,d),Ad(d,x,null,p);var T=d.memoizedState;if(x=T.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){N=So(Error(n(423)),d),d=Mv(l,d,x,p,N);break e}else if(x!==N){N=So(Error(n(424)),d),d=Mv(l,d,x,p,N);break e}else for(vr=mi(d.stateNode.containerInfo.firstChild),yr=d,Dt=!0,Wr=null,p=By(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(bo(),x===N){d=_s(l,d,p);break e}Qn(l,d,x,p)}d=d.child}return d;case 5:return Ky(d),l===null&&dp(d),x=d.type,N=d.pendingProps,S=l!==null?l.memoizedProps:null,T=N.children,tp(x,N)?T=null:S!==null&&tp(x,S)&&(d.flags|=32),Cv(l,d),Qn(l,d,T,p),d.child;case 6:return l===null&&dp(d),null;case 13:return Av(l,d,p);case 4:return yp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=wo(d,null,x,p):Qn(l,d,x,p),d.child;case 11:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),Nv(l,d,x,N,p);case 7:return Qn(l,d,d.pendingProps,p),d.child;case 8:return Qn(l,d,d.pendingProps.children,p),d.child;case 12:return Qn(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,N=d.pendingProps,S=d.memoizedProps,T=N.value,kt(Ed,x._currentValue),x._currentValue=T,S!==null)if(Hr(S.value,T)){if(S.children===N.children&&!sr.current){d=_s(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var z=S.dependencies;if(z!==null){T=S.child;for(var K=z.firstContext;K!==null;){if(K.context===x){if(S.tag===1){K=Ls(-1,p&-p),K.tag=2;var le=S.updateQueue;if(le!==null){le=le.shared;var ye=le.pending;ye===null?K.next=K:(K.next=ye.next,ye.next=K),le.pending=K}}S.lanes|=p,K=S.alternate,K!==null&&(K.lanes|=p),mp(S.return,p,d),z.lanes|=p;break}K=K.next}}else if(S.tag===10)T=S.type===d.type?null:S.child;else if(S.tag===18){if(T=S.return,T===null)throw Error(n(341));T.lanes|=p,z=T.alternate,z!==null&&(z.lanes|=p),mp(T,p,d),T=S.sibling}else T=S.child;if(T!==null)T.return=S;else for(T=S;T!==null;){if(T===d){T=null;break}if(S=T.sibling,S!==null){S.return=T.return,T=S;break}T=T.return}S=T}Qn(l,d,N.children,p),d=d.child}return d;case 9:return N=d.type,x=d.pendingProps.children,jo(d,p),N=Ar(N),x=x(N),d.flags|=1,Qn(l,d,x,p),d.child;case 14:return x=d.type,N=Ur(x,d.pendingProps),N=Ur(x.type,N),jv(l,d,x,N,p);case 15:return kv(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),$d(l,d),d.tag=1,ir(x)?(l=!0,wd(d)):l=!1,jo(d,p),mv(d,x,N),Rp(d,x,N,p),Dp(null,d,x,!0,l,p);case 19:return Iv(l,d,p);case 22:return Sv(l,d,p)}throw Error(n(156,d.tag))};function nb(l,d){return Zc(l,d)}function Q4(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pr(l,d,p,x){return new Q4(l,d,p,x)}function tm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function X4(l){if(typeof l=="function")return tm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===X)return 11;if(l===_)return 14}return 2}function Ci(l,d){var p=l.alternate;return p===null?(p=Pr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function Yd(l,d,p,x,N,S){var T=2;if(x=l,typeof l=="function")tm(l)&&(T=1);else if(typeof l=="string")T=5;else e:switch(l){case R:return Ea(p.children,N,S,d);case I:T=8,N|=8;break;case A:return l=Pr(12,p,d,N|2),l.elementType=A,l.lanes=S,l;case q:return l=Pr(13,p,d,N),l.elementType=q,l.lanes=S,l;case Z:return l=Pr(19,p,d,N),l.elementType=Z,l.lanes=S,l;case oe:return Qd(p,N,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case O:T=10;break e;case W:T=9;break e;case X:T=11;break e;case _:T=14;break e;case $:T=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Pr(T,p,d,N),d.elementType=l,d.type=x,d.lanes=S,d}function Ea(l,d,p,x){return l=Pr(7,l,x,d),l.lanes=p,l}function Qd(l,d,p,x){return l=Pr(22,l,x,d),l.elementType=oe,l.lanes=p,l.stateNode={isHidden:!1},l}function nm(l,d,p){return l=Pr(6,l,null,d),l.lanes=p,l}function rm(l,d,p){return d=Pr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function Z4(l,d,p,x,N){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sn(0),this.expirationTimes=sn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sn(0),this.identifierPrefix=x,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function sm(l,d,p,x,N,S,T,z,K){return l=new Z4(l,d,p,z,K),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Pr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},xp(S),l}function e3(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),dm.exports=h3(),dm.exports}var gb;function f3(){if(gb)return su;gb=1;var t=vN();return su.createRoot=t.createRoot,su.hydrateRoot=t.hydrateRoot,su}var p3=f3(),Bc=vN();const bN=yN(Bc);/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Nc(){return Nc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function yx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function g3(){return Math.random().toString(36).substr(2,8)}function yb(t,e){return{usr:t.state,key:t.key,idx:e}}function lg(t,e,n,r){return n===void 0&&(n=null),Nc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?al(e):e,{state:n,key:e&&e.key||r||g3()})}function Hu(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function al(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function x3(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:a=!1}=r,o=s.history,c=$i.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Nc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=$i.Pop;let w=f(),k=w==null?null:w-h;h=w,u&&u({action:c,location:j.location,delta:k})}function g(w,k){c=$i.Push;let E=lg(j.location,w,k);h=f()+1;let C=yb(E,h),M=j.createHref(E);try{o.pushState(C,"",M)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;s.location.assign(M)}a&&u&&u({action:c,location:j.location,delta:1})}function y(w,k){c=$i.Replace;let E=lg(j.location,w,k);h=f();let C=yb(E,h),M=j.createHref(E);o.replaceState(C,"",M),a&&u&&u({action:c,location:j.location,delta:0})}function v(w){let k=s.location.origin!=="null"?s.location.origin:s.location.href,E=typeof w=="string"?w:Hu(w);return E=E.replace(/ $/,"%20"),nn(k,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,k)}let j={get action(){return c},get location(){return t(s,o)},listen(w){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(xb,m),u=w,()=>{s.removeEventListener(xb,m),u=null}},createHref(w){return e(s,w)},createURL:v,encodeLocation(w){let k=v(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(w){return o.go(w)}};return j}var vb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(vb||(vb={}));function y3(t,e,n){return n===void 0&&(n="/"),v3(t,e,n)}function v3(t,e,n,r){let s=typeof e=="string"?al(e):e,a=vx(s.pathname||"/",n);if(a==null)return null;let o=wN(t);b3(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};u.relativePath.startsWith("/")&&(nn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=Ui([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(nn(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),wN(a.children,e,f,h)),!(a.path==null&&!a.index)&&e.push({path:h,score:E3(h,a.index),routesMeta:f})};return t.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))s(a,o);else for(let u of NN(a.path))s(a,o,u)}),e}function NN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return s?[a,""]:[a];let o=NN(r.join("/")),c=[];return c.push(...o.map(u=>u===""?a:[a,u].join("/"))),s&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function b3(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:T3(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const w3=/^:[\w-]+$/,N3=3,j3=2,k3=1,S3=10,C3=-2,bb=t=>t==="*";function E3(t,e){let n=t.split("/"),r=n.length;return n.some(bb)&&(r+=C3),e&&(r+=j3),n.filter(s=>!bb(s)).reduce((s,a)=>s+(w3.test(a)?N3:a===""?k3:S3),r)}function T3(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function M3(t,e,n){let{routesMeta:r}=t,s={},a="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let j=c[m]||"";o=a.slice(0,a.length-j.length).replace(/(.)\/+$/,"$1")}const v=c[m];return y&&!v?h[g]=void 0:h[g]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:o,pattern:t}}function R3(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),yx(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function I3(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return yx(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function vx(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const P3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,O3=t=>P3.test(t);function D3(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?al(t):t,a;if(n)if(O3(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),yx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=wb(n.substring(1),"/"):a=wb(n,e)}else a=e;return{pathname:a,search:z3(r),hash:$3(s)}}function wb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function fm(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function L3(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function bx(t,e){let n=L3(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function wx(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=al(t):(s=Nc({},t),nn(!s.pathname||!s.pathname.includes("?"),fm("?","pathname","search",s)),nn(!s.pathname||!s.pathname.includes("#"),fm("#","pathname","hash",s)),nn(!s.search||!s.search.includes("#"),fm("#","search","hash",s)));let a=t===""||s.pathname==="",o=a?"/":s.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;s.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=D3(s,c),h=o&&o!=="/"&&o.endsWith("/"),f=(a||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const Ui=t=>t.join("/").replace(/\/\/+/g,"/"),_3=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),z3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,$3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function F3(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const jN=["post","put","patch","delete"];new Set(jN);const B3=["get",...jN];new Set(B3);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function jc(){return jc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=wx(h,JSON.parse(o),a,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:Ui([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,a,t])}const U3=b.createContext(null);function K3(t){let e=b.useContext(ti).outlet;return e&&b.createElement(U3.Provider,{value:t},e)}function CN(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(ra),{matches:s}=b.useContext(ti),{pathname:a}=sa(),o=JSON.stringify(bx(s,r.v7_relativeSplatPath));return b.useMemo(()=>wx(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function q3(t,e){return G3(t,e)}function G3(t,e,n,r){ol()||nn(!1);let{navigator:s}=b.useContext(ra),{matches:a}=b.useContext(ti),o=a[a.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=sa(),f;if(e){var m;let w=typeof e=="string"?al(e):e;u==="/"||(m=w.pathname)!=null&&m.startsWith(u)||nn(!1),f=w}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let w=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=y3(t,{pathname:y}),j=Z3(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Ui([u,s.encodeLocation?s.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:Ui([u,s.encodeLocation?s.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),a,n,r);return e&&j?b.createElement(Uh.Provider,{value:{location:jc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:$i.Pop}},j):j}function J3(){let t=rT(),e=F3(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:s},n):null,null)}const Y3=b.createElement(J3,null);class Q3 extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(ti.Provider,{value:this.props.routeContext},b.createElement(kN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function X3(t){let{routeContext:e,match:n,children:r}=t,s=b.useContext(Nx);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(ti.Provider,{value:e},r)}function Z3(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var a;if(!n)return null;if(n.errors)t=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(s=n)==null?void 0:s.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||nn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let y,v=!1,j=null,w=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||Y3,u&&(h<0&&g===0?(iT("route-fallback"),v=!0,w=null):h===g&&(v=!0,w=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),E=()=>{let C;return y?C=j:v?C=w:m.route.Component?C=b.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,b.createElement(X3,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(Q3,{location:n.location,revalidation:n.revalidation,component:j,error:y,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):E()},null)}var EN=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(EN||{}),TN=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(TN||{});function eT(t){let e=b.useContext(Nx);return e||nn(!1),e}function tT(t){let e=b.useContext(V3);return e||nn(!1),e}function nT(t){let e=b.useContext(ti);return e||nn(!1),e}function MN(t){let e=nT(),n=e.matches[e.matches.length-1];return n.route.id||nn(!1),n.route.id}function rT(){var t;let e=b.useContext(kN),n=tT(),r=MN();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function sT(){let{router:t}=eT(EN.UseNavigateStable),e=MN(TN.UseNavigateStable),n=b.useRef(!1);return SN(()=>{n.current=!0}),b.useCallback(function(s,a){a===void 0&&(a={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,jc({fromRouteId:e},a)))},[t,e])}const Nb={};function iT(t,e,n){Nb[t]||(Nb[t]=!0)}function aT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function oT(t){let{to:e,replace:n,state:r,relative:s}=t;ol()||nn(!1);let{future:a,static:o}=b.useContext(ra),{matches:c}=b.useContext(ti),{pathname:u}=sa(),h=ia(),f=wx(e,bx(c,a.v7_relativeSplatPath),u,s==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:s}),[h,m,s,n,r]),null}function lT(t){return K3(t.context)}function Mt(t){nn(!1)}function cT(t){let{basename:e="/",children:n=null,location:r,navigationType:s=$i.Pop,navigator:a,static:o=!1,future:c}=t;ol()&&nn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:a,static:o,future:jc({v7_relativeSplatPath:!1},c)}),[u,c,a,o]);typeof r=="string"&&(r=al(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:v="default"}=r,j=b.useMemo(()=>{let w=vx(f,u);return w==null?null:{location:{pathname:w,search:m,hash:g,state:y,key:v},navigationType:s}},[u,f,m,g,y,v,s]);return j==null?null:b.createElement(ra.Provider,{value:h},b.createElement(Uh.Provider,{children:n,value:j}))}function dT(t){let{children:e,location:n}=t;return q3(cg(e),n)}new Promise(()=>{});function cg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,s)=>{if(!b.isValidElement(r))return;let a=[...e,s];if(r.type===b.Fragment){n.push.apply(n,cg(r.props.children,a));return}r.type!==Mt&&nn(!1),!r.props.index||!r.props.children||nn(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=cg(r.props.children,a)),n.push(o)}),n}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function dg(){return dg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[s]=t[s]);return n}function hT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function fT(t,e){return t.button===0&&(!e||e==="_self")&&!hT(t)}function ug(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function pT(t,e){let n=ug(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(a=>{n.append(s,a)})}),n}const mT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gT="6";try{window.__reactRouterVersion=gT}catch{}const xT="startTransition",jb=Wh[xT];function yT(t){let{basename:e,children:n,future:r,window:s}=t,a=b.useRef();a.current==null&&(a.current=m3({window:s,v5Compat:!0}));let o=a.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&jb?jb(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>aT(r),[r]),b.createElement(cT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const vT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",bT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Iu=b.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:a,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=uT(e,mT),{basename:y}=b.useContext(ra),v,j=!1;if(typeof h=="string"&&bT.test(h)&&(v=h,vT))try{let C=new URL(window.location.href),M=h.startsWith("//")?new URL(C.protocol+h):new URL(h),D=vx(M.pathname,y);M.origin===C.origin&&D!=null?h=D+M.search+M.hash:j=!0}catch{}let w=H3(h,{relative:s}),k=wT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:s,viewTransition:m});function E(C){r&&r(C),C.defaultPrevented||k(C)}return b.createElement("a",dg({},g,{href:v||w,onClick:j||a?r:E,ref:n,target:u}))});var kb;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(kb||(kb={}));var Sb;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Sb||(Sb={}));function wT(t,e){let{target:n,replace:r,state:s,preventScrollReset:a,relative:o,viewTransition:c}=e===void 0?{}:e,u=ia(),h=sa(),f=CN(t,{relative:o});return b.useCallback(m=>{if(fT(m,n)){m.preventDefault();let g=r!==void 0?r:Hu(h)===Hu(f);u(t,{replace:g,state:s,preventScrollReset:a,relative:o,viewTransition:c})}},[h,u,f,r,s,n,t,a,o,c])}function AN(t){let e=b.useRef(ug(t)),n=b.useRef(!1),r=sa(),s=b.useMemo(()=>pT(r.search,n.current?null:e.current),[r.search]),a=ia(),o=b.useCallback((c,u)=>{const h=ug(typeof c=="function"?c(s):c);n.current=!0,a("?"+h,u)},[a,s]);return[s,o]}/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Cb=t=>{const e=jT(t);return e.charAt(0).toUpperCase()+e.slice(1)},RN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),kT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var ST={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CT=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...ST,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:RN("lucide",s),...!a&&!kT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(a)?a:[a]]));/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const je=(t,e)=>{const n=b.forwardRef(({className:r,...s},a)=>b.createElement(CT,{ref:a,iconNode:e,className:RN(`lucide-${NT(Cb(t))}`,`lucide-${t}`,r),...s}));return n.displayName=Cb(t),n};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ET=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],TT=je("arrow-up-down",ET);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MT=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],Eb=je("bitcoin",MT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AT=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],RT=je("bold",AT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IT=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],zr=je("book-open",IT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PT=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],kc=je("calendar",PT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OT=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],DT=je("chart-column",OT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Kh=je("check",LT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _T=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Jo=je("chevron-down",_T);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],$T=je("chevron-left",zT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Bo=je("chevron-right",FT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],jx=je("chevron-up",BT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],HT=je("circle-alert",VT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Tb=je("circle-check-big",WT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hg=je("circle-check",UT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],IN=je("circle-question-mark",KT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],pm=je("circle-user",qT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],PN=je("circle-x",GT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fg=je("clock",JT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YT=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],QT=je("code",YT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XT=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ON=je("copy",XT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZT=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],pg=je("credit-card",ZT);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eM=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Fi=je("crown",eM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tM=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Wu=je("dollar-sign",tM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nM=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],rM=je("download",nM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sM=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Xs=je("external-link",sM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iM=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],mg=je("eye",iM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],oM=je("file-text",aM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lM=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],DN=je("funnel",lM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cM=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],dM=je("gift",cM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uM=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],hM=je("git-merge",uM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],gg=je("globe",fM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pM=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],LN=je("graduation-cap",pM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mM=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],$s=je("grip-vertical",mM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gM=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],_N=je("handshake",gM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xM=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],yM=je("hash",xM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],bM=je("heading-1",vM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],NM=je("heading-2",wM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],kM=je("heading-3",jM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SM=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],CM=je("house",SM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],zN=je("image",EM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],iu=je("info",TM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],AM=je("italic",MM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],IM=je("key",RM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],OM=je("layout-dashboard",PM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Ns=je("link-2",DM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],xg=je("link",LM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _M=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],zM=je("list-ordered",_M);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $M=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],FM=je("list",$M);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],VM=je("lock",BM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],WM=je("log-out",HM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UM=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],$N=je("map-pin",UM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],qM=je("menu",KM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],JM=je("message-circle",GM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YM=[["path",{d:"M5 12h14",key:"1ays0h"}]],QM=je("minus",YM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],Vo=je("navigation",XM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],eA=je("palette",ZM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tA=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],wt=je("pen-line",tA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nA=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],rA=je("percent",nA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sA=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],iA=je("phone",sA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],oA=je("pin",aA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Lt=je("plus",lA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cA=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Mb=je("qr-code",cA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dA=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],uA=je("quote",dA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hA=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],fA=je("redo",hA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],qe=je("refresh-cw",pA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mA=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],rn=je("save",mA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ki=je("search",gA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xA=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],yA=je("send",xA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vA=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Da=je("settings",vA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bA=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],au=je("settings-2",bA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wA=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],qh=je("shield-check",wA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NA=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],yg=je("shopping-bag",NA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Sc=je("smartphone",jA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Ho=je("star",kA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],CA=je("strikethrough",SA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EA=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],TA=je("table",EA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],mm=je("tag",MA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],vn=je("trash-2",AA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],dc=je("trending-up",RA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ab=je("trophy",IA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PA=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],FN=je("undo-2",PA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],DA=je("undo",OA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Uu=je("upload",LA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _A=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],vg=je("user-plus",_A);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zA=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],La=je("user",zA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $A=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Pn=je("users",$A);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FA=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Yo=je("wallet",FA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],er=je("x",BA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Bi=je("zap",VA),kx="admin_token";function Sx(){try{return localStorage.getItem(kx)}catch{return null}}function HA(t){try{localStorage.setItem(kx,t)}catch{}}function WA(){try{localStorage.removeItem(kx)}catch{}}const UA="https://soulapi.quwanzhi.com",KA=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):UA};function Qo(t){const e=KA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Gh(t,e={}){const{data:n,...r}=e,s=Qo(t),a=new Headers(r.headers),o=Sx();o&&a.set("Authorization",`Bearer ${o}`),n!=null&&!a.has("Content-Type")&&a.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=await fetch(s,{...r,headers:a,body:c,credentials:"include"}),f=(u.headers.get("Content-Type")||"").includes("application/json")?await u.json():u;if(!u.ok){const m=new Error((f==null?void 0:f.error)||`HTTP ${u.status}`);throw m.status=u.status,m.data=f,m}return f}function Be(t,e){return Gh(t,{...e,method:"GET"})}function ht(t,e,n){return Gh(t,{...n,method:"POST",data:e})}function Rt(t,e,n){return Gh(t,{...n,method:"PUT",data:e})}function Yr(t,e){return Gh(t,{...e,method:"DELETE"})}const qA=[{icon:OM,label:"数据概览",href:"/dashboard"},{icon:zr,label:"内容管理",href:"/content"},{icon:Pn,label:"用户管理",href:"/users"}],Rb=[{icon:Fi,label:"VIP 角色",href:"/vip-roles"},{icon:La,label:"作者详情",href:"/author-settings"},{icon:qh,label:"管理员",href:"/admin-users"},{icon:LN,label:"导师管理",href:"/mentors"},{icon:kc,label:"导师预约",href:"/mentor-consultations"},{icon:Yo,label:"推广中心",href:"/distribution"},{icon:_N,label:"找伙伴",href:"/find-partner"},{icon:hM,label:"匹配记录",href:"/match-records"},{icon:pg,label:"推广设置",href:"/referral-settings"}];function GA(){const t=sa(),e=ia(),[n,r]=b.useState(!1),[s,a]=b.useState(!1),[o,c]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{Rb.some(f=>t.pathname===f.href)&&c(!0)},[t.pathname]),b.useEffect(()=>{if(!n)return;a(!1);let h=!1;return Be("/api/admin").then(f=>{h||(f&&f.success!==!1?a(!0):e("/login",{replace:!0}))}).catch(()=>{h||e("/login",{replace:!0})}),()=>{h=!0}},[n,e]);const u=async()=>{WA();try{await ht("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!s?i.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[i.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):i.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[i.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[i.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[i.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),i.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),i.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[qA.map(h=>{const f=t.pathname===h.href;return i.jsxs(Iu,{to:h.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${f?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(h.icon,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:h.label})]},h.href)}),i.jsx("button",{type:"button",onClick:()=>c(!o),className:"w-full flex items-center justify-between gap-3 px-4 py-3 text-gray-400 hover:bg-gray-700/50 hover:text-white rounded-lg transition-colors",children:i.jsxs("span",{className:"flex items-center gap-3",children:[o?i.jsx(jx,{className:"w-5 h-5"}):i.jsx(Jo,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm",children:"更多"})]})}),o&&i.jsx("div",{className:"space-y-1 pl-4",children:Rb.map(h=>{const f=t.pathname===h.href;return i.jsxs(Iu,{to:h.href,className:`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${f?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(h.icon,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:h.label})]},h.href)})}),i.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:i.jsxs(Iu,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(Da,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),i.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:i.jsxs("button",{type:"button",onClick:u,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[i.jsx(WM,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),i.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:i.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:i.jsx(lT,{})})})]})}function Ib(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Cx(...t){return e=>{let n=!1;const r=t.map(s=>{const a=Ib(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s{let{children:a,...o}=r;BN(a)&&typeof Ku=="function"&&(a=Ku(a._payload));const c=b.Children.toArray(a),u=c.find(ZA);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return i.jsx(e,{...o,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}var HN=VN("Slot");function QA(t){const e=b.forwardRef((n,r)=>{let{children:s,...a}=n;if(BN(s)&&typeof Ku=="function"&&(s=Ku(s._payload)),b.isValidElement(s)){const o=tR(s),c=eR(a,s.props);return s.type!==b.Fragment&&(c.ref=r?Cx(r,o):o),b.cloneElement(s,c)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var XA=Symbol("radix.slottable");function ZA(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===XA}function eR(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...c)=>{const u=a(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function tR(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function WN(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Ob=UN,KN=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Ob(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:a}=e,o=Object.keys(s).map(h=>{const f=n==null?void 0:n[h],m=a==null?void 0:a[h];if(f===null)return null;const g=Pb(f)||Pb(m);return s[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(v=>{let[j,w]=v;return Array.isArray(w)?w.includes({...a,...c}[j]):{...a,...c}[j]===w})?[...h,m,g]:h},[]);return Ob(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},nR=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),qN=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),qu="-",Db=[],sR="arbitrary..",iR=t=>{const e=oR(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return aR(o);const c=o.split(qu),u=c[0]===""&&c.length>1?1:0;return GN(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?nR(h,u):u:h||Db}return n[o]||Db}}},GN=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],a=n.nextPart.get(s);if(a){const h=GN(t,e+1,a);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(qu):t.slice(e).join(qu),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?sR+r:void 0})(),oR=t=>{const{theme:e,classGroups:n}=t;return lR(n,e)},lR=(t,e)=>{const n=qN();for(const r in t){const s=t[r];Ex(s,n,r,e)}return n},Ex=(t,e,n,r)=>{const s=t.length;for(let a=0;a{if(typeof t=="string"){dR(t,e,n);return}if(typeof t=="function"){uR(t,e,n,r);return}hR(t,e,n,r)},dR=(t,e,n)=>{const r=t===""?e:JN(e,t);r.classGroupId=n},uR=(t,e,n,r)=>{if(fR(t)){Ex(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(rR(n,t))},hR=(t,e,n,r)=>{const s=Object.entries(t),a=s.length;for(let o=0;o{let n=t;const r=e.split(qu),s=r.length;for(let a=0;a"isThemeGetter"in t&&t.isThemeGetter===!0,pR=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(a,o)=>{n[a]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return s(a,o),o},set(a,o){a in n?n[a]=o:s(a,o)}}},bg="!",Lb=":",mR=[],_b=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),gR=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const a=[];let o=0,c=0,u=0,h;const f=s.length;for(let j=0;ju?h-u:void 0;return _b(a,y,g,v)};if(e){const s=e+Lb,a=r;r=o=>o.startsWith(s)?a(o.slice(s.length)):_b(mR,!1,o,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},xR=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},yR=t=>({cache:pR(t.cacheSize),parseClassName:gR(t),sortModifiers:xR(t),...iR(t)}),vR=/\s+/,bR=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=e,o=[],c=t.trim().split(vR);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let w=!!j,k=r(w?v.substring(0,j):v);if(!k){if(!w){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:a(g).join(":"),C=y?E+bg:E,M=C+k;if(o.indexOf(M)>-1)continue;o.push(M);const D=s(k,w);for(let F=0;F0?" "+u:u)}return u},wR=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,a;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=yR(h),r=n.cache.get,s=n.cache.set,a=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=bR(u,n);return s(u,f),f};return a=o,(...u)=>a(wR(...u))},jR=[],un=t=>{const e=n=>n[t]||jR;return e.isThemeGetter=!0,e},QN=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,XN=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kR=/^\d+\/\d+$/,SR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CR=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ER=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,TR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ao=t=>kR.test(t),at=t=>!!t&&!Number.isNaN(Number(t)),Ti=t=>!!t&&Number.isInteger(Number(t)),gm=t=>t.endsWith("%")&&at(t.slice(0,-1)),Fs=t=>SR.test(t),AR=()=>!0,RR=t=>CR.test(t)&&!ER.test(t),ZN=()=>!1,IR=t=>TR.test(t),PR=t=>MR.test(t),OR=t=>!De(t)&&!Le(t),DR=t=>ll(t,nj,ZN),De=t=>QN.test(t),Ta=t=>ll(t,rj,RR),xm=t=>ll(t,FR,at),zb=t=>ll(t,ej,ZN),LR=t=>ll(t,tj,PR),ou=t=>ll(t,sj,IR),Le=t=>XN.test(t),Yl=t=>cl(t,rj),_R=t=>cl(t,BR),$b=t=>cl(t,ej),zR=t=>cl(t,nj),$R=t=>cl(t,tj),lu=t=>cl(t,sj,!0),ll=(t,e,n)=>{const r=QN.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},cl=(t,e,n=!1)=>{const r=XN.exec(t);return r?r[1]?e(r[1]):n:!1},ej=t=>t==="position"||t==="percentage",tj=t=>t==="image"||t==="url",nj=t=>t==="length"||t==="size"||t==="bg-size",rj=t=>t==="length",FR=t=>t==="number",BR=t=>t==="family-name",sj=t=>t==="shadow",VR=()=>{const t=un("color"),e=un("font"),n=un("text"),r=un("font-weight"),s=un("tracking"),a=un("leading"),o=un("breakpoint"),c=un("container"),u=un("spacing"),h=un("radius"),f=un("shadow"),m=un("inset-shadow"),g=un("text-shadow"),y=un("drop-shadow"),v=un("blur"),j=un("perspective"),w=un("aspect"),k=un("ease"),E=un("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...M(),Le,De],F=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],I=()=>[Le,De,u],A=()=>[Ao,"full","auto",...I()],O=()=>[Ti,"none","subgrid",Le,De],W=()=>["auto",{span:["full",Ti,Le,De]},Ti,Le,De],X=()=>[Ti,"auto",Le,De],q=()=>["auto","min","max","fr",Le,De],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],_=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...I()],oe=()=>[Ao,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],V=()=>[t,Le,De],ae=()=>[...M(),$b,zb,{position:[Le,De]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",zR,DR,{size:[Le,De]}],H=()=>[gm,Yl,Ta],ue=()=>["","none","full",h,Le,De],U=()=>["",at,Yl,Ta],he=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[at,gm,$b,zb],de=()=>["","none",v,Le,De],Ce=()=>["none",at,Le,De],B=()=>["none",at,Le,De],me=()=>[at,Le,De],Se=()=>[Ao,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fs],breakpoint:[Fs],color:[AR],container:[Fs],"drop-shadow":[Fs],ease:["in","out","in-out"],font:[OR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fs],shadow:[Fs],spacing:["px",at],text:[Fs],"text-shadow":[Fs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ao,De,Le,w]}],container:["container"],columns:[{columns:[at,De,Le,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Ti,"auto",Le,De]}],basis:[{basis:[Ao,"full","auto",c,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[at,Ao,"auto","initial","none",De]}],grow:[{grow:["",at,Le,De]}],shrink:[{shrink:["",at,Le,De]}],order:[{order:[Ti,"first","last","none",Le,De]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[..._(),"normal"]}],"justify-self":[{"justify-self":["auto",..._()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[..._(),{baseline:["","last"]}]}],"align-self":[{self:["auto",..._(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[..._(),"baseline"]}],"place-self":[{"place-self":["auto",..._()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:oe()}],w:[{w:[c,"screen",...oe()]}],"min-w":[{"min-w":[c,"screen","none",...oe()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...oe()]}],h:[{h:["screen","lh",...oe()]}],"min-h":[{"min-h":["screen","lh","none",...oe()]}],"max-h":[{"max-h":["screen","lh",...oe()]}],"font-size":[{text:["base",n,Yl,Ta]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Le,xm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gm,De]}],"font-family":[{font:[_R,De,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Le,De]}],"line-clamp":[{"line-clamp":[at,"none",Le,xm]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",Le,De]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Le,De]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[at,"from-font","auto",Le,Ta]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[at,"auto",Le,De]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le,De]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Le,De]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ti,Le,De],radial:["",Le,De],conic:[Ti,Le,De]},$R,LR]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[at,Le,De]}],"outline-w":[{outline:["",at,Yl,Ta]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",f,lu,ou]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",m,lu,ou]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[at,Ta]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",g,lu,ou]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[at,Le,De]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[at]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Le,De]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[at]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Le,De]}],filter:[{filter:["","none",Le,De]}],blur:[{blur:de()}],brightness:[{brightness:[at,Le,De]}],contrast:[{contrast:[at,Le,De]}],"drop-shadow":[{"drop-shadow":["","none",y,lu,ou]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",at,Le,De]}],"hue-rotate":[{"hue-rotate":[at,Le,De]}],invert:[{invert:["",at,Le,De]}],saturate:[{saturate:[at,Le,De]}],sepia:[{sepia:["",at,Le,De]}],"backdrop-filter":[{"backdrop-filter":["","none",Le,De]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[at,Le,De]}],"backdrop-contrast":[{"backdrop-contrast":[at,Le,De]}],"backdrop-grayscale":[{"backdrop-grayscale":["",at,Le,De]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[at,Le,De]}],"backdrop-invert":[{"backdrop-invert":["",at,Le,De]}],"backdrop-opacity":[{"backdrop-opacity":[at,Le,De]}],"backdrop-saturate":[{"backdrop-saturate":[at,Le,De]}],"backdrop-sepia":[{"backdrop-sepia":["",at,Le,De]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Le,De]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[at,"initial",Le,De]}],ease:[{ease:["linear","initial",k,Le,De]}],delay:[{delay:[at,Le,De]}],animate:[{animate:["none",E,Le,De]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Le,De]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[Le,De,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Le,De]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Le,De]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[at,Yl,Ta,xm]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},HR=NR(VR);function xt(...t){return HR(UN(t))}const WR=KN("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function re({className:t,variant:e,size:n,asChild:r=!1,...s}){const a=r?HN:"button";return i.jsx(a,{"data-slot":"button",className:xt(WR({variant:e,size:n,className:t})),...s})}function ce({className:t,type:e,...n}){return i.jsx("input",{type:e,"data-slot":"input",className:xt("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",t),...n})}function UR(){const t=ia(),[e,n]=b.useState(""),[r,s]=b.useState(""),[a,o]=b.useState(""),[c,u]=b.useState(!1),h=async()=>{o(""),u(!0);try{const f=await ht("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){HA(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return i.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[i.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[i.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),i.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),i.jsxs("div",{className:"w-full max-w-md relative z-10",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("div",{className:"w-16 h-16 bg-[#38bdac]/20 rounded-2xl flex items-center justify-center mx-auto mb-4 border border-[#38bdac]/30",children:i.jsx(qh,{className:"w-8 h-8 text-[#38bdac]"})}),i.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),i.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),i.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[i.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),i.jsxs("div",{className:"relative",children:[i.jsx(La,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),i.jsx(ce,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),i.jsxs("div",{className:"relative",children:[i.jsx(VM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),i.jsx(ce,{type:"password",value:r,onChange:f=>s(f.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),a&&i.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:a}),i.jsx(re,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),i.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Ee=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:xt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ee.displayName="Card";const et=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:xt("flex flex-col space-y-1.5 p-6",t),...e}));et.displayName="CardHeader";const tt=b.forwardRef(({className:t,...e},n)=>i.jsx("h3",{ref:n,className:xt("font-semibold leading-none tracking-tight",t),...e}));tt.displayName="CardTitle";const It=b.forwardRef(({className:t,...e},n)=>i.jsx("p",{ref:n,className:xt("text-sm text-muted-foreground",t),...e}));It.displayName="CardDescription";const Te=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:xt("p-6 pt-0",t),...e}));Te.displayName="CardContent";const KR=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:xt("flex items-center p-6 pt-0",t),...e}));KR.displayName="CardFooter";function nt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function qR(t,e){const n=b.createContext(e),r=a=>{const{children:o,...c}=a,u=b.useMemo(()=>c,Object.values(c));return i.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function s(a){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,s]}function aa(t,e=[]){let n=[];function r(a,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...v}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,w=b.useMemo(()=>v,Object.values(v));return i.jsx(j.Provider,{value:w,children:y})};h.displayName=a+"Provider";function f(m,g){var j;const y=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,v=b.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,f]}const s=()=>{const a=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||a;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return s.scopeName=t,[r,GR(s,...e)]}function GR(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(a)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Vn=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},JR=Wh[" useId ".trim().toString()]||(()=>{}),YR=0;function qi(t){const[e,n]=b.useState(JR());return Vn(()=>{n(r=>r??String(YR++))},[t]),e?`radix-${e}`:""}var QR=Wh[" useInsertionEffect ".trim().toString()]||Vn;function Va({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,a,o]=XR({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:s;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const g=ZR(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else a(f)},[c,t,a,o]);return[u,h]}function XR({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),s=b.useRef(n),a=b.useRef(e);return QR(()=>{a.current=e},[e]),b.useEffect(()=>{var o;s.current!==n&&((o=a.current)==null||o.call(a,n),s.current=n)},[n,s]),[n,r,a]}function ZR(t){return typeof t=="function"}function Cc(t){const e=e5(t),n=b.forwardRef((r,s)=>{const{children:a,...o}=r,c=b.Children.toArray(a),u=c.find(n5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return i.jsx(e,{...o,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function e5(t){const e=b.forwardRef((n,r)=>{const{children:s,...a}=n;if(b.isValidElement(s)){const o=s5(s),c=r5(a,s.props);return s.type!==b.Fragment&&(c.ref=r?Cx(r,o):o),b.cloneElement(s,c)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var t5=Symbol("radix.slottable");function n5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===t5}function r5(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...c)=>{const u=a(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function s5(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var i5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ot=i5.reduce((t,e)=>{const n=Cc(`Primitive.${e}`),r=b.forwardRef((s,a)=>{const{asChild:o,...c}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function a5(t,e){t&&Bc.flushSync(()=>t.dispatchEvent(e))}function Xi(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function o5(t,e=globalThis==null?void 0:globalThis.document){const n=Xi(t);b.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var l5="DismissableLayer",wg="dismissableLayer.update",c5="dismissableLayer.pointerDownOutside",d5="dismissableLayer.focusOutside",Fb,ij=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Tx=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(ij),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=gt(e,R=>m(R)),j=Array.from(h.layers),[w]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(w),E=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,M=E>=k,D=f5(R=>{const I=R.target,A=[...h.branches].some(O=>O.contains(I));!M||A||(s==null||s(R),o==null||o(R),R.defaultPrevented||c==null||c())},g),F=p5(R=>{const I=R.target;[...h.branches].some(O=>O.contains(I))||(a==null||a(R),o==null||o(R),R.defaultPrevented||c==null||c())},g);return o5(R=>{E===h.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Fb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Bb(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Fb)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Bb())},[f,h]),b.useEffect(()=>{const R=()=>y({});return document.addEventListener(wg,R),()=>document.removeEventListener(wg,R)},[]),i.jsx(ot.div,{...u,ref:v,style:{pointerEvents:C?M?"auto":"none":void 0,...t.style},onFocusCapture:nt(t.onFocusCapture,F.onFocusCapture),onBlurCapture:nt(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:nt(t.onPointerDownCapture,D.onPointerDownCapture)})});Tx.displayName=l5;var u5="DismissableLayerBranch",h5=b.forwardRef((t,e)=>{const n=b.useContext(ij),r=b.useRef(null),s=gt(e,r);return b.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(ot.div,{...t,ref:s})});h5.displayName=u5;function f5(t,e=globalThis==null?void 0:globalThis.document){const n=Xi(t),r=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const a=c=>{if(c.target&&!r.current){let u=function(){aj(c5,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=u,e.addEventListener("click",s.current,{once:!0})):u()}else e.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function p5(t,e=globalThis==null?void 0:globalThis.document){const n=Xi(t),r=b.useRef(!1);return b.useEffect(()=>{const s=a=>{a.target&&!r.current&&aj(d5,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Bb(){const t=new CustomEvent(wg);document.dispatchEvent(t)}function aj(t,e,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?a5(s,a):s.dispatchEvent(a)}var ym="focusScope.autoFocusOnMount",vm="focusScope.autoFocusOnUnmount",Vb={bubbles:!1,cancelable:!0},m5="FocusScope",Mx=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=t,[c,u]=b.useState(null),h=Xi(s),f=Xi(a),m=b.useRef(null),g=gt(e,j=>u(j)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let j=function(C){if(y.paused||!c)return;const M=C.target;c.contains(M)?m.current=M:Ri(m.current,{select:!0})},w=function(C){if(y.paused||!c)return;const M=C.relatedTarget;M!==null&&(c.contains(M)||Ri(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const D of C)D.removedNodes.length>0&&Ri(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",w);const E=new MutationObserver(k);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){Wb.add(y);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(ym,Vb);c.addEventListener(ym,h),c.dispatchEvent(k),k.defaultPrevented||(g5(w5(oj(c)),{select:!0}),document.activeElement===j&&Ri(c))}return()=>{c.removeEventListener(ym,h),setTimeout(()=>{const k=new CustomEvent(vm,Vb);c.addEventListener(vm,f),c.dispatchEvent(k),k.defaultPrevented||Ri(j??document.body,{select:!0}),c.removeEventListener(vm,f),Wb.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(j=>{if(!n&&!r||y.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(w&&k){const E=j.currentTarget,[C,M]=x5(E);C&&M?!j.shiftKey&&k===M?(j.preventDefault(),n&&Ri(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&Ri(M,{select:!0})):k===E&&j.preventDefault()}},[n,r,y.paused]);return i.jsx(ot.div,{tabIndex:-1,...o,ref:g,onKeyDown:v})});Mx.displayName=m5;function g5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ri(r,{select:e}),document.activeElement!==n)return}function x5(t){const e=oj(t),n=Hb(e,t),r=Hb(e.reverse(),t);return[n,r]}function oj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Hb(t,e){for(const n of t)if(!y5(n,{upTo:e}))return n}function y5(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function v5(t){return t instanceof HTMLInputElement&&"select"in t}function Ri(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&v5(t)&&e&&t.select()}}var Wb=b5();function b5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Ub(t,e),t.unshift(e)},remove(e){var n;t=Ub(t,e),(n=t[0])==null||n.resume()}}}function Ub(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function w5(t){return t.filter(e=>e.tagName!=="A")}var N5="Portal",Ax=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[s,a]=b.useState(!1);Vn(()=>a(!0),[]);const o=n||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?bN.createPortal(i.jsx(ot.div,{...r,ref:e}),o):null});Ax.displayName=N5;function j5(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Vc=t=>{const{present:e,children:n}=t,r=k5(e),s=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),a=gt(r.ref,S5(s));return typeof n=="function"||r.isPresent?b.cloneElement(s,{ref:a}):null};Vc.displayName="Presence";function k5(t){const[e,n]=b.useState(),r=b.useRef(null),s=b.useRef(t),a=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=j5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=cu(r.current);a.current=c==="mounted"?h:"none"},[c]),Vn(()=>{const h=r.current,f=s.current;if(f!==t){const g=a.current,y=cu(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,u]),Vn(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const j=cu(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&j&&(u("ANIMATION_END"),!s.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},g=y=>{y.target===e&&(a.current=cu(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function cu(t){return(t==null?void 0:t.animationName)||"none"}function S5(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bm=0;function lj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Kb()),document.body.insertAdjacentElement("beforeend",t[1]??Kb()),bm++,()=>{bm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),bm--}},[])}function Kb(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var bs=function(){return bs=Object.assign||function(e){for(var n,r=1,s=arguments.length;r"u")return V5;var e=H5(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},U5=hj(),Uo="data-scroll-locked",K5=function(t,e,n,r){var s=t.left,a=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` - .`.concat(E5,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(Uo,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(s,`px; - padding-top: `).concat(a,`px; - padding-right: `).concat(o,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(Pu,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(Ou,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(Pu," .").concat(Pu,` { - right: 0 `).concat(r,`; - } - - .`).concat(Ou," .").concat(Ou,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Uo,`] { - `).concat(T5,": ").concat(c,`px; - } -`)},Gb=function(){var t=parseInt(document.body.getAttribute(Uo)||"0",10);return isFinite(t)?t:0},q5=function(){b.useEffect(function(){return document.body.setAttribute(Uo,(Gb()+1).toString()),function(){var t=Gb()-1;t<=0?document.body.removeAttribute(Uo):document.body.setAttribute(Uo,t.toString())}},[])},G5=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;q5();var a=b.useMemo(function(){return W5(s)},[s]);return b.createElement(U5,{styles:K5(a,!e,s,n?"":"!important")})},Ng=!1;if(typeof window<"u")try{var du=Object.defineProperty({},"passive",{get:function(){return Ng=!0,!0}});window.addEventListener("test",du,du),window.removeEventListener("test",du,du)}catch{Ng=!1}var Ro=Ng?{passive:!1}:!1,J5=function(t){return t.tagName==="TEXTAREA"},fj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!J5(t)&&n[e]==="visible")},Y5=function(t){return fj(t,"overflowY")},Q5=function(t){return fj(t,"overflowX")},Jb=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=pj(t,r);if(s){var a=mj(t,r),o=a[1],c=a[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},X5=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Z5=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},pj=function(t,e){return t==="v"?Y5(e):Q5(e)},mj=function(t,e){return t==="v"?X5(e):Z5(e)},eI=function(t,e){return t==="h"&&e==="rtl"?-1:1},tI=function(t,e,n,r,s){var a=eI(t,window.getComputedStyle(e).direction),o=a*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=mj(t,c),v=y[0],j=y[1],w=y[2],k=j-w-a*v;(v||k)&&pj(t,c)&&(m+=k,g+=v);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},uu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Yb=function(t){return[t.deltaX,t.deltaY]},Qb=function(t){return t&&"current"in t?t.current:t},nI=function(t,e){return t[0]===e[0]&&t[1]===e[1]},rI=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},sI=0,Io=[];function iI(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),s=b.useState(sI++)[0],a=b.useState(hj)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var j=C5([t.lockRef.current],(t.shards||[]).map(Qb),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(j,w){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=uu(j),E=n.current,C="deltaX"in j?j.deltaX:E[0]-k[0],M="deltaY"in j?j.deltaY:E[1]-k[1],D,F=j.target,R=Math.abs(C)>Math.abs(M)?"h":"v";if("touches"in j&&R==="h"&&F.type==="range")return!1;var I=window.getSelection(),A=I&&I.anchorNode,O=A?A===F||A.contains(F):!1;if(O)return!1;var W=Jb(R,F);if(!W)return!0;if(W?D=R:(D=R==="v"?"h":"v",W=Jb(R,F)),!W)return!1;if(!r.current&&"changedTouches"in j&&(C||M)&&(r.current=D),!D)return!0;var X=r.current||D;return tI(X,w,j,X==="h"?C:M)},[]),u=b.useCallback(function(j){var w=j;if(!(!Io.length||Io[Io.length-1]!==a)){var k="deltaY"in w?Yb(w):uu(w),E=e.current.filter(function(D){return D.name===w.type&&(D.target===w.target||w.target===D.shadowParent)&&nI(D.delta,k)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var C=(o.current.shards||[]).map(Qb).filter(Boolean).filter(function(D){return D.contains(w.target)}),M=C.length>0?c(w,C[0]):!o.current.noIsolation;M&&w.cancelable&&w.preventDefault()}}},[]),h=b.useCallback(function(j,w,k,E){var C={name:j,delta:w,target:k,should:E,shadowParent:aI(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(M){return M!==C})},1)},[]),f=b.useCallback(function(j){n.current=uu(j),r.current=void 0},[]),m=b.useCallback(function(j){h(j.type,Yb(j),j.target,c(j,t.lockRef.current))},[]),g=b.useCallback(function(j){h(j.type,uu(j),j.target,c(j,t.lockRef.current))},[]);b.useEffect(function(){return Io.push(a),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Ro),document.addEventListener("touchmove",u,Ro),document.addEventListener("touchstart",f,Ro),function(){Io=Io.filter(function(j){return j!==a}),document.removeEventListener("wheel",u,Ro),document.removeEventListener("touchmove",u,Ro),document.removeEventListener("touchstart",f,Ro)}},[]);var y=t.removeScrollBar,v=t.inert;return b.createElement(b.Fragment,null,v?b.createElement(a,{styles:rI(s)}):null,y?b.createElement(G5,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function aI(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const oI=D5(uj,iI);var Rx=b.forwardRef(function(t,e){return b.createElement(Jh,bs({},t,{ref:e,sideCar:oI}))});Rx.classNames=Jh.classNames;var lI=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Po=new WeakMap,hu=new WeakMap,fu={},km=0,gj=function(t){return t&&(t.host||gj(t.parentNode))},cI=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=gj(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},dI=function(t,e,n,r){var s=cI(e,Array.isArray(t)?t:[t]);fu[n]||(fu[n]=new WeakMap);var a=fu[n],o=[],c=new Set,u=new Set(s),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};s.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var y=g.getAttribute(r),v=y!==null&&y!=="false",j=(Po.get(g)||0)+1,w=(a.get(g)||0)+1;Po.set(g,j),a.set(g,w),o.push(g),j===1&&v&&hu.set(g,!0),w===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),km++,function(){o.forEach(function(m){var g=Po.get(m)-1,y=a.get(m)-1;Po.set(m,g),a.set(m,y),g||(hu.has(m)||m.removeAttribute(r),hu.delete(m)),y||m.removeAttribute(n)}),km--,km||(Po=new WeakMap,Po=new WeakMap,hu=new WeakMap,fu={})}},xj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=lI(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),dI(r,s,n,"aria-hidden")):function(){return null}},Yh="Dialog",[yj]=aa(Yh),[uI,ns]=yj(Yh),vj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=Va({prop:r,defaultProp:s??!1,onChange:a,caller:Yh});return i.jsx(uI,{scope:e,triggerRef:c,contentRef:u,contentId:qi(),titleId:qi(),descriptionId:qi(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};vj.displayName=Yh;var bj="DialogTrigger",hI=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(bj,n),a=gt(e,s.triggerRef);return i.jsx(ot.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ox(s.open),...r,ref:a,onClick:nt(t.onClick,s.onOpenToggle)})});hI.displayName=bj;var Ix="DialogPortal",[fI,wj]=yj(Ix,{forceMount:void 0}),Nj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,a=ns(Ix,e);return i.jsx(fI,{scope:e,forceMount:n,children:b.Children.map(r,o=>i.jsx(Vc,{present:n||a.open,children:i.jsx(Ax,{asChild:!0,container:s,children:o})}))})};Nj.displayName=Ix;var Gu="DialogOverlay",jj=b.forwardRef((t,e)=>{const n=wj(Gu,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=ns(Gu,t.__scopeDialog);return a.modal?i.jsx(Vc,{present:r||a.open,children:i.jsx(mI,{...s,ref:e})}):null});jj.displayName=Gu;var pI=Cc("DialogOverlay.RemoveScroll"),mI=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Gu,n);return i.jsx(Rx,{as:pI,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(ot.div,{"data-state":Ox(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Ha="DialogContent",kj=b.forwardRef((t,e)=>{const n=wj(Ha,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=ns(Ha,t.__scopeDialog);return i.jsx(Vc,{present:r||a.open,children:a.modal?i.jsx(gI,{...s,ref:e}):i.jsx(xI,{...s,ref:e})})});kj.displayName=Ha;var gI=b.forwardRef((t,e)=>{const n=ns(Ha,t.__scopeDialog),r=b.useRef(null),s=gt(e,n.contentRef,r);return b.useEffect(()=>{const a=r.current;if(a)return xj(a)},[]),i.jsx(Sj,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nt(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:nt(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&a.preventDefault()}),onFocusOutside:nt(t.onFocusOutside,a=>a.preventDefault())})}),xI=b.forwardRef((t,e)=>{const n=ns(Ha,t.__scopeDialog),r=b.useRef(!1),s=b.useRef(!1);return i.jsx(Sj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,a),a.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),Sj=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=t,c=ns(Ha,n),u=b.useRef(null),h=gt(e,u);return lj(),i.jsxs(i.Fragment,{children:[i.jsx(Mx,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(Tx,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Ox(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(yI,{titleId:c.titleId}),i.jsx(bI,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Px="DialogTitle",Cj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Px,n);return i.jsx(ot.h2,{id:s.titleId,...r,ref:e})});Cj.displayName=Px;var Ej="DialogDescription",Tj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Ej,n);return i.jsx(ot.p,{id:s.descriptionId,...r,ref:e})});Tj.displayName=Ej;var Mj="DialogClose",Aj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Mj,n);return i.jsx(ot.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,()=>s.onOpenChange(!1))})});Aj.displayName=Mj;function Ox(t){return t?"open":"closed"}var Rj="DialogTitleWarning",[SV,Ij]=qR(Rj,{contentName:Ha,titleName:Px,docsSlug:"dialog"}),yI=({titleId:t})=>{const e=Ij(Rj),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},vI="DialogDescriptionWarning",bI=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ij(vI).contentName}}.`;return b.useEffect(()=>{var a;const s=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},wI=vj,NI=Nj,jI=jj,kI=kj,SI=Cj,CI=Tj,EI=Aj;function Qt(t){return i.jsx(wI,{"data-slot":"dialog",...t})}function TI(t){return i.jsx(NI,{...t})}const Pj=b.forwardRef(({className:t,...e},n)=>i.jsx(jI,{ref:n,className:xt("fixed inset-0 z-50 bg-black/50",t),...e}));Pj.displayName="DialogOverlay";const Ut=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},s)=>i.jsxs(TI,{children:[i.jsx(Pj,{}),i.jsxs(kI,{ref:s,"aria-describedby":void 0,className:xt("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg sm:max-w-lg",t),...r,children:[e,n&&i.jsxs(EI,{className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(er,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ut.displayName="DialogContent";function Xt({className:t,...e}){return i.jsx("div",{className:xt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function bn({className:t,...e}){return i.jsx("div",{className:xt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Zt(t){return i.jsx(SI,{className:"text-lg font-semibold leading-none",...t})}function MI(t){return i.jsx(CI,{className:"text-sm text-muted-foreground",...t})}const AI=KN("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Fe({className:t,variant:e,asChild:n=!1,...r}){const s=n?HN:"span";return i.jsx(s,{className:xt(AI({variant:e}),t),...r})}var RI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],II=RI.reduce((t,e)=>{const n=VN(`Primitive.${e}`),r=b.forwardRef((s,a)=>{const{asChild:o,...c}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),PI="Label",Oj=b.forwardRef((t,e)=>i.jsx(II.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Oj.displayName=PI;var Dj=Oj;const te=b.forwardRef(({className:t,...e},n)=>i.jsx(Dj,{ref:n,className:xt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=Dj.displayName;function Dx(t){const e=t+"CollectionProvider",[n,r]=aa(e),[s,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:w,children:k}=j,E=Zn.useRef(null),C=Zn.useRef(new Map).current;return i.jsx(s,{scope:w,itemMap:C,collectionRef:E,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Cc(c),h=Zn.forwardRef((j,w)=>{const{scope:k,children:E}=j,C=a(c,k),M=gt(w,C.collectionRef);return i.jsx(u,{ref:M,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Cc(f),y=Zn.forwardRef((j,w)=>{const{scope:k,children:E,...C}=j,M=Zn.useRef(null),D=gt(w,M),F=a(f,k);return Zn.useEffect(()=>(F.itemMap.set(M,{ref:M,...C}),()=>void F.itemMap.delete(M))),i.jsx(g,{[m]:"",ref:D,children:E})});y.displayName=f;function v(j){const w=a(t+"CollectionConsumer",j);return Zn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(w.itemMap.values()).sort((F,R)=>C.indexOf(F.ref.current)-C.indexOf(R.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var OI=b.createContext(void 0);function Qh(t){const e=b.useContext(OI);return t||e||"ltr"}var Sm="rovingFocusGroup.onEntryFocus",DI={bubbles:!1,cancelable:!0},Hc="RovingFocusGroup",[jg,Lj,LI]=Dx(Hc),[_I,_j]=aa(Hc,[LI]),[zI,$I]=_I(Hc),zj=b.forwardRef((t,e)=>i.jsx(jg.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(jg.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(FI,{...t,ref:e})})}));zj.displayName=Hc;var FI=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=gt(e,g),v=Qh(a),[j,w]=Va({prop:o,defaultProp:c??null,onChange:u,caller:Hc}),[k,E]=b.useState(!1),C=Xi(h),M=Lj(n),D=b.useRef(!1),[F,R]=b.useState(0);return b.useEffect(()=>{const I=g.current;if(I)return I.addEventListener(Sm,C),()=>I.removeEventListener(Sm,C)},[C]),i.jsx(zI,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:j,onItemFocus:b.useCallback(I=>w(I),[w]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>R(I=>I+1),[]),onFocusableItemRemove:b.useCallback(()=>R(I=>I-1),[]),children:i.jsx(ot.div,{tabIndex:k||F===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:nt(t.onMouseDown,()=>{D.current=!0}),onFocus:nt(t.onFocus,I=>{const A=!D.current;if(I.target===I.currentTarget&&A&&!k){const O=new CustomEvent(Sm,DI);if(I.currentTarget.dispatchEvent(O),!O.defaultPrevented){const W=M().filter($=>$.focusable),X=W.find($=>$.active),q=W.find($=>$.id===j),_=[X,q,...W].filter(Boolean).map($=>$.ref.current);Bj(_,f)}}D.current=!1}),onBlur:nt(t.onBlur,()=>E(!1))})})}),$j="RovingFocusGroupItem",Fj=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:o,...c}=t,u=qi(),h=a||u,f=$I($j,n),m=f.currentTabStopId===h,g=Lj(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:j}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),i.jsx(jg.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:i.jsx(ot.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:nt(t.onMouseDown,w=>{r?f.onItemFocus(h):w.preventDefault()}),onFocus:nt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:nt(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=HI(w,f.orientation,f.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let C=g().filter(M=>M.focusable).map(M=>M.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const M=C.indexOf(w.currentTarget);C=f.loop?WI(C,M+1):C.slice(M+1)}setTimeout(()=>Bj(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});Fj.displayName=$j;var BI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VI(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function HI(t,e,n){const r=VI(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return BI[r]}function Bj(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function WI(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var UI=zj,KI=Fj,Xh="Tabs",[qI]=aa(Xh,[_j]),Vj=_j(),[GI,Lx]=qI(Xh),Hj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Qh(c),[m,g]=Va({prop:r,onChange:s,defaultProp:a??"",caller:Xh});return i.jsx(GI,{scope:n,baseId:qi(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:i.jsx(ot.div,{dir:f,"data-orientation":o,...h,ref:e})})});Hj.displayName=Xh;var Wj="TabsList",Uj=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,a=Lx(Wj,n),o=Vj(n);return i.jsx(UI,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:i.jsx(ot.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:e})})});Uj.displayName=Wj;var Kj="TabsTrigger",qj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...a}=t,o=Lx(Kj,n),c=Vj(n),u=Yj(o.baseId,r),h=Qj(o.baseId,r),f=r===o.value;return i.jsx(KI,{asChild:!0,...c,focusable:!s,active:f,children:i.jsx(ot.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...a,ref:e,onMouseDown:nt(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:nt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:nt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!s&&m&&o.onValueChange(r)})})})});qj.displayName=Kj;var Gj="TabsContent",Jj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:a,...o}=t,c=Lx(Gj,n),u=Yj(c.baseId,r),h=Qj(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),i.jsx(Vc,{present:s||f,children:({present:g})=>i.jsx(ot.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&a})})});Jj.displayName=Gj;function Yj(t,e){return`${t}-trigger-${e}`}function Qj(t,e){return`${t}-content-${e}`}var JI=Hj,Xj=Uj,Zj=qj,ek=Jj;const Wc=JI,dl=b.forwardRef(({className:t,...e},n)=>i.jsx(Xj,{ref:n,className:xt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));dl.displayName=Xj.displayName;const en=b.forwardRef(({className:t,...e},n)=>i.jsx(Zj,{ref:n,className:xt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));en.displayName=Zj.displayName;const tn=b.forwardRef(({className:t,...e},n)=>i.jsx(ek,{ref:n,className:xt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));tn.displayName=ek.displayName;function _x(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function zx(t){const[e,n]=b.useState(void 0);return Vn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,c;if("borderBoxSize"in a){const u=a.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Zh="Switch",[YI]=aa(Zh),[QI,XI]=YI(Zh),tk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:a,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),v=gt(e,C=>y(C)),j=b.useRef(!1),w=g?f||!!g.closest("form"):!0,[k,E]=Va({prop:s,defaultProp:a??!1,onChange:h,caller:Zh});return i.jsxs(QI,{scope:n,checked:k,disabled:c,children:[i.jsx(ot.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":ik(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:nt(t.onClick,C=>{E(M=>!M),w&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),w&&i.jsx(sk,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});tk.displayName=Zh;var nk="SwitchThumb",rk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=XI(nk,n);return i.jsx(ot.span,{"data-state":ik(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});rk.displayName=nk;var ZI="SwitchBubbleInput",sk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},a)=>{const o=b.useRef(null),c=gt(o,a),u=_x(n),h=zx(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[u,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});sk.displayName=ZI;function ik(t){return t?"checked":"unchecked"}var ak=tk,eP=rk;const vt=b.forwardRef(({className:t,...e},n)=>i.jsx(ak,{className:xt("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",t),...e,ref:n,children:i.jsx(eP,{className:xt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));vt.displayName=ak.displayName;function $x({open:t,onClose:e,userId:n,onUserUpdated:r}){var Gn;const[s,a]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,j]=b.useState(!1),[w,k]=b.useState("info"),[E,C]=b.useState(""),[M,D]=b.useState(""),[F,R]=b.useState([]),[I,A]=b.useState(""),[O,W]=b.useState(""),[X,q]=b.useState(""),[Z,_]=b.useState(!1),[$,oe]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[V,ae]=b.useState([]),[Y,L]=b.useState(!1),[H,ue]=b.useState(!1),[U,he]=b.useState(null),[Q,ee]=b.useState(null),[de,Ce]=b.useState(""),[B,me]=b.useState(""),[Se,rt]=b.useState(""),[Ye,st]=b.useState(!1),[Qe,Xe]=b.useState(null),[ft,Pt]=b.useState("");b.useEffect(()=>{t&&n&&(k("info"),he(null),ee(null),Xe(null),Pt(""),W(""),q(""),Jt(),Be("/api/db/vip-roles").then(fe=>{fe!=null&&fe.success&&fe.data&&ae(fe.data)}).catch(()=>{}))},[t,n]);async function Jt(){if(n){m(!0);try{const fe=await Be(`/api/db/users?id=${encodeURIComponent(n)}`);if(fe!=null&&fe.success&&fe.user){const ge=fe.user;a(ge),C(ge.phone||""),D(ge.nickname||""),Ce(ge.phone||""),me(ge.wechatId||""),rt(ge.openId||"");try{R(typeof ge.tags=="string"?JSON.parse(ge.tags||"[]"):[])}catch{R([])}oe({isVip:!!(ge.isVip??!1),vipExpireDate:ge.vipExpireDate?String(ge.vipExpireDate).slice(0,10):"",vipRole:String(ge.vipRole??""),vipName:String(ge.vipName??""),vipProject:String(ge.vipProject??""),vipContact:String(ge.vipContact??""),vipBio:String(ge.vipBio??"")})}try{const ge=await Be(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);ge!=null&&ge.success&&ge.tracks&&c(ge.tracks)}catch{c([])}try{const ge=await Be(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ge!=null&&ge.success&&ge.referrals&&h(ge.referrals)}catch{h([])}}catch(fe){console.error("Load user detail error:",fe)}finally{m(!1)}}}async function Kn(){if(!(s!=null&&s.phone)){alert("用户未绑定手机号,无法同步");return}y(!0);try{const fe=await ht("/api/ckb/sync",{action:"full_sync",phone:s.phone,userId:s.id});fe!=null&&fe.success?(alert("同步成功"),Jt()):alert("同步失败: "+(fe==null?void 0:fe.error))}catch(fe){console.error("Sync CKB error:",fe),alert("同步失败")}finally{y(!1)}}async function qn(){if(s){j(!0);try{const fe={id:s.id,phone:E||void 0,nickname:M||void 0,tags:JSON.stringify(F)},ge=await Rt("/api/db/users",fe);ge!=null&&ge.success?(alert("保存成功"),Jt(),r==null||r()):alert("保存失败: "+(ge==null?void 0:ge.error))}catch(fe){console.error("Save user error:",fe),alert("保存失败")}finally{j(!1)}}}const ss=()=>{I&&!F.includes(I)&&(R([...F,I]),A(""))},zt=fe=>R(F.filter(ge=>ge!==fe));async function Cr(){if(s){if(!O){alert("请输入新密码");return}if(O!==X){alert("两次密码不一致");return}if(O.length<6){alert("密码至少 6 位");return}_(!0);try{const fe=await Rt("/api/db/users",{id:s.id,password:O});fe!=null&&fe.success?(alert("修改成功"),W(""),q("")):alert("修改失败: "+((fe==null?void 0:fe.error)||""))}catch{alert("修改失败")}finally{_(!1)}}}async function is(){if(s){if($.isVip&&!$.vipExpireDate.trim()){alert("开启 VIP 请填写有效到期日");return}L(!0);try{const fe={id:s.id,isVip:$.isVip,vipExpireDate:$.isVip?$.vipExpireDate:void 0,vipRole:$.vipRole||void 0,vipName:$.vipName||void 0,vipProject:$.vipProject||void 0,vipContact:$.vipContact||void 0,vipBio:$.vipBio||void 0},ge=await Rt("/api/db/users",fe);ge!=null&&ge.success?(alert("VIP 设置已保存"),Jt(),r==null||r()):alert("保存失败: "+((ge==null?void 0:ge.error)||""))}catch{alert("保存失败")}finally{L(!1)}}}async function On(){if(!de&&!Se&&!B){ee("请至少输入手机号、微信号或 OpenID 中的一项");return}ue(!0),ee(null),he(null);try{const fe=new URLSearchParams;de&&fe.set("phone",de),Se&&fe.set("openId",Se),B&&fe.set("wechatId",B);const ge=await Be(`/api/admin/shensheshou/query?${fe}`);ge!=null&&ge.success&&ge.data?(he(ge.data),s&&await pn(ge.data)):ee((ge==null?void 0:ge.error)||"未查询到数据,该用户可能未在神射手收录")}catch(fe){console.error("SSS query error:",fe),ee("请求失败,请检查神射手接口配置")}finally{ue(!1)}}async function pn(fe){if(s)try{await ht("/api/admin/shensheshou/enrich",{userId:s.id,phone:de||s.phone||"",openId:Se||s.openId||"",wechatId:B||s.wechatId||""}),Jt()}catch(ge){console.error("SSS enrich error:",ge)}}async function mr(){if(s){st(!0),Xe(null);try{const fe={users:[{phone:s.phone||"",name:s.nickname||"",openId:s.openId||"",tags:F}]},ge=await ht("/api/admin/shensheshou/ingest",fe);ge!=null&&ge.success&&ge.data?Xe(ge.data):Xe({error:(ge==null?void 0:ge.error)||"推送失败"})}catch(fe){console.error("SSS ingest error:",fe),Xe({error:"请求失败"})}finally{st(!1)}}}const Br=fe=>{const kn={view_chapter:zr,purchase:yg,match:Pn,login:La,register:La,share:Ns,bind_phone:iA,bind_wechat:JM,fill_profile:mm,visit_page:Vo}[fe]||fg;return i.jsx(kn,{className:"w-4 h-4"})};return t?i.jsx(Qt,{open:t,onOpenChange:()=>e(),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(La,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(s==null?void 0:s.phone)&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(s==null?void 0:s.isVip)&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?i.jsxs("div",{className:"flex items-center justify-center py-20",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s?i.jsxs("div",{className:"flex flex-col h-[75vh]",children:[i.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[i.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:s.avatar?i.jsx("img",{src:s.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Gn=s.nickname)==null?void 0:Gn.charAt(0))||"?"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx("h3",{className:"text-lg font-bold text-white",children:s.nickname}),s.isAdmin&&i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),s.hasFullBook&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),s.vipRole&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0",children:s.vipRole})]}),i.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[s.phone?`📱 ${s.phone}`:"未绑定手机",s.wechatId&&` · 💬 ${s.wechatId}`,s.mbti&&` · ${s.mbti}`]}),i.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[i.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",s.id.slice(0,16),"…"]}),s.referralCode&&i.jsxs("p",{className:"text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"推广码:"}),i.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:s.referralCode})]})]})]}),i.jsxs("div",{className:"text-right shrink-0",children:[i.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(s.earnings||0).toFixed(2)]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),i.jsxs(Wc,{value:w,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs(dl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[i.jsx(en,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),i.jsx(en,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),i.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[i.jsx(Vo,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),i.jsx(en,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),i.jsxs(en,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[i.jsx(Bi,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),i.jsxs(tn,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:E,onChange:fe=>C(fe.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:M,onChange:fe=>D(fe.target.value)})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.openId&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),i.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:s.openId})]}),s.region&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[i.jsx($N,{className:"w-4 h-4 text-gray-500"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),i.jsx("p",{className:"text-white",children:s.region})]})]}),s.industry&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),i.jsx("p",{className:"text-white",children:s.industry})]}),s.position&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),i.jsx("p",{className:"text-white",children:s.position})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),i.jsx("p",{className:"text-2xl font-bold text-white",children:s.referralCount??0})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),i.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(s.pendingEarnings??0).toFixed(2)]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),i.jsx("p",{className:"text-sm text-white",children:s.createdAt?new Date(s.createdAt).toLocaleDateString():"-"})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(IM,{className:"w-4 h-4 text-yellow-400"}),i.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:O,onChange:fe=>W(fe.target.value)}),i.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:X,onChange:fe=>q(fe.target.value)}),i.jsx(re,{size:"sm",onClick:Cr,disabled:Z||!O||!X,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:Z?"保存中...":"确认修改"})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Fi,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-400 text-sm",children:"VIP 会员"}),i.jsx(vt,{checked:$.isVip,onCheckedChange:fe=>oe(ge=>({...ge,isVip:fe}))})]}),$.isVip&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"到期日"}),i.jsx(ce,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:$.vipExpireDate,onChange:fe=>oe(ge=>({...ge,vipExpireDate:fe.target.value}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"角色"}),i.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:$.vipRole,onChange:fe=>oe(ge=>({...ge,vipRole:fe.target.value})),children:[i.jsx("option",{value:"",children:"请选择"}),V.map(fe=>i.jsx("option",{value:fe.name,children:fe.name},fe.id))]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"展示名"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:$.vipName,onChange:fe=>oe(ge=>({...ge,vipName:fe.target.value}))})]}),i.jsx(re,{size:"sm",onClick:is,disabled:Y,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:Y?"保存中...":"保存 VIP"})]})]})]}),s.isVip&&i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Fi,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:s.vipRole||"VIP"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.vipName&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"展示名:"}),i.jsx("span",{className:"text-white",children:s.vipName})]}),s.vipProject&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"项目:"}),i.jsx("span",{className:"text-white",children:s.vipProject})]}),s.vipContact&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"联系方式:"}),i.jsx("span",{className:"text-white",children:s.vipContact})]}),s.vipExpireDate&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"到期时间:"}),i.jsx("span",{className:"text-white",children:new Date(s.vipExpireDate).toLocaleDateString()})]})]}),s.vipBio&&i.jsx("p",{className:"text-gray-400 text-sm mt-2",children:s.vipBio})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Sc,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"微信归属"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:ft,onChange:fe=>Pt(fe.target.value)}),i.jsxs(re,{size:"sm",onClick:async()=>{if(!(!ft||!s))try{await Rt("/api/db/users",{id:s.id,wechatId:ft}),alert("已保存微信归属"),Jt()}catch{alert("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[i.jsx(rn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),s.wechatId&&i.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",i.jsx("span",{className:"text-purple-400",children:s.wechatId})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ns,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),i.jsx(re,{size:"sm",onClick:Kn,disabled:g||!s.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"同步状态:"}),s.ckbSyncedAt?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"最后同步:"}),i.jsx("span",{className:"text-gray-300 ml-1",children:s.ckbSyncedAt?new Date(s.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),i.jsxs(tn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(mm,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"用户标签"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),i.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[i.jsx(hg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),i.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(fe=>i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:fe.category}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:fe.tags.map(ge=>i.jsxs("button",{type:"button",onClick:()=>{F.includes(ge)?zt(ge):R([...F,ge])},className:`px-2 py-0.5 rounded text-xs border transition-all ${F.includes(ge)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[F.includes(ge)?"✓ ":"",ge]},ge))})]},fe.category))}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),i.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[F.map((fe,ge)=>i.jsxs(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[fe,i.jsx("button",{type:"button",onClick:()=>zt(fe),className:"ml-1 hover:text-red-400",children:i.jsx(er,{className:"w-3 h-3"})})]},ge)),F.length===0&&i.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:I,onChange:fe=>A(fe.target.value),onKeyDown:fe=>fe.key==="Enter"&&ss()}),i.jsx(re,{onClick:ss,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),s.ckbTags&&i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(mm,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof s.ckbTags=="string"?s.ckbTags.split(","):[]).map((fe,ge)=>i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 border-0",children:fe.trim()},ge))})]})]}),i.jsxs(tn,{value:"journey",className:"flex-1 overflow-auto",children:[i.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[i.jsx(Vo,{className:"w-4 h-4 text-[#38bdac]"}),i.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),i.jsx("div",{className:"space-y-2",children:o.length>0?o.map((fe,ge)=>i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex flex-col items-center",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Br(fe.action)}),ge0?u.map((fe,ge)=>{var ri;const kn=fe;return i.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((ri=kn.nickname)==null?void 0:ri.charAt(0))||"?"}),i.jsx("span",{className:"text-white text-sm",children:kn.nickname})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[kn.status==="vip"&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),i.jsx("span",{className:"text-gray-500 text-xs",children:kn.createdAt?new Date(kn.createdAt).toLocaleDateString():""})]})]},kn.id||ge)}):i.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),i.jsxs(tn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Bi,{className:"w-5 h-5 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsxs("div",{children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:de,onChange:fe=>Ce(fe.target.value)})]}),i.jsxs("div",{children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:B,onChange:fe=>me(fe.target.value)})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:Se,onChange:fe=>rt(fe.target.value)})]})]}),i.jsx(re,{onClick:On,disabled:H,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:H?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ki,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),i.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),Q&&i.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:Q}),U&&i.jsxs("div",{className:"mt-3 space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),i.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:U.rfm_score??"-"})]}),i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),i.jsx("p",{className:"text-2xl font-bold text-white",children:U.user_level??"-"})]})]}),U.tags&&U.tags.length>0&&i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:U.tags.map((fe,ge)=>i.jsx(Fe,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:fe},ge))})]}),U.last_active&&i.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",U.last_active]})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(Bi,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),i.jsx(re,{onClick:mr,disabled:Ye||!s.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Ye?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):i.jsxs(i.Fragment,{children:[i.jsx(Bi,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!s.phone&&i.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),Qe&&i.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:Qe.error?i.jsx("p",{className:"text-red-400",children:String(Qe.error)}):i.jsxs("div",{className:"space-y-1",children:[i.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[i.jsx(hg,{className:"w-4 h-4"})," 推送成功"]}),Qe.enriched!==void 0&&i.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(Qe.new_tags_added??0)]})]})})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[i.jsxs(re,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"关闭"]}),i.jsxs(re,{onClick:qn,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):i.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function tP(){const t=ia(),[e,n]=b.useState(!0),[r,s]=b.useState([]),[a,o]=b.useState([]),[c,u]=b.useState(0),[h,f]=b.useState(0),[m,g]=b.useState(0),[y,v]=b.useState(0),[j,w]=b.useState(null),[k,E]=b.useState(null),[C,M]=b.useState(!1);async function D(){var A;n(!0),w(null);try{try{const ae=await Be("/api/admin/dashboard/overview");if(ae!=null&&ae.success){u(ae.totalUsers??0),f(ae.paidOrderCount??0),g(ae.totalRevenue??0),v(ae.conversionRate??0),o(ae.recentOrders??[]),s(ae.newUsers??[]);return}}catch(ae){console.error("数据概览接口失败,尝试降级拉取",ae)}const[O,W]=await Promise.all([Be("/api/db/users?page=1&pageSize=10"),Be("/api/orders?page=1&pageSize=20&status=paid")]),X=typeof(O==null?void 0:O.total)=="number"?O.total:((A=O==null?void 0:O.users)==null?void 0:A.length)??0,q=(W==null?void 0:W.orders)??[],Z=typeof(W==null?void 0:W.total)=="number"?W.total:q.length,_=q.filter(ae=>ae.status==="paid"||ae.status==="completed"||ae.status==="success"),$=_.reduce((ae,Y)=>ae+Number(Y.amount||0),0),oe=new Set(_.map(ae=>ae.userId).filter(Boolean)),V=X>0&&oe.size>0?oe.size/X*100:0;u(X),f(Z),g($),v(V),o(q.slice(0,5)),s((O==null?void 0:O.users)??[])}catch(O){console.error("降级拉取失败",O);const W=O;(W==null?void 0:W.status)===401?w("登录已过期,请重新登录"):(W==null?void 0:W.name)==="AbortError"?w("请求超时,请检查网络后点击重试"):w("加载失败,请检查网络或联系管理员")}finally{n(!1)}}if(b.useEffect(()=>{D();const A=setInterval(D,3e4);return()=>clearInterval(A)},[]),e)return i.jsxs("div",{className:"p-8 w-full",children:[i.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),i.jsxs("div",{className:"flex flex-col items-center justify-center py-24",children:[i.jsx(qe,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),i.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const F=c,R=A=>{const O=A.productType||"",W=A.description||"";if(W){if(O==="section"&&W.includes("章节")){if(W.includes("-")){const X=W.split("-");if(X.length>=3)return{title:`第${X[1]}章 第${X[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:W,subtitle:"章节购买"}}return O==="fullbook"||W.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:O==="match"||W.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:W,subtitle:O==="section"?"单章":O==="fullbook"?"全书":"其他"}}return O==="section"?{title:`章节 ${A.productId||""}`,subtitle:"单章购买"}:O==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:O==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:O||"其他"}},I=[{title:"总用户数",value:F,icon:Pn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${(m??0).toFixed(2)}`,icon:dc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:h,icon:yg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${typeof y=="number"?y.toFixed(1):0}%`,icon:zr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return i.jsxs("div",{className:"p-8 w-full",children:[i.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),j&&i.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[i.jsx("span",{children:j}),i.jsx("button",{type:"button",onClick:()=>D(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:I.map((A,O)=>i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>A.link&&t(A.link),children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsx(tt,{className:"text-sm font-medium text-gray-400",children:A.title}),i.jsx("div",{className:`p-2 rounded-lg ${A.bg}`,children:i.jsx(A.icon,{className:`w-4 h-4 ${A.color}`})})]}),i.jsx(Te,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-2xl font-bold text-white",children:A.value}),i.jsx(Bo,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},O))}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsx(tt,{className:"text-white",children:"最近订单"}),i.jsxs("button",{type:"button",onClick:()=>D(),className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1",title:"刷新",children:[i.jsx(qe,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),i.jsx(Te,{children:i.jsxs("div",{className:"space-y-3",children:[a.slice(0,5).map(A=>{var Z;const O=A.referrerId?r.find(_=>_.id===A.referrerId):void 0,W=A.referralCode||(O==null?void 0:O.referralCode)||(O==null?void 0:O.nickname)||(A.referrerId?String(A.referrerId).slice(0,8):""),X=R(A),q=A.userNickname||((Z=r.find(_=>_.id===A.userId))==null?void 0:Z.nickname)||"匿名用户";return i.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[i.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[A.userAvatar?i.jsx("img",{src:A.userAvatar,alt:q,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:_=>{_.currentTarget.style.display="none";const $=_.currentTarget.nextElementSibling;$&&$.classList.remove("hidden")}}):null,i.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 mt-0.5 ${A.userAvatar?"hidden":""}`,children:q.charAt(0)}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("button",{type:"button",onClick:()=>{A.userId&&(E(A.userId),M(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:q}),i.jsx("span",{className:"text-gray-600",children:"·"}),i.jsx("span",{className:"text-sm font-medium text-white truncate",children:X.title})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[X.subtitle&&X.subtitle!=="章节购买"&&i.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:X.subtitle}),i.jsx("span",{children:new Date(A.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),W&&i.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",W]})]})]}),i.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[i.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(A.amount).toFixed(2)]}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:A.paymentMethod||"微信"})]})]},A.id)}),a.length===0&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(yg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),i.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"新注册用户"})}),i.jsx(Te,{children:i.jsxs("div",{className:"space-y-3",children:[r.slice(0,5).map(A=>{var O;return i.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((O=A.nickname)==null?void 0:O.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>{E(A.id),M(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:A.nickname||"匿名用户"}),i.jsx("p",{className:"text-xs text-gray-500",children:A.phone||"-"})]})]}),i.jsx("p",{className:"text-xs text-gray-400",children:A.createdAt?new Date(A.createdAt).toLocaleDateString():"-"})]},A.id)}),r.length===0&&i.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]}),i.jsx($x,{open:C,onClose:()=>{M(!1),E(null)},userId:k,onUserUpdated:D})]})}const hr=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:xt("w-full caption-bottom text-sm",t),...e})}));hr.displayName="Table";const fr=b.forwardRef(({className:t,...e},n)=>i.jsx("thead",{ref:n,className:xt("[&_tr]:border-b",t),...e}));fr.displayName="TableHeader";const pr=b.forwardRef(({className:t,...e},n)=>i.jsx("tbody",{ref:n,className:xt("[&_tr:last-child]:border-0",t),...e}));pr.displayName="TableBody";const ct=b.forwardRef(({className:t,...e},n)=>i.jsx("tr",{ref:n,className:xt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ct.displayName="TableRow";const ke=b.forwardRef(({className:t,...e},n)=>i.jsx("th",{ref:n,className:xt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableHead";const ve=b.forwardRef(({className:t,...e},n)=>i.jsx("td",{ref:n,className:xt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ve.displayName="TableCell";function Fx(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const s=setTimeout(()=>r(t),e);return()=>clearTimeout(s)},[t,e]),n}function Zr({page:t,totalPages:e,total:n,pageSize:r,onPageChange:s,onPageSizeChange:a,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!a?null:i.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[i.jsxs("span",{children:["共 ",n," 条"]}),a&&i.jsx("select",{value:r,onChange:c=>a(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>i.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>s(1),disabled:t<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),i.jsx("button",{type:"button",onClick:()=>s(t-1),disabled:t<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),i.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),i.jsx("button",{type:"button",onClick:()=>s(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),i.jsx("button",{type:"button",onClick:()=>s(e),disabled:t>=e,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function nP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,a]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,j]=b.useState(""),w=Fx(v,300),[k,E]=b.useState("all"),[C,M]=b.useState(!0),[D,F]=b.useState(null),[R,I]=b.useState(null),[A,O]=b.useState(""),[W,X]=b.useState(!1);async function q(){M(!0),F(null);try{const Y=k==="all"?"":k==="completed"?"completed":k,L=new URLSearchParams({page:String(f),pageSize:String(g),...Y&&{status:Y},...w&&{search:w}}),[H,ue]=await Promise.all([Be(`/api/orders?${L}`),Be("/api/db/users?page=1&pageSize=500")]);H!=null&&H.success&&(e(H.orders||[]),a(H.total??0),c(H.totalRevenue??0),h(H.todayRevenue??0)),ue!=null&&ue.success&&ue.users&&r(ue.users)}catch(Y){console.error("加载订单失败",Y),F("加载订单失败,请检查网络后重试")}finally{M(!1)}}b.useEffect(()=>{m(1)},[w,k]),b.useEffect(()=>{q()},[f,g,w,k]);const Z=Y=>{var L;return Y.userNickname||((L=n.find(H=>H.id===Y.userId))==null?void 0:L.nickname)||"匿名用户"},_=Y=>{var L;return((L=n.find(H=>H.id===Y))==null?void 0:L.phone)||"-"},$=Y=>{const L=Y.productType||Y.type||"",H=Y.description||"";if(H){if(L==="section"&&H.includes("章节")){if(H.includes("-")){const ue=H.split("-");if(ue.length>=3)return{name:`第${ue[1]}章 第${ue[2]}节`,type:"《一场Soul的创业实验》"}}return{name:H,type:"章节购买"}}return L==="fullbook"||H.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:L==="vip"||H.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:L==="match"||H.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:H,type:"其他"}}return L==="section"?{name:`章节 ${Y.productId||Y.sectionId||""}`,type:"单章"}:L==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:L==="vip"?{name:"VIP年度会员",type:"VIP"}:L==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:L||"其他"}},oe=Math.ceil(s/g)||1;async function V(){var Y;if(!(!(R!=null&&R.orderSn)&&!(R!=null&&R.id))){X(!0),F(null);try{const L=await Rt("/api/admin/orders/refund",{orderSn:R.orderSn||R.id,reason:A||void 0});L!=null&&L.success?(I(null),O(""),q()):F((L==null?void 0:L.error)||"退款失败")}catch(L){const H=L;F(((Y=H==null?void 0:H.data)==null?void 0:Y.error)||"退款失败,请检查网络后重试")}finally{X(!1)}}}function ae(){if(t.length===0){alert("暂无数据可导出");return}const Y=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],L=t.map(Q=>{const ee=$(Q);return[Q.orderSn||Q.id||"",Z(Q),_(Q.userId),ee.name,Number(Q.amount||0).toFixed(2),Q.paymentMethod==="wechat"?"微信支付":Q.paymentMethod==="alipay"?"支付宝":Q.paymentMethod||"微信支付",Q.status==="refunded"?"已退款":Q.status==="paid"||Q.status==="completed"?"已完成":Q.status==="pending"||Q.status==="created"?"待支付":"已失败",Q.status==="refunded"&&Q.refundReason?Q.refundReason:"-",Q.referrerEarnings?Number(Q.referrerEarnings).toFixed(2):"-",Q.createdAt?new Date(Q.createdAt).toLocaleString("zh-CN"):""].join(",")}),H="\uFEFF"+[Y.join(","),...L].join(` -`),ue=new Blob([H],{type:"text/csv;charset=utf-8"}),U=URL.createObjectURL(ue),he=document.createElement("a");he.href=U,he.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,he.click(),URL.revokeObjectURL(U)}return i.jsxs("div",{className:"p-8 w-full",children:[D&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:D}),i.jsx("button",{type:"button",onClick:()=>F(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs(re,{variant:"outline",onClick:q,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`}),"刷新"]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"text-gray-400",children:"总收入:"}),i.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),i.jsx("span",{className:"text-gray-600",children:"|"}),i.jsx("span",{className:"text-gray-400",children:"今日:"}),i.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),i.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),i.jsx(ce,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:Y=>j(Y.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(DN,{className:"w-4 h-4 text-gray-400"}),i.jsxs("select",{value:k,onChange:Y=>E(Y.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"pending",children:"待支付"}),i.jsx("option",{value:"created",children:"已创建"}),i.jsx("option",{value:"failed",children:"已失败"}),i.jsx("option",{value:"refunded",children:"已退款"})]})]}),i.jsxs(re,{variant:"outline",onClick:ae,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(rM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:C?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs("div",{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"订单号"}),i.jsx(ke,{className:"text-gray-400",children:"用户"}),i.jsx(ke,{className:"text-gray-400",children:"商品"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"支付方式"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"退款原因"}),i.jsx(ke,{className:"text-gray-400",children:"分销佣金"}),i.jsx(ke,{className:"text-gray-400",children:"下单时间"}),i.jsx(ke,{className:"text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(Y=>{const L=$(Y);return i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsxs(ve,{className:"font-mono text-xs text-gray-400",children:[(Y.orderSn||Y.id||"").slice(0,12),"..."]}),i.jsx(ve,{children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:Z(Y)}),i.jsx("p",{className:"text-gray-500 text-xs",children:_(Y.userId)})]})}),i.jsx(ve,{children:i.jsxs("div",{children:[i.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[L.name,(Y.productType||Y.type)==="vip"&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:L.type})]})}),i.jsxs(ve,{className:"text-[#38bdac] font-bold",children:["¥",Number(Y.amount||0).toFixed(2)]}),i.jsx(ve,{className:"text-gray-300",children:Y.paymentMethod==="wechat"?"微信支付":Y.paymentMethod==="alipay"?"支付宝":Y.paymentMethod||"微信支付"}),i.jsx(ve,{children:Y.status==="refunded"?i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):Y.status==="paid"||Y.status==="completed"?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):Y.status==="pending"||Y.status==="created"?i.jsx(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):i.jsx(Fe,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),i.jsx(ve,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:Y.refundReason,children:Y.status==="refunded"&&Y.refundReason?Y.refundReason:"-"}),i.jsx(ve,{className:"text-[#FFD700]",children:Y.referrerEarnings?`¥${Number(Y.referrerEarnings).toFixed(2)}`:"-"}),i.jsx(ve,{className:"text-gray-400 text-sm",children:new Date(Y.createdAt).toLocaleString("zh-CN")}),i.jsx(ve,{children:(Y.status==="paid"||Y.status==="completed")&&i.jsxs(re,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{I(Y),O("")},children:[i.jsx(FN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},Y.id)}),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),i.jsx(Zr,{page:f,totalPages:oe,total:s,pageSize:g,onPageChange:m,onPageSizeChange:Y=>{y(Y),m(1)}})]})})}),i.jsx(Qt,{open:!!R,onOpenChange:Y=>!Y&&I(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:"订单退款"})}),R&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",R.orderSn||R.id]}),i.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(R.amount||0).toFixed(2)]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),i.jsx("div",{className:"form-input",children:i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:A,onChange:Y=>O(Y.target.value)})})]}),i.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>I(null),disabled:W,children:"取消"}),i.jsx(re,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:V,disabled:W,children:W?"退款中...":"确认退款"})]})]})})]})}const ul=b.forwardRef(({className:t,...e},n)=>i.jsx("textarea",{className:xt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));ul.displayName="Textarea";const pu=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function rP(){var ls,oi,cs,pa,ds;const[t,e]=AN(),n=t.get("pool"),[r,s]=b.useState([]),[a,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=Fx(m,300),v=n==="vip"?"vip":n==="complete"?"complete":"all",[j,w]=b.useState(v),[k,E]=b.useState(!0),[C,M]=b.useState(null),[D,F]=b.useState(!1),[R,I]=b.useState("desc");b.useEffect(()=>{n==="vip"?w("vip"):n==="complete"?w("complete"):n==="all"&&w("all")},[n]);const[A,O]=b.useState(!1),[W,X]=b.useState(null),[q,Z]=b.useState(!1),[_,$]=b.useState(!1),[oe,V]=b.useState({referrals:[],stats:{}}),[ae,Y]=b.useState(!1),[L,H]=b.useState(null),[ue,U]=b.useState(!1),[he,Q]=b.useState(null),[ee,de]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Ce,B]=b.useState([]),[me,Se]=b.useState(!1),[rt,Ye]=b.useState(!1),[st,Qe]=b.useState(null),[Xe,ft]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[Pt,Jt]=b.useState([]),[Kn,qn]=b.useState(!1),[ss,zt]=b.useState(!1),[Cr,is]=b.useState(null),[On,pn]=b.useState({name:"",sort:0}),[mr,Br]=b.useState({}),[Gn,fe]=b.useState(!1);async function ge(){var G;E(!0),M(null);try{if(D){const Ke=new URLSearchParams({search:y,limit:String(h*5)}),Ze=await Be(`/api/db/users/rfm?${Ke}`);if(Ze!=null&&Ze.success){let Cn=Ze.users||[];R==="asc"&&(Cn=[...Cn].reverse());const Vr=(c-1)*h;s(Cn.slice(Vr,Vr+h)),o(((G=Ze.users)==null?void 0:G.length)??0),Cn.length===0&&(F(!1),M("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else F(!1),M((Ze==null?void 0:Ze.error)||"RFM 加载失败,已切回普通模式")}else{const Ke=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...j==="vip"&&{vip:"true"},...j==="complete"&&{pool:"complete"}}),Ze=await Be(`/api/db/users?${Ke}`);Ze!=null&&Ze.success?(s(Ze.users||[]),o(Ze.total??0)):M((Ze==null?void 0:Ze.error)||"加载失败")}}catch(Ke){console.error("Load users error:",Ke),M("网络错误")}finally{E(!1)}}b.useEffect(()=>{u(1)},[y,j,D]),b.useEffect(()=>{ge()},[c,h,y,j,D,R]);const kn=Math.ceil(a/h)||1,ri=()=>{D?R==="desc"?I("asc"):(F(!1),I("desc")):(F(!0),I("desc"))},Ms=G=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[G||""]||"bg-gray-500/20 text-gray-400";async function ha(G){if(confirm("确定要删除这个用户吗?"))try{const Ke=await Yr(`/api/db/users?id=${encodeURIComponent(G)}`);Ke!=null&&Ke.success?ge():alert("删除失败: "+((Ke==null?void 0:Ke.error)||""))}catch{alert("删除失败")}}const Jn=G=>{X(G),de({phone:G.phone||"",nickname:G.nickname||"",password:"",isAdmin:!!(G.isAdmin??!1),hasFullBook:!!(G.hasFullBook??!1)}),O(!0)},as=()=>{X(null),de({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),O(!0)};async function pt(){if(!ee.phone||!ee.nickname){alert("请填写手机号和昵称");return}Z(!0);try{if(W){const G=await Rt("/api/db/users",{id:W.id,nickname:ee.nickname,isAdmin:ee.isAdmin,hasFullBook:ee.hasFullBook,...ee.password&&{password:ee.password}});if(!(G!=null&&G.success)){alert("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await ht("/api/db/users",{phone:ee.phone,nickname:ee.nickname,password:ee.password,isAdmin:ee.isAdmin});if(!(G!=null&&G.success)){alert("创建失败: "+((G==null?void 0:G.error)||""));return}}O(!1),ge()}catch{alert("保存失败")}finally{Z(!1)}}async function Sn(G){H(G),$(!0),Y(!0);try{const Ke=await Be(`/api/db/users/referrals?userId=${encodeURIComponent(G.id)}`);Ke!=null&&Ke.success?V({referrals:Ke.referrals||[],stats:Ke.stats||{}}):V({referrals:[],stats:{}})}catch{V({referrals:[],stats:{}})}finally{Y(!1)}}const Yn=b.useCallback(async()=>{Se(!0);try{const G=await Be("/api/db/user-rules");G!=null&&G.success&&B(G.rules||[])}catch{}finally{Se(!1)}},[]);async function Dn(){if(!Xe.title){alert("请填写规则标题");return}Z(!0);try{if(st){const G=await Rt("/api/db/user-rules",{id:st.id,...Xe});if(!(G!=null&&G.success)){alert("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await ht("/api/db/user-rules",Xe);if(!(G!=null&&G.success)){alert("创建失败: "+((G==null?void 0:G.error)||""));return}}Ye(!1),Yn()}catch{alert("保存失败")}finally{Z(!1)}}async function fa(G){if(confirm("确定删除?"))try{const Ke=await Yr(`/api/db/user-rules?id=${G}`);Ke!=null&&Ke.success&&Yn()}catch{}}async function si(G){try{await Rt("/api/db/user-rules",{id:G.id,enabled:!G.enabled}),Yn()}catch{}}const Er=b.useCallback(async()=>{qn(!0);try{const G=await Be("/api/db/vip-roles");G!=null&&G.success&&Jt(G.roles||[])}catch{}finally{qn(!1)}},[]);async function ii(){if(!On.name){alert("请填写角色名称");return}Z(!0);try{if(Cr){const G=await Rt("/api/db/vip-roles",{id:Cr.id,...On});if(!(G!=null&&G.success)){alert("更新失败");return}}else{const G=await ht("/api/db/vip-roles",On);if(!(G!=null&&G.success)){alert("创建失败");return}}zt(!1),Er()}catch{alert("保存失败")}finally{Z(!1)}}async function ai(G){if(confirm("确定删除?"))try{const Ke=await Yr(`/api/db/vip-roles?id=${G}`);Ke!=null&&Ke.success&&Er()}catch{}}const mn=b.useCallback(async()=>{fe(!0);try{const G=await Be("/api/db/users/journey-stats");G!=null&&G.success&&G.stats&&Br(G.stats)}catch{}finally{fe(!1)}},[]);return i.jsxs("div",{className:"p-8 w-full",children:[C&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:C}),i.jsx("button",{type:"button",onClick:()=>M(null),children:"×"})]}),i.jsx("div",{className:"flex justify-between items-center mb-6",children:i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),i.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",a," 位注册用户",D&&" · RFM 排序中"]})]})}),i.jsxs(Wc,{defaultValue:"users",className:"w-full",children:[i.jsxs(dl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[i.jsxs(en,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[i.jsx(Pn,{className:"w-4 h-4"})," 用户列表"]}),i.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:mn,children:[i.jsx(Vo,{className:"w-4 h-4"})," 用户旅程总览"]}),i.jsxs(en,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Yn,children:[i.jsx(Da,{className:"w-4 h-4"})," 规则配置"]}),i.jsxs(en,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Er,children:[i.jsx(Fi,{className:"w-4 h-4"})," VIP 角色"]})]}),i.jsxs(tn,{value:"users",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[i.jsxs(re,{variant:"outline",onClick:ge,disabled:k,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${k?"animate-spin":""}`})," 刷新"]}),i.jsxs("select",{value:j,onChange:G=>{const Ke=G.target.value;w(Ke),u(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:D,children:[i.jsx("option",{value:"all",children:"全部用户"}),i.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),i.jsx("option",{value:"complete",children:"完善资料用户"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),i.jsx(ce,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:G=>g(G.target.value)})]}),i.jsxs(re,{onClick:as,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(vg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:k?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs("div",{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"用户信息"}),i.jsx(ke,{className:"text-gray-400",children:"绑定信息"}),i.jsx(ke,{className:"text-gray-400",children:"购买状态"}),i.jsx(ke,{className:"text-gray-400",children:"分销收益"}),i.jsxs(ke,{className:"text-gray-400 cursor-pointer select-none",onClick:ri,children:[i.jsxs("div",{className:"flex items-center gap-1 group",children:[i.jsx(dc,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:"RFM分值"}),D?R==="desc"?i.jsx(Jo,{className:"w-3.5 h-3.5 text-[#38bdac]"}):i.jsx(jx,{className:"w-3.5 h-3.5 text-[#38bdac]"}):i.jsx(TT,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),D&&i.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),i.jsx(ke,{className:"text-gray-400",children:"注册时间"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[r.map(G=>{var Ke,Ze,Cn;return i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:G.avatar?i.jsx("img",{src:G.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Ke=G.nickname)==null?void 0:Ke.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>{Q(G.id),U(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:G.nickname}),G.isAdmin&&i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),G.openId&&!((Ze=G.id)!=null&&Ze.startsWith("user_"))&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),i.jsx("p",{className:"text-xs text-gray-500 font-mono",children:G.openId?G.openId.slice(0,12)+"...":(Cn=G.id)==null?void 0:Cn.slice(0,12)})]})]})}),i.jsx(ve,{children:i.jsxs("div",{className:"space-y-1",children:[G.phone&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"📱"}),i.jsx("span",{className:"text-gray-300",children:G.phone})]}),G.wechatId&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"💬"}),i.jsx("span",{className:"text-gray-300",children:G.wechatId})]}),G.openId&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"🔗"}),i.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:G.openId,children:[G.openId.slice(0,12),"..."]})]}),!G.phone&&!G.wechatId&&!G.openId&&i.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),i.jsx(ve,{children:G.hasFullBook?i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),i.jsx(ve,{children:i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(G.earnings||0)).toFixed(2)]}),parseFloat(String(G.pendingEarnings||0))>0&&i.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(G.pendingEarnings||0)).toFixed(2)]}),i.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Sn(G),role:"button",tabIndex:0,onKeyDown:Vr=>Vr.key==="Enter"&&Sn(G),children:[i.jsx(Pn,{className:"w-3 h-3"})," 绑定",G.referralCount||0,"人"]})]})}),i.jsx(ve,{children:G.rfmScore!==void 0?i.jsx("div",{className:"flex flex-col gap-1",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-white font-bold text-base",children:G.rfmScore}),i.jsx(Fe,{className:`border-0 text-xs ${Ms(G.rfmLevel)}`,children:G.rfmLevel})]})}):i.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",i.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),i.jsx(ve,{className:"text-gray-400",children:G.createdAt?new Date(G.createdAt).toLocaleDateString():"-"}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>{Q(G.id),U(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:i.jsx(mg,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Jn(G),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>ha(G.id),title:"删除",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},G.id)}),r.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),i.jsx(Zr,{page:c,totalPages:kn,total:a,pageSize:h,onPageChange:u,onPageSizeChange:G=>{f(G),u(1)}})]})})})]}),i.jsxs(tn,{value:"journey",children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),i.jsxs(re,{variant:"outline",onClick:mn,disabled:Gn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${Gn?"animate-spin":""}`})," 刷新数据"]})]}),i.jsxs("div",{className:"relative mb-8",children:[i.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),i.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:pu.map((G,Ke)=>i.jsxs("div",{className:"relative flex flex-col items-center",children:[i.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${G.color} text-center cursor-default`,children:[i.jsx("div",{className:"text-2xl mb-1",children:G.icon}),i.jsx("div",{className:`text-xs font-medium ${G.color.split(" ").find(Ze=>Ze.startsWith("text-"))}`,children:G.label}),mr[G.id]!==void 0&&i.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[i.jsx("span",{className:"font-bold text-white",children:mr[G.id]})," 人"]}),i.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:Ke+1})]}),Kei.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[i.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:G.step}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-300",children:G.action}),i.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",G.next]})]})]},G.step))})]}),i.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(zr,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),i.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),Gn?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(qe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(mr).length>0?i.jsx("div",{className:"space-y-2",children:pu.map(G=>{const Ke=mr[G.id]||0,Ze=Math.max(...pu.map(Vr=>mr[Vr.id]||0),1),Cn=Math.round(Ke/Ze*100);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[G.icon," ",G.label]}),i.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${Cn}%`}})}),i.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Ke})]},G.id)})}):i.jsx("div",{className:"text-center py-8",children:i.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),i.jsxs(tn,{value:"rules",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{variant:"outline",onClick:Yn,disabled:me,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${me?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:()=>{Qe(null),ft({title:"",description:"",trigger:"",sort:0,enabled:!0}),Ye(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),me?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Ce.length===0?i.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[i.jsx(zr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),i.jsxs(re,{onClick:Yn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(qe,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):i.jsx("div",{className:"space-y-2",children:Ce.map(G=>i.jsx("div",{className:`p-4 rounded-lg border transition-all ${G.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[i.jsx(wt,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),i.jsx("span",{className:"text-white font-medium",children:G.title}),G.trigger&&i.jsxs(Fe,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",G.trigger]}),i.jsx(Fe,{className:`text-xs border-0 ${G.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:G.enabled?"启用":"禁用"})]}),G.description&&i.jsx("p",{className:"text-gray-400 text-sm ml-6",children:G.description})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[i.jsx(vt,{checked:G.enabled,onCheckedChange:()=>si(G)}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>{Qe(G),ft({title:G.title,description:G.description,trigger:G.trigger,sort:G.sort,enabled:G.enabled}),Ye(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>fa(G.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})]})},G.id))})]}),i.jsxs(tn,{value:"vip-roles",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"管理用户 VIP 角色分类,这些角色将在用户详情和会员展示中使用"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{variant:"outline",onClick:Er,disabled:Kn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${Kn?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:()=>{is(null),pn({name:"",sort:0}),zt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加角色"]})]})]}),Kn?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Pt.length===0?i.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[i.jsx(Fi,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-400 mb-4",children:"暂无 VIP 角色"}),i.jsxs(re,{onClick:()=>{is(null),pn({name:"",sort:0}),zt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加第一个角色"]})]}):i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Pt.map(G=>i.jsxs("div",{className:"p-4 bg-[#0f2137] border border-amber-500/20 rounded-xl hover:border-amber-500/40 transition-all group",children:[i.jsxs("div",{className:"flex items-start justify-between mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Fi,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:G.name})]}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx("button",{type:"button",onClick:()=>{is(G),pn({name:G.name,sort:G.sort}),zt(!0)},className:"text-gray-500 hover:text-[#38bdac]",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx("button",{type:"button",onClick:()=>ai(G.id),className:"text-gray-500 hover:text-red-400",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsxs("p",{className:"text-gray-600 text-xs",children:["排序: ",G.sort]})]},G.id))})]})]}),i.jsx(Qt,{open:A,onOpenChange:O,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[W?i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(vg,{className:"w-5 h-5 text-[#38bdac]"}),W?"编辑用户":"添加用户"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ee.phone,onChange:G=>de({...ee,phone:G.target.value}),disabled:!!W})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ee.nickname,onChange:G=>de({...ee,nickname:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:W?"新密码 (留空则不修改)":"密码"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:W?"留空则不修改":"请输入密码",value:ee.password,onChange:G=>de({...ee,password:G.target.value})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-300",children:"管理员权限"}),i.jsx(vt,{checked:ee.isAdmin,onCheckedChange:G=>de({...ee,isAdmin:G})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-300",children:"已购全书"}),i.jsx(vt,{checked:ee.hasFullBook,onCheckedChange:G=>de({...ee,hasFullBook:G})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>O(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:pt,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:rt,onOpenChange:Ye,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}),st?"编辑规则":"添加规则"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"规则标题 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Xe.title,onChange:G=>ft({...Xe,title:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"规则描述"}),i.jsx(ul,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Xe.description,onChange:G=>ft({...Xe,description:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"触发条件"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Xe.trigger,onChange:G=>ft({...Xe,trigger:G.target.value})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{children:i.jsx(te,{className:"text-gray-300",children:"启用状态"})}),i.jsx(vt,{checked:Xe.enabled,onCheckedChange:G=>ft({...Xe,enabled:G})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>Ye(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:Dn,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:ss,onOpenChange:zt,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-amber-400"}),Cr?"编辑 VIP 角色":"添加 VIP 角色"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色名称 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:创业者、资源整合者、技术咖",value:On.name,onChange:G=>pn({...On,name:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序(越小越前)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:On.sort,onChange:G=>pn({...On,sort:parseInt(G.target.value)||0})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>zt(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:ii,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:_,onOpenChange:$,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",L==null?void 0:L.nickname]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((ls=oe.stats)==null?void 0:ls.total)||0}),i.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-green-400",children:((oi=oe.stats)==null?void 0:oi.purchased)||0}),i.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((cs=oe.stats)==null?void 0:cs.earnings)||0).toFixed(2)]}),i.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((pa=oe.stats)==null?void 0:pa.pendingEarnings)||0).toFixed(2)]}),i.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),ae?i.jsxs("div",{className:"flex items-center justify-center py-8",children:[i.jsx(qe,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((ds=oe.referrals)==null?void 0:ds.length)??0)>0?i.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(oe.referrals??[]).map((G,Ke)=>{var Cn;const Ze=G;return i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((Cn=Ze.nickname)==null?void 0:Cn.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white text-sm",children:Ze.nickname}),i.jsx("div",{className:"text-xs text-gray-500",children:Ze.phone||(Ze.hasOpenId?"微信用户":"未绑定")})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[Ze.status==="vip"&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ze.status==="paid"&&i.jsxs(Fe,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ze.purchasedSections,"章"]}),Ze.status==="free"&&i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),i.jsx("span",{className:"text-xs text-gray-500",children:Ze.createdAt?new Date(Ze.createdAt).toLocaleDateString():""})]})]},Ze.id||Ke)})}):i.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),i.jsx(bn,{children:i.jsx(re,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),i.jsx($x,{open:ue,onClose:()=>U(!1),userId:he,onUserUpdated:ge})]})}function Ju(t,[e,n]){return Math.min(n,Math.max(e,t))}var ok=["PageUp","PageDown"],lk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ck={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},hl="Slider",[kg,sP,iP]=Dx(hl),[dk]=aa(hl,[iP]),[aP,ef]=dk(hl),uk=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:a=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:v,...j}=t,w=b.useRef(new Set),k=b.useRef(0),C=o==="horizontal"?oP:lP,[M=[],D]=Va({prop:f,defaultProp:h,onChange:W=>{var q;(q=[...w.current][k.current])==null||q.focus(),m(W)}}),F=b.useRef(M);function R(W){const X=fP(M,W);O(W,X)}function I(W){O(W,k.current)}function A(){const W=F.current[k.current];M[k.current]!==W&&g(M)}function O(W,X,{commit:q}={commit:!1}){const Z=xP(a),_=yP(Math.round((W-r)/a)*a+r,Z),$=Ju(_,[r,s]);D((oe=[])=>{const V=uP(oe,$,X);if(gP(V,u*a)){k.current=V.indexOf($);const ae=String(V)!==String(oe);return ae&&q&&g(V),ae?V:oe}else return oe})}return i.jsx(aP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:k,thumbs:w.current,values:M,orientation:o,form:v,children:i.jsx(kg.Provider,{scope:t.__scopeSlider,children:i.jsx(kg.Slot,{scope:t.__scopeSlider,children:i.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:nt(j.onPointerDown,()=>{c||(F.current=M)}),min:r,max:s,inverted:y,onSlideStart:c?void 0:R,onSlideMove:c?void 0:I,onSlideEnd:c?void 0:A,onHomeKeyDown:()=>!c&&O(r,0,{commit:!0}),onEndKeyDown:()=>!c&&O(s,M.length-1,{commit:!0}),onStepKeyDown:({event:W,direction:X})=>{if(!c){const _=ok.includes(W.key)||W.shiftKey&&lk.includes(W.key)?10:1,$=k.current,oe=M[$],V=a*_*X;O(oe+V,$,{commit:!0})}}})})})})});uk.displayName=hl;var[hk,fk]=dk(hl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),oP=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:a,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=gt(e,C=>g(C)),v=b.useRef(void 0),j=Qh(s),w=j==="ltr",k=w&&!a||!w&&a;function E(C){const M=v.current||m.getBoundingClientRect(),D=[0,M.width],R=Bx(D,k?[n,r]:[r,n]);return v.current=M,R(C-M.left)}return i.jsx(hk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:i.jsx(pk,{dir:j,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const M=E(C.clientX);o==null||o(M)},onSlideMove:C=>{const M=E(C.clientX);c==null||c(M)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:C=>{const D=ck[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:D?-1:1})}})})}),lP=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=gt(e,f),g=b.useRef(void 0),y=!s;function v(j){const w=g.current||f.current.getBoundingClientRect(),k=[0,w.height],C=Bx(k,y?[r,n]:[n,r]);return g.current=w,C(j-w.top)}return i.jsx(hk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:i.jsx(pk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const w=v(j.clientY);a==null||a(w)},onSlideMove:j=>{const w=v(j.clientY);o==null||o(w)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=ck[y?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),pk=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=ef(hl,n);return i.jsx(ot.span,{...h,ref:e,onKeyDown:nt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):ok.concat(lk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:nt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:nt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:nt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),a(m))})})}),mk="SliderTrack",gk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ef(mk,n);return i.jsx(ot.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});gk.displayName=mk;var Sg="SliderRange",xk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ef(Sg,n),a=fk(Sg,n),o=b.useRef(null),c=gt(e,o),u=s.values.length,h=s.values.map(g=>bk(g,s.min,s.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return i.jsx(ot.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[a.startEdge]:f+"%",[a.endEdge]:m+"%"}})});xk.displayName=Sg;var Cg="SliderThumb",yk=b.forwardRef((t,e)=>{const n=sP(t.__scopeSlider),[r,s]=b.useState(null),a=gt(e,c=>s(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return i.jsx(cP,{...t,ref:a,index:o})}),cP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...a}=t,o=ef(Cg,n),c=fk(Cg,n),[u,h]=b.useState(null),f=gt(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,g=zx(u),y=o.values[r],v=y===void 0?0:bk(y,o.min,o.max),j=hP(r,o.values.length),w=g==null?void 0:g[c.size],k=w?pP(w,v,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),i.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${v}% + ${k}px)`},children:[i.jsx(kg.ItemSlot,{scope:t.__scopeSlider,children:i.jsx(ot.span,{role:"slider","aria-label":t["aria-label"]||j,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...a,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:nt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&i.jsx(vk,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});yk.displayName=Cg;var dP="RadioBubbleInput",vk=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),a=gt(s,r),o=_x(e);return b.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),i.jsx(ot.input,{style:{display:"none"},...n,ref:a,defaultValue:e})});vk.displayName=dP;function uP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,a)=>s-a)}function bk(t,e,n){const a=100/(n-e)*(t-e);return Ju(a,[0,100])}function hP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function fP(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function pP(t,e,n){const r=t/2,a=Bx([0,50],[0,r]);return(r-a(e)*n)*n}function mP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function gP(t,e){if(e>0){const n=mP(t);return Math.min(...n)>=e}return!0}function Bx(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function xP(t){return(String(t).split(".")[1]||"").length}function yP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var vP=uk,bP=gk,wP=xk,NP=yk;function jP({className:t,defaultValue:e,value:n,min:r=0,max:s=100,...a}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,s],[n,e,r,s]);return i.jsxs(vP,{defaultValue:e,value:n,min:r,max:s,className:xt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...a,children:[i.jsx(bP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:i.jsx(wP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>i.jsx(NP,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},u))]})}const kP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function wk(t){const[e,n]=b.useState(kP),[r,s]=b.useState(!0),[a,o]=b.useState(!1);b.useEffect(()=>{Be("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>s(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await ht("/api/admin/referral-settings",h);if(!f||f.success===!1){alert("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}alert(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),alert("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return r?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Yo,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),i.jsxs(re,{onClick:c,disabled:a||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(rA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),i.jsx(It,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),i.jsx(Te,{className:"space-y-6",children:i.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(iu,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),i.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(Pn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(jP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),i.jsx(ce,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",i.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(iu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),i.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(iu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),i.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(Pn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),i.jsx(ce,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),i.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(Yo,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),i.jsx(It,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),i.jsx(Te,{className:"space-y-6",children:i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最低提现金额(元)"}),i.jsx(ce,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),i.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",i.jsx(Fe,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[i.jsx(vt,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),i.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[i.jsx(iu,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),i.jsxs(Te,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[i.jsxs("p",{children:["1. 以上配置会写入"," ",i.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),i.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),i.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function SP(){var Ce;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[s,a]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(""),[E,C]=b.useState("all"),[M,D]=b.useState(1),[F,R]=b.useState(10),[I,A]=b.useState(0),[O,W]=b.useState(new Set),[X,q]=b.useState(null),[Z,_]=b.useState(""),[$,oe]=b.useState(!1);b.useEffect(()=>{V()},[]),b.useEffect(()=>{D(1)},[t,E]),b.useEffect(()=>{ae(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&ae(t,!0)},[M,F,E,w]);async function V(){j(null);try{const B=await Be("/api/admin/distribution/overview");B!=null&&B.success&&B.overview&&a(B.overview)}catch(B){console.error("[Admin] 概览接口异常:",B),j("加载概览失败")}try{const B=await Be("/api/db/users");m((B==null?void 0:B.users)||[])}catch(B){console.error("[Admin] 用户数据加载失败:",B)}}async function ae(B,me=!1){var Se;if(!(!me&&O.has(B))){y(!0);try{const rt=f;switch(B){case"overview":break;case"orders":{try{const Ye=new URLSearchParams({page:String(M),pageSize:String(F),...E!=="all"&&{status:E},...w&&{search:w}}),st=await Be(`/api/orders?${Ye}`);if(st!=null&&st.success&&st.orders){const Qe=st.orders.map(Xe=>{const ft=rt.find(Jt=>Jt.id===Xe.userId),Pt=Xe.referrerId?rt.find(Jt=>Jt.id===Xe.referrerId):null;return{...Xe,amount:parseFloat(String(Xe.amount))||0,userNickname:(ft==null?void 0:ft.nickname)||Xe.userNickname||"未知用户",userPhone:(ft==null?void 0:ft.phone)||Xe.userPhone||"-",referrerNickname:(Pt==null?void 0:Pt.nickname)||null,referrerCode:(Pt==null?void 0:Pt.referralCode)??null,type:Xe.productType||Xe.type}});r(Qe),A(st.total??Qe.length)}else r([]),A(0)}catch(Ye){console.error(Ye),j("加载订单失败"),r([])}break}case"bindings":{try{const Ye=new URLSearchParams({page:String(M),pageSize:String(F),...E!=="all"&&{status:E}}),st=await Be(`/api/db/distribution?${Ye}`);c((st==null?void 0:st.bindings)||[]),A((st==null?void 0:st.total)??((Se=st==null?void 0:st.bindings)==null?void 0:Se.length)??0)}catch(Ye){console.error(Ye),j("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const Ye=E==="completed"?"success":E==="rejected"?"failed":E,st=new URLSearchParams({...Ye&&Ye!=="all"&&{status:Ye},page:String(M),pageSize:String(F)}),Qe=await Be(`/api/admin/withdrawals?${st}`);if(Qe!=null&&Qe.success&&Qe.withdrawals){const Xe=Qe.withdrawals.map(ft=>({...ft,account:ft.account??"未绑定微信号",status:ft.status==="success"?"completed":ft.status==="failed"?"rejected":ft.status}));h(Xe),A((Qe==null?void 0:Qe.total)??Xe.length)}else Qe!=null&&Qe.success||j(`获取提现记录失败: ${(Qe==null?void 0:Qe.error)||"未知错误"}`),h([])}catch(Ye){console.error(Ye),j("加载提现数据失败"),h([])}break}}W(Ye=>new Set(Ye).add(B))}catch(rt){console.error(rt)}finally{y(!1)}}}async function Y(){j(null),W(B=>{const me=new Set(B);return me.delete(t),me}),t==="overview"&&V(),await ae(t,!0)}async function L(B){if(confirm("确认审核通过并打款?"))try{const me=await Rt("/api/admin/withdrawals",{id:B,action:"approve"});if(!(me!=null&&me.success)){const Se=(me==null?void 0:me.message)||(me==null?void 0:me.error)||"操作失败";alert(Se);return}await Y()}catch(me){console.error(me),alert("操作失败")}}async function H(B){const me=prompt("请输入拒绝原因:");if(me)try{const Se=await Rt("/api/admin/withdrawals",{id:B,action:"reject",errorMessage:me});if(!(Se!=null&&Se.success)){alert((Se==null?void 0:Se.error)||"操作失败");return}await Y()}catch(Se){console.error(Se),alert("操作失败")}}async function ue(){var B;if(!(!(X!=null&&X.orderSn)&&!(X!=null&&X.id))){oe(!0),j(null);try{const me=await Rt("/api/admin/orders/refund",{orderSn:X.orderSn||X.id,reason:Z||void 0});me!=null&&me.success?(q(null),_(""),await ae("orders",!0)):j((me==null?void 0:me.error)||"退款失败")}catch(me){const Se=me;j(((B=Se==null?void 0:Se.data)==null?void 0:B.error)||"退款失败,请检查网络后重试")}finally{oe(!1)}}}function U(B){const me={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},Se={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return i.jsx(Fe,{className:`${me[B]||"bg-gray-500/20 text-gray-400"} border-0`,children:Se[B]||B})}const he=Math.ceil(I/F)||1,Q=n,ee=o.filter(B=>{var Se,rt,Ye,st;if(!w)return!0;const me=w.toLowerCase();return((Se=B.refereeNickname)==null?void 0:Se.toLowerCase().includes(me))||((rt=B.refereePhone)==null?void 0:rt.includes(me))||((Ye=B.referrerName)==null?void 0:Ye.toLowerCase().includes(me))||((st=B.referrerCode)==null?void 0:st.toLowerCase().includes(me))}),de=u.filter(B=>{var Se;if(!w)return!0;const me=w.toLowerCase();return((Se=B.userName)==null?void 0:Se.toLowerCase().includes(me))||B.account&&B.account.toLowerCase().includes(me)});return i.jsxs("div",{className:"p-8 w-full",children:[v&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:v}),i.jsx("button",{type:"button",onClick:()=>j(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),i.jsxs(re,{onClick:Y,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),i.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:dc},{key:"orders",label:"订单管理",icon:Wu},{key:"bindings",label:"绑定管理",icon:Ns},{key:"withdrawals",label:"提现审核",icon:Yo},{key:"settings",label:"推广设置",icon:Da}].map(B=>i.jsxs("button",{type:"button",onClick:()=>{e(B.key),C("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===B.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[i.jsx(B.icon,{className:"w-4 h-4"}),B.label]},B.key))}),g?i.jsxs("div",{className:"flex items-center justify-center py-20",children:[i.jsx(qe,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[t==="overview"&&s&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayClicks}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:i.jsx(mg,{className:"w-6 h-6 text-blue-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayUniqueVisitors??0}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:i.jsx(Pn,{className:"w-6 h-6 text-cyan-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(s.todayClickRate??0).toFixed(2)}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:i.jsx(dc,{className:"w-6 h-6 text-amber-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayBindings})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:i.jsx(Ns,{className:"w-6 h-6 text-green-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayConversions})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:i.jsx(Tb,{className:"w-6 h-6 text-purple-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),i.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",s.todayEarnings.toFixed(2)]})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:i.jsx(Wu,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Ce=s.todayClicksByPage)==null?void 0:Ce.length)??0)>0&&i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(mg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),i.jsx(Te,{children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[i.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),i.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),i.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),i.jsx("tbody",{children:[...s.todayClicksByPage??[]].sort((B,me)=>me.clicks-B.clicks).map((B,me)=>i.jsxs("tr",{className:"border-b border-gray-700/50",children:[i.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:B.page||"(未区分)"}),i.jsx("td",{className:"py-2 pr-4 text-right text-white",children:B.clicks}),i.jsxs("td",{className:"py-2 text-right text-gray-400",children:[s.todayClicks>0?(B.clicks/s.todayClicks*100).toFixed(1):0,"%"]})]},me))})]})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Ee,{className:"bg-orange-500/10 border-orange-500/30",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:i.jsx(fg,{className:"w-6 h-6 text-orange-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),i.jsxs("p",{className:"text-2xl font-bold text-white",children:[s.expiringBindings," 个"]}),i.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),i.jsx(Ee,{className:"bg-blue-500/10 border-blue-500/30",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:i.jsx(Yo,{className:"w-6 h-6 text-blue-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),i.jsxs("p",{className:"text-2xl font-bold text-white",children:[s.pendingWithdrawals," 笔"]}),i.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",s.pendingWithdrawAmount.toFixed(2)]})]}),i.jsx(re,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(kc,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),i.jsx(Te,{children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthClicks})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthBindings})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthConversions})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),i.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",s.monthEarnings.toFixed(2)]})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(dc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),i.jsxs(Te,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalClicks.toLocaleString()})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalBindings.toLocaleString()})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalConversions})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),i.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",s.totalEarnings.toFixed(2)]})]})]}),i.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[i.jsx("span",{className:"text-gray-300",children:"点击转化率"}),i.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[s.conversionRate,"%"]})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),i.jsx(Te,{children:i.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-white",children:s.totalDistributors}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-green-400",children:s.activeDistributors}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"pending",children:"待支付"}),i.jsx("option",{value:"failed",children:"已失败"}),i.jsx("option",{value:"refunded",children:"已退款"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[n.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Q.map(B=>{var me,Se;return i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(me=B.id)==null?void 0:me.slice(0,12),"..."]}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:B.userNickname}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.userPhone})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:(()=>{const rt=B.productType||B.type;return rt==="fullbook"?`${B.bookName||"《底层逻辑》"} - 全本`:rt==="match"?"匹配次数购买":`${B.bookName||"《底层逻辑》"} - ${B.sectionTitle||B.chapterTitle||`章节${B.productId||B.sectionId||""}`}`})()}),i.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const rt=B.productType||B.type;return rt==="fullbook"?"全书解锁":rt==="match"?"功能权益":B.chapterTitle||"单章购买"})()})]})}),i.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof B.amount=="number"?B.amount.toFixed(2):parseFloat(String(B.amount||"0")).toFixed(2)]}),i.jsx("td",{className:"p-4 text-gray-300",children:B.paymentMethod==="wechat"?"微信支付":B.paymentMethod==="alipay"?"支付宝":B.paymentMethod||"微信支付"}),i.jsx("td",{className:"p-4",children:B.status==="refunded"?i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):B.status==="completed"||B.status==="paid"?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):B.status==="pending"||B.status==="created"?i.jsx(Fe,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):i.jsx(Fe,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),i.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:B.refundReason,children:B.status==="refunded"&&B.refundReason?B.refundReason:"-"}),i.jsx("td",{className:"p-4 text-gray-300 text-sm",children:B.referrerId||B.referralCode?i.jsxs("span",{title:B.referralCode||B.referrerCode||B.referrerId||"",children:[B.referrerNickname||B.referralCode||B.referrerCode||((Se=B.referrerId)==null?void 0:Se.slice(0,8)),(B.referralCode||B.referrerCode)&&` (${B.referralCode||B.referrerCode})`]}):"-"}),i.jsx("td",{className:"p-4 text-[#FFD700]",children:B.referrerEarnings?`¥${(typeof B.referrerEarnings=="number"?B.referrerEarnings:parseFloat(String(B.referrerEarnings))).toFixed(2)}`:"-"}),i.jsx("td",{className:"p-4 text-gray-400 text-sm",children:B.createdAt?new Date(B.createdAt).toLocaleString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:(B.status==="paid"||B.status==="completed")&&i.jsxs(re,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{q(B),_("")},children:[i.jsx(FN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},B.id)})})]})}),t==="orders"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]}),t==="bindings"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"active",children:"有效"}),i.jsx("option",{value:"converted",children:"已转化"}),i.jsx("option",{value:"expired",children:"已过期"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[ee.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ee.map(B=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-medium",children:B.refereeNickname||"匿名用户"}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.refereePhone})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:B.referrerName||"-"}),i.jsx("p",{className:"text-gray-500 text-xs font-mono",children:B.referrerCode})]})}),i.jsx("td",{className:"p-4 text-gray-400",children:B.boundAt?new Date(B.boundAt).toLocaleDateString("zh-CN"):"-"}),i.jsx("td",{className:"p-4 text-gray-400",children:B.expiresAt?new Date(B.expiresAt).toLocaleDateString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:U(B.status)}),i.jsx("td",{className:"p-4",children:B.commission?i.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",B.commission.toFixed(2)]}):i.jsx("span",{className:"text-gray-500",children:"-"})})]},B.id))})]})}),t==="bindings"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]}),t==="withdrawals"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"pending",children:"待审核"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[de.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:de.map(B=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[B.userAvatar?i.jsx("img",{src:B.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):i.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(B.userName||B.name||"?").slice(0,1)}),i.jsx("p",{className:"text-white font-medium",children:B.userName||B.name})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",B.amount.toFixed(2)]})}),i.jsx("td",{className:"p-4",children:i.jsx(Fe,{className:B.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:B.method==="wechat"?"微信":"支付宝"})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-mono text-xs",children:B.account}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.name})]})}),i.jsx("td",{className:"p-4 text-gray-400",children:B.createdAt?new Date(B.createdAt).toLocaleString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:U(B.status)}),i.jsx("td",{className:"p-4 text-right",children:B.status==="pending"&&i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsxs(re,{size:"sm",onClick:()=>L(B.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Tb,{className:"w-4 h-4 mr-1"}),"通过"]}),i.jsxs(re,{size:"sm",variant:"outline",onClick:()=>H(B.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[i.jsx(PN,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},B.id))})]})}),t==="withdrawals"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]})]}),i.jsx(Qt,{open:!!X,onOpenChange:B=>!B&&q(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:"订单退款"})}),X&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",X.orderSn||X.id]}),i.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof X.amount=="number"?X.amount.toFixed(2):parseFloat(String(X.amount||"0")).toFixed(2)]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),i.jsx("div",{className:"form-input",children:i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:Z,onChange:B=>_(B.target.value)})})]}),i.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>q(null),disabled:$,children:"取消"}),i.jsx(re,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ue,disabled:$,children:$?"退款中...":"确认退款"})]})]})}),t==="settings"&&i.jsx("div",{className:"-mx-8 -mt-6",children:i.jsx(wk,{embedded:!0})})]})}function CP(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[s,a]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,j]=b.useState(0),[w,k]=b.useState(null);async function E(){var R,I,A,O,W,X,q;a(!0),c(null);try{const Z=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),_=await Be(`/api/admin/withdrawals?${Z}`);if(_!=null&&_.success){const $=_.withdrawals||[];e($),j(_.total??((R=_.stats)==null?void 0:R.total)??$.length),r({total:((I=_.stats)==null?void 0:I.total)??_.total??$.length,pendingCount:((A=_.stats)==null?void 0:A.pendingCount)??0,pendingAmount:((O=_.stats)==null?void 0:O.pendingAmount)??0,successCount:((W=_.stats)==null?void 0:W.successCount)??0,successAmount:((X=_.stats)==null?void 0:X.successAmount)??0,failedCount:((q=_.stats)==null?void 0:q.failedCount)??0})}else c("加载提现记录失败")}catch(Z){console.error("Load withdrawals error:",Z),c("加载失败,请检查网络后重试")}finally{a(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{E()},[u,f,g]);const C=Math.ceil(v/g)||1;async function M(R){const I=t.find(A=>A.id===R);if(I!=null&&I.userCommissionInfo&&I.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${I.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const A=await Rt("/api/admin/withdrawals",{id:R,action:"approve"});A!=null&&A.success?E():alert("操作失败: "+((A==null?void 0:A.error)??""))}catch{alert("操作失败")}finally{k(null)}}async function D(R){const I=prompt("请输入拒绝原因(将返还用户余额):");if(I){k(R);try{const A=await Rt("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:I});A!=null&&A.success?E():alert("操作失败: "+((A==null?void 0:A.error)??""))}catch{alert("操作失败")}finally{k(null)}}}function F(R){switch(R){case"pending":return i.jsx(Fe,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return i.jsx(Fe,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return i.jsx(Fe,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return i.jsx(Fe,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return i.jsxs("div",{className:"p-8 w-full",children:[o&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:o}),i.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-start mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),i.jsxs(re,{variant:"outline",onClick:E,disabled:s,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})]}),i.jsx(Ee,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:i.jsx(Te,{className:"p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Wu,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),i.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",i.jsx("span",{className:"text-white font-medium",children:"90%"})]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),i.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),i.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),i.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),i.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),i.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>i.jsx(re,{variant:u===R?"default":"outline",size:"sm",onClick:()=>h(R),className:u===R?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:R==="all"?"全部":R==="pending"?"待处理":R==="success"?"已完成":"已拒绝"},R))}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:s?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?i.jsxs("div",{className:"text-center py-12",children:[i.jsx(Yo,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),i.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),i.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?i.jsx("img",{src:R.userAvatar,alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(R.userName??"?").charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),i.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),i.jsx("td",{className:"p-4",children:R.userCommissionInfo?i.jsxs("div",{className:"text-xs space-y-1",children:[i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),i.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"已提现:"}),i.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"待审核:"}),i.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[i.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),i.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):i.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),i.jsxs("td",{className:"p-4",children:[F(R.status),R.errorMessage&&i.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),i.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),i.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?i.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),i.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsxs(re,{size:"sm",onClick:()=>M(R.id),disabled:w===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[i.jsx(Kh,{className:"w-4 h-4 mr-1"}),"批准"]}),i.jsxs(re,{size:"sm",variant:"outline",onClick:()=>D(R.id),disabled:w===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&i.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),i.jsx(Zr,{page:f,totalPages:C,total:v,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})})]})}var Cm={exports:{}},Em={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Xb;function EP(){if(Xb)return Em;Xb=1;var t=Fc();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),j=v[0].inst,w=v[1];return a(function(){j.value=y,j.getSnapshot=g,u(j)&&w({inst:j})},[m,y,g]),s(function(){return u(j)&&w({inst:j}),m(function(){u(j)&&w({inst:j})})},[m]),o(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Em.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Em}var Zb;function Nk(){return Zb||(Zb=1,Cm.exports=EP()),Cm.exports}var jk=Nk();function Mn(t){this.content=t}Mn.prototype={constructor:Mn,find:function(t){for(var e=0;e>1}};Mn.from=function(t){if(t instanceof Mn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Mn(e)};function kk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),a=e.child(r);if(s==a){n+=s.nodeSize;continue}if(!s.sameMarkup(a))return n;if(s.isText&&s.text!=a.text){for(let o=0;s.text[o]==a.text[o];o++)n++;return n}if(s.content.size||a.content.size){let o=kk(s.content,a.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function Sk(t,e,n,r){for(let s=t.childCount,a=e.childCount;;){if(s==0||a==0)return s==a?null:{a:n,b:r};let o=t.child(--s),c=e.child(--a),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,s+c,a||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,s+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let a="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?s?typeof s=="function"?s(c):s:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:a+=r),a+=h},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),a=1);ae)for(let a=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),s+=c.nodeSize),o=u}return new pe(r,s)}cutByIndex(e,n){return e==n?pe.empty:e==0&&n==this.content.length?this:new pe(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new pe(s,a)}addToStart(e){return new pe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new pe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),a=r+s.nodeSize;if(a>=e)return a==e?mu(n+1,a):mu(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return pe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new pe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return pe.empty;let n,r=0;for(let s=0;sthis.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-s.type.rank),n}};jt.none=[];class Qu extends Error{}class Me{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ek(this.content,e+this.openStart,n);return r&&new Me(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Me(Ck(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Me.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Me(pe.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)s++;return new Me(e,r,s)}}Me.empty=new Me(pe.empty,0,0);function Ck(t,e,n){let{index:r,offset:s}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(s==e||a.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(Ck(a.content,e-s-1,n-s-1)))}function Ek(t,e,n,r){let{index:s,offset:a}=t.findIndex(e),o=t.maybeChild(s);if(a==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Ek(o.content,e-a-1,n,o);return c&&t.replaceChild(s,o.copy(c))}function TP(t,e,n){if(n.openStart>t.depth)throw new Qu("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qu("Inconsistent open depths");return Tk(t,e,n,0)}function Tk(t,e,n,r){let s=t.index(r),a=t.node(r);if(s==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function uc(t,e,n,r){let s=(e||t).node(n),a=0,o=e?e.index(n):s.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(_a(t.nodeAfter,r),a++));for(let c=a;cs&&Tg(t,e,s+1),o=r.depth>s&&Tg(n,r,s+1),c=[];return uc(null,t,s,c),a&&o&&e.index(s)==n.index(s)?(Mk(a,o),_a(za(a,Ak(t,e,n,r,s+1)),c)):(a&&_a(za(a,Xu(t,e,s+1)),c),uc(e,n,s,c),o&&_a(za(o,Xu(n,r,s+1)),c)),uc(r,null,s,c),new pe(c)}function Xu(t,e,n){let r=[];if(uc(null,t,n,r),t.depth>n){let s=Tg(t,e,n+1);_a(za(s,Xu(t,e,n+1)),r)}return uc(e,null,n,r),new pe(r)}function MP(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)s=e.node(a).copy(pe.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Ec{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let a=0;a0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Zu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,a=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(a),h=a-u;if(r.push(o,c,s+u),!h||(o=o.child(c),o.isText))break;a=h-1,s+=u+1}return new Ec(n,r,a)}static resolveCached(e,n){let r=e1.get(e);if(r)for(let a=0;ae&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Rk(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=pe.empty,s=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,a),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=s;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=pe.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,s,r);return a.type.checkAttrs(a.attrs),a}};Js.prototype.text=void 0;class eh extends Js{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rk(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new eh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new eh(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Wa{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new PP(e,n);if(r.next==null)return Wa.empty;let s=Ik(r);r.next&&r.err("Unexpected trailing text");let a=FP($P(s));return BP(a,r),a}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s{let a=s+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return a}).join(` -`)}}Wa.empty=new Wa(!0);class PP{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Ik(t){let e=[];do e.push(OP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function OP(t){let e=[];do e.push(DP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function DP(t){let e=zP(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=LP(t,e);else break;return e}function t1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function LP(t,e){let n=t1(t),r=n;return t.eat(",")&&(t.next!="}"?r=t1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function _P(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let a in n){let o=n[a];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function zP(t){if(t.eat("(")){let e=Ik(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=_P(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $P(t){let e=[[]];return s(a(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function s(o,c){o.forEach(u=>u.to=c)}function a(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(a(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=a(o.exprs[u],c);if(u==o.exprs.length-1)return h;s(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),s(a(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return s(a(o.expr,c),u),s(a(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(a(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||s.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let a=e[r.join(",")]=new Wa(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Dk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Js(this,this.computeAttrs(e),pe.from(n),jt.setFrom(r))}createChecked(e=null,n,r){return n=pe.from(n),this.checkContent(n),new Js(this,this.computeAttrs(e),n,jt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=pe.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),a=s&&s.fillBefore(pe.empty,!0);return a?new Js(this,e,n.append(a),jt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[a]=new zk(a,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function VP(t,e,n){let r=n.split("|");return s=>{let a=s===null?"null":typeof s;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class HP{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?VP(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class tf{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=_k(e,s.attrs),this.excluded=null;let a=Ok(this.attrs);this.instance=a?new jt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new jt(this,Dk(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((a,o)=>r[a]=new tf(a,s++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class $k{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Mn.from(e.nodes),n.marks=Mn.from(e.marks||{}),this.nodes=r1.compile(this.spec.nodes,this),this.marks=tf.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let a=this.nodes[s],o=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=Wa.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=c=="_"?null:c?s1(this,c.split(" ")):c==""||!a.inlineContent?[]:null}for(let s in this.marks){let a=this.marks[s],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:s1(this,o.split(" "))}this.nodeFromJSON=s=>Js.fromJSON(this,s),this.markFromJSON=s=>jt.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof r1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new eh(r,r.defaultAttrs,e,jt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function s1(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function WP(t){return t.tag!=null}function UP(t){return t.style!=null}class Gi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(WP(s))this.tags.push(s);else if(UP(s)){let a=/[^=]*/.exec(s.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let a=e.nodes[s.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new a1(this,n,!1);return r.addAll(e,jt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new a1(this,n,!0);return r.addAll(e,jt.none,n.from,n.to),Me.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;se.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let a=s.priority==null?50:s.priority,o=0;for(;o{r(o=o1(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let a=e.nodes[s].spec.parseDOM;a&&a.forEach(o=>{r(o=o1(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Gi(e,Gi.schemaRules(e)))}}const Fk={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},KP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Bk={ol:!0,ul:!0},Tc=1,Ag=2,hc=4;function i1(t,e,n){return e!=null?(e?Tc:0)|(e==="full"?Ag:0):t&&t.whitespace=="pre"?Tc|Ag:n&~hc}class gu{constructor(e,n,r,s,a,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=jt.none,this.match=a||(o&hc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(pe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Tc)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-s[0].length))}}let n=pe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(pe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Fk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class a1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,a,o=i1(null,n.preserveWhitespace,0)|(r?hc:0);s?a=new gu(s.type,s.attrs,jt.none,!0,n.topMatch||s.type.contentMatch,o):r?a=new gu(null,null,jt.none,!0,null,o):a=new gu(e.schema.topNodeType,null,jt.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,a=s.options&Ag?"full":this.localPreserveWS||(s.options&Tc)>0,{schema:o}=this.parser;if(a==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,` -`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,s){let a,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(a=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}a&&this.sync(c)&&this.open--}addAll(e,n,r,s){let a=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=s==null?null:e.childNodes[s];o!=c;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,n);this.findAtPoint(e,a)}findPlace(e,n,r){let s,a;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!s||s.length>h.length+c)&&(s=h,a=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!s)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):l1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new gu(e,n,u,s,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Tc)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(s?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=a;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&s?this.nodes[u].type:r&&u>=a?r.node(u-a).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function qP(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Bk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function GP(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function o1(t){let e={};for(let n in t)e[n]=t[n];return e}function l1(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let a=[],o=c=>{a.push(c);for(let u=0;u{if(a.length||o.marks.length){let c=0,u=0;for(;c=0;s--){let a=this.serializeMark(e.marks[s],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Du(Mm(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return Du(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new eo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=c1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return c1(e.marks)}}function c1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Mm(t){return t.document||window.document}const d1=new WeakMap;function JP(t){let e=d1.get(t);return e===void 0&&d1.set(t,e=YP(t)),e}function YP(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let c,u=n?t.createElementNS(n,s):t.createElement(s),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:v}=Du(t,g,n,r);if(u.appendChild(y),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const Vk=65535,Hk=Math.pow(2,16);function QP(t,e){return t+e*Hk}function u1(t){return t&Vk}function XP(t){return(t-(t&Vk))/Hk}const Wk=1,Uk=2,Lu=4,Kk=8;class Rg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Kk)>0}get deletedBefore(){return(this.delInfo&(Wk|Lu))>0}get deletedAfter(){return(this.delInfo&(Uk|Lu))>0}get deletedAcross(){return(this.delInfo&Lu)>0}}class Nr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Nr.empty)return Nr.empty}recover(e){let n=0,r=u1(e);if(!this.inverted)for(let s=0;se)break;let h=this.ranges[c+a],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+s+(g<0?0:f);if(r)return y;let v=e==(n<0?u:m)?null:QP(c/3,e-u),j=e==u?Uk:e==m?Wk:Lu;return(n<0?e!=u:e!=m)&&(j|=Kk),new Rg(y,j,v)}s+=f-h}return r?e+s:new Rg(e+s,0,null)}touches(e,n){let r=0,s=u1(n),a=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+a],f=u+h;if(e<=f&&c==s*3)return!0;r+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,a=0;s=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Mc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ra&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return on.fromReplace(e,this.from,this.to,a)}invert(){return new Xr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Vi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Vi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Vi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Vi(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("addMark",Vi);class Xr extends Un{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Me(Vx(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return on.fromReplace(e,this.from,this.to,r)}invert(){return new Vi(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Xr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Xr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Xr(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("removeMark",Xr);class Hi extends Un{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return on.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return on.fromReplace(e,this.pos,this.pos+1,new Me(pe.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;sr.pos?null:new Nn(n.pos,r.pos,s,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Nn(n.from,n.to,n.gapFrom,n.gapTo,Me.fromJSON(e,n.slice),n.insert,!!n.structure)}}Un.jsonID("replaceAround",Nn);function Ig(t,e,n){let r=t.resolve(e),s=n-e,a=r.depth;for(;s>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,s--;if(s>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function ZP(t,e,n,r){let s=[],a=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),y=Math.min(h+u.nodeSize,n),v=r.addToSet(m);for(let j=0;jt.step(u)),a.forEach(u=>t.step(u))}function eO(t,e,n,r){let s=[],a=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;a++;let u=null;if(r instanceof tf){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new Xr(o.from,o.to,o.style)))}function Hx(t,e,n,r=n.contentMatch,s=!0){let a=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function tO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function fl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,a=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+s,u=t.$to.indexAfter(r)-a;if(rn;v--)j||r.index(v)>0?(j=!0,f=pe.from(r.node(v).copy(f)),m++):u--;let g=pe.empty,y=0;for(let v=a,j=!1;v>n;v--)j||s.after(v+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=pe.from(n[o].type.create(n[o].attrs,r))}let s=e.start,a=e.end;t.step(new Nn(s,a,s,a,new Me(r,0,0),n.length,!0))}function aO(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,u)&&oO(t.doc,t.mapping.slice(a).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!v?h=!1:!y&&v&&(h=!0)}h===!1&&Gk(t,o,c,a),Hx(t,t.mapping.slice(a).map(c,1),r,void 0,h===null);let f=t.mapping.slice(a),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new Nn(m,g,m+1,g-1,new Me(pe.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&qk(t,o,c,a),!1}})}function qk(t,e,n,r){e.forEach((s,a)=>{if(s.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(s.text);){let u=t.mapping.slice(r).map(n+1+a+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function Gk(t,e,n,r){e.forEach((s,a)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+a);t.replaceWith(o,o+1,e.type.schema.text(` -`))}})}function oO(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function lO(t,e,n,r,s){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let o=n.create(r,null,s||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,o);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Nn(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new Me(pe.from(o),0,0),1,!0))}function Ys(t,e,n=1,r){let s=t.resolve(e),a=s.depth-n,o=r&&r[r.length-1]||s.parent;if(a<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let h=s.depth-1,f=n-2;h>a;h--,f--){let m=s.node(h),g=s.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),v=r&&r[f+1];v&&(y=y.replaceChild(0,v.type.create(v.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(y))return!1}let c=s.indexAfter(a),u=r&&r[0];return s.node(a).canReplaceWith(c,c,u?u.type:s.node(a+1).type)}function cO(t,e,n=1,r){let s=t.doc.resolve(e),a=pe.empty,o=pe.empty;for(let c=s.depth,u=s.depth-n,h=n-1;c>u;c--,h--){a=pe.from(s.node(c).copy(a));let f=r&&r[h];o=pe.from(f?f.type.create(f.attrs,o):s.node(c).copy(o))}t.step(new wn(e,e,new Me(a.append(o),n,n),!0))}function oa(t,e){let n=t.resolve(e),r=n.index();return Jk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function dO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s0?(a=r.node(s+1),c++,o=r.node(s).maybeChild(c)):(a=r.node(s).maybeChild(c-1),o=r.node(s+1)),a&&!a.isTextblock&&Jk(a,o)&&r.node(s).canReplace(c,c+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function uO(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,a=t.doc.resolve(e-n),o=a.node().type;if(s&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(s);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);Gk(t,f.node(),f.before(),c)}o.inlineContent&&Hx(t,e+n-1,o,a.node().contentMatchAt(a.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new wn(h,u.map(e+n,-1),Me.empty,!0)),r===!0){let f=t.doc.resolve(h);qk(t,f.node(),f.before(),t.steps.length)}return t}function hO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let a=r.index(s);if(r.node(s).canReplaceWith(a,a,n))return r.before(s+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>0?1:0),h=r.node(o),f=!1;if(a==1)f=h.canReplace(u,u,s);else{let m=h.contentMatchAt(u).findWrapping(s.firstChild.type);f=m&&h.canReplaceWith(u,u,m[0])}if(f)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function rf(t,e,n=e,r=Me.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),a=t.resolve(n);return Qk(s,a,r)?new wn(e,n,r):new fO(s,a,r).fit()}function Qk(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class fO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=pe.empty;for(let s=0;s<=e.depth;s++){let a=e.node(s);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=pe.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let a=this.placed,o=r.depth,c=s.depth;for(;o&&c&&a.childCount==1;)a=a.firstChild.content,o--,c--;let u=new Me(a,o,c);return e>-1?new Nn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new wn(r.pos,s.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r1&&(s=0),a.type.spec.isolating&&s<=r){e=r;break}n=a.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,a=null;r?(a=Rm(this.unplaced.content,r-1).firstChild,s=a.content):s=this.unplaced.content;let o=s.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(pe.from(o),!1)):a&&u.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:c,parent:a,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:a,wrap:f};if(a&&h.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Rm(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new Me(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Rm(e,n);if(s.childCount<=1&&n>0){let a=e.size-n<=n+s.size;this.unplaced=new Me(rc(e,n-1,1),n-1,a?n-1:r)}else this.unplaced=new Me(rc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let j=0;j1||u==0||j.content.size)&&(m=w,f.push(Xk(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?y:-1)))}let v=h==c.childCount;v||(y=-1),this.placed=sc(this.placed,n,pe.from(f)),this.frontier[n].match=m,v&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,w=c;j1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],a=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Im(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=sc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),a=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,a)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=sc(this.placed,this.depth,pe.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(pe.empty,!0);n.childCount&&(this.placed=sc(this.placed,this.frontier.length,n))}}function rc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(rc(t.firstChild.content,e-1,n)))}function sc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(sc(t.lastChild.content,e-1,n)))}function Rm(t,e){for(let n=0;n1&&(r=r.replaceChild(0,Xk(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(pe.empty,!0)))),t.copy(r)}function Im(t,e,n,r,s){let a=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let c=r.fillBefore(a.content,!0,o);return c&&!pO(n,a.content,o)?c:null}function pO(t,e,n){for(let r=n;r0;g--,y--){let v=s.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(g)>-1?c=g:s.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,y=0;;y++){let v=g.firstChild;if(h.push(v),y==r.openStart)break;g=v.content}for(let g=f-1;g>=0;g--){let y=h[g],v=mO(y.type);if(v&&!y.sameMarkup(s.node(Math.abs(c)-1)))f=g;else if(v||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),v=h[y];if(v)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=s.before(y),n=a.after(y))}}function Zk(t,e,n,r,s){if(er){let a=s.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(pe.empty,!0))}return t}function xO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=hO(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new Me(pe.from(r),0,0))}function yO(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),a=eS(r,s);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),s.indexAfter(c-1))))return t.delete(r.before(c),s.after(c))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function eS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let a=t.start(s);if(ae.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(a==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==a-1)&&n.push(s)}return n}class Ko extends Un{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return on.fail("No node at attribute step's position");let r=Object.create(null);for(let a in n.attrs)r[a]=n.attrs[a];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return on.fromReplace(e,this.pos,this.pos+1,new Me(pe.from(s),0,n.isLeaf?0:1))}getMap(){return Nr.empty}invert(e){return new Ko(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ko(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ko(n.pos,n.attr,n.value)}}Un.jsonID("attr",Ko);class Ac extends Un{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return on.ok(r)}getMap(){return Nr.empty}invert(e){return new Ac(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ac(n.attr,n.value)}}Un.jsonID("docAttr",Ac);let Xo=class extends Error{};Xo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Xo.prototype=Object.create(Error.prototype);Xo.prototype.constructor=Xo;Xo.prototype.name="TransformError";class Ux{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Mc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Xo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Me.empty){let s=rf(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new Me(pe.from(r),0,0))}delete(e,n){return this.replace(e,n,Me.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return gO(this,e,n,r),this}replaceRangeWith(e,n,r){return xO(this,e,n,r),this}deleteRange(e,n){return yO(this,e,n),this}lift(e,n){return nO(this,e,n),this}join(e,n=1){return uO(this,e,n),this}wrap(e,n){return iO(this,e,n),this}setBlockType(e,n=e,r,s=null){return aO(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return lO(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Ko(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ac(e,n)),this}addNodeMark(e,n){return this.step(new Hi(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof jt)n.isInSet(r.marks)&&this.step(new Ua(e,n));else{let s=r.marks,a,o=[];for(;a=n.isInSet(s);)o.push(new Ua(e,a)),s=a.removeFromSet(s);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return cO(this,e,n,r),this}addMark(e,n,r){return ZP(this,e,n,r),this}removeMark(e,n,r){return eO(this,e,n,r),this}clearIncompatible(e,n,r){return Hx(this,e,n,r),this}}const Pm=Object.create(null);class Ge{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new tS(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;a--){let o=n<0?Lo(e.node(0),e.node(a),e.before(a+1),e.index(a),n,r):Lo(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new kr(e.node(0))}static atStart(e){return Lo(e,e,0,0,1)||new kr(e)}static atEnd(e){return Lo(e,e,e.content.size,e.childCount,-1)||new kr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Pm[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Pm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return He.between(this.$anchor,this.$head).getBookmark()}}Ge.prototype.visible=!0;class tS{constructor(e,n){this.$from=e,this.$to=n}}let f1=!1;function p1(t){!f1&&!t.parent.inlineContent&&(f1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class He extends Ge{constructor(e,n=e){p1(e),p1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ge.near(r);let s=e.resolve(n.map(this.anchor));return new He(s.parent.inlineContent?s:r,r)}replace(e,n=Me.empty){if(super.replace(e,n),n==Me.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof He&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new sf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new He(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let a=Ge.findFrom(n,r,!0)||Ge.findFrom(n,-r,!0);if(a)n=a.$head;else return Ge.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Ge.findFrom(e,-r,!0)||Ge.findFrom(e,r,!0)).$anchor,e.pos0?0:1);s>0?o=0;o+=s){let c=e.child(o);if(c.isAtom){if(!a&&Ve.isSelectable(c))return Ve.create(t,n-(s<0?c.nodeSize:0))}else{let u=Lo(t,c,n+s,s<0?c.childCount:0,s,a);if(u)return u}n+=c.nodeSize*s}return null}function m1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(Ge.near(t.doc.resolve(o),n))}const g1=1,xu=2,x1=4;class bO extends Ux{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xu,this}ensureMarks(e){return jt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&xu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~xu,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||jt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let a=this.storedMarks;if(!a){let o=this.doc.resolve(n);a=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ge.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=x1,this}get scrolledIntoView(){return(this.updated&x1)>0}}function y1(t,e){return!e||!t?t:t.bind(e)}class ic{constructor(e,n,r){this.name=e,this.init=y1(n.init,r),this.apply=y1(n.apply,r)}}const wO=[new ic("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ic("selection",{init(t,e){return t.selection||Ge.atStart(e.doc)},apply(t){return t.selection}}),new ic("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ic("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Om{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ic(r.key,r.spec.state,r))})}}class Wo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],a=s.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Om(e.schema,e.plugins),a=new Wo(s);return s.fields.forEach(o=>{if(o.name=="doc")a.doc=Js.fromJSON(e.schema,n.doc);else if(o.name=="selection")a.selection=Ge.fromJSON(a.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){a[o.name]=h.fromJSON.call(u,e,n[c],a);return}}a[o.name]=o.init(e,a)}}),a}}function nS(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=nS(s,e,{})),n[r]=s}return n}class Ct{constructor(e){this.spec=e,this.props={},e.props&&nS(e.props,this,this.props),this.key=e.key?e.key.key:rS("plugin")}getState(e){return e[this.key]}}const Dm=Object.create(null);function rS(t){return t in Dm?t+"$"+ ++Dm[t]:(Dm[t]=0,t+"$")}class _t{constructor(e="key"){this.key=rS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qx=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function sS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const iS=(t,e,n)=>{let r=sS(t,n);if(!r)return!1;let s=Gx(r);if(!s){let o=r.blockRange(),c=o&&fl(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let a=s.nodeBefore;if(pS(t,s,e,-1))return!0;if(r.parent.content.size==0&&(Zo(a,"end")||Ve.isSelectable(a)))for(let o=r.depth;;o--){let c=rf(t.doc,r.before(o),r.after(o),Me.empty);if(c&&c.slice.size1)break}return a.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-a.nodeSize,s.pos).scrollIntoView()),!0):!1},NO=(t,e,n)=>{let r=sS(t,n);if(!r)return!1;let s=Gx(r);return s?aS(t,s,e):!1},jO=(t,e,n)=>{let r=lS(t,n);if(!r)return!1;let s=Jx(r);return s?aS(t,s,e):!1};function aS(t,e,n){let r=e.nodeBefore,s=r,a=e.pos-1;for(;!s.isTextblock;a--){if(s.type.spec.isolating)return!1;let f=s.lastChild;if(!f)return!1;s=f}let o=e.nodeAfter,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let f=c.firstChild;if(!f)return!1;c=f}let h=rf(t.doc,a,u,Me.empty);if(!h||h.from!=a||h instanceof wn&&h.slice.size>=u-a)return!1;if(n){let f=t.tr.step(h);f.setSelection(He.create(f.doc,a)),n(f.scrollIntoView())}return!0}function Zo(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const oS=(t,e,n)=>{let{$head:r,empty:s}=t.selection,a=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=Gx(r)}let o=a&&a.nodeBefore;return!o||!Ve.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ve.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Gx(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function lS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=lS(t,n);if(!r)return!1;let s=Jx(r);if(!s)return!1;let a=s.nodeAfter;if(pS(t,s,e,1))return!0;if(r.parent.content.size==0&&(Zo(a,"start")||Ve.isSelectable(a))){let o=rf(t.doc,r.before(),r.after(),Me.empty);if(o&&o.slice.size{let{$head:r,empty:s}=t.selection,a=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Ve,s;if(r){if(n.node.isTextblock||!oa(t.doc,n.from))return!1;s=n.from}else if(s=nf(t.doc,n.from,-1),s==null)return!1;if(e){let a=t.tr.join(s);r&&a.setSelection(Ve.create(a.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},SO=(t,e)=>{let n=t.selection,r;if(n instanceof Ve){if(n.node.isTextblock||!oa(t.doc,n.to))return!1;r=n.to}else if(r=nf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},CO=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),a=s&&fl(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)},uS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` -`).scrollIntoView()),!0)};function Yx(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),a=n.indexAfter(-1),o=Yx(s.contentMatchAt(a));if(!o||!s.canReplaceWith(a,a,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(Ge.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},hS=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof kr||r.parent.inlineContent||s.parent.inlineContent)return!1;let a=Yx(s.parent.contentMatchAt(s.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(Ys(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),s=r&&fl(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function TO(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof Ve&&e.selection.node.isBlock)return!r.parentOffset||!Ys(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=Yx(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),a.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;a.unshift(null)}let f=e.tr;(e.selection instanceof He||e.selection instanceof kr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Ys(f.doc,m,a.length,a);if(g||(a[0]=c?{type:c}:null,g=Ys(f.doc,m,a.length,a)),!g)return!1;if(f.split(m,a.length,a),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),v=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const MO=TO(),AO=(t,e)=>{let{$from:n,to:r}=t.selection,s,a=n.sharedDepth(r);return a==0?!1:(s=n.before(a),e&&e(t.tr.setSelection(Ve.create(t.doc,s))),!0)};function RO(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,a=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(a-1,a)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(s.isTextblock||oa(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function pS(t,e,n,r){let s=e.nodeBefore,a=e.nodeAfter,o,c,u=s.type.spec.isolating||a.type.spec.isolating;if(!u&&RO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&c.matchType(o[0]||a.type).validEnd){if(n){let y=e.pos+a.nodeSize,v=pe.empty;for(let k=o.length-1;k>=0;k--)v=pe.from(o[k].create(null,v));v=pe.from(s.copy(v));let j=t.tr.step(new Nn(e.pos-1,y,e.pos,y,new Me(v,1,0),o.length,!0)),w=j.doc.resolve(y+2*o.length);w.nodeAfter&&w.nodeAfter.type==s.type&&oa(j.doc,w.pos)&&j.join(w.pos),n(j.scrollIntoView())}return!0}let f=a.type.spec.isolating||r>0&&u?null:Ge.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&fl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Zo(a,"start",!0)&&Zo(s,"end")){let y=s,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let j=a,w=1;for(;!j.isTextblock;j=j.firstChild)w++;if(y.canReplace(y.childCount,y.childCount,j.content)){if(n){let k=pe.empty;for(let C=v.length-1;C>=0;C--)k=pe.from(v[C].copy(k));let E=t.tr.step(new Nn(e.pos-v.length,e.pos+a.nodeSize,e.pos+w,e.pos+a.nodeSize-w,new Me(k,v.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function mS(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,a=s.depth;for(;s.node(a).isInline;){if(!a)return!1;a--}return s.node(a).isTextblock?(n&&n(e.tr.setSelection(He.create(e.doc,t<0?s.start(a):s.end(a)))),!0):!1}}const IO=mS(-1),PO=mS(1);function OO(t,e=null){return function(n,r){let{$from:s,$to:a}=n.selection,o=s.blockRange(a),c=o&&Wx(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function v1(t,e=null){return function(n,r){let s=!1;for(let a=0;a{if(s)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)s=!0;else{let f=n.doc.resolve(h),m=f.index();s=f.parent.canReplaceWith(m,m+1,t)}})}if(!s)return!1;if(r){let a=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);a=new Zu(u,u,e.depth),e.endIndex=0;f--)a=pe.from(n[f].type.create(n[f].attrs,a));t.step(new Nn(e.start-(r?2:0),e.end,e.start,e.end,new Me(a,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return a?n?r.node(a.depth-1).type==t?$O(e,n,t,a):FO(e,n,a):!0:!1}}function $O(t,e,n,r){let s=t.tr,a=r.end,o=r.$to.end(r.depth);aj;v--)y-=s.child(v).nodeSize,r.delete(y-1,y+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==s.childCount,h=a.node(-1),f=a.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?pe.empty:pe.from(s))))return!1;let m=a.pos,g=m+o.nodeSize;return r.step(new Nn(m-(c?1:0),g+(u?1:0),m+1,g-1,new Me((c?pe.empty:pe.from(s.copy(pe.empty))).append(u?pe.empty:pe.from(s.copy(pe.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function BO(t){return function(e,n){let{$from:r,$to:s}=e.selection,a=r.blockRange(s,h=>h.childCount>0&&h.firstChild.type==t);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let c=a.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=pe.from(h?t.create():null),m=new Me(pe.from(t.create(null,pe.from(c.type.create(null,f)))),h?3:1,0),g=a.start,y=a.end;n(e.tr.step(new Nn(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const An=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},el=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Pg=null;const Ks=function(t,e,n){let r=Pg||(Pg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},VO=function(){Pg=null},Ka=function(t,e,n,r){return n&&(b1(t,e,n,r,-1)||b1(t,e,n,r,1))},HO=/^(img|br|input|textarea|hr)$/i;function b1(t,e,n,r,s){for(var a;;){if(t==n&&e==r)return!0;if(e==(s<0?0:_r(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Uc(t)||HO.test(t.nodeName)||t.contentEditable=="false")return!1;e=An(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?_r(t):0}else return!1}}function _r(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function WO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=_r(t)}else if(t.parentNode&&!Uc(t))e=An(t),t=t.parentNode;else return null}}function UO(t,e){for(;;){if(t.nodeType==3&&e2),Lr=tl||(ks?/Mac/.test(ks.platform):!1),yS=ks?/Win/.test(ks.platform):!1,Gs=/Android \d/.test(la),Kc=!!w1&&"webkitFontSmoothing"in w1.documentElement.style,JO=Kc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function YO(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Bs(t,e){return typeof t=="number"?t:t[e]}function QO(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function N1(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=el(o);continue}let c=o,u=c==a.body,h=u?YO(a):QO(c),f=0,m=0;if(e.toph.bottom-Bs(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+Bs(s,"top")-h.top:e.bottom-h.bottom+Bs(s,"bottom")),e.lefth.right-Bs(r,"right")&&(f=e.right-h.right+Bs(s,"right")),f||m)if(u)a.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-y,w=c.scrollTop-v;e={left:e.left-j,top:e.top-w,right:e.right-j,bottom:e.bottom-w}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:el(o)}}function XO(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let a=(e.left+e.right)/2,o=n+1;o=n-20){r=c,s=u.top;break}}return{refDOM:r,refTop:s,stack:vS(t.dom)}}function vS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=el(r));return e}function ZO({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;bS(n,r==0?0:r-e)}function bS(t,e){for(let n=0;n=c){o=Math.max(v.bottom,o),c=Math.min(v.top,c);let j=v.left>e.left?v.left-e.left:v.right=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=f,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(a=m+1)}}return!n&&u&&(n=u,s=h,r=0),n&&n.nodeType==3?tD(n,s):!n||r&&n.nodeType==1?{node:t,offset:a}:wS(n,s)}function tD(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Xx(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function nD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,a)}function sD(t,e,n,r){let s=-1;for(let a=e,o=!1;a!=t.dom;){let c=t.docView.nearestDesc(a,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?s=c.posBefore:(!o&&u.right-1?s:t.docView.posFromDOM(e,n,-1)}function NS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&s++}let h;Kc&&s&&r.nodeType==1&&(h=r.childNodes[s-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(c=sD(t,r,s,e))}c==null&&(c=rD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function j1(t){return t.top=0&&s==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Ql(Ii(Ks(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&s&&(n<0||s==_r(r))){let u=r.childNodes[s-1];if(u.nodeType==1)return Lm(u.getBoundingClientRect(),!1)}if(a==null&&s<_r(r)){let u=r.childNodes[s];if(u.nodeType==1)return Lm(u.getBoundingClientRect(),!0)}return Lm(r.getBoundingClientRect(),n>=0)}if(a==null&&s&&(n<0||s==_r(r))){let u=r.childNodes[s-1],h=u.nodeType==3?Ks(u,_r(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Ql(Ii(h,1),!1)}if(a==null&&s<_r(r)){let u=r.childNodes[s];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let h=u?u.nodeType==3?Ks(u,0,o?0:1):u.nodeType==1?u:null:null;if(h)return Ql(Ii(h,-1),!0)}return Ql(Ii(r.nodeType==3?Ks(r):r,-n),n>=0)}function Ql(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Lm(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function kS(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function oD(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return kS(t,e,()=>{let{node:a}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(a,!0);if(!c)break;if(c.node.isBlock){a=c.contentDOM||c.dom;break}a=c.dom.parentNode}let o=jS(t,s.pos,1);for(let c=a.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Ks(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const lD=/[\u0590-\u08ac]/;function cD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,a=!s,o=s==r.parent.content.size,c=t.domSelection();return c?!lD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?a:o:kS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:j}=t.domSelectionRange(),w=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),w}):r.pos==r.start()||r.pos==r.end()}let k1=null,S1=null,C1=!1;function dD(t,e,n){return k1==e&&S1==n?C1:(k1=e,S1=n,C1=n=="up"||n=="down"?oD(t,e,n):cD(t,e,n))}const Fr=0,E1=1,Ra=2,Ss=3;class qc{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Fr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nAn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){s=!1;break}if(a.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){s=!0;break}if(a.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let a=this.getDesc(s),o;if(a&&(!n||a.node))if(r&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return a}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let a=this.getDesc(s);if(a)return a.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof CS){s=e-a;break}a=c}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof SS&&a.side>=0;r--);if(n<=0){let a,o=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,o=!1);return a&&n&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?An(a.dom)+1:0}}else{let a,o=!0;for(;a=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){s=An(g.dom)+1;break}e-=g.size}s==-1&&(s=0)}if(s>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fv&&on){let v=c;c=u,u=v}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s=r:er){let c=r+a.border,u=o-a.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?Ra:E1,e==c&&n==u&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=Ss:a.markDirty(e-c,n-c);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Ra:Ss}r=o}this.dirty=Ra}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ra:E1;n.dirty{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,a=this}matchesWidget(e){return this.dirty==Fr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class uD extends qc{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class qa extends qc{constructor(e,n,r,s,a){super(e,[],r,s),this.mark=n,this.spec=a}static create(e,n,r,s){let a=s.nodeViews[n.type.name],o=a&&a(n,s,r);return(!o||!o.dom)&&(o=eo.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new qa(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ss||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ss&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Fr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=zg(a,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,s),f=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:m}=eo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=MS(f,r,n),h?u=new hD(e,n,r,s,f,m||null,g,h,a,o+1):n.isText?new of(e,n,r,s,f,g,a):new Yi(e,n,r,s,f,m||null,g,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>pe.empty)}return e}matchesNode(e,n,r){return this.dirty==Fr&&e.eq(this.node)&&th(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,a=e.composing?this.localCompositionInfo(e,n):null,o=a&&a.pos>-1?a:null,c=a&&a.pos<0,u=new pD(this,o&&o.node,e);xD(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?jt.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,s)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>s&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,s)||u.addNode(h,f,m,e,s),s+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Ra)&&(o&&this.protectLocalComposition(e,o),ES(this.contentDOM,this.children,e),tl&&yD(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof He)||rn+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,c=vD(this.node.content,o,r-n,s-n);return c<0?null:{node:a,pos:c,text:o}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new uD(this,a,n,s);e.input.compositionNodes.push(o),this.children=zg(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Ss||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Fr}updateOuterDeco(e){if(th(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=TS(this.dom,this.nodeDOM,_g(this.outerDeco,this.node,n),_g(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function T1(t,e,n,r,s){MS(r,e,t);let a=new Yi(void 0,t,e,n,r,r,r,s,0);return a.contentDOM&&a.updateChildren(s,0),a}class of extends Yi{constructor(e,n,r,s,a,o,c){super(e,n,r,s,a,null,o,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==Ss||this.dirty!=Fr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Fr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Fr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),a=document.createTextNode(s.text);return new of(this.parent,s,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ss)}get domAtom(){return!1}isText(e){return this.node.text==e}}class CS extends qc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Fr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class hD extends Yi{constructor(e,n,r,s,a,o,c,u,h,f){super(e,n,r,s,a,o,c,h,f),this.spec=u}update(e,n,r,s){if(this.dirty==Ss)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,n,r);return a&&this.updateInner(e,n,r,s),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ES(t,e,n){let r=t.firstChild,s=!1;for(let a=0;a>1,c=Math.min(o,e.length);for(;a-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=qa.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let a=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))a=this.top.children.indexOf(o,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof qa)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(s-1))break;--s,a.set(c,s),o.push(c)}}return{index:s,matched:a,matches:o.reverse()}}function gD(t,e){return t.type.side-e.type.side}function xD(t,e,n,r){let s=e.locals(t),a=0;if(s.length==0){for(let h=0;ha;)c.push(s[o++]);let v=a+g.nodeSize;if(g.isText){let w=v;o!w.inline):c.slice();r(g,j,e.forChild(a,g),y),a=v}}function yD(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function vD(t,e,n,r){for(let s=0,a=0;s=n){if(a>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function zg(t,e,n,r,s){let a=[];for(let o=0,c=0;o=n||f<=e?a.push(u):(hn&&a.push(u.slice(n-h,u.size,r)))}return a}function Zx(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),a=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(af(n)){for(u=o;s&&!s.node;)s=s.parent;let m=s.node;if(s&&m.isAtom&&Ve.isSelectable(m)&&s.parent&&!(m.isInline&&KO(n.focusNode,n.focusOffset,s.dom))){let g=s.posBefore;h=new Ve(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!AS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function wD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,An(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ur&&Ji<=11&&(n.disabled=!0,n.disabled=!1)}function RS(t,e){if(e instanceof Ve){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(P1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else P1(t)}function P1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function e0(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||He.between(e,n,r)}function O1(t){return t.editable&&!t.hasFocus()?!1:IS(t)}function IS(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function ND(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ka(e.node,e.offset,n.anchorNode,n.anchorOffset)}function $g(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),a=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return a&&Ge.findFrom(a,e)}function Pi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function D1(t,e,n){let r=t.state.selection;if(r instanceof He)if(n.indexOf("s")>-1){let{$head:s}=r,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+a.nodeSize*(e<0?-1:1));return Pi(t,new He(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=$g(t.state,e);return s&&s instanceof Ve?Pi(t,s):!1}else if(!(Lr&&n.indexOf("m")>-1)){let s=r.$head,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!a||a.isText)return!1;let c=e<0?s.pos-a.nodeSize:s.pos;return a.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ve.isSelectable(a)?Pi(t,new Ve(e<0?t.state.doc.resolve(s.pos-a.nodeSize):s)):Kc?Pi(t,new He(t.state.doc.resolve(e<0?c:c+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ve&&r.node.isInline)return Pi(t,new He(e>0?r.$to:r.$from));{let s=$g(t.state,e);return s?Pi(t,s):!1}}}function nh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function pc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Do(t,e){return e<0?jD(t):kD(t)}function jD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,a,o=!1;for($r&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(pc(c,-1))s=n,a=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(PS(n))break;{let c=n.previousSibling;for(;c&&pc(c,-1);)s=n.parentNode,a=An(c),c=c.previousSibling;if(c)n=c,r=nh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Fg(t,n,r):s&&Fg(t,s,a)}function kD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=nh(n),a,o;for(;;)if(r{t.state==s&&Qs(t)},50)}function L1(t,e){let n=t.state.doc.resolve(e);if(!(In||yS)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>s.top&&o1)return a.lefts.top&&o1)return a.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function _1(t,e,n){let r=t.state.selection;if(r instanceof He&&!r.empty||n.indexOf("s")>-1||Lr&&n.indexOf("m")>-1)return!1;let{$from:s,$to:a}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=$g(t.state,e);if(o&&o instanceof Ve)return Pi(t,o)}if(!s.parent.inlineContent){let o=e<0?s:a,c=r instanceof kr?Ge.near(o,e):Ge.findFrom(o,e);return c?Pi(t,c):!1}return!1}function z1(t,e){if(!(t.state.selection instanceof He))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let o=t.state.tr;return e<0?o.delete(n.pos-a.nodeSize,n.pos):o.delete(n.pos,n.pos+a.nodeSize),t.dispatch(o),!0}return!1}function $1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function ED(t){if(!Hn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;$1(t,r,"true"),setTimeout(()=>$1(t,r,"false"),20)}return!1}function TD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function MD(t,e){let n=e.keyCode,r=TD(e);if(n==8||Lr&&n==72&&r=="c")return z1(t,-1)||Do(t,-1);if(n==46&&!e.shiftKey||Lr&&n==68&&r=="c")return z1(t,1)||Do(t,1);if(n==13||n==27)return!0;if(n==37||Lr&&n==66&&r=="c"){let s=n==37?L1(t,t.state.selection.from)=="ltr"?-1:1:-1;return D1(t,s,r)||Do(t,s)}else if(n==39||Lr&&n==70&&r=="c"){let s=n==39?L1(t,t.state.selection.from)=="ltr"?1:-1:1;return D1(t,s,r)||Do(t,s)}else{if(n==38||Lr&&n==80&&r=="c")return _1(t,-1,r)||Do(t,-1);if(n==40||Lr&&n==78&&r=="c")return ED(t)||_1(t,1,r)||Do(t,1);if(r==(Lr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function t0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:s,openEnd:a}=e;for(;s>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,a--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||eo.fromSchema(t.state.schema),c=$S(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=zS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let v=c.createElement(f[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${s} ${a}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` - -`);return{dom:u,text:g,slice:e}}function OS(t,e,n,r,s){let a=s.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||a||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,a||r,t)}),a)return c=new Me(pe.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,s,r,t));if(m)c=m;else{let g=s.marks(),{schema:y}=t.state,v=eo.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let w=o.appendChild(document.createElement("p"));j&&w.appendChild(v.serializeNode(y.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=PD(n),Kc&&OD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Gi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:s,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!AD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=DD(F1(c,+f[1],+f[2]),f[4]);else if(c=Me.maxOpen(RD(c.content,s),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const AD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function RD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),a,o=[];if(t.forEach(c=>{if(!o)return;let u=s.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&a.length&&LS(u,a,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=_S(o[o.length-1],a.length));let f=DS(c,u);o.push(f),s=s.matchType(f.type),a=u}}),o)return pe.from(o)}return t}function DS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,pe.from(t));return t}function LS(t,e,n,r,s){if(s1&&(a=0),s=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,a<=s).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(pe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function F1(t,e,n){return en})),zm.createHTML(t)):t}function PD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=$S().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&zS[r[1].toLowerCase()])&&(t=s.map(a=>"<"+a+">").join("")+t+s.map(a=>"").reverse().join("")),n.innerHTML=ID(t),s)for(let a=0;a=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;s=pe.from(u.create(r[c+1],s)),a++,o++}return new Me(s,a,o)}const tr={},nr={},LD={touchstart:!0,touchmove:!0};class _D{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function zD(t){for(let e in tr){let n=tr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{FD(t,r)&&!n0(t,r)&&(t.editable||!(r.type in nr))&&n(t,r)},LD[e]?{passive:!0}:void 0)}Hn&&t.dom.addEventListener("input",()=>null),Vg(t)}function Wi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function $D(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Vg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>n0(t,r))})}function n0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function FD(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function BD(t,e){!n0(t,e)&&tr[e.type]&&(t.editable||!(e.type in nr))&&tr[e.type](t,e)}nr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!BS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Gs&&In&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),tl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Aa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||MD(t,n)?n.preventDefault():Wi(t,"key")};nr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};nr.keypress=(t,e)=>{let n=e;if(BS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lr&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof He)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,a))&&t.dispatch(a()),n.preventDefault()}};function lf(t){return{left:t.clientX,top:t.clientY}}function VD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function r0(t,e,n,r,s){if(r==-1)return!1;let a=t.state.doc.resolve(r);for(let o=a.depth+1;o>0;o--)if(t.someProp(e,c=>o>a.depth?c(t,n,a.nodeAfter,a.before(o),s,!0):c(t,n,a.node(o),a.before(o),s,!1)))return!0;return!1}function qo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function HD(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ve.isSelectable(r)?(qo(t,new Ve(n)),!0):!1}function WD(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Ve&&(r=n.node);let a=t.state.doc.resolve(e);for(let o=a.depth+1;o>0;o--){let c=o>a.depth?a.nodeAfter:a.node(o);if(Ve.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?s=a.before(n.$from.depth):s=a.before(o);break}}return s!=null?(qo(t,Ve.create(t.state.doc,s)),!0):!1}function UD(t,e,n,r,s){return r0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",a=>a(t,e,r))||(s?WD(t,n):HD(t,n))}function KD(t,e,n,r){return r0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function qD(t,e,n,r){return r0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||GD(t,n,r)}function GD(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(qo(t,He.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let a=s.depth+1;a>0;a--){let o=a>s.depth?s.nodeAfter:s.node(a),c=s.before(a);if(o.inlineContent)qo(t,He.create(r,c+1,c+1+o.content.size));else if(Ve.isSelectable(o))qo(t,Ve.create(r,c));else continue;return!0}}function s0(t){return rh(t)}const FS=Lr?"metaKey":"ctrlKey";tr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=s0(t),s=Date.now(),a="singleClick";s-t.input.lastClick.time<500&&VD(n,t.input.lastClick)&&!n[FS]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=t.posAtCoords(lf(n));o&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new JD(t,o,n,!!r)):(a=="doubleClick"?KD:qD)(t,o.pos,o.inside,n)?n.preventDefault():Wi(t,"pointer"))};class JD{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[FS],this.allowDefault=r.shiftKey;let a,o;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);a=f.parent,o=f.depth?f.before():0}const c=s?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||h instanceof Ve&&h.from<=o&&h.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$r&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wi(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Qs(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(lf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Wi(this.view,"pointer"):UD(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Hn&&this.mightDrag&&!this.mightDrag.node.isAtom||In&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(qo(this.view,Ge.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Wi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wi(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}tr.touchstart=t=>{t.input.lastTouch=Date.now(),s0(t),Wi(t,"pointer")};tr.touchmove=t=>{t.input.lastTouch=Date.now(),Wi(t,"pointer")};tr.contextmenu=t=>s0(t);function BS(t,e){return t.composing?!0:Hn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const YD=Gs?5e3:-1;nr.compositionstart=nr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof He&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||In&&yS&&QD(t)))t.markCursor=t.state.storedMarks||n.marks(),rh(t,!0),t.markCursor=null;else if(rh(t,!e.selection.empty),$r&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,a=r.focusOffset;s&&s.nodeType==1&&a!=0;){let o=a<0?s.lastChild:s.childNodes[a-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else s=o,a=-1}}t.input.composing=!0}VS(t,YD)};function QD(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}nr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,VS(t,20))};function VS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>rh(t),e))}function HS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=ZD());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function XD(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=WO(e.focusNode,e.focusOffset),r=UO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function ZD(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function rh(t,e=!1){if(!(Gs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),HS(t),e||t.docView&&t.docView.dirty){let n=Zx(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function eL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Rc=ur&&Ji<15||tl&&JO<604;tr.copy=nr.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let a=Rc?null:n.clipboardData,o=r.content(),{dom:c,text:u}=t0(t,o);a?(n.preventDefault(),a.clearData(),a.setData("text/html",c.innerHTML),a.setData("text/plain",u)):eL(t,c),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function tL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function nL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ic(t,r.value,null,s,e):Ic(t,r.textContent,r.innerHTML,s,e)},50)}function Ic(t,e,n,r,s){let a=OS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,s,a||Me.empty)))return!0;if(!a)return!1;let o=tL(a),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(a);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function WS(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}nr.paste=(t,e)=>{let n=e;if(t.composing&&!Gs)return;let r=Rc?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ic(t,WS(r),r.getData("text/html"),s,n)?n.preventDefault():nL(t,n)};class US{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const rL=Lr?"altKey":"ctrlKey";function KS(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[rL]}tr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,a=s.empty?null:t.posAtCoords(lf(n)),o;if(!(a&&a.pos>=s.from&&a.pos<=(s instanceof Ve?s.to-1:s.to))){if(r&&r.mightDrag)o=Ve.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Ve.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=t0(t,c);(!n.dataTransfer.files.length||!In||xS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Rc?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Rc||n.dataTransfer.setData("text/plain",h),t.dragging=new US(f,KS(t,n),o)};tr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};nr.dragover=nr.dragenter=(t,e)=>e.preventDefault();nr.drop=(t,e)=>{try{sL(t,e,t.dragging)}finally{t.dragging=null}};function sL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(lf(e));if(!r)return;let s=t.state.doc.resolve(r.pos),a=n&&n.slice;a?t.someProp("transformPasted",y=>{a=y(a,t,!1)}):a=OS(t,WS(e.dataTransfer),Rc?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&KS(t,e));if(t.someProp("handleDrop",y=>y(t,e,a||Me.empty,o))){e.preventDefault();return}if(!a)return;e.preventDefault();let c=a?Yk(t.state.doc,s.pos,a):s.pos;c==null&&(c=s.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,a.content.firstChild):u.replaceRange(h,h,a),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&Ve.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))u.setSelection(new Ve(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,j,w,k)=>y=k),u.setSelection(e0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}tr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Qs(t)},20))};tr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};tr.beforeinput=(t,e)=>{if(In&&Gs&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,Aa(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in nr)tr[t]=nr[t];function Pc(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class sh{constructor(e,n){this.toDOM=e,this.spec=n||$a,this.side=this.spec.side||0}map(e,n,r,s){let{pos:a,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new hn(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof sh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pc(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Qi{constructor(e,n){this.attrs=e,this.spec=n||$a}map(e,n,r,s){let a=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new hn(a,o,this)}valid(e,n){return n.from=e&&(!a||a(c.spec))&&r.push(c.copy(c.from+s,c.to+s))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,s+c,a)}}map(e,n,r){return this==Bn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||$a)}mapInner(e,n,r,s,a){let o;for(let c=0;c{let h=u+r,f;if(f=GS(n,c,h)){for(s||(s=this.children.slice());ac&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let a=e+1,o=a+n.content.size;for(let c=0;ca&&u.type instanceof Qi){let h=Math.max(a,u.from)-a,f=Math.min(o,u.to)-a;hs.map(e,n,$a));return Li.from(r)}forChild(e,n){if(n.isLeaf)return Nt.empty;let r=[];for(let s=0;sn instanceof Nt)?e:e.reduce((n,r)=>n.concat(r instanceof Nt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let w=j-v-(y-g);for(let k=0;kE+f-m)continue;let C=c[k]+f-m;y>=C?c[k+1]=g<=C?-2:-1:g>=f&&w&&(c[k]+=w,c[k+1]+=w)}m+=w}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+a,-1),y=g-s,{index:v,offset:j}=r.content.findIndex(m),w=r.maybeChild(v);if(w&&j==m&&j+w.nodeSize==y){let k=c[h+2].mapInner(n,w,f+1,t[h]+a+1,o);k!=Bn?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=aL(c,t,e,n,s,a,o),f=ih(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=GS(t,c,u+n);if(h){a=!0;let f=ih(h,c,n+u+1,r);f!=Bn&&s.push(u,u+c.nodeSize,f)}});let o=qS(a?JS(t):t,-n).sort(Fa);for(let c=0;c0;)e++;t.splice(e,0,n)}function $m(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Bn&&e.push(r)}),t.cursorWrapper&&e.push(Nt.create(t.state.doc,[t.cursorWrapper.deco])),Li.from(e)}const oL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lL=ur&&Ji<=11;class cL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class dL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;ss.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Hn&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,oL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(O1(this.view)){if(this.suppressingSelectionUpdates)return Qs(this.view);if(ur&&Ji<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ka(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let a=e.focusNode;a;a=el(a))n.add(a);for(let a=e.anchorNode;a;a=el(a))if(n.has(a)){r=a;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&O1(e)&&!this.ignoreSelectionChange(r),a=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if($r&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||fL(e,m)!=y)&&g.remove()}}}let h=null;a<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||s)&&(a>-1&&(e.docView.markDirty(a,o),uL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,pL(e,u)),this.handleDOMChange(a,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Qs(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fs;w--){let k=r.childNodes[w-1],E=k.pmViewDesc;if(k.nodeName=="BR"&&!E){a=w;break}if(!E||E.size)break}let m=t.state.doc,g=t.someProp("domParser")||Gi.fromSchema(t.state.schema),y=m.resolve(o),v=null,j=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:s,to:a,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:gL,context:y});if(h&&h[0].pos!=null){let w=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=w),v={anchor:w+o,head:k+o}}return{doc:j,sel:v,from:o,to:c}}function gL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Hn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Hn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const xL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function yL(t,e,n,r,s){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let R=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=Zx(t,R);if(I&&!t.state.selection.eq(I)){if(In&&Gs&&t.input.lastKeyCode===13&&Date.now()-100O(t,Aa(13,"Enter"))))return;let A=t.state.tr.setSelection(I);R=="pointer"?A.setMeta("pointer",!0):R=="key"&&A.scrollIntoView(),a&&A.setMeta("composition",a),t.dispatch(A)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=mL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Gs)&&s.some(R=>R.nodeType==1&&!xL.test(R.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",R=>R(t,Aa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof He&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let R=K1(t,t.state.doc,h.sel);if(R&&!R.eq(t.state.selection)){let I=t.state.tr.setSelection(R);a&&I.setMeta("composition",a),t.dispatch(I)}}return}t.state.selection.fromt.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),ur&&Ji<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let j=h.doc.resolveNoCache(v.start-h.from),w=h.doc.resolveNoCache(v.endB-h.from),k=f.resolve(v.start),E=j.sameParent(w)&&j.parent.inlineContent&&k.end()>=v.endA;if((tl&&t.input.lastIOSEnter>Date.now()-225&&(!E||s.some(R=>R.nodeName=="DIV"||R.nodeName=="P"))||!E&&j.posR(t,Aa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&bL(f,v.start,v.endA,j,w)&&t.someProp("handleKeyDown",R=>R(t,Aa(8,"Backspace")))){Gs&&In&&t.domObserver.suppressSelectionUpdates();return}In&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),Gs&&!E&&j.start()!=w.start()&&w.parentOffset==0&&j.depth==w.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,w=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(R){return R(t,Aa(13,"Enter"))})},20));let C=v.start,M=v.endA,D=R=>{let I=R||t.state.tr.replace(C,M,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let A=K1(t,I.doc,h.sel);A&&!(In&&t.composing&&A.empty&&(v.start!=v.endB||t.input.lastChromeDeleteQs(t),20));let R=D(t.state.tr.delete(C,M)),I=f.resolve(v.start).marksAcross(f.resolve(v.endA));I&&R.ensureMarks(I),t.dispatch(R)}else if(v.endA==v.endB&&(F=vL(j.parent.content.cut(j.parentOffset,w.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let R=D(t.state.tr);F.type=="add"?R.addMark(C,M,F.mark):R.removeMark(C,M,F.mark),t.dispatch(R)}else if(j.parent.child(j.index()).isText&&j.index()==w.index()-(w.textOffset?0:1)){let R=j.parent.textBetween(j.parentOffset,w.parentOffset),I=()=>D(t.state.tr.insertText(R,C,M));t.someProp("handleTextInput",A=>A(t,C,M,R,I))||t.dispatch(I())}else t.dispatch(D());else t.dispatch(D())}function K1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:e0(t,e.resolve(n.anchor),e.resolve(n.head))}function vL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,a=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(s.length==0&&a.length==1)c=a[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||Fm(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,s++}return s}function wL(t,e,n,r,s){let a=t.findDiffStart(e,n);if(a==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let u=Math.max(0,a-Math.min(o,c));r-=o+u-a}if(o=o?a-r:0;a-=u,a&&a=c?a-r:0;a-=u,a&&a=56320&&e<=57343&&n>=55296&&n<=56319}class YS{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new _D,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(X1),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Y1(this),J1(this),this.nodeViews=Q1(this),this.docView=T1(this.state.doc,G1(this),$m(this),this.dom,this),this.domObserver=new dL(this,(r,s,a,o)=>yL(this,r,s,a,o)),this.domObserver.start(),zD(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Vg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(X1),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(HS(this),o=!0),this.state=e;let c=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=Q1(this);jL(y,this.nodeViews)&&(this.nodeViews=y,a=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Vg(this),this.editable=Y1(this),J1(this);let u=$m(this),h=G1(this),f=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",m=a||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(s.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&XO(this);if(o){this.domObserver.stop();let y=m&&(ur||In)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&NL(s.selection,e.selection);if(m){let v=In?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=XD(this)),(a||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=T1(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&ND(this))?Qs(this,y):(RS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&ZO(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ve){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&N1(this,n.getBoundingClientRect(),e)}else N1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(a))==r.node&&(s=a)}this.dragging=new US(e.slice,e.move,s<0?void 0:Ve.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return iD(this,e)}coordsAtPos(e,n=1){return jS(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return dD(this,n||this.state,e)}pasteHTML(e,n){return Ic(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ic(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return t0(this,e)}destroy(){this.docView&&($D(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$m(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,VO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return BD(this,e)}domSelectionRange(){let e=this.domSelection();return e?Hn&&this.root.nodeType===11&&qO(this.dom.ownerDocument)==this.dom&&hL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}YS.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function G1(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[hn.node(0,t.state.doc.content.size,e)]}function J1(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:hn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Y1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function NL(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Q1(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function jL(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function X1(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Zi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ah={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},kL=typeof navigator<"u"&&/Mac/.test(navigator.platform),SL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Rn=0;Rn<10;Rn++)Zi[48+Rn]=Zi[96+Rn]=String(Rn);for(var Rn=1;Rn<=24;Rn++)Zi[Rn+111]="F"+Rn;for(var Rn=65;Rn<=90;Rn++)Zi[Rn]=String.fromCharCode(Rn+32),ah[Rn]=String.fromCharCode(Rn);for(var Bm in Zi)ah.hasOwnProperty(Bm)||(ah[Bm]=Zi[Bm]);function CL(t){var e=kL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||SL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ah:Zi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const EL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),TL=typeof navigator<"u"&&/Win/.test(navigator.platform);function ML(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,a,o;for(let c=0;c{for(var n in e)IL(t,n,{get:e[n],enumerable:!0})};function cf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:a}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,a=n.storedMarks,n}}}var df=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,a=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(a);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:a}=r,o=[],c=!!t,u=t||s.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...v)=>{const j=this.buildProps(u,e),w=g(...v)(j);return o.push(w),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,a=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...a,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:a}=r,o={tr:t,editor:r,view:a,state:cf({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},QS={};l0(QS,{blur:()=>PL,clearContent:()=>OL,clearNodes:()=>DL,command:()=>LL,createParagraphNear:()=>_L,cut:()=>zL,deleteCurrentNode:()=>$L,deleteNode:()=>FL,deleteRange:()=>BL,deleteSelection:()=>VL,enter:()=>HL,exitCode:()=>WL,extendMarkRange:()=>UL,first:()=>KL,focus:()=>GL,forEach:()=>JL,insertContent:()=>YL,insertContentAt:()=>ZL,joinBackward:()=>n8,joinDown:()=>t8,joinForward:()=>r8,joinItemBackward:()=>s8,joinItemForward:()=>i8,joinTextblockBackward:()=>a8,joinTextblockForward:()=>o8,joinUp:()=>e8,keyboardShortcut:()=>c8,lift:()=>d8,liftEmptyBlock:()=>u8,liftListItem:()=>h8,newlineInCode:()=>f8,resetAttributes:()=>p8,scrollIntoView:()=>m8,selectAll:()=>g8,selectNodeBackward:()=>x8,selectNodeForward:()=>y8,selectParentNode:()=>v8,selectTextblockEnd:()=>b8,selectTextblockStart:()=>w8,setContent:()=>N8,setMark:()=>V8,setMeta:()=>H8,setNode:()=>W8,setNodeSelection:()=>U8,setTextDirection:()=>K8,setTextSelection:()=>q8,sinkListItem:()=>G8,splitBlock:()=>J8,splitListItem:()=>Y8,toggleList:()=>Q8,toggleMark:()=>X8,toggleNode:()=>Z8,toggleWrap:()=>e6,undoInputRule:()=>t6,unsetAllMarks:()=>n6,unsetMark:()=>r6,unsetTextDirection:()=>s6,updateAttributes:()=>i6,wrapIn:()=>a6,wrapInList:()=>o6});var PL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),OL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),DL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:a,$to:o})=>{t.doc.nodesBetween(a.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=fl(y);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,j)}(v||v===0)&&e.lift(y,v)})}),!0},LL=t=>e=>t(e),_L=()=>({state:t,dispatch:e})=>hS(t,e),zL=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,a=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,a.content),r.setSelection(new He(r.doc.resolve(Math.max(o-1,0)))),!0},$L=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===r.type){if(e){const c=s.before(a),u=s.after(a);t.delete(c,u).scrollIntoView()}return!0}return!1};function ln(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var FL=t=>({tr:e,state:n,dispatch:r})=>{const s=ln(t,n.schema),a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===s){if(r){const u=a.before(o),h=a.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},BL=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},VL=()=>({state:t,dispatch:e})=>qx(t,e),HL=()=>({commands:t})=>t.keyboardShortcut("Enter"),WL=()=>({state:t,dispatch:e})=>EO(t,e);function c0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function oh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:c0(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function XS(t,e,n={}){return t.find(r=>r.type===e&&oh(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function Z1(t,e,n={}){return!!XS(t,e,n)}function d0(t,e,n){var r;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(f=>f.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(f=>f.type===e)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!XS([...s.node.marks],e,n)))return;let o=s.index,c=t.start()+s.offset,u=o+1,h=c+s.node.nodeSize;for(;o>0&&Z1([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:s})=>{const a=ni(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(s){const m=d0(u,a,e);if(m&&m.from<=h&&m.to>=f){const g=He.create(o,m.from,m.to);n.setSelection(g)}}return!0},KL=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:s,dispatch:a})=>{e={scrollIntoView:!0,...e};const o=()=>{(lh()||ew())&&r.dom.focus(),qL()&&!lh()&&!ew()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(a&&t===null&&!ZS(n.state.selection))return o(),!0;const c=eC(s.doc,t)||n.state.selection,u=n.state.selection.eq(c);return a&&(u||s.setSelection(c),u&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},JL=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),YL=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),tC=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&tC(r)}return t};function yu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return tC(n)}function Oc(t,e,n){if(t instanceof Js||t instanceof pe)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return pe.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),Oc("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,c="";const u=new $k({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?Gi.fromSchema(u).parseSlice(yu(t),n.parseOptions):Gi.fromSchema(u).parse(yu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const a=Gi.fromSchema(e);return n.slice?a.parseSlice(yu(t),n.parseOptions).content:a.parse(yu(t),n.parseOptions)}return Oc("",e,n)}function QL(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(Ge.near(t.doc.resolve(o),n))}var XL=t=>!("type"in t),ZL=(t,e,n)=>({tr:r,dispatch:s,editor:a})=>{var o;if(s){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=w=>{a.emit("contentError",{editor:a,error:w,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Oc(e,a.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(w){u(w)}try{c=Oc(e,a.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:a.options.enableContentCheck})}catch(w){return u(w),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((XL(c)?c:[c]).forEach(w=>{w.check(),g=g?w.isText&&w.marks.length===0:!1,y=y?w.isBlock:!1}),f===m&&y){const{parent:w}=r.doc.resolve(f);w.isTextblock&&!w.type.spec.code&&!w.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(w=>w.text||"").join("");else if(e instanceof pe){let w="";e.forEach(k=>{k.text&&(w+=k.text)}),j=w}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const w=r.doc.resolve(f),k=w.node(),E=w.parentOffset===0,C=k.isText||k.isTextblock,M=k.content.size>0;E&&C&&M&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&QL(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},e8=()=>({state:t,dispatch:e})=>kO(t,e),t8=()=>({state:t,dispatch:e})=>SO(t,e),n8=()=>({state:t,dispatch:e})=>iS(t,e),r8=()=>({state:t,dispatch:e})=>cS(t,e),s8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=nf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},i8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=nf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},a8=()=>({state:t,dispatch:e})=>NO(t,e),o8=()=>({state:t,dispatch:e})=>jO(t,e);function nC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function l8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,a,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:s})=>{const a=l8(t).split(/-(?!$)/),o=a.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&s&&r.maybeStep(f)}),!0};function ea(t,e,n={}){const{from:r,to:s,empty:a}=t.selection,o=e?ln(e,t.schema):null,c=[];t.doc.nodesBetween(r,s,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),v=Math.min(s,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=s-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>oh(m.node.attrs,n,{strict:!1}));return a?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var d8=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return ea(n,s,e)?CO(n,r):!1},u8=()=>({state:t,dispatch:e})=>fS(t,e),h8=t=>({state:e,dispatch:n})=>{const r=ln(t,e.schema);return zO(r)(e,n)},f8=()=>({state:t,dispatch:e})=>uS(t,e);function uf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function tw(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var p8=(t,e)=>({tr:n,state:r,dispatch:s})=>{let a=null,o=null;const c=uf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=ln(t,r.schema)),c==="mark"&&(o=ni(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{a&&a===f.type&&(u=!0,s&&n.setNodeMarkup(m,void 0,tw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,s&&n.addMark(m,m+f.nodeSize,o.create(tw(g.attrs,e))))})})}),u},m8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),g8=()=>({tr:t,dispatch:e})=>{if(e){const n=new kr(t.doc);t.setSelection(n)}return!0},x8=()=>({state:t,dispatch:e})=>oS(t,e),y8=()=>({state:t,dispatch:e})=>dS(t,e),v8=()=>({state:t,dispatch:e})=>AO(t,e),b8=()=>({state:t,dispatch:e})=>PO(t,e),w8=()=>({state:t,dispatch:e})=>IO(t,e);function Hg(t,e,n={},r={}){return Oc(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var N8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:a,dispatch:o,commands:c})=>{const{doc:u}=a;if(r.preserveWhitespace!=="full"){const h=Hg(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&a.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&a.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function rC(t,e){const n=ni(e,t.schema),{from:r,to:s,empty:a}=t.selection,o=[];a?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function sC(t,e){const n=new Ux(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function j8(t){for(let e=0;e{n(s)&&r.push({node:s,pos:a})}),r}function iC(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function hf(t){return e=>iC(e.$from,t)}function $e(t,e,n){return t.config[e]===void 0&&t.parent?$e(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?$e(t.parent,e,n):null}):t.config[e]}function u0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=$e(e,"addExtensions",n);return r?[e,...u0(r())]:e}).flat(10)}function h0(t,e){const n=eo.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function aC(t){return typeof t=="function"}function mt(t,e=void 0,...n){return aC(t)?e?t.bind(e)(...n):t(...n):t}function S8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function nl(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function oC(t){const e=[],{nodeExtensions:n,markExtensions:r}=nl(t),s=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:s},m=$e(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let v;Array.isArray(y.types)?v=y.types:y.types==="*"?v=u:y.types==="nodes"?v=o:y.types==="marks"?v=c:v=[],v.forEach(j=>{Object.entries(y.attributes).forEach(([w,k])=>{e.push({type:j,name:w,attribute:{...a,...k}})})})})}),s.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=$e(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,v])=>{const j={...a,...v};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:y,attribute:j})})}),e}function C8(t){const e=[];let n="",r=!1,s=!1,a=0;const o=t.length;for(let c=0;c0){a-=1,n+=u;continue}if(u===";"&&a===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function nw(t){const e=[],n=C8(t||""),r=n.length;for(let s=0;s!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,a])=>{if(!r[s]){r[s]=a;return}if(s==="class"){const c=a?String(a).split(" "):[],u=r[s]?r[s].split(" "):[],h=c.filter(f=>!u.includes(f));r[s]=[...u,...h].join(" ")}else if(s==="style"){const c=new Map([...nw(r[s]),...nw(a)]);r[s]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[s]=a}),r},{})}function Dc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>bt(n,r),{})}function E8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function rw(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((a,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):E8(n.getAttribute(o.name));return c==null?a:{...a,[o.name]:c}},{});return{...r,...s}}}}function sw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&S8(n)?!1:n!=null))}function iw(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function T8(t,e){var n;const r=oC(t),{nodeExtensions:s,markExtensions:a}=nl(t),o=(n=s.find(h=>$e(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(s.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,E)=>{const C=$e(E,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),y=sw({...g,content:mt($e(h,"content",m)),marks:mt($e(h,"marks",m)),group:mt($e(h,"group",m)),inline:mt($e(h,"inline",m)),atom:mt($e(h,"atom",m)),selectable:mt($e(h,"selectable",m)),draggable:mt($e(h,"draggable",m)),code:mt($e(h,"code",m)),whitespace:mt($e(h,"whitespace",m)),linebreakReplacement:mt($e(h,"linebreakReplacement",m)),defining:mt($e(h,"defining",m)),isolating:mt($e(h,"isolating",m)),attrs:Object.fromEntries(f.map(iw))}),v=mt($e(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>rw(k,f)));const j=$e(h,"renderHTML",m);j&&(y.toDOM=k=>j({node:k,HTMLAttributes:Dc(k,f)}));const w=$e(h,"renderText",m);return w&&(y.toText=w),[h.name,y]})),u=Object.fromEntries(a.map(h=>{const f=r.filter(w=>w.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((w,k)=>{const E=$e(k,"extendMarkSchema",m);return{...w,...E?E(h):{}}},{}),y=sw({...g,inclusive:mt($e(h,"inclusive",m)),excludes:mt($e(h,"excludes",m)),group:mt($e(h,"group",m)),spanning:mt($e(h,"spanning",m)),code:mt($e(h,"code",m)),attrs:Object.fromEntries(f.map(iw))}),v=mt($e(h,"parseHTML",m));v&&(y.parseDOM=v.map(w=>rw(w,f)));const j=$e(h,"renderHTML",m);return j&&(y.toDOM=w=>j({mark:w,HTMLAttributes:Dc(w,f)})),[h.name,y]}));return new $k({topNode:o,nodes:c,marks:u})}function M8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function mc(t){return t.sort((n,r)=>{const s=$e(n,"priority")||100,a=$e(r,"priority")||100;return s>a?-1:sr.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function cC(t,e,n){const{from:r,to:s}=e,{blockSeparator:a=` - -`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,s,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=a);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,s-h))}),c}function A8(t,e){const n={from:0,to:t.content.size};return cC(t,n,e)}function dC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function R8(t,e){const n=ln(e,t.schema),{from:r,to:s}=t.selection,a=[];t.doc.nodesBetween(r,s,c=>{a.push(c)});const o=a.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function uC(t,e){const n=uf(typeof e=="string"?e:e.name,t.schema);return n==="node"?R8(t,e):n==="mark"?rC(t,e):{}}function I8(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function P8(t){const e=I8(t);return e.length===1?e:e.filter((n,r)=>!e.filter((a,o)=>o!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function hC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,a)=>{const o=[];if(s.ranges.length)s.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[a];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(a).map(c,-1),f=e.slice(a).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),P8(r)}function f0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const a=n.resolve(t),o=d0(a,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,a)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:a,to:a+s.nodeSize,mark:o})))}),r}var O8=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let a=r,o=null;for(;a>0&&o===null;){const c=s.node(a);(c==null?void 0:c.type.name)===e?o=c:a-=1}return[o,a]};function Xl(t,e){return e.nodes[t]||e.marks[t]||null}function _u(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(a=>a.type===e&&a.name===r);return s?s.attribute.keepOnSplit:!1}))}var D8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,a,o,c)=>{var u,h;const f=((h=(u=s.type.spec).toText)==null?void 0:h.call(u,{node:s,pos:a,parent:o,index:c}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?f:f.slice(0,Math.max(0,r-a))}),n};function Wg(t,e,n={}){const{empty:r,ranges:s}=t.selection,a=e?ni(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>a?a.name===m.type.name:!0).find(m=>oh(m.attrs,n,{strict:!1}));let o=0;const c=[];if(s.forEach(({$from:m,$to:g})=>{const y=m.pos,v=g.pos;t.doc.nodesBetween(y,v,(j,w)=>{if(a&&j.inlineContent&&!j.type.allowsMarkType(a))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(y,w),E=Math.min(v,w+j.nodeSize),C=E-k;o+=C,c.push(...j.marks.map(M=>({mark:M,from:k,to:E})))})}),o===0)return!1;const u=c.filter(m=>a?a.name===m.mark.type.name:!0).filter(m=>oh(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>a?m.mark.type!==a&&m.mark.type.excludes(a):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function L8(t,e,n={}){if(!e)return ea(t,null,n)||Wg(t,null,n);const r=uf(e,t.schema);return r==="node"?ea(t,e,n):r==="mark"?Wg(t,e,n):!1}var _8=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const a=hf(c=>c.type.name===e)(t.selection);if(!a)return!1;const o=t.doc.resolve(a.pos+1);return s.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function aw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ow(t,e){const{nodeExtensions:n}=nl(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},a=mt($e(r,"group",s));return typeof a!="string"?!1:a.split(" ").includes("list")}function ff(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(a=>{s!==!1&&(ff(a,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function fC(t){return t instanceof Ve}var pC=class mC{constructor(e){this.position=e}static fromJSON(e){return new mC(e.position)}toJSON(){return{position:this.position}}};function $8(t,e){const n=e.mapping.mapResult(t.position);return{position:new pC(n.pos),mapResult:n}}function F8(t){return new pC(t)}function B8(t,e,n){var r;const{selection:s}=e;let a=null;if(ZS(s)&&(a=s.$cursor),a){const c=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),v=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=y&&v}return!h}),h})}var V8=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:a}=n,{empty:o,ranges:c}=a,u=ni(t,r.schema);if(s)if(o){const h=rC(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,y)=>{const v=Math.max(y,f),j=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(v,j,u.create({...k.attrs,...e}))}):n.addMark(v,j,u.create(e))})});return B8(r,n,u)},H8=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),W8=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const a=ln(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?s().command(({commands:c})=>v1(a,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>v1(a,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},U8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Pa(t,0,r.content.size),a=Ve.create(r,s);e.setSelection(a)}return!0},K8=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:a}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=a.from,c=a.to),s&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},q8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:a}=typeof t=="number"?{from:t,to:t}:t,o=He.atStart(r).from,c=He.atEnd(r).to,u=Pa(s,o,c),h=Pa(a,o,c),f=He.create(r,u,h);e.setSelection(f)}return!0},G8=t=>({state:e,dispatch:n})=>{const r=ln(t,e.schema);return BO(r)(e,n)};function lw(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var J8=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:a,doc:o}=e,{$from:c,$to:u}=a,h=s.extensionManager.attributes,f=_u(h,c.node().type.name,c.node().attrs);if(a instanceof Ve&&a.node.isBlock)return!c.parentOffset||!Ys(o,c.pos)?!1:(r&&(t&&lw(n,s.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:j8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,v=Ys(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&Ys(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(v&&(a instanceof He&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),w=e.doc.resolve(j);c.node(-1).canReplaceWith(w.index(),w.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&lw(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return v},Y8=(t,e={})=>({tr:n,state:r,dispatch:s,editor:a})=>{var o;const c=ln(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=a.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(s){let k=pe.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let I=u.depth-E;I>=u.depth-3;I-=1)k=pe.from(u.node(I).copy(k));const C=u.indexAfter(-1){if(R>-1)return!1;I.isTextblock&&I.content.size===0&&(R=A+1)}),R>-1&&n.setSelection(He.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={..._u(g,m.type.name,m.attrs),...e},j={..._u(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const w=y?[{type:c,attrs:v},{type:y,attrs:j}]:[{type:c,attrs:v}];if(!Ys(n.doc,u.pos,2))return!1;if(s){const{selection:k,storedMarks:E}=r,{splittableMarks:C}=a.extensionManager,M=E||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,w).scrollIntoView(),!M||!s)return!0;const D=M.filter(F=>C.includes(F.type.name));n.ensureMarks(D)}return!0},Hm=(t,e)=>{const n=hf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&oa(t.doc,n.pos)&&t.join(n.pos),!0},Wm=(t,e)=>{const n=hf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&oa(t.doc,r)&&t.join(r),!0},Q8=(t,e,n,r={})=>({editor:s,tr:a,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=s.extensionManager,y=ln(t,o.schema),v=ln(e,o.schema),{selection:j,storedMarks:w}=o,{$from:k,$to:E}=j,C=k.blockRange(E),M=w||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const D=hf(F=>ow(F.type.name,m))(j);if(C.depth>=1&&D&&C.depth-D.depth<=1){if(D.node.type===y)return h.liftListItem(v);if(ow(D.node.type.name,m)&&y.validContent(D.node.content)&&c)return u().command(()=>(a.setNodeMarkup(D.pos,y),!0)).command(()=>Hm(a,y)).command(()=>Wm(a,y)).run()}return!n||!M||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>Hm(a,y)).command(()=>Wm(a,y)).run():u().command(()=>{const F=f().wrapInList(y,r),R=M.filter(I=>g.includes(I.type.name));return a.ensureMarks(R),F?!0:h.clearNodes()}).wrapInList(y,r).command(()=>Hm(a,y)).command(()=>Wm(a,y)).run()},X8=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:a=!1}=n,o=ni(t,r.schema);return Wg(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:a}):s.setMark(o,e)},Z8=(t,e,n={})=>({state:r,commands:s})=>{const a=ln(t,r.schema),o=ln(e,r.schema),c=ea(r,a,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?s.setNode(o,u):s.setNode(a,{...u,...n})},e6=(t,e={})=>({state:n,commands:r})=>{const s=ln(t,n.schema);return ea(n,s,e)?r.lift(s):r.wrapIn(s,e)},t6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(a.text){const u=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,t.schema.text(a.text,u))}else o.delete(a.from,a.to)}return!0}}return!1},n6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},r6=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var a;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=ni(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!s)return!0;if(f&&o){let{from:g,to:y}=c;const v=(a=h.marks().find(w=>w.type===u))==null?void 0:a.attrs,j=d0(h,u,v);j&&(g=j.from,y=j.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},s6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let a,o;return typeof t=="number"?(a=t,o=t):t&&"from"in t&&"to"in t?(a=t.from,o=t.to):(a=s.from,o=s.to),r&&e.doc.nodesBetween(a,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},i6=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let a=null,o=null;const c=uf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=ln(t,r.schema)),c==="mark"&&(o=ni(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,v,j;n.selection.empty?r.doc.nodesBetween(f,m,(w,k)=>{a&&a===w.type&&(u=!0,v=Math.max(k,f),j=Math.min(k+w.nodeSize,m),g=k,y=w)}):r.doc.nodesBetween(f,m,(w,k)=>{k=f&&k<=m&&(a&&a===w.type&&(u=!0,s&&n.setNodeMarkup(k,void 0,{...w.attrs,...e})),o&&w.marks.length&&w.marks.forEach(E=>{if(o===E.type&&(u=!0,s)){const C=Math.max(k,f),M=Math.min(k+w.nodeSize,m);n.addMark(C,M,o.create({...E.attrs,...e}))}}))}),y&&(g!==void 0&&s&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(w=>{o===w.type&&s&&n.addMark(v,j,o.create({...w.attrs,...e}))}))}),u},a6=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return OO(s,e)(n,r)},o6=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return DO(s,e)(n,r)},l6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},pf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},c6=(t,e)=>{if(c0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function vu(t){var e;const{editor:n,from:r,to:s,text:a,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=D8(h)+a;return o.forEach(g=>{if(f)return;const y=c6(m,g.find);if(!y)return;const v=u.state.tr,j=cf({state:u.state,transaction:v}),w={from:r-(y[0].length-a.length),to:s},{commands:k,chain:E,can:C}=new df({editor:n,state:j});g.handler({state:j,range:w,match:y,commands:k,chain:E,can:C})===null||!v.steps.length||(g.undoable&&v.setMeta(c,{transform:v,from:r,to:s,text:a}),u.dispatch(v),f=!0)}),f}function d6(t){const{editor:e,rules:n}=t,r=new Ct({state:{init(){return null},apply(s,a,o){const c=s.getMeta(r);if(c)return c;const u=s.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=h0(pe.from(f),o.schema);const{from:m}=u,g=m+f.length;vu({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:a}},props:{handleTextInput(s,a,o,c){return vu({editor:e,from:a,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:a}=s.state.selection;a&&vu({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,a){if(a.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?vu({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function u6(t){return Object.prototype.toString.call(t).slice(8,-1)}function bu(t){return u6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function gC(t,e){const n={...t};return bu(t)&&bu(e)&&Object.keys(e).forEach(r=>{bu(e[r])&&bu(t[r])?n[r]=gC(t[r],e[r]):n[r]=e[r]}),n}var p0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...mt($e(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...mt($e(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>gC(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},to=class xC extends p0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new xC(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function h6(t){return typeof t=="number"}var f6=class{constructor(t){this.find=t.find,this.handler=t.handler}},p6=(t,e,n)=>{if(c0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const a=[s.text];return a.index=s.index,a.input=t,a.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(s.replaceWith)),a}):[]};function m6(t){const{editor:e,state:n,from:r,to:s,rule:a,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new df({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,s,(y,v)=>{var j,w,k,E,C;if((w=(j=y.type)==null?void 0:j.spec)!=null&&w.code||!(y.isText||y.isTextblock||y.isInline))return;const M=(C=(E=(k=y.content)==null?void 0:k.size)!=null?E:y.nodeSize)!=null?C:0,D=Math.max(r,v),F=Math.min(s,v+M);if(D>=F)return;const R=y.isText?y.text||"":y.textBetween(D-v,F-v,void 0,"");p6(R,a.find,o).forEach(A=>{if(A.index===void 0)return;const O=D+A.index+1,W=O+A[0].length,X={from:n.tr.mapping.map(O),to:n.tr.mapping.map(W)},q=a.handler({state:n,range:X,match:A,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(q)})}),m.every(y=>y!==null)}var wu=null,g6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function x6(t){const{editor:e,rules:n}=t;let r=null,s=!1,a=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:v})=>{const j=f.tr,w=cf({state:f,transaction:j});if(!(!m6({editor:e,state:w,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:v,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new Ct({view(m){const g=v=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(v.target)?m.dom.parentElement:null,r&&(wu=e)},y=()=>{wu&&(wu=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(a=r===m.dom.parentElement,c=g,!a){const y=wu;y!=null&&y.isEditable&&setTimeout(()=>{const v=y.state.selection;v&&y.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var y;const v=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,s=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const v=m[0],j=v.getMeta("uiEvent")==="paste"&&!s,w=v.getMeta("uiEvent")==="drop"&&!a,k=v.getMeta("applyPasteRules"),E=!!k;if(!j&&!w&&!E)return;if(E){let{text:D}=k;typeof D=="string"?D=D:D=h0(pe.from(D),y.schema);const{from:F}=k,R=F+D.length,I=g6(D);return u({rule:f,state:y,from:F,to:{b:R},pasteEvt:I})}const C=g.doc.content.findDiffStart(y.doc.content),M=g.doc.content.findDiffEnd(y.doc.content);if(!(!h6(C)||!M||C===M.b))return u({rule:f,state:y,from:C,to:M,pasteEvt:o})}}))}var mf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=lC(t),this.schema=T8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xl(e.name,this.schema)},r=$e(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return mc([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Xl(r.name,this.schema)},a=[],o=$e(r,"addKeyboardShortcuts",s);let c={};if(r.type==="mark"&&$e(r,"exitable",s)&&(c.ArrowRight=()=>to.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,v])=>[y,()=>v({editor:t})]));c={...c,...g}}const u=RL(c);a.push(u);const h=$e(r,"addInputRules",s);if(aw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=d6({editor:t,rules:g}),v=Array.isArray(y)?y:[y];a.push(...v)}}const f=$e(r,"addPasteRules",s);if(aw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=x6({editor:t,rules:g});a.push(...y)}}const m=$e(r,"addProseMirrorPlugins",s);if(m){const g=m();a.push(...g)}return a})}get attributes(){return oC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=nl(this.extensions);return Object.fromEntries(e.filter(n=>!!$e(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ln(n.name,this.schema)},a=$e(n,"addNodeView",s);if(!a)return[];const o=a();if(!o)return[];const c=(u,h,f,m,g)=>{const y=Dc(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return mc([...this.extensions].reverse()).reduceRight((r,s)=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Xl(s.name,this.schema)},o=$e(s,"dispatchTransaction",a);return o?c=>{o.call(a,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return mc([...this.extensions]).reduce((r,s)=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Xl(s.name,this.schema)},o=$e(s,"transformPastedHTML",a);return o?(c,u)=>{const h=r(c,u);return o.call(a,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=nl(this.extensions);return Object.fromEntries(e.filter(n=>!!$e(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ni(n.name,this.schema)},a=$e(n,"addMarkView",s);if(!a)return[];const o=(c,u,h)=>{const f=Dc(c,r);return a()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{I6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xl(e.name,this.schema)};e.type==="mark"&&((n=mt($e(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=$e(e,"onBeforeCreate",r),a=$e(e,"onCreate",r),o=$e(e,"onUpdate",r),c=$e(e,"onSelectionUpdate",r),u=$e(e,"onTransaction",r),h=$e(e,"onFocus",r),f=$e(e,"onBlur",r),m=$e(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),a&&this.editor.on("create",a),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};mf.resolve=lC;mf.sort=mc;mf.flatten=u0;var y6={};l0(y6,{ClipboardTextSerializer:()=>vC,Commands:()=>bC,Delete:()=>wC,Drop:()=>NC,Editable:()=>jC,FocusEvents:()=>SC,Keymap:()=>CC,Paste:()=>EC,Tabindex:()=>TC,TextDirection:()=>MC,focusEventsPluginKey:()=>kC});var Gt=class yC extends p0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new yC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},vC=Gt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ct({key:new _t("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:a}=s,o=Math.min(...a.map(f=>f.$from.pos)),c=Math.max(...a.map(f=>f.$to.pos)),u=dC(n);return cC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),bC=Gt.create({name:"commands",addCommands(){return{...QS}}}),wC=Gt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const a=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=sC(t.before,[t,...e]);hC(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(v,j)=>{const w=j+v.nodeSize-2,k=y.oldRange.from<=j&&w<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:j,to:w,newFrom:f.mapping.map(j),newTo:f.mapping.map(w),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,v)=>{var j,w;if(y instanceof Xr){const k=g.slice(v).map(y.from,-1),E=g.slice(v).map(y.to),C=g.invert().map(k,-1),M=g.invert().map(E),D=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(R=>R.eq(y.mark)),F=(w=f.doc.nodeAt(E))==null?void 0:w.marks.some(R=>R.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:C,to:M},newRange:{from:k,to:E},partial:!!(F||D),editor:this.editor,transaction:t,combinedTransform:f})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(a,0):a()}}),NC=Gt.create({name:"drop",addProseMirrorPlugins(){return[new Ct({key:new _t("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),jC=Gt.create({name:"editable",addProseMirrorPlugins(){return[new Ct({key:new _t("editable"),props:{editable:()=>this.editor.options.editable}})]}}),kC=new _t("focusEvents"),SC=Gt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ct({key:kC,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),CC=Gt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=v.parent.type.spec.isolating,w=m.pos-m.parentOffset,k=j&&v.parent.childCount===1?w===m.pos:Ge.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},a={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return lh()||nC()?a:s},addProseMirrorPlugins(){return[new Ct({key:new _t("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),s=t.some(j=>j.getMeta("preventClearDocument"));if(!r||s)return;const{empty:a,from:o,to:c}=e.selection,u=Ge.atStart(e.doc).from,h=Ge.atEnd(e.doc).to;if(a||!(o===u&&c===h)||!ff(n.doc))return;const g=n.tr,y=cf({state:n,transaction:g}),{commands:v}=new df({editor:this.editor,state:y});if(v.clearNodes(),!!g.steps.length)return g}})]}}),EC=Gt.create({name:"paste",addProseMirrorPlugins(){return[new Ct({key:new _t("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),TC=Gt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ct({key:new _t("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),MC=Gt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=nl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ct({key:new _t("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),v6=class ac{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new ac(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ac(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ac(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+r+(a?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!s&&!o&&u.depth<=this.depth)return;const h=new ac(u,this.editor,s,s||o?n:null);s&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const a=s.node.attrs,o=Object.keys(n);for(let c=0;c{r&&s.length>0||(o.node.type.name===e&&a.every(u=>n[u]===o.node.attrs[u])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},b6=`.ProseMirror { - position: relative; -} - -.ProseMirror { - word-wrap: break-word; - white-space: pre-wrap; - white-space: break-spaces; - -webkit-font-variant-ligatures: none; - font-variant-ligatures: none; - font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ -} - -.ProseMirror [contenteditable="false"] { - white-space: normal; -} - -.ProseMirror [contenteditable="false"] [contenteditable="true"] { - white-space: pre-wrap; -} - -.ProseMirror pre { - white-space: pre-wrap; -} - -img.ProseMirror-separator { - display: inline !important; - border: none !important; - margin: 0 !important; - width: 0 !important; - height: 0 !important; -} - -.ProseMirror-gapcursor { - display: none; - pointer-events: none; - position: absolute; - margin: 0; -} - -.ProseMirror-gapcursor:after { - content: ""; - display: block; - position: absolute; - top: -2px; - width: 20px; - border-top: 1px solid black; - animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; -} - -@keyframes ProseMirror-cursor-blink { - to { - visibility: hidden; - } -} - -.ProseMirror-hideselection *::selection { - background: transparent; -} - -.ProseMirror-hideselection *::-moz-selection { - background: transparent; -} - -.ProseMirror-hideselection * { - caret-color: transparent; -} - -.ProseMirror-focused .ProseMirror-gapcursor { - display: block; -}`;function w6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var N6=class extends l6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:$8,createMappablePosition:F8},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:a})=>this.options.onDrop(r,s,a)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=eC(e,this.options.autofocus);this.editorState=Wo.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=w6(b6,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=aC(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const a=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(a))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[jC,vC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),bC,SC,CC,TC,NC,EC,wC,MC.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new mf(r,this)}createCommandManager(){this.commandManager=new df({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Hg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Hg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,a=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new YS(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||a.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return uC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return L8(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return h0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:n={}}=t||{};return A8(this.state.doc,{blockSeparator:e,textSerializers:{...dC(this.schema),...n}})}get isEmpty(){return ff(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new v6(e,this)}get $doc(){return this.$pos(0)}};function rl(t){return new pf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=mt(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:a}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(f0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(j=>j===t.type&&j!==y.mark.type)).filter(y=>y.to>h).length)return null;fn.from&&a.delete(n.from+u,h);const g=n.from+u+o.length;a.addMark(n.from+u,g,t.type.create(s||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function AC(t){return new pf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=mt(t.getAttributes,void 0,r)||{},{tr:a}=e,o=n.from;let c=n.to;const u=t.type.create(s);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];a.insertText(m,o+r[0].length-1),a.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;a.insert(h,t.type.create(s)).delete(a.mapping.map(o),a.mapping.map(c))}a.scrollIntoView()},undoable:t.undoable})}function Ug(t){return new pf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),a=mt(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,a)},undoable:t.undoable})}function sl(t){return new pf({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const a=mt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&Wx(u,t.type,a);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const j=v.filter(w=>y.includes(w.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(m,a).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&oa(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var j6=t=>"touches"in t,k6=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,a,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(a=t.options)!=null&&a.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),a=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),a&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,j6(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),a=this.applyConstraints(r,s,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const a=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return a?r=this.startWidth+e:o&&(r=this.startWidth-e),c?s=this.startHeight+n:u&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(a?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,a,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(s=this.maxSize)!=null&&s.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function S6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ve){const a=r.index();return r.parent.canReplaceWith(a,a+1,e)}let s=r.depth;for(;s>=0;){const a=r.index(s);if(r.node(s).contentMatchAt(a).matchType(e))return!0;s-=1}return!1}function C6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var E6={};l0(E6,{createAtomBlockMarkdownSpec:()=>T6,createBlockMarkdownSpec:()=>M6,createInlineMarkdownSpec:()=>RC,parseAttributes:()=>m0,parseIndentedBlocks:()=>Kg,renderNestedMarkdownContent:()=>x0,serializeAttributes:()=>g0});function m0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const h=s.map(f=>f.trim().slice(1));e.class=h.join(" ")}const a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(e.id=a[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[h]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function g0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function T6(t){const{nodeName:e,name:n,parseAttributes:r=m0,serializeAttributes:s=g0,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...a,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=f.match(y);if(!v)return;const j=v[1]||"",w=r(j);if(!o.find(E=>!(E in w)))return{type:e,raw:v[0],attributes:w}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=s(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function M6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=m0,serializeAttributes:a=g0,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const j=r(m);y=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const v={...o,...m.attributes};return g.createNode(e,v,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),v=(g=m.match(y))==null?void 0:g.index;return v!==void 0?v:-1},tokenize(m,g,y){var v;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),w=m.match(j);if(!w)return;const[k,E=""]=w,C=s(E);let M=1;const D=k.length;let F="";const R=/^:::([\w-]*)(\s.*)?/gm,I=m.slice(D);for(R.lastIndex=0;;){const A=R.exec(I);if(A===null)break;const O=A.index,W=A[1];if(!((v=A[2])!=null&&v.endsWith(":::"))){if(W)M+=1;else if(M-=1,M===0){const X=I.slice(0,O);F=X.trim();const q=m.slice(0,D+O+A[0].length);let Z=[];if(F)if(c==="block")for(Z=y.blockTokens(X),Z.forEach(_=>{_.text&&(!_.tokens||_.tokens.length===0)&&(_.tokens=y.inlineTokens(_.text))});Z.length>0;){const _=Z[Z.length-1];if(_.type==="paragraph"&&(!_.text||_.text.trim()===""))Z.pop();else break}else Z=y.inlineTokens(F);return{type:e,raw:q,attributes:C,content:F,tokens:Z}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),v=a(y),j=v?` {${v}}`:"",w=g.renderChildren(m.content||[],` - -`);return`:::${h}${j} - -${w} - -:::`}}}function A6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,a,o]=r;e[s]=a||o,r=n.exec(t)}return e}function R6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function RC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=A6,serializeAttributes:a=R6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(v=>{const j=typeof v=="string"?v:v.name,w=typeof v=="string"?void 0:v.skipIfDefault;if(j in g){const k=g[j];if(w!==void 0&&k===w)return;y[j]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const v={...o,...g.attributes};if(c)return y.createNode(e,v);const j=r?r(g):g.content||"";return j?y.createNode(e,v,[y.createTextNode(j)]):y.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),v=g.match(y),j=v==null?void 0:v.index;return j!==void 0?j:-1},tokenize(g,y,v){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),w=g.match(j);if(!w)return;let k="",E="";if(c){const[,M]=w;E=M}else{const[,M,D]=w;E=M,k=D||""}const C=s(E.trim());return{type:e,raw:w[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const v=f(g.attrs||{}),j=a(v),w=j?` ${j}`:"";return c?`[${h}${w}]`:`[${h}${w}]${y}[/${h}]`}}}function Kg(t,e,n){var r,s,a,o;const c=t.split(` -`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} -`;continue}else return}const v=e.extractItemData(y),{indentLevel:j,mainContent:w}=v;h=`${h}${g} -`;const k=[w];for(f+=1;fO.trim()!=="");if(R===-1)break;if((((s=(r=c[f+1+R].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>j){k.push(D),h=`${h}${D} -`,f+=1;continue}else break}if((((o=(a=D.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:o.length)||0)>j)k.push(D),h=`${h}${D} -`,f+=1;else break}let E;const C=k.slice(1);if(C.length>0){const D=C.map(F=>F.slice(j+m)).join(` -`);D.trim()&&(e.customNestedParser?E=e.customNestedParser(D):E=n.blockTokens(D))}const M=e.createToken(v,E);u.push(M)}if(u.length!==0)return{items:u,raw:h}}function x0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[a,...o]=t.content,c=e.renderChildren([a]),u=[`${s}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` -`).map(g=>g?e.indent(g):"").join(` -`);u.push(m)}}),u.join(` -`)}function I6(t,e,n={}){const{state:r}=e,{doc:s,tr:a}=r,o=t;s.descendants((c,u)=>{const h=a.mapping.map(u),f=a.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});a.removeMark(h,f,t.type),a.addMark(h,f,y)}}),a.docChanged&&e.view.dispatch(a)}var fn=class IC extends p0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new IC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Ga(t){return new f6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const a=mt(t.getAttributes,void 0,r,s);if(a===!1||a===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(f0(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(w=>w===t.type&&w!==v.mark.type)).filter(v=>v.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:P6,getOwnPropertySymbols:O6}=Object,{hasOwnProperty:D6}=Object.prototype;function Um(t,e){return function(r,s,a){return t(r,s,a)&&e(r,s,a)}}function Nu(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:a}=s,o=a.get(n),c=a.get(r);if(o&&c)return o===r&&c===n;a.set(n,r),a.set(r,n);const u=t(n,r,s);return a.delete(n),a.delete(r),u}}function L6(t){return t!=null?t[Symbol.toStringTag]:void 0}function cw(t){return P6(t).concat(O6(t))}const _6=Object.hasOwn||((t,e)=>D6.call(t,e));function no(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const z6="__v",$6="__o",F6="_owner",{getOwnPropertyDescriptor:dw,keys:uw}=Object;function B6(t,e){return t.byteLength===e.byteLength&&ch(new Uint8Array(t),new Uint8Array(e))}function V6(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function H6(t,e){return t.byteLength===e.byteLength&&ch(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function W6(t,e){return no(t.getTime(),e.getTime())}function U6(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function K6(t,e){return t===e}function hw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),a=t.entries();let o,c,u=0;for(;(o=a.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(s[m]){m++;continue}const g=o.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){f=s[m]=!0;break}m++}if(!f)return!1;u++}return!0}const q6=no;function G6(t,e,n){const r=uw(t);let s=r.length;if(uw(e).length!==s)return!1;for(;s-- >0;)if(!PC(t,e,n,r[s]))return!1;return!0}function Zl(t,e,n){const r=cw(t);let s=r.length;if(cw(e).length!==s)return!1;let a,o,c;for(;s-- >0;)if(a=r[s],!PC(t,e,n,a)||(o=dw(t,a),c=dw(e,a),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function J6(t,e){return no(t.valueOf(),e.valueOf())}function Y6(t,e){return t.source===e.source&&t.flags===e.flags}function fw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),a=t.values();let o,c;for(;(o=a.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!s[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=s[f]=!0;break}f++}if(!h)return!1}return!0}function ch(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function Q6(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function PC(t,e,n,r){return(r===F6||r===$6||r===z6)&&(t.$$typeof||e.$$typeof)?!0:_6(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const X6="[object ArrayBuffer]",Z6="[object Arguments]",e_="[object Boolean]",t_="[object DataView]",n_="[object Date]",r_="[object Error]",s_="[object Map]",i_="[object Number]",a_="[object Object]",o_="[object RegExp]",l_="[object Set]",c_="[object String]",d_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},u_="[object URL]",h_=Object.prototype.toString;function f_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:v}){return function(w,k,E){if(w===k)return!0;if(w==null||k==null)return!1;const C=typeof w;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(w,k,E):C==="function"?a(w,k,E):!1;const M=w.constructor;if(M!==k.constructor)return!1;if(M===Object)return u(w,k,E);if(Array.isArray(w))return e(w,k,E);if(M===Date)return r(w,k,E);if(M===RegExp)return f(w,k,E);if(M===Map)return o(w,k,E);if(M===Set)return m(w,k,E);const D=h_.call(w);if(D===n_)return r(w,k,E);if(D===o_)return f(w,k,E);if(D===s_)return o(w,k,E);if(D===l_)return m(w,k,E);if(D===a_)return typeof w.then!="function"&&typeof k.then!="function"&&u(w,k,E);if(D===u_)return y(w,k,E);if(D===r_)return s(w,k,E);if(D===Z6)return u(w,k,E);if(d_[D])return g(w,k,E);if(D===X6)return t(w,k,E);if(D===t_)return n(w,k,E);if(D===e_||D===i_||D===c_)return h(w,k,E);if(v){let F=v[D];if(!F){const R=L6(w);R&&(F=v[R])}if(F)return F(w,k,E)}return!1}}function p_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:B6,areArraysEqual:n?Zl:V6,areDataViewsEqual:H6,areDatesEqual:W6,areErrorsEqual:U6,areFunctionsEqual:K6,areMapsEqual:n?Um(hw,Zl):hw,areNumbersEqual:q6,areObjectsEqual:n?Zl:G6,arePrimitiveWrappersEqual:J6,areRegExpsEqual:Y6,areSetsEqual:n?Um(fw,Zl):fw,areTypedArraysEqual:n?Um(ch,Zl):ch,areUrlsEqual:Q6,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Nu(r.areArraysEqual),a=Nu(r.areMapsEqual),o=Nu(r.areObjectsEqual),c=Nu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return r}function m_(t){return function(e,n,r,s,a,o,c){return t(e,n,c)}}function g_({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:s})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const a={cache:void 0,equals:r,meta:void 0,strict:s};return function(c,u){return e(c,u,a)}}const x_=ca();ca({strict:!0});ca({circular:!0});ca({circular:!0,strict:!0});ca({createInternalComparator:()=>no});ca({strict:!0,createInternalComparator:()=>no});ca({circular:!0,createInternalComparator:()=>no});ca({circular:!0,createInternalComparator:()=>no,strict:!0});function ca(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,a=p_(t),o=f_(a),c=n?n(o):m_(o);return g_({circular:e,comparator:o,createState:r,equals:c,strict:s})}var Km={exports:{}},qm={};/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var pw;function y_(){if(pw)return qm;pw=1;var t=Fc(),e=Nk();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return qm.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var v=a(null);if(v.current===null){var j={hasValue:!1,value:null};v.current=j}else j=v.current;v=c(function(){function k(F){if(!E){if(E=!0,C=F,F=g(F),y!==void 0&&j.hasValue){var R=j.value;if(y(R,F))return M=R}return M=F}if(R=M,r(C,F))return R;var I=g(F);return y!==void 0&&y(R,I)?(C=F,R):(C=F,M=I)}var E=!1,C,M,D=m===void 0?null:m;return[function(){return k(f())},D===null?void 0:function(){return k(D())}]},[f,m,g,y]);var w=s(h,v[0],v[1]);return o(function(){j.hasValue=!0,j.value=w},[w]),u(w),w},qm}var mw;function v_(){return mw||(mw=1,Km.exports=y_()),Km.exports}var b_=v_(),w_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},N_=({contentComponent:t})=>{const e=jk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return i.jsx(i.Fragment,{children:Object.values(e)})};function j_(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:bN.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var k_=class extends Zn.Component{constructor(t){var e;super(t),this.editorContentRef=Zn.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=j_(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:w_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&i.jsx(N_,{contentComponent:t.contentComponent})]})}},S_=b.forwardRef((t,e)=>{const n=Zn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Zn.createElement(k_,{key:n,innerRef:e,...t})}),OC=Zn.memo(S_),C_=typeof window<"u"?b.useLayoutEffect:b.useEffect,E_=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function T_(t){var e;const[n]=b.useState(()=>new E_(t.editor)),r=b_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:x_);return C_(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var M_=!1,qg=typeof window>"u",A_=qg||!!(typeof window<"u"&&window.next),R_=class DC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?qg||A_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,a;return(a=(s=this.options.current).onBeforeCreate)==null?void 0:a.call(s,...r)},onBlur:(...r)=>{var s,a;return(a=(s=this.options.current).onBlur)==null?void 0:a.call(s,...r)},onCreate:(...r)=>{var s,a;return(a=(s=this.options.current).onCreate)==null?void 0:a.call(s,...r)},onDestroy:(...r)=>{var s,a;return(a=(s=this.options.current).onDestroy)==null?void 0:a.call(s,...r)},onFocus:(...r)=>{var s,a;return(a=(s=this.options.current).onFocus)==null?void 0:a.call(s,...r)},onSelectionUpdate:(...r)=>{var s,a;return(a=(s=this.options.current).onSelectionUpdate)==null?void 0:a.call(s,...r)},onTransaction:(...r)=>{var s,a;return(a=(s=this.options.current).onTransaction)==null?void 0:a.call(s,...r)},onUpdate:(...r)=>{var s,a;return(a=(s=this.options.current).onUpdate)==null?void 0:a.call(s,...r)},onContentError:(...r)=>{var s,a;return(a=(s=this.options.current).onContentError)==null?void 0:a.call(s,...r)},onDrop:(...r)=>{var s,a;return(a=(s=this.options.current).onDrop)==null?void 0:a.call(s,...r)},onPaste:(...r)=>{var s,a;return(a=(s=this.options.current).onPaste)==null?void 0:a.call(s,...r)},onDelete:(...r)=>{var s,a;return(a=(s=this.options.current).onDelete)==null?void 0:a.call(s,...r)}};return new N6(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,a)=>{var o;return s===((o=n.extensions)==null?void 0:o[a])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?DC.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function I_(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new R_(n)),s=jk.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(s),b.useEffect(r.onRender(e)),T_({editor:s,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),s}var LC=b.createContext({editor:null});LC.Consumer;var P_=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),O_=()=>b.useContext(P_);Zn.forwardRef((t,e)=>{const{onDragStart:n}=O_(),r=t.as||"div";return i.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Zn.createContext({markViewContentRef:()=>{}});var y0=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});y0.displayName="TiptapContext";var D_=()=>b.useContext(y0);function _C({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=b.useMemo(()=>({editor:r}),[r]),a=b.useMemo(()=>({editor:r}),[r]);return i.jsx(LC.Provider,{value:a,children:i.jsx(y0.Provider,{value:s,children:n})})}_C.displayName="Tiptap";function zC({...t}){const{editor:e}=D_();return i.jsx(OC,{editor:e,...t})}zC.displayName="Tiptap.Content";Object.assign(_C,{Content:zC});var dh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},L_=/^\s*>\s$/,__=fn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return dh("blockquote",{...bt(this.options.HTMLAttributes,t),children:dh("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(s=>{const c=e.renderChildren([s]).split(` -`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` -`))}),r.join(` -${n} -`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[sl({find:L_,type:this.type})]}}),z_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,$_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,F_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,B_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,V_=to.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return dh("strong",{...bt(this.options.HTMLAttributes,t),children:dh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[rl({find:z_,type:this.type}),rl({find:F_,type:this.type})]},addPasteRules(){return[Ga({find:$_,type:this.type}),Ga({find:B_,type:this.type})]}}),H_=/(^|[^`])`([^`]+)`(?!`)$/,W_=/(^|[^`])`([^`]+)`(?!`)/g,U_=to.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[rl({find:H_,type:this.type})]},addPasteRules(){return[Ga({find:W_,type:this.type})]}}),Gm=4,K_=/^```([a-z]+)?[\s\n]$/,q_=/^~~~([a-z]+)?[\s\n]$/,G_=fn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Gm,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const a=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",bt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(` -`):r=`\`\`\`${s} - -\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Gm,{state:r}=t,{selection:s}=r,{$from:a,empty:o}=s;if(a.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=s,y=r.doc.textBetween(h,f,` -`,` -`).split(` -`).map(v=>c+v).join(` -`);return u.replaceWith(h,f,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Gm,{state:r}=t,{selection:s}=r,{$from:a,empty:o}=s;return a.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=a,f=a.start(),m=a.end(),y=r.doc.textBetween(f,m,` -`,` -`).split(` -`);let v=0,j=0;const w=h-f;for(let F=0;F=w){v=F;break}j+=y[F].length+1}const E=((u=y[v].match(/^ */))==null?void 0:u[0])||"",C=Math.min(E.length,n);if(C===0)return!0;let M=f;for(let F=0;F{const{from:u,to:h}=s,g=r.doc.textBetween(u,h,` -`,` -`).split(` -`).map(y=>{var v;const j=((v=y.match(/^ */))==null?void 0:v[0])||"",w=Math.min(j.length,n);return y.slice(w)}).join(` -`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` - -`);return!a||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:a}=n;if(!a||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const c=s.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(Ge.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ug({find:K_,type:this.type,getAttributes:t=>({language:t[1]})}),Ug({find:q_,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ct({key:new _t("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,a=s==null?void 0:s.mode;if(!n||!a)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` -`));return o.replaceSelectionWith(this.type.create({language:a},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(He.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),J_=fn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` - -`):""}),Y_=fn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",bt(this.options.HTMLAttributes,t)]},renderText(){return` -`},renderMarkdown:()=>` -`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:a}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=a||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Q_=fn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,bt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ug({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),X_=fn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",bt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!S6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return fC(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:a,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(He.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Ve.create(o.doc,u.pos)):o.setSelection(He.create(o.doc,u.pos));else{const f=a.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(He.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[AC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Z_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ez=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,tz=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,nz=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,rz=to.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[rl({find:Z_,type:this.type}),rl({find:tz,type:this.type})]},addPasteRules(){return[Ga({find:ez,type:this.type}),Ga({find:nz,type:this.type})]}});const sz="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",iz="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Gg="numeric",Jg="ascii",Yg="alpha",gc="asciinumeric",oc="alphanumeric",Qg="domain",$C="emoji",az="scheme",oz="slashscheme",Jm="whitespace";function lz(t,e){return t in e||(e[t]=[]),e[t]}function Oa(t,e,n){e[Gg]&&(e[gc]=!0,e[oc]=!0),e[Jg]&&(e[gc]=!0,e[Yg]=!0),e[gc]&&(e[oc]=!0),e[Yg]&&(e[oc]=!0),e[oc]&&(e[Qg]=!0),e[$C]&&(e[Qg]=!0);for(const r in e){const s=lz(r,n);s.indexOf(t)<0&&s.push(t)}}function cz(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function dr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}dr.groups={};dr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,s),Wt=(t,e,n,r,s)=>t.tr(e,n,r,s),gw=(t,e,n,r,s)=>t.ts(e,n,r,s),we=(t,e,n,r,s)=>t.tt(e,n,r,s),Ws="WORD",Xg="UWORD",FC="ASCIINUMERICAL",BC="ALPHANUMERICAL",Lc="LOCALHOST",Zg="TLD",ex="UTLD",zu="SCHEME",zo="SLASH_SCHEME",v0="NUM",tx="WS",b0="NL",xc="OPENBRACE",yc="CLOSEBRACE",uh="OPENBRACKET",hh="CLOSEBRACKET",fh="OPENPAREN",ph="CLOSEPAREN",mh="OPENANGLEBRACKET",gh="CLOSEANGLEBRACKET",xh="FULLWIDTHLEFTPAREN",yh="FULLWIDTHRIGHTPAREN",vh="LEFTCORNERBRACKET",bh="RIGHTCORNERBRACKET",wh="LEFTWHITECORNERBRACKET",Nh="RIGHTWHITECORNERBRACKET",jh="FULLWIDTHLESSTHAN",kh="FULLWIDTHGREATERTHAN",Sh="AMPERSAND",Ch="APOSTROPHE",Eh="ASTERISK",Oi="AT",Th="BACKSLASH",Mh="BACKTICK",Ah="CARET",_i="COLON",w0="COMMA",Rh="DOLLAR",ys="DOT",Ih="EQUALS",N0="EXCLAMATION",Dr="HYPHEN",vc="PERCENT",Ph="PIPE",Oh="PLUS",Dh="POUND",bc="QUERY",j0="QUOTE",VC="FULLWIDTHMIDDLEDOT",k0="SEMI",vs="SLASH",wc="TILDE",Lh="UNDERSCORE",HC="EMOJI",_h="SYM";var WC=Object.freeze({__proto__:null,ALPHANUMERICAL:BC,AMPERSAND:Sh,APOSTROPHE:Ch,ASCIINUMERICAL:FC,ASTERISK:Eh,AT:Oi,BACKSLASH:Th,BACKTICK:Mh,CARET:Ah,CLOSEANGLEBRACKET:gh,CLOSEBRACE:yc,CLOSEBRACKET:hh,CLOSEPAREN:ph,COLON:_i,COMMA:w0,DOLLAR:Rh,DOT:ys,EMOJI:HC,EQUALS:Ih,EXCLAMATION:N0,FULLWIDTHGREATERTHAN:kh,FULLWIDTHLEFTPAREN:xh,FULLWIDTHLESSTHAN:jh,FULLWIDTHMIDDLEDOT:VC,FULLWIDTHRIGHTPAREN:yh,HYPHEN:Dr,LEFTCORNERBRACKET:vh,LEFTWHITECORNERBRACKET:wh,LOCALHOST:Lc,NL:b0,NUM:v0,OPENANGLEBRACKET:mh,OPENBRACE:xc,OPENBRACKET:uh,OPENPAREN:fh,PERCENT:vc,PIPE:Ph,PLUS:Oh,POUND:Dh,QUERY:bc,QUOTE:j0,RIGHTCORNERBRACKET:bh,RIGHTWHITECORNERBRACKET:Nh,SCHEME:zu,SEMI:k0,SLASH:vs,SLASH_SCHEME:zo,SYM:_h,TILDE:wc,TLD:Zg,UNDERSCORE:Lh,UTLD:ex,UWORD:Xg,WORD:Ws,WS:tx});const Vs=/[a-z]/,ec=new RegExp("\\p{L}","u"),Ym=new RegExp("\\p{Emoji}","u"),Hs=/\d/,Qm=/\s/,xw="\r",Xm=` -`,dz="️",uz="‍",Zm="";let ju=null,ku=null;function hz(t=[]){const e={};dr.groups=e;const n=new dr;ju==null&&(ju=yw(sz)),ku==null&&(ku=yw(iz)),we(n,"'",Ch),we(n,"{",xc),we(n,"}",yc),we(n,"[",uh),we(n,"]",hh),we(n,"(",fh),we(n,")",ph),we(n,"<",mh),we(n,">",gh),we(n,"(",xh),we(n,")",yh),we(n,"「",vh),we(n,"」",bh),we(n,"『",wh),we(n,"』",Nh),we(n,"<",jh),we(n,">",kh),we(n,"&",Sh),we(n,"*",Eh),we(n,"@",Oi),we(n,"`",Mh),we(n,"^",Ah),we(n,":",_i),we(n,",",w0),we(n,"$",Rh),we(n,".",ys),we(n,"=",Ih),we(n,"!",N0),we(n,"-",Dr),we(n,"%",vc),we(n,"|",Ph),we(n,"+",Oh),we(n,"#",Dh),we(n,"?",bc),we(n,'"',j0),we(n,"/",vs),we(n,";",k0),we(n,"~",wc),we(n,"_",Lh),we(n,"\\",Th),we(n,"・",VC);const r=Wt(n,Hs,v0,{[Gg]:!0});Wt(r,Hs,r);const s=Wt(r,Vs,FC,{[gc]:!0}),a=Wt(r,ec,BC,{[oc]:!0}),o=Wt(n,Vs,Ws,{[Jg]:!0});Wt(o,Hs,s),Wt(o,Vs,o),Wt(s,Hs,s),Wt(s,Vs,s);const c=Wt(n,ec,Xg,{[Yg]:!0});Wt(c,Vs),Wt(c,Hs,a),Wt(c,ec,c),Wt(a,Hs,a),Wt(a,Vs),Wt(a,ec,a);const u=we(n,Xm,b0,{[Jm]:!0}),h=we(n,xw,tx,{[Jm]:!0}),f=Wt(n,Qm,tx,{[Jm]:!0});we(n,Zm,f),we(h,Xm,u),we(h,Zm,f),Wt(h,Qm,f),we(f,xw),we(f,Xm),Wt(f,Qm,f),we(f,Zm,f);const m=Wt(n,Ym,HC,{[$C]:!0});we(m,"#"),Wt(m,Ym,m),we(m,dz,m);const g=we(m,uz);we(g,"#"),Wt(g,Ym,m);const y=[[Vs,o],[Hs,s]],v=[[Vs,null],[ec,c],[Hs,a]];for(let j=0;jj[0]>w[0]?1:-1);for(let j=0;j=0?E[Qg]=!0:Vs.test(w)?Hs.test(w)?E[gc]=!0:E[Jg]=!0:E[Gg]=!0,gw(n,w,w,E)}return gw(n,"localhost",Lc,{ascii:!0}),n.jd=new dr(_h),{start:n,tokens:Object.assign({groups:e},WC)}}function UC(t,e){const n=fz(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,s=[];let a=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,a+=n[o].length,o++;a-=m,o-=g,h-=m,s.push({t:f.t,v:e.slice(a-h,a),s:a-h,e:a})}return s}function fz(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(a=t.charCodeAt(r+1))<56320||a>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Mi(t,e,n,r,s){let a;const o=e.length;for(let c=0;c=0;)a++;if(a>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+a),10);o>0;o--)n.pop();r+=a}else n.push(t[r]),r++}return e}const _c={defaultProtocol:"http",events:null,format:vw,formatHref:vw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function S0(t,e=null){let n=Object.assign({},_c);t&&(n=Object.assign(n,t instanceof S0?t.o:t));const r=n.ignoreTags,s=[];for(let a=0;an?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=_c.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),a=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:s,attributes:o,content:a,eventListeners:m}}};function gf(t,e){class n extends KC{constructor(s,a){super(s,a),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const bw=gf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ww=gf("text"),pz=gf("nl"),Su=gf("url",{isLink:!0,toHref(t=_c.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Lc&&t[1].t===_i}}),Or=t=>new dr(t);function mz({groups:t}){const e=t.domain.concat([Sh,Eh,Oi,Th,Mh,Ah,Rh,Ih,Dr,v0,vc,Ph,Oh,Dh,vs,_h,wc,Lh]),n=[Ch,_i,w0,ys,N0,vc,bc,j0,k0,mh,gh,xc,yc,hh,uh,fh,ph,xh,yh,vh,bh,wh,Nh,jh,kh],r=[Sh,Ch,Eh,Th,Mh,Ah,Rh,Ih,Dr,xc,yc,vc,Ph,Oh,Dh,bc,vs,_h,wc,Lh],s=Or(),a=we(s,wc);it(a,r,a),it(a,t.domain,a);const o=Or(),c=Or(),u=Or();it(s,t.domain,o),it(s,t.scheme,c),it(s,t.slashscheme,u),it(o,r,a),it(o,t.domain,o);const h=we(o,Oi);we(a,Oi,h),we(c,Oi,h),we(u,Oi,h);const f=we(a,ys);it(f,r,a),it(f,t.domain,a);const m=Or();it(h,t.domain,m),it(m,t.domain,m);const g=we(m,ys);it(g,t.domain,m);const y=Or(bw);it(g,t.tld,y),it(g,t.utld,y),we(h,Lc,y);const v=we(m,Dr);we(v,Dr,v),it(v,t.domain,m),it(y,t.domain,m),we(y,ys,g),we(y,Dr,v);const j=we(y,_i);it(j,t.numeric,bw);const w=we(o,Dr),k=we(o,ys);we(w,Dr,w),it(w,t.domain,o),it(k,r,a),it(k,t.domain,o);const E=Or(Su);it(k,t.tld,E),it(k,t.utld,E),it(E,t.domain,o),it(E,r,a),we(E,ys,k),we(E,Dr,w),we(E,Oi,h);const C=we(E,_i),M=Or(Su);it(C,t.numeric,M);const D=Or(Su),F=Or();it(D,e,D),it(D,n,F),it(F,e,D),it(F,n,F),we(E,vs,D),we(M,vs,D);const R=we(c,_i),I=we(u,_i),A=we(I,vs),O=we(A,vs);it(c,t.domain,o),we(c,ys,k),we(c,Dr,w),it(u,t.domain,o),we(u,ys,k),we(u,Dr,w),it(R,t.domain,D),we(R,vs,D),we(R,bc,D),it(O,t.domain,D),it(O,e,D),we(O,vs,D);const W=[[xc,yc],[uh,hh],[fh,ph],[mh,gh],[xh,yh],[vh,bh],[wh,Nh],[jh,kh]];for(let X=0;X=0&&g++,s++,f++;if(g<0)s-=f,s0&&(a.push(eg(ww,e,o)),o=[]),s-=g,f-=g;const y=m.t,v=n.slice(s-f,s);a.push(eg(y,e,v))}}return o.length>0&&a.push(eg(ww,e,o)),a}function eg(t,e,n){const r=n[0].s,s=n[n.length-1].e,a=e.slice(r,s);return new t(a,n)}const xz=typeof console<"u"&&console&&console.warn||(()=>{}),yz="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",At={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function vz(){return dr.groups={},At.scanner=null,At.parser=null,At.tokenQueue=[],At.pluginQueue=[],At.customSchemes=[],At.initialized=!1,At}function Nw(t,e=!1){if(At.initialized&&xz(`linkifyjs: already initialized - will not register custom scheme "${t}" ${yz}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. -1. Must only contain digits, lowercase ASCII letters or "-" -2. Cannot start or end with "-" -3. "-" cannot repeat`);At.customSchemes.push([t,e])}function bz(){At.scanner=hz(At.customSchemes);for(let t=0;t{const s=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),a=e.some(h=>h.getMeta("preventAutolink"));if(!s||a)return;const{tr:o}=r,c=sC(n.doc,[...e]);if(hC(c).forEach(({newRange:h})=>{const f=k8(r.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(h.from,h.to," "," ");if(!Nz.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(wz).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],j=m.pos+g.lastIndexOf(v);if(!v)return!1;const w=C0(v).map(k=>k.toObject(t.defaultProtocol));if(!kz(w))return!1;w.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{f0(k.from,k.to,r.doc).some(E=>E.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function Cz(t){return new Ct({key:new _t("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,a;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=uC(e.state,t.type.name),h=(s=o.href)!=null?s:u.href,f=(a=o.target)!=null?a:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function Ez(t){return new Ct({key:new _t("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:a}=e,{selection:o}=a,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=qC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||s!==void 0&&!s(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function Ma(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(jz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var GC=to.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Nw(t);return}Nw(t.scheme,t.optionalSlashes)})},onDestroy(){vz()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ma(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ma(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ma(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bt(this.options.HTMLAttributes,t),0]:["a",bt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,a;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(a=(s=t.attrs)==null?void 0:s.title)!=null?a:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ma(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Ma(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Ga({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=qC(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!Ma(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(a=>{this.options.shouldAutoLink(a.value)&&e.push({text:a.value,data:{href:a.href},index:a.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Sz({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Ma(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Cz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Ez({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Tz=GC,Mz=Object.defineProperty,Az=(t,e)=>{for(var n in e)Mz(t,n,{get:e[n],enumerable:!0})},Rz="listItem",jw="textStyle",kw=/^\s*([-+*])\s$/,JC=fn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Rz,this.editor.getAttributes(jw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=sl({find:kw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=sl({find:kw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(jw),editor:this.editor})),[t]}}),YC=fn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))n=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>x0(t,e,r=>{var s,a;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((a=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:a.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Iz={};Az(Iz,{findListItemPos:()=>Gc,getNextListDepth:()=>T0,handleBackspace:()=>nx,handleDelete:()=>rx,hasListBefore:()=>QC,hasListItemAfter:()=>Pz,hasListItemBefore:()=>XC,listItemHasSubList:()=>ZC,nextListIsDeeper:()=>e2,nextListIsHigher:()=>t2});var Gc=(t,e)=>{const{$from:n}=e.selection,r=ln(t,e.schema);let s=null,a=n.depth,o=n.pos,c=null;for(;a>0&&c===null;)s=n.node(a),s.type===r?c=a:(a-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},T0=(t,e)=>{const n=Gc(t,e);if(!n)return!1;const[,r]=O8(e,t,n.$pos.pos+4);return r},QC=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),a=t.doc.resolve(s).node();return!(!a||!n.includes(a.type.name))},XC=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},ZC=(t,e,n)=>{if(!n)return!1;const r=ln(t,e.schema);let s=!1;return n.descendants(a=>{a.type===r&&(s=!0)}),s},nx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ea(t.state,e)&&QC(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,y)=>{g.type.name===e&&h.push({node:g,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!ea(t.state,e)||!z8(t.state))return!1;const r=Gc(e,t.state);if(!r)return!1;const a=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=ZC(e,t.state,a);return XC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},e2=(t,e)=>{const n=T0(t,e),r=Gc(t,e);return!r||!n?!1:n>r.depth},t2=(t,e)=>{const n=T0(t,e),r=Gc(t,e);return!r||!n?!1:n{if(!ea(t.state,e)||!_8(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:e2(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():t2(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Pz=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},n2=Gt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&rx(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&rx(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&nx(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&nx(t,n,r)&&(e=!0)}),e}}}}),Sw=/^(\s*)(\d+)\.\s+(.*)$/,Oz=/^\s/;function Dz(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(j=>j.indent)),v=r2(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:v,raw:g.map(j=>j.raw).join(` -`)})}s.push({type:"list_item",raw:o.raw,tokens:h}),a=m}else a+=1}return s}function Lz(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const a=e.parseChildren([s]);r.push({type:"paragraph",content:a})}else{const a=e.parseChildren([s]);a.length>0&&r.push(...a)}}),{type:"listItem",content:r}})}var _z="listItem",Cw="textStyle",Ew=/^(\d+)\.\s$/,s2=fn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",bt(this.options.HTMLAttributes,n),0]:["ol",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?Lz(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(` -`),[a,o]=Dz(s);if(a.length===0)return;const c=r2(a,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=a[0])==null?void 0:r.number)||1,items:c,raw:s.slice(0,o).join(` -`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_z,this.editor.getAttributes(Cw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=sl({find:Ew,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=sl({find:Ew,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Cw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),zz=/^\s*(\[([( |x])?\])\s$/,$z=fn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",bt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return x0(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),a=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),a.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const v=n();if(typeof v!="number")return!1;const j=y.doc.nodeAt(v);return y.setNodeMarkup(v,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{s.setAttribute(m,g)}),s.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,a.append(c,o),s.append(a,u),Object.entries(e).forEach(([m,g])=>{s.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:s,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;s.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=Dc(m,g),v=new Set(Object.keys(y)),j=this.options.HTMLAttributes;return f.forEach(w=>{v.has(w)||(w in j?s.setAttribute(w,j[w]):s.removeAttribute(w))}),Object.entries(y).forEach(([w,k])=>{k==null?w in j?s.setAttribute(w,j[w]):s.removeAttribute(w):s.setAttribute(w,k)}),f=v,!0}}}},addInputRules(){return[sl({find:zz,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Fz=fn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=a=>{const o=Kg(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(a)},s=Kg(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,o)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Gt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(JC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(YC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(n2.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(s2.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push($z.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Fz.configure(this.options.taskList)),t}});var Tw=" ",Bz=" ",Vz=fn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",bt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Tw||r[0].text===Bz)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?Tw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Wz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Uz=to.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[rl({find:Hz,type:this.type})]},addPasteRules(){return[Ga({find:Wz,type:this.type})]}}),Kz=fn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),qz=to.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",bt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const a=s[2].trim();return{type:"underline",raw:s[0],text:a,tokens:n.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Gz(t={}){return new Ct({view(e){return new Jz(e,t)}})}class Jz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let a=o=>{this[s](o)};return e.dom.addEventListener(s,a),{name:s,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,a=s.getBoundingClientRect(),o=a.width/s.offsetWidth,c=a.height/s.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let v=y.getBoundingClientRect(),j=m?v.bottom:v.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let w=this.width/2*c;r={left:v.left,right:v.right,top:j-w,bottom:j+w}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*y}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,a=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!a){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=Yk(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Kt extends Ge{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Kt.valid(r)?new Kt(r):Ge.near(r)}content(){return Me.empty}eq(e){return e instanceof Kt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Kt(e.resolve(n.pos))}getBookmark(){return new M0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Yz(e)||!Qz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Kt.valid(e))return e;let s=e.pos,a=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){a=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let u=e.doc.resolve(s);if(Kt.valid(u))return u}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Ve.isSelectable(a)){e=e.doc.resolve(s+a.nodeSize*n),r=!1;continue e}break}a=o,s+=n;let c=e.doc.resolve(s);if(Kt.valid(c))return c}return null}}}Kt.prototype.visible=!1;Kt.findFrom=Kt.findGapCursorFrom;Ge.jsonID("gapcursor",Kt);class M0{constructor(e){this.pos=e}map(e){return new M0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Kt.valid(n)?new Kt(n):Ge.near(n)}}function i2(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Yz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||i2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Qz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||i2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Xz(){return new Ct({props:{decorations:n7,createSelectionBetween(t,e,n){return e.pos==n.pos&&Kt.valid(n)?new Kt(n):null},handleClick:e7,handleKeyDown:Zz,handleDOMEvents:{beforeinput:t7}}})}const Zz=o0({ArrowLeft:Cu("horiz",-1),ArrowRight:Cu("horiz",1),ArrowUp:Cu("vert",-1),ArrowDown:Cu("vert",1)});function Cu(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,a){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof He){if(!a.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Kt.findGapCursorFrom(c,e,u);return h?(s&&s(r.tr.setSelection(new Kt(h))),!0):!1}}function e7(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Kt.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Ve.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Kt(r))),!0)}function t7(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Kt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=pe.empty;for(let o=r.length-1;o>=0;o--)s=pe.from(r[o].createAndFill(null,s));let a=t.state.tr.replace(n.pos,n.pos,new Me(s,0,0));return a.setSelection(He.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function n7(t){if(!(t.selection instanceof Kt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Nt.create(t.doc,[hn.widget(t.selection.head,e,{key:"gapcursor"})])}var zh=200,jn=function(){};jn.prototype.append=function(e){return e.length?(e=jn.from(e),!this.length&&e||e.length=n?jn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};jn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};jn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};jn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(a,o){return s.push(e(a,o))},n,r),s};jn.from=function(e){return e instanceof jn?e:e&&e.length?new a2(e):jn.empty};var a2=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,a){return s==0&&a==this.length?this:new e(this.values.slice(s,a))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,a,o,c){for(var u=a;u=o;u--)if(s(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=zh)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=zh)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(jn);jn.empty=new a2([]);var r7=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(s-c,0),Math.min(this.length,a)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,a,o){var c=this.left.length;if(s>c&&this.right.forEachInvertedInner(r,s-c,Math.max(a,c)-c,o+c)===!1||a=a?this.right.slice(r-a,s-a):this.left.slice(r,a).append(this.right.slice(0,s-a))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(jn);const s7=500;class Qr{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,a;n&&(s=this.remapping(r,this.items.length),a=s.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){s||(s=this.remapping(r,g+1),a=s.maps.length),a--,f.push(m);return}if(s){f.push(new Ai(m.map));let y=m.step.map(s.slice(a)),v;y&&o.maybeStep(y).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],h.push(new Ai(v,void 0,void 0,h.length+f.length))),a--,v&&s.appendMap(v,a)}else o.maybeStep(m.step);if(m.selection)return c=s?m.selection.map(s.slice(a)):m.selection,u=new Qr(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,s){let a=[],o=this.eventCount,c=this.items,u=!s&&c.length?c.get(c.length-1):null;for(let f=0;fa7&&(c=i7(c,h),o-=h),new Qr(c.append(a),o)}remapping(e,n){let r=new Mc;return this.items.forEach((s,a)=>{let o=s.mirrorOffset!=null&&a-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Qr(this.items.append(e.map(n=>new Ai(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),a=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},s);let u=n;this.items.forEach(g=>{let y=a.getMirror(--u);if(y==null)return;o=Math.min(o,y);let v=a.maps[y];if(g.step){let j=e.steps[y].invert(e.docs[y]),w=g.selection&&g.selection.map(a.slice(u+1,y));w&&c++,r.push(new Ai(v,j,w))}else r.push(new Ai(v))},s);let h=[];for(let g=n;gs7&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],a=0;return this.items.forEach((o,c)=>{if(c>=e)s.push(o),o.selection&&a++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&a++;let m=new Ai(h.invert(),u,f),g,y=s.length-1;(g=s.length&&s[y].merge(m))?s[y]=g:s.push(m)}}else o.map&&r--},this.items.length,0),new Qr(jn.from(s.reverse()),a)}}Qr.empty=new Qr(jn.empty,0);function i7(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}let Ai=class o2{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new o2(n.getMap().invert(),n,this.selection)}}};class Di{constructor(e,n,r,s,a){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=a}}const a7=20;function o7(t,e,n,r){let s=n.getMeta(Ba),a;if(s)return s.historyState;n.getMeta(d7)&&(t=new Di(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ba))return o.getMeta(Ba).redo?new Di(t.done.addTransform(n,void 0,r,$u(e)),t.undone,Mw(n.mapping.maps),t.prevTime,t.prevComposition):new Di(t.done,t.undone.addTransform(n,void 0,r,$u(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!l7(n,t.prevRanges)),h=o?tg(t.prevRanges,n.mapping):Mw(n.mapping.maps);return new Di(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,$u(e)),Qr.empty,h,n.time,c??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Di(t.done.rebased(n,a),t.undone.rebased(n,a),tg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Di(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),tg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function l7(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let a=0;a=e[a]&&(n=!0)}),n}function Mw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,a,o)=>e.push(a,o));return e}function tg(t,e){if(!t)return null;let n=[];for(let r=0;r{let s=Ba.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let a=c7(s,n,t);a&&r(e?a.scrollIntoView():a)}return!0}}const c2=l2(!1,!0),d2=l2(!0,!0);Gt.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ct({key:new _t("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>s){const o=a-s,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=r||s>r&&a>r&&a<=s)return!0;if(s>r&&a>r&&a>s||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=a-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var h7=Gt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Gz(this.options)]}});Gt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ct({key:new _t("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,a=[];if(!n||!r)return Nt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(s>=h&&s<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(s>=h&&s<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";a.push(hn.node(h,h+u.nodeSize,{class:this.options.className}))}),Nt.create(t,a)}}})]}});var f7=Gt.create({name:"gapCursor",addProseMirrorPlugins(){return[Xz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=mt($e(t,"allowGapCursor",n)))!=null?e:null}}}),Rw="placeholder";function p7(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var m7=Gt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Rw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${p7(this.options.dataAttribute)}`:`data-${Rw}`;return[new Ct({key:new _t("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=n,a=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=s>=u&&s<=u+c.nodeSize,f=!c.isLeaf&&ff(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=hn.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});a.push(g)}return this.options.includeChildren}),Nt.create(e,a)}}})]}});Gt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ct({key:new _t("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||fC(n.selection)||t.view.dragging?null:Nt.create(n.doc,[hn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Iw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var g7=Gt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new _t(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Ct({key:e,appendTransaction:(s,a,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(s,a)=>{const o=a.tr.doc.lastChild;return!Iw({node:o,types:r})},apply:(s,a)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return a;const o=s.doc.lastChild;return!Iw({node:o,types:r})}}})]}}),x7=Gt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>c2(t,e),redo:()=>({state:t,dispatch:e})=>d2(t,e)}},addProseMirrorPlugins(){return[u7(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),y7=Gt.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(V_.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(__.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(JC.configure(this.options.bulletList)),this.options.code!==!1&&s.push(U_.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(G_.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(J_.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(h7.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(f7.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(Y_.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(Q_.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(x7.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(X_.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(rz.configure(this.options.italic)),this.options.listItem!==!1&&s.push(YC.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(n2.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(GC.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(s2.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Vz.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Uz.configure(this.options.strike)),this.options.text!==!1&&s.push(Kz.configure(this.options.text)),this.options.underline!==!1&&s.push(qz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(g7.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),v7=y7,b7=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,w7=fn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",bt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,a,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",h=(o=(a=t.attrs)==null?void 0:a.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:a,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new k6({element:u,editor:c,node:s,getPos:a,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const y=a();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,y)=>m.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[AC({find:b7,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),N7=w7;function j7(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:a,startOfLine:o,$position:c}=t,u=r&&!s,h=C6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=s?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),v=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!v)return null;const j=c.pos-v.length,w=Array.from(v.matchAll(y)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const k=w.input.slice(Math.max(0,w.index-1),w.index),E=new RegExp(`^[${a==null?void 0:a.join("")}\0]?$`).test(k);if(a!==null&&!E)return null;const C=j+w.index;let M=C+w[0].length;return u&&f.test(v.slice(M-1,M+1))&&(w[0]+=" ",M+=1),C=c.pos?{range:{from:C,to:M},query:w[0].slice(n.length),text:w[0]}:null}var k7=new _t("suggestion");function S7({pluginKey:t=k7,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:a=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:j=j7,shouldShow:w}){let k;const E=y==null?void 0:y(),C=()=>{const R=e.state.selection.$anchor.pos,I=e.view.coordsAtPos(R),{top:A,right:O,bottom:W,left:X}=I;try{return new DOMRect(X,A,O-X,W-A)}catch{return null}},M=(R,I)=>I?()=>{const A=t.getState(e.state),O=A==null?void 0:A.decorationId,W=R.dom.querySelector(`[data-decoration-id="${O}"]`);return(W==null?void 0:W.getBoundingClientRect())||null}:C;function D(R,I){var A;try{const W=t.getState(R.state),X=W!=null&&W.decorationId?R.dom.querySelector(`[data-decoration-id="${W.decorationId}"]`):null,q={editor:e,range:(W==null?void 0:W.range)||{from:0,to:0},query:(W==null?void 0:W.query)||null,text:(W==null?void 0:W.text)||null,items:[],command:Z=>m({editor:e,range:(W==null?void 0:W.range)||{from:0,to:0},props:Z}),decorationNode:X,clientRect:M(R,X)};(A=E==null?void 0:E.onExit)==null||A.call(E,q)}catch{}const O=R.state.tr.setMeta(I,{exit:!0});R.dispatch(O)}const F=new Ct({key:t,view(){return{update:async(R,I)=>{var A,O,W,X,q,Z,_;const $=(A=this.key)==null?void 0:A.getState(I),oe=(O=this.key)==null?void 0:O.getState(R.state),V=$.active&&oe.active&&$.range.from!==oe.range.from,ae=!$.active&&oe.active,Y=$.active&&!oe.active,L=!ae&&!Y&&$.query!==oe.query,H=ae||V&&L,ue=L||V,U=Y||V&&L;if(!H&&!ue&&!U)return;const he=U&&!H?$:oe,Q=R.dom.querySelector(`[data-decoration-id="${he.decorationId}"]`);k={editor:e,range:he.range,query:he.query,text:he.text,items:[],command:ee=>m({editor:e,range:he.range,props:ee}),decorationNode:Q,clientRect:M(R,Q)},H&&((W=E==null?void 0:E.onBeforeStart)==null||W.call(E,k)),ue&&((X=E==null?void 0:E.onBeforeUpdate)==null||X.call(E,k)),(ue||H)&&(k.items=await g({editor:e,query:he.query})),U&&((q=E==null?void 0:E.onExit)==null||q.call(E,k)),ue&&((Z=E==null?void 0:E.onUpdate)==null||Z.call(E,k)),H&&((_=E==null?void 0:E.onStart)==null||_.call(E,k))},destroy:()=>{var R;k&&((R=E==null?void 0:E.onExit)==null||R.call(E,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(R,I,A,O){const{isEditable:W}=e,{composing:X}=e.view,{selection:q}=R,{empty:Z,from:_}=q,$={...I},oe=R.getMeta(t);if(oe&&oe.exit)return $.active=!1,$.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null,$;if($.composing=X,W&&(Z||e.view.composing)){(_I.range.to)&&!X&&!I.composing&&($.active=!1);const V=j({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:a,startOfLine:o,$position:q.$from}),ae=`id_${Math.floor(Math.random()*4294967295)}`;V&&v({editor:e,state:O,range:V.range,isActive:I.active})&&(!w||w({editor:e,range:V.range,query:V.query,text:V.text,transaction:R}))?($.active=!0,$.decorationId=I.decorationId?I.decorationId:ae,$.range=V.range,$.query=V.query,$.text=V.text):$.active=!1}else $.active=!1;return $.active||($.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null),$}},props:{handleKeyDown(R,I){var A,O,W,X;const{active:q,range:Z}=F.getState(R.state);if(!q)return!1;if(I.key==="Escape"||I.key==="Esc"){const $=F.getState(R.state),oe=(A=k==null?void 0:k.decorationNode)!=null?A:null,V=oe??($!=null&&$.decorationId?R.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`):null);if(((O=E==null?void 0:E.onKeyDown)==null?void 0:O.call(E,{view:R,event:I,range:$.range}))||!1)return!0;const Y={editor:e,range:$.range,query:$.query,text:$.text,items:[],command:L=>m({editor:e,range:$.range,props:L}),decorationNode:V,clientRect:V?()=>V.getBoundingClientRect()||null:null};return(W=E==null?void 0:E.onExit)==null||W.call(E,Y),D(R,t),!0}return((X=E==null?void 0:E.onKeyDown)==null?void 0:X.call(E,{view:R,event:I,range:Z}))||!1},decorations(R){const{active:I,range:A,decorationId:O,query:W}=F.getState(R);if(!I)return null;const X=!(W!=null&&W.length),q=[u];return X&&q.push(f),Nt.create(R.doc,[hn.inline(A.from,A.to,{nodeName:c,class:q.join(" "),"data-decoration-id":O,"data-decoration-content":h})])}}});return F}function C7({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const s=new _t;return{editor:t,char:r,pluginKey:s,command:({editor:a,range:o,props:c})=>{var u,h,f;const m=a.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),a.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=a.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:a,range:o})=>{const c=a.doc.resolve(o.from),u=a.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function u2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>C7({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Pw(t,e){const n=u2(t),r=n.find(s=>s.char===e);return r||(n.length?n[0]:null)}var E7=fn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,s;return["span",bt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Pw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=bt({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof s=="string"?["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...RC({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,a,o]=r,c=a??o;e[s==="char"?"mentionSuggestionChar":s]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:Pw(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:s,anchor:a}=r;if(!s)return!1;let o=new Js,c=0;return e.doc.nodesBetween(a-1,a,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return u2(this).map(S7)}}),T7=E7,M7=m7;let sx,ix;if(typeof WeakMap<"u"){let t=new WeakMap;sx=e=>t.get(e),ix=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;sx=r=>{for(let s=0;s(n==10&&(n=0),t[n++]=r,t[n++]=s)}var qt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(a||(a=[])).push({type:"overlong_rowspan",pos:f,n:k-C});break}const M=s+C*e;for(let D=0;Dr&&(a+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=a:e!=a&&(e=Math.max(e,a))}return e}function I7(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function O7(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function rs(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function xf(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Ja(e.$head)||D7(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function D7(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function ax(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function L7(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function A0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function h2(t,e,n){const r=t.node(-1),s=qt.get(r),a=t.start(-1),o=s.nextCell(t.pos-a,e,n);return o==null?null:t.node(0).resolve(a+o)}function Ya(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function f2(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;sf!=n.pos-a);u.unshift(n.pos-a);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=a+f+1;return new tS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(ax(r)&&ax(s)&&A0(r,s)){const a=this.$anchorCell.node(-1)!=r.node(-1);return a&&this.isRowSelection()?Us.rowSelection(r,s):a&&this.isColSelection()?Us.colSelection(r,s):new Us(r,s)}return He.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=qt.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),a={},o=[];for(let u=s.top;u0||w>0){let k=v.attrs;if(j>0&&(k=Ya(k,0,j)),w>0&&(k=Ya(k,k.colspan-w,w)),y.lefts.bottom){const k={...v.attrs,rowspan:Math.min(y.bottom,s.bottom)-Math.max(y.top,s.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=qt.get(r),a=e.start(-1),o=s.findCell(e.pos-a),c=s.findCell(n.pos-a),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(a+s.map[o.left])),c.bottom0&&(n=u.resolve(a+s.map[c.left])),o.bottom0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,c=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof Us&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=qt.get(r),a=e.start(-1),o=s.findCell(e.pos-a),c=s.findCell(n.pos-a),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(a+s.map[o.top*s.width])),c.right0&&(n=u.resolve(a+s.map[c.top*s.width])),o.right{e.push(hn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Nt.create(t.doc,e)}function F7({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(s+1)=0&&!(e.before(a+1)>e.start(a));a--,r--);return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function B7({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const a=t.node(s);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}for(let s=e.depth;s>0;s--){const a=e.node(s);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){r=a;break}}return n!==r&&e.parentOffset===0}function V7(t,e,n){const r=(e||t).selection,s=(e||t).doc;let a,o;if(r instanceof Ve&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")a=St.create(s,r.from);else if(o=="row"){const c=s.resolve(r.from+1);a=St.rowSelection(c,c)}else if(!n){const c=qt.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];a=St.create(s,u+1,h)}}else r instanceof He&&F7(r)?a=He.create(s,r.from):r instanceof He&&B7(r)&&(a=He.create(s,r.$from.start(),r.$from.end()));return a&&(e||(e=t.tr)).setSelection(a),e}const H7=new _t("fix-tables");function m2(t,e,n,r){const s=t.childCount,a=e.childCount;e:for(let o=0,c=0;o{s.type.spec.tableRole=="table"&&(n=W7(t,s,a,n))};return e?e.doc!=t.doc&&m2(e.doc,t.doc,0,r):t.doc.descendants(r),n}function W7(t,e,n,r){const s=qt.get(e);if(!s.problems)return r;r||(r=t.tr);const a=[];for(let u=0;u0){let y="cell";f.firstChild&&(y=f.firstChild.type.spec.tableRole);const v=[];for(let w=0;w0?-1:0;_7(e,r,s+a)&&(a=s==0||s==e.width?null:0);for(let o=0;o0&&s0&&e.map[c-1]==u||s0?-1:0;J7(e,r,s+c)&&(c=s==0||s==e.height?null:0);for(let h=0,f=e.width*s;h0&&s0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(s0&&n[a]==n[a-1]||r.right0&&n[s]==n[s-t]||r.bottom0){const f=u+1+h.content.size,m=Ow(h)?u+1:f;a.replaceWith(m+r.tableStart,f+r.tableStart,c)}a.setSelection(new St(a.doc.resolve(u+r.tableStart))),e(a)}return!0}function Lw(t,e){const n=Wn(t.schema);return t$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function t$(t){return(e,n)=>{const r=e.selection;let s,a;if(r instanceof St){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{var o;if(s=O7(r.$from),!s)return!1;a=(o=Ja(r.$from))===null||o===void 0?void 0:o.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let c=s.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Es(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&a.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):a.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(a)}return!0}}function r$(t){return function(e,n){if(!rs(e))return!1;if(n){const r=Wn(e.schema),s=Es(e),a=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),c=o.map(u=>s.table.nodeAt(u));for(let u=0;u{const y=g+a.tableStart,v=o.doc.nodeAt(y);v&&o.setNodeMarkup(y,m,v.attrs)}),r(o)}return!0}}zc("row",{useDeprecatedLogic:!0});zc("column",{useDeprecatedLogic:!0});const s$=zc("cell",{useDeprecatedLogic:!0});function i$(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const a=t.node(-1).child(r),o=a.lastChild;if(o)return s-1-o.nodeSize;s-=a.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Eu(t,e){const n=t.selection;if(!(n instanceof St))return!1;if(e){const r=t.tr,s=Wn(t.schema).cell.createAndFill().content;n.forEachCell((a,o)=>{a.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+a.nodeSize-1),new Me(s,0,0))}),r.docChanged&&e(r)}return!0}function o$(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const s=e.child(0),a=s.type.spec.tableRole,o=s.type.schema,c=[];if(a=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=a.child(o).attrs;for(let h=s;h=e.length&&e.push(pe.empty),n[s]r&&(g=g.type.createChecked(Ya(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;ys&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,s-m.attrs.rowspan)},m.content)),u.push(m)}a.push(pe.from(u))}n=a,e=s}return{width:t,height:e,rows:n}}function d$(t,e,n,r,s,a,o){const c=t.doc.type.schema,u=Wn(c);let h,f;if(s>e.width)for(let m=0,g=0;me.height){const m=[];for(let v=0,j=(e.height-1)*e.width;v=e.width?!1:n.nodeAt(e.map[j+v]).type==u.header_cell;m.push(w?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,pe.from(m)),y=[];for(let v=e.height;v{if(!s)return!1;const a=n.selection;if(a instanceof St)return Fu(n,r,Ge.near(a.$headCell,e));if(t!="horiz"&&!a.empty)return!1;const o=v2(s,t,e);if(o==null)return!1;if(t=="horiz")return Fu(n,r,Ge.near(n.doc.resolve(a.head+e),e));{const c=n.doc.resolve(o),u=h2(c,t,e);let h;return u?h=Ge.near(u,1):e<0?h=Ge.near(n.doc.resolve(c.before(-1)),-1):h=Ge.near(n.doc.resolve(c.after(-1)),1),Fu(n,r,h)}}}function Mu(t,e){return(n,r,s)=>{if(!s)return!1;const a=n.selection;let o;if(a instanceof St)o=a;else{const u=v2(s,t,e);if(u==null)return!1;o=new St(n.doc.resolve(u))}const c=h2(o.$headCell,t,e);return c?Fu(n,r,new St(o.$anchorCell,c)):!1}}function h$(t,e){const n=t.state.doc,r=Ja(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new St(r))),!0):!1}function f$(t,e,n){if(!rs(t.state))return!1;let r=o$(n);const s=t.state.selection;if(s instanceof St){r||(r={width:1,height:1,rows:[pe.from(ox(Wn(t.state.schema).cell,n))]});const a=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),c=qt.get(a).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=c$(r,c.right-c.left,c.bottom-c.top),Bw(t.state,t.dispatch,o,c,r),!0}else if(r){const a=xf(t.state),o=a.start(-1);return Bw(t.state,t.dispatch,o,qt.get(a.node(-1)).findCell(a.pos-o),r),!0}else return!1}function p$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Vw(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof St)a(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=Ja(t.state.selection.$anchor))!=null&&((n=rg(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)a(s,e),e.preventDefault();else if(!r)return;function a(u,h){let f=rg(t,h);const m=zi.getState(t.state)==null;if(!f||!A0(u,f))if(m)f=u;else return;const g=new St(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(zi,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),zi.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(zi,-1))}function c(u){const h=u,f=zi.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Vw(t,h.target)!=r&&(m=rg(t,e),!m))return o();m&&a(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function v2(t,e,n){if(!(t.state.selection instanceof He))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const a=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){const o=r.before(s),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Vw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function rg(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&Ja(t.state.doc.resolve(r))||Ja(t.state.doc.resolve(s))}var m$=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),lx(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,lx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function lx(t,e,n,r,s,a){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new x$(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=jr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{y$(o,c,t,s)},mouseleave:o=>{v$(o)},mousedown:(o,c)=>{b$(o,c,e,n)}},decorations:o=>{const c=jr.getState(o);if(c&&c.activeHandle>-1)return S$(o,c.activeHandle)},nodeViews:{}}});return a}var x$=class Bu{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(jr);if(r&&r.setHandle!=null)return new Bu(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Bu(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return ax(e.doc.resolve(s))||(s=-1),new Bu(s,n.dragging)}return n}};function y$(t,e,n,r){if(!t.editable)return;const s=jr.getState(t.state);if(s&&!s.dragging){const a=N$(e.target);let o=-1;if(a){const{left:c,right:u}=a.getBoundingClientRect();e.clientX-c<=n?o=Hw(t,e,"left",n):u-e.clientX<=n&&(o=Hw(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=qt.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}b2(t,o)}}}function v$(t){if(!t.editable)return;const e=jr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&b2(t,-1)}function b$(t,e,n,r){var s;if(!t.editable)return!1;const a=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,o=jr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=w$(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(jr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){a.removeEventListener("mouseup",h),a.removeEventListener("mousemove",f);const g=jr.getState(t.state);g!=null&&g.dragging&&(j$(t,g.activeHandle,Ww(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(jr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=jr.getState(t.state);if(g&&g.dragging){const y=Ww(g.dragging,m,n);Uw(t,g.activeHandle,y,r)}}return Uw(t,o.activeHandle,u,r),a.addEventListener("mouseup",h),a.addEventListener("mousemove",f),e.preventDefault(),!0}function w$(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const a=t.domAtPos(e);let o=a.node.childNodes[a.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),s=r?r.split(",").map(a=>parseInt(a,10)):null;if(!s){const a=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&a&&a[o]){const c=a[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return s}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",bt(this.options.HTMLAttributes,t),0]}}),N2=fn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",bt(this.options.HTMLAttributes,t),0]}}),j2=fn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}});function cx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Kw(t,e,n,r,s,a){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,y=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function A$(t,e,n,r,s){const a=M$(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!R$(e))return!1;let n=0;const r=iC(e.ranges[0].$from,a=>a.type.name==="table");return r==null||r.node.descendants(a=>{if(a.type.name==="table")return!1;["tableCell","tableHeader"].includes(a.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},I$="";function P$(t){return(t||"").replace(/\s+/g," ").trim()}function O$(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:I$;if(!t||!t.content||t.content.length===0)return"";const a=[];t.content.forEach(v=>{const j=[];v.content&&v.content.forEach(w=>{let k="";w.content&&Array.isArray(w.content)&&w.content.length>1?k=w.content.map(D=>e.renderChildren(D)).join(s):k=w.content?e.renderChildren(w.content):"";const E=P$(k),C=w.type==="tableHeader";j.push({text:E,isHeader:C})}),a.push(j)});const o=a.reduce((v,j)=>Math.max(v,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);a.forEach(v=>{var j;for(let w=0;wc[w]&&(c[w]=E),c[w]<3&&(c[w]=3)}});const u=(v,j)=>v+" ".repeat(Math.max(0,j-v.length)),h=a[0],f=h.some(v=>v.isHeader);let m=` -`;const g=new Array(o).fill(0).map((v,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((v,j)=>u(v,c[j])).join(" | ")} | -`,m+=`| ${c.map(v=>"-".repeat(Math.max(3,v))).join(" | ")} | -`,(f?a.slice(1):a).forEach(v=>{m+=`| ${new Array(o).fill(0).map((j,w)=>u(v[w]&&v[w].text||"",c[w])).join(" | ")} | -`}),m}var D$=O$,k2=fn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:E$,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=T$(t,this.options.cellMinWidth),a=e.style;function o(){return a||(r?`width: ${r}`:`min-width: ${s}`)}const c=["table",bt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(s=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const s=[];r.forEach(a=>{s.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>D$(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:a})=>{const o=A$(a.schema,t,e,n);if(s){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(He.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>U7(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>K7(t,e),deleteColumn:()=>({state:t,dispatch:e})=>G7(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Y7(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Q7(t,e),deleteRow:()=>({state:t,dispatch:e})=>Z7(t,e),deleteTable:()=>({state:t,dispatch:e})=>a$(t,e),mergeCells:()=>({state:t,dispatch:e})=>Dw(t,e),splitCell:()=>({state:t,dispatch:e})=>Lw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>zc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>zc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>s$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Dw(t,e)?!0:Lw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>n$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>zw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>zw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&g2(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=St.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Au,"Mod-Backspace":Au,Delete:Au,"Mod-Delete":Au}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[g$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],C$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:mt($e(t,"tableRole",e))}}});Gt.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(k2.configure(this.options.table)),this.options.tableCell!==!1&&t.push(w2.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(N2.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(j2.configure(this.options.tableRow)),t}});function L$(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 - -`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 - -`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 - -`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 - -`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 -`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` -`),e=e.replace(//gi,` -`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 - -`),e=e.replace(//gi,`--- - -`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` - -`),e.trim()}function Gw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),e=e.replace(/^## (.+)$/gm,"

$1

"),e=e.replace(/^# (.+)$/gm,"

$1

"),e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/\*(.+?)\*/g,"$1"),e=e.replace(/~~(.+?)~~/g,"$1"),e=e.replace(/`([^`]+)`/g,"$1"),e=e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'$1'),e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1'),e=e.replace(/^> (.+)$/gm,"

$1

"),e=e.replace(/^---$/gm,"
"),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` -`),r=[];for(const s of n){const a=s.trim();a&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(a)?r.push(a):r.push(`

    ${a}

    `))}return r.join("")}const _$=t=>({items:({query:e})=>t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase())||n.id.includes(e)).slice(0,8),render:()=>{let e=null,n=0,r=[],s=null;const a=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    - @${o.name} - ${o.label||o.id} -
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");s&&r[c]&&s({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,s=o.command,n=0,a(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,s=o.command,n=0,a(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),a(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),a(),!0):o.event.key==="Enter"?(s&&r[n]&&s({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}}),S2=b.forwardRef(({content:t,onChange:e,onImageUpload:n,persons:r=[],linkTags:s=[],placeholder:a="开始编辑内容...",className:o},c)=>{const u=b.useRef(null),[h,f]=b.useState(""),[m,g]=b.useState(!1),y=b.useRef(Gw(t)),v=I_({extensions:[v7,N7.configure({inline:!0,allowBase64:!0}),Tz.configure({openOnClick:!1,HTMLAttributes:{class:"rich-link"}}),T7.configure({HTMLAttributes:{class:"mention-tag"},suggestion:_$(r)}),M7.configure({placeholder:a}),k2.configure({resizable:!0}),j2,w2,N2],content:y.current,onUpdate:({editor:E})=>{e(E.getHTML())},editorProps:{attributes:{class:"rich-editor-content"}}});b.useImperativeHandle(c,()=>({getHTML:()=>(v==null?void 0:v.getHTML())||"",getMarkdown:()=>L$((v==null?void 0:v.getHTML())||"")})),b.useEffect(()=>{if(v&&t!==v.getHTML()){const E=Gw(t);E!==v.getHTML()&&v.commands.setContent(E)}},[t]);const j=b.useCallback(async E=>{var M;const C=(M=E.target.files)==null?void 0:M[0];if(!(!C||!v)){if(n){const D=await n(C);D&&v.chain().focus().setImage({src:D}).run()}else{const D=new FileReader;D.onload=()=>{typeof D.result=="string"&&v.chain().focus().setImage({src:D.result}).run()},D.readAsDataURL(C)}E.target.value=""}},[v,n]),w=b.useCallback(E=>{v&&v.chain().focus().insertContent({type:"text",marks:[{type:"link",attrs:{href:E.url,target:"_blank"}}],text:`#${E.label}`}).run()},[v]),k=b.useCallback(()=>{!v||!h||(v.chain().focus().setLink({href:h}).run(),f(""),g(!1))},[v,h]);return v?i.jsxs("div",{className:`rich-editor-wrapper ${o||""}`,children:[i.jsxs("div",{className:"rich-editor-toolbar",children:[i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"is-active":"",type:"button",children:i.jsx(RT,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"is-active":"",type:"button",children:i.jsx(AM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleStrike().run(),className:v.isActive("strike")?"is-active":"",type:"button",children:i.jsx(CA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"is-active":"",type:"button",children:i.jsx(QT,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"is-active":"",type:"button",children:i.jsx(bM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"is-active":"",type:"button",children:i.jsx(NM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"is-active":"",type:"button",children:i.jsx(kM,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"is-active":"",type:"button",children:i.jsx(FM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"is-active":"",type:"button",children:i.jsx(zM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"is-active":"",type:"button",children:i.jsx(uA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().setHorizontalRule().run(),type:"button",children:i.jsx(QM,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:j,className:"hidden"}),i.jsx("button",{onClick:()=>{var E;return(E=u.current)==null?void 0:E.click()},type:"button",children:i.jsx(zN,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>g(!m),className:v.isActive("link")?"is-active":"",type:"button",children:i.jsx(xg,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:i.jsx(TA,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:i.jsx(DA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:i.jsx(fA,{className:"w-4 h-4"})})]}),s.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"toolbar-divider"}),i.jsx("div",{className:"toolbar-group",children:i.jsxs("select",{className:"link-tag-select",onChange:E=>{const C=s.find(M=>M.id===E.target.value);C&&w(C),E.target.value=""},defaultValue:"",children:[i.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),s.map(E=>i.jsx("option",{value:E.id,children:E.label},E.id))]})})]})]}),m&&i.jsxs("div",{className:"link-input-bar",children:[i.jsx("input",{type:"url",placeholder:"输入链接地址...",value:h,onChange:E=>f(E.target.value),onKeyDown:E=>E.key==="Enter"&&k(),className:"link-input"}),i.jsx("button",{onClick:k,className:"link-confirm",type:"button",children:"确定"}),i.jsx("button",{onClick:()=>{v.chain().focus().unsetLink().run(),g(!1)},className:"link-remove",type:"button",children:"移除"})]}),i.jsx(OC,{editor:v})]}):null});S2.displayName="RichEditor";const z$=["top","right","bottom","left"],ta=Math.min,wr=Math.max,$h=Math.round,Ru=Math.floor,js=t=>({x:t,y:t}),$$={left:"right",right:"left",bottom:"top",top:"bottom"},F$={start:"end",end:"start"};function dx(t,e,n){return wr(t,ta(e,n))}function Zs(t,e){return typeof t=="function"?t(e):t}function ei(t){return t.split("-")[0]}function pl(t){return t.split("-")[1]}function R0(t){return t==="x"?"y":"x"}function I0(t){return t==="y"?"height":"width"}const B$=new Set(["top","bottom"]);function ws(t){return B$.has(ei(t))?"y":"x"}function P0(t){return R0(ws(t))}function V$(t,e,n){n===void 0&&(n=!1);const r=pl(t),s=P0(t),a=I0(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=Fh(o)),[o,Fh(o)]}function H$(t){const e=Fh(t);return[ux(t),e,ux(e)]}function ux(t){return t.replace(/start|end/g,e=>F$[e])}const Jw=["left","right"],Yw=["right","left"],W$=["top","bottom"],U$=["bottom","top"];function K$(t,e,n){switch(t){case"top":case"bottom":return n?e?Yw:Jw:e?Jw:Yw;case"left":case"right":return e?W$:U$;default:return[]}}function q$(t,e,n,r){const s=pl(t);let a=K$(ei(t),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(ux)))),a}function Fh(t){return t.replace(/left|right|bottom|top/g,e=>$$[e])}function G$(t){return{top:0,right:0,bottom:0,left:0,...t}}function C2(t){return typeof t!="number"?G$(t):{top:t,right:t,bottom:t,left:t}}function Bh(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function Qw(t,e,n){let{reference:r,floating:s}=t;const a=ws(e),o=P0(e),c=I0(o),u=ei(e),h=a==="y",f=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,g=r[c]/2-s[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-s.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(pl(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function J$(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:a,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Zs(e,t),v=C2(y),w=c[g?m==="floating"?"reference":"floating":m],k=Bh(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(w)))==null||n?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),E=m==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),M=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},D=Bh(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-D.top+v.top)/M.y,bottom:(D.bottom-k.bottom+v.bottom)/M.y,left:(k.left-D.left+v.left)/M.x,right:(D.right-k.right+v.right)/M.x}}const Y$=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=n,c=a.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:f,y:m}=Qw(h,r,u),g=r,y={},v=0;for(let w=0;w({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:a,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Zs(t,e)||{};if(h==null)return{};const m=C2(f),g={x:n,y:r},y=P0(s),v=I0(y),j=await o.getDimensions(h),w=y==="y",k=w?"top":"left",E=w?"bottom":"right",C=w?"clientHeight":"clientWidth",M=a.reference[v]+a.reference[y]-g[y]-a.floating[v],D=g[y]-a.reference[y],F=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let R=F?F[C]:0;(!R||!await(o.isElement==null?void 0:o.isElement(F)))&&(R=c.floating[C]||a.floating[v]);const I=M/2-D/2,A=R/2-j[v]/2-1,O=ta(m[k],A),W=ta(m[E],A),X=O,q=R-j[v]-W,Z=R/2-j[v]/2+I,_=dx(X,Z,q),$=!u.arrow&&pl(s)!=null&&Z!==_&&a.reference[v]/2-(ZZ<=0)){var W,X;const Z=(((W=a.flip)==null?void 0:W.index)||0)+1,_=R[Z];if(_&&(!(m==="alignment"?E!==ws(_):!1)||O.every(V=>ws(V.placement)===E?V.overflows[0]>0:!0)))return{data:{index:Z,overflows:O},reset:{placement:_}};let $=(X=O.filter(oe=>oe.overflows[0]<=0).sort((oe,V)=>oe.overflows[1]-V.overflows[1])[0])==null?void 0:X.placement;if(!$)switch(y){case"bestFit":{var q;const oe=(q=O.filter(V=>{if(F){const ae=ws(V.placement);return ae===E||ae==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(ae=>ae>0).reduce((ae,Y)=>ae+Y,0)]).sort((V,ae)=>V[1]-ae[1])[0])==null?void 0:q[0];oe&&($=oe);break}case"initialPlacement":$=c;break}if(s!==$)return{reset:{placement:$}}}return{}}}};function Xw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Zw(t){return z$.some(e=>t[e]>=0)}const Z$=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...a}=Zs(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...a,elementContext:"reference"}),c=Xw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Zw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...a,altBoundary:!0}),c=Xw(o,n.floating);return{data:{escapedOffsets:c,escaped:Zw(c)}}}default:return{}}}}},E2=new Set(["left","top"]);async function eF(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ei(n),c=pl(n),u=ws(n)==="y",h=E2.has(o)?-1:1,f=a&&u?-1:1,m=Zs(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const tF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:a,placement:o,middlewareData:c}=e,u=await eF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:a+u.y,data:{...u,placement:o}}}}},nF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:a}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:E,y:C}=k;return{x:E,y:C}}},...h}=Zs(t,e),f={x:n,y:r},m=await a.detectOverflow(e,h),g=ws(ei(s)),y=R0(g);let v=f[y],j=f[g];if(o){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",C=v+m[k],M=v-m[E];v=dx(C,v,M)}if(c){const k=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=j+m[k],M=j-m[E];j=dx(C,j,M)}const w=u.fn({...e,[y]:v,[g]:j});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]:o,[g]:c}}}}}},rF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:a,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Zs(t,e),f={x:n,y:r},m=ws(s),g=R0(m);let y=f[g],v=f[m];const j=Zs(c,e),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",M=a.reference[g]-a.floating[C]+w.mainAxis,D=a.reference[g]+a.reference[C]-w.mainAxis;yD&&(y=D)}if(h){var k,E;const C=g==="y"?"width":"height",M=E2.has(ei(s)),D=a.reference[m]-a.floating[C]+(M&&((k=o.offset)==null?void 0:k[m])||0)+(M?0:w.crossAxis),F=a.reference[m]+a.reference[C]+(M?0:((E=o.offset)==null?void 0:E[m])||0)-(M?w.crossAxis:0);vF&&(v=F)}return{[g]:y,[m]:v}}}},sF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:a,platform:o,elements:c}=e,{apply:u=()=>{},...h}=Zs(t,e),f=await o.detectOverflow(e,h),m=ei(s),g=pl(s),y=ws(s)==="y",{width:v,height:j}=a.floating;let w,k;m==="top"||m==="bottom"?(w=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,w=g==="end"?"top":"bottom");const E=j-f.top-f.bottom,C=v-f.left-f.right,M=ta(j-f[w],E),D=ta(v-f[k],C),F=!e.middlewareData.shift;let R=M,I=D;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(I=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(R=E),F&&!g){const O=wr(f.left,0),W=wr(f.right,0),X=wr(f.top,0),q=wr(f.bottom,0);y?I=v-2*(O!==0||W!==0?O+W:wr(f.left,f.right)):R=j-2*(X!==0||q!==0?X+q:wr(f.top,f.bottom))}await u({...e,availableWidth:I,availableHeight:R});const A=await o.getDimensions(c.floating);return v!==A.width||j!==A.height?{reset:{rects:!0}}:{}}}};function yf(){return typeof window<"u"}function ml(t){return T2(t)?(t.nodeName||"").toLowerCase():"#document"}function Sr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ts(t){var e;return(e=(T2(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function T2(t){return yf()?t instanceof Node||t instanceof Sr(t).Node:!1}function es(t){return yf()?t instanceof Element||t instanceof Sr(t).Element:!1}function Cs(t){return yf()?t instanceof HTMLElement||t instanceof Sr(t).HTMLElement:!1}function eN(t){return!yf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Sr(t).ShadowRoot}const iF=new Set(["inline","contents"]);function Jc(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=ts(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!iF.has(s)}const aF=new Set(["table","td","th"]);function oF(t){return aF.has(ml(t))}const lF=[":popover-open",":modal"];function vf(t){return lF.some(e=>{try{return t.matches(e)}catch{return!1}})}const cF=["transform","translate","scale","rotate","perspective"],dF=["transform","translate","scale","rotate","perspective","filter"],uF=["paint","layout","strict","content"];function O0(t){const e=D0(),n=es(t)?ts(t):t;return cF.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||dF.some(r=>(n.willChange||"").includes(r))||uF.some(r=>(n.contain||"").includes(r))}function hF(t){let e=na(t);for(;Cs(e)&&!il(e);){if(O0(e))return e;if(vf(e))return null;e=na(e)}return null}function D0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const fF=new Set(["html","body","#document"]);function il(t){return fF.has(ml(t))}function ts(t){return Sr(t).getComputedStyle(t)}function bf(t){return es(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function na(t){if(ml(t)==="html")return t;const e=t.assignedSlot||t.parentNode||eN(t)&&t.host||Ts(t);return eN(e)?e.host:e}function M2(t){const e=na(t);return il(e)?t.ownerDocument?t.ownerDocument.body:t.body:Cs(e)&&Jc(e)?e:M2(e)}function $c(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=M2(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=Sr(s);if(a){const c=hx(o);return e.concat(o,o.visualViewport||[],Jc(s)?s:[],c&&n?$c(c):[])}return e.concat(s,$c(s,[],n))}function hx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function A2(t){const e=ts(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Cs(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,c=$h(n)!==a||$h(r)!==o;return c&&(n=a,r=o),{width:n,height:r,$:c}}function L0(t){return es(t)?t:t.contextElement}function Go(t){const e=L0(t);if(!Cs(e))return js(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=A2(e);let o=(a?$h(n.width):n.width)/r,c=(a?$h(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const pF=js(0);function R2(t){const e=Sr(t);return!D0()||!e.visualViewport?pF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function mF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Sr(t)?!1:e}function Qa(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=L0(t);let o=js(1);e&&(r?es(r)&&(o=Go(r)):o=Go(t));const c=mF(a,n,r)?R2(a):js(0);let u=(s.left+c.x)/o.x,h=(s.top+c.y)/o.y,f=s.width/o.x,m=s.height/o.y;if(a){const g=Sr(a),y=r&&es(r)?Sr(r):r;let v=g,j=hx(v);for(;j&&r&&y!==v;){const w=Go(j),k=j.getBoundingClientRect(),E=ts(j),C=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,M=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;u*=w.x,h*=w.y,f*=w.x,m*=w.y,u+=C,h+=M,v=Sr(j),j=hx(v)}}return Bh({width:f,height:m,x:u,y:h})}function wf(t,e){const n=bf(t).scrollLeft;return e?e.left+n:Qa(Ts(t)).left+n}function I2(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-wf(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function gF(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",o=Ts(r),c=e?vf(e.floating):!1;if(r===o||c&&a)return n;let u={scrollLeft:0,scrollTop:0},h=js(1);const f=js(0),m=Cs(r);if((m||!m&&!a)&&((ml(r)!=="body"||Jc(o))&&(u=bf(r)),Cs(r))){const y=Qa(r);h=Go(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!a?I2(o,u):js(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function xF(t){return Array.from(t.getClientRects())}function yF(t){const e=Ts(t),n=bf(t),r=t.ownerDocument.body,s=wr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=wr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+wf(t);const c=-n.scrollTop;return ts(r).direction==="rtl"&&(o+=wr(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:c}}const tN=25;function vF(t,e){const n=Sr(t),r=Ts(t),s=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,c=0,u=0;if(s){a=s.width,o=s.height;const f=D0();(!f||f&&e==="fixed")&&(c=s.offsetLeft,u=s.offsetTop)}const h=wf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-y);v<=tN&&(a-=v)}else h<=tN&&(a+=h);return{width:a,height:o,x:c,y:u}}const bF=new Set(["absolute","fixed"]);function wF(t,e){const n=Qa(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=Cs(t)?Go(t):js(1),o=t.clientWidth*a.x,c=t.clientHeight*a.y,u=s*a.x,h=r*a.y;return{width:o,height:c,x:u,y:h}}function nN(t,e,n){let r;if(e==="viewport")r=vF(t,n);else if(e==="document")r=yF(Ts(t));else if(es(e))r=wF(e,n);else{const s=R2(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Bh(r)}function P2(t,e){const n=na(t);return n===e||!es(n)||il(n)?!1:ts(n).position==="fixed"||P2(n,e)}function NF(t,e){const n=e.get(t);if(n)return n;let r=$c(t,[],!1).filter(c=>es(c)&&ml(c)!=="body"),s=null;const a=ts(t).position==="fixed";let o=a?na(t):t;for(;es(o)&&!il(o);){const c=ts(o),u=O0(o);!u&&c.position==="fixed"&&(s=null),(a?!u&&!s:!u&&c.position==="static"&&!!s&&bF.has(s.position)||Jc(o)&&!u&&P2(t,o))?r=r.filter(f=>f!==o):s=c,o=na(o)}return e.set(t,r),r}function jF(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?vf(e)?[]:NF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=nN(e,f,s);return h.top=wr(m.top,h.top),h.right=ta(m.right,h.right),h.bottom=ta(m.bottom,h.bottom),h.left=wr(m.left,h.left),h},nN(e,c,s));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function kF(t){const{width:e,height:n}=A2(t);return{width:e,height:n}}function SF(t,e,n){const r=Cs(e),s=Ts(e),a=n==="fixed",o=Qa(t,!0,a,e);let c={scrollLeft:0,scrollTop:0};const u=js(0);function h(){u.x=wf(s)}if(r||!r&&!a)if((ml(e)!=="body"||Jc(s))&&(c=bf(e)),r){const y=Qa(e,!0,a,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else s&&h();a&&!r&&s&&h();const f=s&&!r&&!a?I2(s,c):js(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function sg(t){return ts(t).position==="static"}function rN(t,e){if(!Cs(t)||ts(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ts(t)===n&&(n=n.ownerDocument.body),n}function O2(t,e){const n=Sr(t);if(vf(t))return n;if(!Cs(t)){let s=na(t);for(;s&&!il(s);){if(es(s)&&!sg(s))return s;s=na(s)}return n}let r=rN(t,e);for(;r&&oF(r)&&sg(r);)r=rN(r,e);return r&&il(r)&&sg(r)&&!O0(r)?n:r||hF(t)||n}const CF=async function(t){const e=this.getOffsetParent||O2,n=this.getDimensions,r=await n(t.floating);return{reference:SF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function EF(t){return ts(t).direction==="rtl"}const TF={convertOffsetParentRelativeRectToViewportRelativeRect:gF,getDocumentElement:Ts,getClippingRect:jF,getOffsetParent:O2,getElementRects:CF,getClientRects:xF,getDimensions:kF,getScale:Go,isElement:es,isRTL:EF};function D2(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function MF(t,e){let n=null,r;const s=Ts(t);function a(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),a();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const v=Ru(m),j=Ru(s.clientWidth-(f+g)),w=Ru(s.clientHeight-(m+y)),k=Ru(f),C={rootMargin:-v+"px "+-j+"px "+-w+"px "+-k+"px",threshold:wr(0,ta(1,u))||1};let M=!0;function D(F){const R=F[0].intersectionRatio;if(R!==u){if(!M)return o();R?o(!1,R):r=setTimeout(()=>{o(!1,1e-7)},1e3)}R===1&&!D2(h,t.getBoundingClientRect())&&o(),M=!1}try{n=new IntersectionObserver(D,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(D,C)}n.observe(t)}return o(!0),a}function AF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=L0(t),f=s||a?[...h?$c(h):[],...$c(e)]:[];f.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const m=h&&c?MF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[E]=k;E&&E.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let v,j=u?Qa(t):null;u&&w();function w(){const k=Qa(t);j&&!D2(j,k)&&n(),j=k,v=requestAnimationFrame(w)}return n(),()=>{var k;f.forEach(E=>{s&&E.removeEventListener("scroll",n),a&&E.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const RF=tF,IF=nF,PF=X$,OF=sF,DF=Z$,sN=Q$,LF=rF,_F=(t,e,n)=>{const r=new Map,s={platform:TF,...n},a={...s.platform,_c:r};return Y$(t,e,{...s,platform:a})};var zF=typeof document<"u",$F=function(){},Vu=zF?b.useLayoutEffect:$F;function Vh(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Vh(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&t.$$typeof)&&!Vh(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function L2(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function iN(t,e){const n=L2(t);return Math.round(e*n)/n}function ig(t){const e=b.useRef(t);return Vu(()=>{e.current=t}),e}function FF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);Vh(g,r)||y(r);const[v,j]=b.useState(null),[w,k]=b.useState(null),E=b.useCallback(V=>{V!==F.current&&(F.current=V,j(V))},[]),C=b.useCallback(V=>{V!==R.current&&(R.current=V,k(V))},[]),M=a||v,D=o||w,F=b.useRef(null),R=b.useRef(null),I=b.useRef(f),A=u!=null,O=ig(u),W=ig(s),X=ig(h),q=b.useCallback(()=>{if(!F.current||!R.current)return;const V={placement:e,strategy:n,middleware:g};W.current&&(V.platform=W.current),_F(F.current,R.current,V).then(ae=>{const Y={...ae,isPositioned:X.current!==!1};Z.current&&!Vh(I.current,Y)&&(I.current=Y,Bc.flushSync(()=>{m(Y)}))})},[g,e,n,W,X]);Vu(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[h]);const Z=b.useRef(!1);Vu(()=>(Z.current=!0,()=>{Z.current=!1}),[]),Vu(()=>{if(M&&(F.current=M),D&&(R.current=D),M&&D){if(O.current)return O.current(M,D,q);q()}},[M,D,q,O,A]);const _=b.useMemo(()=>({reference:F,floating:R,setReference:E,setFloating:C}),[E,C]),$=b.useMemo(()=>({reference:M,floating:D}),[M,D]),oe=b.useMemo(()=>{const V={position:n,left:0,top:0};if(!$.floating)return V;const ae=iN($.floating,f.x),Y=iN($.floating,f.y);return c?{...V,transform:"translate("+ae+"px, "+Y+"px)",...L2($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ae,top:Y}},[n,c,$.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:q,refs:_,elements:$,floatingStyles:oe}),[f,q,_,$,oe])}const BF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?sN({element:r.current,padding:s}).fn(n):{}:r?sN({element:r,padding:s}).fn(n):{}}}},VF=(t,e)=>({...RF(t),options:[t,e]}),HF=(t,e)=>({...IF(t),options:[t,e]}),WF=(t,e)=>({...LF(t),options:[t,e]}),UF=(t,e)=>({...PF(t),options:[t,e]}),KF=(t,e)=>({...OF(t),options:[t,e]}),qF=(t,e)=>({...DF(t),options:[t,e]}),GF=(t,e)=>({...BF(t),options:[t,e]});var JF="Arrow",_2=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...a}=t;return i.jsx(ot.svg,{...a,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});_2.displayName=JF;var YF=_2,_0="Popper",[z2,$2]=aa(_0),[QF,F2]=z2(_0),B2=t=>{const{__scopePopper:e,children:n}=t,[r,s]=b.useState(null);return i.jsx(QF,{scope:e,anchor:r,onAnchorChange:s,children:n})};B2.displayName=_0;var V2="PopperAnchor",H2=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=F2(V2,n),o=b.useRef(null),c=gt(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&a.onAnchorChange(u.current)}),r?null:i.jsx(ot.div,{...s,ref:c})});H2.displayName=V2;var z0="PopperContent",[XF,ZF]=z2(z0),W2=b.forwardRef((t,e)=>{var ee,de,Ce,B,me,Se;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:v,...j}=t,w=F2(z0,n),[k,E]=b.useState(null),C=gt(e,rt=>E(rt)),[M,D]=b.useState(null),F=zx(M),R=(F==null?void 0:F.width)??0,I=(F==null?void 0:F.height)??0,A=r+(a!=="center"?"-"+a:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},W=Array.isArray(h)?h:[h],X=W.length>0,q={padding:O,boundary:W.filter(tB),altBoundary:X},{refs:Z,floatingStyles:_,placement:$,isPositioned:oe,middlewareData:V}=FF({strategy:"fixed",placement:A,whileElementsMounted:(...rt)=>AF(...rt,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[VF({mainAxis:s+I,alignmentAxis:o}),u&&HF({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?WF():void 0,...q}),u&&UF({...q}),KF({...q,apply:({elements:rt,rects:Ye,availableWidth:st,availableHeight:Qe})=>{const{width:Xe,height:ft}=Ye.reference,Pt=rt.floating.style;Pt.setProperty("--radix-popper-available-width",`${st}px`),Pt.setProperty("--radix-popper-available-height",`${Qe}px`),Pt.setProperty("--radix-popper-anchor-width",`${Xe}px`),Pt.setProperty("--radix-popper-anchor-height",`${ft}px`)}}),M&&GF({element:M,padding:c}),nB({arrowWidth:R,arrowHeight:I}),g&&qF({strategy:"referenceHidden",...q})]}),[ae,Y]=q2($),L=Xi(v);Vn(()=>{oe&&(L==null||L())},[oe,L]);const H=(ee=V.arrow)==null?void 0:ee.x,ue=(de=V.arrow)==null?void 0:de.y,U=((Ce=V.arrow)==null?void 0:Ce.centerOffset)!==0,[he,Q]=b.useState();return Vn(()=>{k&&Q(window.getComputedStyle(k).zIndex)},[k]),i.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:oe?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(B=V.transformOrigin)==null?void 0:B.x,(me=V.transformOrigin)==null?void 0:me.y].join(" "),...((Se=V.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(XF,{scope:n,placedSide:ae,onArrowChange:D,arrowX:H,arrowY:ue,shouldHideArrow:U,children:i.jsx(ot.div,{"data-side":ae,"data-align":Y,...j,ref:C,style:{...j.style,animation:oe?void 0:"none"}})})})});W2.displayName=z0;var U2="PopperArrow",eB={top:"bottom",right:"left",bottom:"top",left:"right"},K2=b.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=ZF(U2,r),o=eB[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(YF,{...s,ref:n,style:{...s.style,display:"block"}})})});K2.displayName=U2;function tB(t){return t!==null}var nB=t=>({name:"transformOrigin",options:t,fn(e){var w,k,E;const{placement:n,rects:r,middlewareData:s}=e,o=((w=s.arrow)==null?void 0:w.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=q2(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=s.arrow)==null?void 0:k.x)??0)+c/2,y=(((E=s.arrow)==null?void 0:E.y)??0)+u/2;let v="",j="";return h==="bottom"?(v=o?m:`${g}px`,j=`${-u}px`):h==="top"?(v=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,j=o?m:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,j=o?m:`${y}px`),{data:{x:v,y:j}}}});function q2(t){const[e,n="center"]=t.split("-");return[e,n]}var rB=B2,sB=H2,iB=W2,aB=K2,G2=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),oB="VisuallyHidden",lB=b.forwardRef((t,e)=>i.jsx(ot.span,{...t,ref:e,style:{...G2,...t.style}}));lB.displayName=oB;var cB=[" ","Enter","ArrowUp","ArrowDown"],dB=[" ","Enter"],Xa="Select",[Nf,jf,uB]=Dx(Xa),[gl]=aa(Xa,[uB,$2]),kf=$2(),[hB,da]=gl(Xa),[fB,pB]=gl(Xa),J2=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:a,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:v}=t,j=kf(e),[w,k]=b.useState(null),[E,C]=b.useState(null),[M,D]=b.useState(!1),F=Qh(h),[R,I]=Va({prop:r,defaultProp:s??!1,onChange:a,caller:Xa}),[A,O]=Va({prop:o,defaultProp:c,onChange:u,caller:Xa}),W=b.useRef(null),X=w?v||!!w.closest("form"):!0,[q,Z]=b.useState(new Set),_=Array.from(q).map($=>$.props.value).join(";");return i.jsx(rB,{...j,children:i.jsxs(hB,{required:y,scope:e,trigger:w,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:M,onValueNodeHasChildrenChange:D,contentId:qi(),value:A,onValueChange:O,open:R,onOpenChange:I,dir:F,triggerPointerDownPosRef:W,disabled:g,children:[i.jsx(Nf.Provider,{scope:e,children:i.jsx(fB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback($=>{Z(oe=>new Set(oe).add($))},[]),onNativeOptionRemove:b.useCallback($=>{Z(oe=>{const V=new Set(oe);return V.delete($),V})},[]),children:n})}),X?i.jsxs(xE,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:A,onChange:$=>O($.target.value),disabled:g,form:v,children:[A===void 0?i.jsx("option",{value:""}):null,Array.from(q)]},_):null]})})};J2.displayName=Xa;var Y2="SelectTrigger",Q2=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,a=kf(n),o=da(Y2,n),c=o.disabled||r,u=gt(e,o.onTriggerChange),h=jf(n),f=b.useRef("touch"),[m,g,y]=vE(j=>{const w=h().filter(C=>!C.disabled),k=w.find(C=>C.value===o.value),E=bE(w,j,k);E!==void 0&&o.onValueChange(E.value)}),v=j=>{c||(o.onOpenChange(!0),y()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return i.jsx(sB,{asChild:!0,...a,children:i.jsx(ot.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":yE(o.value)?"":void 0,...s,ref:u,onClick:nt(s.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&v(j)}),onPointerDown:nt(s.onPointerDown,j=>{f.current=j.pointerType;const w=j.target;w.hasPointerCapture(j.pointerId)&&w.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(v(j),j.preventDefault())}),onKeyDown:nt(s.onKeyDown,j=>{const w=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(w&&j.key===" ")&&cB.includes(j.key)&&(v(),j.preventDefault())})})})});Q2.displayName=Y2;var X2="SelectValue",Z2=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:o="",...c}=t,u=da(X2,n),{onValueNodeHasChildrenChange:h}=u,f=a!==void 0,m=gt(e,u.onValueNodeChange);return Vn(()=>{h(f)},[h,f]),i.jsx(ot.span,{...c,ref:m,style:{pointerEvents:"none"},children:yE(u.value)?i.jsx(i.Fragment,{children:o}):a})});Z2.displayName=X2;var mB="SelectIcon",eE=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return i.jsx(ot.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});eE.displayName=mB;var gB="SelectPortal",tE=t=>i.jsx(Ax,{asChild:!0,...t});tE.displayName=gB;var Za="SelectContent",nE=b.forwardRef((t,e)=>{const n=da(Za,t.__scopeSelect),[r,s]=b.useState();if(Vn(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Bc.createPortal(i.jsx(rE,{scope:t.__scopeSelect,children:i.jsx(Nf.Slot,{scope:t.__scopeSelect,children:i.jsx("div",{children:t.children})})}),a):null}return i.jsx(sE,{...t,ref:e})});nE.displayName=Za;var Jr=10,[rE,ua]=gl(Za),xB="SelectContentImpl",yB=Cc("SelectContent.RemoveScroll"),sE=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w,...k}=t,E=da(Za,n),[C,M]=b.useState(null),[D,F]=b.useState(null),R=gt(e,ee=>M(ee)),[I,A]=b.useState(null),[O,W]=b.useState(null),X=jf(n),[q,Z]=b.useState(!1),_=b.useRef(!1);b.useEffect(()=>{if(C)return xj(C)},[C]),lj();const $=b.useCallback(ee=>{const[de,...Ce]=X().map(Se=>Se.ref.current),[B]=Ce.slice(-1),me=document.activeElement;for(const Se of ee)if(Se===me||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===de&&D&&(D.scrollTop=0),Se===B&&D&&(D.scrollTop=D.scrollHeight),Se==null||Se.focus(),document.activeElement!==me))return},[X,D]),oe=b.useCallback(()=>$([I,C]),[$,I,C]);b.useEffect(()=>{q&&oe()},[q,oe]);const{onOpenChange:V,triggerPointerDownPosRef:ae}=E;b.useEffect(()=>{if(C){let ee={x:0,y:0};const de=B=>{var me,Se;ee={x:Math.abs(Math.round(B.pageX)-(((me=ae.current)==null?void 0:me.x)??0)),y:Math.abs(Math.round(B.pageY)-(((Se=ae.current)==null?void 0:Se.y)??0))}},Ce=B=>{ee.x<=10&&ee.y<=10?B.preventDefault():C.contains(B.target)||V(!1),document.removeEventListener("pointermove",de),ae.current=null};return ae.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[C,V,ae]),b.useEffect(()=>{const ee=()=>V(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[V]);const[Y,L]=vE(ee=>{const de=X().filter(me=>!me.disabled),Ce=de.find(me=>me.ref.current===document.activeElement),B=bE(de,ee,Ce);B&&setTimeout(()=>B.ref.current.focus())}),H=b.useCallback((ee,de,Ce)=>{const B=!_.current&&!Ce;(E.value!==void 0&&E.value===de||B)&&(A(ee),B&&(_.current=!0))},[E.value]),ue=b.useCallback(()=>C==null?void 0:C.focus(),[C]),U=b.useCallback((ee,de,Ce)=>{const B=!_.current&&!Ce;(E.value!==void 0&&E.value===de||B)&&W(ee)},[E.value]),he=r==="popper"?fx:iE,Q=he===fx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w}:{};return i.jsx(rE,{scope:n,content:C,viewport:D,onViewportChange:F,itemRefCallback:H,selectedItem:I,onItemLeave:ue,itemTextRefCallback:U,focusSelectedItem:oe,selectedItemText:O,position:r,isPositioned:q,searchRef:Y,children:i.jsx(Rx,{as:yB,allowPinchZoom:!0,children:i.jsx(Mx,{asChild:!0,trapped:E.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:nt(s,ee=>{var de;(de=E.trigger)==null||de.focus({preventScroll:!0}),ee.preventDefault()}),children:i.jsx(Tx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:i.jsx(he,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:ee=>ee.preventDefault(),...k,...Q,onPlaced:()=>Z(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:nt(k.onKeyDown,ee=>{const de=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!de&&ee.key.length===1&&L(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let B=X().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(B=B.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const me=ee.target,Se=B.indexOf(me);B=B.slice(Se+1)}setTimeout(()=>$(B)),ee.preventDefault()}})})})})})})});sE.displayName=xB;var vB="SelectItemAlignedPosition",iE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,a=da(Za,n),o=ua(Za,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=gt(e,R=>f(R)),g=jf(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:j,selectedItem:w,selectedItemText:k,focusSelectedItem:E}=o,C=b.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&h&&j&&w&&k){const R=a.trigger.getBoundingClientRect(),I=h.getBoundingClientRect(),A=a.valueNode.getBoundingClientRect(),O=k.getBoundingClientRect();if(a.dir!=="rtl"){const me=O.left-I.left,Se=A.left-me,rt=R.left-Se,Ye=R.width+rt,st=Math.max(Ye,I.width),Qe=window.innerWidth-Jr,Xe=Ju(Se,[Jr,Math.max(Jr,Qe-st)]);c.style.minWidth=Ye+"px",c.style.left=Xe+"px"}else{const me=I.right-O.right,Se=window.innerWidth-A.right-me,rt=window.innerWidth-R.right-Se,Ye=R.width+rt,st=Math.max(Ye,I.width),Qe=window.innerWidth-Jr,Xe=Ju(Se,[Jr,Math.max(Jr,Qe-st)]);c.style.minWidth=Ye+"px",c.style.right=Xe+"px"}const W=g(),X=window.innerHeight-Jr*2,q=j.scrollHeight,Z=window.getComputedStyle(h),_=parseInt(Z.borderTopWidth,10),$=parseInt(Z.paddingTop,10),oe=parseInt(Z.borderBottomWidth,10),V=parseInt(Z.paddingBottom,10),ae=_+$+q+V+oe,Y=Math.min(w.offsetHeight*5,ae),L=window.getComputedStyle(j),H=parseInt(L.paddingTop,10),ue=parseInt(L.paddingBottom,10),U=R.top+R.height/2-Jr,he=X-U,Q=w.offsetHeight/2,ee=w.offsetTop+Q,de=_+$+ee,Ce=ae-de;if(de<=U){const me=W.length>0&&w===W[W.length-1].ref.current;c.style.bottom="0px";const Se=h.clientHeight-j.offsetTop-j.offsetHeight,rt=Math.max(he,Q+(me?ue:0)+Se+oe),Ye=de+rt;c.style.height=Ye+"px"}else{const me=W.length>0&&w===W[0].ref.current;c.style.top="0px";const rt=Math.max(U,_+j.offsetTop+(me?H:0)+Q)+Ce;c.style.height=rt+"px",j.scrollTop=de-U+j.offsetTop}c.style.margin=`${Jr}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=X+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,a.trigger,a.valueNode,c,h,j,w,k,a.dir,r]);Vn(()=>C(),[C]);const[M,D]=b.useState();Vn(()=>{h&&D(window.getComputedStyle(h).zIndex)},[h]);const F=b.useCallback(R=>{R&&v.current===!0&&(C(),E==null||E(),v.current=!1)},[C,E]);return i.jsx(wB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:F,children:i.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:i.jsx(ot.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});iE.displayName=vB;var bB="SelectPopperPosition",fx=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Jr,...a}=t,o=kf(n);return i.jsx(iB,{...o,...a,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});fx.displayName=bB;var[wB,$0]=gl(Za,{}),px="SelectViewport",aE=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,a=ua(px,n),o=$0(px,n),c=gt(e,a.onViewportChange),u=b.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(Nf.Slot,{scope:n,children:i.jsx(ot.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:nt(s.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const v=window.innerHeight-Jr*2,j=parseFloat(m.style.minHeight),w=parseFloat(m.style.height),k=Math.max(j,w);if(k0?M:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});aE.displayName=px;var oE="SelectGroup",[NB,jB]=gl(oE),kB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=qi();return i.jsx(NB,{scope:n,id:s,children:i.jsx(ot.div,{role:"group","aria-labelledby":s,...r,ref:e})})});kB.displayName=oE;var lE="SelectLabel",SB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=jB(lE,n);return i.jsx(ot.div,{id:s.id,...r,ref:e})});SB.displayName=lE;var Hh="SelectItem",[CB,cE]=gl(Hh),dE=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...o}=t,c=da(Hh,n),u=ua(Hh,n),h=c.value===r,[f,m]=b.useState(a??""),[g,y]=b.useState(!1),v=gt(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,s)}),j=qi(),w=b.useRef("touch"),k=()=>{s||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(CB,{scope:n,value:r,disabled:s,textId:j,isSelected:h,onItemTextChange:b.useCallback(E=>{m(C=>C||((E==null?void 0:E.textContent)??"").trim())},[]),children:i.jsx(Nf.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:i.jsx(ot.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:v,onFocus:nt(o.onFocus,()=>y(!0)),onBlur:nt(o.onBlur,()=>y(!1)),onClick:nt(o.onClick,()=>{w.current!=="mouse"&&k()}),onPointerUp:nt(o.onPointerUp,()=>{w.current==="mouse"&&k()}),onPointerDown:nt(o.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:nt(o.onPointerMove,E=>{var C;w.current=E.pointerType,s?(C=u.onItemLeave)==null||C.call(u):w.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:nt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:nt(o.onKeyDown,E=>{var M;((M=u.searchRef)==null?void 0:M.current)!==""&&E.key===" "||(dB.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});dE.displayName=Hh;var lc="SelectItemText",uE=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...a}=t,o=da(lc,n),c=ua(lc,n),u=cE(lc,n),h=pB(lc,n),[f,m]=b.useState(null),g=gt(e,k=>m(k),u.onItemTextChange,k=>{var E;return(E=c.itemTextRefCallback)==null?void 0:E.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,v=b.useMemo(()=>i.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:w}=h;return Vn(()=>(j(v),()=>w(v)),[j,w,v]),i.jsxs(i.Fragment,{children:[i.jsx(ot.span,{id:u.textId,...a,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Bc.createPortal(a.children,o.valueNode):null]})});uE.displayName=lc;var hE="SelectItemIndicator",fE=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return cE(hE,n).isSelected?i.jsx(ot.span,{"aria-hidden":!0,...r,ref:e}):null});fE.displayName=hE;var mx="SelectScrollUpButton",pE=b.forwardRef((t,e)=>{const n=ua(mx,t.__scopeSelect),r=$0(mx,t.__scopeSelect),[s,a]=b.useState(!1),o=gt(e,r.onScrollButtonChange);return Vn(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;a(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(gE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});pE.displayName=mx;var gx="SelectScrollDownButton",mE=b.forwardRef((t,e)=>{const n=ua(gx,t.__scopeSelect),r=$0(gx,t.__scopeSelect),[s,a]=b.useState(!1),o=gt(e,r.onScrollButtonChange);return Vn(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(gE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});mE.displayName=gx;var gE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,a=ua("SelectScrollButton",n),o=b.useRef(null),c=jf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),Vn(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),i.jsx(ot.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:nt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:nt(s.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:nt(s.onPointerLeave,()=>{u()})})}),EB="SelectSeparator",TB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return i.jsx(ot.div,{"aria-hidden":!0,...r,ref:e})});TB.displayName=EB;var xx="SelectArrow",MB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=kf(n),a=da(xx,n),o=ua(xx,n);return a.open&&o.position==="popper"?i.jsx(aB,{...s,...r,ref:e}):null});MB.displayName=xx;var AB="SelectBubbleInput",xE=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=b.useRef(null),a=gt(r,s),o=_x(e);return b.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),i.jsx(ot.select,{...n,style:{...G2,...n.style},ref:a,defaultValue:e})});xE.displayName=AB;function yE(t){return t===""||t===void 0}function vE(t){const e=Xi(t),n=b.useRef(""),r=b.useRef(0),s=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),a=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function bE(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=RB(t,Math.max(a,0));s.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function RB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var IB=J2,wE=Q2,PB=Z2,OB=eE,DB=tE,NE=nE,LB=aE,jE=dE,_B=uE,zB=fE,$B=pE,FB=mE;const tc=IB,nc=PB,$o=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(wE,{ref:r,className:xt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,i.jsx(OB,{asChild:!0,children:i.jsx(Jo,{className:"h-4 w-4 opacity-50"})})]}));$o.displayName=wE.displayName;const Fo=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>i.jsx(DB,{children:i.jsxs(NE,{ref:s,className:xt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[i.jsx($B,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(jx,{className:"h-4 w-4"})}),i.jsx(LB,{className:"p-1",children:e}),i.jsx(FB,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(Jo,{className:"h-4 w-4"})})]})}));Fo.displayName=NE.displayName;const xs=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(jE,{ref:r,className:xt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(zB,{children:i.jsx(Kh,{className:"h-4 w-4"})})}),i.jsx(_B,{children:e})]}));xs.displayName=jE.displayName;const BB=["一","二","三","四","五","六","七","八","九","十"];function ag(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function VB({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:s,onDeleteSection:a,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:v,pinnedSectionIds:j=[]}){const[w,k]=b.useState(null),[E,C]=b.useState(null),M=(O,W)=>(w==null?void 0:w.type)===O&&(w==null?void 0:w.id)===W,D=(O,W)=>(E==null?void 0:E.type)===O&&(E==null?void 0:E.id)===W,F=b.useCallback(()=>{const O=[];for(const W of t)for(const X of W.chapters)for(const q of X.sections)O.push({id:q.id,partId:W.id,partTitle:W.title,chapterId:X.id,chapterTitle:X.title});return O},[t]),R=b.useCallback(async(O,W,X,q)=>{var V;O.preventDefault(),O.stopPropagation();const Z=O.dataTransfer.getData("text/plain"),_=ag(Z);if(!_||_.type===W&&_.id===X)return;const $=F(),oe=new Map($.map(ae=>[ae.id,ae]));if(_.type==="part"&&W==="part"){const ae=t.map(U=>U.id),Y=ae.indexOf(_.id),L=ae.indexOf(X);if(Y===-1||L===-1)return;const H=[...ae];H.splice(Y,1),H.splice(YQ.id===U);if(he)for(const Q of he.chapters)for(const ee of Q.sections){const de=oe.get(ee.id);de&&ue.push(de)}}await r(ue);return}if(_.type==="chapter"&&(W==="chapter"||W==="section"||W==="part")){const ae=t.find(de=>de.chapters.some(Ce=>Ce.id===_.id)),Y=ae==null?void 0:ae.chapters.find(de=>de.id===_.id);if(!ae||!Y)return;let L,H,ue=null;if(W==="section"){const de=oe.get(X);if(!de)return;L=de.partId,H=de.partTitle,ue=X}else if(W==="chapter"){const de=t.find(me=>me.chapters.some(Se=>Se.id===X)),Ce=de==null?void 0:de.chapters.find(me=>me.id===X);if(!de||!Ce)return;L=de.id,H=de.title;const B=$.filter(me=>me.chapterId===X).pop();ue=(B==null?void 0:B.id)??null}else{const de=t.find(B=>B.id===X);if(!de||!de.chapters[0])return;L=de.id,H=de.title;const Ce=$.filter(B=>B.partId===de.id&&B.chapterId===de.chapters[0].id);ue=((V=Ce[Ce.length-1])==null?void 0:V.id)??null}const U=Y.sections.map(de=>de.id),he=$.filter(de=>!U.includes(de.id));let Q=he.length;if(ue){const de=he.findIndex(Ce=>Ce.id===ue);de>=0&&(Q=de+1)}const ee=U.map(de=>({...oe.get(de),partId:L,partTitle:H,chapterId:Y.id,chapterTitle:Y.title}));await r([...he.slice(0,Q),...ee,...he.slice(Q)]);return}if(_.type==="section"&&(W==="section"||W==="chapter"||W==="part")){if(!q)return;const{partId:ae,partTitle:Y,chapterId:L,chapterTitle:H}=q;let ue;if(W==="section")ue=$.findIndex(Ce=>Ce.id===X);else if(W==="chapter"){const Ce=$.filter(B=>B.chapterId===X).pop();ue=Ce?$.findIndex(B=>B.id===Ce.id)+1:$.length}else{const Ce=t.find(Se=>Se.id===X);if(!(Ce!=null&&Ce.chapters[0]))return;const B=$.filter(Se=>Se.partId===Ce.id&&Se.chapterId===Ce.chapters[0].id),me=B[B.length-1];ue=me?$.findIndex(Se=>Se.id===me.id)+1:0}const U=$.findIndex(Ce=>Ce.id===_.id);if(U===-1)return;const he=$.filter(Ce=>Ce.id!==_.id),Q=U({onDragEnter:q=>{q.preventDefault(),q.stopPropagation(),q.dataTransfer.dropEffect="move",C({type:O,id:W})},onDragOver:q=>{q.preventDefault(),q.stopPropagation(),q.dataTransfer.dropEffect="move",C({type:O,id:W})},onDragLeave:()=>C(null),onDrop:q=>{C(null);const Z=ag(q.dataTransfer.getData("text/plain"));if(Z&&!(O==="section"&&Z.type==="section"&&Z.id===W))if(O==="part")if(Z.type==="part")R(q,"part",W);else{const _=t.find(oe=>oe.id===W);(_==null?void 0:_.chapters[0])&&X&&R(q,"part",W,X)}else O==="chapter"&&X?(Z.type==="section"||Z.type==="chapter")&&R(q,"chapter",W,X):O==="section"&&X&&R(q,"section",W,X)}}),A=O=>BB[O]??String(O+1);return i.jsx("div",{className:"space-y-3",children:t.map((O,W)=>{var Y,L,H,ue;const X=O.title==="序言"||O.title.includes("序言"),q=O.title==="尾声"||O.title.includes("尾声"),Z=O.title==="附录"||O.title.includes("附录"),_=D("part",O.id),$=e.includes(O.id),oe=O.chapters.length,V=O.chapters.reduce((U,he)=>U+he.sections.length,0);if(X&&O.chapters.length===1&&O.chapters[0].sections.length===1){const U=O.chapters[0].sections[0],he=D("section",U.id),Q={partId:O.id,partTitle:O.title,chapterId:O.chapters[0].id,chapterTitle:O.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+U.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:U.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${he?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",U.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx($s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(U.id),onChange:()=>y(U.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:i.jsx(zr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[O.chapters[0].title," | ",U.title]}),j.includes(U.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Ho,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[U.price===0||U.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",U.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",U.clickCount??0," · 付款 ",U.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(U.hotScore??0).toFixed(1)," · 第",U.hotRank&&U.hotRank>0?U.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(U),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(U),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},O.id)}if(O.title==="2026每日派对干货"||O.title.includes("2026每日派对干货")){const U=D("part",O.id);return i.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${U?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...I("part",O.id,{partId:O.id,partTitle:O.title,chapterId:((Y=O.chapters[0])==null?void 0:Y.id)??"",chapterTitle:((L=O.chapters[0])==null?void 0:L.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","part:"+O.id),he.dataTransfer.effectAllowed="move",k({type:"part",id:O.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${M("part",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(O.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx($s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),i.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:O.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",V," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:he=>he.stopPropagation(),onClick:he=>he.stopPropagation(),children:[o&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),h&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(O),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(vn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[oe,"章"]}),$?i.jsx(Jo,{className:"w-5 h-5 text-gray-500"}):i.jsx(Bo,{className:"w-5 h-5 text-gray-500"})]})]}),$&&O.chapters.length>0&&i.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:O.chapters.map(he=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:he.title}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>m(O,he),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),u&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>u(O,he),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:he.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:he.id,chapterTitle:he.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx($s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Q.id," ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Ho,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]},Q.id)})})]},he.id))})]},O.id)}if(Z)return i.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),i.jsx("div",{className:"space-y-3",children:O.chapters.map((U,he)=>U.sections.length>0?U.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx($s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",he+1," | ",U.title," | ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Ho,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx(Bo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},Q.id)}):i.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[i.jsxs("span",{className:"text-sm text-gray-500",children:["附录",he+1," | ",U.title,"(空)"]}),i.jsx(Bo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},U.id))})]},O.id);if(q&&O.chapters.length===1&&O.chapters[0].sections.length===1){const U=O.chapters[0].sections[0],he=D("section",U.id),Q={partId:O.id,partTitle:O.title,chapterId:O.chapters[0].id,chapterTitle:O.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+U.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:U.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${he?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",U.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx($s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(U.id),onChange:()=>y(U.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:i.jsx(zr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[O.chapters[0].title," | ",U.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[U.price===0||U.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",U.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",U.clickCount??0," · 付款 ",U.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(U.hotScore??0).toFixed(1)," · 第",U.hotRank&&U.hotRank>0?U.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(U),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(U),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},O.id)}return q?i.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),i.jsx("div",{className:"space-y-3",children:O.chapters.map(U=>U.sections.map(he=>{const Q=D("section",he.id);return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+he.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:he.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${M("section",he.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",he.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx($s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(he.id),onChange:()=>y(he.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-300",children:[U.title," | ",he.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",he.clickCount??0," · 付款 ",he.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(he.hotScore??0).toFixed(1)," · 第",he.hotRank&&he.hotRank>0?he.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(he),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(he),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(he),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},he.id)}))})]},O.id):i.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${_?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...I("part",O.id,{partId:O.id,partTitle:O.title,chapterId:((H=O.chapters[0])==null?void 0:H.id)??"",chapterTitle:((ue=O.chapters[0])==null?void 0:ue.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:U=>{U.stopPropagation(),U.dataTransfer.setData("text/plain","part:"+O.id),U.dataTransfer.effectAllowed="move",k({type:"part",id:O.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${M("part",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(O.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx($s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),i.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:A(W)}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:O.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",V," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:U=>U.stopPropagation(),onClick:U=>U.stopPropagation(),children:[o&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),h&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(O),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(vn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[oe,"章"]}),$?i.jsx(Jo,{className:"w-5 h-5 text-gray-500"}):i.jsx(Bo,{className:"w-5 h-5 text-gray-500"})]})]}),$&&i.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:O.chapters.map(U=>{const he=D("chapter",U.id);return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","chapter:"+U.id),Q.dataTransfer.effectAllowed="move",k({type:"chapter",id:U.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:U.id})},onDragOver:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:U.id})},onDragLeave:()=>C(null),onDrop:Q=>{C(null);const ee=ag(Q.dataTransfer.getData("text/plain"));if(!ee)return;const de={partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title};(ee.type==="section"||ee.type==="chapter")&&R(Q,"chapter",U.id,de)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${he?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${M("chapter",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[i.jsx($s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),i.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:U.title})]}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>m(O,U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),u&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>u(O,U),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:U.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title}),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx($s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),i.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${Q.price===0||Q.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),i.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Q.id," ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Ho,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[Q.isNew&&i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),Q.price===0||Q.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",Q.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),i.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},Q.id)})})]},U.id)})})]},O.id)})})}function HB(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const a=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return a.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function WB(){var gr,rd,rr;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,j]=b.useState(""),[w,k]=b.useState([]),[E,C]=b.useState(!1),[M,D]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),[F,R]=b.useState(null),[I,A]=b.useState(!1),[O,W]=b.useState(!1),[X,q]=b.useState(null),[Z,_]=b.useState(!1),[$,oe]=b.useState([]),[V,ae]=b.useState(!1),[Y,L]=b.useState(""),[H,ue]=b.useState(""),[U,he]=b.useState(!1),[Q,ee]=b.useState(""),[de,Ce]=b.useState(!1),[B,me]=b.useState(null),[Se,rt]=b.useState(!1),[Ye,st]=b.useState(!1),[Qe,Xe]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[ft,Pt]=b.useState(!1),[Jt,Kn]=b.useState(!1),[qn,ss]=b.useState(1),[zt,Cr]=b.useState([]),[is,On]=b.useState(!1),[pn,mr]=b.useState(20),[Br,Gn]=b.useState(!1),[fe,ge]=b.useState(!1),[kn,ri]=b.useState([]),[Ms,ha]=b.useState([]),[Jn,as]=b.useState({personId:"",name:"",label:""}),[pt,Sn]=b.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Yn=b.useRef(null),Dn=HB(t),fa=t.length,si=[...t].sort((P,ie)=>(ie.hotScore??0)-(P.hotScore??0)),Er=10,ii=Math.max(1,Math.ceil(si.length/Er)),ai=si.slice((qn-1)*Er,qn*Er),mn=async()=>{r(!0);try{const P=await Be("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(P==null?void 0:P.sections)?P.sections:[])}catch(P){console.error(P),e([])}finally{r(!1)}};b.useEffect(()=>{mn()},[]);const ls=P=>{a(ie=>ie.includes(P)?ie.filter(Ae=>Ae!==P):[...ie,P])},oi=b.useCallback(P=>{const ie=t,Ae=P.flatMap(Re=>{const Ot=ie.find(Vt=>Vt.id===Re.id);return Ot?[{...Ot,partId:Re.partId,partTitle:Re.partTitle,chapterId:Re.chapterId,chapterTitle:Re.chapterTitle}]:[]});return e(Ae),Rt("/api/db/book",{action:"reorder",items:P}).then(Re=>{Re&&Re.success===!1&&(e(ie),alert("排序失败: "+(Re&&typeof Re=="object"&&"error"in Re?Re.error:"未知错误")))}).catch(Re=>{e(ie),console.error("排序失败:",Re),alert("排序失败: "+(Re instanceof Error?Re.message:"网络或服务异常"))}),Promise.resolve()},[t]),cs=async P=>{if(confirm(`确定要删除章节「${P.title}」吗?此操作不可恢复。`))try{const ie=await Yr(`/api/db/book?id=${encodeURIComponent(P.id)}`);ie&&ie.success!==!1?(alert("已删除"),mn()):alert("删除失败: "+(ie&&typeof ie=="object"&&"error"in ie?ie.error:"未知错误"))}catch(ie){console.error(ie),alert("删除失败")}},pa=b.useCallback(async()=>{Pt(!0);try{const P=await Be("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),ie=P&&P.data;ie&&typeof ie.readWeight=="number"&&typeof ie.recencyWeight=="number"&&typeof ie.payWeight=="number"&&Xe({readWeight:Math.max(0,Math.min(1,ie.readWeight)),recencyWeight:Math.max(0,Math.min(1,ie.recencyWeight)),payWeight:Math.max(0,Math.min(1,ie.payWeight))})}catch{}finally{Pt(!1)}},[]);b.useEffect(()=>{Ye&&pa()},[Ye,pa]);const ds=async()=>{const{readWeight:P,recencyWeight:ie,payWeight:Ae}=Qe,Re=P+ie+Ae;if(Math.abs(Re-1)>.001){alert("三个权重之和必须等于 1");return}Kn(!0);try{const Ot=await ht("/api/db/config",{key:"article_ranking_weights",value:{readWeight:P,recencyWeight:ie,payWeight:Ae},description:"文章排名算法权重"});Ot&&Ot.success!==!1?(alert("已保存"),mn()):alert("保存失败: "+(Ot&&typeof Ot=="object"&&"error"in Ot?Ot.error:""))}catch(Ot){console.error(Ot),alert("保存失败")}finally{Kn(!1)}},G=b.useCallback(async()=>{On(!0);try{const P=await Be("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),ie=P&&P.data;Array.isArray(ie)&&Cr(ie)}catch{}finally{On(!1)}},[]),Ke=b.useCallback(async()=>{try{const P=await Be("/api/db/persons");P!=null&&P.success&&P.persons&&ri(P.persons.map(ie=>({id:ie.personId,name:ie.name,label:ie.label})))}catch{}},[]),Ze=b.useCallback(async()=>{try{const P=await Be("/api/db/link-tags");P!=null&&P.success&&P.linkTags&&ha(P.linkTags.map(ie=>({id:ie.tagId,label:ie.label,url:ie.url,type:ie.type,appId:ie.appId,pagePath:ie.pagePath})))}catch{}},[]),Cn=async P=>{const ie=zt.includes(P)?zt.filter(Ae=>Ae!==P):[...zt,P];Cr(ie);try{await ht("/api/db/config",{key:"pinned_section_ids",value:ie,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{Cr(zt)}},Vr=b.useCallback(async()=>{Gn(!0);try{const P=await Be("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),ie=P&&P.data;typeof ie=="number"&&ie>0&&ie<=100&&mr(ie)}catch{}finally{Gn(!1)}},[]),Sf=async()=>{if(pn<1||pn>100){alert("预览比例需在 1~100 之间");return}ge(!0);try{const P=await ht("/api/db/config",{key:"unpaid_preview_percent",value:pn,description:"小程序未付费内容默认预览比例(%)"});P&&P.success!==!1?alert("已保存"):alert("保存失败: "+(P.error||""))}catch{alert("保存失败")}finally{ge(!1)}};b.useEffect(()=>{G(),Vr(),Ke(),Ze()},[G,Vr,Ke,Ze]);const us=async P=>{me({section:P,orders:[]}),rt(!0);try{const ie=await Be(`/api/db/book?action=section-orders&id=${encodeURIComponent(P.id)}`),Ae=ie!=null&&ie.success&&Array.isArray(ie.orders)?ie.orders:[];me(Re=>Re?{...Re,orders:Ae}:null)}catch(ie){console.error(ie),me(Ae=>Ae?{...Ae,orders:[]}:null)}finally{rt(!1)}},ro=async P=>{m(!0);try{const ie=await Be(`/api/db/book?action=read&id=${encodeURIComponent(P.id)}`);if(ie!=null&&ie.success&&ie.section){const Ae=ie.section;c({id:P.id,originalId:P.id,title:ie.section.title??P.title,price:ie.section.price??P.price,content:ie.section.content??"",filePath:P.filePath,isFree:P.isFree||P.price===0,isNew:Ae.isNew??P.isNew,isPinned:zt.includes(P.id),hotScore:P.hotScore??0})}else c({id:P.id,originalId:P.id,title:P.title,price:P.price,content:"",filePath:P.filePath,isFree:P.isFree,isNew:P.isNew,isPinned:zt.includes(P.id),hotScore:P.hotScore??0}),ie&&!ie.success&&alert("无法读取文件内容: "+(ie.error||"未知错误"))}catch(ie){console.error(ie),c({id:P.id,title:P.title,price:P.price,content:"",filePath:P.filePath,isFree:P.isFree})}finally{m(!1)}},Yc=async()=>{var P;if(o){y(!0);try{let ie=o.content||"";const Ae=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(P=o.title)==null?void 0:P.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const hs of Ae)ie=ie.replace(hs,"");ie=ie.replace(/^\s*\n+/,"").trim();const Re=o.originalId||o.id,Ot=o.id!==Re,Vt=await Rt("/api/db/book",{id:Re,...Ot?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:ie,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,saveToFile:!0}),Ln=Ot?o.id:Re;o.isPinned!==zt.includes(Ln)&&await Cn(Ln),Vt&&Vt.success!==!1?(alert(`已保存章节: ${o.title}`),c(null),mn()):alert("保存失败: "+(Vt&&typeof Vt=="object"&&"error"in Vt?Vt.error:"未知错误"))}catch(ie){console.error(ie),alert("保存失败")}finally{y(!1)}}},Cf=async()=>{if(!M.id||!M.title){alert("请填写章节ID和标题");return}y(!0);try{const P=await Rt("/api/db/book",{id:M.id,title:M.title,price:M.price,content:M.content,partId:M.partId,chapterId:M.chapterId,saveToFile:!1});P&&P.success!==!1?(alert(`章节创建成功: ${M.title}`),h(!1),D({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),mn()):alert("创建失败: "+(P&&typeof P=="object"&&"error"in P?P.error:"未知错误"))}catch(P){console.error(P),alert("创建失败")}finally{y(!1)}},Qc=P=>{D(ie=>{var Ae;return{...ie,partId:P.id,chapterId:((Ae=P.chapters[0])==null?void 0:Ae.id)??"chapter-1"}}),h(!0)},Xc=P=>{R({id:P.id,title:P.title})},Zc=async()=>{var P;if((P=F==null?void 0:F.title)!=null&&P.trim()){A(!0);try{const ie=t.map(Re=>({id:Re.id,partId:Re.partId||"part-1",partTitle:Re.partId===F.id?F.title.trim():Re.partTitle||"",chapterId:Re.chapterId||"chapter-1",chapterTitle:Re.chapterTitle||""})),Ae=await Rt("/api/db/book",{action:"reorder",items:ie});Ae&&Ae.success!==!1?(R(null),mn()):alert("更新篇名失败: "+(Ae&&typeof Ae=="object"&&"error"in Ae?Ae.error:"未知错误"))}catch(ie){console.error(ie),alert("更新篇名失败")}finally{A(!1)}}},ed=P=>{const ie=P.chapters.length+1,Ae=`chapter-${P.id}-${ie}-${Date.now()}`;D({id:`${ie}.1`,title:"新章节",price:1,partId:P.id,chapterId:Ae,content:""}),h(!0)},Ef=(P,ie)=>{q({part:P,chapter:ie,title:ie.title})},Tf=async()=>{var P;if((P=X==null?void 0:X.title)!=null&&P.trim()){_(!0);try{const ie=t.map(Re=>({id:Re.id,partId:Re.partId||X.part.id,partTitle:Re.partId===X.part.id?X.part.title:Re.partTitle||"",chapterId:Re.chapterId||X.chapter.id,chapterTitle:Re.partId===X.part.id&&Re.chapterId===X.chapter.id?X.title.trim():Re.chapterTitle||""})),Ae=await Rt("/api/db/book",{action:"reorder",items:ie});Ae&&Ae.success!==!1?(q(null),mn()):alert("保存失败: "+(Ae&&typeof Ae=="object"&&"error"in Ae?Ae.error:"未知错误"))}catch(ie){console.error(ie),alert("保存失败")}finally{_(!1)}}},$t=async(P,ie)=>{const Ae=ie.sections.map(Re=>Re.id);if(Ae.length===0){alert("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${P.chapters.indexOf(ie)+1}章 | ${ie.title}」吗?将删除共 ${Ae.length} 节,此操作不可恢复。`))try{for(const Re of Ae)await Yr(`/api/db/book?id=${encodeURIComponent(Re)}`);mn()}catch(Re){console.error(Re),alert("删除失败")}},Mf=async()=>{if(!Q.trim()){alert("请输入篇名");return}Ce(!0);try{const P=`part-new-${Date.now()}`,ie="chapter-1",Ae=`part-placeholder-${Date.now()}`,Re=await Rt("/api/db/book",{id:Ae,title:"占位节(可编辑)",price:0,content:"",partId:P,partTitle:Q.trim(),chapterId:ie,chapterTitle:"第1章 | 待编辑",saveToFile:!1});Re&&Re.success!==!1?(alert(`篇「${Q}」创建成功,请编辑占位节`),W(!1),ee(""),mn()):alert("创建失败: "+(Re&&typeof Re=="object"&&"error"in Re?Re.error:"未知错误"))}catch(P){console.error(P),alert("创建失败")}finally{Ce(!1)}},xl=async()=>{if($.length===0){alert("请先勾选要移动的章节");return}const P=Dn.find(Ae=>Ae.id===Y),ie=P==null?void 0:P.chapters.find(Ae=>Ae.id===H);if(!P||!ie||!Y||!H){alert("请选择目标篇和章");return}he(!0);try{const Ae=()=>{const Ln=new Set($),hs=t.map(sn=>({id:sn.id,partId:sn.partId||"",partTitle:sn.partTitle||"",chapterId:sn.chapterId||"",chapterTitle:sn.chapterTitle||""})),Af=hs.filter(sn=>Ln.has(sn.id)).map(sn=>({...sn,partId:Y,partTitle:P.title||Y,chapterId:H,chapterTitle:ie.title||H})),As=hs.filter(sn=>!Ln.has(sn.id));let ao=As.length;for(let sn=As.length-1;sn>=0;sn-=1){const li=As[sn];if(li.partId===Y&&li.chapterId===H){ao=sn+1;break}}return[...As.slice(0,ao),...Af,...As.slice(ao)]},Re=async()=>{const Ln=Ae(),hs=await Rt("/api/db/book",{action:"reorder",items:Ln});return hs&&hs.success!==!1?(alert(`已移动 ${$.length} 节到「${P.title}」-「${ie.title}」`),ae(!1),oe([]),await mn(),!0):!1},Ot={action:"move-sections",sectionIds:$,targetPartId:Y,targetChapterId:H,targetPartTitle:P.title||Y,targetChapterTitle:ie.title||H},Vt=await Rt("/api/db/book",Ot);if(Vt&&Vt.success!==!1)alert(`已移动 ${Vt.count??$.length} 节到「${P.title}」-「${ie.title}」`),ae(!1),oe([]),await mn();else{const Ln=Vt&&typeof Vt=="object"&&"error"in Vt?Vt.error||"":"未知错误";if((Ln.includes("缺少 id")||Ln.includes("无效的 action"))&&await Re())return;alert("移动失败: "+Ln)}}catch(Ae){console.error(Ae),alert("移动失败: "+(Ae instanceof Error?Ae.message:"网络或服务异常"))}finally{he(!1)}},td=P=>{oe(ie=>ie.includes(P)?ie.filter(Ae=>Ae!==P):[...ie,P])},so=async P=>{const ie=t.filter(Ae=>Ae.partId===P.id).map(Ae=>Ae.id);if(ie.length===0){alert("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${P.title}」整篇吗?将删除共 ${ie.length} 节内容,此操作不可恢复。`))try{for(const Ae of ie)await Yr(`/api/db/book?id=${encodeURIComponent(Ae)}`);mn()}catch(Ae){console.error(Ae),alert("删除失败")}},nd=async()=>{var P;if(v.trim()){C(!0);try{const ie=await Be(`/api/search?q=${encodeURIComponent(v)}`);ie!=null&&ie.success&&((P=ie.data)!=null&&P.results)?k(ie.data.results):(k([]),ie&&!ie.success&&alert("搜索失败: "+ie.error))}catch(ie){console.error(ie),k([]),alert("搜索失败")}finally{C(!1)}}},io=Dn.find(P=>P.id===M.partId),ma=(io==null?void 0:io.chapters)??[];return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",Dn.length," 篇 · ",fa," 节内容"]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(re,{onClick:()=>st(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[i.jsx(au,{className:"w-4 h-4 mr-2"}),"排名算法"]}),i.jsxs(re,{onClick:()=>{const P=typeof window<"u"?`${window.location.origin}/api-doc`:"";P&&window.open(P,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Ns,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),i.jsx(Qt,{open:u,onOpenChange:h,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Lt,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节ID *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:M.id,onChange:P=>D({...M,id:P.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:M.price,onChange:P=>D({...M,price:Number(P.target.value)})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:M.title,onChange:P=>D({...M,title:P.target.value})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"所属篇"}),i.jsxs(tc,{value:M.partId,onValueChange:P=>D({...M,partId:P,chapterId:"chapter-1"}),children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(nc,{})}),i.jsxs(Fo,{className:"bg-[#0f2137] border-gray-700",children:[Dn.map(P=>i.jsx(xs,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id)),Dn.length===0&&i.jsx(xs,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"所属章"}),i.jsxs(tc,{value:M.chapterId,onValueChange:P=>D({...M,chapterId:P}),children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(nc,{})}),i.jsxs(Fo,{className:"bg-[#0f2137] border-gray-700",children:[ma.map(P=>i.jsx(xs,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id)),ma.length===0&&i.jsx(xs,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"内容 (Markdown格式)"}),i.jsx(ul,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:M.content,onChange:P=>D({...M,content:P.target.value})})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Cf,disabled:g||!M.id||!M.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),i.jsx(Qt,{open:!!F,onOpenChange:P=>!P&&R(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),F&&i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"篇名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:F.title,onChange:P=>R({...F,title:P.target.value}),placeholder:"输入篇名"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>R(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Zc,disabled:I||!((gr=F==null?void 0:F.title)!=null&&gr.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:I?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Qt,{open:!!X,onOpenChange:P=>!P&&q(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),X&&i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:X.title,onChange:P=>q({...X,title:P.target.value}),placeholder:"输入章节名称"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>q(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Tf,disabled:Z||!((rd=X==null?void 0:X.title)!=null&&rd.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Z?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Qt,{open:V,onOpenChange:P=>{var ie;if(ae(P),P&&Dn.length>0){const Ae=Dn[0];L(Ae.id),ue(((ie=Ae.chapters[0])==null?void 0:ie.id)??"")}},children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:"批量移动至指定目录"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",i.jsx("span",{className:"text-[#38bdac] font-medium",children:$.length})," 节,请选择目标篇与章。"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标篇"}),i.jsxs(tc,{value:Y,onValueChange:P=>{var Ae;L(P);const ie=Dn.find(Re=>Re.id===P);ue(((Ae=ie==null?void 0:ie.chapters[0])==null?void 0:Ae.id)??"")},children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(nc,{placeholder:"选择篇"})}),i.jsx(Fo,{className:"bg-[#0f2137] border-gray-700",children:Dn.map(P=>i.jsx(xs,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标章"}),i.jsxs(tc,{value:H,onValueChange:ue,children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(nc,{placeholder:"选择章"})}),i.jsx(Fo,{className:"bg-[#0f2137] border-gray-700",children:(((rr=Dn.find(P=>P.id===Y))==null?void 0:rr.chapters)??[]).map(P=>i.jsx(xs,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id))})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>ae(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:xl,disabled:U||$.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:U?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),i.jsx(Qt,{open:!!B,onOpenChange:P=>!P&&me(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white",children:["付款记录 — ",(B==null?void 0:B.section.title)??""]})}),i.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Se?i.jsxs("div",{className:"flex items-center justify-center py-8",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):B&&B.orders.length===0?i.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):B?i.jsxs("table",{className:"w-full text-sm border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[i.jsx("th",{className:"py-2 pr-2",children:"订单号"}),i.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),i.jsx("th",{className:"py-2 pr-2",children:"金额"}),i.jsx("th",{className:"py-2 pr-2",children:"状态"}),i.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),i.jsx("tbody",{children:B.orders.map(P=>i.jsxs("tr",{className:"border-b border-gray-700/50",children:[i.jsx("td",{className:"py-2 pr-2",children:i.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${P.orderSn}`,onClick:()=>window.open(`/orders?search=${P.orderSn??P.id??""}`,"_blank"),children:P.orderSn?P.orderSn.length>16?P.orderSn.slice(0,8)+"..."+P.orderSn.slice(-6):P.orderSn:"-"})}),i.jsx("td",{className:"py-2 pr-2",children:i.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${P.userId??P.openId??""}`,onClick:()=>window.open(`/users?search=${P.userId??P.openId??""}`,"_blank"),children:(()=>{const ie=P.userId??P.openId??"-";return ie.length>12?ie.slice(0,6)+"..."+ie.slice(-4):ie})()})}),i.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",P.amount??0]}),i.jsx("td",{className:"py-2 pr-2 text-gray-300",children:P.status??"-"}),i.jsx("td",{className:"py-2 pr-2 text-gray-500",children:P.payTime??P.createdAt??"-"})]},P.id??P.orderSn??""))})]}):null})]})}),i.jsx(Qt,{open:Ye,onOpenChange:st,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(au,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),ft?i.jsx("p",{className:"text-gray-500",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"阅读权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Qe.readWeight,onChange:P=>Xe(ie=>({...ie,readWeight:Math.max(0,Math.min(1,parseFloat(P.target.value)||0))}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"新度权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Qe.recencyWeight,onChange:P=>Xe(ie=>({...ie,recencyWeight:Math.max(0,Math.min(1,parseFloat(P.target.value)||0))}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"付款权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Qe.payWeight,onChange:P=>Xe(ie=>({...ie,payWeight:Math.max(0,Math.min(1,parseFloat(P.target.value)||0))}))})]})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(Qe.readWeight+Qe.recencyWeight+Qe.payWeight).toFixed(1)]}),i.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[i.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),i.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),i.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),i.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),i.jsx(re,{onClick:ds,disabled:Jt||Math.abs(Qe.readWeight+Qe.recencyWeight+Qe.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Jt?"保存中...":"保存权重"})]})]})]})}),i.jsx(Qt,{open:O,onOpenChange:W,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Lt,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:Q,onChange:P=>ee(P.target.value),placeholder:"输入篇名"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>{W(!1),ee("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Mf,disabled:de||!Q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:de?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),i.jsx(Qt,{open:!!o,onOpenChange:()=>c(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[i.jsx(Xt,{className:"shrink-0 px-6 pt-6 pb-2",children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&i.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:P=>c({...o,id:P.target.value}),placeholder:"如: 9.15"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:P=>c({...o,price:Number(P.target.value),isFree:Number(P.target.value)===0}),disabled:o.isFree})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"免费"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:P=>c({...o,isFree:P.target.checked,price:P.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最新新增"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:P=>c({...o,isNew:P.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序直推"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:P=>c({...o,isPinned:P.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"热度分"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:P=>c({...o,hotScore:Math.max(0,parseFloat(P.target.value)||0)})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:P=>c({...o,title:P.target.value})})]}),o.filePath&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"文件路径"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsx(S2,{ref:Yn,content:o.content||"",onChange:P=>c({...o,content:P}),onImageUpload:async P=>{var Ot;const ie=new FormData;ie.append("file",P),ie.append("folder","book-images");const Re=await(await fetch(Qo("/api/upload"),{method:"POST",body:ie,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((Ot=Re==null?void 0:Re.data)==null?void 0:Ot.url)||(Re==null?void 0:Re.url)||""},persons:kn,linkTags:Ms,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),i.jsxs(bn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&i.jsxs(re,{variant:"outline",onClick:()=>us({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[i.jsx(zr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),i.jsxs(re,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsx(re,{onClick:Yc,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),i.jsxs(Wc,{defaultValue:"chapters",className:"space-y-6",children:[i.jsxs(dl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(en,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(zr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),i.jsxs(en,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[i.jsx(Ab,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),i.jsxs(en,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(Ki,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),i.jsxs(en,{value:"link-ai",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[i.jsx(Ns,{className:"w-4 h-4 mr-2"}),"链接AI"]})]}),i.jsxs(tn,{value:"chapters",className:"space-y-4",children:[i.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:i.jsx(zr,{className:"w-6 h-6"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),i.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),i.jsxs("div",{className:"text-center shrink-0",children:[i.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:fa}),i.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs(re,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新建章节"]}),i.jsxs(re,{onClick:()=>W(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新建篇"]}),i.jsxs(re,{variant:"outline",onClick:()=>ae(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",$.length," 节)"]})]}),n?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsx(VB,{parts:Dn,expandedParts:s,onTogglePart:ls,onReorder:oi,onReadSection:ro,onDeleteSection:cs,onAddSectionInPart:Qc,onAddChapterInPart:ed,onDeleteChapter:$t,onEditPart:Xc,onDeletePart:so,onEditChapter:Ef,selectedSectionIds:$,onToggleSectionSelect:td,onShowSectionOrders:us,pinnedSectionIds:zt})]}),i.jsx(tn,{value:"search",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"内容搜索"})}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:v,onChange:P=>j(P.target.value),onKeyDown:P=>P.key==="Enter"&&nd()}),i.jsx(re,{onClick:nd,disabled:E||!v.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?i.jsx(qe,{className:"w-4 h-4 animate-spin"}):i.jsx(Ki,{className:"w-4 h-4"})})]}),w.length>0&&i.jsxs("div",{className:"space-y-2 mt-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",w.length," 个结果"]}),w.map(P=>i.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>ro({id:P.id,title:P.title,price:P.price??1,filePath:""}),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:P.id}),i.jsx("span",{className:"text-white",children:P.title}),zt.includes(P.id)&&i.jsx(Ho,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),i.jsx(Fe,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:P.matchType==="title"?"标题匹配":"内容匹配"})]}),P.snippet&&i.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:P.snippet}),(P.partTitle||P.chapterTitle)&&i.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[P.partTitle," · ",P.chapterTitle]})]},P.id))]})]})]})}),i.jsxs(tn,{value:"ranking",className:"space-y-4",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{className:"pb-3",children:i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(au,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),i.jsx(Te,{children:i.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(te,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),i.jsx(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:pn,onChange:P=>mr(Math.max(1,Math.min(100,Number(P.target.value)||20))),disabled:Br}),i.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),i.jsx(re,{size:"sm",onClick:Sf,disabled:fe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:fe?"保存中...":"保存"}),i.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",pn,"% 内容"]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{className:"pb-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(Ab,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",i.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",si.length," 节"]})]}),i.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[i.jsx(re,{variant:"ghost",size:"sm",disabled:qn<=1,onClick:()=>ss(P=>Math.max(1,P-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx($T,{className:"w-4 h-4"})}),i.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[qn," / ",ii]}),i.jsx(re,{variant:"ghost",size:"sm",disabled:qn>=ii,onClick:()=>ss(P=>Math.min(ii,P+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx(Bo,{className:"w-4 h-4"})})]})]})}),i.jsx(Te,{children:i.jsxs("div",{className:"space-y-0",children:[i.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[i.jsx("span",{children:"排名"}),i.jsx("span",{children:"置顶"}),i.jsx("span",{children:"标题"}),i.jsx("span",{className:"text-right",children:"点击量"}),i.jsx("span",{className:"text-right",children:"付款数"}),i.jsx("span",{className:"text-right",children:"热度"}),i.jsx("span",{className:"text-right",children:"编辑"})]}),ai.map((P,ie)=>{const Ae=(qn-1)*Er+ie+1,Re=zt.includes(P.id);return i.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${Re?"bg-amber-500/5":""}`,children:[i.jsx("span",{className:`text-sm font-bold ${Ae<=3?"text-amber-400":"text-gray-500"}`,children:Ae<=3?["🥇","🥈","🥉"][Ae-1]:`#${Ae}`}),i.jsx(re,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${Re?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Cn(P.id),disabled:is,title:Re?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:Re?i.jsx(Ho,{className:"w-3.5 h-3.5 fill-current"}):i.jsx(oA,{className:"w-3.5 h-3.5"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"text-white text-sm truncate block",children:P.title}),i.jsxs("span",{className:"text-gray-600 text-xs",children:[P.partTitle," · ",P.chapterTitle]})]}),i.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:P.clickCount??0}),i.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:P.payCount??0}),i.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(P.hotScore??0).toFixed(1)}),i.jsx("div",{className:"text-right",children:i.jsx(re,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>ro({id:P.id,title:P.title,price:P.price,filePath:""}),title:"编辑文章",children:i.jsx(wt,{className:"w-3 h-3"})})})]},P.id)}),ai.length===0&&i.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),i.jsxs(tn,{value:"link-ai",className:"space-y-4",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"pb-3",children:[i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"在文章中 @人物,小程序端点击可跳转存客宝流量池或详情页"})]}),i.jsxs(Te,{className:"space-y-3",children:[i.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"名称 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 卡若",value:Jn.name,onChange:P=>as({...Jn,name:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"自动生成",value:Jn.personId,onChange:P=>as({...Jn,personId:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"如 超级个体",value:Jn.label,onChange:P=>as({...Jn,label:P.target.value})})]}),i.jsxs(re,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8",onClick:async()=>{if(!Jn.name)return alert("名称必填");const P={...Jn};P.personId||(P.personId=Jn.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36)),await ht("/api/db/persons",P),as({personId:"",name:"",label:""}),Ke()},children:[i.jsx(Lt,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[kn.map(P=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsxs("span",{className:"text-[#38bdac] font-bold text-base",children:["@",P.name]}),i.jsx("span",{className:"text-gray-600 text-xs font-mono",children:P.id}),P.label&&i.jsx(Fe,{variant:"secondary",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:P.label})]}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Yr(`/api/db/persons?personId=${P.id}`),Ke()},children:i.jsx(er,{className:"w-3 h-3"})})]},P.id)),kn.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"pb-3",children:[i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(yM,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),i.jsxs(Te,{className:"space-y-3",children:[i.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"标签ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:pt.tagId,onChange:P=>Sn({...pt,tagId:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"显示文字"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:pt.label,onChange:P=>Sn({...pt,label:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"类型"}),i.jsxs(tc,{value:pt.type,onValueChange:P=>Sn({...pt,type:P}),children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:i.jsx(nc,{})}),i.jsxs(Fo,{children:[i.jsx(xs,{value:"url",children:"网页链接"}),i.jsx(xs,{value:"miniprogram",children:"小程序"}),i.jsx(xs,{value:"ckb",children:"存客宝"})]})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:pt.type==="url"?"URL地址":pt.type==="ckb"?"存客宝计划URL":"小程序AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:pt.type==="url"?"https://...":pt.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"wx...",value:pt.type==="url"||pt.type==="ckb"?pt.url:pt.appId,onChange:P=>{pt.type==="url"||pt.type==="ckb"?Sn({...pt,url:P.target.value}):Sn({...pt,appId:P.target.value})}})]}),pt.type==="miniprogram"&&i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"页面路径"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:pt.pagePath,onChange:P=>Sn({...pt,pagePath:P.target.value})})]}),i.jsxs(re,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!pt.tagId||!pt.label)return alert("标签ID和显示文字必填");const P={...pt};P.type==="miniprogram"&&P.appId&&(P.url=`weixin://dl/business/?appid=${P.appId}&path=${P.pagePath}`),await ht("/api/db/link-tags",P),Sn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Ze()},children:[i.jsx(Lt,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[Ms.map(P=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsxs("span",{className:"text-amber-400 font-bold text-base",children:["#",P.label]}),i.jsx(Fe,{variant:"secondary",className:`text-[10px] ${P.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:P.type==="url"?"网页":P.type==="ckb"?"存客宝":"小程序"}),i.jsxs("a",{href:P.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[P.url," ",i.jsx(Xs,{className:"w-3 h-3 shrink-0"})]})]}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Yr(`/api/db/link-tags?tagId=${P.id}`),Ze()},children:i.jsx(er,{className:"w-3 h-3"})})]},P.id)),Ms.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"pb-3",children:[i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(au,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),i.jsxs(Te,{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"绑定计划"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往 ",i.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]})]})]})}const qs={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function aN(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):qs.stats}function oN(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):qs.highlights}function kE(){const[t,e]=b.useState(qs),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Be("/api/admin/author-settings").then(k=>{const E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??qs.name),avatar:String(E.avatar??qs.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??qs.title),bio:String(E.bio??qs.bio),stats:aN(E.stats).length?aN(E.stats):qs.stats,highlights:oN(E.highlights).length?oN(E.highlights):qs.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{a(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(M=>M.label||M.value),highlights:t.highlights.filter(Boolean)},E=await ht("/api/admin/author-settings",k);if(!E||E.success===!1){alert("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:""));return}a(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),alert("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},f=async k=>{var C;const E=(C=k.target.files)==null?void 0:C[0];if(E){c(!0);try{const M=new FormData;M.append("file",E),M.append("folder","avatars");const D=Sx(),F={};D&&(F.Authorization=`Bearer ${D}`);const I=await(await fetch(Qo("/api/upload"),{method:"POST",body:M,credentials:"include",headers:F})).json();I!=null&&I.success&&(I!=null&&I.url)?e(A=>({...A,avatarImg:I.url})):alert("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(M){console.error(M),alert("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(E=>({...E,stats:E.stats.filter((C,M)=>M!==k)})),y=(k,E,C)=>e(M=>({...M,stats:M.stats.map((D,F)=>F===k?{...D,[E]:C}:D)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(E=>({...E,highlights:E.highlights.filter((C,M)=>M!==k)})),w=(k,E)=>e(C=>({...C,highlights:C.highlights.map((M,D)=>D===k?E:M)}));return n?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(La,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),i.jsxs(re,{onClick:h,disabled:s||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(La,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),i.jsx(It,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"姓名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(E=>({...E,name:k.target.value})),placeholder:"卡若"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(E=>({...E,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(zN,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(E=>({...E,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),i.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),i.jsxs(re,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[i.jsx(Uu,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:t.avatarImg.startsWith("http")?t.avatarImg:Qo(t.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"头衔"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(E=>({...E,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"个人简介"}),i.jsx(ul,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(E=>({...E,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsx(tt,{className:"text-white",children:"统计数据"}),i.jsx(It,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),i.jsxs(Te,{className:"space-y-3",children:[t.stats.map((k,E)=>i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>y(E,"label",C.target.value),placeholder:"标签"}),i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>y(E,"value",C.target.value),placeholder:"数值"}),i.jsx(re,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(E),children:i.jsx(er,{className:"w-4 h-4"})})]},E)),i.jsxs(re,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsx(tt,{className:"text-white",children:"亮点标签"}),i.jsx(It,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),i.jsxs(Te,{className:"space-y-3",children:[t.highlights.map((k,E)=>i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>w(E,C.target.value),placeholder:"5年私域运营经验"}),i.jsx(re,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(E),children:i.jsx(er,{className:"w-4 h-4"})})]},E)),i.jsxs(re,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function SE(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=Fx(h,300),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(!1),[E,C]=b.useState(null),[M,D]=b.useState(""),[F,R]=b.useState(""),[I,A]=b.useState(""),[O,W]=b.useState("admin"),[X,q]=b.useState("active"),[Z,_]=b.useState(!1);async function $(){var H;y(!0),j(null);try{const ue=new URLSearchParams({page:String(s),pageSize:String(o)});m.trim()&&ue.set("search",m.trim());const U=await Be(`/api/admin/users?${ue}`);U!=null&&U.success?(e(U.records||[]),r(U.total??0),u(U.totalPages??0)):j(U.error||"加载失败")}catch(ue){const U=ue;j(U.status===403?"无权限访问":((H=U==null?void 0:U.data)==null?void 0:H.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{$()},[s,o,m]);const oe=()=>{C(null),D(""),R(""),A(""),W("admin"),q("active"),k(!0)},V=H=>{C(H),D(H.username),R(""),A(H.name||""),W(H.role==="super_admin"?"super_admin":"admin"),q(H.status==="disabled"?"disabled":"active"),k(!0)},ae=async()=>{var H;if(!M.trim()){j("用户名不能为空");return}if(!E&&!F){j("新建时密码必填,至少 6 位");return}if(F&&F.length<6){j("密码至少 6 位");return}j(null),_(!0);try{if(E){const ue=await Rt("/api/admin/users",{id:E.id,password:F||void 0,name:I.trim(),role:O,status:X});ue!=null&&ue.success?(k(!1),$()):j((ue==null?void 0:ue.error)||"保存失败")}else{const ue=await ht("/api/admin/users",{username:M.trim(),password:F,name:I.trim(),role:O});ue!=null&&ue.success?(k(!1),$()):j((ue==null?void 0:ue.error)||"保存失败")}}catch(ue){const U=ue;j(((H=U==null?void 0:U.data)==null?void 0:H.error)||"保存失败")}finally{_(!1)}},Y=async H=>{var ue;if(confirm("确定删除该管理员?"))try{const U=await Yr(`/api/admin/users?id=${H}`);U!=null&&U.success?$():j((U==null?void 0:U.error)||"删除失败")}catch(U){const he=U;j(((ue=he==null?void 0:he.data)==null?void 0:ue.error)||"删除失败")}},L=H=>{if(!H)return"-";try{const ue=new Date(H);return isNaN(ue.getTime())?H:ue.toLocaleString("zh-CN")}catch{return H}};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(qh,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ce,{placeholder:"搜索用户名/昵称",value:h,onChange:H=>f(H.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),i.jsx(re,{variant:"outline",size:"sm",onClick:$,disabled:g,className:"border-gray-600 text-gray-300",children:i.jsx(qe,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),i.jsxs(re,{onClick:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),v&&i.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[i.jsx("span",{children:v}),i.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:g?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户名"}),i.jsx(ke,{className:"text-gray-400",children:"昵称"}),i.jsx(ke,{className:"text-gray-400",children:"角色"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(H=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:H.id}),i.jsx(ve,{className:"text-white font-medium",children:H.username}),i.jsx(ve,{className:"text-gray-400",children:H.name||"-"}),i.jsx(ve,{children:i.jsx(Fe,{variant:"outline",className:H.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:H.role==="super_admin"?"超级管理员":"管理员"})}),i.jsx(ve,{children:i.jsx(Fe,{variant:"outline",className:H.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:H.status==="active"?"正常":"已禁用"})}),i.jsx(ve,{className:"text-gray-500 text-sm",children:L(H.createdAt)}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>V(H),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Y(H.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},H.id)),t.length===0&&!g&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:v==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&i.jsx("div",{className:"p-4 border-t border-gray-700/50",children:i.jsx(Zr,{page:s,pageSize:o,total:n,totalPages:c,onPageChange:a})})]})})}),i.jsx(Qt,{open:w,onOpenChange:k,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:E?"编辑管理员":"新增管理员"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"用户名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:M,onChange:H=>D(H.target.value),disabled:!!E}),E&&i.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:E?"新密码(留空不改)":"密码"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:E?"留空表示不修改":"至少 6 位",value:F,onChange:H=>R(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:I,onChange:H=>A(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色"}),i.jsxs("select",{value:O,onChange:H=>W(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[i.jsx("option",{value:"admin",children:"管理员"}),i.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),E&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"状态"}),i.jsxs("select",{value:X,onChange:H=>q(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[i.jsx("option",{value:"active",children:"正常"}),i.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:ae,disabled:Z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),Z?"保存中...":"保存"]})]})]})})]})}const UB={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},KB={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},qB={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...KB}},GB={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},JB=["system","author","admin"];function YB(){const[t,e]=AN(),n=t.get("tab")??"system",r=JB.includes(n)?n:"system",[s,a]=b.useState(qB),[o,c]=b.useState(GB),[u,h]=b.useState(UB),[f,m]=b.useState(!1),[g,y]=b.useState(!0),[v,j]=b.useState(!1),[w,k]=b.useState(""),[E,C]=b.useState(""),[M,D]=b.useState(!1),[F,R]=b.useState(!1),I=(q,Z,_=!1)=>{k(q),C(Z),D(_),j(!0)};b.useEffect(()=>{(async()=>{try{const Z=await Be("/api/admin/settings");if(!Z||Z.success===!1)return;if(Z.featureConfig&&Object.keys(Z.featureConfig).length&&c(_=>({..._,...Z.featureConfig})),Z.mpConfig&&typeof Z.mpConfig=="object"&&h(_=>({..._,...Z.mpConfig})),Z.siteSettings&&typeof Z.siteSettings=="object"){const _=Z.siteSettings;a($=>({...$,...typeof _.sectionPrice=="number"&&{sectionPrice:_.sectionPrice},...typeof _.baseBookPrice=="number"&&{baseBookPrice:_.baseBookPrice},...typeof _.distributorShare=="number"&&{distributorShare:_.distributorShare},..._.authorInfo&&typeof _.authorInfo=="object"&&{authorInfo:{...$.authorInfo,..._.authorInfo}}}))}}catch(Z){console.error("Load settings error:",Z)}finally{y(!1)}})()},[]);const A=async(q,Z)=>{R(!0);try{const _=await ht("/api/admin/settings",{featureConfig:q});if(!_||_.success===!1){Z(),I("保存失败",(_==null?void 0:_.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(_){console.error("Save feature config error:",_),Z(),I("保存失败",_ instanceof Error?_.message:String(_),!0)}finally{R(!1)}},O=(q,Z)=>{const _=o,$={..._,[q]:Z};c($),A($,()=>c(_))},W=async()=>{m(!0);try{const q=await ht("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:s.sectionPrice,baseBookPrice:s.baseBookPrice,distributorShare:s.distributorShare,authorInfo:s.authorInfo},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10}});if(!q||q.success===!1){I("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(q){console.error("Save settings error:",q),I("保存失败",q instanceof Error?q.message:String(q),!0)}finally{m(!1)}},X=q=>{e(q==="system"?{}:{tab:q})};return g?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&i.jsxs(re,{onClick:W,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),i.jsxs(Wc,{value:r,onValueChange:X,className:"w-full",children:[i.jsxs(dl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(en,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(Da,{className:"w-4 h-4 mr-2"}),"系统设置"]}),i.jsxs(en,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(pm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),i.jsxs(en,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(qh,{className:"w-4 h-4 mr-2"}),"管理员"]})]}),i.jsx(tn,{value:"system",className:"mt-0",children:i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(pm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),i.jsx(It,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(pm,{className:"w-3 h-3"}),"主理人名称"]}),i.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.name??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,name:q.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(kc,{className:"w-3 h-3"}),"开播日期"]}),i.jsx(ce,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:s.authorInfo.startDate??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,startDate:q.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(kc,{className:"w-3 h-3"}),"直播时间"]}),i.jsx(ce,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:s.authorInfo.liveTime??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,liveTime:q.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[i.jsx($N,{className:"w-3 h-3"}),"直播平台"]}),i.jsx(ce,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:s.authorInfo.platform??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,platform:q.target.value}}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(zr,{className:"w-3 h-3"}),"简介描述"]}),i.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.description??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,description:q.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),i.jsx(ul,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:s.authorInfo.bio??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,bio:q.target.value}}))})]}),i.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[i.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(s.authorInfo.name??"K").charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-semibold",children:s.authorInfo.name}),i.jsx("p",{className:"text-gray-400 text-xs",children:s.authorInfo.description}),i.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",s.authorInfo.liveTime," · ",s.authorInfo.platform]})]})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Wu,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),i.jsx(Te,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单节价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:s.sectionPrice,onChange:q=>a(Z=>({...Z,sectionPrice:Number.parseFloat(q.target.value)||1}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:s.baseBookPrice,onChange:q=>a(Z=>({...Z,baseBookPrice:Number.parseFloat(q.target.value)||9.9}))})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Sc,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),i.jsx(It,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),i.jsx(Te,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序 AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:q=>h(Z=>({...Z,appId:q.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:q=>h(Z=>({...Z,withdrawSubscribeTmplId:q.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:q=>h(Z=>({...Z,mchId:q.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:q=>h(Z=>({...Z,minWithdraw:Number.parseFloat(q.target.value)||10}))})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Da,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),i.jsx(It,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Pn,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),i.jsx(vt,{id:"match-enabled",checked:o.matchEnabled,disabled:F,onCheckedChange:q=>O("matchEnabled",q)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(dM,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),i.jsx(vt,{id:"referral-enabled",checked:o.referralEnabled,disabled:F,onCheckedChange:q=>O("referralEnabled",q)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(zr,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),i.jsx(vt,{id:"search-enabled",checked:o.searchEnabled,disabled:F,onCheckedChange:q=>O("searchEnabled",q)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Da,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),i.jsx(vt,{id:"about-enabled",checked:o.aboutEnabled,disabled:F,onCheckedChange:q=>O("aboutEnabled",q)})]})]}),i.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:i.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),i.jsx(tn,{value:"author",className:"mt-0",children:i.jsx(kE,{})}),i.jsx(tn,{value:"admin",className:"mt-0",children:i.jsx(SE,{})})]}),i.jsx(Qt,{open:v,onOpenChange:j,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[i.jsxs(Xt,{children:[i.jsx(Zt,{className:M?"text-red-400":"text-[#38bdac]",children:w}),i.jsx(MI,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:E})]}),i.jsx(bn,{className:"mt-4",children:i.jsx(re,{onClick:()=>j(!1),className:M?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const lN={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function QB(){const[t,e]=b.useState(!1),[n,r]=b.useState(lN),[s,a]=b.useState(""),o=async()=>{e(!0);try{const k=await Be("/api/config");k!=null&&k.paymentMethods&&r({...lN,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await ht("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),alert("配置已保存!")}catch(k){console.error("保存失败:",k),alert("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,E)=>{navigator.clipboard.writeText(k),a(E),setTimeout(()=>a(""),2e3)},h=(k,E)=>{r(C=>({...C,wechat:{...C.wechat,[k]:E}}))},f=(k,E)=>{r(C=>({...C,alipay:{...C.alipay,[k]:E}}))},m=(k,E)=>{r(C=>({...C,usdt:{...C.usdt,[k]:E}}))},g=(k,E)=>{r(C=>({...C,paypal:{...C.paypal,[k]:E}}))},y=n.wechat,v=n.alipay,j=n.usdt,w=n.paypal;return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),i.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(re,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),i.jsxs(re,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),i.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(IN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),i.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[i.jsx("li",{children:"打开微信,进入目标微信群"}),i.jsx("li",{children:'点击右上角"..." → "群二维码"'}),i.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),i.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),i.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),i.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),i.jsxs(Wc,{defaultValue:"wechat",className:"space-y-6",children:[i.jsxs(dl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[i.jsxs(en,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[i.jsx(Sc,{className:"w-4 h-4 mr-2"}),"微信"]}),i.jsxs(en,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[i.jsx(pg,{className:"w-4 h-4 mr-2"}),"支付宝"]}),i.jsxs(en,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[i.jsx(Eb,{className:"w-4 h-4 mr-2"}),"USDT"]}),i.jsxs(en,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[i.jsx(gg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),i.jsx(tn,{value:"wechat",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Sc,{className:"w-5 h-5"}),"微信支付配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),i.jsx(vt,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"网站AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"商户号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[i.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[i.jsx(Xs,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),i.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[i.jsx(te,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),i.jsx(ce,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),i.jsx(tn,{value:"alipay",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#1677FF] flex items-center gap-2",children:[i.jsx(pg,{className:"w-5 h-5"}),"支付宝配置"]}),i.jsx(It,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),i.jsx(vt,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"合作者身份 (PID)"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),i.jsx(re,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:s==="pid"?i.jsx(Kh,{className:"w-4 h-4 text-green-500"}):i.jsx(ON,{className:"w-4 h-4 text-gray-400"})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[i.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[i.jsx(Xs,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),i.jsx(tn,{value:"usdt",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#26A17B] flex items-center gap-2",children:[i.jsx(Eb,{className:"w-5 h-5"}),"USDT配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),i.jsx(vt,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"网络类型"}),i.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[i.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),i.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),i.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"收款地址"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(j.address??""),onChange:k=>m("address",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),i.jsx(tn,{value:"paypal",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#169BD7] flex items-center gap-2",children:[i.jsx(gg,{className:"w-5 h-5"}),"PayPal配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),i.jsx(vt,{checked:!!w.enabled,onCheckedChange:k=>g("enabled",k)})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(w.email??""),onChange:k=>g("email",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const XB={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},ZB={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},eV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function tV(){const[t,e]=b.useState({siteConfig:{...XB},menuConfig:{...ZB},pageConfig:{...eV}}),[n,r]=b.useState(!1),[s,a]=b.useState(!1);b.useEffect(()=>{Be("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{a(!0);try{await ht("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await ht("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await ht("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),alert("配置已保存")}catch(f){console.error(f),alert("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{a(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),i.jsxs(re,{onClick:o,disabled:s,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":n?"已保存":"保存设置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(gg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),i.jsx(It,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),i.jsx(ce,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),i.jsx(ce,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),i.jsx(ce,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),i.jsx(ce,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),i.jsx(ce,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(eA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),i.jsx(It,{className:"text-gray-400",children:"配置网站主题色"})]}),i.jsx(Te,{children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"space-y-2 flex-1",children:[i.jsx(te,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(ce,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),i.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(qM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),i.jsx(It,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),i.jsx(Te,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>i.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[i.jsx(vt,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),i.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),i.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(oM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首页副标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目录页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"我的页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"关于作者标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function nV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[s,a]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,j,w;try{const k=await Be("/api/config"),E=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(E)&&e(E.join(` -`));const C=(w=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:w.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,v)=>{navigator.clipboard.writeText(y),a(v),setTimeout(()=>a(""),2e3)},f=async()=>{try{const y=t.split(` -`).map(j=>j.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await ht("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),alert("群活码配置已保存!"),await u()}catch(y){console.error(y),alert("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await ht("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),alert("保存失败: "+(v instanceof Error?v.message:String(v)))}},g=()=>{n?window.open(n,"_blank"):alert("请先配置微信群链接")};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"mb-8",children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),i.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(IN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),i.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[i.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[i.jsx("li",{children:"访问草料二维码创建活码"}),i.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),i.jsx("li",{children:"复制生成的短链接填入下方配置"}),i.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),i.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[i.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),i.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),i.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),i.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Mb,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),i.jsx(It,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(xg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:y=>r(y.target.value)}),i.jsx(re,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:s==="group"?i.jsx(Kh,{className:"w-4 h-4 text-green-500"}):i.jsx(ON,{className:"w-4 h-4 text-gray-400"})})]}),i.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(re,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[i.jsx(Uu,{className:"w-4 h-4 mr-2"}),"保存配置"]}),i.jsxs(re,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[i.jsx(Xs,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Mb,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),i.jsx(It,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),i.jsxs(Te,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(xg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),i.jsx(ul,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[i.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),i.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` -`).filter(Boolean).length," 个"]})]}),i.jsxs(re,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Uu,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),i.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[i.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),i.jsxs("div",{className:"space-y-3 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),i.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),i.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const cN={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},rV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function sV(){const[t,e]=b.useState(cN),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Be("/api/db/config/full?key=match_config"),M=(C==null?void 0:C.data)??(C==null?void 0:C.config);M&&e({...cN,...M})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{a(!0);try{const C=await ht("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),alert("保存失败")}finally{a(!1)}},v=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},w=()=>{if(!f.id||!f.label){alert("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const M=C.findIndex(D=>D.id===u.id);M!==-1&&(C[M]={...f})}else{if(C.some(M=>M.id===f.id)){alert("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(M=>M.id!==C)})},E=C=>{e({...t,matchTypes:t.matchTypes.map(M=>M.id===C?{...M,enabled:!M.enabled}:M)})};return i.jsxs("div",{className:"p-8 w-full space-y-6",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Da,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(re,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),i.jsxs(re,{onClick:y,disabled:s,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存配置"]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Bi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Te,{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:C=>e({...t,freeMatchLimit:parseInt(C.target.value,10)||0})}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:C=>e({...t,matchPrice:parseFloat(C.target.value)||1})}),i.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),i.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:C=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(C.target.value,10)||10}})}),i.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),i.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),i.jsx(It,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(re,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),i.jsx(Te,{children:i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"图标"}),i.jsx(ke,{className:"text-gray-400",children:"类型ID"}),i.jsx(ke,{className:"text-gray-400",children:"显示名称"}),i.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),i.jsx(ke,{className:"text-gray-400",children:"价格"}),i.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(pr,{children:t.matchTypes.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx("span",{className:"text-2xl",children:C.icon})}),i.jsx(ve,{className:"font-mono text-gray-300",children:C.id}),i.jsx(ve,{className:"text-white font-medium",children:C.label}),i.jsx(ve,{className:"text-gray-300",children:C.matchLabel}),i.jsx(ve,{children:i.jsxs(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),i.jsx(ve,{children:C.matchFromDB?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(ve,{children:i.jsx(vt,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),i.jsx(Qt,{open:o,onOpenChange:c,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[u?i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Lt,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:C=>m({...f,id:C.target.value}),disabled:!!u})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"图标"}),i.jsx("div",{className:"flex gap-1 flex-wrap",children:rV.map(C=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===C?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:C}),children:C},C))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"显示名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:C=>m({...f,label:C.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配标签"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:C=>m({...f,matchLabel:C.target.value})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:C=>m({...f,price:parseFloat(C.target.value)||1})})]}),i.jsxs("div",{className:"flex gap-6 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(re,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const dN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function iV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function v(){m(!0),y(null);try{const w=new URLSearchParams({page:String(s),pageSize:String(o)});u&&w.set("matchType",u);const k=await Be(`/api/db/match-records?${w}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(w){console.error("加载匹配记录失败",w),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[s,u]);const j=Math.ceil(n/o)||1;return i.jsxs("div",{className:"p-8 w-full",children:[g&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:g}),i.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("select",{value:u,onChange:w=>{h(w.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"",children:"全部类型"}),Object.entries(dN).map(([w,k])=>i.jsx("option",{value:w,children:k},w))]}),i.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:f?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(pr,{children:[t.map(w=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.userAvatar?i.jsx("img",{src:w.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,i.jsx("span",{className:w.userAvatar?"hidden":"",children:(w.userNickname||w.userId||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white",children:w.userNickname||w.userId}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.userId.slice(0,16),"..."]})]})]})}),i.jsx(ve,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.matchedUserAvatar?i.jsx("img",{src:w.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,i.jsx("span",{className:w.matchedUserAvatar?"hidden":"",children:(w.matchedNickname||w.matchedUserId||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white",children:w.matchedNickname||w.matchedUserId}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.matchedUserId.slice(0,16),"..."]})]})]})}),i.jsx(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:dN[w.matchType]||w.matchType})}),i.jsxs(ve,{className:"text-gray-400 text-sm",children:[w.phone&&i.jsxs("div",{children:["📱 ",w.phone]}),w.wechatId&&i.jsxs("div",{children:["💬 ",w.wechatId]}),!w.phone&&!w.wechatId&&"-"]}),i.jsx(ve,{className:"text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleString():"-"})]},w.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:j,total:n,pageSize:o,onPageChange:a,onPageSizeChange:w=>{c(w),a(1)}})]})})})]})}function aV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(null),[u,h]=b.useState(""),[f,m]=b.useState(0),[g,y]=b.useState(!1);async function v(){r(!0);try{const C=await Be("/api/db/vip-roles");C!=null&&C.success&&C.data&&e(C.data)}catch(C){console.error("Load roles error:",C)}finally{r(!1)}}b.useEffect(()=>{v()},[]);const j=()=>{c(null),h(""),m(t.length>0?Math.max(...t.map(C=>C.sort))+1:0),a(!0)},w=C=>{c(C),h(C.name),m(C.sort),a(!0)},k=async()=>{if(!u.trim()){alert("角色名称不能为空");return}y(!0);try{if(o){const C=await Rt("/api/db/vip-roles",{id:o.id,name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):alert("更新失败: "+(C==null?void 0:C.error))}else{const C=await ht("/api/db/vip-roles",{name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):alert("新增失败: "+(C==null?void 0:C.error))}}catch(C){console.error("Save error:",C),alert("保存失败")}finally{y(!1)}},E=async C=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const M=await Yr(`/api/db/vip-roles?id=${C}`);M!=null&&M.success?v():alert("删除失败: "+(M==null?void 0:M.error))}catch(M){console.error("Delete error:",M),alert("删除失败")}};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),i.jsxs(re,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"角色名称"}),i.jsx(ke,{className:"text-gray-400",children:"排序"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(C=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:C.id}),i.jsx(ve,{className:"text-white",children:C.name}),i.jsx(ve,{className:"text-gray-400",children:C.sort}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>w(C),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>E(C.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),i.jsx(Qt,{open:s,onOpenChange:a,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:o?"编辑角色":"新增角色"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:u,onChange:C=>h(C.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f,onChange:C=>m(parseInt(C.target.value,10)||0)})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>a(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:k,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function CE(t){const[e,n]=b.useState([]),[r,s]=b.useState(!0),[a,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,v]=b.useState(!1),j=b.useRef(null),w=async I=>{var O;const A=(O=I.target.files)==null?void 0:O[0];if(A){v(!0);try{const W=new FormData;W.append("file",A),W.append("folder","mentors");const X=Sx(),q={};X&&(q.Authorization=`Bearer ${X}`);const _=await(await fetch(Qo("/api/upload"),{method:"POST",body:W,credentials:"include",headers:q})).json();_!=null&&_.success&&(_!=null&&_.url)?f($=>({...$,avatar:_.url})):alert("上传失败: "+((_==null?void 0:_.error)||"未知错误"))}catch(W){console.error(W),alert("上传失败")}finally{v(!1),j.current&&(j.current.value="")}}};async function k(){s(!0);try{const I=await Be("/api/db/mentors");I!=null&&I.success&&I.data&&n(I.data)}catch(I){console.error("Load mentors error:",I)}finally{s(!1)}}b.useEffect(()=>{k()},[]);const E=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(I=>I.sort))+1:0,enabled:!0})},C=()=>{u(null),E(),o(!0)},M=I=>{u(I),f({name:I.name,avatar:I.avatar||"",intro:I.intro||"",tags:I.tags||"",priceSingle:I.priceSingle!=null?String(I.priceSingle):"",priceHalfYear:I.priceHalfYear!=null?String(I.priceHalfYear):"",priceYear:I.priceYear!=null?String(I.priceYear):"",quote:I.quote||"",whyFind:I.whyFind||"",offering:I.offering||"",judgmentStyle:I.judgmentStyle||"",sort:I.sort,enabled:I.enabled??!0}),o(!0)},D=async()=>{if(!h.name.trim()){alert("导师姓名不能为空");return}g(!0);try{const I=O=>O===""?void 0:parseFloat(O),A={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:I(h.priceSingle),priceHalfYear:I(h.priceHalfYear),priceYear:I(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const O=await Rt("/api/db/mentors",{id:c.id,...A});O!=null&&O.success?(o(!1),k()):alert("更新失败: "+(O==null?void 0:O.error))}else{const O=await ht("/api/db/mentors",A);O!=null&&O.success?(o(!1),k()):alert("新增失败: "+(O==null?void 0:O.error))}}catch(I){console.error("Save error:",I),alert("保存失败")}finally{g(!1)}},F=async I=>{if(confirm("确定删除该导师?"))try{const A=await Yr(`/api/db/mentors?id=${I}`);A!=null&&A.success?k():alert("删除失败: "+(A==null?void 0:A.error))}catch(A){console.error("Delete error:",A),alert("删除失败")}},R=I=>I!=null?`¥${I}`:"-";return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),i.jsxs(re,{onClick:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:r?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"姓名"}),i.jsx(ke,{className:"text-gray-400",children:"简介"}),i.jsx(ke,{className:"text-gray-400",children:"单次"}),i.jsx(ke,{className:"text-gray-400",children:"半年"}),i.jsx(ke,{className:"text-gray-400",children:"年度"}),i.jsx(ke,{className:"text-gray-400",children:"排序"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[e.map(I=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:I.id}),i.jsx(ve,{className:"text-white",children:I.name}),i.jsx(ve,{className:"text-gray-400 max-w-[200px] truncate",children:I.intro||"-"}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceSingle)}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceHalfYear)}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceYear)}),i.jsx(ve,{className:"text-gray-400",children:I.sort}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>M(I),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>F(I.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},I.id)),e.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),i.jsx(Qt,{open:a,onOpenChange:o,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:c?"编辑导师":"新增导师"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"姓名 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:I=>f(A=>({...A,name:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:I=>f(A=>({...A,sort:parseInt(I.target.value,10)||0}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"头像"}),i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:I=>f(A=>({...A,avatar:I.target.value})),placeholder:"点击上传或粘贴图片地址"}),i.jsx("input",{ref:j,type:"file",accept:"image/*",className:"hidden",onChange:w}),i.jsxs(re,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var I;return(I=j.current)==null?void 0:I.click()},children:[i.jsx(Uu,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:h.avatar.startsWith("http")?h.avatar:Qo(h.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"简介"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:I=>f(A=>({...A,intro:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:I=>f(A=>({...A,tags:I.target.value}))})]}),i.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[i.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:I=>f(A=>({...A,priceSingle:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:I=>f(A=>({...A,priceHalfYear:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:I=>f(A=>({...A,priceYear:I.target.value}))})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"引言"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:I=>f(A=>({...A,quote:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:I=>f(A=>({...A,whyFind:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:I=>f(A=>({...A,offering:I.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:I=>f(A=>({...A,judgmentStyle:I.target.value}))})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:I=>f(A=>({...A,enabled:I.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),i.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:D,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function oV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState("");async function o(){r(!0);try{const h=s?`/api/db/mentor-consultations?status=${s}`:"/api/db/mentor-consultations",f=await Be(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[s]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(kc,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:s,onChange:h=>a(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[i.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>i.jsx("option",{value:h,children:f},h))]}),i.jsxs(re,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户ID"}),i.jsx(ke,{className:"text-gray-400",children:"导师ID"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(pr,{children:[t.map(h=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:h.id}),i.jsx(ve,{className:"text-gray-400",children:h.userId}),i.jsx(ve,{className:"text-gray-400",children:h.mentorId}),i.jsx(ve,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),i.jsxs(ve,{className:"text-white",children:["¥",h.amount]}),i.jsx(ve,{className:"text-gray-400",children:c[h.status]||h.status}),i.jsx(ve,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const cc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},uN={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:cc},lV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function cV(){const t=ia(),[e,n]=b.useState(uN),[r,s]=b.useState(!0),[a,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,v]=b.useState(null),[j,w]=b.useState(!1),k=async()=>{w(!0);try{const A=await Be("/api/db/match-pool-counts");A!=null&&A.success&&A.data&&v(A.data)}catch(A){console.error("加载池子人数失败:",A)}finally{w(!1)}},E=async()=>{s(!0);try{const A=await Be("/api/db/config/full?key=match_config"),O=(A==null?void 0:A.data)??(A==null?void 0:A.config);if(O){let W=O.poolSettings??cc;W.poolSource&&!Array.isArray(W.poolSource)&&(W={...W,poolSource:[W.poolSource]}),n({...uN,...O,poolSettings:W})}}catch(A){console.error("加载匹配配置失败:",A)}finally{s(!1)}};b.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const A=await ht("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});alert((A==null?void 0:A.success)!==!1?"配置保存成功!":"保存失败: "+((A==null?void 0:A.error)||"未知错误"))}catch(A){console.error(A),alert("保存失败")}finally{o(!1)}},M=A=>{f(A),g({...A}),u(!0)},D=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},F=()=>{if(!m.id||!m.label){alert("请填写类型ID和名称");return}const A=[...e.matchTypes];if(h){const O=A.findIndex(W=>W.id===h.id);O!==-1&&(A[O]={...m})}else{if(A.some(O=>O.id===m.id)){alert("类型ID已存在");return}A.push({...m})}n({...e,matchTypes:A}),u(!1)},R=A=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(O=>O.id!==A)})},I=A=>{n({...e,matchTypes:e.matchTypes.map(O=>O.id===A?{...O,enabled:!O.enabled}:O)})};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex justify-end gap-3",children:[i.jsxs(re,{variant:"outline",onClick:E,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:C,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"})," ",a?"保存中...":"保存配置"]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(DN,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),i.jsx(It,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),i.jsxs(Te,{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),i.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(A=>{const O=e.poolSettings??cc,X=(Array.isArray(O.poolSource)?O.poolSource:[O.poolSource]).includes(A.value),q=y==null?void 0:y[A.countKey],Z=()=>{const _=Array.isArray(O.poolSource)?[...O.poolSource]:[O.poolSource],$=X?_.filter(oe=>oe!==A.value):[..._,A.value];$.length===0&&$.push(A.value),n({...e,poolSettings:{...O,poolSource:$}})};return i.jsxs("button",{type:"button",onClick:Z,className:`p-4 rounded-lg border text-left transition-all ${X?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${X?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:X&&"✓"}),i.jsx("span",{className:"text-xl",children:A.icon}),i.jsx("span",{className:`text-sm font-medium ${X?"text-[#38bdac]":"text-gray-300"}`,children:A.label})]}),i.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":q??"-",i.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),i.jsx("p",{className:"text-gray-500 text-xs mt-2",children:A.desc}),i.jsx("span",{role:"link",tabIndex:0,onClick:_=>{_.stopPropagation(),t(`/users?pool=${A.value}`)},onKeyDown:_=>{_.key==="Enter"&&(_.stopPropagation(),t(`/users?pool=${A.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},A.value)})})]}),i.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[i.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(A=>{const W=(e.poolSettings??cc)[A.key];return i.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[i.jsx(vt,{checked:W,onCheckedChange:X=>n({...e,poolSettings:{...e.poolSettings??cc,[A.key]:X}})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{children:A.icon}),i.jsx(te,{className:"text-gray-300 text-sm",children:A.label})]})]},A.key)})})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Bi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Te,{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:A=>n({...e,freeMatchLimit:parseInt(A.target.value,10)||0})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:A=>n({...e,matchPrice:parseFloat(A.target.value)||1})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),i.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:A=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(A.target.value,10)||10}})})]})]}),i.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:e.settings.enableFreeMatches,onCheckedChange:A=>n({...e,settings:{...e.settings,enableFreeMatches:A}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:e.settings.enablePaidMatches,onCheckedChange:A=>n({...e,settings:{...e.settings,enablePaidMatches:A}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),i.jsx(It,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(re,{onClick:D,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),i.jsx(Te,{children:i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"图标"}),i.jsx(ke,{className:"text-gray-400",children:"类型ID"}),i.jsx(ke,{className:"text-gray-400",children:"显示名称"}),i.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),i.jsx(ke,{className:"text-gray-400",children:"价格"}),i.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(pr,{children:e.matchTypes.map(A=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx("span",{className:"text-2xl",children:A.icon})}),i.jsx(ve,{className:"font-mono text-gray-300",children:A.id}),i.jsx(ve,{className:"text-white font-medium",children:A.label}),i.jsx(ve,{className:"text-gray-300",children:A.matchLabel}),i.jsx(ve,{children:i.jsxs(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",A.price]})}),i.jsx(ve,{children:A.matchFromDB?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(ve,{children:i.jsx(vt,{checked:A.enabled,onCheckedChange:()=>I(A.id)})}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>M(A),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>R(A.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},A.id))})]})})]}),i.jsx(Qt,{open:c,onOpenChange:u,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[h?i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Lt,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:A=>g({...m,id:A.target.value}),disabled:!!h})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"图标"}),i.jsx("div",{className:"flex gap-1 flex-wrap",children:lV.map(A=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===A?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:A}),children:A},A))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"显示名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:A=>g({...m,label:A.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配标签"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:A=>g({...m,matchLabel:A.target.value})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:A=>g({...m,price:parseFloat(A.target.value)||1})})]}),i.jsxs("div",{className:"flex gap-6 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:m.matchFromDB,onCheckedChange:A=>g({...m,matchFromDB:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:m.showJoinAfterMatch,onCheckedChange:A=>g({...m,showJoinAfterMatch:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:m.enabled,onCheckedChange:A=>g({...m,enabled:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(re,{onClick:F,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const hN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function dV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[v,j]=b.useState(null);async function w(){m(!0),y(null);try{const C=new URLSearchParams({page:String(s),pageSize:String(o)});u&&C.set("matchType",u);const M=await Be(`/api/db/match-records?${C}`);M!=null&&M.success?(e(M.records||[]),r(M.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{w()},[s,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:M,avatar:D})=>i.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[D?i.jsx("img",{src:D,alt:"",className:"w-full h-full object-cover",onError:F=>{F.currentTarget.style.display="none"}}):null,i.jsx("span",{className:D?"hidden":"",children:(M||C||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:M||C}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[C==null?void 0:C.slice(0,16),(C==null?void 0:C.length)>16?"...":""]})]})]});return i.jsxs("div",{children:[g&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:g}),i.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("select",{value:u,onChange:C=>{h(C.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"",children:"全部类型"}),Object.entries(hN).map(([C,M])=>i.jsx("option",{value:C,children:M},C))]}),i.jsxs("button",{type:"button",onClick:w,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:f?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(pr,{children:[t.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),i.jsx(ve,{children:C.matchedUserId?i.jsx(E,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):i.jsx("span",{className:"text-gray-500",children:"—"})}),i.jsx(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:hN[C.matchType]||C.matchType})}),i.jsxs(ve,{className:"text-sm",children:[C.phone&&i.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&i.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&i.jsx("span",{className:"text-gray-600",children:"-"})]}),i.jsx(ve,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:k,total:n,pageSize:o,onPageChange:a,onPageSizeChange:C=>{c(C),a(1)}})]})})}),i.jsx($x,{open:!!v,onClose:()=>j(null),userId:v,onUserUpdated:w})]})}function uV(){const[t,e]=b.useState("records");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),i.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&i.jsx(dV,{}),t==="pool"&&i.jsx(cV,{})]})}const fN={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function hV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function v(){h(!0);try{const E=new URLSearchParams({page:String(s),pageSize:String(o),matchType:f}),C=await Be(`/api/db/match-records?${E}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(E){console.error(E)}finally{h(!1)}}b.useEffect(()=>{v()},[s,f]);const j=async E=>{if(!E.phone&&!E.wechatId){alert("该记录无联系方式,无法推送到存客宝");return}y(E.id);try{const C=await ht("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});alert((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){alert("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{y(null)}},w=Math.ceil(n/o)||1,k=E=>!!(E.phone||E.wechatId);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),i.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("select",{value:f,onChange:E=>{m(E.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(fN).map(([E,C])=>i.jsx("option",{value:E,children:C},E))}),i.jsxs(re,{onClick:v,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:u?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"时间"}),i.jsx(ke,{className:"text-gray-400 text-right",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(E=>{var C,M;return i.jsxs(ct,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[i.jsx(ve,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),i.jsx(ve,{className:"text-white",children:E.matchedNickname||((M=E.matchedUserId)==null?void 0:M.slice(0,12))}),i.jsx(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:fN[E.matchType]||E.matchType})}),i.jsxs(ve,{className:"text-sm",children:[E.phone&&i.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&i.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&i.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),i.jsx(ve,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),i.jsx(ve,{className:"text-right",children:k(E)?i.jsxs(re,{size:"sm",onClick:()=>j(E),disabled:g===E.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[i.jsx(yA,{className:"w-3 h-3 mr-1"}),g===E.id?"推送中...":"推送CKB"]}):i.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},E.id)}),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:w,total:n,pageSize:o,onPageChange:a,onPageSizeChange:E=>{c(E),a(1)}})]})})})]})}const pN={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},fV={single:"单次",half_year:"半年",year:"年度"};function pV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState("");async function o(){r(!0);try{const c=s?`/api/db/mentor-consultations?status=${s}`:"/api/db/mentor-consultations",u=await Be(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[s]),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:s,onChange:c=>a(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[i.jsx("option",{value:"",children:"全部状态"}),Object.entries(pN).map(([c,u])=>i.jsx("option",{value:c,children:u},c))]}),i.jsxs(re,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户ID"}),i.jsx(ke,{className:"text-gray-400",children:"导师ID"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(pr,{children:[t.map(c=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:c.id}),i.jsx(ve,{className:"text-gray-400",children:c.userId}),i.jsx(ve,{className:"text-gray-400",children:c.mentorId}),i.jsx(ve,{className:"text-gray-400",children:fV[c.consultationType]||c.consultationType}),i.jsxs(ve,{className:"text-white",children:["¥",c.amount]}),i.jsx(ve,{className:"text-gray-400",children:pN[c.status]||c.status}),i.jsx(ve,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function mV(){const[t,e]=b.useState("booking");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),i.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&i.jsx(pV,{}),t==="manage"&&i.jsx("div",{className:"-mx-8",children:i.jsx(CE,{embedded:!0})})]})}function gV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(s),pageSize:String(o),matchType:"team"}),y=await Be(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[s]);const m=Math.ceil(n/o)||1;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),i.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),i.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:u?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"时间"})]})}),i.jsxs(pr,{children:[t.map(g=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{className:"text-white",children:g.userNickname||g.userId}),i.jsx(ve,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),i.jsxs(ve,{className:"text-gray-400 text-sm",children:[g.phone&&i.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&i.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),i.jsx(ve,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:m,total:n,pageSize:o,onPageChange:a,onPageSizeChange:g=>{c(g),a(1)}})]})})})]})}const mN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},gN={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function xV({onSwitchTab:t,onOpenCKB:e}={}){const n=ia(),[r,s]=b.useState(null),[a,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var m,g;u(!0);try{const[y,v]=await Promise.allSettled([Be("/api/db/match-records?stats=true"),Be("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let j=y.value.data;if(j.totalMatches>0&&(!j.uniqueUsers||j.uniqueUsers===0))try{const w=await Be("/api/db/match-records?page=1&pageSize=200");if(w!=null&&w.success&&w.records){const k=new Set(w.records.map(E=>E.userId).filter(Boolean));j={...j,uniqueUsers:k.size}}}catch{}s(j)}v.status==="fulfilled"&&((g=v.value)!=null&&g.success)&&v.value.data&&o(v.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[i.jsx(Ee,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),i.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),i.jsx(Ee,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-yellow-500/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),i.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[i.jsx(Bi,{className:"w-3 h-3"})," 今日实时"]})]})}),i.jsx(Ee,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),i.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"})," 查看用户管理"]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:f(r==null?void 0:r.paidMatchCount)})]})})]})]}),(r==null?void 0:r.byType)&&r.byType.length>0&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:r.byType.map(m=>{const g=r.totalMatches>0?m.count/r.totalMatches*100:0;return i.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("span",{className:"text-2xl",children:gN[m.matchType]||"📊"}),i.jsx("span",{className:"text-gray-300 font-medium",children:mN[m.matchType]||m.matchType})]}),i.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),i.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),i.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[i.jsx(Ns,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.ckbTotal)??0}),i.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.withContact)??0}),i.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:i.jsxs(Te,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),i.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),i.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(a==null?void 0:a.byType)&&a.byType.length>0&&i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:a.byType.map(m=>i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsx("span",{className:"text-xl",children:gN[m.matchType]||"📋"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-xs",children:mN[m.matchType]||m.matchType}),i.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const yV=["partner","investor","mentor","team"],og=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],xN=`# 场景获客接口摘要 -- 地址:POST /v1/api/scenarios -- 必填:apiKey、sign、timestamp -- 主标识:phone 或 wechatId 至少一项 -- 可选:name、source、remark、tags、siteTags、portrait -- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function vV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,s]=b.useState("13800000000"),[a,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(xN),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[j,w]=b.useState([]),[k,E]=b.useState([]),[C,M]=b.useState({}),[D,F]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),R=b.useMemo(()=>{const _={};return og.forEach($=>{_[$.key]=C[$.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),_},[C]),I=_=>{const $=r.trim(),oe=a.trim();return _<=3?{type:yV[_],phone:$||void 0,wechat:oe||void 0,userId:"admin_test",name:"后台测试"}:_===4?{matchType:"partner",phone:$||void 0,wechat:oe||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:_===5?{phone:$||void 0,wechatId:oe||void 0,userId:"admin_test",name:"后台测试"}:{}};async function A(){v(!0);try{const[_,$,oe]=await Promise.all([Be("/api/db/config/full?key=ckb_config"),Be("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Be("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),V=_==null?void 0:_.data;V!=null&&V.routes&&M(V.routes),V!=null&&V.docNotes&&u(V.docNotes),V!=null&&V.docContent&&f(V.docContent),$!=null&&$.success&&w($.records||[]),oe!=null&&oe.success&&E(oe.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{A()},[]);async function O(){g(!0);try{const _=await ht("/api/db/config",{key:"ckb_config",value:{routes:R,docNotes:c,docContent:h},description:"存客宝接口配置"});alert((_==null?void 0:_.success)!==!1?"存客宝配置已保存":`保存失败: ${(_==null?void 0:_.error)||"未知错误"}`)}catch(_){alert(`保存失败: ${_ instanceof Error?_.message:"网络错误"}`)}finally{g(!1)}}const W=(_,$)=>{M(oe=>({...oe,[_]:{...R[_],...$}}))},X=async _=>{const $=D[_];if($.method==="POST"&&!r.trim()&&!a.trim()){alert("请填写测试手机号");return}const oe=[...D];oe[_]={...$,status:"testing",message:void 0,responseTime:void 0},F(oe);const V=performance.now();try{const ae=$.method==="GET"?await Be($.endpoint):await ht($.endpoint,I(_)),Y=Math.round(performance.now()-V),L=(ae==null?void 0:ae.message)||"",H=(ae==null?void 0:ae.success)===!0||L.includes("已存在")||L.includes("已加入")||L.includes("已提交"),ue=[...D];ue[_]={...$,status:H?"success":"error",message:L||(H?"正常":"异常"),responseTime:Y},F(ue),await A()}catch(ae){const Y=Math.round(performance.now()-V),L=[...D];L[_]={...$,status:"error",message:ae instanceof Error?ae.message:"失败",responseTime:Y},F(L)}},q=async()=>{if(!r.trim()&&!a.trim()){alert("请填写测试手机号");return}for(let _=0;_i.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),i.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),i.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),i.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),i.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),i.jsx("tbody",{children:_.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:$})}):_.map(oe=>i.jsxs("tr",{className:"border-t border-gray-700/30",children:[i.jsx("td",{className:"px-4 py-3 text-white",children:oe.userNickname||oe.userId}),i.jsx("td",{className:"px-4 py-3 text-gray-300",children:oe.matchType}),i.jsx("td",{className:"px-4 py-3 text-green-400",children:oe.phone||"—"}),i.jsx("td",{className:"px-4 py-3 text-blue-400",children:oe.wechatId||"—"}),i.jsx("td",{className:"px-4 py-3 text-gray-400",children:oe.createdAt?new Date(oe.createdAt).toLocaleString():"—"})]},oe.id))})]})});return i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:i.jsxs(Te,{className:"p-5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),i.jsx(Fe,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),i.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"})," API 文档"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{onClick:()=>A(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:O,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),i.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([_,$])=>i.jsx("button",{type:"button",onClick:()=>n(_),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===_?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:$},_))}),e==="overview"&&i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:j.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:og.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),i.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&Z(j,"暂无已提交线索"),e==="contact"&&Z(k,"暂无有联系方式线索"),e==="config"&&i.jsx("div",{className:"space-y-4",children:og.map(_=>i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-white font-medium",children:_.label}),i.jsx(Fe,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:_.key})]}),i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"API 地址"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].apiUrl,onChange:$=>W(_.key,{apiUrl:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"API Key"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].apiKey,onChange:$=>W(_.key,{apiKey:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"Source"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].source,onChange:$=>W(_.key,{source:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"Tags"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].tags,onChange:$=>W(_.key,{tags:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"SiteTags"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].siteTags,onChange:$=>W(_.key,{siteTags:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[_.key].notes,onChange:$=>W(_.key,{notes:$.target.value})})]})]})]},_.key))}),e==="test"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex gap-3 mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx(Sc,{className:"w-4 h-4 text-gray-500 shrink-0"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:_=>s(_.target.value)})]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:a,onChange:_=>o(_.target.value)})]})]}),i.jsx("div",{className:"flex items-end",children:i.jsxs(re,{onClick:q,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[i.jsx(Bi,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:D.map((_,$)=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[_.status==="idle"&&i.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),_.status==="testing"&&i.jsx(qe,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),_.status==="success"&&i.jsx(hg,{className:"w-3 h-3 text-green-400 shrink-0"}),_.status==="error"&&i.jsx(PN,{className:"w-3 h-3 text-red-400 shrink-0"}),i.jsx("span",{className:"text-white text-xs truncate",children:_.label})]}),i.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[_.responseTime!==void 0&&i.jsxs("span",{className:"text-gray-600 text-[10px]",children:[_.responseTime,"ms"]}),i.jsx("button",{type:"button",onClick:()=>X($),disabled:_.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${_.endpoint}-${$}`))})]}),e==="doc"&&i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),i.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[i.jsx(Xs,{className:"w-3 h-3"})," 打开外链"]})]}),i.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||xN})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[i.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),i.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:_=>u(_.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const bV=[{id:"stats",label:"数据统计",icon:DT},{id:"partner",label:"找伙伴",icon:Pn},{id:"resource",label:"资源对接",icon:_N},{id:"mentor",label:"导师预约",icon:LN},{id:"team",label:"团队招募",icon:vg}];function wV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[s,a]=b.useState("overview");return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),i.jsxs(re,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[i.jsx(Ns,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&i.jsx(vV,{initialTab:s}),i.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:bV.map(o=>{const c=t===o.id;return i.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[i.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&i.jsx(xV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{a(o||"overview"),r(!0)}}),t==="partner"&&i.jsx(uV,{}),t==="resource"&&i.jsx(hV,{}),t==="mentor"&&i.jsx(mV,{}),t==="team"&&i.jsx(gV,{})]})}function NV(){return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[i.jsx(Ns,{className:"w-8 h-8 text-[#38bdac]"}),i.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),i.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"1. 接口总览"})}),i.jsxs(Te,{className:"space-y-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),i.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[i.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),i.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),i.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),i.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),i.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),i.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),i.jsx("li",{children:"/api/config — 配置系统"})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),i.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),i.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"2. 书籍内容"})}),i.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),i.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),i.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"3. 支付"})}),i.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),i.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),i.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"4. 分销与用户"})}),i.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),i.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),i.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"5. 管理后台"})}),i.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),i.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),i.jsx("p",{children:"GET /api/orders — 订单列表"})]})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function jV(){const t=sa();return i.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:i.jsxs("div",{className:"text-center max-w-md",children:[i.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:i.jsx(HT,{className:"w-10 h-10"})}),i.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),i.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),i.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),i.jsx(re,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:i.jsxs(Iu,{to:"/",children:[i.jsx(CM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function kV(){return i.jsxs(dT,{children:[i.jsx(Mt,{path:"/login",element:i.jsx(UR,{})}),i.jsxs(Mt,{path:"/",element:i.jsx(GA,{}),children:[i.jsx(Mt,{index:!0,element:i.jsx(oT,{to:"/dashboard",replace:!0})}),i.jsx(Mt,{path:"dashboard",element:i.jsx(tP,{})}),i.jsx(Mt,{path:"orders",element:i.jsx(nP,{})}),i.jsx(Mt,{path:"users",element:i.jsx(rP,{})}),i.jsx(Mt,{path:"distribution",element:i.jsx(SP,{})}),i.jsx(Mt,{path:"withdrawals",element:i.jsx(CP,{})}),i.jsx(Mt,{path:"content",element:i.jsx(WB,{})}),i.jsx(Mt,{path:"referral-settings",element:i.jsx(wk,{})}),i.jsx(Mt,{path:"author-settings",element:i.jsx(kE,{})}),i.jsx(Mt,{path:"vip-roles",element:i.jsx(aV,{})}),i.jsx(Mt,{path:"mentors",element:i.jsx(CE,{})}),i.jsx(Mt,{path:"mentor-consultations",element:i.jsx(oV,{})}),i.jsx(Mt,{path:"admin-users",element:i.jsx(SE,{})}),i.jsx(Mt,{path:"settings",element:i.jsx(YB,{})}),i.jsx(Mt,{path:"payment",element:i.jsx(QB,{})}),i.jsx(Mt,{path:"site",element:i.jsx(tV,{})}),i.jsx(Mt,{path:"qrcodes",element:i.jsx(nV,{})}),i.jsx(Mt,{path:"find-partner",element:i.jsx(wV,{})}),i.jsx(Mt,{path:"match",element:i.jsx(sV,{})}),i.jsx(Mt,{path:"match-records",element:i.jsx(iV,{})}),i.jsx(Mt,{path:"api-doc",element:i.jsx(NV,{})})]}),i.jsx(Mt,{path:"*",element:i.jsx(jV,{})})]})}p3.createRoot(document.getElementById("root")).render(i.jsx(b.StrictMode,{children:i.jsx(yT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:i.jsx(kV,{})})})); diff --git a/soul-admin/dist/assets/index-GNzyAsgf.js b/soul-admin/dist/assets/index-GNzyAsgf.js new file mode 100644 index 00000000..9faea2fa --- /dev/null +++ b/soul-admin/dist/assets/index-GNzyAsgf.js @@ -0,0 +1,779 @@ +function s4(t,e){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function wN(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cm={exports:{}},Xl={},dm={exports:{}},lt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ub;function i4(){if(ub)return lt;ub=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(z){return z===null||typeof z!="object"?null:(z=m&&z[m]||z["@@iterator"],typeof z=="function"?z:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,j={};function w(z,H,de){this.props=z,this.context=H,this.refs=j,this.updater=de||y}w.prototype.isReactComponent={},w.prototype.setState=function(z,H){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,H,"setState")},w.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function k(){}k.prototype=w.prototype;function E(z,H,de){this.props=z,this.context=H,this.refs=j,this.updater=de||y}var C=E.prototype=new k;C.constructor=E,v(C,w.prototype),C.isPureReactComponent=!0;var T=Array.isArray,O=Object.prototype.hasOwnProperty,B={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function P(z,H,de){var K,fe={},Q=null,oe=null;if(H!=null)for(K in H.ref!==void 0&&(oe=H.ref),H.key!==void 0&&(Q=""+H.key),H)O.call(H,K)&&!R.hasOwnProperty(K)&&(fe[K]=H[K]);var ue=arguments.length-2;if(ue===1)fe.children=de;else if(1>>1,H=_[z];if(0>>1;zs(fe,q))Qs(oe,fe)?(_[z]=oe,_[Q]=q,z=Q):(_[z]=fe,_[K]=q,z=K);else if(Qs(oe,q))_[z]=oe,_[Q]=q,z=Q;else break e}}return se}function s(_,se){var q=_.sortIndex-se.sortIndex;return q!==0?q:_.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,y=!1,v=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(_){for(var se=n(h);se!==null;){if(se.callback===null)r(h);else if(se.startTime<=_)r(h),se.sortIndex=se.expirationTime,e(u,se);else break;se=n(h)}}function T(_){if(j=!1,C(_),!v)if(n(u)!==null)v=!0,$(O);else{var se=n(h);se!==null&&ae(T,se.startTime-_)}}function O(_,se){v=!1,j&&(j=!1,k(P),P=-1),y=!0;var q=g;try{for(C(se),m=n(u);m!==null&&(!(m.expirationTime>se)||_&&!X());){var z=m.callback;if(typeof z=="function"){m.callback=null,g=m.priorityLevel;var H=z(m.expirationTime<=se);se=t.unstable_now(),typeof H=="function"?m.callback=H:m===n(u)&&r(u),C(se)}else r(u);m=n(u)}if(m!==null)var de=!0;else{var K=n(h);K!==null&&ae(T,K.startTime-se),de=!1}return de}finally{m=null,g=q,y=!1}}var B=!1,R=null,P=-1,I=5,L=-1;function X(){return!(t.unstable_now()-L_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<_?Math.floor(1e3/_):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(_){switch(g){case 1:case 2:case 3:var se=3;break;default:se=g}var q=g;g=se;try{return _()}finally{g=q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(_,se){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var q=g;g=_;try{return se()}finally{g=q}},t.unstable_scheduleCallback=function(_,se,q){var z=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0z?(_.sortIndex=q,e(h,_),n(u)===null&&_===n(h)&&(j?(k(P),P=-1):j=!0,ae(T,q-z))):(_.sortIndex=H,e(u,_),v||y||(v=!0,$(O))),_},t.unstable_shouldYield=X,t.unstable_wrapCallback=function(_){var se=g;return function(){var q=g;g=se;try{return _.apply(this,arguments)}finally{g=q}}}})(fm)),fm}var gb;function c4(){return gb||(gb=1,hm.exports=l4()),hm.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var xb;function d4(){if(xb)return dr;xb=1;var t=Hc(),e=c4();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function y(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,d,p,x){if(d===null||typeof d>"u"||y(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,N,S,M){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=N,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=M}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];w[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new j(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){w[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var N=w.hasOwnProperty(d)?w[d]:null;(N!==null?N.type!==0:x||!(2F||N[M]!==S[F]){var U=` +`+N[M].replace(" at new "," at ");return l.displayName&&U.includes("")&&(U=U.replace("",l.displayName)),U}while(1<=M&&0<=F);break}}}finally{de=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?H(l):""}function fe(l){switch(l.tag){case 5:return H(l.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return l=K(l.type,!1),l;case 11:return l=K(l.type.render,!1),l;case 1:return l=K(l.type,!0),l;default:return""}}function Q(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case R:return"Fragment";case B:return"Portal";case I:return"Profiler";case P:return"StrictMode";case Y:return"Suspense";case W:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case X:return(l.displayName||"Context")+".Consumer";case L:return(l._context.displayName||"Context")+".Provider";case Z:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case D:return d=l.displayName||null,d!==null?d:Q(l.type)||"Memo";case $:d=l._payload,l=l._init;try{return Q(l(d))}catch{}}return null}function oe(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(d);case 8:return d===P?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function ue(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ye(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function V(l){var d=ye(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var N=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return N.call(this)},set:function(M){x=""+M,S.call(this,M)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(M){x=""+M},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function ge(l){l._valueTracker||(l._valueTracker=V(l))}function Me(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=ye(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function tt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function et(l,d){var p=d.checked;return q({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function ot(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=ue(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function Ge(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function dt(l,d){Ge(l,d);var p=ue(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?ht(l,d.type,p):d.hasOwnProperty("defaultValue")&&ht(l,d.type,ue(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function Et(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function ht(l,d,p){(d!=="number"||tt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Tt=Array.isArray;function rr(l,d,p,x){if(l=l.options,d){d={};for(var N=0;N"+d.valueOf().toString()+"",d=_n.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Yn(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var Cn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pe=["Webkit","ms","Moz","O"];Object.keys(Cn).forEach(function(l){pe.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),Cn[d]=Cn[l]})});function ve(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||Cn.hasOwnProperty(l)&&Cn[l]?(""+d).trim():d+"px"}function hn(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,N=ve(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,N):l[p]=N}}var Mr=q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fs(l,d){if(d){if(Mr[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function ua(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var En=null;function qr(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var ha=null,xr=null,Gr=null;function ai(l){if(l=_l(l)){if(typeof ha!="function")throw Error(n(280));var d=l.stateNode;d&&(d=kd(d),ha(l.stateNode,l.type,d))}}function ut(l){xr?Gr?Gr.push(l):Gr=[l]:xr=l}function Ar(){if(xr){var l=xr,d=Gr;if(Gr=xr=null,ai(l),d)for(l=0;l>>=0,l===0?32:31-(ad(l)/od|0)|0}var fa=64,A=4194304;function ee(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Se(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,N=l.suspendedLanes,S=l.pingedLanes,M=p&268435455;if(M!==0){var F=M&~N;F!==0?x=ee(F):(S&=M,S!==0&&(x=ee(S)))}else M=p&~N,M!==0?x=ee(M):S!==0&&(x=ee(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&N)===0&&(N=x&-x,S=d&-d,N>=S||N===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function pa(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-Qn(d),l[d]=p}function ma(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=Tl),sy=" ",iy=!1;function ay(l,d){switch(l){case"keyup":return ZE.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function oy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ho=!1;function t3(l,d){switch(l){case"compositionend":return oy(d);case"keypress":return d.which!==32?null:(iy=!0,sy);case"textInput":return l=d.data,l===sy&&iy?null:l;default:return null}}function n3(l,d){if(ho)return l==="compositionend"||!Hf&&ay(l,d)?(l=X0(),fd=_f=fi=null,ho=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=py(p)}}function gy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?gy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function xy(){for(var l=window,d=tt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=tt(l.document)}return d}function Kf(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function u3(l){var d=xy(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&gy(p.ownerDocument.documentElement,p)){if(x!==null&&Kf(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var N=p.textContent.length,S=Math.min(x.start,N);x=x.end===void 0?S:Math.min(x.end,N),!l.extend&&S>x&&(N=x,x=S,S=N),N=my(p,S);var M=my(p,x);N&&M&&(l.rangeCount!==1||l.anchorNode!==N.node||l.anchorOffset!==N.offset||l.focusNode!==M.node||l.focusOffset!==M.offset)&&(d=d.createRange(),d.setStart(N.node,N.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(M.node,M.offset)):(d.setEnd(M.node,M.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,fo=null,qf=null,Pl=null,Gf=!1;function yy(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Gf||fo==null||fo!==tt(x)||(x=fo,"selectionStart"in x&&Kf(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Pl&&Rl(Pl,x)||(Pl=x,x=wd(qf,"onSelect"),0yo||(l.current=ap[yo],ap[yo]=null,yo--)}function At(l,d){yo++,ap[yo]=l.current,l.current=d}var xi={},$n=gi(xi),ir=gi(!1),ya=xi;function vo(l,d){var p=l.type.contextTypes;if(!p)return xi;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var N={},S;for(S in p)N[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=N),N}function ar(l){return l=l.childContextTypes,l!=null}function Sd(){Ot(ir),Ot($n)}function Iy(l,d,p){if($n.current!==xi)throw Error(n(168));At($n,d),At(ir,p)}function Oy(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var N in x)if(!(N in d))throw Error(n(108,oe(l)||"Unknown",N));return q({},p,x)}function Cd(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||xi,ya=$n.current,At($n,l),At(ir,ir.current),!0}function Dy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Oy(l,d,ya),x.__reactInternalMemoizedMergedChildContext=l,Ot(ir),Ot($n),At($n,l)):Ot(ir),At(ir,p)}var Ds=null,Ed=!1,op=!1;function Ly(l){Ds===null?Ds=[l]:Ds.push(l)}function j3(l){Ed=!0,Ly(l)}function yi(){if(!op&&Ds!==null){op=!0;var l=0,d=Qe;try{var p=Ds;for(Qe=1;l>=M,N-=M,Ls=1<<32-Qn(d)+N|p<Ye?(bn=Ke,Ke=null):bn=Ke.sibling;var gt=xe(re,Ke,ie[Ye],Ee);if(gt===null){Ke===null&&(Ke=bn);break}l&&Ke&>.alternate===null&&d(re,Ke),J=S(gt,J,Ye),Ue===null?$e=gt:Ue.sibling=gt,Ue=gt,Ke=bn}if(Ye===ie.length)return p(re,Ke),$t&&ba(re,Ye),$e;if(Ke===null){for(;YeYe?(bn=Ke,Ke=null):bn=Ke.sibling;var Ei=xe(re,Ke,gt.value,Ee);if(Ei===null){Ke===null&&(Ke=bn);break}l&&Ke&&Ei.alternate===null&&d(re,Ke),J=S(Ei,J,Ye),Ue===null?$e=Ei:Ue.sibling=Ei,Ue=Ei,Ke=bn}if(gt.done)return p(re,Ke),$t&&ba(re,Ye),$e;if(Ke===null){for(;!gt.done;Ye++,gt=ie.next())gt=Ne(re,gt.value,Ee),gt!==null&&(J=S(gt,J,Ye),Ue===null?$e=gt:Ue.sibling=gt,Ue=gt);return $t&&ba(re,Ye),$e}for(Ke=x(re,Ke);!gt.done;Ye++,gt=ie.next())gt=Ie(Ke,re,Ye,gt.value,Ee),gt!==null&&(l&>.alternate!==null&&Ke.delete(gt.key===null?Ye:gt.key),J=S(gt,J,Ye),Ue===null?$e=gt:Ue.sibling=gt,Ue=gt);return l&&Ke.forEach(function(r4){return d(re,r4)}),$t&&ba(re,Ye),$e}function Xt(re,J,ie,Ee){if(typeof ie=="object"&&ie!==null&&ie.type===R&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case O:e:{for(var $e=ie.key,Ue=J;Ue!==null;){if(Ue.key===$e){if($e=ie.type,$e===R){if(Ue.tag===7){p(re,Ue.sibling),J=N(Ue,ie.props.children),J.return=re,re=J;break e}}else if(Ue.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===$&&Vy($e)===Ue.type){p(re,Ue.sibling),J=N(Ue,ie.props),J.ref=zl(re,Ue,ie),J.return=re,re=J;break e}p(re,Ue);break}else d(re,Ue);Ue=Ue.sibling}ie.type===R?(J=Ta(ie.props.children,re.mode,Ee,ie.key),J.return=re,re=J):(Ee=tu(ie.type,ie.key,ie.props,null,re.mode,Ee),Ee.ref=zl(re,J,ie),Ee.return=re,re=Ee)}return M(re);case B:e:{for(Ue=ie.key;J!==null;){if(J.key===Ue)if(J.tag===4&&J.stateNode.containerInfo===ie.containerInfo&&J.stateNode.implementation===ie.implementation){p(re,J.sibling),J=N(J,ie.children||[]),J.return=re,re=J;break e}else{p(re,J);break}else d(re,J);J=J.sibling}J=sm(ie,re.mode,Ee),J.return=re,re=J}return M(re);case $:return Ue=ie._init,Xt(re,J,Ue(ie._payload),Ee)}if(Tt(ie))return De(re,J,ie,Ee);if(se(ie))return ze(re,J,ie,Ee);Rd(re,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,J!==null&&J.tag===6?(p(re,J.sibling),J=N(J,ie),J.return=re,re=J):(p(re,J),J=rm(ie,re.mode,Ee),J.return=re,re=J),M(re)):p(re,J)}return Xt}var jo=Hy(!0),Wy=Hy(!1),Pd=gi(null),Id=null,ko=null,fp=null;function pp(){fp=ko=Id=null}function mp(l){var d=Pd.current;Ot(Pd),l._currentValue=d}function gp(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function So(l,d){Id=l,fp=ko=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(or=!0),l.firstContext=null)}function Dr(l){var d=l._currentValue;if(fp!==l)if(l={context:l,memoizedValue:d,next:null},ko===null){if(Id===null)throw Error(n(308));ko=l,Id.dependencies={lanes:0,firstContext:l}}else ko=ko.next=l;return d}var wa=null;function xp(l){wa===null?wa=[l]:wa.push(l)}function Uy(l,d,p,x){var N=d.interleaved;return N===null?(p.next=p,xp(d)):(p.next=N.next,N.next=p),d.interleaved=p,zs(l,x)}function zs(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var vi=!1;function yp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ky(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function $s(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function bi(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(pt&2)!==0){var N=x.pending;return N===null?d.next=d:(d.next=N.next,N.next=d),x.pending=d,zs(l,p)}return N=x.interleaved,N===null?(d.next=d,xp(x)):(d.next=N.next,N.next=d),x.interleaved=d,zs(l,p)}function Od(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,ga(l,p)}}function qy(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var N=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var M={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?N=S=M:S=S.next=M,p=p.next}while(p!==null);S===null?N=S=d:S=S.next=d}else N=S=d;p={baseState:x.baseState,firstBaseUpdate:N,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function Dd(l,d,p,x){var N=l.updateQueue;vi=!1;var S=N.firstBaseUpdate,M=N.lastBaseUpdate,F=N.shared.pending;if(F!==null){N.shared.pending=null;var U=F,le=U.next;U.next=null,M===null?S=le:M.next=le,M=U;var be=l.alternate;be!==null&&(be=be.updateQueue,F=be.lastBaseUpdate,F!==M&&(F===null?be.firstBaseUpdate=le:F.next=le,be.lastBaseUpdate=U))}if(S!==null){var Ne=N.baseState;M=0,be=le=U=null,F=S;do{var xe=F.lane,Ie=F.eventTime;if((x&xe)===xe){be!==null&&(be=be.next={eventTime:Ie,lane:0,tag:F.tag,payload:F.payload,callback:F.callback,next:null});e:{var De=l,ze=F;switch(xe=d,Ie=p,ze.tag){case 1:if(De=ze.payload,typeof De=="function"){Ne=De.call(Ie,Ne,xe);break e}Ne=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=ze.payload,xe=typeof De=="function"?De.call(Ie,Ne,xe):De,xe==null)break e;Ne=q({},Ne,xe);break e;case 2:vi=!0}}F.callback!==null&&F.lane!==0&&(l.flags|=64,xe=N.effects,xe===null?N.effects=[F]:xe.push(F))}else Ie={eventTime:Ie,lane:xe,tag:F.tag,payload:F.payload,callback:F.callback,next:null},be===null?(le=be=Ie,U=Ne):be=be.next=Ie,M|=xe;if(F=F.next,F===null){if(F=N.shared.pending,F===null)break;xe=F,F=xe.next,xe.next=null,N.lastBaseUpdate=xe,N.shared.pending=null}}while(!0);if(be===null&&(U=Ne),N.baseState=U,N.firstBaseUpdate=le,N.lastBaseUpdate=be,d=N.shared.interleaved,d!==null){N=d;do M|=N.lane,N=N.next;while(N!==d)}else S===null&&(N.shared.lanes=0);ka|=M,l.lanes=M,l.memoizedState=Ne}}function Gy(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=jp.transition;jp.transition={};try{l(!1),d()}finally{Qe=p,jp.transition=x}}function fv(){return Lr().memoizedState}function E3(l,d,p){var x=ki(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},pv(l))mv(d,p);else if(p=Uy(l,d,p,x),p!==null){var N=Zn();ns(p,l,x,N),gv(p,d,x)}}function T3(l,d,p){var x=ki(l),N={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(pv(l))mv(d,N);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var M=d.lastRenderedState,F=S(M,p);if(N.hasEagerState=!0,N.eagerState=F,Qr(F,M)){var U=d.interleaved;U===null?(N.next=N,xp(d)):(N.next=U.next,U.next=N),d.interleaved=N;return}}catch{}finally{}p=Uy(l,d,N,x),p!==null&&(N=Zn(),ns(p,l,x,N),gv(p,d,x))}}function pv(l){var d=l.alternate;return l===Wt||d!==null&&d===Wt}function mv(l,d){Vl=zd=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function gv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,ga(l,p)}}var Bd={readContext:Dr,useCallback:Fn,useContext:Fn,useEffect:Fn,useImperativeHandle:Fn,useInsertionEffect:Fn,useLayoutEffect:Fn,useMemo:Fn,useReducer:Fn,useRef:Fn,useState:Fn,useDebugValue:Fn,useDeferredValue:Fn,useTransition:Fn,useMutableSource:Fn,useSyncExternalStore:Fn,useId:Fn,unstable_isNewReconciler:!1},M3={readContext:Dr,useCallback:function(l,d){return ys().memoizedState=[l,d===void 0?null:d],l},useContext:Dr,useEffect:iv,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,$d(4194308,4,lv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return $d(4194308,4,l,d)},useInsertionEffect:function(l,d){return $d(4,2,l,d)},useMemo:function(l,d){var p=ys();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=ys();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=E3.bind(null,Wt,l),[x.memoizedState,l]},useRef:function(l){var d=ys();return l={current:l},d.memoizedState=l},useState:rv,useDebugValue:Ap,useDeferredValue:function(l){return ys().memoizedState=l},useTransition:function(){var l=rv(!1),d=l[0];return l=C3.bind(null,l[1]),ys().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=Wt,N=ys();if($t){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),vn===null)throw Error(n(349));(ja&30)!==0||Xy(x,d,p)}N.memoizedState=p;var S={value:p,getSnapshot:d};return N.queue=S,iv(ev.bind(null,x,S,l),[l]),x.flags|=2048,Ul(9,Zy.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=ys(),d=vn.identifierPrefix;if($t){var p=_s,x=Ls;p=(x&~(1<<32-Qn(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=Hl++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=M.createElement(p,{is:x.is}):(l=M.createElement(p),p==="select"&&(M=l,x.multiple?M.multiple=!0:x.size&&(M.size=x.size))):l=M.createElementNS(l,p),l[gs]=d,l[Ll]=x,Lv(l,d,!1,!1),d.stateNode=l;e:{switch(M=ua(p,x),p){case"dialog":It("cancel",l),It("close",l),N=x;break;case"iframe":case"object":case"embed":It("load",l),N=x;break;case"video":case"audio":for(N=0;NAo&&(d.flags|=128,x=!0,Kl(S,!1),d.lanes=4194304)}else{if(!x)if(l=Ld(M),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Kl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!M.alternate&&!$t)return Bn(d),null}else 2*Vt()-S.renderingStartTime>Ao&&p!==1073741824&&(d.flags|=128,x=!0,Kl(S,!1),d.lanes=4194304);S.isBackwards?(M.sibling=d.child,d.child=M):(p=S.last,p!==null?p.sibling=M:d.child=M,S.last=M)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=Vt(),d.sibling=null,p=Ht.current,At(Ht,x?p&1|2:p&1),d):(Bn(d),null);case 22:case 23:return em(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(wr&1073741824)!==0&&(Bn(d),d.subtreeFlags&6&&(d.flags|=8192)):Bn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function _3(l,d){switch(cp(d),d.tag){case 1:return ar(d.type)&&Sd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Co(),Ot(ir),Ot($n),Np(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return bp(d),null;case 13:if(Ot(Ht),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));No()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Ot(Ht),null;case 4:return Co(),null;case 10:return mp(d.type._context),null;case 22:case 23:return em(),null;case 24:return null;default:return null}}var Ud=!1,Vn=!1,z3=typeof WeakSet=="function"?WeakSet:Set,Oe=null;function To(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){Ut(l,d,x)}else p.current=null}function Vp(l,d,p){try{p()}catch(x){Ut(l,d,x)}}var $v=!1;function $3(l,d){if(ep=ud,l=xy(),Kf(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var N=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var M=0,F=-1,U=-1,le=0,be=0,Ne=l,xe=null;t:for(;;){for(var Ie;Ne!==p||N!==0&&Ne.nodeType!==3||(F=M+N),Ne!==S||x!==0&&Ne.nodeType!==3||(U=M+x),Ne.nodeType===3&&(M+=Ne.nodeValue.length),(Ie=Ne.firstChild)!==null;)xe=Ne,Ne=Ie;for(;;){if(Ne===l)break t;if(xe===p&&++le===N&&(F=M),xe===S&&++be===x&&(U=M),(Ie=Ne.nextSibling)!==null)break;Ne=xe,xe=Ne.parentNode}Ne=Ie}p=F===-1||U===-1?null:{start:F,end:U}}else p=null}p=p||{start:0,end:0}}else p=null;for(tp={focusedElem:l,selectionRange:p},ud=!1,Oe=d;Oe!==null;)if(d=Oe,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Oe=l;else for(;Oe!==null;){d=Oe;try{var De=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(De!==null){var ze=De.memoizedProps,Xt=De.memoizedState,re=d.stateNode,J=re.getSnapshotBeforeUpdate(d.elementType===d.type?ze:Zr(d.type,ze),Xt);re.__reactInternalSnapshotBeforeUpdate=J}break;case 3:var ie=d.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ee){Ut(d,d.return,Ee)}if(l=d.sibling,l!==null){l.return=d.return,Oe=l;break}Oe=d.return}return De=$v,$v=!1,De}function ql(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var N=x=x.next;do{if((N.tag&l)===l){var S=N.destroy;N.destroy=void 0,S!==void 0&&Vp(d,p,S)}N=N.next}while(N!==x)}}function Kd(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function Hp(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function Fv(l){var d=l.alternate;d!==null&&(l.alternate=null,Fv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[gs],delete d[Ll],delete d[ip],delete d[w3],delete d[N3])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function Bv(l){return l.tag===5||l.tag===3||l.tag===4}function Vv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Bv(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Wp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=jd));else if(x!==4&&(l=l.child,l!==null))for(Wp(l,d,p),l=l.sibling;l!==null;)Wp(l,d,p),l=l.sibling}function Up(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(Up(l,d,p),l=l.sibling;l!==null;)Up(l,d,p),l=l.sibling}var An=null,es=!1;function wi(l,d,p){for(p=p.child;p!==null;)Hv(l,d,p),p=p.sibling}function Hv(l,d,p){if(Pr&&typeof Pr.onCommitFiberUnmount=="function")try{Pr.onCommitFiberUnmount(lo,p)}catch{}switch(p.tag){case 5:Vn||To(p,d);case 6:var x=An,N=es;An=null,wi(l,d,p),An=x,es=N,An!==null&&(es?(l=An,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):An.removeChild(p.stateNode));break;case 18:An!==null&&(es?(l=An,p=p.stateNode,l.nodeType===8?sp(l.parentNode,p):l.nodeType===1&&sp(l,p),Sl(l)):sp(An,p.stateNode));break;case 4:x=An,N=es,An=p.stateNode.containerInfo,es=!0,wi(l,d,p),An=x,es=N;break;case 0:case 11:case 14:case 15:if(!Vn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){N=x=x.next;do{var S=N,M=S.destroy;S=S.tag,M!==void 0&&((S&2)!==0||(S&4)!==0)&&Vp(p,d,M),N=N.next}while(N!==x)}wi(l,d,p);break;case 1:if(!Vn&&(To(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(F){Ut(p,d,F)}wi(l,d,p);break;case 21:wi(l,d,p);break;case 22:p.mode&1?(Vn=(x=Vn)||p.memoizedState!==null,wi(l,d,p),Vn=x):wi(l,d,p);break;default:wi(l,d,p)}}function Wv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new z3),d.forEach(function(x){var N=G3.bind(null,l,x);p.has(x)||(p.add(x),x.then(N,N))})}}function ts(l,d){var p=d.deletions;if(p!==null)for(var x=0;xN&&(N=M),x&=~S}if(x=N,x=Vt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*B3(x/1960))-x,10l?16:l,ji===null)var x=!1;else{if(l=ji,ji=null,Qd=0,(pt&6)!==0)throw Error(n(331));var N=pt;for(pt|=4,Oe=l.current;Oe!==null;){var S=Oe,M=S.child;if((Oe.flags&16)!==0){var F=S.deletions;if(F!==null){for(var U=0;UVt()-Gp?Ca(l,0):qp|=p),cr(l,d)}function rb(l,d){d===0&&((l.mode&1)===0?d=1:(d=A,A<<=1,(A&130023424)===0&&(A=4194304)));var p=Zn();l=zs(l,d),l!==null&&(pa(l,d,p),cr(l,p))}function q3(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),rb(l,p)}function G3(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,N=l.memoizedState;N!==null&&(p=N.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),rb(l,p)}var sb;sb=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||ir.current)or=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return or=!1,D3(l,d,p);or=(l.flags&131072)!==0}else or=!1,$t&&(d.flags&1048576)!==0&&_y(d,Md,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;Wd(l,d),l=d.pendingProps;var N=vo(d,$n.current);So(d,p),N=Sp(null,d,x,l,N,p);var S=Cp();return d.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,ar(x)?(S=!0,Cd(d)):S=!1,d.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,yp(d),N.updater=Vd,d.stateNode=N,N._reactInternals=d,Pp(d,x,l,p),d=Lp(null,d,x,!0,S,p)):(d.tag=0,$t&&S&&lp(d),Xn(null,d,N,p),d=d.child),d;case 16:x=d.elementType;e:{switch(Wd(l,d),l=d.pendingProps,N=x._init,x=N(x._payload),d.type=x,N=d.tag=Y3(x),l=Zr(x,l),N){case 0:d=Dp(null,d,x,l,p);break e;case 1:d=Av(null,d,x,l,p);break e;case 11:d=Sv(null,d,x,l,p);break e;case 14:d=Cv(null,d,x,Zr(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Zr(x,N),Dp(l,d,x,N,p);case 1:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Zr(x,N),Av(l,d,x,N,p);case 3:e:{if(Rv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,N=S.element,Ky(l,d),Dd(d,x,null,p);var M=d.memoizedState;if(x=M.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){N=Eo(Error(n(423)),d),d=Pv(l,d,x,p,N);break e}else if(x!==N){N=Eo(Error(n(424)),d),d=Pv(l,d,x,p,N);break e}else for(br=mi(d.stateNode.containerInfo.firstChild),vr=d,$t=!0,Xr=null,p=Wy(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(No(),x===N){d=Fs(l,d,p);break e}Xn(l,d,x,p)}d=d.child}return d;case 5:return Jy(d),l===null&&up(d),x=d.type,N=d.pendingProps,S=l!==null?l.memoizedProps:null,M=N.children,np(x,N)?M=null:S!==null&&np(x,S)&&(d.flags|=32),Mv(l,d),Xn(l,d,M,p),d.child;case 6:return l===null&&up(d),null;case 13:return Iv(l,d,p);case 4:return vp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=jo(d,null,x,p):Xn(l,d,x,p),d.child;case 11:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Zr(x,N),Sv(l,d,x,N,p);case 7:return Xn(l,d,d.pendingProps,p),d.child;case 8:return Xn(l,d,d.pendingProps.children,p),d.child;case 12:return Xn(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,N=d.pendingProps,S=d.memoizedProps,M=N.value,At(Pd,x._currentValue),x._currentValue=M,S!==null)if(Qr(S.value,M)){if(S.children===N.children&&!ir.current){d=Fs(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var F=S.dependencies;if(F!==null){M=S.child;for(var U=F.firstContext;U!==null;){if(U.context===x){if(S.tag===1){U=$s(-1,p&-p),U.tag=2;var le=S.updateQueue;if(le!==null){le=le.shared;var be=le.pending;be===null?U.next=U:(U.next=be.next,be.next=U),le.pending=U}}S.lanes|=p,U=S.alternate,U!==null&&(U.lanes|=p),gp(S.return,p,d),F.lanes|=p;break}U=U.next}}else if(S.tag===10)M=S.type===d.type?null:S.child;else if(S.tag===18){if(M=S.return,M===null)throw Error(n(341));M.lanes|=p,F=M.alternate,F!==null&&(F.lanes|=p),gp(M,p,d),M=S.sibling}else M=S.child;if(M!==null)M.return=S;else for(M=S;M!==null;){if(M===d){M=null;break}if(S=M.sibling,S!==null){S.return=M.return,M=S;break}M=M.return}S=M}Xn(l,d,N.children,p),d=d.child}return d;case 9:return N=d.type,x=d.pendingProps.children,So(d,p),N=Dr(N),x=x(N),d.flags|=1,Xn(l,d,x,p),d.child;case 14:return x=d.type,N=Zr(x,d.pendingProps),N=Zr(x.type,N),Cv(l,d,x,N,p);case 15:return Ev(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Zr(x,N),Wd(l,d),d.tag=1,ar(x)?(l=!0,Cd(d)):l=!1,So(d,p),yv(d,x,N),Pp(d,x,N,p),Lp(null,d,x,!0,l,p);case 19:return Dv(l,d,p);case 22:return Tv(l,d,p)}throw Error(n(156,d.tag))};function ib(l,d){return td(l,d)}function J3(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zr(l,d,p,x){return new J3(l,d,p,x)}function nm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function Y3(l){if(typeof l=="function")return nm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===Z)return 11;if(l===D)return 14}return 2}function Ci(l,d){var p=l.alternate;return p===null?(p=zr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function tu(l,d,p,x,N,S){var M=2;if(x=l,typeof l=="function")nm(l)&&(M=1);else if(typeof l=="string")M=5;else e:switch(l){case R:return Ta(p.children,N,S,d);case P:M=8,N|=8;break;case I:return l=zr(12,p,d,N|2),l.elementType=I,l.lanes=S,l;case Y:return l=zr(13,p,d,N),l.elementType=Y,l.lanes=S,l;case W:return l=zr(19,p,d,N),l.elementType=W,l.lanes=S,l;case ae:return nu(p,N,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case L:M=10;break e;case X:M=9;break e;case Z:M=11;break e;case D:M=14;break e;case $:M=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=zr(M,p,d,N),d.elementType=l,d.type=x,d.lanes=S,d}function Ta(l,d,p,x){return l=zr(7,l,x,d),l.lanes=p,l}function nu(l,d,p,x){return l=zr(22,l,x,d),l.elementType=ae,l.lanes=p,l.stateNode={isHidden:!1},l}function rm(l,d,p){return l=zr(6,l,null,d),l.lanes=p,l}function sm(l,d,p){return d=zr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function Q3(l,d,p,x,N){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mn(0),this.expirationTimes=Mn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mn(0),this.identifierPrefix=x,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function im(l,d,p,x,N,S,M,F,U){return l=new Q3(l,d,p,F,U),d===1?(d=1,S===!0&&(d|=8)):d=0,S=zr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},yp(S),l}function X3(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),um.exports=d4(),um.exports}var vb;function u4(){if(vb)return cu;vb=1;var t=NN();return cu.createRoot=t.createRoot,cu.hydrateRoot=t.hydrateRoot,cu}var h4=u4(),Wc=NN();const jN=wN(Wc);/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Sc(){return Sc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Nx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function p4(){return Math.random().toString(36).substr(2,8)}function wb(t,e){return{usr:t.state,key:t.key,idx:e}}function ug(t,e,n,r){return n===void 0&&(n=null),Sc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?ol(e):e,{state:n,key:e&&e.key||r||p4()})}function qu(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function ol(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function m4(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:a=!1}=r,o=s.history,c=$i.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Sc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=$i.Pop;let w=f(),k=w==null?null:w-h;h=w,u&&u({action:c,location:j.location,delta:k})}function g(w,k){c=$i.Push;let E=ug(j.location,w,k);h=f()+1;let C=wb(E,h),T=j.createHref(E);try{o.pushState(C,"",T)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;s.location.assign(T)}a&&u&&u({action:c,location:j.location,delta:1})}function y(w,k){c=$i.Replace;let E=ug(j.location,w,k);h=f();let C=wb(E,h),T=j.createHref(E);o.replaceState(C,"",T),a&&u&&u({action:c,location:j.location,delta:0})}function v(w){let k=s.location.origin!=="null"?s.location.origin:s.location.href,E=typeof w=="string"?w:qu(w);return E=E.replace(/ $/,"%20"),sn(k,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,k)}let j={get action(){return c},get location(){return t(s,o)},listen(w){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(bb,m),u=w,()=>{s.removeEventListener(bb,m),u=null}},createHref(w){return e(s,w)},createURL:v,encodeLocation(w){let k=v(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(w){return o.go(w)}};return j}var Nb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Nb||(Nb={}));function g4(t,e,n){return n===void 0&&(n="/"),x4(t,e,n)}function x4(t,e,n,r){let s=typeof e=="string"?ol(e):e,a=jx(s.pathname||"/",n);if(a==null)return null;let o=kN(t);y4(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};u.relativePath.startsWith("/")&&(sn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=Wi([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(sn(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),kN(a.children,e,f,h)),!(a.path==null&&!a.index)&&e.push({path:h,score:S4(h,a.index),routesMeta:f})};return t.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))s(a,o);else for(let u of SN(a.path))s(a,o,u)}),e}function SN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return s?[a,""]:[a];let o=SN(r.join("/")),c=[];return c.push(...o.map(u=>u===""?a:[a,u].join("/"))),s&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function y4(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:C4(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const v4=/^:[\w-]+$/,b4=3,w4=2,N4=1,j4=10,k4=-2,jb=t=>t==="*";function S4(t,e){let n=t.split("/"),r=n.length;return n.some(jb)&&(r+=k4),e&&(r+=w4),n.filter(s=>!jb(s)).reduce((s,a)=>s+(v4.test(a)?b4:a===""?N4:j4),r)}function C4(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function E4(t,e,n){let{routesMeta:r}=t,s={},a="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let j=c[m]||"";o=a.slice(0,a.length-j.length).replace(/(.)\/+$/,"$1")}const v=c[m];return y&&!v?h[g]=void 0:h[g]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:o,pattern:t}}function M4(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Nx(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function A4(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Nx(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function jx(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const R4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,P4=t=>R4.test(t);function I4(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?ol(t):t,a;if(n)if(P4(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Nx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=kb(n.substring(1),"/"):a=kb(n,e)}else a=e;return{pathname:a,search:L4(r),hash:_4(s)}}function kb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function pm(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function O4(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function kx(t,e){let n=O4(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Sx(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=ol(t):(s=Sc({},t),sn(!s.pathname||!s.pathname.includes("?"),pm("?","pathname","search",s)),sn(!s.pathname||!s.pathname.includes("#"),pm("#","pathname","hash",s)),sn(!s.search||!s.search.includes("#"),pm("#","search","hash",s)));let a=t===""||s.pathname==="",o=a?"/":s.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;s.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=I4(s,c),h=o&&o!=="/"&&o.endsWith("/"),f=(a||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const Wi=t=>t.join("/").replace(/\/\/+/g,"/"),D4=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),L4=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,_4=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function z4(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const CN=["post","put","patch","delete"];new Set(CN);const $4=["get",...CN];new Set($4);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Cc(){return Cc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=Sx(h,JSON.parse(o),a,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:Wi([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,a,t])}const H4=b.createContext(null);function W4(t){let e=b.useContext(si).outlet;return e&&b.createElement(H4.Provider,{value:t},e)}function MN(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(na),{matches:s}=b.useContext(si),{pathname:a}=ra(),o=JSON.stringify(kx(s,r.v7_relativeSplatPath));return b.useMemo(()=>Sx(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function U4(t,e){return K4(t,e)}function K4(t,e,n,r){ll()||sn(!1);let{navigator:s}=b.useContext(na),{matches:a}=b.useContext(si),o=a[a.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=ra(),f;if(e){var m;let w=typeof e=="string"?ol(e):e;u==="/"||(m=w.pathname)!=null&&m.startsWith(u)||sn(!1),f=w}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let w=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=g4(t,{pathname:y}),j=Q4(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Wi([u,s.encodeLocation?s.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:Wi([u,s.encodeLocation?s.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),a,n,r);return e&&j?b.createElement(Yh.Provider,{value:{location:Cc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:$i.Pop}},j):j}function q4(){let t=tT(),e=z4(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:s},n):null,null)}const G4=b.createElement(q4,null);class J4 extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(si.Provider,{value:this.props.routeContext},b.createElement(EN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Y4(t){let{routeContext:e,match:n,children:r}=t,s=b.useContext(Cx);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(si.Provider,{value:e},r)}function Q4(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var a;if(!n)return null;if(n.errors)t=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(s=n)==null?void 0:s.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||sn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let y,v=!1,j=null,w=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||G4,u&&(h<0&&g===0?(rT("route-fallback"),v=!0,w=null):h===g&&(v=!0,w=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),E=()=>{let C;return y?C=j:v?C=w:m.route.Component?C=b.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,b.createElement(Y4,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(J4,{location:n.location,revalidation:n.revalidation,component:j,error:y,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):E()},null)}var AN=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(AN||{}),RN=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(RN||{});function X4(t){let e=b.useContext(Cx);return e||sn(!1),e}function Z4(t){let e=b.useContext(F4);return e||sn(!1),e}function eT(t){let e=b.useContext(si);return e||sn(!1),e}function PN(t){let e=eT(),n=e.matches[e.matches.length-1];return n.route.id||sn(!1),n.route.id}function tT(){var t;let e=b.useContext(EN),n=Z4(),r=PN();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function nT(){let{router:t}=X4(AN.UseNavigateStable),e=PN(RN.UseNavigateStable),n=b.useRef(!1);return TN(()=>{n.current=!0}),b.useCallback(function(s,a){a===void 0&&(a={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,Cc({fromRouteId:e},a)))},[t,e])}const Sb={};function rT(t,e,n){Sb[t]||(Sb[t]=!0)}function sT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function mm(t){let{to:e,replace:n,state:r,relative:s}=t;ll()||sn(!1);let{future:a,static:o}=b.useContext(na),{matches:c}=b.useContext(si),{pathname:u}=ra(),h=sa(),f=Sx(e,kx(c,a.v7_relativeSplatPath),u,s==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:s}),[h,m,s,n,r]),null}function iT(t){return W4(t.context)}function Dt(t){sn(!1)}function aT(t){let{basename:e="/",children:n=null,location:r,navigationType:s=$i.Pop,navigator:a,static:o=!1,future:c}=t;ll()&&sn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:a,static:o,future:Cc({v7_relativeSplatPath:!1},c)}),[u,c,a,o]);typeof r=="string"&&(r=ol(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:v="default"}=r,j=b.useMemo(()=>{let w=jx(f,u);return w==null?null:{location:{pathname:w,search:m,hash:g,state:y,key:v},navigationType:s}},[u,f,m,g,y,v,s]);return j==null?null:b.createElement(na.Provider,{value:h},b.createElement(Yh.Provider,{children:n,value:j}))}function oT(t){let{children:e,location:n}=t;return U4(hg(e),n)}new Promise(()=>{});function hg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,s)=>{if(!b.isValidElement(r))return;let a=[...e,s];if(r.type===b.Fragment){n.push.apply(n,hg(r.props.children,a));return}r.type!==Dt&&sn(!1),!r.props.index||!r.props.children||sn(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=hg(r.props.children,a)),n.push(o)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function fg(){return fg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[s]=t[s]);return n}function cT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function dT(t,e){return t.button===0&&(!e||e==="_self")&&!cT(t)}function pg(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function uT(t,e){let n=pg(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(a=>{n.append(s,a)})}),n}const hT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],fT="6";try{window.__reactRouterVersion=fT}catch{}const pT="startTransition",Cb=Jh[pT];function mT(t){let{basename:e,children:n,future:r,window:s}=t,a=b.useRef();a.current==null&&(a.current=f4({window:s,v5Compat:!0}));let o=a.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&Cb?Cb(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>sT(r),[r]),b.createElement(aT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const gT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mg=b.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:a,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=lT(e,hT),{basename:y}=b.useContext(na),v,j=!1;if(typeof h=="string"&&xT.test(h)&&(v=h,gT))try{let C=new URL(window.location.href),T=h.startsWith("//")?new URL(C.protocol+h):new URL(h),O=jx(T.pathname,y);T.origin===C.origin&&O!=null?h=O+T.search+T.hash:j=!0}catch{}let w=B4(h,{relative:s}),k=yT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:s,viewTransition:m});function E(C){r&&r(C),C.defaultPrevented||k(C)}return b.createElement("a",fg({},g,{href:v||w,onClick:j||a?r:E,ref:n,target:u}))});var Eb;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Eb||(Eb={}));var Tb;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Tb||(Tb={}));function yT(t,e){let{target:n,replace:r,state:s,preventScrollReset:a,relative:o,viewTransition:c}=e===void 0?{}:e,u=sa(),h=ra(),f=MN(t,{relative:o});return b.useCallback(m=>{if(dT(m,n)){m.preventDefault();let g=r!==void 0?r:qu(h)===qu(f);u(t,{replace:g,state:s,preventScrollReset:a,relative:o,viewTransition:c})}},[h,u,f,r,s,n,t,a,o,c])}function IN(t){let e=b.useRef(pg(t)),n=b.useRef(!1),r=ra(),s=b.useMemo(()=>uT(r.search,n.current?null:e.current),[r.search]),a=sa(),o=b.useCallback((c,u)=>{const h=pg(typeof c=="function"?c(s):c);n.current=!0,a("?"+h,u)},[a,s]);return[s,o]}/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Mb=t=>{const e=bT(t);return e.charAt(0).toUpperCase()+e.slice(1)},ON=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),wT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var NT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jT=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...NT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:ON("lucide",s),...!a&&!wT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(a)?a:[a]]));/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ce=(t,e)=>{const n=b.forwardRef(({className:r,...s},a)=>b.createElement(jT,{ref:a,iconNode:e,className:ON(`lucide-${vT(Mb(t))}`,`lucide-${t}`,r),...s}));return n.displayName=Mb(t),n};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kT=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],ST=Ce("arrow-up-down",kT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CT=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],Ab=Ce("bitcoin",CT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ET=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],TT=Ce("bold",ET);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MT=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Hr=Ce("book-open",MT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AT=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Gu=Ce("calendar",AT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RT=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],PT=Ce("chart-column",RT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Uc=Ce("check",IT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ec=Ce("chevron-down",OT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],LT=Ce("chevron-left",DT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _T=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ho=Ce("chevron-right",_T);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],DN=Ce("chevron-up",zT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],FT=Ce("circle-alert",$T);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Rb=Ce("circle-check-big",BT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],gg=Ce("circle-check",VT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],LN=Ce("circle-question-mark",HT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],gm=Ce("circle-user",WT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],_N=Ce("circle-x",UT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xg=Ce("clock",KT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qT=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],GT=Ce("code",qT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JT=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],zN=Ce("copy",JT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YT=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Pb=Ce("credit-card",YT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QT=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Pa=Ce("crown",QT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XT=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Ju=Ce("dollar-sign",XT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZT=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],eM=Ce("download",ZT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tM=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ti=Ce("external-link",tM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nM=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],yg=Ce("eye",nM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],sM=Ce("file-text",rM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iM=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],$N=Ce("funnel",iM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aM=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],oM=Ce("gift",aM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lM=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],cM=Ce("git-merge",lM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],vg=Ce("globe",dM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uM=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],hM=Ce("graduation-cap",uM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fM=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Vs=Ce("grip-vertical",fM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pM=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],mM=Ce("handshake",pM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gM=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],xM=Ce("hash",gM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],vM=Ce("heading-1",yM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],wM=Ce("heading-2",bM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],jM=Ce("heading-3",NM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kM=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],SM=Ce("house",kM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],FN=Ce("image",CM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],du=Ce("info",EM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],MM=Ce("italic",TM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],RM=Ce("key",AM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],IM=Ce("layout-dashboard",PM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Ss=Ce("link-2",OM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],bg=Ce("link",DM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],_M=Ce("list-ordered",LM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],$M=Ce("list",zM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],BM=Ce("lock",FM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],HM=Ce("log-out",VM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WM=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],BN=Ce("map-pin",WM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],KM=Ce("menu",UM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],GM=Ce("message-circle",qM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JM=[["path",{d:"M5 12h14",key:"1ays0h"}]],YM=Ce("minus",JM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],Wo=Ce("navigation",QM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],ZM=Ce("palette",XM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eA=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],kt=Ce("pen-line",eA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tA=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],nA=Ce("pencil",tA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rA=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],sA=Ce("percent",rA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iA=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],aA=Ce("phone",iA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],lA=Ce("pin",oA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ft=Ce("plus",cA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dA=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Ib=Ce("qr-code",dA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uA=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],hA=Ce("quote",uA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fA=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],pA=Ce("redo",fA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],qe=Ce("refresh-cw",mA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gA=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],an=Ce("save",gA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ui=Ce("search",xA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yA=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],vA=Ce("send",yA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bA=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],_a=Ce("settings",bA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wA=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],uu=Ce("settings-2",wA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NA=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ex=Ce("shield-check",NA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jA=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],wg=Ce("shopping-bag",jA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Tc=Ce("smartphone",kA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Uo=Ce("star",SA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],EA=Ce("strikethrough",CA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TA=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],MA=Ce("table",TA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],xm=Ce("tag",AA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],wn=Ce("trash-2",RA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],fc=Ce("trending-up",PA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ob=Ce("trophy",IA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OA=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],VN=Ce("undo-2",OA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],LA=Ce("undo",DA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _A=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Yu=Ce("upload",_A);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Ng=Ce("user-plus",zA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $A=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],qo=Ce("user",$A);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Ln=Ce("users",FA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BA=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Xo=Ce("wallet",BA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Wn=Ce("x",VA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fi=Ce("zap",HA),Tx="admin_token";function Mx(){try{return localStorage.getItem(Tx)}catch{return null}}function WA(t){try{localStorage.setItem(Tx,t)}catch{}}function UA(){try{localStorage.removeItem(Tx)}catch{}}const KA="https://soulapi.quwanzhi.com",qA=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):KA};function Ha(t){const e=qA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Qh(t,e={}){const{data:n,...r}=e,s=Ha(t),a=new Headers(r.headers),o=Mx();o&&a.set("Authorization",`Bearer ${o}`),n!=null&&!a.has("Content-Type")&&a.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=await fetch(s,{...r,headers:a,body:c,credentials:"include"}),f=(u.headers.get("Content-Type")||"").includes("application/json")?await u.json():u;if(!u.ok){const m=new Error((f==null?void 0:f.error)||`HTTP ${u.status}`);throw m.status=u.status,m.data=f,m}return f}function Fe(t,e){return Qh(t,{...e,method:"GET"})}function mt(t,e,n){return Qh(t,{...n,method:"POST",data:e})}function _t(t,e,n){return Qh(t,{...n,method:"PUT",data:e})}function ss(t,e){return Qh(t,{...e,method:"DELETE"})}const GA=[{icon:IM,label:"数据概览",href:"/dashboard"},{icon:Hr,label:"内容管理",href:"/content"},{icon:Ln,label:"用户管理",href:"/users"},{icon:cM,label:"找伙伴",href:"/find-partner"},{icon:Xo,label:"推广中心",href:"/distribution"}];function JA(){const t=ra(),e=sa(),[n,r]=b.useState(!1),[s,a]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;a(!1);let c=!1;return Fe("/api/admin").then(u=>{c||(u&&u.success!==!1?a(!0):e("/login",{replace:!0}))}).catch(()=>{c||e("/login",{replace:!0})}),()=>{c=!0}},[n,e]);const o=async()=>{UA();try{await mt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!s?i.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[i.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):i.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[i.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[i.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[i.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),i.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),i.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[GA.map(c=>{const u=t.pathname===c.href;return i.jsxs(mg,{to:c.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${u?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),i.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:i.jsxs(mg,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(_a,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),i.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:i.jsxs("button",{type:"button",onClick:o,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[i.jsx(HM,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),i.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:i.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:i.jsx(iT,{})})})]})}function Db(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ax(...t){return e=>{let n=!1;const r=t.map(s=>{const a=Db(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s{let{children:a,...o}=r;HN(a)&&typeof Qu=="function"&&(a=Qu(a._payload));const c=b.Children.toArray(a),u=c.find(eR);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return i.jsx(e,{...o,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}var UN=WN("Slot");function XA(t){const e=b.forwardRef((n,r)=>{let{children:s,...a}=n;if(HN(s)&&typeof Qu=="function"&&(s=Qu(s._payload)),b.isValidElement(s)){const o=nR(s),c=tR(a,s.props);return s.type!==b.Fragment&&(c.ref=r?Ax(r,o):o),b.cloneElement(s,c)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var ZA=Symbol("radix.slottable");function eR(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===ZA}function tR(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...c)=>{const u=a(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function nR(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function KN(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,_b=qN,GN=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return _b(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:a}=e,o=Object.keys(s).map(h=>{const f=n==null?void 0:n[h],m=a==null?void 0:a[h];if(f===null)return null;const g=Lb(f)||Lb(m);return s[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(v=>{let[j,w]=v;return Array.isArray(w)?w.includes({...a,...c}[j]):{...a,...c}[j]===w})?[...h,m,g]:h},[]);return _b(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},rR=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),JN=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Xu="-",zb=[],iR="arbitrary..",aR=t=>{const e=lR(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return oR(o);const c=o.split(Xu),u=c[0]===""&&c.length>1?1:0;return YN(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?rR(h,u):u:h||zb}return n[o]||zb}}},YN=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],a=n.nextPart.get(s);if(a){const h=YN(t,e+1,a);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(Xu):t.slice(e).join(Xu),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?iR+r:void 0})(),lR=t=>{const{theme:e,classGroups:n}=t;return cR(n,e)},cR=(t,e)=>{const n=JN();for(const r in t){const s=t[r];Rx(s,n,r,e)}return n},Rx=(t,e,n,r)=>{const s=t.length;for(let a=0;a{if(typeof t=="string"){uR(t,e,n);return}if(typeof t=="function"){hR(t,e,n,r);return}fR(t,e,n,r)},uR=(t,e,n)=>{const r=t===""?e:QN(e,t);r.classGroupId=n},hR=(t,e,n,r)=>{if(pR(t)){Rx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(sR(n,t))},fR=(t,e,n,r)=>{const s=Object.entries(t),a=s.length;for(let o=0;o{let n=t;const r=e.split(Xu),s=r.length;for(let a=0;a"isThemeGetter"in t&&t.isThemeGetter===!0,mR=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(a,o)=>{n[a]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return s(a,o),o},set(a,o){a in n?n[a]=o:s(a,o)}}},jg="!",$b=":",gR=[],Fb=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),xR=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const a=[];let o=0,c=0,u=0,h;const f=s.length;for(let j=0;ju?h-u:void 0;return Fb(a,y,g,v)};if(e){const s=e+$b,a=r;r=o=>o.startsWith(s)?a(o.slice(s.length)):Fb(gR,!1,o,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},yR=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},vR=t=>({cache:mR(t.cacheSize),parseClassName:xR(t),sortModifiers:yR(t),...aR(t)}),bR=/\s+/,wR=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=e,o=[],c=t.trim().split(bR);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let w=!!j,k=r(w?v.substring(0,j):v);if(!k){if(!w){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:a(g).join(":"),C=y?E+jg:E,T=C+k;if(o.indexOf(T)>-1)continue;o.push(T);const O=s(k,w);for(let B=0;B0?" "+u:u)}return u},NR=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,a;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=vR(h),r=n.cache.get,s=n.cache.set,a=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=wR(u,n);return s(u,f),f};return a=o,(...u)=>a(NR(...u))},kR=[],mn=t=>{const e=n=>n[t]||kR;return e.isThemeGetter=!0,e},ZN=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ej=/^\((?:(\w[\w-]*):)?(.+)\)$/i,SR=/^\d+\/\d+$/,CR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ER=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,TR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Po=t=>SR.test(t),it=t=>!!t&&!Number.isNaN(Number(t)),Ti=t=>!!t&&Number.isInteger(Number(t)),ym=t=>t.endsWith("%")&&it(t.slice(0,-1)),Hs=t=>CR.test(t),RR=()=>!0,PR=t=>ER.test(t)&&!TR.test(t),tj=()=>!1,IR=t=>MR.test(t),OR=t=>AR.test(t),DR=t=>!Le(t)&&!_e(t),LR=t=>cl(t,sj,tj),Le=t=>ZN.test(t),Ma=t=>cl(t,ij,PR),vm=t=>cl(t,BR,it),Bb=t=>cl(t,nj,tj),_R=t=>cl(t,rj,OR),hu=t=>cl(t,aj,IR),_e=t=>ej.test(t),Zl=t=>dl(t,ij),zR=t=>dl(t,VR),Vb=t=>dl(t,nj),$R=t=>dl(t,sj),FR=t=>dl(t,rj),fu=t=>dl(t,aj,!0),cl=(t,e,n)=>{const r=ZN.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},dl=(t,e,n=!1)=>{const r=ej.exec(t);return r?r[1]?e(r[1]):n:!1},nj=t=>t==="position"||t==="percentage",rj=t=>t==="image"||t==="url",sj=t=>t==="length"||t==="size"||t==="bg-size",ij=t=>t==="length",BR=t=>t==="number",VR=t=>t==="family-name",aj=t=>t==="shadow",HR=()=>{const t=mn("color"),e=mn("font"),n=mn("text"),r=mn("font-weight"),s=mn("tracking"),a=mn("leading"),o=mn("breakpoint"),c=mn("container"),u=mn("spacing"),h=mn("radius"),f=mn("shadow"),m=mn("inset-shadow"),g=mn("text-shadow"),y=mn("drop-shadow"),v=mn("blur"),j=mn("perspective"),w=mn("aspect"),k=mn("ease"),E=mn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...T(),_e,Le],B=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],P=()=>[_e,Le,u],I=()=>[Po,"full","auto",...P()],L=()=>[Ti,"none","subgrid",_e,Le],X=()=>["auto",{span:["full",Ti,_e,Le]},Ti,_e,Le],Z=()=>[Ti,"auto",_e,Le],Y=()=>["auto","min","max","fr",_e,Le],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...P()],ae=()=>[Po,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],_=()=>[t,_e,Le],se=()=>[...T(),Vb,Bb,{position:[_e,Le]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",$R,LR,{size:[_e,Le]}],H=()=>[ym,Zl,Ma],de=()=>["","none","full",h,_e,Le],K=()=>["",it,Zl,Ma],fe=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[it,ym,Vb,Bb],ue=()=>["","none",v,_e,Le],ye=()=>["none",it,_e,Le],V=()=>["none",it,_e,Le],ge=()=>[it,_e,Le],Me=()=>[Po,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Hs],breakpoint:[Hs],color:[RR],container:[Hs],"drop-shadow":[Hs],ease:["in","out","in-out"],font:[DR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Hs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Hs],shadow:[Hs],spacing:["px",it],text:[Hs],"text-shadow":[Hs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Po,Le,_e,w]}],container:["container"],columns:[{columns:[it,Le,_e,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Ti,"auto",_e,Le]}],basis:[{basis:[Po,"full","auto",c,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,Po,"auto","initial","none",Le]}],grow:[{grow:["",it,_e,Le]}],shrink:[{shrink:["",it,_e,Le]}],order:[{order:[Ti,"first","last","none",_e,Le]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Zl,Ma]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,_e,vm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ym,Le]}],"font-family":[{font:[zR,Le,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,_e,Le]}],"line-clamp":[{"line-clamp":[it,"none",_e,vm]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",_e,Le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_e,Le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",_e,Ma]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[it,"auto",_e,Le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_e,Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",_e,Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ti,_e,Le],radial:["",_e,Le],conic:[Ti,_e,Le]},FR,_R]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,_e,Le]}],"outline-w":[{outline:["",it,Zl,Ma]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",f,fu,hu]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",m,fu,hu]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[it,Ma]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",g,fu,hu]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[it,_e,Le]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[_e,Le]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_e,Le]}],filter:[{filter:["","none",_e,Le]}],blur:[{blur:ue()}],brightness:[{brightness:[it,_e,Le]}],contrast:[{contrast:[it,_e,Le]}],"drop-shadow":[{"drop-shadow":["","none",y,fu,hu]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",it,_e,Le]}],"hue-rotate":[{"hue-rotate":[it,_e,Le]}],invert:[{invert:["",it,_e,Le]}],saturate:[{saturate:[it,_e,Le]}],sepia:[{sepia:["",it,_e,Le]}],"backdrop-filter":[{"backdrop-filter":["","none",_e,Le]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[it,_e,Le]}],"backdrop-contrast":[{"backdrop-contrast":[it,_e,Le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,_e,Le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,_e,Le]}],"backdrop-invert":[{"backdrop-invert":["",it,_e,Le]}],"backdrop-opacity":[{"backdrop-opacity":[it,_e,Le]}],"backdrop-saturate":[{"backdrop-saturate":[it,_e,Le]}],"backdrop-sepia":[{"backdrop-sepia":["",it,_e,Le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_e,Le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",_e,Le]}],ease:[{ease:["linear","initial",k,_e,Le]}],delay:[{delay:[it,_e,Le]}],animate:[{animate:["none",E,_e,Le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,_e,Le]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:V()}],"scale-x":[{"scale-x":V()}],"scale-y":[{"scale-y":V()}],"scale-z":[{"scale-z":V()}],"scale-3d":["scale-3d"],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[_e,Le,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Me()}],"translate-x":[{"translate-x":Me()}],"translate-y":[{"translate-y":Me()}],"translate-z":[{"translate-z":Me()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",_e,Le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",_e,Le]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[it,Zl,Ma,vm]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},WR=jR(HR);function bt(...t){return WR(qN(t))}const UR=GN("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ne({className:t,variant:e,size:n,asChild:r=!1,...s}){const a=r?UN:"button";return i.jsx(a,{"data-slot":"button",className:bt(UR({variant:e,size:n,className:t})),...s})}function ce({className:t,type:e,...n}){return i.jsx("input",{type:e,"data-slot":"input",className:bt("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",t),...n})}function KR(){const t=sa(),[e,n]=b.useState(""),[r,s]=b.useState(""),[a,o]=b.useState(""),[c,u]=b.useState(!1),h=async()=>{o(""),u(!0);try{const f=await mt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){WA(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return i.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[i.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[i.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),i.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),i.jsxs("div",{className:"w-full max-w-md relative z-10",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("div",{className:"w-16 h-16 bg-[#38bdac]/20 rounded-2xl flex items-center justify-center mx-auto mb-4 border border-[#38bdac]/30",children:i.jsx(Ex,{className:"w-8 h-8 text-[#38bdac]"})}),i.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),i.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),i.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[i.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),i.jsxs("div",{className:"relative",children:[i.jsx(qo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),i.jsx(ce,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),i.jsxs("div",{className:"relative",children:[i.jsx(BM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),i.jsx(ce,{type:"password",value:r,onChange:f=>s(f.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),a&&i.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:a}),i.jsx(ne,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),i.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Ae=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:bt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ae.displayName="Card";const Xe=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:bt("flex flex-col space-y-1.5 p-6",t),...e}));Xe.displayName="CardHeader";const Ze=b.forwardRef(({className:t,...e},n)=>i.jsx("h3",{ref:n,className:bt("font-semibold leading-none tracking-tight",t),...e}));Ze.displayName="CardTitle";const zt=b.forwardRef(({className:t,...e},n)=>i.jsx("p",{ref:n,className:bt("text-sm text-muted-foreground",t),...e}));zt.displayName="CardDescription";const Re=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:bt("p-6 pt-0",t),...e}));Re.displayName="CardContent";const qR=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:bt("flex items-center p-6 pt-0",t),...e}));qR.displayName="CardFooter";const GR={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function bm(t,e="info",n=3e3){const r=`toast-${Date.now()}`,s=GR[e],a=document.createElement("div");a.id=r,a.setAttribute("role","alert"),Object.assign(a.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:s.bg,border:`1.5px solid ${s.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:s.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=s.icon;const c=document.createElement("span");c.textContent=t,a.appendChild(o),a.appendChild(c),document.body.appendChild(a),requestAnimationFrame(()=>{a.style.opacity="1",a.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const he={success:(t,e)=>bm(t,"success",e),error:(t,e)=>bm(t,"error",e),info:(t,e)=>bm(t,"info",e)};function rt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function JR(t,e){const n=b.createContext(e),r=a=>{const{children:o,...c}=a,u=b.useMemo(()=>c,Object.values(c));return i.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function s(a){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,s]}function ia(t,e=[]){let n=[];function r(a,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...v}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,w=b.useMemo(()=>v,Object.values(v));return i.jsx(j.Provider,{value:w,children:y})};h.displayName=a+"Provider";function f(m,g){var j;const y=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,v=b.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,f]}const s=()=>{const a=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||a;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return s.scopeName=t,[r,YR(s,...e)]}function YR(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(a)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Un=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},QR=Jh[" useId ".trim().toString()]||(()=>{}),XR=0;function Ki(t){const[e,n]=b.useState(QR());return Un(()=>{n(r=>r??String(XR++))},[t]),e?`radix-${e}`:""}var ZR=Jh[" useInsertionEffect ".trim().toString()]||Un;function Wa({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,a,o]=e5({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:s;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const g=t5(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else a(f)},[c,t,a,o]);return[u,h]}function e5({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),s=b.useRef(n),a=b.useRef(e);return ZR(()=>{a.current=e},[e]),b.useEffect(()=>{var o;s.current!==n&&((o=a.current)==null||o.call(a,n),s.current=n)},[n,s]),[n,r,a]}function t5(t){return typeof t=="function"}function Mc(t){const e=n5(t),n=b.forwardRef((r,s)=>{const{children:a,...o}=r,c=b.Children.toArray(a),u=c.find(s5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return i.jsx(e,{...o,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function n5(t){const e=b.forwardRef((n,r)=>{const{children:s,...a}=n;if(b.isValidElement(s)){const o=a5(s),c=i5(a,s.props);return s.type!==b.Fragment&&(c.ref=r?Ax(r,o):o),b.cloneElement(s,c)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var r5=Symbol("radix.slottable");function s5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===r5}function i5(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...c)=>{const u=a(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function a5(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var o5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],at=o5.reduce((t,e)=>{const n=Mc(`Primitive.${e}`),r=b.forwardRef((s,a)=>{const{asChild:o,...c}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function l5(t,e){t&&Wc.flushSync(()=>t.dispatchEvent(e))}function Qi(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function c5(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t);b.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var d5="DismissableLayer",kg="dismissableLayer.update",u5="dismissableLayer.pointerDownOutside",h5="dismissableLayer.focusOutside",Hb,oj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Px=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(oj),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=vt(e,R=>m(R)),j=Array.from(h.layers),[w]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(w),E=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,T=E>=k,O=m5(R=>{const P=R.target,I=[...h.branches].some(L=>L.contains(P));!T||I||(s==null||s(R),o==null||o(R),R.defaultPrevented||c==null||c())},g),B=g5(R=>{const P=R.target;[...h.branches].some(L=>L.contains(P))||(a==null||a(R),o==null||o(R),R.defaultPrevented||c==null||c())},g);return c5(R=>{E===h.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Hb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Wb(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Hb)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Wb())},[f,h]),b.useEffect(()=>{const R=()=>y({});return document.addEventListener(kg,R),()=>document.removeEventListener(kg,R)},[]),i.jsx(at.div,{...u,ref:v,style:{pointerEvents:C?T?"auto":"none":void 0,...t.style},onFocusCapture:rt(t.onFocusCapture,B.onFocusCapture),onBlurCapture:rt(t.onBlurCapture,B.onBlurCapture),onPointerDownCapture:rt(t.onPointerDownCapture,O.onPointerDownCapture)})});Px.displayName=d5;var f5="DismissableLayerBranch",p5=b.forwardRef((t,e)=>{const n=b.useContext(oj),r=b.useRef(null),s=vt(e,r);return b.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(at.div,{...t,ref:s})});p5.displayName=f5;function m5(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t),r=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const a=c=>{if(c.target&&!r.current){let u=function(){lj(u5,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=u,e.addEventListener("click",s.current,{once:!0})):u()}else e.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function g5(t,e=globalThis==null?void 0:globalThis.document){const n=Qi(t),r=b.useRef(!1);return b.useEffect(()=>{const s=a=>{a.target&&!r.current&&lj(h5,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Wb(){const t=new CustomEvent(kg);document.dispatchEvent(t)}function lj(t,e,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?l5(s,a):s.dispatchEvent(a)}var wm="focusScope.autoFocusOnMount",Nm="focusScope.autoFocusOnUnmount",Ub={bubbles:!1,cancelable:!0},x5="FocusScope",Ix=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=t,[c,u]=b.useState(null),h=Qi(s),f=Qi(a),m=b.useRef(null),g=vt(e,j=>u(j)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let j=function(C){if(y.paused||!c)return;const T=C.target;c.contains(T)?m.current=T:Ri(m.current,{select:!0})},w=function(C){if(y.paused||!c)return;const T=C.relatedTarget;T!==null&&(c.contains(T)||Ri(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const O of C)O.removedNodes.length>0&&Ri(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",w);const E=new MutationObserver(k);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){qb.add(y);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(wm,Ub);c.addEventListener(wm,h),c.dispatchEvent(k),k.defaultPrevented||(y5(j5(cj(c)),{select:!0}),document.activeElement===j&&Ri(c))}return()=>{c.removeEventListener(wm,h),setTimeout(()=>{const k=new CustomEvent(Nm,Ub);c.addEventListener(Nm,f),c.dispatchEvent(k),k.defaultPrevented||Ri(j??document.body,{select:!0}),c.removeEventListener(Nm,f),qb.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(j=>{if(!n&&!r||y.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(w&&k){const E=j.currentTarget,[C,T]=v5(E);C&&T?!j.shiftKey&&k===T?(j.preventDefault(),n&&Ri(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&Ri(T,{select:!0})):k===E&&j.preventDefault()}},[n,r,y.paused]);return i.jsx(at.div,{tabIndex:-1,...o,ref:g,onKeyDown:v})});Ix.displayName=x5;function y5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ri(r,{select:e}),document.activeElement!==n)return}function v5(t){const e=cj(t),n=Kb(e,t),r=Kb(e.reverse(),t);return[n,r]}function cj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Kb(t,e){for(const n of t)if(!b5(n,{upTo:e}))return n}function b5(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function w5(t){return t instanceof HTMLInputElement&&"select"in t}function Ri(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&w5(t)&&e&&t.select()}}var qb=N5();function N5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Gb(t,e),t.unshift(e)},remove(e){var n;t=Gb(t,e),(n=t[0])==null||n.resume()}}}function Gb(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function j5(t){return t.filter(e=>e.tagName!=="A")}var k5="Portal",Ox=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[s,a]=b.useState(!1);Un(()=>a(!0),[]);const o=n||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?jN.createPortal(i.jsx(at.div,{...r,ref:e}),o):null});Ox.displayName=k5;function S5(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Kc=t=>{const{present:e,children:n}=t,r=C5(e),s=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),a=vt(r.ref,E5(s));return typeof n=="function"||r.isPresent?b.cloneElement(s,{ref:a}):null};Kc.displayName="Presence";function C5(t){const[e,n]=b.useState(),r=b.useRef(null),s=b.useRef(t),a=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=S5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=pu(r.current);a.current=c==="mounted"?h:"none"},[c]),Un(()=>{const h=r.current,f=s.current;if(f!==t){const g=a.current,y=pu(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,u]),Un(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const j=pu(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&j&&(u("ANIMATION_END"),!s.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},g=y=>{y.target===e&&(a.current=pu(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function pu(t){return(t==null?void 0:t.animationName)||"none"}function E5(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var jm=0;function dj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Jb()),document.body.insertAdjacentElement("beforeend",t[1]??Jb()),jm++,()=>{jm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),jm--}},[])}function Jb(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var js=function(){return js=Object.assign||function(e){for(var n,r=1,s=arguments.length;r"u")return W5;var e=U5(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},q5=pj(),Go="data-scroll-locked",G5=function(t,e,n,r){var s=t.left,a=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` + .`.concat(M5,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body[`).concat(Go,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(s,`px; + padding-top: `).concat(a,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(c,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(_u,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(zu,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(_u," .").concat(_u,` { + right: 0 `).concat(r,`; + } + + .`).concat(zu," .").concat(zu,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Go,`] { + `).concat(A5,": ").concat(c,`px; + } +`)},Qb=function(){var t=parseInt(document.body.getAttribute(Go)||"0",10);return isFinite(t)?t:0},J5=function(){b.useEffect(function(){return document.body.setAttribute(Go,(Qb()+1).toString()),function(){var t=Qb()-1;t<=0?document.body.removeAttribute(Go):document.body.setAttribute(Go,t.toString())}},[])},Y5=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;J5();var a=b.useMemo(function(){return K5(s)},[s]);return b.createElement(q5,{styles:G5(a,!e,s,n?"":"!important")})},Sg=!1;if(typeof window<"u")try{var mu=Object.defineProperty({},"passive",{get:function(){return Sg=!0,!0}});window.addEventListener("test",mu,mu),window.removeEventListener("test",mu,mu)}catch{Sg=!1}var Io=Sg?{passive:!1}:!1,Q5=function(t){return t.tagName==="TEXTAREA"},mj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Q5(t)&&n[e]==="visible")},X5=function(t){return mj(t,"overflowY")},Z5=function(t){return mj(t,"overflowX")},Xb=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=gj(t,r);if(s){var a=xj(t,r),o=a[1],c=a[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},eP=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},tP=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},gj=function(t,e){return t==="v"?X5(e):Z5(e)},xj=function(t,e){return t==="v"?eP(e):tP(e)},nP=function(t,e){return t==="h"&&e==="rtl"?-1:1},rP=function(t,e,n,r,s){var a=nP(t,window.getComputedStyle(e).direction),o=a*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=xj(t,c),v=y[0],j=y[1],w=y[2],k=j-w-a*v;(v||k)&&gj(t,c)&&(m+=k,g+=v);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},gu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Zb=function(t){return[t.deltaX,t.deltaY]},e1=function(t){return t&&"current"in t?t.current:t},sP=function(t,e){return t[0]===e[0]&&t[1]===e[1]},iP=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},aP=0,Oo=[];function oP(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),s=b.useState(aP++)[0],a=b.useState(pj)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var j=T5([t.lockRef.current],(t.shards||[]).map(e1),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(j,w){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=gu(j),E=n.current,C="deltaX"in j?j.deltaX:E[0]-k[0],T="deltaY"in j?j.deltaY:E[1]-k[1],O,B=j.target,R=Math.abs(C)>Math.abs(T)?"h":"v";if("touches"in j&&R==="h"&&B.type==="range")return!1;var P=window.getSelection(),I=P&&P.anchorNode,L=I?I===B||I.contains(B):!1;if(L)return!1;var X=Xb(R,B);if(!X)return!0;if(X?O=R:(O=R==="v"?"h":"v",X=Xb(R,B)),!X)return!1;if(!r.current&&"changedTouches"in j&&(C||T)&&(r.current=O),!O)return!0;var Z=r.current||O;return rP(Z,w,j,Z==="h"?C:T)},[]),u=b.useCallback(function(j){var w=j;if(!(!Oo.length||Oo[Oo.length-1]!==a)){var k="deltaY"in w?Zb(w):gu(w),E=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&sP(O.delta,k)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var C=(o.current.shards||[]).map(e1).filter(Boolean).filter(function(O){return O.contains(w.target)}),T=C.length>0?c(w,C[0]):!o.current.noIsolation;T&&w.cancelable&&w.preventDefault()}}},[]),h=b.useCallback(function(j,w,k,E){var C={name:j,delta:w,target:k,should:E,shadowParent:lP(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(T){return T!==C})},1)},[]),f=b.useCallback(function(j){n.current=gu(j),r.current=void 0},[]),m=b.useCallback(function(j){h(j.type,Zb(j),j.target,c(j,t.lockRef.current))},[]),g=b.useCallback(function(j){h(j.type,gu(j),j.target,c(j,t.lockRef.current))},[]);b.useEffect(function(){return Oo.push(a),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Io),document.addEventListener("touchmove",u,Io),document.addEventListener("touchstart",f,Io),function(){Oo=Oo.filter(function(j){return j!==a}),document.removeEventListener("wheel",u,Io),document.removeEventListener("touchmove",u,Io),document.removeEventListener("touchstart",f,Io)}},[]);var y=t.removeScrollBar,v=t.inert;return b.createElement(b.Fragment,null,v?b.createElement(a,{styles:iP(s)}):null,y?b.createElement(Y5,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function lP(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const cP=_5(fj,oP);var Dx=b.forwardRef(function(t,e){return b.createElement(Xh,js({},t,{ref:e,sideCar:cP}))});Dx.classNames=Xh.classNames;var dP=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Do=new WeakMap,xu=new WeakMap,yu={},Em=0,yj=function(t){return t&&(t.host||yj(t.parentNode))},uP=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=yj(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},hP=function(t,e,n,r){var s=uP(e,Array.isArray(t)?t:[t]);yu[n]||(yu[n]=new WeakMap);var a=yu[n],o=[],c=new Set,u=new Set(s),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};s.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var y=g.getAttribute(r),v=y!==null&&y!=="false",j=(Do.get(g)||0)+1,w=(a.get(g)||0)+1;Do.set(g,j),a.set(g,w),o.push(g),j===1&&v&&xu.set(g,!0),w===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Em++,function(){o.forEach(function(m){var g=Do.get(m)-1,y=a.get(m)-1;Do.set(m,g),a.set(m,y),g||(xu.has(m)||m.removeAttribute(r),xu.delete(m)),y||m.removeAttribute(n)}),Em--,Em||(Do=new WeakMap,Do=new WeakMap,xu=new WeakMap,yu={})}},vj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=dP(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),hP(r,s,n,"aria-hidden")):function(){return null}},Zh="Dialog",[bj]=ia(Zh),[fP,us]=bj(Zh),wj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=Wa({prop:r,defaultProp:s??!1,onChange:a,caller:Zh});return i.jsx(fP,{scope:e,triggerRef:c,contentRef:u,contentId:Ki(),titleId:Ki(),descriptionId:Ki(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};wj.displayName=Zh;var Nj="DialogTrigger",pP=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=us(Nj,n),a=vt(e,s.triggerRef);return i.jsx(at.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":zx(s.open),...r,ref:a,onClick:rt(t.onClick,s.onOpenToggle)})});pP.displayName=Nj;var Lx="DialogPortal",[mP,jj]=bj(Lx,{forceMount:void 0}),kj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,a=us(Lx,e);return i.jsx(mP,{scope:e,forceMount:n,children:b.Children.map(r,o=>i.jsx(Kc,{present:n||a.open,children:i.jsx(Ox,{asChild:!0,container:s,children:o})}))})};kj.displayName=Lx;var Zu="DialogOverlay",Sj=b.forwardRef((t,e)=>{const n=jj(Zu,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=us(Zu,t.__scopeDialog);return a.modal?i.jsx(Kc,{present:r||a.open,children:i.jsx(xP,{...s,ref:e})}):null});Sj.displayName=Zu;var gP=Mc("DialogOverlay.RemoveScroll"),xP=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=us(Zu,n);return i.jsx(Dx,{as:gP,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(at.div,{"data-state":zx(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Ua="DialogContent",Cj=b.forwardRef((t,e)=>{const n=jj(Ua,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=us(Ua,t.__scopeDialog);return i.jsx(Kc,{present:r||a.open,children:a.modal?i.jsx(yP,{...s,ref:e}):i.jsx(vP,{...s,ref:e})})});Cj.displayName=Ua;var yP=b.forwardRef((t,e)=>{const n=us(Ua,t.__scopeDialog),r=b.useRef(null),s=vt(e,n.contentRef,r);return b.useEffect(()=>{const a=r.current;if(a)return vj(a)},[]),i.jsx(Ej,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:rt(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:rt(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&a.preventDefault()}),onFocusOutside:rt(t.onFocusOutside,a=>a.preventDefault())})}),vP=b.forwardRef((t,e)=>{const n=us(Ua,t.__scopeDialog),r=b.useRef(!1),s=b.useRef(!1);return i.jsx(Ej,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,a),a.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),Ej=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=t,c=us(Ua,n),u=b.useRef(null),h=vt(e,u);return dj(),i.jsxs(i.Fragment,{children:[i.jsx(Ix,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(Px,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":zx(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(bP,{titleId:c.titleId}),i.jsx(NP,{contentRef:u,descriptionId:c.descriptionId})]})]})}),_x="DialogTitle",Tj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=us(_x,n);return i.jsx(at.h2,{id:s.titleId,...r,ref:e})});Tj.displayName=_x;var Mj="DialogDescription",Aj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=us(Mj,n);return i.jsx(at.p,{id:s.descriptionId,...r,ref:e})});Aj.displayName=Mj;var Rj="DialogClose",Pj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=us(Rj,n);return i.jsx(at.button,{type:"button",...r,ref:e,onClick:rt(t.onClick,()=>s.onOpenChange(!1))})});Pj.displayName=Rj;function zx(t){return t?"open":"closed"}var Ij="DialogTitleWarning",[AV,Oj]=JR(Ij,{contentName:Ua,titleName:_x,docsSlug:"dialog"}),bP=({titleId:t})=>{const e=Oj(Ij),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},wP="DialogDescriptionWarning",NP=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Oj(wP).contentName}}.`;return b.useEffect(()=>{var a;const s=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},jP=wj,kP=kj,SP=Sj,CP=Cj,EP=Tj,TP=Aj,MP=Pj;function Zt(t){return i.jsx(jP,{"data-slot":"dialog",...t})}function AP(t){return i.jsx(kP,{...t})}const Dj=b.forwardRef(({className:t,...e},n)=>i.jsx(SP,{ref:n,className:bt("fixed inset-0 z-50 bg-black/50",t),...e}));Dj.displayName="DialogOverlay";const qt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},s)=>i.jsxs(AP,{children:[i.jsx(Dj,{}),i.jsxs(CP,{ref:s,"aria-describedby":void 0,className:bt("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg",t),...r,children:[e,n&&i.jsxs(MP,{className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(Wn,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qt.displayName="DialogContent";function en({className:t,...e}){return i.jsx("div",{className:bt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Nn({className:t,...e}){return i.jsx("div",{className:bt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function tn(t){return i.jsx(EP,{className:"text-lg font-semibold leading-none",...t})}function RP(t){return i.jsx(TP,{className:"text-sm text-muted-foreground",...t})}const PP=GN("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Be({className:t,variant:e,asChild:n=!1,...r}){const s=n?UN:"span";return i.jsx(s,{className:bt(PP({variant:e}),t),...r})}var IP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],OP=IP.reduce((t,e)=>{const n=WN(`Primitive.${e}`),r=b.forwardRef((s,a)=>{const{asChild:o,...c}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),DP="Label",Lj=b.forwardRef((t,e)=>i.jsx(OP.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Lj.displayName=DP;var _j=Lj;const te=b.forwardRef(({className:t,...e},n)=>i.jsx(_j,{ref:n,className:bt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=_j.displayName;function $x(t){const e=t+"CollectionProvider",[n,r]=ia(e),[s,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:w,children:k}=j,E=er.useRef(null),C=er.useRef(new Map).current;return i.jsx(s,{scope:w,itemMap:C,collectionRef:E,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Mc(c),h=er.forwardRef((j,w)=>{const{scope:k,children:E}=j,C=a(c,k),T=vt(w,C.collectionRef);return i.jsx(u,{ref:T,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Mc(f),y=er.forwardRef((j,w)=>{const{scope:k,children:E,...C}=j,T=er.useRef(null),O=vt(w,T),B=a(f,k);return er.useEffect(()=>(B.itemMap.set(T,{ref:T,...C}),()=>void B.itemMap.delete(T))),i.jsx(g,{[m]:"",ref:O,children:E})});y.displayName=f;function v(j){const w=a(t+"CollectionConsumer",j);return er.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(w.itemMap.values()).sort((B,R)=>C.indexOf(B.ref.current)-C.indexOf(R.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var LP=b.createContext(void 0);function ef(t){const e=b.useContext(LP);return t||e||"ltr"}var Tm="rovingFocusGroup.onEntryFocus",_P={bubbles:!1,cancelable:!0},qc="RovingFocusGroup",[Cg,zj,zP]=$x(qc),[$P,$j]=ia(qc,[zP]),[FP,BP]=$P(qc),Fj=b.forwardRef((t,e)=>i.jsx(Cg.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(Cg.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(VP,{...t,ref:e})})}));Fj.displayName=qc;var VP=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=vt(e,g),v=ef(a),[j,w]=Wa({prop:o,defaultProp:c??null,onChange:u,caller:qc}),[k,E]=b.useState(!1),C=Qi(h),T=zj(n),O=b.useRef(!1),[B,R]=b.useState(0);return b.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Tm,C),()=>P.removeEventListener(Tm,C)},[C]),i.jsx(FP,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:j,onItemFocus:b.useCallback(P=>w(P),[w]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>R(P=>P+1),[]),onFocusableItemRemove:b.useCallback(()=>R(P=>P-1),[]),children:i.jsx(at.div,{tabIndex:k||B===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:rt(t.onMouseDown,()=>{O.current=!0}),onFocus:rt(t.onFocus,P=>{const I=!O.current;if(P.target===P.currentTarget&&I&&!k){const L=new CustomEvent(Tm,_P);if(P.currentTarget.dispatchEvent(L),!L.defaultPrevented){const X=T().filter($=>$.focusable),Z=X.find($=>$.active),Y=X.find($=>$.id===j),D=[Z,Y,...X].filter(Boolean).map($=>$.ref.current);Hj(D,f)}}O.current=!1}),onBlur:rt(t.onBlur,()=>E(!1))})})}),Bj="RovingFocusGroupItem",Vj=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:o,...c}=t,u=Ki(),h=a||u,f=BP(Bj,n),m=f.currentTabStopId===h,g=zj(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:j}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),i.jsx(Cg.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:i.jsx(at.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:rt(t.onMouseDown,w=>{r?f.onItemFocus(h):w.preventDefault()}),onFocus:rt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:rt(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=UP(w,f.orientation,f.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let C=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const T=C.indexOf(w.currentTarget);C=f.loop?KP(C,T+1):C.slice(T+1)}setTimeout(()=>Hj(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});Vj.displayName=Bj;var HP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function UP(t,e,n){const r=WP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return HP[r]}function Hj(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function KP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var qP=Fj,GP=Vj,tf="Tabs",[JP]=ia(tf,[$j]),Wj=$j(),[YP,Fx]=JP(tf),Uj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=ef(c),[m,g]=Wa({prop:r,onChange:s,defaultProp:a??"",caller:tf});return i.jsx(YP,{scope:n,baseId:Ki(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:i.jsx(at.div,{dir:f,"data-orientation":o,...h,ref:e})})});Uj.displayName=tf;var Kj="TabsList",qj=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,a=Fx(Kj,n),o=Wj(n);return i.jsx(qP,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:i.jsx(at.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:e})})});qj.displayName=Kj;var Gj="TabsTrigger",Jj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...a}=t,o=Fx(Gj,n),c=Wj(n),u=Xj(o.baseId,r),h=Zj(o.baseId,r),f=r===o.value;return i.jsx(GP,{asChild:!0,...c,focusable:!s,active:f,children:i.jsx(at.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...a,ref:e,onMouseDown:rt(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:rt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:rt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!s&&m&&o.onValueChange(r)})})})});Jj.displayName=Gj;var Yj="TabsContent",Qj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:a,...o}=t,c=Fx(Yj,n),u=Xj(c.baseId,r),h=Zj(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),i.jsx(Kc,{present:s||f,children:({present:g})=>i.jsx(at.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&a})})});Qj.displayName=Yj;function Xj(t,e){return`${t}-trigger-${e}`}function Zj(t,e){return`${t}-content-${e}`}var QP=Uj,ek=qj,tk=Jj,nk=Qj;const Gc=QP,ul=b.forwardRef(({className:t,...e},n)=>i.jsx(ek,{ref:n,className:bt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ul.displayName=ek.displayName;const nn=b.forwardRef(({className:t,...e},n)=>i.jsx(tk,{ref:n,className:bt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));nn.displayName=tk.displayName;const rn=b.forwardRef(({className:t,...e},n)=>i.jsx(nk,{ref:n,className:bt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));rn.displayName=nk.displayName;function Bx(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function Vx(t){const[e,n]=b.useState(void 0);return Un(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,c;if("borderBoxSize"in a){const u=a.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var nf="Switch",[XP]=ia(nf),[ZP,eI]=XP(nf),rk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:a,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),v=vt(e,C=>y(C)),j=b.useRef(!1),w=g?f||!!g.closest("form"):!0,[k,E]=Wa({prop:s,defaultProp:a??!1,onChange:h,caller:nf});return i.jsxs(ZP,{scope:n,checked:k,disabled:c,children:[i.jsx(at.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":ok(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:rt(t.onClick,C=>{E(T=>!T),w&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),w&&i.jsx(ak,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});rk.displayName=nf;var sk="SwitchThumb",ik=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=eI(sk,n);return i.jsx(at.span,{"data-state":ok(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});ik.displayName=sk;var tI="SwitchBubbleInput",ak=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},a)=>{const o=b.useRef(null),c=vt(o,a),u=Bx(n),h=Vx(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[u,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ak.displayName=tI;function ok(t){return t?"checked":"unchecked"}var lk=rk,nI=ik;const Nt=b.forwardRef(({className:t,...e},n)=>i.jsx(lk,{className:bt("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",t),...e,ref:n,children:i.jsx(nI,{className:bt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Nt.displayName=lk.displayName;function Hx({open:t,onClose:e,userId:n,onUserUpdated:r}){var Cn;const[s,a]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,j]=b.useState(!1),[w,k]=b.useState("info"),[E,C]=b.useState(""),[T,O]=b.useState(""),[B,R]=b.useState([]),[P,I]=b.useState(""),[L,X]=b.useState(""),[Z,Y]=b.useState(""),[W,D]=b.useState(!1),[$,ae]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[_,se]=b.useState([]),[q,z]=b.useState(!1),[H,de]=b.useState(!1),[K,fe]=b.useState(null),[Q,oe]=b.useState(null),[ue,ye]=b.useState(""),[V,ge]=b.useState(""),[Me,tt]=b.useState(""),[et,ot]=b.useState(!1),[Ge,dt]=b.useState(null),[Et,ht]=b.useState("");b.useEffect(()=>{t&&n&&(k("info"),fe(null),oe(null),dt(null),ht(""),X(""),Y(""),Tt(),Fe("/api/db/vip-roles").then(pe=>{pe!=null&&pe.success&&pe.data&&se(pe.data)}).catch(()=>{}))},[t,n]);async function Tt(){if(n){m(!0);try{const pe=await Fe(`/api/db/users?id=${encodeURIComponent(n)}`);if(pe!=null&&pe.success&&pe.user){const ve=pe.user;a(ve),C(ve.phone||""),O(ve.nickname||""),ye(ve.phone||""),ge(ve.wechatId||""),tt(ve.openId||"");try{R(typeof ve.tags=="string"?JSON.parse(ve.tags||"[]"):[])}catch{R([])}ae({isVip:!!(ve.isVip??!1),vipExpireDate:ve.vipExpireDate?String(ve.vipExpireDate).slice(0,10):"",vipRole:String(ve.vipRole??""),vipName:String(ve.vipName??""),vipProject:String(ve.vipProject??""),vipContact:String(ve.vipContact??""),vipBio:String(ve.vipBio??"")})}try{const ve=await Fe(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);ve!=null&&ve.success&&ve.tracks&&c(ve.tracks)}catch{c([])}try{const ve=await Fe(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ve!=null&&ve.success&&ve.referrals&&h(ve.referrals)}catch{h([])}}catch(pe){console.error("Load user detail error:",pe)}finally{m(!1)}}}async function rr(){if(!(s!=null&&s.phone)){he.info("用户未绑定手机号,无法同步");return}y(!0);try{const pe=await mt("/api/ckb/sync",{action:"full_sync",phone:s.phone,userId:s.id});pe!=null&&pe.success?(he.success("同步成功"),Tt()):he.error("同步失败: "+(pe==null?void 0:pe.error))}catch(pe){console.error("Sync CKB error:",pe),he.error("同步失败")}finally{y(!1)}}async function sr(){if(s){j(!0);try{const pe={id:s.id,phone:E||void 0,nickname:T||void 0,tags:JSON.stringify(B)},ve=await _t("/api/db/users",pe);ve!=null&&ve.success?(he.success("保存成功"),Tt(),r==null||r()):he.error("保存失败: "+(ve==null?void 0:ve.error))}catch(pe){console.error("Save user error:",pe),he.error("保存失败")}finally{j(!1)}}}const Er=()=>{P&&!B.includes(P)&&(R([...B,P]),I(""))},on=pe=>R(B.filter(ve=>ve!==pe));async function Kr(){if(s){if(!L){he.error("请输入新密码");return}if(L!==Z){he.error("两次密码不一致");return}if(L.length<6){he.error("密码至少 6 位");return}D(!0);try{const pe=await _t("/api/db/users",{id:s.id,password:L});pe!=null&&pe.success?(he.success("修改成功"),X(""),Y("")):he.error("修改失败: "+((pe==null?void 0:pe.error)||""))}catch{he.error("修改失败")}finally{D(!1)}}}async function gr(){if(s){if($.isVip&&!$.vipExpireDate.trim()){he.error("开启 VIP 请填写有效到期日");return}z(!0);try{const pe={id:s.id,isVip:$.isVip,vipExpireDate:$.isVip?$.vipExpireDate:void 0,vipRole:$.vipRole||void 0,vipName:$.vipName||void 0,vipProject:$.vipProject||void 0,vipContact:$.vipContact||void 0,vipBio:$.vipBio||void 0},ve=await _t("/api/db/users",pe);ve!=null&&ve.success?(he.success("VIP 设置已保存"),Tt(),r==null||r()):he.error("保存失败: "+((ve==null?void 0:ve.error)||""))}catch{he.error("保存失败")}finally{z(!1)}}}async function Tr(){if(!ue&&!Me&&!V){oe("请至少输入手机号、微信号或 OpenID 中的一项");return}de(!0),oe(null),fe(null);try{const pe=new URLSearchParams;ue&&pe.set("phone",ue),Me&&pe.set("openId",Me),V&&pe.set("wechatId",V);const ve=await Fe(`/api/admin/shensheshou/query?${pe}`);ve!=null&&ve.success&&ve.data?(fe(ve.data),s&&await _n(ve.data)):oe((ve==null?void 0:ve.error)||"未查询到数据,该用户可能未在神射手收录")}catch(pe){console.error("SSS query error:",pe),oe("请求失败,请检查神射手接口配置")}finally{de(!1)}}async function _n(pe){if(s)try{await mt("/api/admin/shensheshou/enrich",{userId:s.id,phone:ue||s.phone||"",openId:Me||s.openId||"",wechatId:V||s.wechatId||""}),Tt()}catch(ve){console.error("SSS enrich error:",ve)}}async function Jn(){if(s){ot(!0),dt(null);try{const pe={users:[{phone:s.phone||"",name:s.nickname||"",openId:s.openId||"",tags:B}]},ve=await mt("/api/admin/shensheshou/ingest",pe);ve!=null&&ve.success&&ve.data?dt(ve.data):dt({error:(ve==null?void 0:ve.error)||"推送失败"})}catch(pe){console.error("SSS ingest error:",pe),dt({error:"请求失败"})}finally{ot(!1)}}}const Yn=pe=>{const hn={view_chapter:Hr,purchase:wg,match:Ln,login:qo,register:qo,share:Ss,bind_phone:aA,bind_wechat:GM,fill_profile:xm,visit_page:Wo}[pe]||xg;return i.jsx(hn,{className:"w-4 h-4"})};return t?i.jsx(Zt,{open:t,onOpenChange:()=>e(),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(qo,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(s==null?void 0:s.phone)&&i.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(s==null?void 0:s.isVip)&&i.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?i.jsxs("div",{className:"flex items-center justify-center py-20",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s?i.jsxs("div",{className:"flex flex-col h-[75vh]",children:[i.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[i.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:s.avatar?i.jsx("img",{src:s.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Cn=s.nickname)==null?void 0:Cn.charAt(0))||"?"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx("h3",{className:"text-lg font-bold text-white",children:s.nickname}),s.isAdmin&&i.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),s.hasFullBook&&i.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),s.vipRole&&i.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0",children:s.vipRole})]}),i.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[s.phone?`📱 ${s.phone}`:"未绑定手机",s.wechatId&&` · 💬 ${s.wechatId}`,s.mbti&&` · ${s.mbti}`]}),i.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[i.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",s.id.slice(0,16),"…"]}),s.referralCode&&i.jsxs("p",{className:"text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"推广码:"}),i.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:s.referralCode})]})]})]}),i.jsxs("div",{className:"text-right shrink-0",children:[i.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(s.earnings||0).toFixed(2)]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),i.jsxs(Gc,{value:w,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs(ul,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[i.jsx(nn,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),i.jsx(nn,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),i.jsxs(nn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[i.jsx(Wo,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),i.jsx(nn,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),i.jsxs(nn,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[i.jsx(Fi,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),i.jsxs(rn,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:E,onChange:pe=>C(pe.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:T,onChange:pe=>O(pe.target.value)})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.openId&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),i.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:s.openId})]}),s.region&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[i.jsx(BN,{className:"w-4 h-4 text-gray-500"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),i.jsx("p",{className:"text-white",children:s.region})]})]}),s.industry&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),i.jsx("p",{className:"text-white",children:s.industry})]}),s.position&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),i.jsx("p",{className:"text-white",children:s.position})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),i.jsx("p",{className:"text-2xl font-bold text-white",children:s.referralCount??0})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),i.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(s.pendingEarnings??0).toFixed(2)]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),i.jsx("p",{className:"text-sm text-white",children:s.createdAt?new Date(s.createdAt).toLocaleDateString():"-"})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(RM,{className:"w-4 h-4 text-yellow-400"}),i.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:L,onChange:pe=>X(pe.target.value)}),i.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:Z,onChange:pe=>Y(pe.target.value)}),i.jsx(ne,{size:"sm",onClick:Kr,disabled:W||!L||!Z,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:W?"保存中...":"确认修改"})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Pa,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-400 text-sm",children:"VIP 会员"}),i.jsx(Nt,{checked:$.isVip,onCheckedChange:pe=>ae(ve=>({...ve,isVip:pe}))})]}),$.isVip&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"到期日"}),i.jsx(ce,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:$.vipExpireDate,onChange:pe=>ae(ve=>({...ve,vipExpireDate:pe.target.value}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"角色"}),i.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:$.vipRole,onChange:pe=>ae(ve=>({...ve,vipRole:pe.target.value})),children:[i.jsx("option",{value:"",children:"请选择"}),_.map(pe=>i.jsx("option",{value:pe.name,children:pe.name},pe.id))]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"展示名"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:$.vipName,onChange:pe=>ae(ve=>({...ve,vipName:pe.target.value}))})]}),i.jsx(ne,{size:"sm",onClick:gr,disabled:q,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:q?"保存中...":"保存 VIP"})]})]})]}),s.isVip&&i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Pa,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),i.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:s.vipRole||"VIP"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.vipName&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"展示名:"}),i.jsx("span",{className:"text-white",children:s.vipName})]}),s.vipProject&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"项目:"}),i.jsx("span",{className:"text-white",children:s.vipProject})]}),s.vipContact&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"联系方式:"}),i.jsx("span",{className:"text-white",children:s.vipContact})]}),s.vipExpireDate&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"到期时间:"}),i.jsx("span",{className:"text-white",children:new Date(s.vipExpireDate).toLocaleDateString()})]})]}),s.vipBio&&i.jsx("p",{className:"text-gray-400 text-sm mt-2",children:s.vipBio})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Tc,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"微信归属"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:Et,onChange:pe=>ht(pe.target.value)}),i.jsxs(ne,{size:"sm",onClick:async()=>{if(!(!Et||!s))try{await _t("/api/db/users",{id:s.id,wechatId:Et}),he.success("已保存微信归属"),Tt()}catch{he.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[i.jsx(an,{className:"w-4 h-4 mr-1"})," 保存"]})]}),s.wechatId&&i.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",i.jsx("span",{className:"text-purple-400",children:s.wechatId})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ss,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),i.jsx(ne,{size:"sm",onClick:rr,disabled:g||!s.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"同步状态:"}),s.ckbSyncedAt?i.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):i.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"最后同步:"}),i.jsx("span",{className:"text-gray-300 ml-1",children:s.ckbSyncedAt?new Date(s.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),i.jsxs(rn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(xm,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"用户标签"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),i.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[i.jsx(gg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),i.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(pe=>i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:pe.category}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:pe.tags.map(ve=>i.jsxs("button",{type:"button",onClick:()=>{B.includes(ve)?on(ve):R([...B,ve])},className:`px-2 py-0.5 rounded text-xs border transition-all ${B.includes(ve)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[B.includes(ve)?"✓ ":"",ve]},ve))})]},pe.category))}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),i.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[B.map((pe,ve)=>i.jsxs(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[pe,i.jsx("button",{type:"button",onClick:()=>on(pe),className:"ml-1 hover:text-red-400",children:i.jsx(Wn,{className:"w-3 h-3"})})]},ve)),B.length===0&&i.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:P,onChange:pe=>I(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&Er()}),i.jsx(ne,{onClick:Er,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),s.ckbTags&&i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(xm,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof s.ckbTags=="string"?s.ckbTags.split(","):[]).map((pe,ve)=>i.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0",children:pe.trim()},ve))})]})]}),i.jsxs(rn,{value:"journey",className:"flex-1 overflow-auto",children:[i.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[i.jsx(Wo,{className:"w-4 h-4 text-[#38bdac]"}),i.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),i.jsx("div",{className:"space-y-2",children:o.length>0?o.map((pe,ve)=>i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex flex-col items-center",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Yn(pe.action)}),ve0?u.map((pe,ve)=>{var Mr;const hn=pe;return i.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((Mr=hn.nickname)==null?void 0:Mr.charAt(0))||"?"}),i.jsx("span",{className:"text-white text-sm",children:hn.nickname})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[hn.status==="vip"&&i.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),i.jsx("span",{className:"text-gray-500 text-xs",children:hn.createdAt?new Date(hn.createdAt).toLocaleDateString():""})]})]},hn.id||ve)}):i.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),i.jsxs(rn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Fi,{className:"w-5 h-5 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsxs("div",{children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:ue,onChange:pe=>ye(pe.target.value)})]}),i.jsxs("div",{children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:V,onChange:pe=>ge(pe.target.value)})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:Me,onChange:pe=>tt(pe.target.value)})]})]}),i.jsx(ne,{onClick:Tr,disabled:H,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:H?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ui,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),i.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),Q&&i.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:Q}),K&&i.jsxs("div",{className:"mt-3 space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),i.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:K.rfm_score??"-"})]}),i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),i.jsx("p",{className:"text-2xl font-bold text-white",children:K.user_level??"-"})]})]}),K.tags&&K.tags.length>0&&i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:K.tags.map((pe,ve)=>i.jsx(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:pe},ve))})]}),K.last_active&&i.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",K.last_active]})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(Fi,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),i.jsx(ne,{onClick:Jn,disabled:et||!s.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:et?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):i.jsxs(i.Fragment,{children:[i.jsx(Fi,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!s.phone&&i.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),Ge&&i.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:Ge.error?i.jsx("p",{className:"text-red-400",children:String(Ge.error)}):i.jsxs("div",{className:"space-y-1",children:[i.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[i.jsx(gg,{className:"w-4 h-4"})," 推送成功"]}),Ge.enriched!==void 0&&i.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(Ge.new_tags_added??0)]})]})})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[i.jsxs(ne,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"关闭"]}),i.jsxs(ne,{onClick:sr,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):i.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function rI(){const t=sa(),[e,n]=b.useState(!0),[r,s]=b.useState(!0),[a,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,g]=b.useState(0),[y,v]=b.useState(0),[j,w]=b.useState(0),[k,E]=b.useState(0),[C,T]=b.useState(null),[O,B]=b.useState(null),[R,P]=b.useState(!1),I=W=>{const D=W;if((D==null?void 0:D.status)===401)T("登录已过期,请重新登录");else{if((D==null?void 0:D.name)==="AbortError")return;T("加载失败,请检查网络或联系管理员")}};async function L(W){const D=W?{signal:W}:void 0;n(!0),T(null);try{const _=await Fe("/api/admin/dashboard/stats",D);_!=null&&_.success&&(g(_.totalUsers??0),v(_.paidOrderCount??0),w(_.totalRevenue??0),E(_.conversionRate??0))}catch(_){if((_==null?void 0:_.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",_);try{const se=await Fe("/api/admin/dashboard/overview",D);se!=null&&se.success&&(g(se.totalUsers??0),v(se.paidOrderCount??0),w(se.totalRevenue??0),E(se.conversionRate??0))}catch(se){I(se)}}}finally{n(!1)}s(!0),o(!0);const $=async()=>{try{const _=await Fe("/api/admin/dashboard/recent-orders",D);if(_!=null&&_.success&&_.recentOrders)f(_.recentOrders);else throw new Error("no data")}catch(_){if((_==null?void 0:_.name)!=="AbortError")try{const se=await Fe("/api/orders?page=1&pageSize=20&status=paid",D),z=((se==null?void 0:se.orders)??[]).filter(H=>["paid","completed","success"].includes(H.status||""));f(z.slice(0,5))}catch{f([])}}finally{s(!1)}},ae=async()=>{try{const _=await Fe("/api/admin/dashboard/new-users",D);if(_!=null&&_.success&&_.newUsers)u(_.newUsers);else throw new Error("no data")}catch(_){if((_==null?void 0:_.name)!=="AbortError")try{const se=await Fe("/api/db/users?page=1&pageSize=10",D);u((se==null?void 0:se.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([$(),ae()])}b.useEffect(()=>{const W=new AbortController;L(W.signal);const D=setInterval(()=>L(),3e4);return()=>{W.abort(),clearInterval(D)}},[]);const X=m,Z=W=>{const D=W.productType||"",$=W.description||"";if($){if(D==="section"&&$.includes("章节")){if($.includes("-")){const ae=$.split("-");if(ae.length>=3)return{title:`第${ae[1]}章 第${ae[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:$,subtitle:"章节购买"}}return D==="fullbook"||$.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:D==="match"||$.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:$,subtitle:D==="section"?"单章":D==="fullbook"?"全书":"其他"}}return D==="section"?{title:`章节 ${W.productId||""}`,subtitle:"单章购买"}:D==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:D==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:D||"其他"}},Y=[{title:"总用户数",value:e?null:X,icon:Ln,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(j??0).toFixed(2)}`,icon:fc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,icon:wg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,icon:Hr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return i.jsxs("div",{className:"p-8 w-full",children:[i.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),C&&i.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[i.jsx("span",{children:C}),i.jsx("button",{type:"button",onClick:()=>L(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:Y.map((W,D)=>i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>W.link&&t(W.link),children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsx(Ze,{className:"text-sm font-medium text-gray-400",children:W.title}),i.jsx("div",{className:`p-2 rounded-lg ${W.bg}`,children:i.jsx(W.icon,{className:`w-4 h-4 ${W.color}`})})]}),i.jsx(Re,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-2xl font-bold text-white min-h-[2rem] flex items-center",children:W.value!=null?W.value:i.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[i.jsx(qe,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),i.jsx(Ho,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},D))}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[i.jsx(Ze,{className:"text-white",children:"最近订单"}),i.jsxs("button",{type:"button",onClick:()=>L(),disabled:r||a,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||a?i.jsx(qe,{className:"w-3.5 h-3.5 animate-spin"}):i.jsx(qe,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),i.jsx(Re,{children:i.jsx("div",{className:"space-y-3",children:r&&h.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[i.jsx(qe,{className:"w-8 h-8 animate-spin mb-2"}),i.jsx("span",{className:"text-sm",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[h.slice(0,5).map(W=>{var se;const D=W.referrerId?c.find(q=>q.id===W.referrerId):void 0,$=W.referralCode||(D==null?void 0:D.referralCode)||(D==null?void 0:D.nickname)||(W.referrerId?String(W.referrerId).slice(0,8):""),ae=Z(W),_=W.userNickname||((se=c.find(q=>q.id===W.userId))==null?void 0:se.nickname)||"匿名用户";return i.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[i.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[W.userAvatar?i.jsx("img",{src:W.userAvatar,alt:_,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:q=>{q.currentTarget.style.display="none";const z=q.currentTarget.nextElementSibling;z&&z.classList.remove("hidden")}}):null,i.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 mt-0.5 ${W.userAvatar?"hidden":""}`,children:_.charAt(0)}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("button",{type:"button",onClick:()=>{W.userId&&(B(W.userId),P(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:_}),i.jsx("span",{className:"text-gray-600",children:"·"}),i.jsx("span",{className:"text-sm font-medium text-white truncate",children:ae.title})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[ae.subtitle&&ae.subtitle!=="章节购买"&&i.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:ae.subtitle}),i.jsx("span",{children:new Date(W.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),$&&i.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",$]})]})]}),i.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[i.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(W.amount).toFixed(2)]}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:W.paymentMethod||"微信"})]})]},W.id)}),h.length===0&&!r&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(wg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),i.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"新注册用户"})}),i.jsx(Re,{children:i.jsx("div",{className:"space-y-3",children:a&&c.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[i.jsx(qe,{className:"w-8 h-8 animate-spin mb-2"}),i.jsx("span",{className:"text-sm",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[c.slice(0,5).map(W=>{var D;return i.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((D=W.nickname)==null?void 0:D.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>{B(W.id),P(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:W.nickname||"匿名用户"}),i.jsx("p",{className:"text-xs text-gray-500",children:W.phone||"-"})]})]}),i.jsx("p",{className:"text-xs text-gray-400",children:W.createdAt?new Date(W.createdAt).toLocaleDateString():"-"})]},W.id)}),c.length===0&&!a&&i.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),i.jsx(Hx,{open:R,onClose:()=>{P(!1),B(null)},userId:O,onUserUpdated:()=>L()})]})}const fr=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:bt("w-full caption-bottom text-sm",t),...e})}));fr.displayName="Table";const pr=b.forwardRef(({className:t,...e},n)=>i.jsx("thead",{ref:n,className:bt("[&_tr]:border-b",t),...e}));pr.displayName="TableHeader";const mr=b.forwardRef(({className:t,...e},n)=>i.jsx("tbody",{ref:n,className:bt("[&_tr:last-child]:border-0",t),...e}));mr.displayName="TableBody";const ct=b.forwardRef(({className:t,...e},n)=>i.jsx("tr",{ref:n,className:bt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ct.displayName="TableRow";const Te=b.forwardRef(({className:t,...e},n)=>i.jsx("th",{ref:n,className:bt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Te.displayName="TableHead";const we=b.forwardRef(({className:t,...e},n)=>i.jsx("td",{ref:n,className:bt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));we.displayName="TableCell";function Wx(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const s=setTimeout(()=>r(t),e);return()=>clearTimeout(s)},[t,e]),n}function ls({page:t,totalPages:e,total:n,pageSize:r,onPageChange:s,onPageSizeChange:a,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!a?null:i.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[i.jsxs("span",{children:["共 ",n," 条"]}),a&&i.jsx("select",{value:r,onChange:c=>a(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>i.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>s(1),disabled:t<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),i.jsx("button",{type:"button",onClick:()=>s(t-1),disabled:t<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),i.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),i.jsx("button",{type:"button",onClick:()=>s(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),i.jsx("button",{type:"button",onClick:()=>s(e),disabled:t>=e,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function sI(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,a]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,j]=b.useState(""),w=Wx(v,300),[k,E]=b.useState("all"),[C,T]=b.useState(!0),[O,B]=b.useState(null),[R,P]=b.useState(null),[I,L]=b.useState(""),[X,Z]=b.useState(!1);async function Y(){T(!0),B(null);try{const q=k==="all"?"":k==="completed"?"completed":k,z=new URLSearchParams({page:String(f),pageSize:String(g),...q&&{status:q},...w&&{search:w}}),[H,de]=await Promise.all([Fe(`/api/orders?${z}`),Fe("/api/db/users?page=1&pageSize=500")]);H!=null&&H.success&&(e(H.orders||[]),a(H.total??0),c(H.totalRevenue??0),h(H.todayRevenue??0)),de!=null&&de.success&&de.users&&r(de.users)}catch(q){console.error("加载订单失败",q),B("加载订单失败,请检查网络后重试")}finally{T(!1)}}b.useEffect(()=>{m(1)},[w,k]),b.useEffect(()=>{Y()},[f,g,w,k]);const W=q=>{var z;return q.userNickname||((z=n.find(H=>H.id===q.userId))==null?void 0:z.nickname)||"匿名用户"},D=q=>{var z;return((z=n.find(H=>H.id===q))==null?void 0:z.phone)||"-"},$=q=>{const z=q.productType||q.type||"",H=q.description||"";if(H){if(z==="section"&&H.includes("章节")){if(H.includes("-")){const de=H.split("-");if(de.length>=3)return{name:`第${de[1]}章 第${de[2]}节`,type:"《一场Soul的创业实验》"}}return{name:H,type:"章节购买"}}return z==="fullbook"||H.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:z==="vip"||H.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:z==="match"||H.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:H,type:"其他"}}return z==="section"?{name:`章节 ${q.productId||q.sectionId||""}`,type:"单章"}:z==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:z==="vip"?{name:"VIP年度会员",type:"VIP"}:z==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:z||"其他"}},ae=Math.ceil(s/g)||1;async function _(){var q;if(!(!(R!=null&&R.orderSn)&&!(R!=null&&R.id))){Z(!0),B(null);try{const z=await _t("/api/admin/orders/refund",{orderSn:R.orderSn||R.id,reason:I||void 0});z!=null&&z.success?(P(null),L(""),Y()):B((z==null?void 0:z.error)||"退款失败")}catch(z){const H=z;B(((q=H==null?void 0:H.data)==null?void 0:q.error)||"退款失败,请检查网络后重试")}finally{Z(!1)}}}function se(){if(t.length===0){he.info("暂无数据可导出");return}const q=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],z=t.map(Q=>{const oe=$(Q);return[Q.orderSn||Q.id||"",W(Q),D(Q.userId),oe.name,Number(Q.amount||0).toFixed(2),Q.paymentMethod==="wechat"?"微信支付":Q.paymentMethod==="alipay"?"支付宝":Q.paymentMethod||"微信支付",Q.status==="refunded"?"已退款":Q.status==="paid"||Q.status==="completed"?"已完成":Q.status==="pending"||Q.status==="created"?"待支付":"已失败",Q.status==="refunded"&&Q.refundReason?Q.refundReason:"-",Q.referrerEarnings?Number(Q.referrerEarnings).toFixed(2):"-",Q.createdAt?new Date(Q.createdAt).toLocaleString("zh-CN"):""].join(",")}),H="\uFEFF"+[q.join(","),...z].join(` +`),de=new Blob([H],{type:"text/csv;charset=utf-8"}),K=URL.createObjectURL(de),fe=document.createElement("a");fe.href=K,fe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,fe.click(),URL.revokeObjectURL(K)}return i.jsxs("div",{className:"p-8 w-full",children:[O&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:O}),i.jsx("button",{type:"button",onClick:()=>B(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs(ne,{variant:"outline",onClick:Y,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`}),"刷新"]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"text-gray-400",children:"总收入:"}),i.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),i.jsx("span",{className:"text-gray-600",children:"|"}),i.jsx("span",{className:"text-gray-400",children:"今日:"}),i.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),i.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),i.jsx(ce,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:q=>j(q.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx($N,{className:"w-4 h-4 text-gray-400"}),i.jsxs("select",{value:k,onChange:q=>E(q.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"pending",children:"待支付"}),i.jsx("option",{value:"created",children:"已创建"}),i.jsx("option",{value:"failed",children:"已失败"}),i.jsx("option",{value:"refunded",children:"已退款"})]})]}),i.jsxs(ne,{variant:"outline",onClick:se,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(eM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:C?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs("div",{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"订单号"}),i.jsx(Te,{className:"text-gray-400",children:"用户"}),i.jsx(Te,{className:"text-gray-400",children:"商品"}),i.jsx(Te,{className:"text-gray-400",children:"金额"}),i.jsx(Te,{className:"text-gray-400",children:"支付方式"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-gray-400",children:"退款原因"}),i.jsx(Te,{className:"text-gray-400",children:"分销佣金"}),i.jsx(Te,{className:"text-gray-400",children:"下单时间"}),i.jsx(Te,{className:"text-gray-400",children:"操作"})]})}),i.jsxs(mr,{children:[t.map(q=>{const z=$(q);return i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsxs(we,{className:"font-mono text-xs text-gray-400",children:[(q.orderSn||q.id||"").slice(0,12),"..."]}),i.jsx(we,{children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:W(q)}),i.jsx("p",{className:"text-gray-500 text-xs",children:D(q.userId)})]})}),i.jsx(we,{children:i.jsxs("div",{children:[i.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[z.name,(q.productType||q.type)==="vip"&&i.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:z.type})]})}),i.jsxs(we,{className:"text-[#38bdac] font-bold",children:["¥",Number(q.amount||0).toFixed(2)]}),i.jsx(we,{className:"text-gray-300",children:q.paymentMethod==="wechat"?"微信支付":q.paymentMethod==="alipay"?"支付宝":q.paymentMethod||"微信支付"}),i.jsx(we,{children:q.status==="refunded"?i.jsx(Be,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):q.status==="paid"||q.status==="completed"?i.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):q.status==="pending"||q.status==="created"?i.jsx(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):i.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),i.jsx(we,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:q.refundReason,children:q.status==="refunded"&&q.refundReason?q.refundReason:"-"}),i.jsx(we,{className:"text-[#FFD700]",children:q.referrerEarnings?`¥${Number(q.referrerEarnings).toFixed(2)}`:"-"}),i.jsx(we,{className:"text-gray-400 text-sm",children:new Date(q.createdAt).toLocaleString("zh-CN")}),i.jsx(we,{children:(q.status==="paid"||q.status==="completed")&&i.jsxs(ne,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{P(q),L("")},children:[i.jsx(VN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},q.id)}),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),i.jsx(ls,{page:f,totalPages:ae,total:s,pageSize:g,onPageChange:m,onPageSizeChange:q=>{y(q),m(1)}})]})})}),i.jsx(Zt,{open:!!R,onOpenChange:q=>!q&&P(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:"订单退款"})}),R&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",R.orderSn||R.id]}),i.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(R.amount||0).toFixed(2)]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),i.jsx("div",{className:"form-input",children:i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:I,onChange:q=>L(q.target.value)})})]}),i.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>P(null),disabled:X,children:"取消"}),i.jsx(ne,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:_,disabled:X,children:X?"退款中...":"确认退款"})]})]})})]})}const Jc=b.forwardRef(({className:t,...e},n)=>i.jsx("textarea",{className:bt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));Jc.displayName="Textarea";const vu=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function iI(){var Yr,Tn,ms,Ps,Is;const[t,e]=IN(),n=t.get("pool"),[r,s]=b.useState([]),[a,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=Wx(m,300),v=n==="vip"?"vip":n==="complete"?"complete":"all",[j,w]=b.useState(v),[k,E]=b.useState(!0),[C,T]=b.useState(!1),[O,B]=b.useState(null),[R,P]=b.useState(!1),[I,L]=b.useState("desc");b.useEffect(()=>{n==="vip"?w("vip"):n==="complete"?w("complete"):n==="all"&&w("all")},[n]);const[X,Z]=b.useState(!1),[Y,W]=b.useState(null),[D,$]=b.useState(!1),[ae,_]=b.useState(!1),[se,q]=b.useState({referrals:[],stats:{}}),[z,H]=b.useState(!1),[de,K]=b.useState(null),[fe,Q]=b.useState(!1),[oe,ue]=b.useState(null),[ye,V]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[ge,Me]=b.useState([]),[tt,et]=b.useState(!1),[ot,Ge]=b.useState(!1),[dt,Et]=b.useState(null),[ht,Tt]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[rr,sr]=b.useState([]),[Er,on]=b.useState(!1),[Kr,gr]=b.useState(!1),[Tr,_n]=b.useState(null),[Jn,Yn]=b.useState({name:"",sort:0}),[Cn,pe]=b.useState({}),[ve,hn]=b.useState(!1);async function Mr(G=!1){var nt;E(!0),G&&T(!0),B(null);try{if(R){const wt=new URLSearchParams({search:y,limit:String(h*5)}),ft=await Fe(`/api/db/users/rfm?${wt}`);if(ft!=null&&ft.success){let Qt=ft.users||[];I==="asc"&&(Qt=[...Qt].reverse());const li=(c-1)*h;s(Qt.slice(li,li+h)),o(((nt=ft.users)==null?void 0:nt.length)??0),Qt.length===0&&(P(!1),B("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else P(!1),B((ft==null?void 0:ft.error)||"RFM 加载失败,已切回普通模式")}else{const wt=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...j==="vip"&&{vip:"true"},...j==="complete"&&{pool:"complete"}}),ft=await Fe(`/api/db/users?${wt}`);ft!=null&&ft.success?(s(ft.users||[]),o(ft.total??0)):B((ft==null?void 0:ft.error)||"加载失败")}}catch(wt){console.error("Load users error:",wt),B("网络错误")}finally{E(!1),G&&T(!1)}}b.useEffect(()=>{u(1)},[y,j,R]),b.useEffect(()=>{Mr()},[c,h,y,j,R,I]);const fs=Math.ceil(a/h)||1,ua=()=>{R?I==="desc"?L("asc"):(P(!1),L("desc")):(P(!0),L("desc"))},En=G=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[G||""]||"bg-gray-500/20 text-gray-400";async function qr(G){if(confirm("确定要删除这个用户吗?"))try{const nt=await ss(`/api/db/users?id=${encodeURIComponent(G)}`);nt!=null&&nt.success?Mr():he.error("删除失败: "+((nt==null?void 0:nt.error)||""))}catch{he.error("删除失败")}}const ha=G=>{W(G),V({phone:G.phone||"",nickname:G.nickname||"",password:"",isAdmin:!!(G.isAdmin??!1),hasFullBook:!!(G.hasFullBook??!1)}),Z(!0)},xr=()=>{W(null),V({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),Z(!0)};async function Gr(){if(!ye.phone||!ye.nickname){he.error("请填写手机号和昵称");return}$(!0);try{if(Y){const G=await _t("/api/db/users",{id:Y.id,nickname:ye.nickname,isAdmin:ye.isAdmin,hasFullBook:ye.hasFullBook,...ye.password&&{password:ye.password}});if(!(G!=null&&G.success)){he.error("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await mt("/api/db/users",{phone:ye.phone,nickname:ye.nickname,password:ye.password,isAdmin:ye.isAdmin});if(!(G!=null&&G.success)){he.error("创建失败: "+((G==null?void 0:G.error)||""));return}}Z(!1),Mr()}catch{he.error("保存失败")}finally{$(!1)}}async function ai(G){K(G),_(!0),H(!0);try{const nt=await Fe(`/api/db/users/referrals?userId=${encodeURIComponent(G.id)}`);nt!=null&&nt.success?q({referrals:nt.referrals||[],stats:nt.stats||{}}):q({referrals:[],stats:{}})}catch{q({referrals:[],stats:{}})}finally{H(!1)}}const ut=b.useCallback(async()=>{et(!0);try{const G=await Fe("/api/db/user-rules");G!=null&&G.success&&Me(G.rules||[])}catch{}finally{et(!1)}},[]);async function Ar(){if(!ht.title){he.error("请填写规则标题");return}$(!0);try{if(dt){const G=await _t("/api/db/user-rules",{id:dt.id,...ht});if(!(G!=null&&G.success)){he.error("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await mt("/api/db/user-rules",ht);if(!(G!=null&&G.success)){he.error("创建失败: "+((G==null?void 0:G.error)||""));return}}Ge(!1),ut()}catch{he.error("保存失败")}finally{$(!1)}}async function io(G){if(confirm("确定删除?"))try{const nt=await ss(`/api/db/user-rules?id=${G}`);nt!=null&&nt.success&&ut()}catch{}}async function xn(G){try{await _t("/api/db/user-rules",{id:G.id,enabled:!G.enabled}),ut()}catch{}}const Jr=b.useCallback(async()=>{on(!0);try{const G=await Fe("/api/db/vip-roles");G!=null&&G.success&&sr(G.roles||[])}catch{}finally{on(!1)}},[]);async function oi(){if(!Jn.name){he.error("请填写角色名称");return}$(!0);try{if(Tr){const G=await _t("/api/db/vip-roles",{id:Tr.id,...Jn});if(!(G!=null&&G.success)){he.error("更新失败");return}}else{const G=await mt("/api/db/vip-roles",Jn);if(!(G!=null&&G.success)){he.error("创建失败");return}}gr(!1),Jr()}catch{he.error("保存失败")}finally{$(!1)}}async function Rr(G){if(confirm("确定删除?"))try{const nt=await ss(`/api/db/vip-roles?id=${G}`);nt!=null&&nt.success&&Jr()}catch{}}const ps=b.useCallback(async()=>{hn(!0);try{const G=await Fe("/api/db/users/journey-stats");G!=null&&G.success&&G.stats&&pe(G.stats)}catch{}finally{hn(!1)}},[]);return i.jsxs("div",{className:"p-8 w-full",children:[O&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:O}),i.jsx("button",{type:"button",onClick:()=>B(null),children:"×"})]}),i.jsx("div",{className:"flex justify-between items-center mb-6",children:i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),i.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",a," 位注册用户",R&&" · RFM 排序中"]})]})}),i.jsxs(Gc,{defaultValue:"users",className:"w-full",children:[i.jsxs(ul,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[i.jsxs(nn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[i.jsx(Ln,{className:"w-4 h-4"})," 用户列表"]}),i.jsxs(nn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ps,children:[i.jsx(Wo,{className:"w-4 h-4"})," 用户旅程总览"]}),i.jsxs(nn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ut,children:[i.jsx(_a,{className:"w-4 h-4"})," 规则配置"]}),i.jsxs(nn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Jr,children:[i.jsx(Pa,{className:"w-4 h-4"})," VIP 角色"]})]}),i.jsxs(rn,{value:"users",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[i.jsxs(ne,{variant:"outline",onClick:()=>Mr(!0),disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`})," 刷新"]}),i.jsxs("select",{value:j,onChange:G=>{const nt=G.target.value;w(nt),u(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:R,children:[i.jsx("option",{value:"all",children:"全部用户"}),i.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),i.jsx("option",{value:"complete",children:"完善资料用户"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),i.jsx(ce,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:G=>g(G.target.value)})]}),i.jsxs(ne,{onClick:xr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ng,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:k?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs("div",{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"用户信息"}),i.jsx(Te,{className:"text-gray-400",children:"绑定信息"}),i.jsx(Te,{className:"text-gray-400",children:"购买状态"}),i.jsx(Te,{className:"text-gray-400",children:"分销收益"}),i.jsxs(Te,{className:"text-gray-400 cursor-pointer select-none",onClick:ua,children:[i.jsxs("div",{className:"flex items-center gap-1 group",children:[i.jsx(fc,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:"RFM分值"}),R?I==="desc"?i.jsx(Ec,{className:"w-3.5 h-3.5 text-[#38bdac]"}):i.jsx(DN,{className:"w-3.5 h-3.5 text-[#38bdac]"}):i.jsx(ST,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),R&&i.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),i.jsx(Te,{className:"text-gray-400",children:"注册时间"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(mr,{children:[r.map(G=>{var nt,wt,ft;return i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:G.avatar?i.jsx("img",{src:G.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((nt=G.nickname)==null?void 0:nt.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>{ue(G.id),Q(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:G.nickname}),G.isAdmin&&i.jsx(Be,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),G.openId&&!((wt=G.id)!=null&&wt.startsWith("user_"))&&i.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),i.jsx("p",{className:"text-xs text-gray-500 font-mono",children:G.openId?G.openId.slice(0,12)+"...":(ft=G.id)==null?void 0:ft.slice(0,12)})]})]})}),i.jsx(we,{children:i.jsxs("div",{className:"space-y-1",children:[G.phone&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"📱"}),i.jsx("span",{className:"text-gray-300",children:G.phone})]}),G.wechatId&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"💬"}),i.jsx("span",{className:"text-gray-300",children:G.wechatId})]}),G.openId&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"🔗"}),i.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:G.openId,children:[G.openId.slice(0,12),"..."]})]}),!G.phone&&!G.wechatId&&!G.openId&&i.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),i.jsx(we,{children:G.hasFullBook?i.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):i.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),i.jsx(we,{children:i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(G.earnings||0)).toFixed(2)]}),parseFloat(String(G.pendingEarnings||0))>0&&i.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(G.pendingEarnings||0)).toFixed(2)]}),i.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>ai(G),role:"button",tabIndex:0,onKeyDown:Qt=>Qt.key==="Enter"&&ai(G),children:[i.jsx(Ln,{className:"w-3 h-3"})," 绑定",G.referralCount||0,"人"]})]})}),i.jsx(we,{children:G.rfmScore!==void 0?i.jsx("div",{className:"flex flex-col gap-1",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-white font-bold text-base",children:G.rfmScore}),i.jsx(Be,{className:`border-0 text-xs ${En(G.rfmLevel)}`,children:G.rfmLevel})]})}):i.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",i.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),i.jsx(we,{className:"text-gray-400",children:G.createdAt?new Date(G.createdAt).toLocaleDateString():"-"}),i.jsx(we,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{ue(G.id),Q(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:i.jsx(yg,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>ha(G),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>qr(G.id),title:"删除",children:i.jsx(wn,{className:"w-4 h-4"})})]})})]},G.id)}),r.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),i.jsx(ls,{page:c,totalPages:fs,total:a,pageSize:h,onPageChange:u,onPageSizeChange:G=>{f(G),u(1)}})]})})})]}),i.jsxs(rn,{value:"journey",children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),i.jsxs(ne,{variant:"outline",onClick:ps,disabled:ve,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${ve?"animate-spin":""}`})," 刷新数据"]})]}),i.jsxs("div",{className:"relative mb-8",children:[i.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),i.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:vu.map((G,nt)=>i.jsxs("div",{className:"relative flex flex-col items-center",children:[i.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${G.color} text-center cursor-default`,children:[i.jsx("div",{className:"text-2xl mb-1",children:G.icon}),i.jsx("div",{className:`text-xs font-medium ${G.color.split(" ").find(wt=>wt.startsWith("text-"))}`,children:G.label}),Cn[G.id]!==void 0&&i.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[i.jsx("span",{className:"font-bold text-white",children:Cn[G.id]})," 人"]}),i.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:nt+1})]}),nti.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[i.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:G.step}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-300",children:G.action}),i.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",G.next]})]})]},G.step))})]}),i.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Hr,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),i.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),ve?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(qe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Cn).length>0?i.jsx("div",{className:"space-y-2",children:vu.map(G=>{const nt=Cn[G.id]||0,wt=Math.max(...vu.map(Qt=>Cn[Qt.id]||0),1),ft=Math.round(nt/wt*100);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[G.icon," ",G.label]}),i.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${ft}%`}})}),i.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:nt})]},G.id)})}):i.jsx("div",{className:"text-center py-8",children:i.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),i.jsxs(rn,{value:"rules",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ne,{variant:"outline",onClick:ut,disabled:tt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${tt?"animate-spin":""}`})," 刷新"]}),i.jsxs(ne,{onClick:()=>{Et(null),Tt({title:"",description:"",trigger:"",sort:0,enabled:!0}),Ge(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),tt?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):ge.length===0?i.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[i.jsx(Hr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),i.jsxs(ne,{onClick:ut,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(qe,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):i.jsx("div",{className:"space-y-2",children:ge.map(G=>i.jsx("div",{className:`p-4 rounded-lg border transition-all ${G.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[i.jsx(kt,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),i.jsx("span",{className:"text-white font-medium",children:G.title}),G.trigger&&i.jsxs(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",G.trigger]}),i.jsx(Be,{className:`text-xs border-0 ${G.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:G.enabled?"启用":"禁用"})]}),G.description&&i.jsx("p",{className:"text-gray-400 text-sm ml-6",children:G.description})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[i.jsx(Nt,{checked:G.enabled,onCheckedChange:()=>xn(G)}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{Et(G),Tt({title:G.title,description:G.description,trigger:G.trigger,sort:G.sort,enabled:G.enabled}),Ge(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>io(G.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(wn,{className:"w-4 h-4"})})]})]})},G.id))})]}),i.jsxs(rn,{value:"vip-roles",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"管理用户 VIP 角色分类,这些角色将在用户详情和会员展示中使用"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ne,{variant:"outline",onClick:Jr,disabled:Er,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${Er?"animate-spin":""}`})," 刷新"]}),i.jsxs(ne,{onClick:()=>{_n(null),Yn({name:"",sort:0}),gr(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"})," 添加角色"]})]})]}),Er?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):rr.length===0?i.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[i.jsx(Pa,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-400 mb-4",children:"暂无 VIP 角色"}),i.jsxs(ne,{onClick:()=>{_n(null),Yn({name:"",sort:0}),gr(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"})," 添加第一个角色"]})]}):i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:rr.map(G=>i.jsxs("div",{className:"p-4 bg-[#0f2137] border border-amber-500/20 rounded-xl hover:border-amber-500/40 transition-all group",children:[i.jsxs("div",{className:"flex items-start justify-between mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Pa,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:G.name})]}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx("button",{type:"button",onClick:()=>{_n(G),Yn({name:G.name,sort:G.sort}),gr(!0)},className:"text-gray-500 hover:text-[#38bdac]",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx("button",{type:"button",onClick:()=>Rr(G.id),className:"text-gray-500 hover:text-red-400",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]}),i.jsxs("p",{className:"text-gray-600 text-xs",children:["排序: ",G.sort]})]},G.id))})]})]}),i.jsx(Zt,{open:X,onOpenChange:Z,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[Y?i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Ng,{className:"w-5 h-5 text-[#38bdac]"}),Y?"编辑用户":"添加用户"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ye.phone,onChange:G=>V({...ye,phone:G.target.value}),disabled:!!Y})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ye.nickname,onChange:G=>V({...ye,nickname:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:Y?"新密码 (留空则不修改)":"密码"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:Y?"留空则不修改":"请输入密码",value:ye.password,onChange:G=>V({...ye,password:G.target.value})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-300",children:"管理员权限"}),i.jsx(Nt,{checked:ye.isAdmin,onCheckedChange:G=>V({...ye,isAdmin:G})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-300",children:"已购全书"}),i.jsx(Nt,{checked:ye.hasFullBook,onCheckedChange:G=>V({...ye,hasFullBook:G})})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>Z(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:Gr,disabled:D,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),D?"保存中...":"保存"]})]})]})}),i.jsx(Zt,{open:ot,onOpenChange:Ge,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}),dt?"编辑规则":"添加规则"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"规则标题 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:ht.title,onChange:G=>Tt({...ht,title:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"规则描述"}),i.jsx(Jc,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:ht.description,onChange:G=>Tt({...ht,description:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"触发条件"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:ht.trigger,onChange:G=>Tt({...ht,trigger:G.target.value})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{children:i.jsx(te,{className:"text-gray-300",children:"启用状态"})}),i.jsx(Nt,{checked:ht.enabled,onCheckedChange:G=>Tt({...ht,enabled:G})})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>Ge(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:Ar,disabled:D,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),D?"保存中...":"保存"]})]})]})}),i.jsx(Zt,{open:Kr,onOpenChange:gr,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(Pa,{className:"w-5 h-5 text-amber-400"}),Tr?"编辑 VIP 角色":"添加 VIP 角色"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色名称 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:创业者、资源整合者、技术咖",value:Jn.name,onChange:G=>Yn({...Jn,name:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序(越小越前)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Jn.sort,onChange:G=>Yn({...Jn,sort:parseInt(G.target.value)||0})})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>gr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:oi,disabled:D,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),D?"保存中...":"保存"]})]})]})}),i.jsx(Zt,{open:ae,onOpenChange:_,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",de==null?void 0:de.nickname]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((Yr=se.stats)==null?void 0:Yr.total)||0}),i.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Tn=se.stats)==null?void 0:Tn.purchased)||0}),i.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((ms=se.stats)==null?void 0:ms.earnings)||0).toFixed(2)]}),i.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((Ps=se.stats)==null?void 0:Ps.pendingEarnings)||0).toFixed(2)]}),i.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),z?i.jsxs("div",{className:"flex items-center justify-center py-8",children:[i.jsx(qe,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Is=se.referrals)==null?void 0:Is.length)??0)>0?i.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(se.referrals??[]).map((G,nt)=>{var ft;const wt=G;return i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((ft=wt.nickname)==null?void 0:ft.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white text-sm",children:wt.nickname}),i.jsx("div",{className:"text-xs text-gray-500",children:wt.phone||(wt.hasOpenId?"微信用户":"未绑定")})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[wt.status==="vip"&&i.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),wt.status==="paid"&&i.jsxs(Be,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",wt.purchasedSections,"章"]}),wt.status==="free"&&i.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),i.jsx("span",{className:"text-xs text-gray-500",children:wt.createdAt?new Date(wt.createdAt).toLocaleDateString():""})]})]},wt.id||nt)})}):i.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),i.jsx(Nn,{children:i.jsx(ne,{variant:"outline",onClick:()=>_(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),i.jsx(Hx,{open:fe,onClose:()=>Q(!1),userId:oe,onUserUpdated:Mr})]})}function eh(t,[e,n]){return Math.min(n,Math.max(e,t))}var ck=["PageUp","PageDown"],dk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],uk={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},hl="Slider",[Eg,aI,oI]=$x(hl),[hk]=ia(hl,[oI]),[lI,rf]=hk(hl),fk=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:a=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:v,...j}=t,w=b.useRef(new Set),k=b.useRef(0),C=o==="horizontal"?cI:dI,[T=[],O]=Wa({prop:f,defaultProp:h,onChange:X=>{var Y;(Y=[...w.current][k.current])==null||Y.focus(),m(X)}}),B=b.useRef(T);function R(X){const Z=mI(T,X);L(X,Z)}function P(X){L(X,k.current)}function I(){const X=B.current[k.current];T[k.current]!==X&&g(T)}function L(X,Z,{commit:Y}={commit:!1}){const W=vI(a),D=bI(Math.round((X-r)/a)*a+r,W),$=eh(D,[r,s]);O((ae=[])=>{const _=fI(ae,$,Z);if(yI(_,u*a)){k.current=_.indexOf($);const se=String(_)!==String(ae);return se&&Y&&g(_),se?_:ae}else return ae})}return i.jsx(lI,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:k,thumbs:w.current,values:T,orientation:o,form:v,children:i.jsx(Eg.Provider,{scope:t.__scopeSlider,children:i.jsx(Eg.Slot,{scope:t.__scopeSlider,children:i.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:rt(j.onPointerDown,()=>{c||(B.current=T)}),min:r,max:s,inverted:y,onSlideStart:c?void 0:R,onSlideMove:c?void 0:P,onSlideEnd:c?void 0:I,onHomeKeyDown:()=>!c&&L(r,0,{commit:!0}),onEndKeyDown:()=>!c&&L(s,T.length-1,{commit:!0}),onStepKeyDown:({event:X,direction:Z})=>{if(!c){const D=ck.includes(X.key)||X.shiftKey&&dk.includes(X.key)?10:1,$=k.current,ae=T[$],_=a*D*Z;L(ae+_,$,{commit:!0})}}})})})})});fk.displayName=hl;var[pk,mk]=hk(hl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),cI=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:a,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=vt(e,C=>g(C)),v=b.useRef(void 0),j=ef(s),w=j==="ltr",k=w&&!a||!w&&a;function E(C){const T=v.current||m.getBoundingClientRect(),O=[0,T.width],R=Ux(O,k?[n,r]:[r,n]);return v.current=T,R(C-T.left)}return i.jsx(pk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:i.jsx(gk,{dir:j,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const T=E(C.clientX);o==null||o(T)},onSlideMove:C=>{const T=E(C.clientX);c==null||c(T)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:C=>{const O=uk[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:O?-1:1})}})})}),dI=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=vt(e,f),g=b.useRef(void 0),y=!s;function v(j){const w=g.current||f.current.getBoundingClientRect(),k=[0,w.height],C=Ux(k,y?[r,n]:[n,r]);return g.current=w,C(j-w.top)}return i.jsx(pk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:i.jsx(gk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const w=v(j.clientY);a==null||a(w)},onSlideMove:j=>{const w=v(j.clientY);o==null||o(w)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=uk[y?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),gk=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=rf(hl,n);return i.jsx(at.span,{...h,ref:e,onKeyDown:rt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):ck.concat(dk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:rt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:rt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:rt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),a(m))})})}),xk="SliderTrack",yk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=rf(xk,n);return i.jsx(at.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});yk.displayName=xk;var Tg="SliderRange",vk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=rf(Tg,n),a=mk(Tg,n),o=b.useRef(null),c=vt(e,o),u=s.values.length,h=s.values.map(g=>Nk(g,s.min,s.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return i.jsx(at.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[a.startEdge]:f+"%",[a.endEdge]:m+"%"}})});vk.displayName=Tg;var Mg="SliderThumb",bk=b.forwardRef((t,e)=>{const n=aI(t.__scopeSlider),[r,s]=b.useState(null),a=vt(e,c=>s(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return i.jsx(uI,{...t,ref:a,index:o})}),uI=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...a}=t,o=rf(Mg,n),c=mk(Mg,n),[u,h]=b.useState(null),f=vt(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,g=Vx(u),y=o.values[r],v=y===void 0?0:Nk(y,o.min,o.max),j=pI(r,o.values.length),w=g==null?void 0:g[c.size],k=w?gI(w,v,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),i.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${v}% + ${k}px)`},children:[i.jsx(Eg.ItemSlot,{scope:t.__scopeSlider,children:i.jsx(at.span,{role:"slider","aria-label":t["aria-label"]||j,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...a,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:rt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&i.jsx(wk,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});bk.displayName=Mg;var hI="RadioBubbleInput",wk=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),a=vt(s,r),o=Bx(e);return b.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),i.jsx(at.input,{style:{display:"none"},...n,ref:a,defaultValue:e})});wk.displayName=hI;function fI(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,a)=>s-a)}function Nk(t,e,n){const a=100/(n-e)*(t-e);return eh(a,[0,100])}function pI(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function mI(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function gI(t,e,n){const r=t/2,a=Ux([0,50],[0,r]);return(r-a(e)*n)*n}function xI(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function yI(t,e){if(e>0){const n=xI(t);return Math.min(...n)>=e}return!0}function Ux(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function vI(t){return(String(t).split(".")[1]||"").length}function bI(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var wI=fk,NI=yk,jI=vk,kI=bk;function SI({className:t,defaultValue:e,value:n,min:r=0,max:s=100,...a}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,s],[n,e,r,s]);return i.jsxs(wI,{defaultValue:e,value:n,min:r,max:s,className:bt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...a,children:[i.jsx(NI,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:i.jsx(jI,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>i.jsx(kI,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},u))]})}const CI={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function jk(t){const[e,n]=b.useState(CI),[r,s]=b.useState(!0),[a,o]=b.useState(!1);b.useEffect(()=>{Fe("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>s(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await mt("/api/admin/referral-settings",h);if(!f||f.success===!1){he.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}he.success(`✅ 分销配置已保存成功! + +• 小程序与网站的推广规则会一起生效 +• 绑定关系会使用新的天数配置 +• 佣金比例会立即应用到新订单 + +如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),he.error("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return r?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Xo,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),i.jsxs(ne,{onClick:c,disabled:a||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"flex items-center gap-2 text-white",children:[i.jsx(sA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),i.jsx(zt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),i.jsx(Re,{className:"space-y-6",children:i.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(du,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),i.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(Ln,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(SI,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),i.jsx(ce,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",i.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(du,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),i.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(du,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),i.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(Ln,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),i.jsx(ce,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),i.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"flex items-center gap-2 text-white",children:[i.jsx(Xo,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),i.jsx(zt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),i.jsx(Re,{className:"space-y-6",children:i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最低提现金额(元)"}),i.jsx(ce,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),i.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",i.jsx(Be,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[i.jsx(Nt,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),i.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(Xe,{children:i.jsxs(Ze,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[i.jsx(du,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),i.jsxs(Re,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[i.jsxs("p",{children:["1. 以上配置会写入"," ",i.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),i.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),i.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function EI(){var ye;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[s,a]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(""),[E,C]=b.useState("all"),[T,O]=b.useState(1),[B,R]=b.useState(10),[P,I]=b.useState(0),[L,X]=b.useState(new Set),[Z,Y]=b.useState(null),[W,D]=b.useState(""),[$,ae]=b.useState(!1);b.useEffect(()=>{_()},[]),b.useEffect(()=>{O(1)},[t,E]),b.useEffect(()=>{se(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&se(t,!0)},[T,B,E,w]);async function _(){j(null);try{const V=await Fe("/api/admin/distribution/overview");V!=null&&V.success&&V.overview&&a(V.overview)}catch(V){console.error("[Admin] 概览接口异常:",V),j("加载概览失败")}try{const V=await Fe("/api/db/users");m((V==null?void 0:V.users)||[])}catch(V){console.error("[Admin] 用户数据加载失败:",V)}}async function se(V,ge=!1){var Me;if(!(!ge&&L.has(V))){y(!0);try{const tt=f;switch(V){case"overview":break;case"orders":{try{const et=new URLSearchParams({page:String(T),pageSize:String(B),...E!=="all"&&{status:E},...w&&{search:w}}),ot=await Fe(`/api/orders?${et}`);if(ot!=null&&ot.success&&ot.orders){const Ge=ot.orders.map(dt=>{const Et=tt.find(Tt=>Tt.id===dt.userId),ht=dt.referrerId?tt.find(Tt=>Tt.id===dt.referrerId):null;return{...dt,amount:parseFloat(String(dt.amount))||0,userNickname:(Et==null?void 0:Et.nickname)||dt.userNickname||"未知用户",userPhone:(Et==null?void 0:Et.phone)||dt.userPhone||"-",referrerNickname:(ht==null?void 0:ht.nickname)||null,referrerCode:(ht==null?void 0:ht.referralCode)??null,type:dt.productType||dt.type}});r(Ge),I(ot.total??Ge.length)}else r([]),I(0)}catch(et){console.error(et),j("加载订单失败"),r([])}break}case"bindings":{try{const et=new URLSearchParams({page:String(T),pageSize:String(B),...E!=="all"&&{status:E}}),ot=await Fe(`/api/db/distribution?${et}`);c((ot==null?void 0:ot.bindings)||[]),I((ot==null?void 0:ot.total)??((Me=ot==null?void 0:ot.bindings)==null?void 0:Me.length)??0)}catch(et){console.error(et),j("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const et=E==="completed"?"success":E==="rejected"?"failed":E,ot=new URLSearchParams({...et&&et!=="all"&&{status:et},page:String(T),pageSize:String(B)}),Ge=await Fe(`/api/admin/withdrawals?${ot}`);if(Ge!=null&&Ge.success&&Ge.withdrawals){const dt=Ge.withdrawals.map(Et=>({...Et,account:Et.account??"未绑定微信号",status:Et.status==="success"?"completed":Et.status==="failed"?"rejected":Et.status}));h(dt),I((Ge==null?void 0:Ge.total)??dt.length)}else Ge!=null&&Ge.success||j(`获取提现记录失败: ${(Ge==null?void 0:Ge.error)||"未知错误"}`),h([])}catch(et){console.error(et),j("加载提现数据失败"),h([])}break}}X(et=>new Set(et).add(V))}catch(tt){console.error(tt)}finally{y(!1)}}}async function q(){j(null),X(V=>{const ge=new Set(V);return ge.delete(t),ge}),t==="overview"&&_(),await se(t,!0)}async function z(V){if(confirm("确认审核通过并打款?"))try{const ge=await _t("/api/admin/withdrawals",{id:V,action:"approve"});if(!(ge!=null&&ge.success)){const Me=(ge==null?void 0:ge.message)||(ge==null?void 0:ge.error)||"操作失败";he.error(Me);return}await q()}catch(ge){console.error(ge),he.error("操作失败")}}async function H(V){const ge=prompt("请输入拒绝原因:");if(ge)try{const Me=await _t("/api/admin/withdrawals",{id:V,action:"reject",errorMessage:ge});if(!(Me!=null&&Me.success)){he.error((Me==null?void 0:Me.error)||"操作失败");return}await q()}catch(Me){console.error(Me),he.error("操作失败")}}async function de(){var V;if(!(!(Z!=null&&Z.orderSn)&&!(Z!=null&&Z.id))){ae(!0),j(null);try{const ge=await _t("/api/admin/orders/refund",{orderSn:Z.orderSn||Z.id,reason:W||void 0});ge!=null&&ge.success?(Y(null),D(""),await se("orders",!0)):j((ge==null?void 0:ge.error)||"退款失败")}catch(ge){const Me=ge;j(((V=Me==null?void 0:Me.data)==null?void 0:V.error)||"退款失败,请检查网络后重试")}finally{ae(!1)}}}function K(V){const ge={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},Me={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return i.jsx(Be,{className:`${ge[V]||"bg-gray-500/20 text-gray-400"} border-0`,children:Me[V]||V})}const fe=Math.ceil(P/B)||1,Q=n,oe=o.filter(V=>{var Me,tt,et,ot;if(!w)return!0;const ge=w.toLowerCase();return((Me=V.refereeNickname)==null?void 0:Me.toLowerCase().includes(ge))||((tt=V.refereePhone)==null?void 0:tt.includes(ge))||((et=V.referrerName)==null?void 0:et.toLowerCase().includes(ge))||((ot=V.referrerCode)==null?void 0:ot.toLowerCase().includes(ge))}),ue=u.filter(V=>{var Me;if(!w)return!0;const ge=w.toLowerCase();return((Me=V.userName)==null?void 0:Me.toLowerCase().includes(ge))||V.account&&V.account.toLowerCase().includes(ge)});return i.jsxs("div",{className:"p-8 w-full",children:[v&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:v}),i.jsx("button",{type:"button",onClick:()=>j(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),i.jsxs(ne,{onClick:q,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),i.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:fc},{key:"orders",label:"订单管理",icon:Ju},{key:"bindings",label:"绑定管理",icon:Ss},{key:"withdrawals",label:"提现审核",icon:Xo},{key:"settings",label:"推广设置",icon:_a}].map(V=>i.jsxs("button",{type:"button",onClick:()=>{e(V.key),C("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===V.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[i.jsx(V.icon,{className:"w-4 h-4"}),V.label]},V.key))}),g?i.jsxs("div",{className:"flex items-center justify-center py-20",children:[i.jsx(qe,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[t==="overview"&&s&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayClicks}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:i.jsx(yg,{className:"w-6 h-6 text-blue-400"})})]})})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayUniqueVisitors??0}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:i.jsx(Ln,{className:"w-6 h-6 text-cyan-400"})})]})})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(s.todayClickRate??0).toFixed(2)}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:i.jsx(fc,{className:"w-6 h-6 text-amber-400"})})]})})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayBindings})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:i.jsx(Ss,{className:"w-6 h-6 text-green-400"})})]})})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayConversions})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:i.jsx(Rb,{className:"w-6 h-6 text-purple-400"})})]})})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),i.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",s.todayEarnings.toFixed(2)]})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:i.jsx(Ju,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((ye=s.todayClicksByPage)==null?void 0:ye.length)??0)>0&&i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(yg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),i.jsx(Re,{children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[i.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),i.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),i.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),i.jsx("tbody",{children:[...s.todayClicksByPage??[]].sort((V,ge)=>ge.clicks-V.clicks).map((V,ge)=>i.jsxs("tr",{className:"border-b border-gray-700/50",children:[i.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:V.page||"(未区分)"}),i.jsx("td",{className:"py-2 pr-4 text-right text-white",children:V.clicks}),i.jsxs("td",{className:"py-2 text-right text-gray-400",children:[s.todayClicks>0?(V.clicks/s.todayClicks*100).toFixed(1):0,"%"]})]},ge))})]})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Ae,{className:"bg-orange-500/10 border-orange-500/30",children:i.jsx(Re,{className:"p-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:i.jsx(xg,{className:"w-6 h-6 text-orange-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),i.jsxs("p",{className:"text-2xl font-bold text-white",children:[s.expiringBindings," 个"]}),i.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),i.jsx(Ae,{className:"bg-blue-500/10 border-blue-500/30",children:i.jsx(Re,{className:"p-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:i.jsx(Xo,{className:"w-6 h-6 text-blue-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),i.jsxs("p",{className:"text-2xl font-bold text-white",children:[s.pendingWithdrawals," 笔"]}),i.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",s.pendingWithdrawAmount.toFixed(2)]})]}),i.jsx(ne,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(Xe,{children:i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Gu,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),i.jsx(Re,{children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthClicks})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthBindings})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthConversions})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),i.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",s.monthEarnings.toFixed(2)]})]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(Xe,{children:i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(fc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),i.jsxs(Re,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalClicks.toLocaleString()})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalBindings.toLocaleString()})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalConversions})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),i.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",s.totalEarnings.toFixed(2)]})]})]}),i.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[i.jsx("span",{className:"text-gray-300",children:"点击转化率"}),i.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[s.conversionRate,"%"]})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(Xe,{children:i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),i.jsx(Re,{children:i.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-white",children:s.totalDistributors}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-green-400",children:s.activeDistributors}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:V=>k(V.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:V=>C(V.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"pending",children:"待支付"}),i.jsx("option",{value:"failed",children:"已失败"}),i.jsx("option",{value:"refunded",children:"已退款"})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Re,{className:"p-0",children:[n.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Q.map(V=>{var ge,Me;return i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(ge=V.id)==null?void 0:ge.slice(0,12),"..."]}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:V.userNickname}),i.jsx("p",{className:"text-gray-500 text-xs",children:V.userPhone})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:(()=>{const tt=V.productType||V.type;return tt==="fullbook"?`${V.bookName||"《底层逻辑》"} - 全本`:tt==="match"?"匹配次数购买":`${V.bookName||"《底层逻辑》"} - ${V.sectionTitle||V.chapterTitle||`章节${V.productId||V.sectionId||""}`}`})()}),i.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const tt=V.productType||V.type;return tt==="fullbook"?"全书解锁":tt==="match"?"功能权益":V.chapterTitle||"单章购买"})()})]})}),i.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof V.amount=="number"?V.amount.toFixed(2):parseFloat(String(V.amount||"0")).toFixed(2)]}),i.jsx("td",{className:"p-4 text-gray-300",children:V.paymentMethod==="wechat"?"微信支付":V.paymentMethod==="alipay"?"支付宝":V.paymentMethod||"微信支付"}),i.jsx("td",{className:"p-4",children:V.status==="refunded"?i.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):V.status==="completed"||V.status==="paid"?i.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):V.status==="pending"||V.status==="created"?i.jsx(Be,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):i.jsx(Be,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),i.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:V.refundReason,children:V.status==="refunded"&&V.refundReason?V.refundReason:"-"}),i.jsx("td",{className:"p-4 text-gray-300 text-sm",children:V.referrerId||V.referralCode?i.jsxs("span",{title:V.referralCode||V.referrerCode||V.referrerId||"",children:[V.referrerNickname||V.referralCode||V.referrerCode||((Me=V.referrerId)==null?void 0:Me.slice(0,8)),(V.referralCode||V.referrerCode)&&` (${V.referralCode||V.referrerCode})`]}):"-"}),i.jsx("td",{className:"p-4 text-[#FFD700]",children:V.referrerEarnings?`¥${(typeof V.referrerEarnings=="number"?V.referrerEarnings:parseFloat(String(V.referrerEarnings))).toFixed(2)}`:"-"}),i.jsx("td",{className:"p-4 text-gray-400 text-sm",children:V.createdAt?new Date(V.createdAt).toLocaleString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:(V.status==="paid"||V.status==="completed")&&i.jsxs(ne,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(V),D("")},children:[i.jsx(VN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},V.id)})})]})}),t==="orders"&&i.jsx(ls,{page:T,totalPages:fe,total:P,pageSize:B,onPageChange:O,onPageSizeChange:V=>{R(V),O(1)}})]})})]}),t==="bindings"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:V=>k(V.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:V=>C(V.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"active",children:"有效"}),i.jsx("option",{value:"converted",children:"已转化"}),i.jsx("option",{value:"expired",children:"已过期"})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Re,{className:"p-0",children:[oe.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:oe.map(V=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-medium",children:V.refereeNickname||"匿名用户"}),i.jsx("p",{className:"text-gray-500 text-xs",children:V.refereePhone})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:V.referrerName||"-"}),i.jsx("p",{className:"text-gray-500 text-xs font-mono",children:V.referrerCode})]})}),i.jsx("td",{className:"p-4 text-gray-400",children:V.boundAt?new Date(V.boundAt).toLocaleDateString("zh-CN"):"-"}),i.jsx("td",{className:"p-4 text-gray-400",children:V.expiresAt?new Date(V.expiresAt).toLocaleDateString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:K(V.status)}),i.jsx("td",{className:"p-4",children:V.commission?i.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",V.commission.toFixed(2)]}):i.jsx("span",{className:"text-gray-500",children:"-"})})]},V.id))})]})}),t==="bindings"&&i.jsx(ls,{page:T,totalPages:fe,total:P,pageSize:B,onPageChange:O,onPageSizeChange:V=>{R(V),O(1)}})]})})]}),t==="withdrawals"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ui,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:V=>k(V.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:V=>C(V.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"pending",children:"待审核"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Re,{className:"p-0",children:[ue.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ue.map(V=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[V.userAvatar?i.jsx("img",{src:V.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):i.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(V.userName||V.name||"?").slice(0,1)}),i.jsx("p",{className:"text-white font-medium",children:V.userName||V.name})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",V.amount.toFixed(2)]})}),i.jsx("td",{className:"p-4",children:i.jsx(Be,{className:V.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:V.method==="wechat"?"微信":"支付宝"})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-mono text-xs",children:V.account}),i.jsx("p",{className:"text-gray-500 text-xs",children:V.name})]})}),i.jsx("td",{className:"p-4 text-gray-400",children:V.createdAt?new Date(V.createdAt).toLocaleString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:K(V.status)}),i.jsx("td",{className:"p-4 text-right",children:V.status==="pending"&&i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsxs(ne,{size:"sm",onClick:()=>z(V.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Rb,{className:"w-4 h-4 mr-1"}),"通过"]}),i.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>H(V.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[i.jsx(_N,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},V.id))})]})}),t==="withdrawals"&&i.jsx(ls,{page:T,totalPages:fe,total:P,pageSize:B,onPageChange:O,onPageSizeChange:V=>{R(V),O(1)}})]})})]})]}),i.jsx(Zt,{open:!!Z,onOpenChange:V=>!V&&Y(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:"订单退款"})}),Z&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",Z.orderSn||Z.id]}),i.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof Z.amount=="number"?Z.amount.toFixed(2):parseFloat(String(Z.amount||"0")).toFixed(2)]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),i.jsx("div",{className:"form-input",children:i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:W,onChange:V=>D(V.target.value)})})]}),i.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:$,children:"取消"}),i.jsx(ne,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:de,disabled:$,children:$?"退款中...":"确认退款"})]})]})}),t==="settings"&&i.jsx("div",{className:"-mx-8 -mt-6",children:i.jsx(jk,{embedded:!0})})]})}function TI(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[s,a]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,j]=b.useState(0),[w,k]=b.useState(null);async function E(){var R,P,I,L,X,Z,Y;a(!0),c(null);try{const W=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),D=await Fe(`/api/admin/withdrawals?${W}`);if(D!=null&&D.success){const $=D.withdrawals||[];e($),j(D.total??((R=D.stats)==null?void 0:R.total)??$.length),r({total:((P=D.stats)==null?void 0:P.total)??D.total??$.length,pendingCount:((I=D.stats)==null?void 0:I.pendingCount)??0,pendingAmount:((L=D.stats)==null?void 0:L.pendingAmount)??0,successCount:((X=D.stats)==null?void 0:X.successCount)??0,successAmount:((Z=D.stats)==null?void 0:Z.successAmount)??0,failedCount:((Y=D.stats)==null?void 0:Y.failedCount)??0})}else c("加载提现记录失败")}catch(W){console.error("Load withdrawals error:",W),c("加载失败,请检查网络后重试")}finally{a(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{E()},[u,f,g]);const C=Math.ceil(v/g)||1;async function T(R){const P=t.find(I=>I.id===R);if(P!=null&&P.userCommissionInfo&&P.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${P.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 + +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const I=await _t("/api/admin/withdrawals",{id:R,action:"approve"});I!=null&&I.success?E():he.error("操作失败: "+((I==null?void 0:I.error)??""))}catch{he.error("操作失败")}finally{k(null)}}async function O(R){const P=prompt("请输入拒绝原因(将返还用户余额):");if(P){k(R);try{const I=await _t("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:P});I!=null&&I.success?E():he.error("操作失败: "+((I==null?void 0:I.error)??""))}catch{he.error("操作失败")}finally{k(null)}}}function B(R){switch(R){case"pending":return i.jsx(Be,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return i.jsx(Be,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return i.jsx(Be,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return i.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return i.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return i.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return i.jsxs("div",{className:"p-8 w-full",children:[o&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:o}),i.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-start mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),i.jsxs(ne,{variant:"outline",onClick:E,disabled:s,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})]}),i.jsx(Ae,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:i.jsx(Re,{className:"p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Ju,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),i.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",i.jsx("span",{className:"text-white font-medium",children:"90%"})]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),i.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Re,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),i.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Re,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),i.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Re,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),i.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Re,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),i.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>i.jsx(ne,{variant:u===R?"default":"outline",size:"sm",onClick:()=>h(R),className:u===R?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:R==="all"?"全部":R==="pending"?"待处理":R==="success"?"已完成":"已拒绝"},R))}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:s?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?i.jsxs("div",{className:"text-center py-12",children:[i.jsx(Xo,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),i.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),i.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?i.jsx("img",{src:R.userAvatar,alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(R.userName??"?").charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),i.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),i.jsx("td",{className:"p-4",children:R.userCommissionInfo?i.jsxs("div",{className:"text-xs space-y-1",children:[i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),i.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"已提现:"}),i.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"待审核:"}),i.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[i.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),i.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):i.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),i.jsxs("td",{className:"p-4",children:[B(R.status),R.errorMessage&&i.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),i.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),i.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?i.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),i.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsxs(ne,{size:"sm",onClick:()=>T(R.id),disabled:w===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[i.jsx(Uc,{className:"w-4 h-4 mr-1"}),"批准"]}),i.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>O(R.id),disabled:w===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[i.jsx(Wn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&i.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),i.jsx(ls,{page:f,totalPages:C,total:v,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})})]})}var Mm={exports:{}},Am={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var t1;function MI(){if(t1)return Am;t1=1;var t=Hc();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),j=v[0].inst,w=v[1];return a(function(){j.value=y,j.getSnapshot=g,u(j)&&w({inst:j})},[m,y,g]),s(function(){return u(j)&&w({inst:j}),m(function(){u(j)&&w({inst:j})})},[m]),o(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Am.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Am}var n1;function kk(){return n1||(n1=1,Mm.exports=MI()),Mm.exports}var Sk=kk();function Pn(t){this.content=t}Pn.prototype={constructor:Pn,find:function(t){for(var e=0;e>1}};Pn.from=function(t){if(t instanceof Pn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Pn(e)};function Ck(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),a=e.child(r);if(s==a){n+=s.nodeSize;continue}if(!s.sameMarkup(a))return n;if(s.isText&&s.text!=a.text){for(let o=0;s.text[o]==a.text[o];o++)n++;return n}if(s.content.size||a.content.size){let o=Ck(s.content,a.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function Ek(t,e,n,r){for(let s=t.childCount,a=e.childCount;;){if(s==0||a==0)return s==a?null:{a:n,b:r};let o=t.child(--s),c=e.child(--a),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,s+c,a||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,s+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let a="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?s?typeof s=="function"?s(c):s:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:a+=r),a+=h},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),a=1);ae)for(let a=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),s+=c.nodeSize),o=u}return new me(r,s)}cutByIndex(e,n){return e==n?me.empty:e==0&&n==this.content.length?this:new me(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new me(s,a)}addToStart(e){return new me([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new me(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),a=r+s.nodeSize;if(a>=e)return a==e?bu(n+1,a):bu(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return me.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new me(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return me.empty;let n,r=0;for(let s=0;sthis.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-s.type.rank),n}};Ct.none=[];class nh extends Error{}class Pe{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Mk(this.content,e+this.openStart,n);return r&&new Pe(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Pe(Tk(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Pe.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Pe(me.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)s++;return new Pe(e,r,s)}}Pe.empty=new Pe(me.empty,0,0);function Tk(t,e,n){let{index:r,offset:s}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(s==e||a.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(Tk(a.content,e-s-1,n-s-1)))}function Mk(t,e,n,r){let{index:s,offset:a}=t.findIndex(e),o=t.maybeChild(s);if(a==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Mk(o.content,e-a-1,n,o);return c&&t.replaceChild(s,o.copy(c))}function AI(t,e,n){if(n.openStart>t.depth)throw new nh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new nh("Inconsistent open depths");return Ak(t,e,n,0)}function Ak(t,e,n,r){let s=t.index(r),a=t.node(r);if(s==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function pc(t,e,n,r){let s=(e||t).node(n),a=0,o=e?e.index(n):s.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(za(t.nodeAfter,r),a++));for(let c=a;cs&&Rg(t,e,s+1),o=r.depth>s&&Rg(n,r,s+1),c=[];return pc(null,t,s,c),a&&o&&e.index(s)==n.index(s)?(Rk(a,o),za($a(a,Pk(t,e,n,r,s+1)),c)):(a&&za($a(a,rh(t,e,s+1)),c),pc(e,n,s,c),o&&za($a(o,rh(n,r,s+1)),c)),pc(r,null,s,c),new me(c)}function rh(t,e,n){let r=[];if(pc(null,t,n,r),t.depth>n){let s=Rg(t,e,n+1);za($a(s,rh(t,e,n+1)),r)}return pc(e,null,n,r),new me(r)}function RI(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)s=e.node(a).copy(me.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Ac{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let a=0;a0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new sh(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,a=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(a),h=a-u;if(r.push(o,c,s+u),!h||(o=o.child(c),o.isText))break;a=h-1,s+=u+1}return new Ac(n,r,a)}static resolveCached(e,n){let r=r1.get(e);if(r)for(let a=0;ae&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ik(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=me.empty,s=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,a),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=s;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=me.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,s,r);return a.type.checkAttrs(a.attrs),a}};Xs.prototype.text=void 0;class ih extends Xs{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ik(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ih(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ih(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ik(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ka{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new DI(e,n);if(r.next==null)return Ka.empty;let s=Ok(r);r.next&&r.err("Unexpected trailing text");let a=VI(BI(s));return HI(a,r),a}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s{let a=s+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return a}).join(` +`)}}Ka.empty=new Ka(!0);class DI{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Ok(t){let e=[];do e.push(LI(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function LI(t){let e=[];do e.push(_I(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function _I(t){let e=FI(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=zI(t,e);else break;return e}function s1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function zI(t,e){let n=s1(t),r=n;return t.eat(",")&&(t.next!="}"?r=s1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function $I(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let a in n){let o=n[a];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function FI(t){if(t.eat("(")){let e=Ok(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=$I(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function BI(t){let e=[[]];return s(a(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function s(o,c){o.forEach(u=>u.to=c)}function a(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(a(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=a(o.exprs[u],c);if(u==o.exprs.length-1)return h;s(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),s(a(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return s(a(o.expr,c),u),s(a(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(a(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||s.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let a=e[r.join(",")]=new Ka(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:_k(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Xs(this,this.computeAttrs(e),me.from(n),Ct.setFrom(r))}createChecked(e=null,n,r){return n=me.from(n),this.checkContent(n),new Xs(this,this.computeAttrs(e),n,Ct.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=me.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),a=s&&s.fillBefore(me.empty,!0);return a?new Xs(this,e,n.append(a),Ct.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[a]=new Fk(a,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function WI(t,e,n){let r=n.split("|");return s=>{let a=s===null?"null":typeof s;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class UI{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?WI(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class sf{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=$k(e,s.attrs),this.excluded=null;let a=Lk(this.attrs);this.instance=a?new Ct(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Ct(this,_k(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((a,o)=>r[a]=new sf(a,s++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class Bk{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Pn.from(e.nodes),n.marks=Pn.from(e.marks||{}),this.nodes=a1.compile(this.spec.nodes,this),this.marks=sf.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let a=this.nodes[s],o=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=Ka.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=c=="_"?null:c?o1(this,c.split(" ")):c==""||!a.inlineContent?[]:null}for(let s in this.marks){let a=this.marks[s],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:o1(this,o.split(" "))}this.nodeFromJSON=s=>Xs.fromJSON(this,s),this.markFromJSON=s=>Ct.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof a1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new ih(r,r.defaultAttrs,e,Ct.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function o1(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function KI(t){return t.tag!=null}function qI(t){return t.style!=null}class qi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(KI(s))this.tags.push(s);else if(qI(s)){let a=/[^=]*/.exec(s.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let a=e.nodes[s.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new c1(this,n,!1);return r.addAll(e,Ct.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new c1(this,n,!0);return r.addAll(e,Ct.none,n.from,n.to),Pe.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;se.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let a=s.priority==null?50:s.priority,o=0;for(;o{r(o=d1(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let a=e.nodes[s].spec.parseDOM;a&&a.forEach(o=>{r(o=d1(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new qi(e,qi.schemaRules(e)))}}const Vk={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},GI={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hk={ol:!0,ul:!0},Rc=1,Ig=2,mc=4;function l1(t,e,n){return e!=null?(e?Rc:0)|(e==="full"?Ig:0):t&&t.whitespace=="pre"?Rc|Ig:n&~mc}class wu{constructor(e,n,r,s,a,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Ct.none,this.match=a||(o&mc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(me.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Rc)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-s[0].length))}}let n=me.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(me.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class c1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,a,o=l1(null,n.preserveWhitespace,0)|(r?mc:0);s?a=new wu(s.type,s.attrs,Ct.none,!0,n.topMatch||s.type.contentMatch,o):r?a=new wu(null,null,Ct.none,!0,null,o):a=new wu(e.schema.topNodeType,null,Ct.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,a=s.options&Ig?"full":this.localPreserveWS||(s.options&Rc)>0,{schema:o}=this.parser;if(a==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,` +`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,s){let a,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(a=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}a&&this.sync(c)&&this.open--}addAll(e,n,r,s){let a=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=s==null?null:e.childNodes[s];o!=c;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,n);this.findAtPoint(e,a)}findPlace(e,n,r){let s,a;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!s||s.length>h.length+c)&&(s=h,a=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!s)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):u1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new wu(e,n,u,s,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Rc)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(s?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=a;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&s?this.nodes[u].type:r&&u>=a?r.node(u-a).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function JI(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function YI(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function d1(t){let e={};for(let n in t)e[n]=t[n];return e}function u1(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let a=[],o=c=>{a.push(c);for(let u=0;u{if(a.length||o.marks.length){let c=0,u=0;for(;c=0;s--){let a=this.serializeMark(e.marks[s],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&$u(Pm(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return $u(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new no(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=h1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return h1(e.marks)}}function h1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Pm(t){return t.document||window.document}const f1=new WeakMap;function QI(t){let e=f1.get(t);return e===void 0&&f1.set(t,e=XI(t)),e}function XI(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let c,u=n?t.createElementNS(n,s):t.createElement(s),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:v}=$u(t,g,n,r);if(u.appendChild(y),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const Wk=65535,Uk=Math.pow(2,16);function ZI(t,e){return t+e*Uk}function p1(t){return t&Wk}function eO(t){return(t-(t&Wk))/Uk}const Kk=1,qk=2,Fu=4,Gk=8;class Og{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Gk)>0}get deletedBefore(){return(this.delInfo&(Kk|Fu))>0}get deletedAfter(){return(this.delInfo&(qk|Fu))>0}get deletedAcross(){return(this.delInfo&Fu)>0}}class jr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&jr.empty)return jr.empty}recover(e){let n=0,r=p1(e);if(!this.inverted)for(let s=0;se)break;let h=this.ranges[c+a],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+s+(g<0?0:f);if(r)return y;let v=e==(n<0?u:m)?null:ZI(c/3,e-u),j=e==u?qk:e==m?Kk:Fu;return(n<0?e!=u:e!=m)&&(j|=Gk),new Og(y,j,v)}s+=f-h}return r?e+s:new Og(e+s,0,null)}touches(e,n){let r=0,s=p1(n),a=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+a],f=u+h;if(e<=f&&c==s*3)return!0;r+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,a=0;s=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Pc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ra&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return cn.fromReplace(e,this.from,this.to,a)}invert(){return new as(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Bi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Bi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Bi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Bi(n.from,n.to,e.markFromJSON(n.mark))}}Gn.jsonID("addMark",Bi);class as extends Gn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Pe(Kx(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return cn.fromReplace(e,this.from,this.to,r)}invert(){return new Bi(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new as(n.pos,r.pos,this.mark)}merge(e){return e instanceof as&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new as(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new as(n.from,n.to,e.markFromJSON(n.mark))}}Gn.jsonID("removeMark",as);class Vi extends Gn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return cn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return cn.fromReplace(e,this.pos,this.pos+1,new Pe(me.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;sr.pos?null:new kn(n.pos,r.pos,s,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new kn(n.from,n.to,n.gapFrom,n.gapTo,Pe.fromJSON(e,n.slice),n.insert,!!n.structure)}}Gn.jsonID("replaceAround",kn);function Dg(t,e,n){let r=t.resolve(e),s=n-e,a=r.depth;for(;s>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,s--;if(s>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function tO(t,e,n,r){let s=[],a=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),y=Math.min(h+u.nodeSize,n),v=r.addToSet(m);for(let j=0;jt.step(u)),a.forEach(u=>t.step(u))}function nO(t,e,n,r){let s=[],a=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;a++;let u=null;if(r instanceof sf){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new as(o.from,o.to,o.style)))}function qx(t,e,n,r=n.contentMatch,s=!0){let a=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function rO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function fl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,a=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+s,u=t.$to.indexAfter(r)-a;if(rn;v--)j||r.index(v)>0?(j=!0,f=me.from(r.node(v).copy(f)),m++):u--;let g=me.empty,y=0;for(let v=a,j=!1;v>n;v--)j||s.after(v+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=me.from(n[o].type.create(n[o].attrs,r))}let s=e.start,a=e.end;t.step(new kn(s,a,s,a,new Pe(r,0,0),n.length,!0))}function lO(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,u)&&cO(t.doc,t.mapping.slice(a).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!v?h=!1:!y&&v&&(h=!0)}h===!1&&Yk(t,o,c,a),qx(t,t.mapping.slice(a).map(c,1),r,void 0,h===null);let f=t.mapping.slice(a),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new kn(m,g,m+1,g-1,new Pe(me.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&Jk(t,o,c,a),!1}})}function Jk(t,e,n,r){e.forEach((s,a)=>{if(s.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(s.text);){let u=t.mapping.slice(r).map(n+1+a+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function Yk(t,e,n,r){e.forEach((s,a)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+a);t.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function cO(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function dO(t,e,n,r,s){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let o=n.create(r,null,s||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,o);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new kn(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new Pe(me.from(o),0,0),1,!0))}function Zs(t,e,n=1,r){let s=t.resolve(e),a=s.depth-n,o=r&&r[r.length-1]||s.parent;if(a<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let h=s.depth-1,f=n-2;h>a;h--,f--){let m=s.node(h),g=s.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),v=r&&r[f+1];v&&(y=y.replaceChild(0,v.type.create(v.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(y))return!1}let c=s.indexAfter(a),u=r&&r[0];return s.node(a).canReplaceWith(c,c,u?u.type:s.node(a+1).type)}function uO(t,e,n=1,r){let s=t.doc.resolve(e),a=me.empty,o=me.empty;for(let c=s.depth,u=s.depth-n,h=n-1;c>u;c--,h--){a=me.from(s.node(c).copy(a));let f=r&&r[h];o=me.from(f?f.type.create(f.attrs,o):s.node(c).copy(o))}t.step(new jn(e,e,new Pe(a.append(o),n,n),!0))}function aa(t,e){let n=t.resolve(e),r=n.index();return Qk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function hO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s0?(a=r.node(s+1),c++,o=r.node(s).maybeChild(c)):(a=r.node(s).maybeChild(c-1),o=r.node(s+1)),a&&!a.isTextblock&&Qk(a,o)&&r.node(s).canReplace(c,c+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function fO(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,a=t.doc.resolve(e-n),o=a.node().type;if(s&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(s);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);Yk(t,f.node(),f.before(),c)}o.inlineContent&&qx(t,e+n-1,o,a.node().contentMatchAt(a.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new jn(h,u.map(e+n,-1),Pe.empty,!0)),r===!0){let f=t.doc.resolve(h);Jk(t,f.node(),f.before(),t.steps.length)}return t}function pO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let a=r.index(s);if(r.node(s).canReplaceWith(a,a,n))return r.before(s+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>0?1:0),h=r.node(o),f=!1;if(a==1)f=h.canReplace(u,u,s);else{let m=h.contentMatchAt(u).findWrapping(s.firstChild.type);f=m&&h.canReplaceWith(u,u,m[0])}if(f)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function of(t,e,n=e,r=Pe.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),a=t.resolve(n);return Zk(s,a,r)?new jn(e,n,r):new mO(s,a,r).fit()}function Zk(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class mO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=me.empty;for(let s=0;s<=e.depth;s++){let a=e.node(s);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=me.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let a=this.placed,o=r.depth,c=s.depth;for(;o&&c&&a.childCount==1;)a=a.firstChild.content,o--,c--;let u=new Pe(a,o,c);return e>-1?new kn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new jn(r.pos,s.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r1&&(s=0),a.type.spec.isolating&&s<=r){e=r;break}n=a.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,a=null;r?(a=Om(this.unplaced.content,r-1).firstChild,s=a.content):s=this.unplaced.content;let o=s.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(me.from(o),!1)):a&&u.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:c,parent:a,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:a,wrap:f};if(a&&h.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Om(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new Pe(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Om(e,n);if(s.childCount<=1&&n>0){let a=e.size-n<=n+s.size;this.unplaced=new Pe(ac(e,n-1,1),n-1,a?n-1:r)}else this.unplaced=new Pe(ac(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let j=0;j1||u==0||j.content.size)&&(m=w,f.push(eS(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?y:-1)))}let v=h==c.childCount;v||(y=-1),this.placed=oc(this.placed,n,me.from(f)),this.frontier[n].match=m,v&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,w=c;j1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],a=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Dm(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=oc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),a=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,a)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=oc(this.placed,this.depth,me.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(me.empty,!0);n.childCount&&(this.placed=oc(this.placed,this.frontier.length,n))}}function ac(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ac(t.firstChild.content,e-1,n)))}function oc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(oc(t.lastChild.content,e-1,n)))}function Om(t,e){for(let n=0;n1&&(r=r.replaceChild(0,eS(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(me.empty,!0)))),t.copy(r)}function Dm(t,e,n,r,s){let a=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let c=r.fillBefore(a.content,!0,o);return c&&!gO(n,a.content,o)?c:null}function gO(t,e,n){for(let r=n;r0;g--,y--){let v=s.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(g)>-1?c=g:s.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,y=0;;y++){let v=g.firstChild;if(h.push(v),y==r.openStart)break;g=v.content}for(let g=f-1;g>=0;g--){let y=h[g],v=xO(y.type);if(v&&!y.sameMarkup(s.node(Math.abs(c)-1)))f=g;else if(v||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),v=h[y];if(v)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=s.before(y),n=a.after(y))}}function tS(t,e,n,r,s){if(er){let a=s.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(me.empty,!0))}return t}function vO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=pO(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new Pe(me.from(r),0,0))}function bO(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),a=nS(r,s);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),s.indexAfter(c-1))))return t.delete(r.before(c),s.after(c))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function nS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let a=t.start(s);if(ae.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(a==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==a-1)&&n.push(s)}return n}class Jo extends Gn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return cn.fail("No node at attribute step's position");let r=Object.create(null);for(let a in n.attrs)r[a]=n.attrs[a];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return cn.fromReplace(e,this.pos,this.pos+1,new Pe(me.from(s),0,n.isLeaf?0:1))}getMap(){return jr.empty}invert(e){return new Jo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Jo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Jo(n.pos,n.attr,n.value)}}Gn.jsonID("attr",Jo);class Ic extends Gn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return cn.ok(r)}getMap(){return jr.empty}invert(e){return new Ic(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ic(n.attr,n.value)}}Gn.jsonID("docAttr",Ic);let Zo=class extends Error{};Zo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Zo.prototype=Object.create(Error.prototype);Zo.prototype.constructor=Zo;Zo.prototype.name="TransformError";class Jx{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Pc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Zo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Pe.empty){let s=of(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new Pe(me.from(r),0,0))}delete(e,n){return this.replace(e,n,Pe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return yO(this,e,n,r),this}replaceRangeWith(e,n,r){return vO(this,e,n,r),this}deleteRange(e,n){return bO(this,e,n),this}lift(e,n){return sO(this,e,n),this}join(e,n=1){return fO(this,e,n),this}wrap(e,n){return oO(this,e,n),this}setBlockType(e,n=e,r,s=null){return lO(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return dO(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Jo(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ic(e,n)),this}addNodeMark(e,n){return this.step(new Vi(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Ct)n.isInSet(r.marks)&&this.step(new qa(e,n));else{let s=r.marks,a,o=[];for(;a=n.isInSet(s);)o.push(new qa(e,a)),s=a.removeFromSet(s);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return uO(this,e,n,r),this}addMark(e,n,r){return tO(this,e,n,r),this}removeMark(e,n,r){return nO(this,e,n,r),this}clearIncompatible(e,n,r){return qx(this,e,n,r),this}}const Lm=Object.create(null);class Je{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new rS(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;a--){let o=n<0?zo(e.node(0),e.node(a),e.before(a+1),e.index(a),n,r):zo(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Sr(e.node(0))}static atStart(e){return zo(e,e,0,0,1)||new Sr(e)}static atEnd(e){return zo(e,e,e.content.size,e.childCount,-1)||new Sr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Lm[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Lm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Lm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return We.between(this.$anchor,this.$head).getBookmark()}}Je.prototype.visible=!0;class rS{constructor(e,n){this.$from=e,this.$to=n}}let g1=!1;function x1(t){!g1&&!t.parent.inlineContent&&(g1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class We extends Je{constructor(e,n=e){x1(e),x1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Je.near(r);let s=e.resolve(n.map(this.anchor));return new We(s.parent.inlineContent?s:r,r)}replace(e,n=Pe.empty){if(super.replace(e,n),n==Pe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof We&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new lf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new We(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let a=Je.findFrom(n,r,!0)||Je.findFrom(n,-r,!0);if(a)n=a.$head;else return Je.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Je.findFrom(e,-r,!0)||Je.findFrom(e,r,!0)).$anchor,e.pos0?0:1);s>0?o=0;o+=s){let c=e.child(o);if(c.isAtom){if(!a&&He.isSelectable(c))return He.create(t,n-(s<0?c.nodeSize:0))}else{let u=zo(t,c,n+s,s<0?c.childCount:0,s,a);if(u)return u}n+=c.nodeSize*s}return null}function y1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(Je.near(t.doc.resolve(o),n))}const v1=1,Nu=2,b1=4;class NO extends Jx{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Nu,this}ensureMarks(e){return Ct.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Nu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Nu,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ct.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let a=this.storedMarks;if(!a){let o=this.doc.resolve(n);a=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Je.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=b1,this}get scrolledIntoView(){return(this.updated&b1)>0}}function w1(t,e){return!e||!t?t:t.bind(e)}class lc{constructor(e,n,r){this.name=e,this.init=w1(n.init,r),this.apply=w1(n.apply,r)}}const jO=[new lc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new lc("selection",{init(t,e){return t.selection||Je.atStart(e.doc)},apply(t){return t.selection}}),new lc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new lc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class _m{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=jO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new lc(r.key,r.spec.state,r))})}}class Ko{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],a=s.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new _m(e.schema,e.plugins),a=new Ko(s);return s.fields.forEach(o=>{if(o.name=="doc")a.doc=Xs.fromJSON(e.schema,n.doc);else if(o.name=="selection")a.selection=Je.fromJSON(a.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){a[o.name]=h.fromJSON.call(u,e,n[c],a);return}}a[o.name]=o.init(e,a)}}),a}}function sS(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=sS(s,e,{})),n[r]=s}return n}class Pt{constructor(e){this.spec=e,this.props={},e.props&&sS(e.props,this,this.props),this.key=e.key?e.key.key:iS("plugin")}getState(e){return e[this.key]}}const zm=Object.create(null);function iS(t){return t in zm?t+"$"+ ++zm[t]:(zm[t]=0,t+"$")}class Bt{constructor(e="key"){this.key=iS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Qx=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function aS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const oS=(t,e,n)=>{let r=aS(t,n);if(!r)return!1;let s=Xx(r);if(!s){let o=r.blockRange(),c=o&&fl(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let a=s.nodeBefore;if(gS(t,s,e,-1))return!0;if(r.parent.content.size==0&&(el(a,"end")||He.isSelectable(a)))for(let o=r.depth;;o--){let c=of(t.doc,r.before(o),r.after(o),Pe.empty);if(c&&c.slice.size1)break}return a.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-a.nodeSize,s.pos).scrollIntoView()),!0):!1},kO=(t,e,n)=>{let r=aS(t,n);if(!r)return!1;let s=Xx(r);return s?lS(t,s,e):!1},SO=(t,e,n)=>{let r=dS(t,n);if(!r)return!1;let s=Zx(r);return s?lS(t,s,e):!1};function lS(t,e,n){let r=e.nodeBefore,s=r,a=e.pos-1;for(;!s.isTextblock;a--){if(s.type.spec.isolating)return!1;let f=s.lastChild;if(!f)return!1;s=f}let o=e.nodeAfter,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let f=c.firstChild;if(!f)return!1;c=f}let h=of(t.doc,a,u,Pe.empty);if(!h||h.from!=a||h instanceof jn&&h.slice.size>=u-a)return!1;if(n){let f=t.tr.step(h);f.setSelection(We.create(f.doc,a)),n(f.scrollIntoView())}return!0}function el(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const cS=(t,e,n)=>{let{$head:r,empty:s}=t.selection,a=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=Xx(r)}let o=a&&a.nodeBefore;return!o||!He.isSelectable(o)?!1:(e&&e(t.tr.setSelection(He.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Xx(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function dS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=dS(t,n);if(!r)return!1;let s=Zx(r);if(!s)return!1;let a=s.nodeAfter;if(gS(t,s,e,1))return!0;if(r.parent.content.size==0&&(el(a,"start")||He.isSelectable(a))){let o=of(t.doc,r.before(),r.after(),Pe.empty);if(o&&o.slice.size{let{$head:r,empty:s}=t.selection,a=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof He,s;if(r){if(n.node.isTextblock||!aa(t.doc,n.from))return!1;s=n.from}else if(s=af(t.doc,n.from,-1),s==null)return!1;if(e){let a=t.tr.join(s);r&&a.setSelection(He.create(a.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},EO=(t,e)=>{let n=t.selection,r;if(n instanceof He){if(n.node.isTextblock||!aa(t.doc,n.to))return!1;r=n.to}else if(r=af(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},TO=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),a=s&&fl(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)},fS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` +`).scrollIntoView()),!0)};function e0(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),a=n.indexAfter(-1),o=e0(s.contentMatchAt(a));if(!o||!s.canReplaceWith(a,a,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(Je.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},pS=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Sr||r.parent.inlineContent||s.parent.inlineContent)return!1;let a=e0(s.parent.contentMatchAt(s.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(Zs(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),s=r&&fl(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function AO(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof He&&e.selection.node.isBlock)return!r.parentOffset||!Zs(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=e0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),a.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;a.unshift(null)}let f=e.tr;(e.selection instanceof We||e.selection instanceof Sr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Zs(f.doc,m,a.length,a);if(g||(a[0]=c?{type:c}:null,g=Zs(f.doc,m,a.length,a)),!g)return!1;if(f.split(m,a.length,a),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),v=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const RO=AO(),PO=(t,e)=>{let{$from:n,to:r}=t.selection,s,a=n.sharedDepth(r);return a==0?!1:(s=n.before(a),e&&e(t.tr.setSelection(He.create(t.doc,s))),!0)};function IO(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,a=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(a-1,a)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(s.isTextblock||aa(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function gS(t,e,n,r){let s=e.nodeBefore,a=e.nodeAfter,o,c,u=s.type.spec.isolating||a.type.spec.isolating;if(!u&&IO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&c.matchType(o[0]||a.type).validEnd){if(n){let y=e.pos+a.nodeSize,v=me.empty;for(let k=o.length-1;k>=0;k--)v=me.from(o[k].create(null,v));v=me.from(s.copy(v));let j=t.tr.step(new kn(e.pos-1,y,e.pos,y,new Pe(v,1,0),o.length,!0)),w=j.doc.resolve(y+2*o.length);w.nodeAfter&&w.nodeAfter.type==s.type&&aa(j.doc,w.pos)&&j.join(w.pos),n(j.scrollIntoView())}return!0}let f=a.type.spec.isolating||r>0&&u?null:Je.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&fl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&el(a,"start",!0)&&el(s,"end")){let y=s,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let j=a,w=1;for(;!j.isTextblock;j=j.firstChild)w++;if(y.canReplace(y.childCount,y.childCount,j.content)){if(n){let k=me.empty;for(let C=v.length-1;C>=0;C--)k=me.from(v[C].copy(k));let E=t.tr.step(new kn(e.pos-v.length,e.pos+a.nodeSize,e.pos+w,e.pos+a.nodeSize-w,new Pe(k,v.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function xS(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,a=s.depth;for(;s.node(a).isInline;){if(!a)return!1;a--}return s.node(a).isTextblock?(n&&n(e.tr.setSelection(We.create(e.doc,t<0?s.start(a):s.end(a)))),!0):!1}}const OO=xS(-1),DO=xS(1);function LO(t,e=null){return function(n,r){let{$from:s,$to:a}=n.selection,o=s.blockRange(a),c=o&&Gx(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function N1(t,e=null){return function(n,r){let s=!1;for(let a=0;a{if(s)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)s=!0;else{let f=n.doc.resolve(h),m=f.index();s=f.parent.canReplaceWith(m,m+1,t)}})}if(!s)return!1;if(r){let a=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);a=new sh(u,u,e.depth),e.endIndex=0;f--)a=me.from(n[f].type.create(n[f].attrs,a));t.step(new kn(e.start-(r?2:0),e.end,e.start,e.end,new Pe(a,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return a?n?r.node(a.depth-1).type==t?BO(e,n,t,a):VO(e,n,a):!0:!1}}function BO(t,e,n,r){let s=t.tr,a=r.end,o=r.$to.end(r.depth);aj;v--)y-=s.child(v).nodeSize,r.delete(y-1,y+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==s.childCount,h=a.node(-1),f=a.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?me.empty:me.from(s))))return!1;let m=a.pos,g=m+o.nodeSize;return r.step(new kn(m-(c?1:0),g+(u?1:0),m+1,g-1,new Pe((c?me.empty:me.from(s.copy(me.empty))).append(u?me.empty:me.from(s.copy(me.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function HO(t){return function(e,n){let{$from:r,$to:s}=e.selection,a=r.blockRange(s,h=>h.childCount>0&&h.firstChild.type==t);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let c=a.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=me.from(h?t.create():null),m=new Pe(me.from(t.create(null,me.from(c.type.create(null,f)))),h?3:1,0),g=a.start,y=a.end;n(e.tr.step(new kn(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const In=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},tl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Lg=null;const Js=function(t,e,n){let r=Lg||(Lg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},WO=function(){Lg=null},Ga=function(t,e,n,r){return n&&(j1(t,e,n,r,-1)||j1(t,e,n,r,1))},UO=/^(img|br|input|textarea|hr)$/i;function j1(t,e,n,r,s){for(var a;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Vr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Yc(t)||UO.test(t.nodeName)||t.contentEditable=="false")return!1;e=In(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?Vr(t):0}else return!1}}function Vr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function KO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Vr(t)}else if(t.parentNode&&!Yc(t))e=In(t),t=t.parentNode;else return null}}function qO(t,e){for(;;){if(t.nodeType==3&&e2),Br=nl||(Es?/Mac/.test(Es.platform):!1),bS=Es?/Win/.test(Es.platform):!1,Qs=/Android \d/.test(oa),Qc=!!k1&&"webkitFontSmoothing"in k1.documentElement.style,QO=Qc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function XO(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ws(t,e){return typeof t=="number"?t:t[e]}function ZO(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function S1(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=tl(o);continue}let c=o,u=c==a.body,h=u?XO(a):ZO(c),f=0,m=0;if(e.toph.bottom-Ws(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+Ws(s,"top")-h.top:e.bottom-h.bottom+Ws(s,"bottom")),e.lefth.right-Ws(r,"right")&&(f=e.right-h.right+Ws(s,"right")),f||m)if(u)a.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-y,w=c.scrollTop-v;e={left:e.left-j,top:e.top-w,right:e.right-j,bottom:e.bottom-w}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:tl(o)}}function eD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let a=(e.left+e.right)/2,o=n+1;o=n-20){r=c,s=u.top;break}}return{refDOM:r,refTop:s,stack:wS(t.dom)}}function wS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=tl(r));return e}function tD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;NS(n,r==0?0:r-e)}function NS(t,e){for(let n=0;n=c){o=Math.max(v.bottom,o),c=Math.min(v.top,c);let j=v.left>e.left?v.left-e.left:v.right=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=f,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(a=m+1)}}return!n&&u&&(n=u,s=h,r=0),n&&n.nodeType==3?rD(n,s):!n||r&&n.nodeType==1?{node:t,offset:a}:jS(n,s)}function rD(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function n0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function sD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,a)}function aD(t,e,n,r){let s=-1;for(let a=e,o=!1;a!=t.dom;){let c=t.docView.nearestDesc(a,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?s=c.posBefore:(!o&&u.right-1?s:t.docView.posFromDOM(e,n,-1)}function kS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&s++}let h;Qc&&s&&r.nodeType==1&&(h=r.childNodes[s-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(c=aD(t,r,s,e))}c==null&&(c=iD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function C1(t){return t.top=0&&s==r.nodeValue.length?(u--,f=1):n<0?u--:h++,ec(Pi(Js(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&s&&(n<0||s==Vr(r))){let u=r.childNodes[s-1];if(u.nodeType==1)return $m(u.getBoundingClientRect(),!1)}if(a==null&&s=0)}if(a==null&&s&&(n<0||s==Vr(r))){let u=r.childNodes[s-1],h=u.nodeType==3?Js(u,Vr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return ec(Pi(h,1),!1)}if(a==null&&s=0)}function ec(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function $m(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function CS(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function cD(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return CS(t,e,()=>{let{node:a}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(a,!0);if(!c)break;if(c.node.isBlock){a=c.contentDOM||c.dom;break}a=c.dom.parentNode}let o=SS(t,s.pos,1);for(let c=a.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Js(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const dD=/[\u0590-\u08ac]/;function uD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,a=!s,o=s==r.parent.content.size,c=t.domSelection();return c?!dD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?a:o:CS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:j}=t.domSelectionRange(),w=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),w}):r.pos==r.start()||r.pos==r.end()}let E1=null,T1=null,M1=!1;function hD(t,e,n){return E1==e&&T1==n?M1:(E1=e,T1=n,M1=n=="up"||n=="down"?cD(t,e,n):uD(t,e,n))}const Ur=0,A1=1,Ia=2,Ts=3;class Xc{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Ur,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nIn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){s=!1;break}if(a.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){s=!0;break}if(a.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let a=this.getDesc(s),o;if(a&&(!n||a.node))if(r&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return a}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let a=this.getDesc(s);if(a)return a.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof TS){s=e-a;break}a=c}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof ES&&a.side>=0;r--);if(n<=0){let a,o=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,o=!1);return a&&n&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?In(a.dom)+1:0}}else{let a,o=!0;for(;a=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){s=In(g.dom)+1;break}e-=g.size}s==-1&&(s=0)}if(s>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fv&&on){let v=c;c=u,u=v}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s=r:er){let c=r+a.border,u=o-a.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?Ia:A1,e==c&&n==u&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=Ts:a.markDirty(e-c,n-c);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Ia:Ts}r=o}this.dirty=Ia}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ia:A1;n.dirty{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,a=this}matchesWidget(e){return this.dirty==Ur&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class fD extends Xc{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ja extends Xc{constructor(e,n,r,s,a){super(e,[],r,s),this.mark=n,this.spec=a}static create(e,n,r,s){let a=s.nodeViews[n.type.name],o=a&&a(n,s,r);return(!o||!o.dom)&&(o=no.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ja(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ts||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ts&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ur){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=Bg(a,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,s),f=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:m}=no.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=RS(f,r,n),h?u=new pD(e,n,r,s,f,m||null,g,h,a,o+1):n.isText?new df(e,n,r,s,f,g,a):new Ji(e,n,r,s,f,m||null,g,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>me.empty)}return e}matchesNode(e,n,r){return this.dirty==Ur&&e.eq(this.node)&&ah(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,a=e.composing?this.localCompositionInfo(e,n):null,o=a&&a.pos>-1?a:null,c=a&&a.pos<0,u=new gD(this,o&&o.node,e);vD(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?Ct.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,s)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>s&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,s)||u.addNode(h,f,m,e,s),s+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Ia)&&(o&&this.protectLocalComposition(e,o),MS(this.contentDOM,this.children,e),nl&&bD(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof We)||rn+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,c=wD(this.node.content,o,r-n,s-n);return c<0?null:{node:a,pos:c,text:o}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new fD(this,a,n,s);e.input.compositionNodes.push(o),this.children=Bg(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Ts||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Ur}updateOuterDeco(e){if(ah(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=AS(this.dom,this.nodeDOM,Fg(this.outerDeco,this.node,n),Fg(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function R1(t,e,n,r,s){RS(r,e,t);let a=new Ji(void 0,t,e,n,r,r,r,s,0);return a.contentDOM&&a.updateChildren(s,0),a}class df extends Ji{constructor(e,n,r,s,a,o,c){super(e,n,r,s,a,null,o,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==Ts||this.dirty!=Ur&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ur||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Ur,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),a=document.createTextNode(s.text);return new df(this.parent,s,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ts)}get domAtom(){return!1}isText(e){return this.node.text==e}}class TS extends Xc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ur&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class pD extends Ji{constructor(e,n,r,s,a,o,c,u,h,f){super(e,n,r,s,a,o,c,h,f),this.spec=u}update(e,n,r,s){if(this.dirty==Ts)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,n,r);return a&&this.updateInner(e,n,r,s),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function MS(t,e,n){let r=t.firstChild,s=!1;for(let a=0;a>1,c=Math.min(o,e.length);for(;a-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=Ja.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let a=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))a=this.top.children.indexOf(o,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof Ja)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(s-1))break;--s,a.set(c,s),o.push(c)}}return{index:s,matched:a,matches:o.reverse()}}function yD(t,e){return t.type.side-e.type.side}function vD(t,e,n,r){let s=e.locals(t),a=0;if(s.length==0){for(let h=0;ha;)c.push(s[o++]);let v=a+g.nodeSize;if(g.isText){let w=v;o!w.inline):c.slice();r(g,j,e.forChild(a,g),y),a=v}}function bD(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function wD(t,e,n,r){for(let s=0,a=0;s=n){if(a>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function Bg(t,e,n,r,s){let a=[];for(let o=0,c=0;o=n||f<=e?a.push(u):(hn&&a.push(u.slice(n-h,u.size,r)))}return a}function r0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),a=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(cf(n)){for(u=o;s&&!s.node;)s=s.parent;let m=s.node;if(s&&m.isAtom&&He.isSelectable(m)&&s.parent&&!(m.isInline&&GO(n.focusNode,n.focusOffset,s.dom))){let g=s.posBefore;h=new He(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!PS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function jD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,In(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&hr&&Gi<=11&&(n.disabled=!0,n.disabled=!1)}function IS(t,e){if(e instanceof He){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(L1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else L1(t)}function L1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function s0(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||We.between(e,n,r)}function _1(t){return t.editable&&!t.hasFocus()?!1:OS(t)}function OS(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function kD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ga(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Vg(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),a=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return a&&Je.findFrom(a,e)}function Ii(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function z1(t,e,n){let r=t.state.selection;if(r instanceof We)if(n.indexOf("s")>-1){let{$head:s}=r,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+a.nodeSize*(e<0?-1:1));return Ii(t,new We(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Vg(t.state,e);return s&&s instanceof He?Ii(t,s):!1}else if(!(Br&&n.indexOf("m")>-1)){let s=r.$head,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!a||a.isText)return!1;let c=e<0?s.pos-a.nodeSize:s.pos;return a.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?He.isSelectable(a)?Ii(t,new He(e<0?t.state.doc.resolve(s.pos-a.nodeSize):s)):Qc?Ii(t,new We(t.state.doc.resolve(e<0?c:c+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof He&&r.node.isInline)return Ii(t,new We(e>0?r.$to:r.$from));{let s=Vg(t.state,e);return s?Ii(t,s):!1}}}function oh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function xc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function _o(t,e){return e<0?SD(t):CD(t)}function SD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,a,o=!1;for(Wr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(xc(c,-1))s=n,a=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(DS(n))break;{let c=n.previousSibling;for(;c&&xc(c,-1);)s=n.parentNode,a=In(c),c=c.previousSibling;if(c)n=c,r=oh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Hg(t,n,r):s&&Hg(t,s,a)}function CD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=oh(n),a,o;for(;;)if(r{t.state==s&&ei(t)},50)}function $1(t,e){let n=t.state.doc.resolve(e);if(!(Dn||bS)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>s.top&&o1)return a.lefts.top&&o1)return a.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function F1(t,e,n){let r=t.state.selection;if(r instanceof We&&!r.empty||n.indexOf("s")>-1||Br&&n.indexOf("m")>-1)return!1;let{$from:s,$to:a}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Vg(t.state,e);if(o&&o instanceof He)return Ii(t,o)}if(!s.parent.inlineContent){let o=e<0?s:a,c=r instanceof Sr?Je.near(o,e):Je.findFrom(o,e);return c?Ii(t,c):!1}return!1}function B1(t,e){if(!(t.state.selection instanceof We))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let o=t.state.tr;return e<0?o.delete(n.pos-a.nodeSize,n.pos):o.delete(n.pos,n.pos+a.nodeSize),t.dispatch(o),!0}return!1}function V1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function MD(t){if(!Kn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;V1(t,r,"true"),setTimeout(()=>V1(t,r,"false"),20)}return!1}function AD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function RD(t,e){let n=e.keyCode,r=AD(e);if(n==8||Br&&n==72&&r=="c")return B1(t,-1)||_o(t,-1);if(n==46&&!e.shiftKey||Br&&n==68&&r=="c")return B1(t,1)||_o(t,1);if(n==13||n==27)return!0;if(n==37||Br&&n==66&&r=="c"){let s=n==37?$1(t,t.state.selection.from)=="ltr"?-1:1:-1;return z1(t,s,r)||_o(t,s)}else if(n==39||Br&&n==70&&r=="c"){let s=n==39?$1(t,t.state.selection.from)=="ltr"?1:-1:1;return z1(t,s,r)||_o(t,s)}else{if(n==38||Br&&n==80&&r=="c")return F1(t,-1,r)||_o(t,-1);if(n==40||Br&&n==78&&r=="c")return MD(t)||F1(t,1,r)||_o(t,1);if(r==(Br?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function i0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:s,openEnd:a}=e;for(;s>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,a--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||no.fromSchema(t.state.schema),c=BS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=FS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let v=c.createElement(f[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${s} ${a}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` + +`);return{dom:u,text:g,slice:e}}function LS(t,e,n,r,s){let a=s.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||a||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,a||r,t)}),a)return c=new Pe(me.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,s,r,t));if(m)c=m;else{let g=s.marks(),{schema:y}=t.state,v=no.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let w=o.appendChild(document.createElement("p"));j&&w.appendChild(v.serializeNode(y.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=DD(n),Qc&&LD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||qi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:s,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!PD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=_D(H1(c,+f[1],+f[2]),f[4]);else if(c=Pe.maxOpen(ID(c.content,s),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const PD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ID(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),a,o=[];if(t.forEach(c=>{if(!o)return;let u=s.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&a.length&&zS(u,a,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=$S(o[o.length-1],a.length));let f=_S(c,u);o.push(f),s=s.matchType(f.type),a=u}}),o)return me.from(o)}return t}function _S(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,me.from(t));return t}function zS(t,e,n,r,s){if(s1&&(a=0),s=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,a<=s).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(me.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function H1(t,e,n){return en})),Bm.createHTML(t)):t}function DD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=BS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&FS[r[1].toLowerCase()])&&(t=s.map(a=>"<"+a+">").join("")+t+s.map(a=>"").reverse().join("")),n.innerHTML=OD(t),s)for(let a=0;a=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;s=me.from(u.create(r[c+1],s)),a++,o++}return new Pe(s,a,o)}const tr={},nr={},zD={touchstart:!0,touchmove:!0};class $D{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function FD(t){for(let e in tr){let n=tr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{VD(t,r)&&!a0(t,r)&&(t.editable||!(r.type in nr))&&n(t,r)},zD[e]?{passive:!0}:void 0)}Kn&&t.dom.addEventListener("input",()=>null),Ug(t)}function Hi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function BD(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ug(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>a0(t,r))})}function a0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function VD(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function HD(t,e){!a0(t,e)&&tr[e.type]&&(t.editable||!(e.type in nr))&&tr[e.type](t,e)}nr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!HS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Qs&&Dn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),nl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Ra(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||RD(t,n)?n.preventDefault():Hi(t,"key")};nr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};nr.keypress=(t,e)=>{let n=e;if(HS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Br&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof We)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,a))&&t.dispatch(a()),n.preventDefault()}};function uf(t){return{left:t.clientX,top:t.clientY}}function WD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function o0(t,e,n,r,s){if(r==-1)return!1;let a=t.state.doc.resolve(r);for(let o=a.depth+1;o>0;o--)if(t.someProp(e,c=>o>a.depth?c(t,n,a.nodeAfter,a.before(o),s,!0):c(t,n,a.node(o),a.before(o),s,!1)))return!0;return!1}function Yo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function UD(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&He.isSelectable(r)?(Yo(t,new He(n)),!0):!1}function KD(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof He&&(r=n.node);let a=t.state.doc.resolve(e);for(let o=a.depth+1;o>0;o--){let c=o>a.depth?a.nodeAfter:a.node(o);if(He.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?s=a.before(n.$from.depth):s=a.before(o);break}}return s!=null?(Yo(t,He.create(t.state.doc,s)),!0):!1}function qD(t,e,n,r,s){return o0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",a=>a(t,e,r))||(s?KD(t,n):UD(t,n))}function GD(t,e,n,r){return o0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function JD(t,e,n,r){return o0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||YD(t,n,r)}function YD(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yo(t,We.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let a=s.depth+1;a>0;a--){let o=a>s.depth?s.nodeAfter:s.node(a),c=s.before(a);if(o.inlineContent)Yo(t,We.create(r,c+1,c+1+o.content.size));else if(He.isSelectable(o))Yo(t,He.create(r,c));else continue;return!0}}function l0(t){return lh(t)}const VS=Br?"metaKey":"ctrlKey";tr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=l0(t),s=Date.now(),a="singleClick";s-t.input.lastClick.time<500&&WD(n,t.input.lastClick)&&!n[VS]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=t.posAtCoords(uf(n));o&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new QD(t,o,n,!!r)):(a=="doubleClick"?GD:JD)(t,o.pos,o.inside,n)?n.preventDefault():Hi(t,"pointer"))};class QD{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[VS],this.allowDefault=r.shiftKey;let a,o;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);a=f.parent,o=f.depth?f.before():0}const c=s?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||h instanceof He&&h.from<=o&&h.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Hi(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ei(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(uf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Hi(this.view,"pointer"):qD(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Kn&&this.mightDrag&&!this.mightDrag.node.isAtom||Dn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yo(this.view,Je.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Hi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Hi(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}tr.touchstart=t=>{t.input.lastTouch=Date.now(),l0(t),Hi(t,"pointer")};tr.touchmove=t=>{t.input.lastTouch=Date.now(),Hi(t,"pointer")};tr.contextmenu=t=>l0(t);function HS(t,e){return t.composing?!0:Kn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const XD=Qs?5e3:-1;nr.compositionstart=nr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof We&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Dn&&bS&&ZD(t)))t.markCursor=t.state.storedMarks||n.marks(),lh(t,!0),t.markCursor=null;else if(lh(t,!e.selection.empty),Wr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,a=r.focusOffset;s&&s.nodeType==1&&a!=0;){let o=a<0?s.lastChild:s.childNodes[a-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else s=o,a=-1}}t.input.composing=!0}WS(t,XD)};function ZD(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}nr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,WS(t,20))};function WS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>lh(t),e))}function US(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=tL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function eL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=KO(e.focusNode,e.focusOffset),r=qO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function tL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function lh(t,e=!1){if(!(Qs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),US(t),e||t.docView&&t.docView.dirty){let n=r0(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function nL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Oc=hr&&Gi<15||nl&&QO<604;tr.copy=nr.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let a=Oc?null:n.clipboardData,o=r.content(),{dom:c,text:u}=i0(t,o);a?(n.preventDefault(),a.clearData(),a.setData("text/html",c.innerHTML),a.setData("text/plain",u)):nL(t,c),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function rL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function sL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Dc(t,r.value,null,s,e):Dc(t,r.textContent,r.innerHTML,s,e)},50)}function Dc(t,e,n,r,s){let a=LS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,s,a||Pe.empty)))return!0;if(!a)return!1;let o=rL(a),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(a);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function KS(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}nr.paste=(t,e)=>{let n=e;if(t.composing&&!Qs)return;let r=Oc?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Dc(t,KS(r),r.getData("text/html"),s,n)?n.preventDefault():sL(t,n)};class qS{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const iL=Br?"altKey":"ctrlKey";function GS(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[iL]}tr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,a=s.empty?null:t.posAtCoords(uf(n)),o;if(!(a&&a.pos>=s.from&&a.pos<=(s instanceof He?s.to-1:s.to))){if(r&&r.mightDrag)o=He.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=He.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=i0(t,c);(!n.dataTransfer.files.length||!Dn||vS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Oc?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Oc||n.dataTransfer.setData("text/plain",h),t.dragging=new qS(f,GS(t,n),o)};tr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};nr.dragover=nr.dragenter=(t,e)=>e.preventDefault();nr.drop=(t,e)=>{try{aL(t,e,t.dragging)}finally{t.dragging=null}};function aL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(uf(e));if(!r)return;let s=t.state.doc.resolve(r.pos),a=n&&n.slice;a?t.someProp("transformPasted",y=>{a=y(a,t,!1)}):a=LS(t,KS(e.dataTransfer),Oc?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&GS(t,e));if(t.someProp("handleDrop",y=>y(t,e,a||Pe.empty,o))){e.preventDefault();return}if(!a)return;e.preventDefault();let c=a?Xk(t.state.doc,s.pos,a):s.pos;c==null&&(c=s.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,a.content.firstChild):u.replaceRange(h,h,a),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&He.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))u.setSelection(new He(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,j,w,k)=>y=k),u.setSelection(s0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}tr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&ei(t)},20))};tr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};tr.beforeinput=(t,e)=>{if(Dn&&Qs&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,Ra(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in nr)tr[t]=nr[t];function Lc(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ch{constructor(e,n){this.toDOM=e,this.spec=n||Fa,this.side=this.spec.side||0}map(e,n,r,s){let{pos:a,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new gn(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ch&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Lc(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Yi{constructor(e,n){this.attrs=e,this.spec=n||Fa}map(e,n,r,s){let a=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new gn(a,o,this)}valid(e,n){return n.from=e&&(!a||a(c.spec))&&r.push(c.copy(c.from+s,c.to+s))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,s+c,a)}}map(e,n,r){return this==Hn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Fa)}mapInner(e,n,r,s,a){let o;for(let c=0;c{let h=u+r,f;if(f=YS(n,c,h)){for(s||(s=this.children.slice());ac&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let a=e+1,o=a+n.content.size;for(let c=0;ca&&u.type instanceof Yi){let h=Math.max(a,u.from)-a,f=Math.min(o,u.to)-a;hs.map(e,n,Fa));return Li.from(r)}forChild(e,n){if(n.isLeaf)return St.empty;let r=[];for(let s=0;sn instanceof St)?e:e.reduce((n,r)=>n.concat(r instanceof St?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let w=j-v-(y-g);for(let k=0;kE+f-m)continue;let C=c[k]+f-m;y>=C?c[k+1]=g<=C?-2:-1:g>=f&&w&&(c[k]+=w,c[k+1]+=w)}m+=w}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+a,-1),y=g-s,{index:v,offset:j}=r.content.findIndex(m),w=r.maybeChild(v);if(w&&j==m&&j+w.nodeSize==y){let k=c[h+2].mapInner(n,w,f+1,t[h]+a+1,o);k!=Hn?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=lL(c,t,e,n,s,a,o),f=dh(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=YS(t,c,u+n);if(h){a=!0;let f=dh(h,c,n+u+1,r);f!=Hn&&s.push(u,u+c.nodeSize,f)}});let o=JS(a?QS(t):t,-n).sort(Ba);for(let c=0;c0;)e++;t.splice(e,0,n)}function Vm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Hn&&e.push(r)}),t.cursorWrapper&&e.push(St.create(t.state.doc,[t.cursorWrapper.deco])),Li.from(e)}const cL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},dL=hr&&Gi<=11;class uL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class hL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new uL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;ss.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Kn&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),dL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,cL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(_1(this.view)){if(this.suppressingSelectionUpdates)return ei(this.view);if(hr&&Gi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ga(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let a=e.focusNode;a;a=tl(a))n.add(a);for(let a=e.anchorNode;a;a=tl(a))if(n.has(a)){r=a;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&_1(e)&&!this.ignoreSelectionChange(r),a=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(Wr&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||mL(e,m)!=y)&&g.remove()}}}let h=null;a<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||s)&&(a>-1&&(e.docView.markDirty(a,o),fL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,gL(e,u)),this.handleDOMChange(a,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ei(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fs;w--){let k=r.childNodes[w-1],E=k.pmViewDesc;if(k.nodeName=="BR"&&!E){a=w;break}if(!E||E.size)break}let m=t.state.doc,g=t.someProp("domParser")||qi.fromSchema(t.state.schema),y=m.resolve(o),v=null,j=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:s,to:a,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:yL,context:y});if(h&&h[0].pos!=null){let w=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=w),v={anchor:w+o,head:k+o}}return{doc:j,sel:v,from:o,to:c}}function yL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Kn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Kn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const vL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function bL(t,e,n,r,s){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let R=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=r0(t,R);if(P&&!t.state.selection.eq(P)){if(Dn&&Qs&&t.input.lastKeyCode===13&&Date.now()-100L(t,Ra(13,"Enter"))))return;let I=t.state.tr.setSelection(P);R=="pointer"?I.setMeta("pointer",!0):R=="key"&&I.scrollIntoView(),a&&I.setMeta("composition",a),t.dispatch(I)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=xL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Qs)&&s.some(R=>R.nodeType==1&&!vL.test(R.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",R=>R(t,Ra(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof We&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let R=J1(t,t.state.doc,h.sel);if(R&&!R.eq(t.state.selection)){let P=t.state.tr.setSelection(R);a&&P.setMeta("composition",a),t.dispatch(P)}}return}t.state.selection.fromt.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),hr&&Gi<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let j=h.doc.resolveNoCache(v.start-h.from),w=h.doc.resolveNoCache(v.endB-h.from),k=f.resolve(v.start),E=j.sameParent(w)&&j.parent.inlineContent&&k.end()>=v.endA;if((nl&&t.input.lastIOSEnter>Date.now()-225&&(!E||s.some(R=>R.nodeName=="DIV"||R.nodeName=="P"))||!E&&j.posR(t,Ra(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&NL(f,v.start,v.endA,j,w)&&t.someProp("handleKeyDown",R=>R(t,Ra(8,"Backspace")))){Qs&&Dn&&t.domObserver.suppressSelectionUpdates();return}Dn&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),Qs&&!E&&j.start()!=w.start()&&w.parentOffset==0&&j.depth==w.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,w=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(R){return R(t,Ra(13,"Enter"))})},20));let C=v.start,T=v.endA,O=R=>{let P=R||t.state.tr.replace(C,T,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let I=J1(t,P.doc,h.sel);I&&!(Dn&&t.composing&&I.empty&&(v.start!=v.endB||t.input.lastChromeDeleteei(t),20));let R=O(t.state.tr.delete(C,T)),P=f.resolve(v.start).marksAcross(f.resolve(v.endA));P&&R.ensureMarks(P),t.dispatch(R)}else if(v.endA==v.endB&&(B=wL(j.parent.content.cut(j.parentOffset,w.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let R=O(t.state.tr);B.type=="add"?R.addMark(C,T,B.mark):R.removeMark(C,T,B.mark),t.dispatch(R)}else if(j.parent.child(j.index()).isText&&j.index()==w.index()-(w.textOffset?0:1)){let R=j.parent.textBetween(j.parentOffset,w.parentOffset),P=()=>O(t.state.tr.insertText(R,C,T));t.someProp("handleTextInput",I=>I(t,C,T,R,P))||t.dispatch(P())}else t.dispatch(O());else t.dispatch(O())}function J1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:s0(t,e.resolve(n.anchor),e.resolve(n.head))}function wL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,a=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(s.length==0&&a.length==1)c=a[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||Hm(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,s++}return s}function jL(t,e,n,r,s){let a=t.findDiffStart(e,n);if(a==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let u=Math.max(0,a-Math.min(o,c));r-=o+u-a}if(o=o?a-r:0;a-=u,a&&a=c?a-r:0;a-=u,a&&a=56320&&e<=57343&&n>=55296&&n<=56319}class XS{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new $D,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(tw),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Z1(this),X1(this),this.nodeViews=ew(this),this.docView=R1(this.state.doc,Q1(this),Vm(this),this.dom,this),this.domObserver=new hL(this,(r,s,a,o)=>bL(this,r,s,a,o)),this.domObserver.start(),FD(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ug(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(tw),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(US(this),o=!0),this.state=e;let c=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=ew(this);SL(y,this.nodeViews)&&(this.nodeViews=y,a=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ug(this),this.editable=Z1(this),X1(this);let u=Vm(this),h=Q1(this),f=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",m=a||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(s.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&eD(this);if(o){this.domObserver.stop();let y=m&&(hr||Dn)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&kL(s.selection,e.selection);if(m){let v=Dn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=eL(this)),(a||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=R1(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&kD(this))?ei(this,y):(IS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&tD(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof He){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&S1(this,n.getBoundingClientRect(),e)}else S1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(a))==r.node&&(s=a)}this.dragging=new qS(e.slice,e.move,s<0?void 0:He.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return oD(this,e)}coordsAtPos(e,n=1){return SS(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return hD(this,n||this.state,e)}pasteHTML(e,n){return Dc(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Dc(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return i0(this,e)}destroy(){this.docView&&(BD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Vm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,WO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return HD(this,e)}domSelectionRange(){let e=this.domSelection();return e?Kn&&this.root.nodeType===11&&JO(this.dom.ownerDocument)==this.dom&&pL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}XS.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Q1(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[gn.node(0,t.state.doc.content.size,e)]}function X1(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:gn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Z1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function kL(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function ew(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function SL(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function tw(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Xi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},uh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},CL=typeof navigator<"u"&&/Mac/.test(navigator.platform),EL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var On=0;On<10;On++)Xi[48+On]=Xi[96+On]=String(On);for(var On=1;On<=24;On++)Xi[On+111]="F"+On;for(var On=65;On<=90;On++)Xi[On]=String.fromCharCode(On+32),uh[On]=String.fromCharCode(On);for(var Wm in Xi)uh.hasOwnProperty(Wm)||(uh[Wm]=Xi[Wm]);function TL(t){var e=CL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||EL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?uh:Xi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const ML=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),AL=typeof navigator<"u"&&/Win/.test(navigator.platform);function RL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,a,o;for(let c=0;c{for(var n in e)OL(t,n,{get:e[n],enumerable:!0})};function hf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:a}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,a=n.storedMarks,n}}}var ff=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,a=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(a);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:a}=r,o=[],c=!!t,u=t||s.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...v)=>{const j=this.buildProps(u,e),w=g(...v)(j);return o.push(w),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,a=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...a,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:a}=r,o={tr:t,editor:r,view:a,state:hf({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},ZS={};h0(ZS,{blur:()=>DL,clearContent:()=>LL,clearNodes:()=>_L,command:()=>zL,createParagraphNear:()=>$L,cut:()=>FL,deleteCurrentNode:()=>BL,deleteNode:()=>VL,deleteRange:()=>HL,deleteSelection:()=>WL,enter:()=>UL,exitCode:()=>KL,extendMarkRange:()=>qL,first:()=>GL,focus:()=>YL,forEach:()=>QL,insertContent:()=>XL,insertContentAt:()=>t8,joinBackward:()=>s8,joinDown:()=>r8,joinForward:()=>i8,joinItemBackward:()=>a8,joinItemForward:()=>o8,joinTextblockBackward:()=>l8,joinTextblockForward:()=>c8,joinUp:()=>n8,keyboardShortcut:()=>u8,lift:()=>h8,liftEmptyBlock:()=>f8,liftListItem:()=>p8,newlineInCode:()=>m8,resetAttributes:()=>g8,scrollIntoView:()=>x8,selectAll:()=>y8,selectNodeBackward:()=>v8,selectNodeForward:()=>b8,selectParentNode:()=>w8,selectTextblockEnd:()=>N8,selectTextblockStart:()=>j8,setContent:()=>k8,setMark:()=>W8,setMeta:()=>U8,setNode:()=>K8,setNodeSelection:()=>q8,setTextDirection:()=>G8,setTextSelection:()=>J8,sinkListItem:()=>Y8,splitBlock:()=>Q8,splitListItem:()=>X8,toggleList:()=>Z8,toggleMark:()=>e6,toggleNode:()=>t6,toggleWrap:()=>n6,undoInputRule:()=>r6,unsetAllMarks:()=>s6,unsetMark:()=>i6,unsetTextDirection:()=>a6,updateAttributes:()=>o6,wrapIn:()=>l6,wrapInList:()=>c6});var DL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),LL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),_L=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:a,$to:o})=>{t.doc.nodesBetween(a.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=fl(y);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,j)}(v||v===0)&&e.lift(y,v)})}),!0},zL=t=>e=>t(e),$L=()=>({state:t,dispatch:e})=>pS(t,e),FL=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,a=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,a.content),r.setSelection(new We(r.doc.resolve(Math.max(o-1,0)))),!0},BL=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===r.type){if(e){const c=s.before(a),u=s.after(a);t.delete(c,u).scrollIntoView()}return!0}return!1};function dn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var VL=t=>({tr:e,state:n,dispatch:r})=>{const s=dn(t,n.schema),a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===s){if(r){const u=a.before(o),h=a.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},HL=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},WL=()=>({state:t,dispatch:e})=>Qx(t,e),UL=()=>({commands:t})=>t.keyboardShortcut("Enter"),KL=()=>({state:t,dispatch:e})=>MO(t,e);function f0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function hh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:f0(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function e2(t,e,n={}){return t.find(r=>r.type===e&&hh(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function nw(t,e,n={}){return!!e2(t,e,n)}function p0(t,e,n){var r;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(f=>f.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(f=>f.type===e)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!e2([...s.node.marks],e,n)))return;let o=s.index,c=t.start()+s.offset,u=o+1,h=c+s.node.nodeSize;for(;o>0&&nw([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:s})=>{const a=ii(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(s){const m=p0(u,a,e);if(m&&m.from<=h&&m.to>=f){const g=We.create(o,m.from,m.to);n.setSelection(g)}}return!0},GL=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:s,dispatch:a})=>{e={scrollIntoView:!0,...e};const o=()=>{(fh()||rw())&&r.dom.focus(),JL()&&!fh()&&!rw()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(a&&t===null&&!t2(n.state.selection))return o(),!0;const c=n2(s.doc,t)||n.state.selection,u=n.state.selection.eq(c);return a&&(u||s.setSelection(c),u&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},QL=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),XL=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),r2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&r2(r)}return t};function ju(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return r2(n)}function _c(t,e,n){if(t instanceof Xs||t instanceof me)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return me.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),_c("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,c="";const u=new Bk({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?qi.fromSchema(u).parseSlice(ju(t),n.parseOptions):qi.fromSchema(u).parse(ju(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const a=qi.fromSchema(e);return n.slice?a.parseSlice(ju(t),n.parseOptions).content:a.parse(ju(t),n.parseOptions)}return _c("",e,n)}function ZL(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(Je.near(t.doc.resolve(o),n))}var e8=t=>!("type"in t),t8=(t,e,n)=>({tr:r,dispatch:s,editor:a})=>{var o;if(s){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=w=>{a.emit("contentError",{editor:a,error:w,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{_c(e,a.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(w){u(w)}try{c=_c(e,a.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:a.options.enableContentCheck})}catch(w){return u(w),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((e8(c)?c:[c]).forEach(w=>{w.check(),g=g?w.isText&&w.marks.length===0:!1,y=y?w.isBlock:!1}),f===m&&y){const{parent:w}=r.doc.resolve(f);w.isTextblock&&!w.type.spec.code&&!w.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(w=>w.text||"").join("");else if(e instanceof me){let w="";e.forEach(k=>{k.text&&(w+=k.text)}),j=w}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const w=r.doc.resolve(f),k=w.node(),E=w.parentOffset===0,C=k.isText||k.isTextblock,T=k.content.size>0;E&&C&&T&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&ZL(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},n8=()=>({state:t,dispatch:e})=>CO(t,e),r8=()=>({state:t,dispatch:e})=>EO(t,e),s8=()=>({state:t,dispatch:e})=>oS(t,e),i8=()=>({state:t,dispatch:e})=>uS(t,e),a8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=af(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},o8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=af(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},l8=()=>({state:t,dispatch:e})=>kO(t,e),c8=()=>({state:t,dispatch:e})=>SO(t,e);function s2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function d8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,a,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:s})=>{const a=d8(t).split(/-(?!$)/),o=a.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&s&&r.maybeStep(f)}),!0};function Zi(t,e,n={}){const{from:r,to:s,empty:a}=t.selection,o=e?dn(e,t.schema):null,c=[];t.doc.nodesBetween(r,s,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),v=Math.min(s,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=s-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>hh(m.node.attrs,n,{strict:!1}));return a?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var h8=(t,e={})=>({state:n,dispatch:r})=>{const s=dn(t,n.schema);return Zi(n,s,e)?TO(n,r):!1},f8=()=>({state:t,dispatch:e})=>mS(t,e),p8=t=>({state:e,dispatch:n})=>{const r=dn(t,e.schema);return FO(r)(e,n)},m8=()=>({state:t,dispatch:e})=>fS(t,e);function pf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function sw(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var g8=(t,e)=>({tr:n,state:r,dispatch:s})=>{let a=null,o=null;const c=pf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=dn(t,r.schema)),c==="mark"&&(o=ii(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{a&&a===f.type&&(u=!0,s&&n.setNodeMarkup(m,void 0,sw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,s&&n.addMark(m,m+f.nodeSize,o.create(sw(g.attrs,e))))})})}),u},x8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),y8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Sr(t.doc);t.setSelection(n)}return!0},v8=()=>({state:t,dispatch:e})=>cS(t,e),b8=()=>({state:t,dispatch:e})=>hS(t,e),w8=()=>({state:t,dispatch:e})=>PO(t,e),N8=()=>({state:t,dispatch:e})=>DO(t,e),j8=()=>({state:t,dispatch:e})=>OO(t,e);function Kg(t,e,n={},r={}){return _c(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var k8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:a,dispatch:o,commands:c})=>{const{doc:u}=a;if(r.preserveWhitespace!=="full"){const h=Kg(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&a.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&a.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function i2(t,e){const n=ii(e,t.schema),{from:r,to:s,empty:a}=t.selection,o=[];a?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function a2(t,e){const n=new Jx(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function S8(t){for(let e=0;e{n(s)&&r.push({node:s,pos:a})}),r}function o2(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function mf(t){return e=>o2(e.$from,t)}function Ve(t,e,n){return t.config[e]===void 0&&t.parent?Ve(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Ve(t.parent,e,n):null}):t.config[e]}function m0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Ve(e,"addExtensions",n);return r?[e,...m0(r())]:e}).flat(10)}function g0(t,e){const n=no.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function l2(t){return typeof t=="function"}function xt(t,e=void 0,...n){return l2(t)?e?t.bind(e)(...n):t(...n):t}function E8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function rl(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function c2(t){const e=[],{nodeExtensions:n,markExtensions:r}=rl(t),s=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:s},m=Ve(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let v;Array.isArray(y.types)?v=y.types:y.types==="*"?v=u:y.types==="nodes"?v=o:y.types==="marks"?v=c:v=[],v.forEach(j=>{Object.entries(y.attributes).forEach(([w,k])=>{e.push({type:j,name:w,attribute:{...a,...k}})})})})}),s.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=Ve(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,v])=>{const j={...a,...v};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:y,attribute:j})})}),e}function T8(t){const e=[];let n="",r=!1,s=!1,a=0;const o=t.length;for(let c=0;c0){a-=1,n+=u;continue}if(u===";"&&a===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function iw(t){const e=[],n=T8(t||""),r=n.length;for(let s=0;s!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,a])=>{if(!r[s]){r[s]=a;return}if(s==="class"){const c=a?String(a).split(" "):[],u=r[s]?r[s].split(" "):[],h=c.filter(f=>!u.includes(f));r[s]=[...u,...h].join(" ")}else if(s==="style"){const c=new Map([...iw(r[s]),...iw(a)]);r[s]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[s]=a}),r},{})}function zc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>yt(n,r),{})}function M8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function aw(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((a,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):M8(n.getAttribute(o.name));return c==null?a:{...a,[o.name]:c}},{});return{...r,...s}}}}function ow(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&E8(n)?!1:n!=null))}function lw(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function A8(t,e){var n;const r=c2(t),{nodeExtensions:s,markExtensions:a}=rl(t),o=(n=s.find(h=>Ve(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(s.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,E)=>{const C=Ve(E,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),y=ow({...g,content:xt(Ve(h,"content",m)),marks:xt(Ve(h,"marks",m)),group:xt(Ve(h,"group",m)),inline:xt(Ve(h,"inline",m)),atom:xt(Ve(h,"atom",m)),selectable:xt(Ve(h,"selectable",m)),draggable:xt(Ve(h,"draggable",m)),code:xt(Ve(h,"code",m)),whitespace:xt(Ve(h,"whitespace",m)),linebreakReplacement:xt(Ve(h,"linebreakReplacement",m)),defining:xt(Ve(h,"defining",m)),isolating:xt(Ve(h,"isolating",m)),attrs:Object.fromEntries(f.map(lw))}),v=xt(Ve(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>aw(k,f)));const j=Ve(h,"renderHTML",m);j&&(y.toDOM=k=>j({node:k,HTMLAttributes:zc(k,f)}));const w=Ve(h,"renderText",m);return w&&(y.toText=w),[h.name,y]})),u=Object.fromEntries(a.map(h=>{const f=r.filter(w=>w.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((w,k)=>{const E=Ve(k,"extendMarkSchema",m);return{...w,...E?E(h):{}}},{}),y=ow({...g,inclusive:xt(Ve(h,"inclusive",m)),excludes:xt(Ve(h,"excludes",m)),group:xt(Ve(h,"group",m)),spanning:xt(Ve(h,"spanning",m)),code:xt(Ve(h,"code",m)),attrs:Object.fromEntries(f.map(lw))}),v=xt(Ve(h,"parseHTML",m));v&&(y.parseDOM=v.map(w=>aw(w,f)));const j=Ve(h,"renderHTML",m);return j&&(y.toDOM=w=>j({mark:w,HTMLAttributes:zc(w,f)})),[h.name,y]}));return new Bk({topNode:o,nodes:c,marks:u})}function R8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function yc(t){return t.sort((n,r)=>{const s=Ve(n,"priority")||100,a=Ve(r,"priority")||100;return s>a?-1:sr.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function u2(t,e,n){const{from:r,to:s}=e,{blockSeparator:a=` + +`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,s,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=a);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,s-h))}),c}function P8(t,e){const n={from:0,to:t.content.size};return u2(t,n,e)}function h2(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function I8(t,e){const n=dn(e,t.schema),{from:r,to:s}=t.selection,a=[];t.doc.nodesBetween(r,s,c=>{a.push(c)});const o=a.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function f2(t,e){const n=pf(typeof e=="string"?e:e.name,t.schema);return n==="node"?I8(t,e):n==="mark"?i2(t,e):{}}function O8(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function D8(t){const e=O8(t);return e.length===1?e:e.filter((n,r)=>!e.filter((a,o)=>o!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function p2(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,a)=>{const o=[];if(s.ranges.length)s.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[a];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(a).map(c,-1),f=e.slice(a).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),D8(r)}function x0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const a=n.resolve(t),o=p0(a,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,a)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:a,to:a+s.nodeSize,mark:o})))}),r}var L8=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let a=r,o=null;for(;a>0&&o===null;){const c=s.node(a);(c==null?void 0:c.type.name)===e?o=c:a-=1}return[o,a]};function tc(t,e){return e.nodes[t]||e.marks[t]||null}function Bu(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(a=>a.type===e&&a.name===r);return s?s.attribute.keepOnSplit:!1}))}var _8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,a,o,c)=>{var u,h;const f=((h=(u=s.type.spec).toText)==null?void 0:h.call(u,{node:s,pos:a,parent:o,index:c}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?f:f.slice(0,Math.max(0,r-a))}),n};function qg(t,e,n={}){const{empty:r,ranges:s}=t.selection,a=e?ii(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>a?a.name===m.type.name:!0).find(m=>hh(m.attrs,n,{strict:!1}));let o=0;const c=[];if(s.forEach(({$from:m,$to:g})=>{const y=m.pos,v=g.pos;t.doc.nodesBetween(y,v,(j,w)=>{if(a&&j.inlineContent&&!j.type.allowsMarkType(a))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(y,w),E=Math.min(v,w+j.nodeSize),C=E-k;o+=C,c.push(...j.marks.map(T=>({mark:T,from:k,to:E})))})}),o===0)return!1;const u=c.filter(m=>a?a.name===m.mark.type.name:!0).filter(m=>hh(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>a?m.mark.type!==a&&m.mark.type.excludes(a):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function z8(t,e,n={}){if(!e)return Zi(t,null,n)||qg(t,null,n);const r=pf(e,t.schema);return r==="node"?Zi(t,e,n):r==="mark"?qg(t,e,n):!1}var $8=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const a=mf(c=>c.type.name===e)(t.selection);if(!a)return!1;const o=t.doc.resolve(a.pos+1);return s.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function cw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function dw(t,e){const{nodeExtensions:n}=rl(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},a=xt(Ve(r,"group",s));return typeof a!="string"?!1:a.split(" ").includes("list")}function gf(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(a=>{s!==!1&&(gf(a,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function m2(t){return t instanceof He}var g2=class x2{constructor(e){this.position=e}static fromJSON(e){return new x2(e.position)}toJSON(){return{position:this.position}}};function B8(t,e){const n=e.mapping.mapResult(t.position);return{position:new g2(n.pos),mapResult:n}}function V8(t){return new g2(t)}function H8(t,e,n){var r;const{selection:s}=e;let a=null;if(t2(s)&&(a=s.$cursor),a){const c=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),v=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=y&&v}return!h}),h})}var W8=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:a}=n,{empty:o,ranges:c}=a,u=ii(t,r.schema);if(s)if(o){const h=i2(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,y)=>{const v=Math.max(y,f),j=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(v,j,u.create({...k.attrs,...e}))}):n.addMark(v,j,u.create(e))})});return H8(r,n,u)},U8=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),K8=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const a=dn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?s().command(({commands:c})=>N1(a,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>N1(a,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},q8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Da(t,0,r.content.size),a=He.create(r,s);e.setSelection(a)}return!0},G8=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:a}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=a.from,c=a.to),s&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},J8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:a}=typeof t=="number"?{from:t,to:t}:t,o=We.atStart(r).from,c=We.atEnd(r).to,u=Da(s,o,c),h=Da(a,o,c),f=We.create(r,u,h);e.setSelection(f)}return!0},Y8=t=>({state:e,dispatch:n})=>{const r=dn(t,e.schema);return HO(r)(e,n)};function uw(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var Q8=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:a,doc:o}=e,{$from:c,$to:u}=a,h=s.extensionManager.attributes,f=Bu(h,c.node().type.name,c.node().attrs);if(a instanceof He&&a.node.isBlock)return!c.parentOffset||!Zs(o,c.pos)?!1:(r&&(t&&uw(n,s.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:S8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,v=Zs(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&Zs(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(v&&(a instanceof We&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),w=e.doc.resolve(j);c.node(-1).canReplaceWith(w.index(),w.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&uw(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return v},X8=(t,e={})=>({tr:n,state:r,dispatch:s,editor:a})=>{var o;const c=dn(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=a.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(s){let k=me.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-E;P>=u.depth-3;P-=1)k=me.from(u.node(P).copy(k));const C=u.indexAfter(-1){if(R>-1)return!1;P.isTextblock&&P.content.size===0&&(R=I+1)}),R>-1&&n.setSelection(We.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Bu(g,m.type.name,m.attrs),...e},j={...Bu(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const w=y?[{type:c,attrs:v},{type:y,attrs:j}]:[{type:c,attrs:v}];if(!Zs(n.doc,u.pos,2))return!1;if(s){const{selection:k,storedMarks:E}=r,{splittableMarks:C}=a.extensionManager,T=E||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,w).scrollIntoView(),!T||!s)return!0;const O=T.filter(B=>C.includes(B.type.name));n.ensureMarks(O)}return!0},Km=(t,e)=>{const n=mf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&aa(t.doc,n.pos)&&t.join(n.pos),!0},qm=(t,e)=>{const n=mf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&aa(t.doc,r)&&t.join(r),!0},Z8=(t,e,n,r={})=>({editor:s,tr:a,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=s.extensionManager,y=dn(t,o.schema),v=dn(e,o.schema),{selection:j,storedMarks:w}=o,{$from:k,$to:E}=j,C=k.blockRange(E),T=w||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const O=mf(B=>dw(B.type.name,m))(j);if(C.depth>=1&&O&&C.depth-O.depth<=1){if(O.node.type===y)return h.liftListItem(v);if(dw(O.node.type.name,m)&&y.validContent(O.node.content)&&c)return u().command(()=>(a.setNodeMarkup(O.pos,y),!0)).command(()=>Km(a,y)).command(()=>qm(a,y)).run()}return!n||!T||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>Km(a,y)).command(()=>qm(a,y)).run():u().command(()=>{const B=f().wrapInList(y,r),R=T.filter(P=>g.includes(P.type.name));return a.ensureMarks(R),B?!0:h.clearNodes()}).wrapInList(y,r).command(()=>Km(a,y)).command(()=>qm(a,y)).run()},e6=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:a=!1}=n,o=ii(t,r.schema);return qg(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:a}):s.setMark(o,e)},t6=(t,e,n={})=>({state:r,commands:s})=>{const a=dn(t,r.schema),o=dn(e,r.schema),c=Zi(r,a,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?s.setNode(o,u):s.setNode(a,{...u,...n})},n6=(t,e={})=>({state:n,commands:r})=>{const s=dn(t,n.schema);return Zi(n,s,e)?r.lift(s):r.wrapIn(s,e)},r6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(a.text){const u=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,t.schema.text(a.text,u))}else o.delete(a.from,a.to)}return!0}}return!1},s6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},i6=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var a;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=ii(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!s)return!0;if(f&&o){let{from:g,to:y}=c;const v=(a=h.marks().find(w=>w.type===u))==null?void 0:a.attrs,j=p0(h,u,v);j&&(g=j.from,y=j.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},a6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let a,o;return typeof t=="number"?(a=t,o=t):t&&"from"in t&&"to"in t?(a=t.from,o=t.to):(a=s.from,o=s.to),r&&e.doc.nodesBetween(a,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},o6=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let a=null,o=null;const c=pf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=dn(t,r.schema)),c==="mark"&&(o=ii(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,v,j;n.selection.empty?r.doc.nodesBetween(f,m,(w,k)=>{a&&a===w.type&&(u=!0,v=Math.max(k,f),j=Math.min(k+w.nodeSize,m),g=k,y=w)}):r.doc.nodesBetween(f,m,(w,k)=>{k=f&&k<=m&&(a&&a===w.type&&(u=!0,s&&n.setNodeMarkup(k,void 0,{...w.attrs,...e})),o&&w.marks.length&&w.marks.forEach(E=>{if(o===E.type&&(u=!0,s)){const C=Math.max(k,f),T=Math.min(k+w.nodeSize,m);n.addMark(C,T,o.create({...E.attrs,...e}))}}))}),y&&(g!==void 0&&s&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(w=>{o===w.type&&s&&n.addMark(v,j,o.create({...w.attrs,...e}))}))}),u},l6=(t,e={})=>({state:n,dispatch:r})=>{const s=dn(t,n.schema);return LO(s,e)(n,r)},c6=(t,e={})=>({state:n,dispatch:r})=>{const s=dn(t,n.schema);return _O(s,e)(n,r)},d6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},xf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},u6=(t,e)=>{if(f0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ku(t){var e;const{editor:n,from:r,to:s,text:a,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=_8(h)+a;return o.forEach(g=>{if(f)return;const y=u6(m,g.find);if(!y)return;const v=u.state.tr,j=hf({state:u.state,transaction:v}),w={from:r-(y[0].length-a.length),to:s},{commands:k,chain:E,can:C}=new ff({editor:n,state:j});g.handler({state:j,range:w,match:y,commands:k,chain:E,can:C})===null||!v.steps.length||(g.undoable&&v.setMeta(c,{transform:v,from:r,to:s,text:a}),u.dispatch(v),f=!0)}),f}function h6(t){const{editor:e,rules:n}=t,r=new Pt({state:{init(){return null},apply(s,a,o){const c=s.getMeta(r);if(c)return c;const u=s.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=g0(me.from(f),o.schema);const{from:m}=u,g=m+f.length;ku({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:a}},props:{handleTextInput(s,a,o,c){return ku({editor:e,from:a,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:a}=s.state.selection;a&&ku({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,a){if(a.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?ku({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function f6(t){return Object.prototype.toString.call(t).slice(8,-1)}function Su(t){return f6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function y2(t,e){const n={...t};return Su(t)&&Su(e)&&Object.keys(e).forEach(r=>{Su(e[r])&&Su(t[r])?n[r]=y2(t[r],e[r]):n[r]=e[r]}),n}var y0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...xt(Ve(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...xt(Ve(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>y2(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},ro=class v2 extends y0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new v2(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function p6(t){return typeof t=="number"}var m6=class{constructor(t){this.find=t.find,this.handler=t.handler}},g6=(t,e,n)=>{if(f0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const a=[s.text];return a.index=s.index,a.input=t,a.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(s.replaceWith)),a}):[]};function x6(t){const{editor:e,state:n,from:r,to:s,rule:a,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new ff({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,s,(y,v)=>{var j,w,k,E,C;if((w=(j=y.type)==null?void 0:j.spec)!=null&&w.code||!(y.isText||y.isTextblock||y.isInline))return;const T=(C=(E=(k=y.content)==null?void 0:k.size)!=null?E:y.nodeSize)!=null?C:0,O=Math.max(r,v),B=Math.min(s,v+T);if(O>=B)return;const R=y.isText?y.text||"":y.textBetween(O-v,B-v,void 0,"");g6(R,a.find,o).forEach(I=>{if(I.index===void 0)return;const L=O+I.index+1,X=L+I[0].length,Z={from:n.tr.mapping.map(L),to:n.tr.mapping.map(X)},Y=a.handler({state:n,range:Z,match:I,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(Y)})}),m.every(y=>y!==null)}var Cu=null,y6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function v6(t){const{editor:e,rules:n}=t;let r=null,s=!1,a=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:v})=>{const j=f.tr,w=hf({state:f,transaction:j});if(!(!x6({editor:e,state:w,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:v,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new Pt({view(m){const g=v=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(v.target)?m.dom.parentElement:null,r&&(Cu=e)},y=()=>{Cu&&(Cu=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(a=r===m.dom.parentElement,c=g,!a){const y=Cu;y!=null&&y.isEditable&&setTimeout(()=>{const v=y.state.selection;v&&y.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var y;const v=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,s=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const v=m[0],j=v.getMeta("uiEvent")==="paste"&&!s,w=v.getMeta("uiEvent")==="drop"&&!a,k=v.getMeta("applyPasteRules"),E=!!k;if(!j&&!w&&!E)return;if(E){let{text:O}=k;typeof O=="string"?O=O:O=g0(me.from(O),y.schema);const{from:B}=k,R=B+O.length,P=y6(O);return u({rule:f,state:y,from:B,to:{b:R},pasteEvt:P})}const C=g.doc.content.findDiffStart(y.doc.content),T=g.doc.content.findDiffEnd(y.doc.content);if(!(!p6(C)||!T||C===T.b))return u({rule:f,state:y,from:C,to:T,pasteEvt:o})}}))}var yf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=d2(t),this.schema=A8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:tc(e.name,this.schema)},r=Ve(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return yc([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:tc(r.name,this.schema)},a=[],o=Ve(r,"addKeyboardShortcuts",s);let c={};if(r.type==="mark"&&Ve(r,"exitable",s)&&(c.ArrowRight=()=>ro.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,v])=>[y,()=>v({editor:t})]));c={...c,...g}}const u=IL(c);a.push(u);const h=Ve(r,"addInputRules",s);if(cw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=h6({editor:t,rules:g}),v=Array.isArray(y)?y:[y];a.push(...v)}}const f=Ve(r,"addPasteRules",s);if(cw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=v6({editor:t,rules:g});a.push(...y)}}const m=Ve(r,"addProseMirrorPlugins",s);if(m){const g=m();a.push(...g)}return a})}get attributes(){return c2(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=rl(this.extensions);return Object.fromEntries(e.filter(n=>!!Ve(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:dn(n.name,this.schema)},a=Ve(n,"addNodeView",s);if(!a)return[];const o=a();if(!o)return[];const c=(u,h,f,m,g)=>{const y=zc(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return yc([...this.extensions].reverse()).reduceRight((r,s)=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:tc(s.name,this.schema)},o=Ve(s,"dispatchTransaction",a);return o?c=>{o.call(a,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return yc([...this.extensions]).reduce((r,s)=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:tc(s.name,this.schema)},o=Ve(s,"transformPastedHTML",a);return o?(c,u)=>{const h=r(c,u);return o.call(a,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=rl(this.extensions);return Object.fromEntries(e.filter(n=>!!Ve(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ii(n.name,this.schema)},a=Ve(n,"addMarkView",s);if(!a)return[];const o=(c,u,h)=>{const f=zc(c,r);return a()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{O6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:tc(e.name,this.schema)};e.type==="mark"&&((n=xt(Ve(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=Ve(e,"onBeforeCreate",r),a=Ve(e,"onCreate",r),o=Ve(e,"onUpdate",r),c=Ve(e,"onSelectionUpdate",r),u=Ve(e,"onTransaction",r),h=Ve(e,"onFocus",r),f=Ve(e,"onBlur",r),m=Ve(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),a&&this.editor.on("create",a),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};yf.resolve=d2;yf.sort=yc;yf.flatten=m0;var b6={};h0(b6,{ClipboardTextSerializer:()=>w2,Commands:()=>N2,Delete:()=>j2,Drop:()=>k2,Editable:()=>S2,FocusEvents:()=>E2,Keymap:()=>T2,Paste:()=>M2,Tabindex:()=>A2,TextDirection:()=>R2,focusEventsPluginKey:()=>C2});var Yt=class b2 extends y0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new b2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},w2=Yt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Pt({key:new Bt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:a}=s,o=Math.min(...a.map(f=>f.$from.pos)),c=Math.max(...a.map(f=>f.$to.pos)),u=h2(n);return u2(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),N2=Yt.create({name:"commands",addCommands(){return{...ZS}}}),j2=Yt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const a=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=a2(t.before,[t,...e]);p2(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(v,j)=>{const w=j+v.nodeSize-2,k=y.oldRange.from<=j&&w<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:j,to:w,newFrom:f.mapping.map(j),newTo:f.mapping.map(w),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,v)=>{var j,w;if(y instanceof as){const k=g.slice(v).map(y.from,-1),E=g.slice(v).map(y.to),C=g.invert().map(k,-1),T=g.invert().map(E),O=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(R=>R.eq(y.mark)),B=(w=f.doc.nodeAt(E))==null?void 0:w.marks.some(R=>R.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:C,to:T},newRange:{from:k,to:E},partial:!!(B||O),editor:this.editor,transaction:t,combinedTransform:f})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(a,0):a()}}),k2=Yt.create({name:"drop",addProseMirrorPlugins(){return[new Pt({key:new Bt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),S2=Yt.create({name:"editable",addProseMirrorPlugins(){return[new Pt({key:new Bt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),C2=new Bt("focusEvents"),E2=Yt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Pt({key:C2,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),T2=Yt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=v.parent.type.spec.isolating,w=m.pos-m.parentOffset,k=j&&v.parent.childCount===1?w===m.pos:Je.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},a={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return fh()||s2()?a:s},addProseMirrorPlugins(){return[new Pt({key:new Bt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),s=t.some(j=>j.getMeta("preventClearDocument"));if(!r||s)return;const{empty:a,from:o,to:c}=e.selection,u=Je.atStart(e.doc).from,h=Je.atEnd(e.doc).to;if(a||!(o===u&&c===h)||!gf(n.doc))return;const g=n.tr,y=hf({state:n,transaction:g}),{commands:v}=new ff({editor:this.editor,state:y});if(v.clearNodes(),!!g.steps.length)return g}})]}}),M2=Yt.create({name:"paste",addProseMirrorPlugins(){return[new Pt({key:new Bt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),A2=Yt.create({name:"tabindex",addProseMirrorPlugins(){return[new Pt({key:new Bt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),R2=Yt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=rl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Pt({key:new Bt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),w6=class cc{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new cc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new cc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new cc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+r+(a?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!s&&!o&&u.depth<=this.depth)return;const h=new cc(u,this.editor,s,s||o?n:null);s&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const a=s.node.attrs,o=Object.keys(n);for(let c=0;c{r&&s.length>0||(o.node.type.name===e&&a.every(u=>n[u]===o.node.attrs[u])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},N6=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +}`;function j6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var k6=class extends d6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:B8,createMappablePosition:V8},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:a})=>this.options.onDrop(r,s,a)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=n2(e,this.options.autofocus);this.editorState=Ko.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=j6(N6,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=l2(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const a=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(a))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[S2,w2.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),N2,E2,T2,A2,k2,M2,j2,R2.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new yf(r,this)}createCommandManager(){this.commandManager=new ff({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Kg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Kg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,a=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new XS(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||a.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return f2(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return z8(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return g0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` + +`,textSerializers:n={}}=t||{};return P8(this.state.doc,{blockSeparator:e,textSerializers:{...h2(this.schema),...n}})}get isEmpty(){return gf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new w6(e,this)}get $doc(){return this.$pos(0)}};function sl(t){return new xf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=xt(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:a}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(x0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(j=>j===t.type&&j!==y.mark.type)).filter(y=>y.to>h).length)return null;fn.from&&a.delete(n.from+u,h);const g=n.from+u+o.length;a.addMark(n.from+u,g,t.type.create(s||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function P2(t){return new xf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=xt(t.getAttributes,void 0,r)||{},{tr:a}=e,o=n.from;let c=n.to;const u=t.type.create(s);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];a.insertText(m,o+r[0].length-1),a.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;a.insert(h,t.type.create(s)).delete(a.mapping.map(o),a.mapping.map(c))}a.scrollIntoView()},undoable:t.undoable})}function Gg(t){return new xf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),a=xt(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,a)},undoable:t.undoable})}function il(t){return new xf({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const a=xt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&Gx(u,t.type,a);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const j=v.filter(w=>y.includes(w.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(m,a).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&aa(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var S6=t=>"touches"in t,C6=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,a,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(a=t.options)!=null&&a.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),a=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),a&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,S6(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),a=this.applyConstraints(r,s,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const a=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return a?r=this.startWidth+e:o&&(r=this.startWidth-e),c?s=this.startHeight+n:u&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(a?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,a,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(s=this.maxSize)!=null&&s.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function E6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof He){const a=r.index();return r.parent.canReplaceWith(a,a+1,e)}let s=r.depth;for(;s>=0;){const a=r.index(s);if(r.node(s).contentMatchAt(a).matchType(e))return!0;s-=1}return!1}function T6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var M6={};h0(M6,{createAtomBlockMarkdownSpec:()=>A6,createBlockMarkdownSpec:()=>R6,createInlineMarkdownSpec:()=>I2,parseAttributes:()=>v0,parseIndentedBlocks:()=>Jg,renderNestedMarkdownContent:()=>w0,serializeAttributes:()=>b0});function v0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const h=s.map(f=>f.trim().slice(1));e.class=h.join(" ")}const a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(e.id=a[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[h]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function b0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function A6(t){const{nodeName:e,name:n,parseAttributes:r=v0,serializeAttributes:s=b0,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...a,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=f.match(y);if(!v)return;const j=v[1]||"",w=r(j);if(!o.find(E=>!(E in w)))return{type:e,raw:v[0],attributes:w}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=s(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function R6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=v0,serializeAttributes:a=b0,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const j=r(m);y=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const v={...o,...m.attributes};return g.createNode(e,v,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),v=(g=m.match(y))==null?void 0:g.index;return v!==void 0?v:-1},tokenize(m,g,y){var v;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),w=m.match(j);if(!w)return;const[k,E=""]=w,C=s(E);let T=1;const O=k.length;let B="";const R=/^:::([\w-]*)(\s.*)?/gm,P=m.slice(O);for(R.lastIndex=0;;){const I=R.exec(P);if(I===null)break;const L=I.index,X=I[1];if(!((v=I[2])!=null&&v.endsWith(":::"))){if(X)T+=1;else if(T-=1,T===0){const Z=P.slice(0,L);B=Z.trim();const Y=m.slice(0,O+L+I[0].length);let W=[];if(B)if(c==="block")for(W=y.blockTokens(Z),W.forEach(D=>{D.text&&(!D.tokens||D.tokens.length===0)&&(D.tokens=y.inlineTokens(D.text))});W.length>0;){const D=W[W.length-1];if(D.type==="paragraph"&&(!D.text||D.text.trim()===""))W.pop();else break}else W=y.inlineTokens(B);return{type:e,raw:Y,attributes:C,content:B,tokens:W}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),v=a(y),j=v?` {${v}}`:"",w=g.renderChildren(m.content||[],` + +`);return`:::${h}${j} + +${w} + +:::`}}}function P6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,a,o]=r;e[s]=a||o,r=n.exec(t)}return e}function I6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function I2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=P6,serializeAttributes:a=I6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(v=>{const j=typeof v=="string"?v:v.name,w=typeof v=="string"?void 0:v.skipIfDefault;if(j in g){const k=g[j];if(w!==void 0&&k===w)return;y[j]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const v={...o,...g.attributes};if(c)return y.createNode(e,v);const j=r?r(g):g.content||"";return j?y.createNode(e,v,[y.createTextNode(j)]):y.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),v=g.match(y),j=v==null?void 0:v.index;return j!==void 0?j:-1},tokenize(g,y,v){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),w=g.match(j);if(!w)return;let k="",E="";if(c){const[,T]=w;E=T}else{const[,T,O]=w;E=T,k=O||""}const C=s(E.trim());return{type:e,raw:w[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const v=f(g.attrs||{}),j=a(v),w=j?` ${j}`:"";return c?`[${h}${w}]`:`[${h}${w}]${y}[/${h}]`}}}function Jg(t,e,n){var r,s,a,o;const c=t.split(` +`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} +`;continue}else return}const v=e.extractItemData(y),{indentLevel:j,mainContent:w}=v;h=`${h}${g} +`;const k=[w];for(f+=1;fL.trim()!=="");if(R===-1)break;if((((s=(r=c[f+1+R].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>j){k.push(O),h=`${h}${O} +`,f+=1;continue}else break}if((((o=(a=O.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:o.length)||0)>j)k.push(O),h=`${h}${O} +`,f+=1;else break}let E;const C=k.slice(1);if(C.length>0){const O=C.map(B=>B.slice(j+m)).join(` +`);O.trim()&&(e.customNestedParser?E=e.customNestedParser(O):E=n.blockTokens(O))}const T=e.createToken(v,E);u.push(T)}if(u.length!==0)return{items:u,raw:h}}function w0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[a,...o]=t.content,c=e.renderChildren([a]),u=[`${s}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` +`).map(g=>g?e.indent(g):"").join(` +`);u.push(m)}}),u.join(` +`)}function O6(t,e,n={}){const{state:r}=e,{doc:s,tr:a}=r,o=t;s.descendants((c,u)=>{const h=a.mapping.map(u),f=a.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});a.removeMark(h,f,t.type),a.addMark(h,f,y)}}),a.docChanged&&e.view.dispatch(a)}var un=class O2 extends y0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new O2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Ya(t){return new m6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const a=xt(t.getAttributes,void 0,r,s);if(a===!1||a===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(x0(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(w=>w===t.type&&w!==v.mark.type)).filter(v=>v.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:D6,getOwnPropertySymbols:L6}=Object,{hasOwnProperty:_6}=Object.prototype;function Gm(t,e){return function(r,s,a){return t(r,s,a)&&e(r,s,a)}}function Eu(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:a}=s,o=a.get(n),c=a.get(r);if(o&&c)return o===r&&c===n;a.set(n,r),a.set(r,n);const u=t(n,r,s);return a.delete(n),a.delete(r),u}}function z6(t){return t!=null?t[Symbol.toStringTag]:void 0}function hw(t){return D6(t).concat(L6(t))}const $6=Object.hasOwn||((t,e)=>_6.call(t,e));function so(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const F6="__v",B6="__o",V6="_owner",{getOwnPropertyDescriptor:fw,keys:pw}=Object;function H6(t,e){return t.byteLength===e.byteLength&&ph(new Uint8Array(t),new Uint8Array(e))}function W6(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function U6(t,e){return t.byteLength===e.byteLength&&ph(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function K6(t,e){return so(t.getTime(),e.getTime())}function q6(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function G6(t,e){return t===e}function mw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),a=t.entries();let o,c,u=0;for(;(o=a.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(s[m]){m++;continue}const g=o.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){f=s[m]=!0;break}m++}if(!f)return!1;u++}return!0}const J6=so;function Y6(t,e,n){const r=pw(t);let s=r.length;if(pw(e).length!==s)return!1;for(;s-- >0;)if(!D2(t,e,n,r[s]))return!1;return!0}function nc(t,e,n){const r=hw(t);let s=r.length;if(hw(e).length!==s)return!1;let a,o,c;for(;s-- >0;)if(a=r[s],!D2(t,e,n,a)||(o=fw(t,a),c=fw(e,a),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function Q6(t,e){return so(t.valueOf(),e.valueOf())}function X6(t,e){return t.source===e.source&&t.flags===e.flags}function gw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),a=t.values();let o,c;for(;(o=a.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!s[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=s[f]=!0;break}f++}if(!h)return!1}return!0}function ph(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function Z6(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function D2(t,e,n,r){return(r===V6||r===B6||r===F6)&&(t.$$typeof||e.$$typeof)?!0:$6(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const e_="[object ArrayBuffer]",t_="[object Arguments]",n_="[object Boolean]",r_="[object DataView]",s_="[object Date]",i_="[object Error]",a_="[object Map]",o_="[object Number]",l_="[object Object]",c_="[object RegExp]",d_="[object Set]",u_="[object String]",h_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},f_="[object URL]",p_=Object.prototype.toString;function m_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:v}){return function(w,k,E){if(w===k)return!0;if(w==null||k==null)return!1;const C=typeof w;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(w,k,E):C==="function"?a(w,k,E):!1;const T=w.constructor;if(T!==k.constructor)return!1;if(T===Object)return u(w,k,E);if(Array.isArray(w))return e(w,k,E);if(T===Date)return r(w,k,E);if(T===RegExp)return f(w,k,E);if(T===Map)return o(w,k,E);if(T===Set)return m(w,k,E);const O=p_.call(w);if(O===s_)return r(w,k,E);if(O===c_)return f(w,k,E);if(O===a_)return o(w,k,E);if(O===d_)return m(w,k,E);if(O===l_)return typeof w.then!="function"&&typeof k.then!="function"&&u(w,k,E);if(O===f_)return y(w,k,E);if(O===i_)return s(w,k,E);if(O===t_)return u(w,k,E);if(h_[O])return g(w,k,E);if(O===e_)return t(w,k,E);if(O===r_)return n(w,k,E);if(O===n_||O===o_||O===u_)return h(w,k,E);if(v){let B=v[O];if(!B){const R=z6(w);R&&(B=v[R])}if(B)return B(w,k,E)}return!1}}function g_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:H6,areArraysEqual:n?nc:W6,areDataViewsEqual:U6,areDatesEqual:K6,areErrorsEqual:q6,areFunctionsEqual:G6,areMapsEqual:n?Gm(mw,nc):mw,areNumbersEqual:J6,areObjectsEqual:n?nc:Y6,arePrimitiveWrappersEqual:Q6,areRegExpsEqual:X6,areSetsEqual:n?Gm(gw,nc):gw,areTypedArraysEqual:n?Gm(ph,nc):ph,areUrlsEqual:Z6,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Eu(r.areArraysEqual),a=Eu(r.areMapsEqual),o=Eu(r.areObjectsEqual),c=Eu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return r}function x_(t){return function(e,n,r,s,a,o,c){return t(e,n,c)}}function y_({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:s})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const a={cache:void 0,equals:r,meta:void 0,strict:s};return function(c,u){return e(c,u,a)}}const v_=la();la({strict:!0});la({circular:!0});la({circular:!0,strict:!0});la({createInternalComparator:()=>so});la({strict:!0,createInternalComparator:()=>so});la({circular:!0,createInternalComparator:()=>so});la({circular:!0,createInternalComparator:()=>so,strict:!0});function la(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,a=g_(t),o=m_(a),c=n?n(o):x_(o);return y_({circular:e,comparator:o,createState:r,equals:c,strict:s})}var Jm={exports:{}},Ym={};/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var xw;function b_(){if(xw)return Ym;xw=1;var t=Hc(),e=kk();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return Ym.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var v=a(null);if(v.current===null){var j={hasValue:!1,value:null};v.current=j}else j=v.current;v=c(function(){function k(B){if(!E){if(E=!0,C=B,B=g(B),y!==void 0&&j.hasValue){var R=j.value;if(y(R,B))return T=R}return T=B}if(R=T,r(C,B))return R;var P=g(B);return y!==void 0&&y(R,P)?(C=B,R):(C=B,T=P)}var E=!1,C,T,O=m===void 0?null:m;return[function(){return k(f())},O===null?void 0:function(){return k(O())}]},[f,m,g,y]);var w=s(h,v[0],v[1]);return o(function(){j.hasValue=!0,j.value=w},[w]),u(w),w},Ym}var yw;function w_(){return yw||(yw=1,Jm.exports=b_()),Jm.exports}var N_=w_(),j_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},k_=({contentComponent:t})=>{const e=Sk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return i.jsx(i.Fragment,{children:Object.values(e)})};function S_(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:jN.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var C_=class extends er.Component{constructor(t){var e;super(t),this.editorContentRef=er.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=S_(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:j_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&i.jsx(k_,{contentComponent:t.contentComponent})]})}},E_=b.forwardRef((t,e)=>{const n=er.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return er.createElement(C_,{key:n,innerRef:e,...t})}),L2=er.memo(E_),T_=typeof window<"u"?b.useLayoutEffect:b.useEffect,M_=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function A_(t){var e;const[n]=b.useState(()=>new M_(t.editor)),r=N_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:v_);return T_(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var R_=!1,Yg=typeof window>"u",P_=Yg||!!(typeof window<"u"&&window.next),I_=class _2{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Yg||P_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,a;return(a=(s=this.options.current).onBeforeCreate)==null?void 0:a.call(s,...r)},onBlur:(...r)=>{var s,a;return(a=(s=this.options.current).onBlur)==null?void 0:a.call(s,...r)},onCreate:(...r)=>{var s,a;return(a=(s=this.options.current).onCreate)==null?void 0:a.call(s,...r)},onDestroy:(...r)=>{var s,a;return(a=(s=this.options.current).onDestroy)==null?void 0:a.call(s,...r)},onFocus:(...r)=>{var s,a;return(a=(s=this.options.current).onFocus)==null?void 0:a.call(s,...r)},onSelectionUpdate:(...r)=>{var s,a;return(a=(s=this.options.current).onSelectionUpdate)==null?void 0:a.call(s,...r)},onTransaction:(...r)=>{var s,a;return(a=(s=this.options.current).onTransaction)==null?void 0:a.call(s,...r)},onUpdate:(...r)=>{var s,a;return(a=(s=this.options.current).onUpdate)==null?void 0:a.call(s,...r)},onContentError:(...r)=>{var s,a;return(a=(s=this.options.current).onContentError)==null?void 0:a.call(s,...r)},onDrop:(...r)=>{var s,a;return(a=(s=this.options.current).onDrop)==null?void 0:a.call(s,...r)},onPaste:(...r)=>{var s,a;return(a=(s=this.options.current).onPaste)==null?void 0:a.call(s,...r)},onDelete:(...r)=>{var s,a;return(a=(s=this.options.current).onDelete)==null?void 0:a.call(s,...r)}};return new k6(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,a)=>{var o;return s===((o=n.extensions)==null?void 0:o[a])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?_2.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function O_(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new I_(n)),s=Sk.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(s),b.useEffect(r.onRender(e)),A_({editor:s,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),s}var z2=b.createContext({editor:null});z2.Consumer;var D_=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),L_=()=>b.useContext(D_);er.forwardRef((t,e)=>{const{onDragStart:n}=L_(),r=t.as||"div";return i.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});er.createContext({markViewContentRef:()=>{}});var N0=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});N0.displayName="TiptapContext";var __=()=>b.useContext(N0);function $2({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=b.useMemo(()=>({editor:r}),[r]),a=b.useMemo(()=>({editor:r}),[r]);return i.jsx(z2.Provider,{value:a,children:i.jsx(N0.Provider,{value:s,children:n})})}$2.displayName="Tiptap";function F2({...t}){const{editor:e}=__();return i.jsx(L2,{editor:e,...t})}F2.displayName="Tiptap.Content";Object.assign($2,{Content:F2});var mh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},z_=/^\s*>\s$/,$_=un.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return mh("blockquote",{...yt(this.options.HTMLAttributes,t),children:mh("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(s=>{const c=e.renderChildren([s]).split(` +`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` +`))}),r.join(` +${n} +`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[il({find:z_,type:this.type})]}}),F_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,B_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,V_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,H_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,W_=ro.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return mh("strong",{...yt(this.options.HTMLAttributes,t),children:mh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[sl({find:F_,type:this.type}),sl({find:V_,type:this.type})]},addPasteRules(){return[Ya({find:B_,type:this.type}),Ya({find:H_,type:this.type})]}}),U_=/(^|[^`])`([^`]+)`(?!`)$/,K_=/(^|[^`])`([^`]+)`(?!`)/g,q_=ro.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",yt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[sl({find:U_,type:this.type})]},addPasteRules(){return[Ya({find:K_,type:this.type})]}}),Qm=4,G_=/^```([a-z]+)?[\s\n]$/,J_=/^~~~([a-z]+)?[\s\n]$/,Y_=un.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Qm,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const a=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",yt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(` +`):r=`\`\`\`${s} + +\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Qm,{state:r}=t,{selection:s}=r,{$from:a,empty:o}=s;if(a.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=s,y=r.doc.textBetween(h,f,` +`,` +`).split(` +`).map(v=>c+v).join(` +`);return u.replaceWith(h,f,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Qm,{state:r}=t,{selection:s}=r,{$from:a,empty:o}=s;return a.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=a,f=a.start(),m=a.end(),y=r.doc.textBetween(f,m,` +`,` +`).split(` +`);let v=0,j=0;const w=h-f;for(let B=0;B=w){v=B;break}j+=y[B].length+1}const E=((u=y[v].match(/^ */))==null?void 0:u[0])||"",C=Math.min(E.length,n);if(C===0)return!0;let T=f;for(let B=0;B{const{from:u,to:h}=s,g=r.doc.textBetween(u,h,` +`,` +`).split(` +`).map(y=>{var v;const j=((v=y.match(/^ */))==null?void 0:v[0])||"",w=Math.min(j.length,n);return y.slice(w)}).join(` +`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!a||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:a}=n;if(!a||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const c=s.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(Je.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Gg({find:G_,type:this.type,getAttributes:t=>({language:t[1]})}),Gg({find:J_,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Pt({key:new Bt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,a=s==null?void 0:s.mode;if(!n||!a)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` +`));return o.replaceSelectionWith(this.type.create({language:a},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(We.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),Q_=un.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` + +`):""}),X_=un.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",yt(this.options.HTMLAttributes,t)]},renderText(){return` +`},renderMarkdown:()=>` +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:a}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=a||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Z_=un.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,yt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Gg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),ez=un.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",yt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!E6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return m2(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:a,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(We.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(He.create(o.doc,u.pos)):o.setSelection(We.create(o.doc,u.pos));else{const f=a.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(We.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[P2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),tz=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,nz=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,rz=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,sz=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,iz=ro.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[sl({find:tz,type:this.type}),sl({find:rz,type:this.type})]},addPasteRules(){return[Ya({find:nz,type:this.type}),Ya({find:sz,type:this.type})]}});const az="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",oz="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Qg="numeric",Xg="ascii",Zg="alpha",vc="asciinumeric",dc="alphanumeric",ex="domain",B2="emoji",lz="scheme",cz="slashscheme",Xm="whitespace";function dz(t,e){return t in e||(e[t]=[]),e[t]}function La(t,e,n){e[Qg]&&(e[vc]=!0,e[dc]=!0),e[Xg]&&(e[vc]=!0,e[Zg]=!0),e[vc]&&(e[dc]=!0),e[Zg]&&(e[dc]=!0),e[dc]&&(e[ex]=!0),e[B2]&&(e[ex]=!0);for(const r in e){const s=dz(r,n);s.indexOf(t)<0&&s.push(t)}}function uz(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function ur(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ur.groups={};ur.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,s),Kt=(t,e,n,r,s)=>t.tr(e,n,r,s),vw=(t,e,n,r,s)=>t.ts(e,n,r,s),ke=(t,e,n,r,s)=>t.tt(e,n,r,s),qs="WORD",tx="UWORD",V2="ASCIINUMERICAL",H2="ALPHANUMERICAL",$c="LOCALHOST",nx="TLD",rx="UTLD",Vu="SCHEME",Fo="SLASH_SCHEME",j0="NUM",sx="WS",k0="NL",bc="OPENBRACE",wc="CLOSEBRACE",gh="OPENBRACKET",xh="CLOSEBRACKET",yh="OPENPAREN",vh="CLOSEPAREN",bh="OPENANGLEBRACKET",wh="CLOSEANGLEBRACKET",Nh="FULLWIDTHLEFTPAREN",jh="FULLWIDTHRIGHTPAREN",kh="LEFTCORNERBRACKET",Sh="RIGHTCORNERBRACKET",Ch="LEFTWHITECORNERBRACKET",Eh="RIGHTWHITECORNERBRACKET",Th="FULLWIDTHLESSTHAN",Mh="FULLWIDTHGREATERTHAN",Ah="AMPERSAND",Rh="APOSTROPHE",Ph="ASTERISK",Oi="AT",Ih="BACKSLASH",Oh="BACKTICK",Dh="CARET",_i="COLON",S0="COMMA",Lh="DOLLAR",ws="DOT",_h="EQUALS",C0="EXCLAMATION",Fr="HYPHEN",Nc="PERCENT",zh="PIPE",$h="PLUS",Fh="POUND",jc="QUERY",E0="QUOTE",W2="FULLWIDTHMIDDLEDOT",T0="SEMI",Ns="SLASH",kc="TILDE",Bh="UNDERSCORE",U2="EMOJI",Vh="SYM";var K2=Object.freeze({__proto__:null,ALPHANUMERICAL:H2,AMPERSAND:Ah,APOSTROPHE:Rh,ASCIINUMERICAL:V2,ASTERISK:Ph,AT:Oi,BACKSLASH:Ih,BACKTICK:Oh,CARET:Dh,CLOSEANGLEBRACKET:wh,CLOSEBRACE:wc,CLOSEBRACKET:xh,CLOSEPAREN:vh,COLON:_i,COMMA:S0,DOLLAR:Lh,DOT:ws,EMOJI:U2,EQUALS:_h,EXCLAMATION:C0,FULLWIDTHGREATERTHAN:Mh,FULLWIDTHLEFTPAREN:Nh,FULLWIDTHLESSTHAN:Th,FULLWIDTHMIDDLEDOT:W2,FULLWIDTHRIGHTPAREN:jh,HYPHEN:Fr,LEFTCORNERBRACKET:kh,LEFTWHITECORNERBRACKET:Ch,LOCALHOST:$c,NL:k0,NUM:j0,OPENANGLEBRACKET:bh,OPENBRACE:bc,OPENBRACKET:gh,OPENPAREN:yh,PERCENT:Nc,PIPE:zh,PLUS:$h,POUND:Fh,QUERY:jc,QUOTE:E0,RIGHTCORNERBRACKET:Sh,RIGHTWHITECORNERBRACKET:Eh,SCHEME:Vu,SEMI:T0,SLASH:Ns,SLASH_SCHEME:Fo,SYM:Vh,TILDE:kc,TLD:nx,UNDERSCORE:Bh,UTLD:rx,UWORD:tx,WORD:qs,WS:sx});const Us=/[a-z]/,rc=new RegExp("\\p{L}","u"),Zm=new RegExp("\\p{Emoji}","u"),Ks=/\d/,eg=/\s/,bw="\r",tg=` +`,hz="️",fz="‍",ng="";let Tu=null,Mu=null;function pz(t=[]){const e={};ur.groups=e;const n=new ur;Tu==null&&(Tu=ww(az)),Mu==null&&(Mu=ww(oz)),ke(n,"'",Rh),ke(n,"{",bc),ke(n,"}",wc),ke(n,"[",gh),ke(n,"]",xh),ke(n,"(",yh),ke(n,")",vh),ke(n,"<",bh),ke(n,">",wh),ke(n,"(",Nh),ke(n,")",jh),ke(n,"「",kh),ke(n,"」",Sh),ke(n,"『",Ch),ke(n,"』",Eh),ke(n,"<",Th),ke(n,">",Mh),ke(n,"&",Ah),ke(n,"*",Ph),ke(n,"@",Oi),ke(n,"`",Oh),ke(n,"^",Dh),ke(n,":",_i),ke(n,",",S0),ke(n,"$",Lh),ke(n,".",ws),ke(n,"=",_h),ke(n,"!",C0),ke(n,"-",Fr),ke(n,"%",Nc),ke(n,"|",zh),ke(n,"+",$h),ke(n,"#",Fh),ke(n,"?",jc),ke(n,'"',E0),ke(n,"/",Ns),ke(n,";",T0),ke(n,"~",kc),ke(n,"_",Bh),ke(n,"\\",Ih),ke(n,"・",W2);const r=Kt(n,Ks,j0,{[Qg]:!0});Kt(r,Ks,r);const s=Kt(r,Us,V2,{[vc]:!0}),a=Kt(r,rc,H2,{[dc]:!0}),o=Kt(n,Us,qs,{[Xg]:!0});Kt(o,Ks,s),Kt(o,Us,o),Kt(s,Ks,s),Kt(s,Us,s);const c=Kt(n,rc,tx,{[Zg]:!0});Kt(c,Us),Kt(c,Ks,a),Kt(c,rc,c),Kt(a,Ks,a),Kt(a,Us),Kt(a,rc,a);const u=ke(n,tg,k0,{[Xm]:!0}),h=ke(n,bw,sx,{[Xm]:!0}),f=Kt(n,eg,sx,{[Xm]:!0});ke(n,ng,f),ke(h,tg,u),ke(h,ng,f),Kt(h,eg,f),ke(f,bw),ke(f,tg),Kt(f,eg,f),ke(f,ng,f);const m=Kt(n,Zm,U2,{[B2]:!0});ke(m,"#"),Kt(m,Zm,m),ke(m,hz,m);const g=ke(m,fz);ke(g,"#"),Kt(g,Zm,m);const y=[[Us,o],[Ks,s]],v=[[Us,null],[rc,c],[Ks,a]];for(let j=0;jj[0]>w[0]?1:-1);for(let j=0;j=0?E[ex]=!0:Us.test(w)?Ks.test(w)?E[vc]=!0:E[Xg]=!0:E[Qg]=!0,vw(n,w,w,E)}return vw(n,"localhost",$c,{ascii:!0}),n.jd=new ur(Vh),{start:n,tokens:Object.assign({groups:e},K2)}}function q2(t,e){const n=mz(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,s=[];let a=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,a+=n[o].length,o++;a-=m,o-=g,h-=m,s.push({t:f.t,v:e.slice(a-h,a),s:a-h,e:a})}return s}function mz(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(a=t.charCodeAt(r+1))<56320||a>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Mi(t,e,n,r,s){let a;const o=e.length;for(let c=0;c=0;)a++;if(a>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+a),10);o>0;o--)n.pop();r+=a}else n.push(t[r]),r++}return e}const Fc={defaultProtocol:"http",events:null,format:Nw,formatHref:Nw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function M0(t,e=null){let n=Object.assign({},Fc);t&&(n=Object.assign(n,t instanceof M0?t.o:t));const r=n.ignoreTags,s=[];for(let a=0;an?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Fc.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),a=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:s,attributes:o,content:a,eventListeners:m}}};function vf(t,e){class n extends G2{constructor(s,a){super(s,a),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const jw=vf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),kw=vf("text"),gz=vf("nl"),Au=vf("url",{isLink:!0,toHref(t=Fc.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==$c&&t[1].t===_i}}),$r=t=>new ur(t);function xz({groups:t}){const e=t.domain.concat([Ah,Ph,Oi,Ih,Oh,Dh,Lh,_h,Fr,j0,Nc,zh,$h,Fh,Ns,Vh,kc,Bh]),n=[Rh,_i,S0,ws,C0,Nc,jc,E0,T0,bh,wh,bc,wc,xh,gh,yh,vh,Nh,jh,kh,Sh,Ch,Eh,Th,Mh],r=[Ah,Rh,Ph,Ih,Oh,Dh,Lh,_h,Fr,bc,wc,Nc,zh,$h,Fh,jc,Ns,Vh,kc,Bh],s=$r(),a=ke(s,kc);st(a,r,a),st(a,t.domain,a);const o=$r(),c=$r(),u=$r();st(s,t.domain,o),st(s,t.scheme,c),st(s,t.slashscheme,u),st(o,r,a),st(o,t.domain,o);const h=ke(o,Oi);ke(a,Oi,h),ke(c,Oi,h),ke(u,Oi,h);const f=ke(a,ws);st(f,r,a),st(f,t.domain,a);const m=$r();st(h,t.domain,m),st(m,t.domain,m);const g=ke(m,ws);st(g,t.domain,m);const y=$r(jw);st(g,t.tld,y),st(g,t.utld,y),ke(h,$c,y);const v=ke(m,Fr);ke(v,Fr,v),st(v,t.domain,m),st(y,t.domain,m),ke(y,ws,g),ke(y,Fr,v);const j=ke(y,_i);st(j,t.numeric,jw);const w=ke(o,Fr),k=ke(o,ws);ke(w,Fr,w),st(w,t.domain,o),st(k,r,a),st(k,t.domain,o);const E=$r(Au);st(k,t.tld,E),st(k,t.utld,E),st(E,t.domain,o),st(E,r,a),ke(E,ws,k),ke(E,Fr,w),ke(E,Oi,h);const C=ke(E,_i),T=$r(Au);st(C,t.numeric,T);const O=$r(Au),B=$r();st(O,e,O),st(O,n,B),st(B,e,O),st(B,n,B),ke(E,Ns,O),ke(T,Ns,O);const R=ke(c,_i),P=ke(u,_i),I=ke(P,Ns),L=ke(I,Ns);st(c,t.domain,o),ke(c,ws,k),ke(c,Fr,w),st(u,t.domain,o),ke(u,ws,k),ke(u,Fr,w),st(R,t.domain,O),ke(R,Ns,O),ke(R,jc,O),st(L,t.domain,O),st(L,e,O),ke(L,Ns,O);const X=[[bc,wc],[gh,xh],[yh,vh],[bh,wh],[Nh,jh],[kh,Sh],[Ch,Eh],[Th,Mh]];for(let Z=0;Z=0&&g++,s++,f++;if(g<0)s-=f,s0&&(a.push(rg(kw,e,o)),o=[]),s-=g,f-=g;const y=m.t,v=n.slice(s-f,s);a.push(rg(y,e,v))}}return o.length>0&&a.push(rg(kw,e,o)),a}function rg(t,e,n){const r=n[0].s,s=n[n.length-1].e,a=e.slice(r,s);return new t(a,n)}const vz=typeof console<"u"&&console&&console.warn||(()=>{}),bz="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Lt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function wz(){return ur.groups={},Lt.scanner=null,Lt.parser=null,Lt.tokenQueue=[],Lt.pluginQueue=[],Lt.customSchemes=[],Lt.initialized=!1,Lt}function Sw(t,e=!1){if(Lt.initialized&&vz(`linkifyjs: already initialized - will not register custom scheme "${t}" ${bz}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +1. Must only contain digits, lowercase ASCII letters or "-" +2. Cannot start or end with "-" +3. "-" cannot repeat`);Lt.customSchemes.push([t,e])}function Nz(){Lt.scanner=pz(Lt.customSchemes);for(let t=0;t{const s=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),a=e.some(h=>h.getMeta("preventAutolink"));if(!s||a)return;const{tr:o}=r,c=a2(n.doc,[...e]);if(p2(c).forEach(({newRange:h})=>{const f=C8(r.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(h.from,h.to," "," ");if(!kz.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(jz).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],j=m.pos+g.lastIndexOf(v);if(!v)return!1;const w=A0(v).map(k=>k.toObject(t.defaultProtocol));if(!Cz(w))return!1;w.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{x0(k.from,k.to,r.doc).some(E=>E.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function Tz(t){return new Pt({key:new Bt("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,a;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=f2(e.state,t.type.name),h=(s=o.href)!=null?s:u.href,f=(a=o.target)!=null?a:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function Mz(t){return new Pt({key:new Bt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:a}=e,{selection:o}=a,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=J2(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||s!==void 0&&!s(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function Aa(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(Sz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Y2=ro.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Sw(t);return}Sw(t.scheme,t.optionalSlashes)})},onDestroy(){wz()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Aa(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Aa(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",yt(this.options.HTMLAttributes,t),0]:["a",yt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,a;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(a=(s=t.attrs)==null?void 0:s.title)!=null?a:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Aa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Aa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Ya({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=J2(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!Aa(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(a=>{this.options.shouldAutoLink(a.value)&&e.push({text:a.value,data:{href:a.href},index:a.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Ez({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Aa(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Tz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Mz({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Az=Y2,Rz=Object.defineProperty,Pz=(t,e)=>{for(var n in e)Rz(t,n,{get:e[n],enumerable:!0})},Iz="listItem",Cw="textStyle",Ew=/^\s*([-+*])\s$/,Q2=un.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",yt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Iz,this.editor.getAttributes(Cw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=il({find:Ew,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=il({find:Ew,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Cw),editor:this.editor})),[t]}}),X2=un.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",yt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))n=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>w0(t,e,r=>{var s,a;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((a=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:a.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Oz={};Pz(Oz,{findListItemPos:()=>Zc,getNextListDepth:()=>P0,handleBackspace:()=>ix,handleDelete:()=>ax,hasListBefore:()=>Z2,hasListItemAfter:()=>Dz,hasListItemBefore:()=>eC,listItemHasSubList:()=>tC,nextListIsDeeper:()=>nC,nextListIsHigher:()=>rC});var Zc=(t,e)=>{const{$from:n}=e.selection,r=dn(t,e.schema);let s=null,a=n.depth,o=n.pos,c=null;for(;a>0&&c===null;)s=n.node(a),s.type===r?c=a:(a-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},P0=(t,e)=>{const n=Zc(t,e);if(!n)return!1;const[,r]=L8(e,t,n.$pos.pos+4);return r},Z2=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),a=t.doc.resolve(s).node();return!(!a||!n.includes(a.type.name))},eC=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},tC=(t,e,n)=>{if(!n)return!1;const r=dn(t,e.schema);let s=!1;return n.descendants(a=>{a.type===r&&(s=!0)}),s},ix=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Zi(t.state,e)&&Z2(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,y)=>{g.type.name===e&&h.push({node:g,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Zi(t.state,e)||!F8(t.state))return!1;const r=Zc(e,t.state);if(!r)return!1;const a=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=tC(e,t.state,a);return eC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},nC=(t,e)=>{const n=P0(t,e),r=Zc(t,e);return!r||!n?!1:n>r.depth},rC=(t,e)=>{const n=P0(t,e),r=Zc(t,e);return!r||!n?!1:n{if(!Zi(t.state,e)||!$8(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:nC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():rC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Dz=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},sC=Yt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&ax(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&ax(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&ix(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&ix(t,n,r)&&(e=!0)}),e}}}}),Tw=/^(\s*)(\d+)\.\s+(.*)$/,Lz=/^\s/;function _z(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(j=>j.indent)),v=iC(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:v,raw:g.map(j=>j.raw).join(` +`)})}s.push({type:"list_item",raw:o.raw,tokens:h}),a=m}else a+=1}return s}function zz(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const a=e.parseChildren([s]);r.push({type:"paragraph",content:a})}else{const a=e.parseChildren([s]);a.length>0&&r.push(...a)}}),{type:"listItem",content:r}})}var $z="listItem",Mw="textStyle",Aw=/^(\d+)\.\s$/,aC=un.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",yt(this.options.HTMLAttributes,n),0]:["ol",yt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?zz(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(` +`),[a,o]=_z(s);if(a.length===0)return;const c=iC(a,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=a[0])==null?void 0:r.number)||1,items:c,raw:s.slice(0,o).join(` +`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes($z,this.editor.getAttributes(Mw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=il({find:Aw,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=il({find:Aw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Fz=/^\s*(\[([( |x])?\])\s$/,Bz=un.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",yt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return w0(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),a=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),a.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const v=n();if(typeof v!="number")return!1;const j=y.doc.nodeAt(v);return y.setNodeMarkup(v,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{s.setAttribute(m,g)}),s.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,a.append(c,o),s.append(a,u),Object.entries(e).forEach(([m,g])=>{s.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:s,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;s.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=zc(m,g),v=new Set(Object.keys(y)),j=this.options.HTMLAttributes;return f.forEach(w=>{v.has(w)||(w in j?s.setAttribute(w,j[w]):s.removeAttribute(w))}),Object.entries(y).forEach(([w,k])=>{k==null?w in j?s.setAttribute(w,j[w]):s.removeAttribute(w):s.setAttribute(w,k)}),f=v,!0}}}},addInputRules(){return[il({find:Fz,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Vz=un.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",yt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=a=>{const o=Jg(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(a)},s=Jg(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,o)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Yt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Q2.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(X2.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(sC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(aC.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Bz.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Vz.configure(this.options.taskList)),t}});var Rw=" ",Hz=" ",Wz=un.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",yt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Rw||r[0].text===Hz)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?Rw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Uz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Kz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,qz=ro.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",yt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[sl({find:Uz,type:this.type})]},addPasteRules(){return[Ya({find:Kz,type:this.type})]}}),Gz=un.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Jz=ro.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",yt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const a=s[2].trim();return{type:"underline",raw:s[0],text:a,tokens:n.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Yz(t={}){return new Pt({view(e){return new Qz(e,t)}})}class Qz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let a=o=>{this[s](o)};return e.dom.addEventListener(s,a),{name:s,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,a=s.getBoundingClientRect(),o=a.width/s.offsetWidth,c=a.height/s.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let v=y.getBoundingClientRect(),j=m?v.bottom:v.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let w=this.width/2*c;r={left:v.left,right:v.right,top:j-w,bottom:j+w}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*y}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,a=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!a){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=Xk(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Gt extends Je{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Gt.valid(r)?new Gt(r):Je.near(r)}content(){return Pe.empty}eq(e){return e instanceof Gt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Gt(e.resolve(n.pos))}getBookmark(){return new I0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Xz(e)||!Zz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Gt.valid(e))return e;let s=e.pos,a=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){a=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let u=e.doc.resolve(s);if(Gt.valid(u))return u}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!He.isSelectable(a)){e=e.doc.resolve(s+a.nodeSize*n),r=!1;continue e}break}a=o,s+=n;let c=e.doc.resolve(s);if(Gt.valid(c))return c}return null}}}Gt.prototype.visible=!1;Gt.findFrom=Gt.findGapCursorFrom;Je.jsonID("gapcursor",Gt);class I0{constructor(e){this.pos=e}map(e){return new I0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Gt.valid(n)?new Gt(n):Je.near(n)}}function oC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Xz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||oC(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Zz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||oC(s.type))return!0;if(s.inlineContent)return!1}}return!0}function e7(){return new Pt({props:{decorations:s7,createSelectionBetween(t,e,n){return e.pos==n.pos&&Gt.valid(n)?new Gt(n):null},handleClick:n7,handleKeyDown:t7,handleDOMEvents:{beforeinput:r7}}})}const t7=u0({ArrowLeft:Ru("horiz",-1),ArrowRight:Ru("horiz",1),ArrowUp:Ru("vert",-1),ArrowDown:Ru("vert",1)});function Ru(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,a){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof We){if(!a.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Gt.findGapCursorFrom(c,e,u);return h?(s&&s(r.tr.setSelection(new Gt(h))),!0):!1}}function n7(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Gt.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&He.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Gt(r))),!0)}function r7(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Gt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=me.empty;for(let o=r.length-1;o>=0;o--)s=me.from(r[o].createAndFill(null,s));let a=t.state.tr.replace(n.pos,n.pos,new Pe(s,0,0));return a.setSelection(We.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function s7(t){if(!(t.selection instanceof Gt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",St.create(t.doc,[gn.widget(t.selection.head,e,{key:"gapcursor"})])}var Hh=200,Sn=function(){};Sn.prototype.append=function(e){return e.length?(e=Sn.from(e),!this.length&&e||e.length=n?Sn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Sn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Sn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Sn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(a,o){return s.push(e(a,o))},n,r),s};Sn.from=function(e){return e instanceof Sn?e:e&&e.length?new lC(e):Sn.empty};var lC=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,a){return s==0&&a==this.length?this:new e(this.values.slice(s,a))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,a,o,c){for(var u=a;u=o;u--)if(s(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Hh)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Hh)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Sn);Sn.empty=new lC([]);var i7=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(s-c,0),Math.min(this.length,a)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,a,o){var c=this.left.length;if(s>c&&this.right.forEachInvertedInner(r,s-c,Math.max(a,c)-c,o+c)===!1||a=a?this.right.slice(r-a,s-a):this.left.slice(r,a).append(this.right.slice(0,s-a))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Sn);const a7=500;class is{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,a;n&&(s=this.remapping(r,this.items.length),a=s.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){s||(s=this.remapping(r,g+1),a=s.maps.length),a--,f.push(m);return}if(s){f.push(new Ai(m.map));let y=m.step.map(s.slice(a)),v;y&&o.maybeStep(y).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],h.push(new Ai(v,void 0,void 0,h.length+f.length))),a--,v&&s.appendMap(v,a)}else o.maybeStep(m.step);if(m.selection)return c=s?m.selection.map(s.slice(a)):m.selection,u=new is(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,s){let a=[],o=this.eventCount,c=this.items,u=!s&&c.length?c.get(c.length-1):null;for(let f=0;fl7&&(c=o7(c,h),o-=h),new is(c.append(a),o)}remapping(e,n){let r=new Pc;return this.items.forEach((s,a)=>{let o=s.mirrorOffset!=null&&a-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new is(this.items.append(e.map(n=>new Ai(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),a=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},s);let u=n;this.items.forEach(g=>{let y=a.getMirror(--u);if(y==null)return;o=Math.min(o,y);let v=a.maps[y];if(g.step){let j=e.steps[y].invert(e.docs[y]),w=g.selection&&g.selection.map(a.slice(u+1,y));w&&c++,r.push(new Ai(v,j,w))}else r.push(new Ai(v))},s);let h=[];for(let g=n;ga7&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],a=0;return this.items.forEach((o,c)=>{if(c>=e)s.push(o),o.selection&&a++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&a++;let m=new Ai(h.invert(),u,f),g,y=s.length-1;(g=s.length&&s[y].merge(m))?s[y]=g:s.push(m)}}else o.map&&r--},this.items.length,0),new is(Sn.from(s.reverse()),a)}}is.empty=new is(Sn.empty,0);function o7(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}let Ai=class cC{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new cC(n.getMap().invert(),n,this.selection)}}};class Di{constructor(e,n,r,s,a){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=a}}const l7=20;function c7(t,e,n,r){let s=n.getMeta(Va),a;if(s)return s.historyState;n.getMeta(h7)&&(t=new Di(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Va))return o.getMeta(Va).redo?new Di(t.done.addTransform(n,void 0,r,Hu(e)),t.undone,Pw(n.mapping.maps),t.prevTime,t.prevComposition):new Di(t.done,t.undone.addTransform(n,void 0,r,Hu(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!d7(n,t.prevRanges)),h=o?sg(t.prevRanges,n.mapping):Pw(n.mapping.maps);return new Di(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Hu(e)),is.empty,h,n.time,c??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Di(t.done.rebased(n,a),t.undone.rebased(n,a),sg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Di(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),sg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function d7(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let a=0;a=e[a]&&(n=!0)}),n}function Pw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,a,o)=>e.push(a,o));return e}function sg(t,e){if(!t)return null;let n=[];for(let r=0;r{let s=Va.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let a=u7(s,n,t);a&&r(e?a.scrollIntoView():a)}return!0}}const uC=dC(!1,!0),hC=dC(!0,!0);Yt.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Pt({key:new Bt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>s){const o=a-s,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=r||s>r&&a>r&&a<=s)return!0;if(s>r&&a>r&&a>s||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=a-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var p7=Yt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Yz(this.options)]}});Yt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Pt({key:new Bt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,a=[];if(!n||!r)return St.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(s>=h&&s<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(s>=h&&s<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";a.push(gn.node(h,h+u.nodeSize,{class:this.options.className}))}),St.create(t,a)}}})]}});var m7=Yt.create({name:"gapCursor",addProseMirrorPlugins(){return[e7()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=xt(Ve(t,"allowGapCursor",n)))!=null?e:null}}}),Ow="placeholder";function g7(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var x7=Yt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Ow,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${g7(this.options.dataAttribute)}`:`data-${Ow}`;return[new Pt({key:new Bt("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=n,a=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=s>=u&&s<=u+c.nodeSize,f=!c.isLeaf&&gf(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=gn.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});a.push(g)}return this.options.includeChildren}),St.create(e,a)}}})]}});Yt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Pt({key:new Bt("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||m2(n.selection)||t.view.dragging?null:St.create(n.doc,[gn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Dw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var y7=Yt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Bt(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Pt({key:e,appendTransaction:(s,a,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(s,a)=>{const o=a.tr.doc.lastChild;return!Dw({node:o,types:r})},apply:(s,a)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return a;const o=s.doc.lastChild;return!Dw({node:o,types:r})}}})]}}),v7=Yt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>uC(t,e),redo:()=>({state:t,dispatch:e})=>hC(t,e)}},addProseMirrorPlugins(){return[f7(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),b7=Yt.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(W_.configure(this.options.bold)),this.options.blockquote!==!1&&s.push($_.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(Q2.configure(this.options.bulletList)),this.options.code!==!1&&s.push(q_.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(Y_.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(Q_.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(p7.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(m7.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(X_.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(Z_.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(v7.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(ez.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(iz.configure(this.options.italic)),this.options.listItem!==!1&&s.push(X2.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(sC.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(Y2.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(aC.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Wz.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(qz.configure(this.options.strike)),this.options.text!==!1&&s.push(Gz.configure(this.options.text)),this.options.underline!==!1&&s.push(Jz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(y7.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),w7=b7,N7=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,j7=un.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",yt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,a,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",h=(o=(a=t.attrs)==null?void 0:a.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:a,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new C6({element:u,editor:c,node:s,getPos:a,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const y=a();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,y)=>m.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[P2({find:N7,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),k7=j7;function S7(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:a,startOfLine:o,$position:c}=t,u=r&&!s,h=T6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=s?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),v=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!v)return null;const j=c.pos-v.length,w=Array.from(v.matchAll(y)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const k=w.input.slice(Math.max(0,w.index-1),w.index),E=new RegExp(`^[${a==null?void 0:a.join("")}\0]?$`).test(k);if(a!==null&&!E)return null;const C=j+w.index;let T=C+w[0].length;return u&&f.test(v.slice(T-1,T+1))&&(w[0]+=" ",T+=1),C=c.pos?{range:{from:C,to:T},query:w[0].slice(n.length),text:w[0]}:null}var C7=new Bt("suggestion");function E7({pluginKey:t=C7,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:a=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:j=S7,shouldShow:w}){let k;const E=y==null?void 0:y(),C=()=>{const R=e.state.selection.$anchor.pos,P=e.view.coordsAtPos(R),{top:I,right:L,bottom:X,left:Z}=P;try{return new DOMRect(Z,I,L-Z,X-I)}catch{return null}},T=(R,P)=>P?()=>{const I=t.getState(e.state),L=I==null?void 0:I.decorationId,X=R.dom.querySelector(`[data-decoration-id="${L}"]`);return(X==null?void 0:X.getBoundingClientRect())||null}:C;function O(R,P){var I;try{const X=t.getState(R.state),Z=X!=null&&X.decorationId?R.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`):null,Y={editor:e,range:(X==null?void 0:X.range)||{from:0,to:0},query:(X==null?void 0:X.query)||null,text:(X==null?void 0:X.text)||null,items:[],command:W=>m({editor:e,range:(X==null?void 0:X.range)||{from:0,to:0},props:W}),decorationNode:Z,clientRect:T(R,Z)};(I=E==null?void 0:E.onExit)==null||I.call(E,Y)}catch{}const L=R.state.tr.setMeta(P,{exit:!0});R.dispatch(L)}const B=new Pt({key:t,view(){return{update:async(R,P)=>{var I,L,X,Z,Y,W,D;const $=(I=this.key)==null?void 0:I.getState(P),ae=(L=this.key)==null?void 0:L.getState(R.state),_=$.active&&ae.active&&$.range.from!==ae.range.from,se=!$.active&&ae.active,q=$.active&&!ae.active,z=!se&&!q&&$.query!==ae.query,H=se||_&&z,de=z||_,K=q||_&&z;if(!H&&!de&&!K)return;const fe=K&&!H?$:ae,Q=R.dom.querySelector(`[data-decoration-id="${fe.decorationId}"]`);k={editor:e,range:fe.range,query:fe.query,text:fe.text,items:[],command:oe=>m({editor:e,range:fe.range,props:oe}),decorationNode:Q,clientRect:T(R,Q)},H&&((X=E==null?void 0:E.onBeforeStart)==null||X.call(E,k)),de&&((Z=E==null?void 0:E.onBeforeUpdate)==null||Z.call(E,k)),(de||H)&&(k.items=await g({editor:e,query:fe.query})),K&&((Y=E==null?void 0:E.onExit)==null||Y.call(E,k)),de&&((W=E==null?void 0:E.onUpdate)==null||W.call(E,k)),H&&((D=E==null?void 0:E.onStart)==null||D.call(E,k))},destroy:()=>{var R;k&&((R=E==null?void 0:E.onExit)==null||R.call(E,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(R,P,I,L){const{isEditable:X}=e,{composing:Z}=e.view,{selection:Y}=R,{empty:W,from:D}=Y,$={...P},ae=R.getMeta(t);if(ae&&ae.exit)return $.active=!1,$.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null,$;if($.composing=Z,X&&(W||e.view.composing)){(DP.range.to)&&!Z&&!P.composing&&($.active=!1);const _=j({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:a,startOfLine:o,$position:Y.$from}),se=`id_${Math.floor(Math.random()*4294967295)}`;_&&v({editor:e,state:L,range:_.range,isActive:P.active})&&(!w||w({editor:e,range:_.range,query:_.query,text:_.text,transaction:R}))?($.active=!0,$.decorationId=P.decorationId?P.decorationId:se,$.range=_.range,$.query=_.query,$.text=_.text):$.active=!1}else $.active=!1;return $.active||($.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null),$}},props:{handleKeyDown(R,P){var I,L,X,Z;const{active:Y,range:W}=B.getState(R.state);if(!Y)return!1;if(P.key==="Escape"||P.key==="Esc"){const $=B.getState(R.state),ae=(I=k==null?void 0:k.decorationNode)!=null?I:null,_=ae??($!=null&&$.decorationId?R.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`):null);if(((L=E==null?void 0:E.onKeyDown)==null?void 0:L.call(E,{view:R,event:P,range:$.range}))||!1)return!0;const q={editor:e,range:$.range,query:$.query,text:$.text,items:[],command:z=>m({editor:e,range:$.range,props:z}),decorationNode:_,clientRect:_?()=>_.getBoundingClientRect()||null:null};return(X=E==null?void 0:E.onExit)==null||X.call(E,q),O(R,t),!0}return((Z=E==null?void 0:E.onKeyDown)==null?void 0:Z.call(E,{view:R,event:P,range:W}))||!1},decorations(R){const{active:P,range:I,decorationId:L,query:X}=B.getState(R);if(!P)return null;const Z=!(X!=null&&X.length),Y=[u];return Z&&Y.push(f),St.create(R.doc,[gn.inline(I.from,I.to,{nodeName:c,class:Y.join(" "),"data-decoration-id":L,"data-decoration-content":h})])}}});return B}function T7({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const s=new Bt;return{editor:t,char:r,pluginKey:s,command:({editor:a,range:o,props:c})=>{var u,h,f;const m=a.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),a.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=a.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:a,range:o})=>{const c=a.doc.resolve(o.from),u=a.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function fC(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>T7({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Lw(t,e){const n=fC(t),r=n.find(s=>s.char===e);return r||(n.length?n[0]:null)}var M7=un.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,s;return["span",yt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Lw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",yt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=yt({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof s=="string"?["span",yt({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...I2({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,a,o]=r,c=a??o;e[s==="char"?"mentionSuggestionChar":s]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:Lw(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:s,anchor:a}=r;if(!s)return!1;let o=new Xs,c=0;return e.doc.nodesBetween(a-1,a,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return fC(this).map(E7)}}),A7=M7,R7=x7;let ox,lx;if(typeof WeakMap<"u"){let t=new WeakMap;ox=e=>t.get(e),lx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;ox=r=>{for(let s=0;s(n==10&&(n=0),t[n++]=r,t[n++]=s)}var Jt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(a||(a=[])).push({type:"overlong_rowspan",pos:f,n:k-C});break}const T=s+C*e;for(let O=0;Or&&(a+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=a:e!=a&&(e=Math.max(e,a))}return e}function O7(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function L7(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function hs(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function bf(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Qa(e.$head)||_7(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function _7(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function cx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function z7(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function O0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function pC(t,e,n){const r=t.node(-1),s=Jt.get(r),a=t.start(-1),o=s.nextCell(t.pos-a,e,n);return o==null?null:t.node(0).resolve(a+o)}function Xa(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function mC(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;sf!=n.pos-a);u.unshift(n.pos-a);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=a+f+1;return new rS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(cx(r)&&cx(s)&&O0(r,s)){const a=this.$anchorCell.node(-1)!=r.node(-1);return a&&this.isRowSelection()?Gs.rowSelection(r,s):a&&this.isColSelection()?Gs.colSelection(r,s):new Gs(r,s)}return We.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=Jt.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),a={},o=[];for(let u=s.top;u0||w>0){let k=v.attrs;if(j>0&&(k=Xa(k,0,j)),w>0&&(k=Xa(k,k.colspan-w,w)),y.lefts.bottom){const k={...v.attrs,rowspan:Math.min(y.bottom,s.bottom)-Math.max(y.top,s.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=Jt.get(r),a=e.start(-1),o=s.findCell(e.pos-a),c=s.findCell(n.pos-a),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(a+s.map[o.left])),c.bottom0&&(n=u.resolve(a+s.map[c.left])),o.bottom0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,c=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof Gs&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=Jt.get(r),a=e.start(-1),o=s.findCell(e.pos-a),c=s.findCell(n.pos-a),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(a+s.map[o.top*s.width])),c.right0&&(n=u.resolve(a+s.map[c.top*s.width])),o.right{e.push(gn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),St.create(t.doc,e)}function V7({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(s+1)=0&&!(e.before(a+1)>e.start(a));a--,r--);return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function H7({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const a=t.node(s);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}for(let s=e.depth;s>0;s--){const a=e.node(s);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){r=a;break}}return n!==r&&e.parentOffset===0}function W7(t,e,n){const r=(e||t).selection,s=(e||t).doc;let a,o;if(r instanceof He&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")a=Rt.create(s,r.from);else if(o=="row"){const c=s.resolve(r.from+1);a=Rt.rowSelection(c,c)}else if(!n){const c=Jt.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];a=Rt.create(s,u+1,h)}}else r instanceof We&&V7(r)?a=We.create(s,r.from):r instanceof We&&H7(r)&&(a=We.create(s,r.$from.start(),r.$from.end()));return a&&(e||(e=t.tr)).setSelection(a),e}const U7=new Bt("fix-tables");function xC(t,e,n,r){const s=t.childCount,a=e.childCount;e:for(let o=0,c=0;o{s.type.spec.tableRole=="table"&&(n=K7(t,s,a,n))};return e?e.doc!=t.doc&&xC(e.doc,t.doc,0,r):t.doc.descendants(r),n}function K7(t,e,n,r){const s=Jt.get(e);if(!s.problems)return r;r||(r=t.tr);const a=[];for(let u=0;u0){let y="cell";f.firstChild&&(y=f.firstChild.type.spec.tableRole);const v=[];for(let w=0;w0?-1:0;$7(e,r,s+a)&&(a=s==0||s==e.width?null:0);for(let o=0;o0&&s0&&e.map[c-1]==u||s0?-1:0;Q7(e,r,s+c)&&(c=s==0||s==e.height?null:0);for(let h=0,f=e.width*s;h0&&s0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(s0&&n[a]==n[a-1]||r.right0&&n[s]==n[s-t]||r.bottom0){const f=u+1+h.content.size,m=_w(h)?u+1:f;a.replaceWith(m+r.tableStart,f+r.tableStart,c)}a.setSelection(new Rt(a.doc.resolve(u+r.tableStart))),e(a)}return!0}function $w(t,e){const n=qn(t.schema);return r$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function r$(t){return(e,n)=>{const r=e.selection;let s,a;if(r instanceof Rt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{var o;if(s=L7(r.$from),!s)return!1;a=(o=Qa(r.$from))===null||o===void 0?void 0:o.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let c=s.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=As(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&a.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):a.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(a)}return!0}}function i$(t){return function(e,n){if(!hs(e))return!1;if(n){const r=qn(e.schema),s=As(e),a=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),c=o.map(u=>s.table.nodeAt(u));for(let u=0;u{const y=g+a.tableStart,v=o.doc.nodeAt(y);v&&o.setNodeMarkup(y,m,v.attrs)}),r(o)}return!0}}Bc("row",{useDeprecatedLogic:!0});Bc("column",{useDeprecatedLogic:!0});const a$=Bc("cell",{useDeprecatedLogic:!0});function o$(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const a=t.node(-1).child(r),o=a.lastChild;if(o)return s-1-o.nodeSize;s-=a.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Pu(t,e){const n=t.selection;if(!(n instanceof Rt))return!1;if(e){const r=t.tr,s=qn(t.schema).cell.createAndFill().content;n.forEachCell((a,o)=>{a.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+a.nodeSize-1),new Pe(s,0,0))}),r.docChanged&&e(r)}return!0}function c$(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const s=e.child(0),a=s.type.spec.tableRole,o=s.type.schema,c=[];if(a=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=a.child(o).attrs;for(let h=s;h=e.length&&e.push(me.empty),n[s]r&&(g=g.type.createChecked(Xa(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;ys&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,s-m.attrs.rowspan)},m.content)),u.push(m)}a.push(me.from(u))}n=a,e=s}return{width:t,height:e,rows:n}}function h$(t,e,n,r,s,a,o){const c=t.doc.type.schema,u=qn(c);let h,f;if(s>e.width)for(let m=0,g=0;me.height){const m=[];for(let v=0,j=(e.height-1)*e.width;v=e.width?!1:n.nodeAt(e.map[j+v]).type==u.header_cell;m.push(w?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,me.from(m)),y=[];for(let v=e.height;v{if(!s)return!1;const a=n.selection;if(a instanceof Rt)return Wu(n,r,Je.near(a.$headCell,e));if(t!="horiz"&&!a.empty)return!1;const o=wC(s,t,e);if(o==null)return!1;if(t=="horiz")return Wu(n,r,Je.near(n.doc.resolve(a.head+e),e));{const c=n.doc.resolve(o),u=pC(c,t,e);let h;return u?h=Je.near(u,1):e<0?h=Je.near(n.doc.resolve(c.before(-1)),-1):h=Je.near(n.doc.resolve(c.after(-1)),1),Wu(n,r,h)}}}function Ou(t,e){return(n,r,s)=>{if(!s)return!1;const a=n.selection;let o;if(a instanceof Rt)o=a;else{const u=wC(s,t,e);if(u==null)return!1;o=new Rt(n.doc.resolve(u))}const c=pC(o.$headCell,t,e);return c?Wu(n,r,new Rt(o.$anchorCell,c)):!1}}function p$(t,e){const n=t.state.doc,r=Qa(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Rt(r))),!0):!1}function m$(t,e,n){if(!hs(t.state))return!1;let r=c$(n);const s=t.state.selection;if(s instanceof Rt){r||(r={width:1,height:1,rows:[me.from(dx(qn(t.state.schema).cell,n))]});const a=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),c=Jt.get(a).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=u$(r,c.right-c.left,c.bottom-c.top),Ww(t.state,t.dispatch,o,c,r),!0}else if(r){const a=bf(t.state),o=a.start(-1);return Ww(t.state,t.dispatch,o,Jt.get(a.node(-1)).findCell(a.pos-o),r),!0}else return!1}function g$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Uw(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof Rt)a(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=Qa(t.state.selection.$anchor))!=null&&((n=ag(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)a(s,e),e.preventDefault();else if(!r)return;function a(u,h){let f=ag(t,h);const m=zi.getState(t.state)==null;if(!f||!O0(u,f))if(m)f=u;else return;const g=new Rt(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(zi,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),zi.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(zi,-1))}function c(u){const h=u,f=zi.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Uw(t,h.target)!=r&&(m=ag(t,e),!m))return o();m&&a(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function wC(t,e,n){if(!(t.state.selection instanceof We))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const a=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){const o=r.before(s),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Uw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ag(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&Qa(t.state.doc.resolve(r))||Qa(t.state.doc.resolve(s))}var x$=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ux(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ux(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ux(t,e,n,r,s,a){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new v$(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=kr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{b$(o,c,t,s)},mouseleave:o=>{w$(o)},mousedown:(o,c)=>{N$(o,c,e,n)}},decorations:o=>{const c=kr.getState(o);if(c&&c.activeHandle>-1)return E$(o,c.activeHandle)},nodeViews:{}}});return a}var v$=class Uu{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(kr);if(r&&r.setHandle!=null)return new Uu(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Uu(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return cx(e.doc.resolve(s))||(s=-1),new Uu(s,n.dragging)}return n}};function b$(t,e,n,r){if(!t.editable)return;const s=kr.getState(t.state);if(s&&!s.dragging){const a=k$(e.target);let o=-1;if(a){const{left:c,right:u}=a.getBoundingClientRect();e.clientX-c<=n?o=Kw(t,e,"left",n):u-e.clientX<=n&&(o=Kw(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=Jt.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}NC(t,o)}}}function w$(t){if(!t.editable)return;const e=kr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&NC(t,-1)}function N$(t,e,n,r){var s;if(!t.editable)return!1;const a=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,o=kr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=j$(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(kr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){a.removeEventListener("mouseup",h),a.removeEventListener("mousemove",f);const g=kr.getState(t.state);g!=null&&g.dragging&&(S$(t,g.activeHandle,qw(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(kr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=kr.getState(t.state);if(g&&g.dragging){const y=qw(g.dragging,m,n);Gw(t,g.activeHandle,y,r)}}return Gw(t,o.activeHandle,u,r),a.addEventListener("mouseup",h),a.addEventListener("mousemove",f),e.preventDefault(),!0}function j$(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const a=t.domAtPos(e);let o=a.node.childNodes[a.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),s=r?r.split(",").map(a=>parseInt(a,10)):null;if(!s){const a=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&a&&a[o]){const c=a[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return s}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",yt(this.options.HTMLAttributes,t),0]}}),kC=un.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",yt(this.options.HTMLAttributes,t),0]}}),SC=un.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",yt(this.options.HTMLAttributes,t),0]}});function hx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Jw(t,e,n,r,s,a){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,y=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function P$(t,e,n,r,s){const a=R$(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!I$(e))return!1;let n=0;const r=o2(e.ranges[0].$from,a=>a.type.name==="table");return r==null||r.node.descendants(a=>{if(a.type.name==="table")return!1;["tableCell","tableHeader"].includes(a.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},O$="";function D$(t){return(t||"").replace(/\s+/g," ").trim()}function L$(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:O$;if(!t||!t.content||t.content.length===0)return"";const a=[];t.content.forEach(v=>{const j=[];v.content&&v.content.forEach(w=>{let k="";w.content&&Array.isArray(w.content)&&w.content.length>1?k=w.content.map(O=>e.renderChildren(O)).join(s):k=w.content?e.renderChildren(w.content):"";const E=D$(k),C=w.type==="tableHeader";j.push({text:E,isHeader:C})}),a.push(j)});const o=a.reduce((v,j)=>Math.max(v,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);a.forEach(v=>{var j;for(let w=0;wc[w]&&(c[w]=E),c[w]<3&&(c[w]=3)}});const u=(v,j)=>v+" ".repeat(Math.max(0,j-v.length)),h=a[0],f=h.some(v=>v.isHeader);let m=` +`;const g=new Array(o).fill(0).map((v,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((v,j)=>u(v,c[j])).join(" | ")} | +`,m+=`| ${c.map(v=>"-".repeat(Math.max(3,v))).join(" | ")} | +`,(f?a.slice(1):a).forEach(v=>{m+=`| ${new Array(o).fill(0).map((j,w)=>u(v[w]&&v[w].text||"",c[w])).join(" | ")} | +`}),m}var _$=L$,CC=un.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:M$,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=A$(t,this.options.cellMinWidth),a=e.style;function o(){return a||(r?`width: ${r}`:`min-width: ${s}`)}const c=["table",yt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(s=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const s=[];r.forEach(a=>{s.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>_$(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:a})=>{const o=P$(a.schema,t,e,n);if(s){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(We.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>q7(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>G7(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Y7(t,e),addRowBefore:()=>({state:t,dispatch:e})=>X7(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Z7(t,e),deleteRow:()=>({state:t,dispatch:e})=>t$(t,e),deleteTable:()=>({state:t,dispatch:e})=>l$(t,e),mergeCells:()=>({state:t,dispatch:e})=>zw(t,e),splitCell:()=>({state:t,dispatch:e})=>$w(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Bc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Bc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>a$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>zw(t,e)?!0:$w(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>s$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Bw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Bw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&yC(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Rt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Du,"Mod-Backspace":Du,Delete:Du,"Mod-Delete":Du}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[y$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],T$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:xt(Ve(t,"tableRole",e))}}});Yt.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(CC.configure(this.options.table)),this.options.tableCell!==!1&&t.push(jC.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(kC.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(SC.configure(this.options.tableRow)),t}});function z$(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 + +`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 + +`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 + +`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 + +`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 +`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` +`),e=e.replace(//gi,` +`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 + +`),e=e.replace(//gi,`--- + +`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` + +`),e.trim()}function Qw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),e=e.replace(/^## (.+)$/gm,"

    $1

    "),e=e.replace(/^# (.+)$/gm,"

    $1

    "),e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/\*(.+?)\*/g,"$1"),e=e.replace(/~~(.+?)~~/g,"$1"),e=e.replace(/`([^`]+)`/g,"$1"),e=e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'$1'),e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1'),e=e.replace(/^> (.+)$/gm,"

    $1

    "),e=e.replace(/^---$/gm,"
    "),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` +`),r=[];for(const s of n){const a=s.trim();a&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(a)?r.push(a):r.push(`

    ${a}

    `))}return r.join("")}const $$=un.create({name:"linkTag",group:"inline",inline:!0,selectable:!0,atom:!0,addAttributes(){return{label:{default:""},url:{default:""},tagType:{default:"url",parseHTML:t=>t.getAttribute("data-tag-type")||"url"},tagId:{default:"",parseHTML:t=>t.getAttribute("data-tag-id")||""},pagePath:{default:"",parseHTML:t=>t.getAttribute("data-page-path")||""}}},parseHTML(){return[{tag:'span[data-type="linkTag"]',getAttrs:t=>{var e;return{label:((e=t.textContent)==null?void 0:e.replace(/^#/,"").trim())||"",url:t.getAttribute("data-url")||"",tagType:t.getAttribute("data-tag-type")||"url",tagId:t.getAttribute("data-tag-id")||"",pagePath:t.getAttribute("data-page-path")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",yt(e,{"data-type":"linkTag","data-url":t.attrs.url,"data-tag-type":t.attrs.tagType,"data-tag-id":t.attrs.tagId,"data-page-path":t.attrs.pagePath,class:"link-tag-node"}),`#${t.attrs.label}`]}}),F$=t=>({items:({query:e})=>t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase())||n.id.includes(e)).slice(0,8),render:()=>{let e=null,n=0,r=[],s=null;const a=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    + @${o.name} + ${o.label||o.id} +
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");s&&r[c]&&s({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,s=o.command,n=0,a(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,s=o.command,n=0,a(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),a(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),a(),!0):o.event.key==="Enter"?(s&&r[n]&&s({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}}),fx=b.forwardRef(({content:t,onChange:e,onImageUpload:n,persons:r=[],linkTags:s=[],placeholder:a="开始编辑内容...",className:o},c)=>{const u=b.useRef(null),[h,f]=b.useState(""),[m,g]=b.useState(!1),y=b.useRef(Qw(t)),v=O_({extensions:[w7,k7.configure({inline:!0,allowBase64:!0}),Az.configure({openOnClick:!1,HTMLAttributes:{class:"rich-link"}}),A7.configure({HTMLAttributes:{class:"mention-tag"},suggestion:F$(r)}),$$,R7.configure({placeholder:a}),CC.configure({resizable:!0}),SC,jC,kC],content:y.current,onUpdate:({editor:E})=>{e(E.getHTML())},editorProps:{attributes:{class:"rich-editor-content"}}});b.useImperativeHandle(c,()=>({getHTML:()=>(v==null?void 0:v.getHTML())||"",getMarkdown:()=>z$((v==null?void 0:v.getHTML())||"")})),b.useEffect(()=>{if(v&&t!==v.getHTML()){const E=Qw(t);E!==v.getHTML()&&v.commands.setContent(E)}},[t]);const j=b.useCallback(async E=>{var T;const C=(T=E.target.files)==null?void 0:T[0];if(!(!C||!v)){if(n){const O=await n(C);O&&v.chain().focus().setImage({src:O}).run()}else{const O=new FileReader;O.onload=()=>{typeof O.result=="string"&&v.chain().focus().setImage({src:O.result}).run()},O.readAsDataURL(C)}E.target.value=""}},[v,n]),w=b.useCallback(E=>{v&&v.chain().focus().insertContent({type:"linkTag",attrs:{label:E.label,url:E.url||"",tagType:E.type||"url",tagId:E.id||"",pagePath:E.pagePath||""}}).run()},[v]),k=b.useCallback(()=>{!v||!h||(v.chain().focus().setLink({href:h}).run(),f(""),g(!1))},[v,h]);return v?i.jsxs("div",{className:`rich-editor-wrapper ${o||""}`,children:[i.jsxs("div",{className:"rich-editor-toolbar",children:[i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"is-active":"",type:"button",children:i.jsx(TT,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"is-active":"",type:"button",children:i.jsx(MM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleStrike().run(),className:v.isActive("strike")?"is-active":"",type:"button",children:i.jsx(EA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"is-active":"",type:"button",children:i.jsx(GT,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"is-active":"",type:"button",children:i.jsx(vM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"is-active":"",type:"button",children:i.jsx(wM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"is-active":"",type:"button",children:i.jsx(jM,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"is-active":"",type:"button",children:i.jsx($M,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"is-active":"",type:"button",children:i.jsx(_M,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"is-active":"",type:"button",children:i.jsx(hA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().setHorizontalRule().run(),type:"button",children:i.jsx(YM,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:j,className:"hidden"}),i.jsx("button",{onClick:()=>{var E;return(E=u.current)==null?void 0:E.click()},type:"button",children:i.jsx(FN,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>g(!m),className:v.isActive("link")?"is-active":"",type:"button",children:i.jsx(bg,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:i.jsx(MA,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:i.jsx(LA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:i.jsx(pA,{className:"w-4 h-4"})})]}),s.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"toolbar-divider"}),i.jsx("div",{className:"toolbar-group",children:i.jsxs("select",{className:"link-tag-select",onChange:E=>{const C=s.find(T=>T.id===E.target.value);C&&w(C),E.target.value=""},defaultValue:"",children:[i.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),s.map(E=>i.jsx("option",{value:E.id,children:E.label},E.id))]})})]})]}),m&&i.jsxs("div",{className:"link-input-bar",children:[i.jsx("input",{type:"url",placeholder:"输入链接地址...",value:h,onChange:E=>f(E.target.value),onKeyDown:E=>E.key==="Enter"&&k(),className:"link-input"}),i.jsx("button",{onClick:k,className:"link-confirm",type:"button",children:"确定"}),i.jsx("button",{onClick:()=>{v.chain().focus().unsetLink().run(),g(!1)},className:"link-remove",type:"button",children:"移除"})]}),i.jsx(L2,{editor:v})]}):null});fx.displayName="RichEditor";const B$=["top","right","bottom","left"],ea=Math.min,Nr=Math.max,Wh=Math.round,Lu=Math.floor,Cs=t=>({x:t,y:t}),V$={left:"right",right:"left",bottom:"top",top:"bottom"},H$={start:"end",end:"start"};function px(t,e,n){return Nr(t,ea(e,n))}function ni(t,e){return typeof t=="function"?t(e):t}function ri(t){return t.split("-")[0]}function pl(t){return t.split("-")[1]}function D0(t){return t==="x"?"y":"x"}function L0(t){return t==="y"?"height":"width"}const W$=new Set(["top","bottom"]);function ks(t){return W$.has(ri(t))?"y":"x"}function _0(t){return D0(ks(t))}function U$(t,e,n){n===void 0&&(n=!1);const r=pl(t),s=_0(t),a=L0(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=Uh(o)),[o,Uh(o)]}function K$(t){const e=Uh(t);return[mx(t),e,mx(e)]}function mx(t){return t.replace(/start|end/g,e=>H$[e])}const Xw=["left","right"],Zw=["right","left"],q$=["top","bottom"],G$=["bottom","top"];function J$(t,e,n){switch(t){case"top":case"bottom":return n?e?Zw:Xw:e?Xw:Zw;case"left":case"right":return e?q$:G$;default:return[]}}function Y$(t,e,n,r){const s=pl(t);let a=J$(ri(t),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(mx)))),a}function Uh(t){return t.replace(/left|right|bottom|top/g,e=>V$[e])}function Q$(t){return{top:0,right:0,bottom:0,left:0,...t}}function EC(t){return typeof t!="number"?Q$(t):{top:t,right:t,bottom:t,left:t}}function Kh(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function eN(t,e,n){let{reference:r,floating:s}=t;const a=ks(e),o=_0(e),c=L0(o),u=ri(e),h=a==="y",f=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,g=r[c]/2-s[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-s.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(pl(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function X$(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:a,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=ni(e,t),v=EC(y),w=c[g?m==="floating"?"reference":"floating":m],k=Kh(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(w)))==null||n?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),E=m==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),T=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},O=Kh(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-O.top+v.top)/T.y,bottom:(O.bottom-k.bottom+v.bottom)/T.y,left:(k.left-O.left+v.left)/T.x,right:(O.right-k.right+v.right)/T.x}}const Z$=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=n,c=a.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:f,y:m}=eN(h,r,u),g=r,y={},v=0;for(let w=0;w({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:a,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=ni(t,e)||{};if(h==null)return{};const m=EC(f),g={x:n,y:r},y=_0(s),v=L0(y),j=await o.getDimensions(h),w=y==="y",k=w?"top":"left",E=w?"bottom":"right",C=w?"clientHeight":"clientWidth",T=a.reference[v]+a.reference[y]-g[y]-a.floating[v],O=g[y]-a.reference[y],B=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let R=B?B[C]:0;(!R||!await(o.isElement==null?void 0:o.isElement(B)))&&(R=c.floating[C]||a.floating[v]);const P=T/2-O/2,I=R/2-j[v]/2-1,L=ea(m[k],I),X=ea(m[E],I),Z=L,Y=R-j[v]-X,W=R/2-j[v]/2+P,D=px(Z,W,Y),$=!u.arrow&&pl(s)!=null&&W!==D&&a.reference[v]/2-(WW<=0)){var X,Z;const W=(((X=a.flip)==null?void 0:X.index)||0)+1,D=R[W];if(D&&(!(m==="alignment"?E!==ks(D):!1)||L.every(_=>ks(_.placement)===E?_.overflows[0]>0:!0)))return{data:{index:W,overflows:L},reset:{placement:D}};let $=(Z=L.filter(ae=>ae.overflows[0]<=0).sort((ae,_)=>ae.overflows[1]-_.overflows[1])[0])==null?void 0:Z.placement;if(!$)switch(y){case"bestFit":{var Y;const ae=(Y=L.filter(_=>{if(B){const se=ks(_.placement);return se===E||se==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(se=>se>0).reduce((se,q)=>se+q,0)]).sort((_,se)=>_[1]-se[1])[0])==null?void 0:Y[0];ae&&($=ae);break}case"initialPlacement":$=c;break}if(s!==$)return{reset:{placement:$}}}return{}}}};function tN(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function nN(t){return B$.some(e=>t[e]>=0)}const nF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...a}=ni(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...a,elementContext:"reference"}),c=tN(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:nN(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...a,altBoundary:!0}),c=tN(o,n.floating);return{data:{escapedOffsets:c,escaped:nN(c)}}}default:return{}}}}},TC=new Set(["left","top"]);async function rF(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ri(n),c=pl(n),u=ks(n)==="y",h=TC.has(o)?-1:1,f=a&&u?-1:1,m=ni(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const sF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:a,placement:o,middlewareData:c}=e,u=await rF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:a+u.y,data:{...u,placement:o}}}}},iF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:a}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:E,y:C}=k;return{x:E,y:C}}},...h}=ni(t,e),f={x:n,y:r},m=await a.detectOverflow(e,h),g=ks(ri(s)),y=D0(g);let v=f[y],j=f[g];if(o){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",C=v+m[k],T=v-m[E];v=px(C,v,T)}if(c){const k=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=j+m[k],T=j-m[E];j=px(C,j,T)}const w=u.fn({...e,[y]:v,[g]:j});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]:o,[g]:c}}}}}},aF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:a,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=ni(t,e),f={x:n,y:r},m=ks(s),g=D0(m);let y=f[g],v=f[m];const j=ni(c,e),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",T=a.reference[g]-a.floating[C]+w.mainAxis,O=a.reference[g]+a.reference[C]-w.mainAxis;yO&&(y=O)}if(h){var k,E;const C=g==="y"?"width":"height",T=TC.has(ri(s)),O=a.reference[m]-a.floating[C]+(T&&((k=o.offset)==null?void 0:k[m])||0)+(T?0:w.crossAxis),B=a.reference[m]+a.reference[C]+(T?0:((E=o.offset)==null?void 0:E[m])||0)-(T?w.crossAxis:0);vB&&(v=B)}return{[g]:y,[m]:v}}}},oF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:a,platform:o,elements:c}=e,{apply:u=()=>{},...h}=ni(t,e),f=await o.detectOverflow(e,h),m=ri(s),g=pl(s),y=ks(s)==="y",{width:v,height:j}=a.floating;let w,k;m==="top"||m==="bottom"?(w=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,w=g==="end"?"top":"bottom");const E=j-f.top-f.bottom,C=v-f.left-f.right,T=ea(j-f[w],E),O=ea(v-f[k],C),B=!e.middlewareData.shift;let R=T,P=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(R=E),B&&!g){const L=Nr(f.left,0),X=Nr(f.right,0),Z=Nr(f.top,0),Y=Nr(f.bottom,0);y?P=v-2*(L!==0||X!==0?L+X:Nr(f.left,f.right)):R=j-2*(Z!==0||Y!==0?Z+Y:Nr(f.top,f.bottom))}await u({...e,availableWidth:P,availableHeight:R});const I=await o.getDimensions(c.floating);return v!==I.width||j!==I.height?{reset:{rects:!0}}:{}}}};function wf(){return typeof window<"u"}function ml(t){return MC(t)?(t.nodeName||"").toLowerCase():"#document"}function Cr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Rs(t){var e;return(e=(MC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function MC(t){return wf()?t instanceof Node||t instanceof Cr(t).Node:!1}function cs(t){return wf()?t instanceof Element||t instanceof Cr(t).Element:!1}function Ms(t){return wf()?t instanceof HTMLElement||t instanceof Cr(t).HTMLElement:!1}function rN(t){return!wf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Cr(t).ShadowRoot}const lF=new Set(["inline","contents"]);function ed(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=ds(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!lF.has(s)}const cF=new Set(["table","td","th"]);function dF(t){return cF.has(ml(t))}const uF=[":popover-open",":modal"];function Nf(t){return uF.some(e=>{try{return t.matches(e)}catch{return!1}})}const hF=["transform","translate","scale","rotate","perspective"],fF=["transform","translate","scale","rotate","perspective","filter"],pF=["paint","layout","strict","content"];function z0(t){const e=$0(),n=cs(t)?ds(t):t;return hF.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||fF.some(r=>(n.willChange||"").includes(r))||pF.some(r=>(n.contain||"").includes(r))}function mF(t){let e=ta(t);for(;Ms(e)&&!al(e);){if(z0(e))return e;if(Nf(e))return null;e=ta(e)}return null}function $0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const gF=new Set(["html","body","#document"]);function al(t){return gF.has(ml(t))}function ds(t){return Cr(t).getComputedStyle(t)}function jf(t){return cs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ta(t){if(ml(t)==="html")return t;const e=t.assignedSlot||t.parentNode||rN(t)&&t.host||Rs(t);return rN(e)?e.host:e}function AC(t){const e=ta(t);return al(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ms(e)&&ed(e)?e:AC(e)}function Vc(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=AC(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=Cr(s);if(a){const c=gx(o);return e.concat(o,o.visualViewport||[],ed(s)?s:[],c&&n?Vc(c):[])}return e.concat(s,Vc(s,[],n))}function gx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function RC(t){const e=ds(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Ms(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,c=Wh(n)!==a||Wh(r)!==o;return c&&(n=a,r=o),{width:n,height:r,$:c}}function F0(t){return cs(t)?t:t.contextElement}function Qo(t){const e=F0(t);if(!Ms(e))return Cs(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=RC(e);let o=(a?Wh(n.width):n.width)/r,c=(a?Wh(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const xF=Cs(0);function PC(t){const e=Cr(t);return!$0()||!e.visualViewport?xF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function yF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Cr(t)?!1:e}function Za(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=F0(t);let o=Cs(1);e&&(r?cs(r)&&(o=Qo(r)):o=Qo(t));const c=yF(a,n,r)?PC(a):Cs(0);let u=(s.left+c.x)/o.x,h=(s.top+c.y)/o.y,f=s.width/o.x,m=s.height/o.y;if(a){const g=Cr(a),y=r&&cs(r)?Cr(r):r;let v=g,j=gx(v);for(;j&&r&&y!==v;){const w=Qo(j),k=j.getBoundingClientRect(),E=ds(j),C=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,T=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;u*=w.x,h*=w.y,f*=w.x,m*=w.y,u+=C,h+=T,v=Cr(j),j=gx(v)}}return Kh({width:f,height:m,x:u,y:h})}function kf(t,e){const n=jf(t).scrollLeft;return e?e.left+n:Za(Rs(t)).left+n}function IC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-kf(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function vF(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",o=Rs(r),c=e?Nf(e.floating):!1;if(r===o||c&&a)return n;let u={scrollLeft:0,scrollTop:0},h=Cs(1);const f=Cs(0),m=Ms(r);if((m||!m&&!a)&&((ml(r)!=="body"||ed(o))&&(u=jf(r)),Ms(r))){const y=Za(r);h=Qo(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!a?IC(o,u):Cs(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function bF(t){return Array.from(t.getClientRects())}function wF(t){const e=Rs(t),n=jf(t),r=t.ownerDocument.body,s=Nr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=Nr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+kf(t);const c=-n.scrollTop;return ds(r).direction==="rtl"&&(o+=Nr(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:c}}const sN=25;function NF(t,e){const n=Cr(t),r=Rs(t),s=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,c=0,u=0;if(s){a=s.width,o=s.height;const f=$0();(!f||f&&e==="fixed")&&(c=s.offsetLeft,u=s.offsetTop)}const h=kf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-y);v<=sN&&(a-=v)}else h<=sN&&(a+=h);return{width:a,height:o,x:c,y:u}}const jF=new Set(["absolute","fixed"]);function kF(t,e){const n=Za(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=Ms(t)?Qo(t):Cs(1),o=t.clientWidth*a.x,c=t.clientHeight*a.y,u=s*a.x,h=r*a.y;return{width:o,height:c,x:u,y:h}}function iN(t,e,n){let r;if(e==="viewport")r=NF(t,n);else if(e==="document")r=wF(Rs(t));else if(cs(e))r=kF(e,n);else{const s=PC(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Kh(r)}function OC(t,e){const n=ta(t);return n===e||!cs(n)||al(n)?!1:ds(n).position==="fixed"||OC(n,e)}function SF(t,e){const n=e.get(t);if(n)return n;let r=Vc(t,[],!1).filter(c=>cs(c)&&ml(c)!=="body"),s=null;const a=ds(t).position==="fixed";let o=a?ta(t):t;for(;cs(o)&&!al(o);){const c=ds(o),u=z0(o);!u&&c.position==="fixed"&&(s=null),(a?!u&&!s:!u&&c.position==="static"&&!!s&&jF.has(s.position)||ed(o)&&!u&&OC(t,o))?r=r.filter(f=>f!==o):s=c,o=ta(o)}return e.set(t,r),r}function CF(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?Nf(e)?[]:SF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=iN(e,f,s);return h.top=Nr(m.top,h.top),h.right=ea(m.right,h.right),h.bottom=ea(m.bottom,h.bottom),h.left=Nr(m.left,h.left),h},iN(e,c,s));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function EF(t){const{width:e,height:n}=RC(t);return{width:e,height:n}}function TF(t,e,n){const r=Ms(e),s=Rs(e),a=n==="fixed",o=Za(t,!0,a,e);let c={scrollLeft:0,scrollTop:0};const u=Cs(0);function h(){u.x=kf(s)}if(r||!r&&!a)if((ml(e)!=="body"||ed(s))&&(c=jf(e)),r){const y=Za(e,!0,a,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else s&&h();a&&!r&&s&&h();const f=s&&!r&&!a?IC(s,c):Cs(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function og(t){return ds(t).position==="static"}function aN(t,e){if(!Ms(t)||ds(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Rs(t)===n&&(n=n.ownerDocument.body),n}function DC(t,e){const n=Cr(t);if(Nf(t))return n;if(!Ms(t)){let s=ta(t);for(;s&&!al(s);){if(cs(s)&&!og(s))return s;s=ta(s)}return n}let r=aN(t,e);for(;r&&dF(r)&&og(r);)r=aN(r,e);return r&&al(r)&&og(r)&&!z0(r)?n:r||mF(t)||n}const MF=async function(t){const e=this.getOffsetParent||DC,n=this.getDimensions,r=await n(t.floating);return{reference:TF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function AF(t){return ds(t).direction==="rtl"}const RF={convertOffsetParentRelativeRectToViewportRelativeRect:vF,getDocumentElement:Rs,getClippingRect:CF,getOffsetParent:DC,getElementRects:MF,getClientRects:bF,getDimensions:EF,getScale:Qo,isElement:cs,isRTL:AF};function LC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function PF(t,e){let n=null,r;const s=Rs(t);function a(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),a();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const v=Lu(m),j=Lu(s.clientWidth-(f+g)),w=Lu(s.clientHeight-(m+y)),k=Lu(f),C={rootMargin:-v+"px "+-j+"px "+-w+"px "+-k+"px",threshold:Nr(0,ea(1,u))||1};let T=!0;function O(B){const R=B[0].intersectionRatio;if(R!==u){if(!T)return o();R?o(!1,R):r=setTimeout(()=>{o(!1,1e-7)},1e3)}R===1&&!LC(h,t.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(O,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(t)}return o(!0),a}function IF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=F0(t),f=s||a?[...h?Vc(h):[],...Vc(e)]:[];f.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const m=h&&c?PF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[E]=k;E&&E.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let v,j=u?Za(t):null;u&&w();function w(){const k=Za(t);j&&!LC(j,k)&&n(),j=k,v=requestAnimationFrame(w)}return n(),()=>{var k;f.forEach(E=>{s&&E.removeEventListener("scroll",n),a&&E.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const OF=sF,DF=iF,LF=tF,_F=oF,zF=nF,oN=eF,$F=aF,FF=(t,e,n)=>{const r=new Map,s={platform:RF,...n},a={...s.platform,_c:r};return Z$(t,e,{...s,platform:a})};var BF=typeof document<"u",VF=function(){},Ku=BF?b.useLayoutEffect:VF;function qh(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!qh(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&t.$$typeof)&&!qh(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function _C(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function lN(t,e){const n=_C(t);return Math.round(e*n)/n}function lg(t){const e=b.useRef(t);return Ku(()=>{e.current=t}),e}function HF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);qh(g,r)||y(r);const[v,j]=b.useState(null),[w,k]=b.useState(null),E=b.useCallback(_=>{_!==B.current&&(B.current=_,j(_))},[]),C=b.useCallback(_=>{_!==R.current&&(R.current=_,k(_))},[]),T=a||v,O=o||w,B=b.useRef(null),R=b.useRef(null),P=b.useRef(f),I=u!=null,L=lg(u),X=lg(s),Z=lg(h),Y=b.useCallback(()=>{if(!B.current||!R.current)return;const _={placement:e,strategy:n,middleware:g};X.current&&(_.platform=X.current),FF(B.current,R.current,_).then(se=>{const q={...se,isPositioned:Z.current!==!1};W.current&&!qh(P.current,q)&&(P.current=q,Wc.flushSync(()=>{m(q)}))})},[g,e,n,X,Z]);Ku(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(_=>({..._,isPositioned:!1})))},[h]);const W=b.useRef(!1);Ku(()=>(W.current=!0,()=>{W.current=!1}),[]),Ku(()=>{if(T&&(B.current=T),O&&(R.current=O),T&&O){if(L.current)return L.current(T,O,Y);Y()}},[T,O,Y,L,I]);const D=b.useMemo(()=>({reference:B,floating:R,setReference:E,setFloating:C}),[E,C]),$=b.useMemo(()=>({reference:T,floating:O}),[T,O]),ae=b.useMemo(()=>{const _={position:n,left:0,top:0};if(!$.floating)return _;const se=lN($.floating,f.x),q=lN($.floating,f.y);return c?{..._,transform:"translate("+se+"px, "+q+"px)",..._C($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:se,top:q}},[n,c,$.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:Y,refs:D,elements:$,floatingStyles:ae}),[f,Y,D,$,ae])}const WF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?oN({element:r.current,padding:s}).fn(n):{}:r?oN({element:r,padding:s}).fn(n):{}}}},UF=(t,e)=>({...OF(t),options:[t,e]}),KF=(t,e)=>({...DF(t),options:[t,e]}),qF=(t,e)=>({...$F(t),options:[t,e]}),GF=(t,e)=>({...LF(t),options:[t,e]}),JF=(t,e)=>({..._F(t),options:[t,e]}),YF=(t,e)=>({...zF(t),options:[t,e]}),QF=(t,e)=>({...WF(t),options:[t,e]});var XF="Arrow",zC=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...a}=t;return i.jsx(at.svg,{...a,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});zC.displayName=XF;var ZF=zC,B0="Popper",[$C,FC]=ia(B0),[eB,BC]=$C(B0),VC=t=>{const{__scopePopper:e,children:n}=t,[r,s]=b.useState(null);return i.jsx(eB,{scope:e,anchor:r,onAnchorChange:s,children:n})};VC.displayName=B0;var HC="PopperAnchor",WC=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=BC(HC,n),o=b.useRef(null),c=vt(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&a.onAnchorChange(u.current)}),r?null:i.jsx(at.div,{...s,ref:c})});WC.displayName=HC;var V0="PopperContent",[tB,nB]=$C(V0),UC=b.forwardRef((t,e)=>{var oe,ue,ye,V,ge,Me;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:v,...j}=t,w=BC(V0,n),[k,E]=b.useState(null),C=vt(e,tt=>E(tt)),[T,O]=b.useState(null),B=Vx(T),R=(B==null?void 0:B.width)??0,P=(B==null?void 0:B.height)??0,I=r+(a!=="center"?"-"+a:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},X=Array.isArray(h)?h:[h],Z=X.length>0,Y={padding:L,boundary:X.filter(sB),altBoundary:Z},{refs:W,floatingStyles:D,placement:$,isPositioned:ae,middlewareData:_}=HF({strategy:"fixed",placement:I,whileElementsMounted:(...tt)=>IF(...tt,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[UF({mainAxis:s+P,alignmentAxis:o}),u&&KF({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?qF():void 0,...Y}),u&&GF({...Y}),JF({...Y,apply:({elements:tt,rects:et,availableWidth:ot,availableHeight:Ge})=>{const{width:dt,height:Et}=et.reference,ht=tt.floating.style;ht.setProperty("--radix-popper-available-width",`${ot}px`),ht.setProperty("--radix-popper-available-height",`${Ge}px`),ht.setProperty("--radix-popper-anchor-width",`${dt}px`),ht.setProperty("--radix-popper-anchor-height",`${Et}px`)}}),T&&QF({element:T,padding:c}),iB({arrowWidth:R,arrowHeight:P}),g&&YF({strategy:"referenceHidden",...Y})]}),[se,q]=GC($),z=Qi(v);Un(()=>{ae&&(z==null||z())},[ae,z]);const H=(oe=_.arrow)==null?void 0:oe.x,de=(ue=_.arrow)==null?void 0:ue.y,K=((ye=_.arrow)==null?void 0:ye.centerOffset)!==0,[fe,Q]=b.useState();return Un(()=>{k&&Q(window.getComputedStyle(k).zIndex)},[k]),i.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:ae?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(V=_.transformOrigin)==null?void 0:V.x,(ge=_.transformOrigin)==null?void 0:ge.y].join(" "),...((Me=_.hide)==null?void 0:Me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(tB,{scope:n,placedSide:se,onArrowChange:O,arrowX:H,arrowY:de,shouldHideArrow:K,children:i.jsx(at.div,{"data-side":se,"data-align":q,...j,ref:C,style:{...j.style,animation:ae?void 0:"none"}})})})});UC.displayName=V0;var KC="PopperArrow",rB={top:"bottom",right:"left",bottom:"top",left:"right"},qC=b.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=nB(KC,r),o=rB[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(ZF,{...s,ref:n,style:{...s.style,display:"block"}})})});qC.displayName=KC;function sB(t){return t!==null}var iB=t=>({name:"transformOrigin",options:t,fn(e){var w,k,E;const{placement:n,rects:r,middlewareData:s}=e,o=((w=s.arrow)==null?void 0:w.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=GC(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=s.arrow)==null?void 0:k.x)??0)+c/2,y=(((E=s.arrow)==null?void 0:E.y)??0)+u/2;let v="",j="";return h==="bottom"?(v=o?m:`${g}px`,j=`${-u}px`):h==="top"?(v=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,j=o?m:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,j=o?m:`${y}px`),{data:{x:v,y:j}}}});function GC(t){const[e,n="center"]=t.split("-");return[e,n]}var aB=VC,oB=WC,lB=UC,cB=qC,JC=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),dB="VisuallyHidden",uB=b.forwardRef((t,e)=>i.jsx(at.span,{...t,ref:e,style:{...JC,...t.style}}));uB.displayName=dB;var hB=[" ","Enter","ArrowUp","ArrowDown"],fB=[" ","Enter"],eo="Select",[Sf,Cf,pB]=$x(eo),[gl]=ia(eo,[pB,FC]),Ef=FC(),[mB,ca]=gl(eo),[gB,xB]=gl(eo),YC=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:a,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:v}=t,j=Ef(e),[w,k]=b.useState(null),[E,C]=b.useState(null),[T,O]=b.useState(!1),B=ef(h),[R,P]=Wa({prop:r,defaultProp:s??!1,onChange:a,caller:eo}),[I,L]=Wa({prop:o,defaultProp:c,onChange:u,caller:eo}),X=b.useRef(null),Z=w?v||!!w.closest("form"):!0,[Y,W]=b.useState(new Set),D=Array.from(Y).map($=>$.props.value).join(";");return i.jsx(aB,{...j,children:i.jsxs(mB,{required:y,scope:e,trigger:w,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:T,onValueNodeHasChildrenChange:O,contentId:Ki(),value:I,onValueChange:L,open:R,onOpenChange:P,dir:B,triggerPointerDownPosRef:X,disabled:g,children:[i.jsx(Sf.Provider,{scope:e,children:i.jsx(gB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback($=>{W(ae=>new Set(ae).add($))},[]),onNativeOptionRemove:b.useCallback($=>{W(ae=>{const _=new Set(ae);return _.delete($),_})},[]),children:n})}),Z?i.jsxs(yE,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:I,onChange:$=>L($.target.value),disabled:g,form:v,children:[I===void 0?i.jsx("option",{value:""}):null,Array.from(Y)]},D):null]})})};YC.displayName=eo;var QC="SelectTrigger",XC=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,a=Ef(n),o=ca(QC,n),c=o.disabled||r,u=vt(e,o.onTriggerChange),h=Cf(n),f=b.useRef("touch"),[m,g,y]=bE(j=>{const w=h().filter(C=>!C.disabled),k=w.find(C=>C.value===o.value),E=wE(w,j,k);E!==void 0&&o.onValueChange(E.value)}),v=j=>{c||(o.onOpenChange(!0),y()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return i.jsx(oB,{asChild:!0,...a,children:i.jsx(at.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":vE(o.value)?"":void 0,...s,ref:u,onClick:rt(s.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&v(j)}),onPointerDown:rt(s.onPointerDown,j=>{f.current=j.pointerType;const w=j.target;w.hasPointerCapture(j.pointerId)&&w.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(v(j),j.preventDefault())}),onKeyDown:rt(s.onKeyDown,j=>{const w=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(w&&j.key===" ")&&hB.includes(j.key)&&(v(),j.preventDefault())})})})});XC.displayName=QC;var ZC="SelectValue",eE=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:o="",...c}=t,u=ca(ZC,n),{onValueNodeHasChildrenChange:h}=u,f=a!==void 0,m=vt(e,u.onValueNodeChange);return Un(()=>{h(f)},[h,f]),i.jsx(at.span,{...c,ref:m,style:{pointerEvents:"none"},children:vE(u.value)?i.jsx(i.Fragment,{children:o}):a})});eE.displayName=ZC;var yB="SelectIcon",tE=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return i.jsx(at.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});tE.displayName=yB;var vB="SelectPortal",nE=t=>i.jsx(Ox,{asChild:!0,...t});nE.displayName=vB;var to="SelectContent",rE=b.forwardRef((t,e)=>{const n=ca(to,t.__scopeSelect),[r,s]=b.useState();if(Un(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Wc.createPortal(i.jsx(sE,{scope:t.__scopeSelect,children:i.jsx(Sf.Slot,{scope:t.__scopeSelect,children:i.jsx("div",{children:t.children})})}),a):null}return i.jsx(iE,{...t,ref:e})});rE.displayName=to;var rs=10,[sE,da]=gl(to),bB="SelectContentImpl",wB=Mc("SelectContent.RemoveScroll"),iE=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w,...k}=t,E=ca(to,n),[C,T]=b.useState(null),[O,B]=b.useState(null),R=vt(e,oe=>T(oe)),[P,I]=b.useState(null),[L,X]=b.useState(null),Z=Cf(n),[Y,W]=b.useState(!1),D=b.useRef(!1);b.useEffect(()=>{if(C)return vj(C)},[C]),dj();const $=b.useCallback(oe=>{const[ue,...ye]=Z().map(Me=>Me.ref.current),[V]=ye.slice(-1),ge=document.activeElement;for(const Me of oe)if(Me===ge||(Me==null||Me.scrollIntoView({block:"nearest"}),Me===ue&&O&&(O.scrollTop=0),Me===V&&O&&(O.scrollTop=O.scrollHeight),Me==null||Me.focus(),document.activeElement!==ge))return},[Z,O]),ae=b.useCallback(()=>$([P,C]),[$,P,C]);b.useEffect(()=>{Y&&ae()},[Y,ae]);const{onOpenChange:_,triggerPointerDownPosRef:se}=E;b.useEffect(()=>{if(C){let oe={x:0,y:0};const ue=V=>{var ge,Me;oe={x:Math.abs(Math.round(V.pageX)-(((ge=se.current)==null?void 0:ge.x)??0)),y:Math.abs(Math.round(V.pageY)-(((Me=se.current)==null?void 0:Me.y)??0))}},ye=V=>{oe.x<=10&&oe.y<=10?V.preventDefault():C.contains(V.target)||_(!1),document.removeEventListener("pointermove",ue),se.current=null};return se.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",ye,{capture:!0})}}},[C,_,se]),b.useEffect(()=>{const oe=()=>_(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[_]);const[q,z]=bE(oe=>{const ue=Z().filter(ge=>!ge.disabled),ye=ue.find(ge=>ge.ref.current===document.activeElement),V=wE(ue,oe,ye);V&&setTimeout(()=>V.ref.current.focus())}),H=b.useCallback((oe,ue,ye)=>{const V=!D.current&&!ye;(E.value!==void 0&&E.value===ue||V)&&(I(oe),V&&(D.current=!0))},[E.value]),de=b.useCallback(()=>C==null?void 0:C.focus(),[C]),K=b.useCallback((oe,ue,ye)=>{const V=!D.current&&!ye;(E.value!==void 0&&E.value===ue||V)&&X(oe)},[E.value]),fe=r==="popper"?xx:aE,Q=fe===xx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w}:{};return i.jsx(sE,{scope:n,content:C,viewport:O,onViewportChange:B,itemRefCallback:H,selectedItem:P,onItemLeave:de,itemTextRefCallback:K,focusSelectedItem:ae,selectedItemText:L,position:r,isPositioned:Y,searchRef:q,children:i.jsx(Dx,{as:wB,allowPinchZoom:!0,children:i.jsx(Ix,{asChild:!0,trapped:E.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:rt(s,oe=>{var ue;(ue=E.trigger)==null||ue.focus({preventScroll:!0}),oe.preventDefault()}),children:i.jsx(Px,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:i.jsx(fe,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:oe=>oe.preventDefault(),...k,...Q,onPlaced:()=>W(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:rt(k.onKeyDown,oe=>{const ue=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!ue&&oe.key.length===1&&z(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let V=Z().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(V=V.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){const ge=oe.target,Me=V.indexOf(ge);V=V.slice(Me+1)}setTimeout(()=>$(V)),oe.preventDefault()}})})})})})})});iE.displayName=bB;var NB="SelectItemAlignedPosition",aE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,a=ca(to,n),o=da(to,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=vt(e,R=>f(R)),g=Cf(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:j,selectedItem:w,selectedItemText:k,focusSelectedItem:E}=o,C=b.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&h&&j&&w&&k){const R=a.trigger.getBoundingClientRect(),P=h.getBoundingClientRect(),I=a.valueNode.getBoundingClientRect(),L=k.getBoundingClientRect();if(a.dir!=="rtl"){const ge=L.left-P.left,Me=I.left-ge,tt=R.left-Me,et=R.width+tt,ot=Math.max(et,P.width),Ge=window.innerWidth-rs,dt=eh(Me,[rs,Math.max(rs,Ge-ot)]);c.style.minWidth=et+"px",c.style.left=dt+"px"}else{const ge=P.right-L.right,Me=window.innerWidth-I.right-ge,tt=window.innerWidth-R.right-Me,et=R.width+tt,ot=Math.max(et,P.width),Ge=window.innerWidth-rs,dt=eh(Me,[rs,Math.max(rs,Ge-ot)]);c.style.minWidth=et+"px",c.style.right=dt+"px"}const X=g(),Z=window.innerHeight-rs*2,Y=j.scrollHeight,W=window.getComputedStyle(h),D=parseInt(W.borderTopWidth,10),$=parseInt(W.paddingTop,10),ae=parseInt(W.borderBottomWidth,10),_=parseInt(W.paddingBottom,10),se=D+$+Y+_+ae,q=Math.min(w.offsetHeight*5,se),z=window.getComputedStyle(j),H=parseInt(z.paddingTop,10),de=parseInt(z.paddingBottom,10),K=R.top+R.height/2-rs,fe=Z-K,Q=w.offsetHeight/2,oe=w.offsetTop+Q,ue=D+$+oe,ye=se-ue;if(ue<=K){const ge=X.length>0&&w===X[X.length-1].ref.current;c.style.bottom="0px";const Me=h.clientHeight-j.offsetTop-j.offsetHeight,tt=Math.max(fe,Q+(ge?de:0)+Me+ae),et=ue+tt;c.style.height=et+"px"}else{const ge=X.length>0&&w===X[0].ref.current;c.style.top="0px";const tt=Math.max(K,D+j.offsetTop+(ge?H:0)+Q)+ye;c.style.height=tt+"px",j.scrollTop=ue-K+j.offsetTop}c.style.margin=`${rs}px 0`,c.style.minHeight=q+"px",c.style.maxHeight=Z+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,a.trigger,a.valueNode,c,h,j,w,k,a.dir,r]);Un(()=>C(),[C]);const[T,O]=b.useState();Un(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const B=b.useCallback(R=>{R&&v.current===!0&&(C(),E==null||E(),v.current=!1)},[C,E]);return i.jsx(kB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:B,children:i.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:i.jsx(at.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});aE.displayName=NB;var jB="SelectPopperPosition",xx=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=rs,...a}=t,o=Ef(n);return i.jsx(lB,{...o,...a,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xx.displayName=jB;var[kB,H0]=gl(to,{}),yx="SelectViewport",oE=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,a=da(yx,n),o=H0(yx,n),c=vt(e,a.onViewportChange),u=b.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(Sf.Slot,{scope:n,children:i.jsx(at.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:rt(s.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const v=window.innerHeight-rs*2,j=parseFloat(m.style.minHeight),w=parseFloat(m.style.height),k=Math.max(j,w);if(k0?T:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});oE.displayName=yx;var lE="SelectGroup",[SB,CB]=gl(lE),EB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ki();return i.jsx(SB,{scope:n,id:s,children:i.jsx(at.div,{role:"group","aria-labelledby":s,...r,ref:e})})});EB.displayName=lE;var cE="SelectLabel",TB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=CB(cE,n);return i.jsx(at.div,{id:s.id,...r,ref:e})});TB.displayName=cE;var Gh="SelectItem",[MB,dE]=gl(Gh),uE=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...o}=t,c=ca(Gh,n),u=da(Gh,n),h=c.value===r,[f,m]=b.useState(a??""),[g,y]=b.useState(!1),v=vt(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,s)}),j=Ki(),w=b.useRef("touch"),k=()=>{s||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(MB,{scope:n,value:r,disabled:s,textId:j,isSelected:h,onItemTextChange:b.useCallback(E=>{m(C=>C||((E==null?void 0:E.textContent)??"").trim())},[]),children:i.jsx(Sf.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:i.jsx(at.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:v,onFocus:rt(o.onFocus,()=>y(!0)),onBlur:rt(o.onBlur,()=>y(!1)),onClick:rt(o.onClick,()=>{w.current!=="mouse"&&k()}),onPointerUp:rt(o.onPointerUp,()=>{w.current==="mouse"&&k()}),onPointerDown:rt(o.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:rt(o.onPointerMove,E=>{var C;w.current=E.pointerType,s?(C=u.onItemLeave)==null||C.call(u):w.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:rt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:rt(o.onKeyDown,E=>{var T;((T=u.searchRef)==null?void 0:T.current)!==""&&E.key===" "||(fB.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});uE.displayName=Gh;var uc="SelectItemText",hE=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...a}=t,o=ca(uc,n),c=da(uc,n),u=dE(uc,n),h=xB(uc,n),[f,m]=b.useState(null),g=vt(e,k=>m(k),u.onItemTextChange,k=>{var E;return(E=c.itemTextRefCallback)==null?void 0:E.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,v=b.useMemo(()=>i.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:w}=h;return Un(()=>(j(v),()=>w(v)),[j,w,v]),i.jsxs(i.Fragment,{children:[i.jsx(at.span,{id:u.textId,...a,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Wc.createPortal(a.children,o.valueNode):null]})});hE.displayName=uc;var fE="SelectItemIndicator",pE=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return dE(fE,n).isSelected?i.jsx(at.span,{"aria-hidden":!0,...r,ref:e}):null});pE.displayName=fE;var vx="SelectScrollUpButton",mE=b.forwardRef((t,e)=>{const n=da(vx,t.__scopeSelect),r=H0(vx,t.__scopeSelect),[s,a]=b.useState(!1),o=vt(e,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;a(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(xE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});mE.displayName=vx;var bx="SelectScrollDownButton",gE=b.forwardRef((t,e)=>{const n=da(bx,t.__scopeSelect),r=H0(bx,t.__scopeSelect),[s,a]=b.useState(!1),o=vt(e,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(xE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});gE.displayName=bx;var xE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,a=da("SelectScrollButton",n),o=b.useRef(null),c=Cf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),Un(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),i.jsx(at.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:rt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:rt(s.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:rt(s.onPointerLeave,()=>{u()})})}),AB="SelectSeparator",RB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return i.jsx(at.div,{"aria-hidden":!0,...r,ref:e})});RB.displayName=AB;var wx="SelectArrow",PB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ef(n),a=ca(wx,n),o=da(wx,n);return a.open&&o.position==="popper"?i.jsx(cB,{...s,...r,ref:e}):null});PB.displayName=wx;var IB="SelectBubbleInput",yE=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=b.useRef(null),a=vt(r,s),o=Bx(e);return b.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),i.jsx(at.select,{...n,style:{...JC,...n.style},ref:a,defaultValue:e})});yE.displayName=IB;function vE(t){return t===""||t===void 0}function bE(t){const e=Qi(t),n=b.useRef(""),r=b.useRef(0),s=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),a=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function wE(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=OB(t,Math.max(a,0));s.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function OB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var DB=YC,NE=XC,LB=eE,_B=tE,zB=nE,jE=rE,$B=oE,kE=uE,FB=hE,BB=pE,VB=mE,HB=gE;const sc=DB,ic=LB,Bo=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(NE,{ref:r,className:bt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,i.jsx(_B,{asChild:!0,children:i.jsx(Ec,{className:"h-4 w-4 opacity-50"})})]}));Bo.displayName=NE.displayName;const Vo=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>i.jsx(zB,{children:i.jsxs(jE,{ref:s,className:bt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[i.jsx(VB,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(DN,{className:"h-4 w-4"})}),i.jsx($B,{className:"p-1",children:e}),i.jsx(HB,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(Ec,{className:"h-4 w-4"})})]})}));Vo.displayName=jE.displayName;const bs=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(kE,{ref:r,className:bt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(BB,{children:i.jsx(Uc,{className:"h-4 w-4"})})}),i.jsx(FB,{children:e})]}));bs.displayName=kE.displayName;const WB=["一","二","三","四","五","六","七","八","九","十"];function cg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function UB({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:s,onDeleteSection:a,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:v,pinnedSectionIds:j=[]}){const[w,k]=b.useState(null),[E,C]=b.useState(null),T=(L,X)=>(w==null?void 0:w.type)===L&&(w==null?void 0:w.id)===X,O=(L,X)=>(E==null?void 0:E.type)===L&&(E==null?void 0:E.id)===X,B=b.useCallback(()=>{const L=[];for(const X of t)for(const Z of X.chapters)for(const Y of Z.sections)L.push({id:Y.id,partId:X.id,partTitle:X.title,chapterId:Z.id,chapterTitle:Z.title});return L},[t]),R=b.useCallback(async(L,X,Z,Y)=>{var _;L.preventDefault(),L.stopPropagation();const W=L.dataTransfer.getData("text/plain"),D=cg(W);if(!D||D.type===X&&D.id===Z)return;const $=B(),ae=new Map($.map(se=>[se.id,se]));if(D.type==="part"&&X==="part"){const se=t.map(K=>K.id),q=se.indexOf(D.id),z=se.indexOf(Z);if(q===-1||z===-1)return;const H=[...se];H.splice(q,1),H.splice(qQ.id===K);if(fe)for(const Q of fe.chapters)for(const oe of Q.sections){const ue=ae.get(oe.id);ue&&de.push(ue)}}await r(de);return}if(D.type==="chapter"&&(X==="chapter"||X==="section"||X==="part")){const se=t.find(ue=>ue.chapters.some(ye=>ye.id===D.id)),q=se==null?void 0:se.chapters.find(ue=>ue.id===D.id);if(!se||!q)return;let z,H,de=null;if(X==="section"){const ue=ae.get(Z);if(!ue)return;z=ue.partId,H=ue.partTitle,de=Z}else if(X==="chapter"){const ue=t.find(ge=>ge.chapters.some(Me=>Me.id===Z)),ye=ue==null?void 0:ue.chapters.find(ge=>ge.id===Z);if(!ue||!ye)return;z=ue.id,H=ue.title;const V=$.filter(ge=>ge.chapterId===Z).pop();de=(V==null?void 0:V.id)??null}else{const ue=t.find(V=>V.id===Z);if(!ue||!ue.chapters[0])return;z=ue.id,H=ue.title;const ye=$.filter(V=>V.partId===ue.id&&V.chapterId===ue.chapters[0].id);de=((_=ye[ye.length-1])==null?void 0:_.id)??null}const K=q.sections.map(ue=>ue.id),fe=$.filter(ue=>!K.includes(ue.id));let Q=fe.length;if(de){const ue=fe.findIndex(ye=>ye.id===de);ue>=0&&(Q=ue+1)}const oe=K.map(ue=>({...ae.get(ue),partId:z,partTitle:H,chapterId:q.id,chapterTitle:q.title}));await r([...fe.slice(0,Q),...oe,...fe.slice(Q)]);return}if(D.type==="section"&&(X==="section"||X==="chapter"||X==="part")){if(!Y)return;const{partId:se,partTitle:q,chapterId:z,chapterTitle:H}=Y;let de;if(X==="section")de=$.findIndex(ye=>ye.id===Z);else if(X==="chapter"){const ye=$.filter(V=>V.chapterId===Z).pop();de=ye?$.findIndex(V=>V.id===ye.id)+1:$.length}else{const ye=t.find(Me=>Me.id===Z);if(!(ye!=null&&ye.chapters[0]))return;const V=$.filter(Me=>Me.partId===ye.id&&Me.chapterId===ye.chapters[0].id),ge=V[V.length-1];de=ge?$.findIndex(Me=>Me.id===ge.id)+1:0}const K=$.findIndex(ye=>ye.id===D.id);if(K===-1)return;const fe=$.filter(ye=>ye.id!==D.id),Q=K({onDragEnter:Y=>{Y.preventDefault(),Y.stopPropagation(),Y.dataTransfer.dropEffect="move",C({type:L,id:X})},onDragOver:Y=>{Y.preventDefault(),Y.stopPropagation(),Y.dataTransfer.dropEffect="move",C({type:L,id:X})},onDragLeave:()=>C(null),onDrop:Y=>{C(null);const W=cg(Y.dataTransfer.getData("text/plain"));if(W&&!(L==="section"&&W.type==="section"&&W.id===X))if(L==="part")if(W.type==="part")R(Y,"part",X);else{const D=t.find(ae=>ae.id===X);(D==null?void 0:D.chapters[0])&&Z&&R(Y,"part",X,Z)}else L==="chapter"&&Z?(W.type==="section"||W.type==="chapter")&&R(Y,"chapter",X,Z):L==="section"&&Z&&R(Y,"section",X,Z)}}),I=L=>WB[L]??String(L+1);return i.jsx("div",{className:"space-y-3",children:t.map((L,X)=>{var q,z,H,de;const Z=L.title==="序言"||L.title.includes("序言"),Y=L.title==="尾声"||L.title.includes("尾声"),W=L.title==="附录"||L.title.includes("附录"),D=O("part",L.id),$=e.includes(L.id),ae=L.chapters.length,_=L.chapters.reduce((K,fe)=>K+fe.sections.length,0);if(Z&&L.chapters.length===1&&L.chapters[0].sections.length===1){const K=L.chapters[0].sections[0],fe=O("section",K.id),Q={partId:L.id,partTitle:L.title,chapterId:L.chapters[0].id,chapterTitle:L.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:oe=>{oe.stopPropagation(),oe.dataTransfer.setData("text/plain","section:"+K.id),oe.dataTransfer.effectAllowed="move",k({type:"section",id:K.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${fe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",K.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx(Vs,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:oe=>oe.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(K.id),onChange:()=>y(K.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:i.jsx(Hr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[L.chapters[0].title," | ",K.title]}),j.includes(K.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Uo,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:oe=>oe.stopPropagation(),onClick:oe=>oe.stopPropagation(),children:[K.price===0||K.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",K.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",K.clickCount??0," · 付款 ",K.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(K.hotScore??0).toFixed(1)," · 第",K.hotRank&&K.hotRank>0?K.hotRank:"-","名"]}),v&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(K),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(K),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]})]},L.id)}if(L.title==="2026每日派对干货"||L.title.includes("2026每日派对干货")){const K=O("part",L.id);return i.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${K?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...P("part",L.id,{partId:L.id,partTitle:L.title,chapterId:((q=L.chapters[0])==null?void 0:q.id)??"",chapterTitle:((z=L.chapters[0])==null?void 0:z.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:fe=>{fe.stopPropagation(),fe.dataTransfer.setData("text/plain","part:"+L.id),fe.dataTransfer.effectAllowed="move",k({type:"part",id:L.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",L.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(L.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(Vs,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),i.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:L.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",_," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:fe=>fe.stopPropagation(),onClick:fe=>fe.stopPropagation(),children:[o&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Ft,{className:"w-3.5 h-3.5"})}),h&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(L),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(wn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[ae,"章"]}),$?i.jsx(Ec,{className:"w-5 h-5 text-gray-500"}):i.jsx(Ho,{className:"w-5 h-5 text-gray-500"})]})]}),$&&L.chapters.length>0&&i.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:L.chapters.map(fe=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:fe.title}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(L,fe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>c(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Ft,{className:"w-3.5 h-3.5"})}),u&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(L,fe),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:fe.sections.map(Q=>{const oe=O("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:ue=>{ue.stopPropagation(),ue.dataTransfer.setData("text/plain","section:"+Q.id),ue.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",Q.id,{partId:L.id,partTitle:L.title,chapterId:fe.id,chapterTitle:fe.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ue=>ue.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Q.id," ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Uo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]},Q.id)})})]},fe.id))})]},L.id)}if(W)return i.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),i.jsx("div",{className:"space-y-3",children:L.chapters.map((K,fe)=>K.sections.length>0?K.sections.map(Q=>{const oe=O("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:ue=>{ue.stopPropagation(),ue.dataTransfer.setData("text/plain","section:"+Q.id),ue.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",Q.id,{partId:L.id,partTitle:L.title,chapterId:K.id,chapterTitle:K.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ue=>ue.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",fe+1," | ",K.title," | ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Uo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx(Ho,{className:"w-4 h-4 text-gray-500 shrink-0"})]},Q.id)}):i.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[i.jsxs("span",{className:"text-sm text-gray-500",children:["附录",fe+1," | ",K.title,"(空)"]}),i.jsx(Ho,{className:"w-4 h-4 text-gray-500 shrink-0"})]},K.id))})]},L.id);if(Y&&L.chapters.length===1&&L.chapters[0].sections.length===1){const K=L.chapters[0].sections[0],fe=O("section",K.id),Q={partId:L.id,partTitle:L.title,chapterId:L.chapters[0].id,chapterTitle:L.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:oe=>{oe.stopPropagation(),oe.dataTransfer.setData("text/plain","section:"+K.id),oe.dataTransfer.effectAllowed="move",k({type:"section",id:K.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${fe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",K.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx(Vs,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:oe=>oe.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(K.id),onChange:()=>y(K.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:i.jsx(Hr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[L.chapters[0].title," | ",K.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:oe=>oe.stopPropagation(),onClick:oe=>oe.stopPropagation(),children:[K.price===0||K.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",K.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",K.clickCount??0," · 付款 ",K.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(K.hotScore??0).toFixed(1)," · 第",K.hotRank&&K.hotRank>0?K.hotRank:"-","名"]}),v&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(K),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(K),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]})]},L.id)}return Y?i.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),i.jsx("div",{className:"space-y-3",children:L.chapters.map(K=>K.sections.map(fe=>{const Q=O("section",fe.id);return i.jsxs("div",{draggable:!0,onDragStart:oe=>{oe.stopPropagation(),oe.dataTransfer.setData("text/plain","section:"+fe.id),oe.dataTransfer.effectAllowed="move",k({type:"section",id:fe.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",fe.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",fe.id,{partId:L.id,partTitle:L.title,chapterId:K.id,chapterTitle:K.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:oe=>oe.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(fe.id),onChange:()=>y(fe.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-300",children:[K.title," | ",fe.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",fe.clickCount??0," · 付款 ",fe.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(fe.hotScore??0).toFixed(1)," · 第",fe.hotRank&&fe.hotRank>0?fe.hotRank:"-","名"]}),v&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(fe),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(fe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(fe),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]})]},fe.id)}))})]},L.id):i.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${D?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...P("part",L.id,{partId:L.id,partTitle:L.title,chapterId:((H=L.chapters[0])==null?void 0:H.id)??"",chapterTitle:((de=L.chapters[0])==null?void 0:de.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:K=>{K.stopPropagation(),K.dataTransfer.setData("text/plain","part:"+L.id),K.dataTransfer.effectAllowed="move",k({type:"part",id:L.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",L.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(L.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(Vs,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),i.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:I(X)}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:L.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",_," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:K=>K.stopPropagation(),onClick:K=>K.stopPropagation(),children:[o&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Ft,{className:"w-3.5 h-3.5"})}),h&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(L),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(wn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[ae,"章"]}),$?i.jsx(Ec,{className:"w-5 h-5 text-gray-500"}):i.jsx(Ho,{className:"w-5 h-5 text-gray-500"})]})]}),$&&i.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:L.chapters.map(K=>{const fe=O("chapter",K.id);return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","chapter:"+K.id),Q.dataTransfer.effectAllowed="move",k({type:"chapter",id:K.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:K.id})},onDragOver:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:K.id})},onDragLeave:()=>C(null),onDrop:Q=>{C(null);const oe=cg(Q.dataTransfer.getData("text/plain"));if(!oe)return;const ue={partId:L.id,partTitle:L.title,chapterId:K.id,chapterTitle:K.title};(oe.type==="section"||oe.type==="chapter")&&R(Q,"chapter",K.id,ue)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${fe?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${T("chapter",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),i.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:K.title})]}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(L,K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>c(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Ft,{className:"w-3.5 h-3.5"})}),u&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(L,K),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:K.sections.map(Q=>{const oe=O("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:ue=>{ue.stopPropagation(),ue.dataTransfer.setData("text/plain","section:"+Q.id),ue.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...P("section",Q.id,{partId:L.id,partTitle:L.title,chapterId:K.id,chapterTitle:K.title}),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ue=>ue.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),i.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${Q.price===0||Q.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),i.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Q.id," ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Uo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ue=>ue.stopPropagation(),onClick:ue=>ue.stopPropagation(),children:[Q.isNew&&i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),Q.price===0||Q.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",Q.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),i.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]})]},Q.id)})})]},K.id)})})]},L.id)})})}function KB(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const a=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return a.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function qB(){var od,ld,fa;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,j]=b.useState(""),[w,k]=b.useState([]),[E,C]=b.useState(!1),[T,O]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[B,R]=b.useState(null),[P,I]=b.useState(!1),[L,X]=b.useState(!1),[Z,Y]=b.useState(null),[W,D]=b.useState(!1),[$,ae]=b.useState([]),[_,se]=b.useState(!1),[q,z]=b.useState(""),[H,de]=b.useState(""),[K,fe]=b.useState(!1),[Q,oe]=b.useState(""),[ue,ye]=b.useState(!1),[V,ge]=b.useState(null),[Me,tt]=b.useState(!1),[et,ot]=b.useState(!1),[Ge,dt]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[Et,ht]=b.useState(!1),[Tt,rr]=b.useState(!1),[sr,Er]=b.useState(1),[on,Kr]=b.useState([]),[gr,Tr]=b.useState(!1),[_n,Jn]=b.useState(20),[Yn,Cn]=b.useState(!1),[pe,ve]=b.useState(!1),[hn,Mr]=b.useState([]),[fs,ua]=b.useState([]),[En,qr]=b.useState({personId:"",name:"",label:"",ckbApiKey:""}),[ha,xr]=b.useState(null),[Gr,ai]=b.useState(""),[ut,Ar]=b.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),io=b.useRef(null),xn=KB(t),Jr=t.length,oi=[...t].sort((A,ee)=>(ee.hotScore??0)-(A.hotScore??0)),Rr=10,ps=Math.max(1,Math.ceil(oi.length/Rr)),Yr=oi.slice((sr-1)*Rr,sr*Rr),Tn=async()=>{r(!0);try{const A=await Fe("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(A==null?void 0:A.sections)?A.sections:[])}catch(A){console.error(A),e([])}finally{r(!1)}};b.useEffect(()=>{Tn()},[]);const ms=A=>{a(ee=>ee.includes(A)?ee.filter(Se=>Se!==A):[...ee,A])},Ps=b.useCallback(A=>{const ee=t,Se=A.flatMap(je=>{const jt=ee.find(Mt=>Mt.id===je.id);return jt?[{...jt,partId:je.partId,partTitle:je.partTitle,chapterId:je.chapterId,chapterTitle:je.chapterTitle}]:[]});return e(Se),_t("/api/db/book",{action:"reorder",items:A}).then(je=>{je&&je.success===!1&&(e(ee),he.error("排序失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误")))}).catch(je=>{e(ee),console.error("排序失败:",je),he.error("排序失败: "+(je instanceof Error?je.message:"网络或服务异常"))}),Promise.resolve()},[t]),Is=async A=>{if(confirm(`确定要删除章节「${A.title}」吗?此操作不可恢复。`))try{const ee=await ss(`/api/db/book?id=${encodeURIComponent(A.id)}`);ee&&ee.success!==!1?(he.success("已删除"),Tn()):he.error("删除失败: "+(ee&&typeof ee=="object"&&"error"in ee?ee.error:"未知错误"))}catch(ee){console.error(ee),he.error("删除失败")}},G=b.useCallback(async()=>{ht(!0);try{const A=await Fe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),ee=A&&A.data;ee&&typeof ee.readWeight=="number"&&typeof ee.recencyWeight=="number"&&typeof ee.payWeight=="number"&&dt({readWeight:Math.max(0,Math.min(1,ee.readWeight)),recencyWeight:Math.max(0,Math.min(1,ee.recencyWeight)),payWeight:Math.max(0,Math.min(1,ee.payWeight))})}catch{}finally{ht(!1)}},[]);b.useEffect(()=>{et&&G()},[et,G]);const nt=async()=>{const{readWeight:A,recencyWeight:ee,payWeight:Se}=Ge,je=A+ee+Se;if(Math.abs(je-1)>.001){he.error("三个权重之和必须等于 1");return}rr(!0);try{const jt=await mt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:A,recencyWeight:ee,payWeight:Se},description:"文章排名算法权重"});jt&&jt.success!==!1?(he.success("排名权重已保存"),Tn()):he.error("保存失败: "+(jt&&typeof jt=="object"&&"error"in jt?jt.error:""))}catch(jt){console.error(jt),he.error("保存失败")}finally{rr(!1)}},wt=b.useCallback(async()=>{Tr(!0);try{const A=await Fe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),ee=A&&A.data;Array.isArray(ee)&&Kr(ee)}catch{}finally{Tr(!1)}},[]),ft=b.useCallback(async()=>{try{const A=await Fe("/api/db/persons");A!=null&&A.success&&A.persons&&Mr(A.persons.map(ee=>({id:ee.personId,name:ee.name,label:ee.label,ckbApiKey:ee.ckbApiKey})))}catch{}},[]),Qt=b.useCallback(async()=>{try{const A=await Fe("/api/db/link-tags");A!=null&&A.success&&A.linkTags&&ua(A.linkTags.map(ee=>({id:ee.tagId,label:ee.label,url:ee.url,type:ee.type,appId:ee.appId,pagePath:ee.pagePath})))}catch{}},[]),li=async A=>{const ee=on.includes(A)?on.filter(Se=>Se!==A):[...on,A];Kr(ee);try{await mt("/api/db/config",{key:"pinned_section_ids",value:ee,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{Kr(on)}},xl=b.useCallback(async()=>{Cn(!0);try{const A=await Fe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),ee=A&&A.data;typeof ee=="number"&&ee>0&&ee<=100&&Jn(ee)}catch{}finally{Cn(!1)}},[]),Tf=async()=>{if(_n<1||_n>100){he.error("预览比例需在 1~100 之间");return}ve(!0);try{const A=await mt("/api/db/config",{key:"unpaid_preview_percent",value:_n,description:"小程序未付费内容默认预览比例(%)"});A&&A.success!==!1?he.success("预览比例已保存"):he.error("保存失败: "+(A.error||""))}catch{he.error("保存失败")}finally{ve(!1)}};b.useEffect(()=>{wt(),xl(),ft(),Qt()},[wt,xl,ft,Qt]);const yl=async A=>{ge({section:A,orders:[]}),tt(!0);try{const ee=await Fe(`/api/db/book?action=section-orders&id=${encodeURIComponent(A.id)}`),Se=ee!=null&&ee.success&&Array.isArray(ee.orders)?ee.orders:[];ge(je=>je?{...je,orders:Se}:null)}catch(ee){console.error(ee),ge(Se=>Se?{...Se,orders:[]}:null)}finally{tt(!1)}},ao=async A=>{m(!0);try{const ee=await Fe(`/api/db/book?action=read&id=${encodeURIComponent(A.id)}`);if(ee!=null&&ee.success&&ee.section){const Se=ee.section,je=Se.editionPremium===!0;c({id:A.id,originalId:A.id,title:ee.section.title??A.title,price:ee.section.price??A.price,content:ee.section.content??"",filePath:A.filePath,isFree:A.isFree||A.price===0,isNew:Se.isNew??A.isNew,isPinned:on.includes(A.id),hotScore:A.hotScore??0,editionStandard:je?!1:Se.editionStandard??!0,editionPremium:je})}else c({id:A.id,originalId:A.id,title:A.title,price:A.price,content:"",filePath:A.filePath,isFree:A.isFree,isNew:A.isNew,isPinned:on.includes(A.id),hotScore:A.hotScore??0,editionStandard:!0,editionPremium:!1}),ee&&!ee.success&&he.error("无法读取文件内容: "+(ee.error||"未知错误"))}catch(ee){console.error(ee),c({id:A.id,title:A.title,price:A.price,content:"",filePath:A.filePath,isFree:A.isFree})}finally{m(!1)}},td=async()=>{var A;if(o){y(!0);try{let ee=o.content||"";const Se=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(A=o.title)==null?void 0:A.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Mn of Se)ee=ee.replace(Mn,"");ee=ee.replace(/^\s*\n+/,"").trim();const je=o.originalId||o.id,jt=o.id!==je,Mt=await _t("/api/db/book",{id:je,...jt?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:ee,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,editionStandard:o.editionPremium?!1:o.editionStandard??!0,editionPremium:o.editionPremium??!1,saveToFile:!0}),zn=jt?o.id:je;o.isPinned!==on.includes(zn)&&await li(zn),Mt&&Mt.success!==!1?(he.success(`已保存:${o.title}`),c(null),Tn()):he.error("保存失败: "+(Mt&&typeof Mt=="object"&&"error"in Mt?Mt.error:"未知错误"))}catch(ee){console.error(ee),he.error("保存失败")}finally{y(!1)}}},nd=async()=>{if(!T.id||!T.title){he.error("请填写章节ID和标题");return}y(!0);try{const A=xn.find(je=>je.id===T.partId),ee=A==null?void 0:A.chapters.find(je=>je.id===T.chapterId),Se=await _t("/api/db/book",{id:T.id,title:T.title,price:T.isFree?0:T.price,content:T.content,partId:T.partId,partTitle:(A==null?void 0:A.title)??"",chapterId:T.chapterId,chapterTitle:(ee==null?void 0:ee.title)??"",isFree:T.isFree,isNew:T.isNew,editionStandard:T.editionPremium?!1:T.editionStandard??!0,editionPremium:T.editionPremium??!1,hotScore:T.hotScore??0,saveToFile:!1});if(Se&&Se.success!==!1){if(T.isPinned){const je=[...on,T.id];Kr(je);try{await mt("/api/db/config",{key:"pinned_section_ids",value:je,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}he.success(`章节创建成功:${T.title}`),h(!1),O({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),Tn()}else he.error("创建失败: "+(Se&&typeof Se=="object"&&"error"in Se?Se.error:"未知错误"))}catch(A){console.error(A),he.error("创建失败")}finally{y(!1)}},Mf=A=>{O(ee=>{var Se;return{...ee,partId:A.id,chapterId:((Se=A.chapters[0])==null?void 0:Se.id)??"chapter-1"}}),h(!0)},Af=A=>{R({id:A.id,title:A.title})},Vt=async()=>{var A;if((A=B==null?void 0:B.title)!=null&&A.trim()){I(!0);try{const ee=t.map(je=>({id:je.id,partId:je.partId||"part-1",partTitle:je.partId===B.id?B.title.trim():je.partTitle||"",chapterId:je.chapterId||"chapter-1",chapterTitle:je.chapterTitle||""})),Se=await _t("/api/db/book",{action:"reorder",items:ee});if(Se&&Se.success!==!1){const je=B.title.trim();e(jt=>jt.map(Mt=>Mt.partId===B.id?{...Mt,partTitle:je}:Mt)),R(null),Tn()}else he.error("更新篇名失败: "+(Se&&typeof Se=="object"&&"error"in Se?Se.error:"未知错误"))}catch(ee){console.error(ee),he.error("更新篇名失败")}finally{I(!1)}}},Rf=A=>{const ee=A.chapters.length+1,Se=`chapter-${A.id}-${ee}-${Date.now()}`;O({id:`${ee}.1`,title:"新章节",price:1,partId:A.id,chapterId:Se,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},vl=(A,ee)=>{Y({part:A,chapter:ee,title:ee.title})},rd=async()=>{var A;if((A=Z==null?void 0:Z.title)!=null&&A.trim()){D(!0);try{const ee=t.map(je=>({id:je.id,partId:je.partId||Z.part.id,partTitle:je.partId===Z.part.id?Z.part.title:je.partTitle||"",chapterId:je.chapterId||Z.chapter.id,chapterTitle:je.partId===Z.part.id&&je.chapterId===Z.chapter.id?Z.title.trim():je.chapterTitle||""})),Se=await _t("/api/db/book",{action:"reorder",items:ee});if(Se&&Se.success!==!1){const je=Z.title.trim(),jt=Z.part.id,Mt=Z.chapter.id;e(zn=>zn.map(Mn=>Mn.partId===jt&&Mn.chapterId===Mt?{...Mn,chapterTitle:je}:Mn)),Y(null),Tn()}else he.error("保存失败: "+(Se&&typeof Se=="object"&&"error"in Se?Se.error:"未知错误"))}catch(ee){console.error(ee),he.error("保存失败")}finally{D(!1)}}},oo=async(A,ee)=>{const Se=ee.sections.map(je=>je.id);if(Se.length===0){he.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${A.chapters.indexOf(ee)+1}章 | ${ee.title}」吗?将删除共 ${Se.length} 节,此操作不可恢复。`))try{for(const je of Se)await ss(`/api/db/book?id=${encodeURIComponent(je)}`);Tn()}catch(je){console.error(je),he.error("删除失败")}},Pf=async()=>{if(!Q.trim()){he.error("请输入篇名");return}ye(!0);try{const A=`part-new-${Date.now()}`,ee="chapter-1",Se=`part-placeholder-${Date.now()}`,je=await _t("/api/db/book",{id:Se,title:"占位节(可编辑)",price:0,content:"",partId:A,partTitle:Q.trim(),chapterId:ee,chapterTitle:"第1章 | 待编辑",saveToFile:!1});je&&je.success!==!1?(he.success(`篇「${Q}」创建成功`),X(!1),oe(""),Tn()):he.error("创建失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误"))}catch(A){console.error(A),he.error("创建失败")}finally{ye(!1)}},sd=async()=>{if($.length===0){he.error("请先勾选要移动的章节");return}const A=xn.find(Se=>Se.id===q),ee=A==null?void 0:A.chapters.find(Se=>Se.id===H);if(!A||!ee||!q||!H){he.error("请选择目标篇和章");return}fe(!0);try{const Se=()=>{const zn=new Set($),Mn=t.map(Qe=>({id:Qe.id,partId:Qe.partId||"",partTitle:Qe.partTitle||"",chapterId:Qe.chapterId||"",chapterTitle:Qe.chapterTitle||""})),pa=Mn.filter(Qe=>zn.has(Qe.id)).map(Qe=>({...Qe,partId:q,partTitle:A.title||q,chapterId:H,chapterTitle:ee.title||H})),ma=Mn.filter(Qe=>!zn.has(Qe.id));let ga=ma.length;for(let Qe=ma.length-1;Qe>=0;Qe-=1){const bl=ma[Qe];if(bl.partId===q&&bl.chapterId===H){ga=Qe+1;break}}return[...ma.slice(0,ga),...pa,...ma.slice(ga)]},je=async()=>{const zn=Se(),Mn=await _t("/api/db/book",{action:"reorder",items:zn});return Mn&&Mn.success!==!1?(he.success(`已移动 ${$.length} 节到「${A.title}」-「${ee.title}」`),se(!1),ae([]),await Tn(),!0):!1},jt={action:"move-sections",sectionIds:$,targetPartId:q,targetChapterId:H,targetPartTitle:A.title||q,targetChapterTitle:ee.title||H},Mt=await _t("/api/db/book",jt);if(Mt&&Mt.success!==!1)he.success(`已移动 ${Mt.count??$.length} 节到「${A.title}」-「${ee.title}」`),se(!1),ae([]),await Tn();else{const zn=Mt&&typeof Mt=="object"&&"error"in Mt?Mt.error||"":"未知错误";if((zn.includes("缺少 id")||zn.includes("无效的 action"))&&await je())return;he.error("移动失败: "+zn)}}catch(Se){console.error(Se),he.error("移动失败: "+(Se instanceof Error?Se.message:"网络或服务异常"))}finally{fe(!1)}},lo=A=>{ae(ee=>ee.includes(A)?ee.filter(Se=>Se!==A):[...ee,A])},Pr=async A=>{const ee=t.filter(Se=>Se.partId===A.id).map(Se=>Se.id);if(ee.length===0){he.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${A.title}」整篇吗?将删除共 ${ee.length} 节内容,此操作不可恢复。`))try{for(const Se of ee)await ss(`/api/db/book?id=${encodeURIComponent(Se)}`);Tn()}catch(Se){console.error(Se),he.error("删除失败")}},id=async()=>{var A;if(v.trim()){C(!0);try{const ee=await Fe(`/api/search?q=${encodeURIComponent(v)}`);ee!=null&&ee.success&&((A=ee.data)!=null&&A.results)?k(ee.data.results):(k([]),ee&&!ee.success&&he.error("搜索失败: "+ee.error))}catch(ee){console.error(ee),k([]),he.error("搜索失败")}finally{C(!1)}}},Qn=xn.find(A=>A.id===T.partId),ad=(Qn==null?void 0:Qn.chapters)??[];return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",xn.length," 篇 · ",Jr," 节内容"]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(ne,{onClick:()=>ot(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[i.jsx(uu,{className:"w-4 h-4 mr-2"}),"排名算法"]}),i.jsxs(ne,{onClick:()=>{const A=typeof window<"u"?`${window.location.origin}/api-doc`:"";A&&window.open(A,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Ss,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),i.jsx(Zt,{open:u,onOpenChange:h,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[i.jsx(en,{className:"shrink-0 px-6 pt-6 pb-2",children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节ID *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:T.id,onChange:A=>O({...T,id:A.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:T.isFree?0:T.price,onChange:A=>O({...T,price:Number(A.target.value),isFree:Number(A.target.value)===0}),disabled:T.isFree})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"免费"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:T.isFree,onChange:A=>O({...T,isFree:A.target.checked,price:A.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最新新增"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:T.isNew,onChange:A=>O({...T,isNew:A.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序直推"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:T.isPinned,onChange:A=>O({...T,isPinned:A.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"文章类型"}),i.jsxs("div",{className:"flex items-center gap-4 h-10",children:[i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium!==!0,onChange:()=>O({...T,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium===!0,onChange:()=>O({...T,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"热度分"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:T.hotScore??0,onChange:A=>O({...T,hotScore:Math.max(0,parseFloat(A.target.value)||0)})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:T.title,onChange:A=>O({...T,title:A.target.value})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"所属篇"}),i.jsxs(sc,{value:T.partId,onValueChange:A=>{var Se;const ee=xn.find(je=>je.id===A);O({...T,partId:A,chapterId:((Se=ee==null?void 0:ee.chapters[0])==null?void 0:Se.id)??"chapter-1"})},children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(ic,{})}),i.jsxs(Vo,{className:"bg-[#0f2137] border-gray-700",children:[xn.map(A=>i.jsx(bs,{value:A.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:A.title},A.id)),xn.length===0&&i.jsx(bs,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"所属章"}),i.jsxs(sc,{value:T.chapterId,onValueChange:A=>O({...T,chapterId:A}),children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(ic,{})}),i.jsxs(Vo,{className:"bg-[#0f2137] border-gray-700",children:[ad.map(A=>i.jsx(bs,{value:A.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:A.title},A.id)),ad.length===0&&i.jsx(bs,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),i.jsx(fx,{content:T.content||"",onChange:A=>O({...T,content:A}),onImageUpload:async A=>{var jt;const ee=new FormData;ee.append("file",A),ee.append("folder","book-images");const je=await(await fetch(Ha("/api/upload"),{method:"POST",body:ee,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((jt=je==null?void 0:je.data)==null?void 0:jt.url)||(je==null?void 0:je.url)||""},persons:hn,linkTags:fs,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),i.jsxs(Nn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[i.jsx(ne,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:nd,disabled:g||!T.id||!T.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),i.jsx(Zt,{open:!!B,onOpenChange:A=>!A&&R(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),B&&i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"篇名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:B.title,onChange:A=>R({...B,title:A.target.value}),placeholder:"输入篇名"})]})}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>R(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:Vt,disabled:P||!((od=B==null?void 0:B.title)!=null&&od.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Zt,{open:!!Z,onOpenChange:A=>!A&&Y(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),Z&&i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:Z.title,onChange:A=>Y({...Z,title:A.target.value}),placeholder:"输入章节名称"})]})}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>Y(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:rd,disabled:W||!((ld=Z==null?void 0:Z.title)!=null&&ld.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:W?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Zt,{open:_,onOpenChange:A=>{var ee;if(se(A),A&&xn.length>0){const Se=xn[0];z(Se.id),de(((ee=Se.chapters[0])==null?void 0:ee.id)??"")}},children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:"批量移动至指定目录"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",i.jsx("span",{className:"text-[#38bdac] font-medium",children:$.length})," 节,请选择目标篇与章。"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标篇"}),i.jsxs(sc,{value:q,onValueChange:A=>{var Se;z(A);const ee=xn.find(je=>je.id===A);de(((Se=ee==null?void 0:ee.chapters[0])==null?void 0:Se.id)??"")},children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(ic,{placeholder:"选择篇"})}),i.jsx(Vo,{className:"bg-[#0f2137] border-gray-700",children:xn.map(A=>i.jsx(bs,{value:A.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:A.title},A.id))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标章"}),i.jsxs(sc,{value:H,onValueChange:de,children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(ic,{placeholder:"选择章"})}),i.jsx(Vo,{className:"bg-[#0f2137] border-gray-700",children:(((fa=xn.find(A=>A.id===q))==null?void 0:fa.chapters)??[]).map(A=>i.jsx(bs,{value:A.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:A.title},A.id))})]})]})]}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>se(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:sd,disabled:K||$.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:K?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),i.jsx(Zt,{open:!!V,onOpenChange:A=>!A&&ge(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white",children:["付款记录 — ",(V==null?void 0:V.section.title)??""]})}),i.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Me?i.jsxs("div",{className:"flex items-center justify-center py-8",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):V&&V.orders.length===0?i.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):V?i.jsxs("table",{className:"w-full text-sm border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[i.jsx("th",{className:"py-2 pr-2",children:"订单号"}),i.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),i.jsx("th",{className:"py-2 pr-2",children:"金额"}),i.jsx("th",{className:"py-2 pr-2",children:"状态"}),i.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),i.jsx("tbody",{children:V.orders.map(A=>i.jsxs("tr",{className:"border-b border-gray-700/50",children:[i.jsx("td",{className:"py-2 pr-2",children:i.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${A.orderSn}`,onClick:()=>window.open(`/orders?search=${A.orderSn??A.id??""}`,"_blank"),children:A.orderSn?A.orderSn.length>16?A.orderSn.slice(0,8)+"..."+A.orderSn.slice(-6):A.orderSn:"-"})}),i.jsx("td",{className:"py-2 pr-2",children:i.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${A.userId??A.openId??""}`,onClick:()=>window.open(`/users?search=${A.userId??A.openId??""}`,"_blank"),children:(()=>{const ee=A.userId??A.openId??"-";return ee.length>12?ee.slice(0,6)+"..."+ee.slice(-4):ee})()})}),i.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",A.amount??0]}),i.jsx("td",{className:"py-2 pr-2 text-gray-300",children:A.status??"-"}),i.jsx("td",{className:"py-2 pr-2 text-gray-500",children:A.payTime??A.createdAt??"-"})]},A.id??A.orderSn??""))})]}):null})]})}),i.jsx(Zt,{open:et,onOpenChange:ot,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(uu,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),Et?i.jsx("p",{className:"text-gray-500",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"阅读权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Ge.readWeight,onChange:A=>dt(ee=>({...ee,readWeight:Math.max(0,Math.min(1,parseFloat(A.target.value)||0))}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"新度权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Ge.recencyWeight,onChange:A=>dt(ee=>({...ee,recencyWeight:Math.max(0,Math.min(1,parseFloat(A.target.value)||0))}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"付款权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Ge.payWeight,onChange:A=>dt(ee=>({...ee,payWeight:Math.max(0,Math.min(1,parseFloat(A.target.value)||0))}))})]})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(Ge.readWeight+Ge.recencyWeight+Ge.payWeight).toFixed(1)]}),i.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[i.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),i.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),i.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),i.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),i.jsx(ne,{onClick:nt,disabled:Tt||Math.abs(Ge.readWeight+Ge.recencyWeight+Ge.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Tt?"保存中...":"保存权重"})]})]})]})}),i.jsx(Zt,{open:L,onOpenChange:X,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(Ft,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:Q,onChange:A=>oe(A.target.value),placeholder:"输入篇名"})]})}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>{X(!1),oe("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:Pf,disabled:ue||!Q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:ue?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),i.jsx(Zt,{open:!!o,onOpenChange:()=>c(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[i.jsx(en,{className:"shrink-0 px-6 pt-6 pb-2",children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&i.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:A=>c({...o,id:A.target.value}),placeholder:"如: 9.15"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:A=>c({...o,price:Number(A.target.value),isFree:Number(A.target.value)===0}),disabled:o.isFree})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"免费"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:A=>c({...o,isFree:A.target.checked,price:A.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最新新增"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:A=>c({...o,isNew:A.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序直推"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:A=>c({...o,isPinned:A.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"文章类型"}),i.jsxs("div",{className:"flex items-center gap-4 h-10",children:[i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium!==!0,onChange:()=>c({...o,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium===!0,onChange:()=>c({...o,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"热度分"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:A=>c({...o,hotScore:Math.max(0,parseFloat(A.target.value)||0)})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:A=>c({...o,title:A.target.value})})]}),o.filePath&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"文件路径"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsx(fx,{ref:io,content:o.content||"",onChange:A=>c({...o,content:A}),onImageUpload:async A=>{var jt;const ee=new FormData;ee.append("file",A),ee.append("folder","book-images");const je=await(await fetch(Ha("/api/upload"),{method:"POST",body:ee,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((jt=je==null?void 0:je.data)==null?void 0:jt.url)||(je==null?void 0:je.url)||""},persons:hn,linkTags:fs,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),i.jsxs(Nn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&i.jsxs(ne,{variant:"outline",onClick:()=>yl({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[i.jsx(Hr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),i.jsxs(ne,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsx(ne,{onClick:td,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),i.jsxs(Gc,{defaultValue:"chapters",className:"space-y-6",children:[i.jsxs(ul,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(nn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(Hr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),i.jsxs(nn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[i.jsx(Ob,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),i.jsxs(nn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(Ui,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),i.jsxs(nn,{value:"link-ai",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[i.jsx(Ss,{className:"w-4 h-4 mr-2"}),"链接AI"]})]}),i.jsxs(rn,{value:"chapters",className:"space-y-4",children:[i.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:i.jsx(Hr,{className:"w-6 h-6"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),i.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),i.jsxs("div",{className:"text-center shrink-0",children:[i.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:Jr}),i.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs(ne,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新建章节"]}),i.jsxs(ne,{onClick:()=>X(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新建篇"]}),i.jsxs(ne,{variant:"outline",onClick:()=>se(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",$.length," 节)"]})]}),n?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsx(UB,{parts:xn,expandedParts:s,onTogglePart:ms,onReorder:Ps,onReadSection:ao,onDeleteSection:Is,onAddSectionInPart:Mf,onAddChapterInPart:Rf,onDeleteChapter:oo,onEditPart:Af,onDeletePart:Pr,onEditChapter:vl,selectedSectionIds:$,onToggleSectionSelect:lo,onShowSectionOrders:yl,pinnedSectionIds:on})]}),i.jsx(rn,{value:"search",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"内容搜索"})}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:v,onChange:A=>j(A.target.value),onKeyDown:A=>A.key==="Enter"&&id()}),i.jsx(ne,{onClick:id,disabled:E||!v.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?i.jsx(qe,{className:"w-4 h-4 animate-spin"}):i.jsx(Ui,{className:"w-4 h-4"})})]}),w.length>0&&i.jsxs("div",{className:"space-y-2 mt-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",w.length," 个结果"]}),w.map(A=>i.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>ao({id:A.id,title:A.title,price:A.price??1,filePath:""}),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:A.id}),i.jsx("span",{className:"text-white",children:A.title}),on.includes(A.id)&&i.jsx(Uo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),i.jsx(Be,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:A.matchType==="title"?"标题匹配":"内容匹配"})]}),A.snippet&&i.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:A.snippet}),(A.partTitle||A.chapterTitle)&&i.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[A.partTitle," · ",A.chapterTitle]})]},A.id))]})]})]})}),i.jsxs(rn,{value:"ranking",className:"space-y-4",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(Xe,{className:"pb-3",children:i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(uu,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),i.jsx(Re,{children:i.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(te,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),i.jsx(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:_n,onChange:A=>Jn(Math.max(1,Math.min(100,Number(A.target.value)||20))),disabled:Yn}),i.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),i.jsx(ne,{size:"sm",onClick:Tf,disabled:pe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:pe?"保存中...":"保存"}),i.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",_n,"% 内容"]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(Xe,{className:"pb-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(Ob,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",i.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",oi.length," 节"]})]}),i.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[i.jsx(ne,{variant:"ghost",size:"sm",disabled:sr<=1,onClick:()=>Er(A=>Math.max(1,A-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx(LT,{className:"w-4 h-4"})}),i.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[sr," / ",ps]}),i.jsx(ne,{variant:"ghost",size:"sm",disabled:sr>=ps,onClick:()=>Er(A=>Math.min(ps,A+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx(Ho,{className:"w-4 h-4"})})]})]})}),i.jsx(Re,{children:i.jsxs("div",{className:"space-y-0",children:[i.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[i.jsx("span",{children:"排名"}),i.jsx("span",{children:"置顶"}),i.jsx("span",{children:"标题"}),i.jsx("span",{className:"text-right",children:"点击量"}),i.jsx("span",{className:"text-right",children:"付款数"}),i.jsx("span",{className:"text-right",children:"热度"}),i.jsx("span",{className:"text-right",children:"编辑"})]}),Yr.map((A,ee)=>{const Se=(sr-1)*Rr+ee+1,je=on.includes(A.id);return i.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${je?"bg-amber-500/5":""}`,children:[i.jsx("span",{className:`text-sm font-bold ${Se<=3?"text-amber-400":"text-gray-500"}`,children:Se<=3?["🥇","🥈","🥉"][Se-1]:`#${Se}`}),i.jsx(ne,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${je?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>li(A.id),disabled:gr,title:je?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:je?i.jsx(Uo,{className:"w-3.5 h-3.5 fill-current"}):i.jsx(lA,{className:"w-3.5 h-3.5"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"text-white text-sm truncate block",children:A.title}),i.jsxs("span",{className:"text-gray-600 text-xs",children:[A.partTitle," · ",A.chapterTitle]})]}),i.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:A.clickCount??0}),i.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:A.payCount??0}),i.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(A.hotScore??0).toFixed(1)}),i.jsx("div",{className:"text-right",children:i.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>ao({id:A.id,title:A.title,price:A.price,filePath:""}),title:"编辑文章",children:i.jsx(kt,{className:"w-3 h-3"})})})]},A.id)}),Yr.length===0&&i.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),i.jsxs(rn,{value:"link-ai",className:"space-y-4",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"pb-3",children:[i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"在文章中 @人物,小程序端点击可跳转存客宝流量池或详情页"})]}),i.jsxs(Re,{className:"space-y-3",children:[i.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"名称 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 卡若",value:En.name,onChange:A=>qr({...En,name:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"自动生成",value:En.personId,onChange:A=>qr({...En,personId:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"如 超级个体",value:En.label,onChange:A=>qr({...En,label:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝密钥(留空用默认)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-48",placeholder:"xxxx-xxxx-xxxx-xxxx",value:En.ckbApiKey,onChange:A=>qr({...En,ckbApiKey:A.target.value})})]}),i.jsxs(ne,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8",onClick:async()=>{if(!En.name){he.error("名称必填");return}const A={...En};A.personId||(A.personId=En.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36)),await mt("/api/db/persons",A),qr({personId:"",name:"",label:"",ckbApiKey:""}),ft()},children:[i.jsx(Ft,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[hn.map(A=>i.jsxs("div",{className:"bg-[#0a1628] rounded px-3 py-2 space-y-1.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsxs("span",{className:"text-[#38bdac] font-bold text-base",children:["@",A.name]}),i.jsx("span",{className:"text-gray-600 text-xs font-mono",children:A.id}),A.label&&i.jsx(Be,{variant:"secondary",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:A.label}),A.ckbApiKey?i.jsx(Be,{variant:"secondary",className:"bg-green-500/20 text-green-300 border-green-500/30 text-[10px]",children:"密钥 ✓"}):i.jsx(Be,{variant:"secondary",className:"bg-gray-500/20 text-gray-500 border-gray-500/30 text-[10px]",children:"用默认密钥"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑密钥",onClick:()=>{xr(A.id),ai(A.ckbApiKey||"")},children:i.jsx(nA,{className:"w-3 h-3"})}),i.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await ss(`/api/db/persons?personId=${A.id}`),ft()},children:i.jsx(Wn,{className:"w-3 h-3"})})]})]}),ha===A.id&&i.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[i.jsx(ce,{className:"bg-[#0d1f35] border-gray-600 text-white h-7 text-xs flex-1",placeholder:"输入存客宝密钥,留空则用默认",value:Gr,onChange:ee=>ai(ee.target.value),onKeyDown:ee=>{ee.key==="Escape"&&xr(null)},autoFocus:!0}),i.jsx(ne,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-7 px-2",onClick:async()=>{await mt("/api/db/persons",{personId:A.id,name:A.name,label:A.label,ckbApiKey:Gr}),xr(null),ft()},children:i.jsx(Uc,{className:"w-3 h-3"})}),i.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 h-7 px-2",onClick:()=>xr(null),children:i.jsx(Wn,{className:"w-3 h-3"})})]})]},A.id)),hn.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"pb-3",children:[i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(xM,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),i.jsxs(Re,{className:"space-y-3",children:[i.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"标签ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:ut.tagId,onChange:A=>Ar({...ut,tagId:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"显示文字"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:ut.label,onChange:A=>Ar({...ut,label:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"类型"}),i.jsxs(sc,{value:ut.type,onValueChange:A=>Ar({...ut,type:A}),children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:i.jsx(ic,{})}),i.jsxs(Vo,{children:[i.jsx(bs,{value:"url",children:"网页链接"}),i.jsx(bs,{value:"miniprogram",children:"小程序"}),i.jsx(bs,{value:"ckb",children:"存客宝"})]})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:ut.type==="url"?"URL地址":ut.type==="ckb"?"存客宝计划URL":"小程序AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:ut.type==="url"?"https://...":ut.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"wx...",value:ut.type==="url"||ut.type==="ckb"?ut.url:ut.appId,onChange:A=>{ut.type==="url"||ut.type==="ckb"?Ar({...ut,url:A.target.value}):Ar({...ut,appId:A.target.value})}})]}),ut.type==="miniprogram"&&i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"页面路径"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:ut.pagePath,onChange:A=>Ar({...ut,pagePath:A.target.value})})]}),i.jsxs(ne,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!ut.tagId||!ut.label){he.error("标签ID和显示文字必填");return}const A={...ut};A.type==="miniprogram"&&A.appId&&(A.url=`weixin://dl/business/?appid=${A.appId}&path=${A.pagePath}`),await mt("/api/db/link-tags",A),Ar({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Qt()},children:[i.jsx(Ft,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[fs.map(A=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsxs("span",{className:"text-amber-400 font-bold text-base",children:["#",A.label]}),i.jsx(Be,{variant:"secondary",className:`text-[10px] ${A.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:A.type==="url"?"网页":A.type==="ckb"?"存客宝":"小程序"}),i.jsxs("a",{href:A.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[A.url," ",i.jsx(ti,{className:"w-3 h-3 shrink-0"})]})]}),i.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await ss(`/api/db/link-tags?tagId=${A.id}`),Qt()},children:i.jsx(Wn,{className:"w-3 h-3"})})]},A.id)),fs.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"pb-3",children:[i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(uu,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),i.jsxs(Re,{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"绑定计划"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往 ",i.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]})]})]})}const Ys={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function cN(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):Ys.stats}function dN(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Ys.highlights}function GB(){const[t,e]=b.useState(Ys),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Fe("/api/admin/author-settings").then(k=>{const E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??Ys.name),avatar:String(E.avatar??Ys.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??Ys.title),bio:String(E.bio??Ys.bio),stats:cN(E.stats).length?cN(E.stats):Ys.stats,highlights:dN(E.highlights).length?dN(E.highlights):Ys.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{a(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(T=>T.label||T.value),highlights:t.highlights.filter(Boolean)},E=await mt("/api/admin/author-settings",k);if(!E||E.success===!1){he.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:""));return}a(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),he.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},f=async k=>{var C;const E=(C=k.target.files)==null?void 0:C[0];if(E){c(!0);try{const T=new FormData;T.append("file",E),T.append("folder","avatars");const O=Mx(),B={};O&&(B.Authorization=`Bearer ${O}`);const P=await(await fetch(Ha("/api/upload"),{method:"POST",body:T,credentials:"include",headers:B})).json();P!=null&&P.success&&(P!=null&&P.url)?e(I=>({...I,avatarImg:P.url})):he.error("上传失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(T){console.error(T),he.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(E=>({...E,stats:E.stats.filter((C,T)=>T!==k)})),y=(k,E,C)=>e(T=>({...T,stats:T.stats.map((O,B)=>B===k?{...O,[E]:C}:O)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(E=>({...E,highlights:E.highlights.filter((C,T)=>T!==k)})),w=(k,E)=>e(C=>({...C,highlights:C.highlights.map((T,O)=>O===k?E:T)}));return n?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(qo,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),i.jsxs(ne,{onClick:h,disabled:s||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"flex items-center gap-2 text-white",children:[i.jsx(qo,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),i.jsx(zt,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"姓名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(E=>({...E,name:k.target.value})),placeholder:"卡若"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(E=>({...E,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(FN,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(E=>({...E,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),i.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),i.jsxs(ne,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[i.jsx(Yu,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:t.avatarImg.startsWith("http")?t.avatarImg:Ha(t.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"头衔"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(E=>({...E,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"个人简介"}),i.jsx(Jc,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(E=>({...E,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsx(Ze,{className:"text-white",children:"统计数据"}),i.jsx(zt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),i.jsxs(Re,{className:"space-y-3",children:[t.stats.map((k,E)=>i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>y(E,"label",C.target.value),placeholder:"标签"}),i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>y(E,"value",C.target.value),placeholder:"数值"}),i.jsx(ne,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(E),children:i.jsx(Wn,{className:"w-4 h-4"})})]},E)),i.jsxs(ne,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsx(Ze,{className:"text-white",children:"亮点标签"}),i.jsx(zt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),i.jsxs(Re,{className:"space-y-3",children:[t.highlights.map((k,E)=>i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>w(E,C.target.value),placeholder:"5年私域运营经验"}),i.jsx(ne,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(E),children:i.jsx(Wn,{className:"w-4 h-4"})})]},E)),i.jsxs(ne,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function JB(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=Wx(h,300),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(!1),[E,C]=b.useState(null),[T,O]=b.useState(""),[B,R]=b.useState(""),[P,I]=b.useState(""),[L,X]=b.useState("admin"),[Z,Y]=b.useState("active"),[W,D]=b.useState(!1);async function $(){var H;y(!0),j(null);try{const de=new URLSearchParams({page:String(s),pageSize:String(o)});m.trim()&&de.set("search",m.trim());const K=await Fe(`/api/admin/users?${de}`);K!=null&&K.success?(e(K.records||[]),r(K.total??0),u(K.totalPages??0)):j(K.error||"加载失败")}catch(de){const K=de;j(K.status===403?"无权限访问":((H=K==null?void 0:K.data)==null?void 0:H.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{$()},[s,o,m]);const ae=()=>{C(null),O(""),R(""),I(""),X("admin"),Y("active"),k(!0)},_=H=>{C(H),O(H.username),R(""),I(H.name||""),X(H.role==="super_admin"?"super_admin":"admin"),Y(H.status==="disabled"?"disabled":"active"),k(!0)},se=async()=>{var H;if(!T.trim()){j("用户名不能为空");return}if(!E&&!B){j("新建时密码必填,至少 6 位");return}if(B&&B.length<6){j("密码至少 6 位");return}j(null),D(!0);try{if(E){const de=await _t("/api/admin/users",{id:E.id,password:B||void 0,name:P.trim(),role:L,status:Z});de!=null&&de.success?(k(!1),$()):j((de==null?void 0:de.error)||"保存失败")}else{const de=await mt("/api/admin/users",{username:T.trim(),password:B,name:P.trim(),role:L});de!=null&&de.success?(k(!1),$()):j((de==null?void 0:de.error)||"保存失败")}}catch(de){const K=de;j(((H=K==null?void 0:K.data)==null?void 0:H.error)||"保存失败")}finally{D(!1)}},q=async H=>{var de;if(confirm("确定删除该管理员?"))try{const K=await ss(`/api/admin/users?id=${H}`);K!=null&&K.success?$():j((K==null?void 0:K.error)||"删除失败")}catch(K){const fe=K;j(((de=fe==null?void 0:fe.data)==null?void 0:de.error)||"删除失败")}},z=H=>{if(!H)return"-";try{const de=new Date(H);return isNaN(de.getTime())?H:de.toLocaleString("zh-CN")}catch{return H}};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Ex,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ce,{placeholder:"搜索用户名/昵称",value:h,onChange:H=>f(H.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),i.jsx(ne,{variant:"outline",size:"sm",onClick:$,disabled:g,className:"border-gray-600 text-gray-300",children:i.jsx(qe,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),i.jsxs(ne,{onClick:ae,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),v&&i.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[i.jsx("span",{children:v}),i.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:g?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"用户名"}),i.jsx(Te,{className:"text-gray-400",children:"昵称"}),i.jsx(Te,{className:"text-gray-400",children:"角色"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-gray-400",children:"创建时间"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(mr,{children:[t.map(H=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:H.id}),i.jsx(we,{className:"text-white font-medium",children:H.username}),i.jsx(we,{className:"text-gray-400",children:H.name||"-"}),i.jsx(we,{children:i.jsx(Be,{variant:"outline",className:H.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:H.role==="super_admin"?"超级管理员":"管理员"})}),i.jsx(we,{children:i.jsx(Be,{variant:"outline",className:H.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:H.status==="active"?"正常":"已禁用"})}),i.jsx(we,{className:"text-gray-500 text-sm",children:z(H.createdAt)}),i.jsxs(we,{className:"text-right",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>_(H),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>q(H.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(wn,{className:"w-4 h-4"})})]})]},H.id)),t.length===0&&!g&&i.jsx(ct,{children:i.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:v==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&i.jsx("div",{className:"p-4 border-t border-gray-700/50",children:i.jsx(ls,{page:s,pageSize:o,total:n,totalPages:c,onPageChange:a})})]})})}),i.jsx(Zt,{open:w,onOpenChange:k,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:E?"编辑管理员":"新增管理员"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"用户名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:T,onChange:H=>O(H.target.value),disabled:!!E}),E&&i.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:E?"新密码(留空不改)":"密码"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:E?"留空表示不修改":"至少 6 位",value:B,onChange:H=>R(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:P,onChange:H=>I(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色"}),i.jsxs("select",{value:L,onChange:H=>X(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[i.jsx("option",{value:"admin",children:"管理员"}),i.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),E&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"状态"}),i.jsxs("select",{value:Z,onChange:H=>Y(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[i.jsx("option",{value:"active",children:"正常"}),i.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:se,disabled:W,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),W?"保存中...":"保存"]})]})]})})]})}const YB={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},QB={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},XB={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...QB}},ZB={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},eV=["system","author","admin"];function tV(){const[t,e]=IN(),n=t.get("tab")??"system",r=eV.includes(n)?n:"system",[s,a]=b.useState(XB),[o,c]=b.useState(ZB),[u,h]=b.useState(YB),[f,m]=b.useState(!1),[g,y]=b.useState(!0),[v,j]=b.useState(!1),[w,k]=b.useState(""),[E,C]=b.useState(""),[T,O]=b.useState(!1),[B,R]=b.useState(!1),P=(Y,W,D=!1)=>{k(Y),C(W),O(D),j(!0)};b.useEffect(()=>{(async()=>{try{const W=await Fe("/api/admin/settings");if(!W||W.success===!1)return;if(W.featureConfig&&Object.keys(W.featureConfig).length&&c(D=>({...D,...W.featureConfig})),W.mpConfig&&typeof W.mpConfig=="object"&&h(D=>({...D,...W.mpConfig})),W.siteSettings&&typeof W.siteSettings=="object"){const D=W.siteSettings;a($=>({...$,...typeof D.sectionPrice=="number"&&{sectionPrice:D.sectionPrice},...typeof D.baseBookPrice=="number"&&{baseBookPrice:D.baseBookPrice},...typeof D.distributorShare=="number"&&{distributorShare:D.distributorShare},...D.authorInfo&&typeof D.authorInfo=="object"&&{authorInfo:{...$.authorInfo,...D.authorInfo}}}))}}catch(W){console.error("Load settings error:",W)}finally{y(!1)}})()},[]);const I=async(Y,W)=>{R(!0);try{const D=await mt("/api/admin/settings",{featureConfig:Y});if(!D||D.success===!1){W(),P("保存失败",(D==null?void 0:D.error)??"未知错误",!0);return}P("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(D){console.error("Save feature config error:",D),W(),P("保存失败",D instanceof Error?D.message:String(D),!0)}finally{R(!1)}},L=(Y,W)=>{const D=o,$={...D,[Y]:W};c($),I($,()=>c(D))},X=async()=>{m(!0);try{const Y=await mt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:s.sectionPrice,baseBookPrice:s.baseBookPrice,distributorShare:s.distributorShare,authorInfo:s.authorInfo},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10}});if(!Y||Y.success===!1){P("保存失败",(Y==null?void 0:Y.error)??"未知错误",!0);return}P("已保存","设置已保存成功。")}catch(Y){console.error("Save settings error:",Y),P("保存失败",Y instanceof Error?Y.message:String(Y),!0)}finally{m(!1)}},Z=Y=>{e(Y==="system"?{}:{tab:Y})};return g?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&i.jsxs(ne,{onClick:X,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),i.jsxs(Gc,{value:r,onValueChange:Z,className:"w-full",children:[i.jsxs(ul,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(nn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(_a,{className:"w-4 h-4 mr-2"}),"系统设置"]}),i.jsxs(nn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(gm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),i.jsxs(nn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(Ex,{className:"w-4 h-4 mr-2"}),"管理员"]})]}),i.jsx(rn,{value:"system",className:"mt-0",children:i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(gm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),i.jsx(zt,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(gm,{className:"w-3 h-3"}),"主理人名称"]}),i.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.name??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,name:Y.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(Gu,{className:"w-3 h-3"}),"开播日期"]}),i.jsx(ce,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:s.authorInfo.startDate??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,startDate:Y.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(Gu,{className:"w-3 h-3"}),"直播时间"]}),i.jsx(ce,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:s.authorInfo.liveTime??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,liveTime:Y.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(BN,{className:"w-3 h-3"}),"直播平台"]}),i.jsx(ce,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:s.authorInfo.platform??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,platform:Y.target.value}}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(Hr,{className:"w-3 h-3"}),"简介描述"]}),i.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.description??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,description:Y.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),i.jsx(Jc,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:s.authorInfo.bio??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,bio:Y.target.value}}))})]}),i.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[i.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(s.authorInfo.name??"K").charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-semibold",children:s.authorInfo.name}),i.jsx("p",{className:"text-gray-400 text-xs",children:s.authorInfo.description}),i.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",s.authorInfo.liveTime," · ",s.authorInfo.platform]})]})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ju,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),i.jsx(Re,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单节价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:s.sectionPrice,onChange:Y=>a(W=>({...W,sectionPrice:Number.parseFloat(Y.target.value)||1}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:s.baseBookPrice,onChange:Y=>a(W=>({...W,baseBookPrice:Number.parseFloat(Y.target.value)||9.9}))})]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Tc,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),i.jsx(zt,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),i.jsx(Re,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序 AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:Y=>h(W=>({...W,appId:Y.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:Y=>h(W=>({...W,withdrawSubscribeTmplId:Y.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:Y=>h(W=>({...W,mchId:Y.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:Y=>h(W=>({...W,minWithdraw:Number.parseFloat(Y.target.value)||10}))})]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(_a,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),i.jsx(zt,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ln,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),i.jsx(Nt,{id:"match-enabled",checked:o.matchEnabled,disabled:B,onCheckedChange:Y=>L("matchEnabled",Y)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(oM,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),i.jsx(Nt,{id:"referral-enabled",checked:o.referralEnabled,disabled:B,onCheckedChange:Y=>L("referralEnabled",Y)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Hr,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),i.jsx(Nt,{id:"search-enabled",checked:o.searchEnabled,disabled:B,onCheckedChange:Y=>L("searchEnabled",Y)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_a,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),i.jsx(Nt,{id:"about-enabled",checked:o.aboutEnabled,disabled:B,onCheckedChange:Y=>L("aboutEnabled",Y)})]})]}),i.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:i.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),i.jsx(rn,{value:"author",className:"mt-0",children:i.jsx(GB,{})}),i.jsx(rn,{value:"admin",className:"mt-0",children:i.jsx(JB,{})})]}),i.jsx(Zt,{open:v,onOpenChange:j,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[i.jsxs(en,{children:[i.jsx(tn,{className:T?"text-red-400":"text-[#38bdac]",children:w}),i.jsx(RP,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:E})]}),i.jsx(Nn,{className:"mt-4",children:i.jsx(ne,{onClick:()=>j(!1),className:T?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const uN={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function nV(){const[t,e]=b.useState(!1),[n,r]=b.useState(uN),[s,a]=b.useState(""),o=async()=>{e(!0);try{const k=await Fe("/api/config");k!=null&&k.paymentMethods&&r({...uN,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await mt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),he.success("配置已保存!")}catch(k){console.error("保存失败:",k),he.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,E)=>{navigator.clipboard.writeText(k),a(E),setTimeout(()=>a(""),2e3)},h=(k,E)=>{r(C=>({...C,wechat:{...C.wechat,[k]:E}}))},f=(k,E)=>{r(C=>({...C,alipay:{...C.alipay,[k]:E}}))},m=(k,E)=>{r(C=>({...C,usdt:{...C.usdt,[k]:E}}))},g=(k,E)=>{r(C=>({...C,paypal:{...C.paypal,[k]:E}}))},y=n.wechat,v=n.alipay,j=n.usdt,w=n.paypal;return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),i.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(ne,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),i.jsxs(ne,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),i.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(LN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),i.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[i.jsx("li",{children:"打开微信,进入目标微信群"}),i.jsx("li",{children:'点击右上角"..." → "群二维码"'}),i.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),i.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),i.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),i.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),i.jsxs(Gc,{defaultValue:"wechat",className:"space-y-6",children:[i.jsxs(ul,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[i.jsxs(nn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[i.jsx(Tc,{className:"w-4 h-4 mr-2"}),"微信"]}),i.jsxs(nn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[i.jsx(Pb,{className:"w-4 h-4 mr-2"}),"支付宝"]}),i.jsxs(nn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[i.jsx(Ab,{className:"w-4 h-4 mr-2"}),"USDT"]}),i.jsxs(nn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[i.jsx(vg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),i.jsx(rn,{value:"wechat",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(Ze,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Tc,{className:"w-5 h-5"}),"微信支付配置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),i.jsx(Nt,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"网站AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"商户号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[i.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[i.jsx(ti,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),i.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[i.jsx(te,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),i.jsx(ce,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),i.jsx(rn,{value:"alipay",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(Ze,{className:"text-[#1677FF] flex items-center gap-2",children:[i.jsx(Pb,{className:"w-5 h-5"}),"支付宝配置"]}),i.jsx(zt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),i.jsx(Nt,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"合作者身份 (PID)"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),i.jsx(ne,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:s==="pid"?i.jsx(Uc,{className:"w-4 h-4 text-green-500"}):i.jsx(zN,{className:"w-4 h-4 text-gray-400"})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[i.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[i.jsx(ti,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),i.jsx(rn,{value:"usdt",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(Ze,{className:"text-[#26A17B] flex items-center gap-2",children:[i.jsx(Ab,{className:"w-5 h-5"}),"USDT配置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),i.jsx(Nt,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"网络类型"}),i.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[i.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),i.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),i.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"收款地址"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(j.address??""),onChange:k=>m("address",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),i.jsx(rn,{value:"paypal",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(Ze,{className:"text-[#169BD7] flex items-center gap-2",children:[i.jsx(vg,{className:"w-5 h-5"}),"PayPal配置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),i.jsx(Nt,{checked:!!w.enabled,onCheckedChange:k=>g("enabled",k)})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(w.email??""),onChange:k=>g("email",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const rV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},sV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},iV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function aV(){const[t,e]=b.useState({siteConfig:{...rV},menuConfig:{...sV},pageConfig:{...iV}}),[n,r]=b.useState(!1),[s,a]=b.useState(!1);b.useEffect(()=>{Fe("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{a(!0);try{await mt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await mt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await mt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),he.success("配置已保存")}catch(f){console.error(f),he.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{a(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),i.jsxs(ne,{onClick:o,disabled:s,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),s?"保存中...":n?"已保存":"保存设置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(vg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),i.jsx(zt,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),i.jsx(ce,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),i.jsx(ce,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),i.jsx(ce,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),i.jsx(ce,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),i.jsx(ce,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(ZM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),i.jsx(zt,{className:"text-gray-400",children:"配置网站主题色"})]}),i.jsx(Re,{children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"space-y-2 flex-1",children:[i.jsx(te,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(ce,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),i.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(KM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),i.jsx(zt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),i.jsx(Re,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>i.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[i.jsx(Nt,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),i.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),i.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(sM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首页副标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目录页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"我的页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"关于作者标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function oV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[s,a]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,j,w;try{const k=await Fe("/api/config"),E=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(E)&&e(E.join(` +`));const C=(w=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:w.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,v)=>{navigator.clipboard.writeText(y),a(v),setTimeout(()=>a(""),2e3)},f=async()=>{try{const y=t.split(` +`).map(j=>j.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await mt("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),he.success("群活码配置已保存!"),await u()}catch(y){console.error(y),he.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await mt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),he.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),he.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},g=()=>{n?window.open(n,"_blank"):he.error("请先配置微信群链接")};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"mb-8",children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),i.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(LN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),i.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[i.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[i.jsx("li",{children:"访问草料二维码创建活码"}),i.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),i.jsx("li",{children:"复制生成的短链接填入下方配置"}),i.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),i.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[i.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),i.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),i.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),i.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Ib,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),i.jsx(zt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(bg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:y=>r(y.target.value)}),i.jsx(ne,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:s==="group"?i.jsx(Uc,{className:"w-4 h-4 text-green-500"}):i.jsx(zN,{className:"w-4 h-4 text-gray-400"})})]}),i.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(ne,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[i.jsx(Yu,{className:"w-4 h-4 mr-2"}),"保存配置"]}),i.jsxs(ne,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[i.jsx(ti,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ib,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),i.jsx(zt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(bg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),i.jsx(Jc,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[i.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),i.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` +`).filter(Boolean).length," 个"]})]}),i.jsxs(ne,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Yu,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),i.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[i.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),i.jsxs("div",{className:"space-y-3 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),i.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),i.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const hN={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},lV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function cV(){const[t,e]=b.useState(hN),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Fe("/api/db/config/full?key=match_config"),T=(C==null?void 0:C.data)??(C==null?void 0:C.config);T&&e({...hN,...T})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{a(!0);try{const C=await mt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?he.success("配置保存成功!"):he.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),he.error("保存失败")}finally{a(!1)}},v=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},w=()=>{if(!f.id||!f.label){he.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const T=C.findIndex(O=>O.id===u.id);T!==-1&&(C[T]={...f})}else{if(C.some(T=>T.id===f.id)){he.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(T=>T.id!==C)})},E=C=>{e({...t,matchTypes:t.matchTypes.map(T=>T.id===C?{...T,enabled:!T.enabled}:T)})};return i.jsxs("div",{className:"p-8 w-full space-y-6",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(_a,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(ne,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),i.jsxs(ne,{onClick:y,disabled:s,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存配置"]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Re,{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:C=>e({...t,freeMatchLimit:parseInt(C.target.value,10)||0})}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:C=>e({...t,matchPrice:parseFloat(C.target.value)||1})}),i.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),i.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:C=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(C.target.value,10)||10}})}),i.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),i.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),i.jsx(zt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(ne,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),i.jsx(Re,{children:i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"图标"}),i.jsx(Te,{className:"text-gray-400",children:"类型ID"}),i.jsx(Te,{className:"text-gray-400",children:"显示名称"}),i.jsx(Te,{className:"text-gray-400",children:"匹配标签"}),i.jsx(Te,{className:"text-gray-400",children:"价格"}),i.jsx(Te,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(mr,{children:t.matchTypes.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsx("span",{className:"text-2xl",children:C.icon})}),i.jsx(we,{className:"font-mono text-gray-300",children:C.id}),i.jsx(we,{className:"text-white font-medium",children:C.label}),i.jsx(we,{className:"text-gray-300",children:C.matchLabel}),i.jsx(we,{children:i.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),i.jsx(we,{children:C.matchFromDB?i.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(we,{children:i.jsx(Nt,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),i.jsx(we,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(wn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),i.jsx(Zt,{open:o,onOpenChange:c,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[u?i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:C=>m({...f,id:C.target.value}),disabled:!!u})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"图标"}),i.jsx("div",{className:"flex gap-1 flex-wrap",children:lV.map(C=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===C?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:C}),children:C},C))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"显示名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:C=>m({...f,label:C.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配标签"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:C=>m({...f,matchLabel:C.target.value})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:C=>m({...f,price:parseFloat(C.target.value)||1})})]}),i.jsxs("div",{className:"flex gap-6 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(ne,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const fN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function dV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function v(){m(!0),y(null);try{const w=new URLSearchParams({page:String(s),pageSize:String(o)});u&&w.set("matchType",u);const k=await Fe(`/api/db/match-records?${w}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(w){console.error("加载匹配记录失败",w),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[s,u]);const j=Math.ceil(n/o)||1;return i.jsxs("div",{className:"p-8 w-full",children:[g&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:g}),i.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("select",{value:u,onChange:w=>{h(w.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"",children:"全部类型"}),Object.entries(fN).map(([w,k])=>i.jsx("option",{value:w,children:k},w))]}),i.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:f?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"发起人"}),i.jsx(Te,{className:"text-gray-400",children:"匹配到"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"联系方式"}),i.jsx(Te,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(mr,{children:[t.map(w=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.userAvatar?i.jsx("img",{src:w.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,i.jsx("span",{className:w.userAvatar?"hidden":"",children:(w.userNickname||w.userId||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white",children:w.userNickname||w.userId}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.userId.slice(0,16),"..."]})]})]})}),i.jsx(we,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.matchedUserAvatar?i.jsx("img",{src:w.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,i.jsx("span",{className:w.matchedUserAvatar?"hidden":"",children:(w.matchedNickname||w.matchedUserId||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white",children:w.matchedNickname||w.matchedUserId}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.matchedUserId.slice(0,16),"..."]})]})]})}),i.jsx(we,{children:i.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:fN[w.matchType]||w.matchType})}),i.jsxs(we,{className:"text-gray-400 text-sm",children:[w.phone&&i.jsxs("div",{children:["📱 ",w.phone]}),w.wechatId&&i.jsxs("div",{children:["💬 ",w.wechatId]}),!w.phone&&!w.wechatId&&"-"]}),i.jsx(we,{className:"text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleString():"-"})]},w.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(ls,{page:s,totalPages:j,total:n,pageSize:o,onPageChange:a,onPageSizeChange:w=>{c(w),a(1)}})]})})})]})}function uV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(null),[u,h]=b.useState(""),[f,m]=b.useState(0),[g,y]=b.useState(!1);async function v(){r(!0);try{const C=await Fe("/api/db/vip-roles");C!=null&&C.success&&C.data&&e(C.data)}catch(C){console.error("Load roles error:",C)}finally{r(!1)}}b.useEffect(()=>{v()},[]);const j=()=>{c(null),h(""),m(t.length>0?Math.max(...t.map(C=>C.sort))+1:0),a(!0)},w=C=>{c(C),h(C.name),m(C.sort),a(!0)},k=async()=>{if(!u.trim()){he.error("角色名称不能为空");return}y(!0);try{if(o){const C=await _t("/api/db/vip-roles",{id:o.id,name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):he.error("更新失败: "+(C==null?void 0:C.error))}else{const C=await mt("/api/db/vip-roles",{name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):he.error("新增失败: "+(C==null?void 0:C.error))}}catch(C){console.error("Save error:",C),he.error("保存失败")}finally{y(!1)}},E=async C=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const T=await ss(`/api/db/vip-roles?id=${C}`);T!=null&&T.success?v():he.error("删除失败: "+(T==null?void 0:T.error))}catch(T){console.error("Delete error:",T),he.error("删除失败")}};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Pa,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),i.jsxs(ne,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"角色名称"}),i.jsx(Te,{className:"text-gray-400",children:"排序"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(mr,{children:[t.map(C=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:C.id}),i.jsx(we,{className:"text-white",children:C.name}),i.jsx(we,{className:"text-gray-400",children:C.sort}),i.jsxs(we,{className:"text-right",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>w(C),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>E(C.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(wn,{className:"w-4 h-4"})})]})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),i.jsx(Zt,{open:s,onOpenChange:a,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:o?"编辑角色":"新增角色"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:u,onChange:C=>h(C.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f,onChange:C=>m(parseInt(C.target.value,10)||0)})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>a(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:k,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function SE(t){const[e,n]=b.useState([]),[r,s]=b.useState(!0),[a,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,v]=b.useState(!1),j=b.useRef(null),w=async P=>{var L;const I=(L=P.target.files)==null?void 0:L[0];if(I){v(!0);try{const X=new FormData;X.append("file",I),X.append("folder","mentors");const Z=Mx(),Y={};Z&&(Y.Authorization=`Bearer ${Z}`);const D=await(await fetch(Ha("/api/upload"),{method:"POST",body:X,credentials:"include",headers:Y})).json();D!=null&&D.success&&(D!=null&&D.url)?f($=>({...$,avatar:D.url})):he.error("上传失败: "+((D==null?void 0:D.error)||"未知错误"))}catch(X){console.error(X),he.error("上传失败")}finally{v(!1),j.current&&(j.current.value="")}}};async function k(){s(!0);try{const P=await Fe("/api/db/mentors");P!=null&&P.success&&P.data&&n(P.data)}catch(P){console.error("Load mentors error:",P)}finally{s(!1)}}b.useEffect(()=>{k()},[]);const E=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(P=>P.sort))+1:0,enabled:!0})},C=()=>{u(null),E(),o(!0)},T=P=>{u(P),f({name:P.name,avatar:P.avatar||"",intro:P.intro||"",tags:P.tags||"",priceSingle:P.priceSingle!=null?String(P.priceSingle):"",priceHalfYear:P.priceHalfYear!=null?String(P.priceHalfYear):"",priceYear:P.priceYear!=null?String(P.priceYear):"",quote:P.quote||"",whyFind:P.whyFind||"",offering:P.offering||"",judgmentStyle:P.judgmentStyle||"",sort:P.sort,enabled:P.enabled??!0}),o(!0)},O=async()=>{if(!h.name.trim()){he.error("导师姓名不能为空");return}g(!0);try{const P=L=>L===""?void 0:parseFloat(L),I={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:P(h.priceSingle),priceHalfYear:P(h.priceHalfYear),priceYear:P(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const L=await _t("/api/db/mentors",{id:c.id,...I});L!=null&&L.success?(o(!1),k()):he.error("更新失败: "+(L==null?void 0:L.error))}else{const L=await mt("/api/db/mentors",I);L!=null&&L.success?(o(!1),k()):he.error("新增失败: "+(L==null?void 0:L.error))}}catch(P){console.error("Save error:",P),he.error("保存失败")}finally{g(!1)}},B=async P=>{if(confirm("确定删除该导师?"))try{const I=await ss(`/api/db/mentors?id=${P}`);I!=null&&I.success?k():he.error("删除失败: "+(I==null?void 0:I.error))}catch(I){console.error("Delete error:",I),he.error("删除失败")}},R=P=>P!=null?`¥${P}`:"-";return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),i.jsxs(ne,{onClick:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:r?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"姓名"}),i.jsx(Te,{className:"text-gray-400",children:"简介"}),i.jsx(Te,{className:"text-gray-400",children:"单次"}),i.jsx(Te,{className:"text-gray-400",children:"半年"}),i.jsx(Te,{className:"text-gray-400",children:"年度"}),i.jsx(Te,{className:"text-gray-400",children:"排序"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(mr,{children:[e.map(P=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:P.id}),i.jsx(we,{className:"text-white",children:P.name}),i.jsx(we,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),i.jsx(we,{className:"text-gray-400",children:R(P.priceSingle)}),i.jsx(we,{className:"text-gray-400",children:R(P.priceHalfYear)}),i.jsx(we,{className:"text-gray-400",children:R(P.priceYear)}),i.jsx(we,{className:"text-gray-400",children:P.sort}),i.jsxs(we,{className:"text-right",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>T(P),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>B(P.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(wn,{className:"w-4 h-4"})})]})]},P.id)),e.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),i.jsx(Zt,{open:a,onOpenChange:o,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:c?"编辑导师":"新增导师"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"姓名 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:P=>f(I=>({...I,name:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:P=>f(I=>({...I,sort:parseInt(P.target.value,10)||0}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"头像"}),i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:P=>f(I=>({...I,avatar:P.target.value})),placeholder:"点击上传或粘贴图片地址"}),i.jsx("input",{ref:j,type:"file",accept:"image/*",className:"hidden",onChange:w}),i.jsxs(ne,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var P;return(P=j.current)==null?void 0:P.click()},children:[i.jsx(Yu,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:h.avatar.startsWith("http")?h.avatar:Ha(h.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"简介"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:P=>f(I=>({...I,intro:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:P=>f(I=>({...I,tags:P.target.value}))})]}),i.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[i.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:P=>f(I=>({...I,priceSingle:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:P=>f(I=>({...I,priceHalfYear:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:P=>f(I=>({...I,priceYear:P.target.value}))})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"引言"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:P=>f(I=>({...I,quote:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:P=>f(I=>({...I,whyFind:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:P=>f(I=>({...I,offering:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:P=>f(I=>({...I,judgmentStyle:P.target.value}))})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:P=>f(I=>({...I,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),i.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:O,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function hV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState("");async function o(){r(!0);try{const h=s?`/api/db/mentor-consultations?status=${s}`:"/api/db/mentor-consultations",f=await Fe(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[s]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Gu,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:s,onChange:h=>a(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[i.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>i.jsx("option",{value:h,children:f},h))]}),i.jsxs(ne,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"用户ID"}),i.jsx(Te,{className:"text-gray-400",children:"导师ID"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"金额"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(mr,{children:[t.map(h=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:h.id}),i.jsx(we,{className:"text-gray-400",children:h.userId}),i.jsx(we,{className:"text-gray-400",children:h.mentorId}),i.jsx(we,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),i.jsxs(we,{className:"text-white",children:["¥",h.amount]}),i.jsx(we,{className:"text-gray-400",children:c[h.status]||h.status}),i.jsx(we,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const hc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},pN={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:hc},fV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function pV(){const t=sa(),[e,n]=b.useState(pN),[r,s]=b.useState(!0),[a,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,v]=b.useState(null),[j,w]=b.useState(!1),k=async()=>{w(!0);try{const I=await Fe("/api/db/match-pool-counts");I!=null&&I.success&&I.data&&v(I.data)}catch(I){console.error("加载池子人数失败:",I)}finally{w(!1)}},E=async()=>{s(!0);try{const I=await Fe("/api/db/config/full?key=match_config"),L=(I==null?void 0:I.data)??(I==null?void 0:I.config);if(L){let X=L.poolSettings??hc;X.poolSource&&!Array.isArray(X.poolSource)&&(X={...X,poolSource:[X.poolSource]}),n({...pN,...L,poolSettings:X})}}catch(I){console.error("加载匹配配置失败:",I)}finally{s(!1)}};b.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const I=await mt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});he.error((I==null?void 0:I.success)!==!1?"配置保存成功!":"保存失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(I){console.error(I),he.error("保存失败")}finally{o(!1)}},T=I=>{f(I),g({...I}),u(!0)},O=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},B=()=>{if(!m.id||!m.label){he.error("请填写类型ID和名称");return}const I=[...e.matchTypes];if(h){const L=I.findIndex(X=>X.id===h.id);L!==-1&&(I[L]={...m})}else{if(I.some(L=>L.id===m.id)){he.error("类型ID已存在");return}I.push({...m})}n({...e,matchTypes:I}),u(!1)},R=I=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(L=>L.id!==I)})},P=I=>{n({...e,matchTypes:e.matchTypes.map(L=>L.id===I?{...L,enabled:!L.enabled}:L)})};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex justify-end gap-3",children:[i.jsxs(ne,{variant:"outline",onClick:E,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),i.jsxs(ne,{onClick:C,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"})," ",a?"保存中...":"保存配置"]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx($N,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),i.jsx(zt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),i.jsxs(Re,{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),i.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(I=>{const L=e.poolSettings??hc,Z=(Array.isArray(L.poolSource)?L.poolSource:[L.poolSource]).includes(I.value),Y=y==null?void 0:y[I.countKey],W=()=>{const D=Array.isArray(L.poolSource)?[...L.poolSource]:[L.poolSource],$=Z?D.filter(ae=>ae!==I.value):[...D,I.value];$.length===0&&$.push(I.value),n({...e,poolSettings:{...L,poolSource:$}})};return i.jsxs("button",{type:"button",onClick:W,className:`p-4 rounded-lg border text-left transition-all ${Z?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${Z?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:Z&&"✓"}),i.jsx("span",{className:"text-xl",children:I.icon}),i.jsx("span",{className:`text-sm font-medium ${Z?"text-[#38bdac]":"text-gray-300"}`,children:I.label})]}),i.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":Y??"-",i.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),i.jsx("p",{className:"text-gray-500 text-xs mt-2",children:I.desc}),i.jsx("span",{role:"link",tabIndex:0,onClick:D=>{D.stopPropagation(),t(`/users?pool=${I.value}`)},onKeyDown:D=>{D.key==="Enter"&&(D.stopPropagation(),t(`/users?pool=${I.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},I.value)})})]}),i.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[i.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(I=>{const X=(e.poolSettings??hc)[I.key];return i.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[i.jsx(Nt,{checked:X,onCheckedChange:Z=>n({...e,poolSettings:{...e.poolSettings??hc,[I.key]:Z}})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{children:I.icon}),i.jsx(te,{className:"text-gray-300 text-sm",children:I.label})]})]},I.key)})})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Re,{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:I=>n({...e,freeMatchLimit:parseInt(I.target.value,10)||0})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:I=>n({...e,matchPrice:parseFloat(I.target.value)||1})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),i.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:I=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(I.target.value,10)||10}})})]})]}),i.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:e.settings.enableFreeMatches,onCheckedChange:I=>n({...e,settings:{...e.settings,enableFreeMatches:I}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:e.settings.enablePaidMatches,onCheckedChange:I=>n({...e,settings:{...e.settings,enablePaidMatches:I}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),i.jsx(zt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(ne,{onClick:O,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),i.jsx(Re,{children:i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"图标"}),i.jsx(Te,{className:"text-gray-400",children:"类型ID"}),i.jsx(Te,{className:"text-gray-400",children:"显示名称"}),i.jsx(Te,{className:"text-gray-400",children:"匹配标签"}),i.jsx(Te,{className:"text-gray-400",children:"价格"}),i.jsx(Te,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(mr,{children:e.matchTypes.map(I=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsx("span",{className:"text-2xl",children:I.icon})}),i.jsx(we,{className:"font-mono text-gray-300",children:I.id}),i.jsx(we,{className:"text-white font-medium",children:I.label}),i.jsx(we,{className:"text-gray-300",children:I.matchLabel}),i.jsx(we,{children:i.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",I.price]})}),i.jsx(we,{children:I.matchFromDB?i.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(we,{children:i.jsx(Nt,{checked:I.enabled,onCheckedChange:()=>P(I.id)})}),i.jsx(we,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>T(I),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>R(I.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(wn,{className:"w-4 h-4"})})]})})]},I.id))})]})})]}),i.jsx(Zt,{open:c,onOpenChange:u,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[h?i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:I=>g({...m,id:I.target.value}),disabled:!!h})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"图标"}),i.jsx("div",{className:"flex gap-1 flex-wrap",children:fV.map(I=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===I?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:I}),children:I},I))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"显示名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:I=>g({...m,label:I.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配标签"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:I=>g({...m,matchLabel:I.target.value})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:I=>g({...m,price:parseFloat(I.target.value)||1})})]}),i.jsxs("div",{className:"flex gap-6 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:m.matchFromDB,onCheckedChange:I=>g({...m,matchFromDB:I})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:m.showJoinAfterMatch,onCheckedChange:I=>g({...m,showJoinAfterMatch:I})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:m.enabled,onCheckedChange:I=>g({...m,enabled:I})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(ne,{onClick:B,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const mN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function mV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[v,j]=b.useState(null);async function w(){m(!0),y(null);try{const C=new URLSearchParams({page:String(s),pageSize:String(o)});u&&C.set("matchType",u);const T=await Fe(`/api/db/match-records?${C}`);T!=null&&T.success?(e(T.records||[]),r(T.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{w()},[s,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:T,avatar:O})=>i.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[O?i.jsx("img",{src:O,alt:"",className:"w-full h-full object-cover",onError:B=>{B.currentTarget.style.display="none"}}):null,i.jsx("span",{className:O?"hidden":"",children:(T||C||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:T||C}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[C==null?void 0:C.slice(0,16),(C==null?void 0:C.length)>16?"...":""]})]})]});return i.jsxs("div",{children:[g&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:g}),i.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("select",{value:u,onChange:C=>{h(C.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"",children:"全部类型"}),Object.entries(mN).map(([C,T])=>i.jsx("option",{value:C,children:T},C))]}),i.jsxs("button",{type:"button",onClick:w,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:f?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"发起人"}),i.jsx(Te,{className:"text-gray-400",children:"匹配到"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"联系方式"}),i.jsx(Te,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(mr,{children:[t.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),i.jsx(we,{children:C.matchedUserId?i.jsx(E,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):i.jsx("span",{className:"text-gray-500",children:"—"})}),i.jsx(we,{children:i.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:mN[C.matchType]||C.matchType})}),i.jsxs(we,{className:"text-sm",children:[C.phone&&i.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&i.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&i.jsx("span",{className:"text-gray-600",children:"-"})]}),i.jsx(we,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(ls,{page:s,totalPages:k,total:n,pageSize:o,onPageChange:a,onPageSizeChange:C=>{c(C),a(1)}})]})})}),i.jsx(Hx,{open:!!v,onClose:()=>j(null),userId:v,onUserUpdated:w})]})}function gV(){const[t,e]=b.useState("records");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),i.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&i.jsx(mV,{}),t==="pool"&&i.jsx(pV,{})]})}const gN={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function xV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function v(){h(!0);try{const E=new URLSearchParams({page:String(s),pageSize:String(o),matchType:f}),C=await Fe(`/api/db/match-records?${E}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(E){console.error(E)}finally{h(!1)}}b.useEffect(()=>{v()},[s,f]);const j=async E=>{if(!E.phone&&!E.wechatId){he.info("该记录无联系方式,无法推送到存客宝");return}y(E.id);try{const C=await mt("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});he.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){he.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{y(null)}},w=Math.ceil(n/o)||1,k=E=>!!(E.phone||E.wechatId);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),i.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("select",{value:f,onChange:E=>{m(E.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(gN).map(([E,C])=>i.jsx("option",{value:E,children:C},E))}),i.jsxs(ne,{onClick:v,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:u?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"发起人"}),i.jsx(Te,{className:"text-gray-400",children:"匹配到"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"联系方式"}),i.jsx(Te,{className:"text-gray-400",children:"时间"}),i.jsx(Te,{className:"text-gray-400 text-right",children:"操作"})]})}),i.jsxs(mr,{children:[t.map(E=>{var C,T;return i.jsxs(ct,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[i.jsx(we,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),i.jsx(we,{className:"text-white",children:E.matchedNickname||((T=E.matchedUserId)==null?void 0:T.slice(0,12))}),i.jsx(we,{children:i.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:gN[E.matchType]||E.matchType})}),i.jsxs(we,{className:"text-sm",children:[E.phone&&i.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&i.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&i.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),i.jsx(we,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),i.jsx(we,{className:"text-right",children:k(E)?i.jsxs(ne,{size:"sm",onClick:()=>j(E),disabled:g===E.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[i.jsx(vA,{className:"w-3 h-3 mr-1"}),g===E.id?"推送中...":"推送CKB"]}):i.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},E.id)}),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),i.jsx(ls,{page:s,totalPages:w,total:n,pageSize:o,onPageChange:a,onPageSizeChange:E=>{c(E),a(1)}})]})})})]})}const xN={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},yV={single:"单次",half_year:"半年",year:"年度"};function vV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState("");async function o(){r(!0);try{const c=s?`/api/db/mentor-consultations?status=${s}`:"/api/db/mentor-consultations",u=await Fe(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[s]),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:s,onChange:c=>a(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[i.jsx("option",{value:"",children:"全部状态"}),Object.entries(xN).map(([c,u])=>i.jsx("option",{value:c,children:u},c))]}),i.jsxs(ne,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"用户ID"}),i.jsx(Te,{className:"text-gray-400",children:"导师ID"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"金额"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(mr,{children:[t.map(c=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:c.id}),i.jsx(we,{className:"text-gray-400",children:c.userId}),i.jsx(we,{className:"text-gray-400",children:c.mentorId}),i.jsx(we,{className:"text-gray-400",children:yV[c.consultationType]||c.consultationType}),i.jsxs(we,{className:"text-white",children:["¥",c.amount]}),i.jsx(we,{className:"text-gray-400",children:xN[c.status]||c.status}),i.jsx(we,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function bV(){const[t,e]=b.useState("booking");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),i.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&i.jsx(vV,{}),t==="manage"&&i.jsx("div",{className:"-mx-8",children:i.jsx(SE,{embedded:!0})})]})}function wV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(s),pageSize:String(o),matchType:"team"}),y=await Fe(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[s]);const m=Math.ceil(n/o)||1;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),i.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),i.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:u?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"发起人"}),i.jsx(Te,{className:"text-gray-400",children:"匹配到"}),i.jsx(Te,{className:"text-gray-400",children:"联系方式"}),i.jsx(Te,{className:"text-gray-400",children:"时间"})]})}),i.jsxs(mr,{children:[t.map(g=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{className:"text-white",children:g.userNickname||g.userId}),i.jsx(we,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),i.jsxs(we,{className:"text-gray-400 text-sm",children:[g.phone&&i.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&i.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),i.jsx(we,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),i.jsx(ls,{page:s,totalPages:m,total:n,pageSize:o,onPageChange:a,onPageSizeChange:g=>{c(g),a(1)}})]})})})]})}const yN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},vN={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function NV({onSwitchTab:t,onOpenCKB:e}={}){const n=sa(),[r,s]=b.useState(null),[a,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var m,g;u(!0);try{const[y,v]=await Promise.allSettled([Fe("/api/db/match-records?stats=true"),Fe("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let j=y.value.data;if(j.totalMatches>0&&(!j.uniqueUsers||j.uniqueUsers===0))try{const w=await Fe("/api/db/match-records?page=1&pageSize=200");if(w!=null&&w.success&&w.records){const k=new Set(w.records.map(E=>E.userId).filter(Boolean));j={...j,uniqueUsers:k.size}}}catch{}s(j)}v.status==="fulfilled"&&((g=v.value)!=null&&g.success)&&v.value.data&&o(v.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[i.jsx(Ae,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),i.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),i.jsx(Ae,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-yellow-500/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),i.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[i.jsx(Fi,{className:"w-3 h-3"})," 今日实时"]})]})}),i.jsx(Ae,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),i.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"})," 查看用户管理"]})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:f(r==null?void 0:r.paidMatchCount)})]})})]})]}),(r==null?void 0:r.byType)&&r.byType.length>0&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:r.byType.map(m=>{const g=r.totalMatches>0?m.count/r.totalMatches*100:0;return i.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("span",{className:"text-2xl",children:vN[m.matchType]||"📊"}),i.jsx("span",{className:"text-gray-300 font-medium",children:yN[m.matchType]||m.matchType})]}),i.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),i.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),i.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[i.jsx(Ss,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[i.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.ckbTotal)??0}),i.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.withContact)??0}),i.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),i.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),i.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(a==null?void 0:a.byType)&&a.byType.length>0&&i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:a.byType.map(m=>i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsx("span",{className:"text-xl",children:vN[m.matchType]||"📋"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-xs",children:yN[m.matchType]||m.matchType}),i.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const jV=["partner","investor","mentor","team"],dg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],bN=`# 场景获客接口摘要 +- 地址:POST /v1/api/scenarios +- 必填:apiKey、sign、timestamp +- 主标识:phone 或 wechatId 至少一项 +- 可选:name、source、remark、tags、siteTags、portrait +- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 +- 成功:code=200,message=新增成功 或 已存在`;function kV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,s]=b.useState("13800000000"),[a,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(bN),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[j,w]=b.useState([]),[k,E]=b.useState([]),[C,T]=b.useState({}),[O,B]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),R=b.useMemo(()=>{const D={};return dg.forEach($=>{D[$.key]=C[$.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),D},[C]),P=D=>{const $=r.trim(),ae=a.trim();return D<=3?{type:jV[D],phone:$||void 0,wechat:ae||void 0,userId:"admin_test",name:"后台测试"}:D===4?{matchType:"partner",phone:$||void 0,wechat:ae||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:D===5?{phone:$||void 0,wechatId:ae||void 0,userId:"admin_test",name:"后台测试"}:{}};async function I(){v(!0);try{const[D,$,ae]=await Promise.all([Fe("/api/db/config/full?key=ckb_config"),Fe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Fe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),_=D==null?void 0:D.data;_!=null&&_.routes&&T(_.routes),_!=null&&_.docNotes&&u(_.docNotes),_!=null&&_.docContent&&f(_.docContent),$!=null&&$.success&&w($.records||[]),ae!=null&&ae.success&&E(ae.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{I()},[]);async function L(){g(!0);try{const D=await mt("/api/db/config",{key:"ckb_config",value:{routes:R,docNotes:c,docContent:h},description:"存客宝接口配置"});he.error((D==null?void 0:D.success)!==!1?"存客宝配置已保存":`保存失败: ${(D==null?void 0:D.error)||"未知错误"}`)}catch(D){he.error(`保存失败: ${D instanceof Error?D.message:"网络错误"}`)}finally{g(!1)}}const X=(D,$)=>{T(ae=>({...ae,[D]:{...R[D],...$}}))},Z=async D=>{const $=O[D];if($.method==="POST"&&!r.trim()&&!a.trim()){he.error("请填写测试手机号");return}const ae=[...O];ae[D]={...$,status:"testing",message:void 0,responseTime:void 0},B(ae);const _=performance.now();try{const se=$.method==="GET"?await Fe($.endpoint):await mt($.endpoint,P(D)),q=Math.round(performance.now()-_),z=(se==null?void 0:se.message)||"",H=(se==null?void 0:se.success)===!0||z.includes("已存在")||z.includes("已加入")||z.includes("已提交"),de=[...O];de[D]={...$,status:H?"success":"error",message:z||(H?"正常":"异常"),responseTime:q},B(de),await I()}catch(se){const q=Math.round(performance.now()-_),z=[...O];z[D]={...$,status:"error",message:se instanceof Error?se.message:"失败",responseTime:q},B(z)}},Y=async()=>{if(!r.trim()&&!a.trim()){he.error("请填写测试手机号");return}for(let D=0;Di.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),i.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),i.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),i.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),i.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),i.jsx("tbody",{children:D.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:$})}):D.map(ae=>i.jsxs("tr",{className:"border-t border-gray-700/30",children:[i.jsx("td",{className:"px-4 py-3 text-white",children:ae.userNickname||ae.userId}),i.jsx("td",{className:"px-4 py-3 text-gray-300",children:ae.matchType}),i.jsx("td",{className:"px-4 py-3 text-green-400",children:ae.phone||"—"}),i.jsx("td",{className:"px-4 py-3 text-blue-400",children:ae.wechatId||"—"}),i.jsx("td",{className:"px-4 py-3 text-gray-400",children:ae.createdAt?new Date(ae.createdAt).toLocaleString():"—"})]},ae.id))})]})});return i.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:i.jsxs(Re,{className:"p-5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),i.jsx(Be,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),i.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"})," API 文档"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ne,{onClick:()=>I(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),i.jsxs(ne,{onClick:L,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),i.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([D,$])=>i.jsx("button",{type:"button",onClick:()=>n(D),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===D?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:$},D))}),e==="overview"&&i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:j.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:dg.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),i.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&W(j,"暂无已提交线索"),e==="contact"&&W(k,"暂无有联系方式线索"),e==="config"&&i.jsx("div",{className:"space-y-4",children:dg.map(D=>i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-white font-medium",children:D.label}),i.jsx(Be,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:D.key})]}),i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"API 地址"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].apiUrl,onChange:$=>X(D.key,{apiUrl:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"API Key"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].apiKey,onChange:$=>X(D.key,{apiKey:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"Source"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].source,onChange:$=>X(D.key,{source:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"Tags"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].tags,onChange:$=>X(D.key,{tags:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"SiteTags"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].siteTags,onChange:$=>X(D.key,{siteTags:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].notes,onChange:$=>X(D.key,{notes:$.target.value})})]})]})]},D.key))}),e==="test"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex gap-3 mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx(Tc,{className:"w-4 h-4 text-gray-500 shrink-0"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:D=>s(D.target.value)})]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:a,onChange:D=>o(D.target.value)})]})]}),i.jsx("div",{className:"flex items-end",children:i.jsxs(ne,{onClick:Y,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[i.jsx(Fi,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:O.map((D,$)=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[D.status==="idle"&&i.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),D.status==="testing"&&i.jsx(qe,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),D.status==="success"&&i.jsx(gg,{className:"w-3 h-3 text-green-400 shrink-0"}),D.status==="error"&&i.jsx(_N,{className:"w-3 h-3 text-red-400 shrink-0"}),i.jsx("span",{className:"text-white text-xs truncate",children:D.label})]}),i.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[D.responseTime!==void 0&&i.jsxs("span",{className:"text-gray-600 text-[10px]",children:[D.responseTime,"ms"]}),i.jsx("button",{type:"button",onClick:()=>Z($),disabled:D.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${D.endpoint}-${$}`))})]}),e==="doc"&&i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),i.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"})," 打开外链"]})]}),i.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||bN})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[i.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),i.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:D=>u(D.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const SV=[{id:"stats",label:"数据统计",icon:PT},{id:"partner",label:"找伙伴",icon:Ln},{id:"resource",label:"资源对接",icon:mM},{id:"mentor",label:"导师预约",icon:hM},{id:"team",label:"团队招募",icon:Ng}];function CV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[s,a]=b.useState("overview");return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),i.jsxs(ne,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[i.jsx(Ss,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&i.jsx(kV,{initialTab:s}),i.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:SV.map(o=>{const c=t===o.id;return i.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[i.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&i.jsx(NV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{a(o||"overview"),r(!0)}}),t==="partner"&&i.jsx(gV,{}),t==="resource"&&i.jsx(xV,{}),t==="mentor"&&i.jsx(bV,{}),t==="team"&&i.jsx(wV,{})]})}function EV(){return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[i.jsx(Ss,{className:"w-8 h-8 text-[#38bdac]"}),i.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),i.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"1. 接口总览"})}),i.jsxs(Re,{className:"space-y-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),i.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[i.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),i.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),i.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),i.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),i.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),i.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),i.jsx("li",{children:"/api/config — 配置系统"})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),i.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),i.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"2. 书籍内容"})}),i.jsxs(Re,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),i.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),i.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"3. 支付"})}),i.jsxs(Re,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),i.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),i.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"4. 分销与用户"})}),i.jsxs(Re,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),i.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),i.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"5. 管理后台"})}),i.jsxs(Re,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),i.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),i.jsx("p",{children:"GET /api/orders — 订单列表"})]})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function TV(){const t=ra();return i.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:i.jsxs("div",{className:"text-center max-w-md",children:[i.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:i.jsx(FT,{className:"w-10 h-10"})}),i.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),i.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),i.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),i.jsx(ne,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:i.jsxs(mg,{to:"/",children:[i.jsx(SM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function MV(){return i.jsxs(oT,{children:[i.jsx(Dt,{path:"/login",element:i.jsx(KR,{})}),i.jsxs(Dt,{path:"/",element:i.jsx(JA,{}),children:[i.jsx(Dt,{index:!0,element:i.jsx(mm,{to:"/dashboard",replace:!0})}),i.jsx(Dt,{path:"dashboard",element:i.jsx(rI,{})}),i.jsx(Dt,{path:"orders",element:i.jsx(sI,{})}),i.jsx(Dt,{path:"users",element:i.jsx(iI,{})}),i.jsx(Dt,{path:"distribution",element:i.jsx(EI,{})}),i.jsx(Dt,{path:"withdrawals",element:i.jsx(TI,{})}),i.jsx(Dt,{path:"content",element:i.jsx(qB,{})}),i.jsx(Dt,{path:"referral-settings",element:i.jsx(jk,{})}),i.jsx(Dt,{path:"author-settings",element:i.jsx(mm,{to:"/settings?tab=author",replace:!0})}),i.jsx(Dt,{path:"vip-roles",element:i.jsx(uV,{})}),i.jsx(Dt,{path:"mentors",element:i.jsx(SE,{})}),i.jsx(Dt,{path:"mentor-consultations",element:i.jsx(hV,{})}),i.jsx(Dt,{path:"admin-users",element:i.jsx(mm,{to:"/settings?tab=admin",replace:!0})}),i.jsx(Dt,{path:"settings",element:i.jsx(tV,{})}),i.jsx(Dt,{path:"payment",element:i.jsx(nV,{})}),i.jsx(Dt,{path:"site",element:i.jsx(aV,{})}),i.jsx(Dt,{path:"qrcodes",element:i.jsx(oV,{})}),i.jsx(Dt,{path:"find-partner",element:i.jsx(CV,{})}),i.jsx(Dt,{path:"match",element:i.jsx(cV,{})}),i.jsx(Dt,{path:"match-records",element:i.jsx(dV,{})}),i.jsx(Dt,{path:"api-doc",element:i.jsx(EV,{})})]}),i.jsx(Dt,{path:"*",element:i.jsx(TV,{})})]})}h4.createRoot(document.getElementById("root")).render(i.jsx(b.StrictMode,{children:i.jsx(mT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:i.jsx(MV,{})})})); diff --git a/soul-admin/dist/assets/index-hM2iAGkr.css b/soul-admin/dist/assets/index-hM2iAGkr.css new file mode 100644 index 00000000..d94e0466 --- /dev/null +++ b/soul-admin/dist/assets/index-hM2iAGkr.css @@ -0,0 +1 @@ +.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:300px;max-height:500px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}/*! tailwindcss v4.1.18 | 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-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--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;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--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-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--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}::-webkit-calendar-picker-indicator{line-height:1}:-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{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-auto{margin-right:auto}.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-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-\[75vh\]{height:75vh}.h-auto{height:auto}.h-full{height:100%}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[2rem\]{min-height:2rem}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-36{width:calc(var(--spacing)*36)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.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-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-500\/30{border-color:#6a72824d}@supports (color:color-mix(in lab,red,red)){.border-gray-500\/30{border-color:color-mix(in oklab,var(--color-gray-500)30%,transparent)}}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0d1f35\]{background-color:#0d1f35}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.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-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.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-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--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}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.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-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);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,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));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,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.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,)!important}.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,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.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))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-amber-500\/40:hover{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.hover\:border-amber-500\/40:hover{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@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}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 7a62eec2..63e92070 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,8 +4,8 @@ 管理后台 - Soul创业派对 - - + +
    diff --git a/soul-admin/tsconfig.tsbuildinfo b/soul-admin/tsconfig.tsbuildinfo index 6c23f859..40e1957d 100644 --- a/soul-admin/tsconfig.tsbuildinfo +++ b/soul-admin/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/client.ts","./src/components/richeditor.tsx","./src/components/modules/user/setvipmodal.tsx","./src/components/modules/user/userdetailmodal.tsx","./src/components/ui/pagination.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/dialog.tsx","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/select.tsx","./src/components/ui/slider.tsx","./src/components/ui/switch.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/components/ui/textarea.tsx","./src/hooks/usedebounce.ts","./src/layouts/adminlayout.tsx","./src/lib/utils.ts","./src/pages/admin-users/adminuserspage.tsx","./src/pages/api-doc/apidocpage.tsx","./src/pages/author-settings/authorsettingspage.tsx","./src/pages/chapters/chapterspage.tsx","./src/pages/content/chaptertree.tsx","./src/pages/content/contentpage.tsx","./src/pages/dashboard/dashboardpage.tsx","./src/pages/distribution/distributionpage.tsx","./src/pages/find-partner/findpartnerpage.tsx","./src/pages/find-partner/tabs/ckbconfigpanel.tsx","./src/pages/find-partner/tabs/ckbstatstab.tsx","./src/pages/find-partner/tabs/findpartnertab.tsx","./src/pages/find-partner/tabs/matchpooltab.tsx","./src/pages/find-partner/tabs/matchrecordstab.tsx","./src/pages/find-partner/tabs/mentorbookingtab.tsx","./src/pages/find-partner/tabs/mentortab.tsx","./src/pages/find-partner/tabs/resourcedockingtab.tsx","./src/pages/find-partner/tabs/teamrecruittab.tsx","./src/pages/login/loginpage.tsx","./src/pages/match/matchpage.tsx","./src/pages/match-records/matchrecordspage.tsx","./src/pages/mentor-consultations/mentorconsultationspage.tsx","./src/pages/mentors/mentorspage.tsx","./src/pages/not-found/notfoundpage.tsx","./src/pages/orders/orderspage.tsx","./src/pages/payment/paymentpage.tsx","./src/pages/qrcodes/qrcodespage.tsx","./src/pages/referral-settings/referralsettingspage.tsx","./src/pages/settings/settingspage.tsx","./src/pages/site/sitepage.tsx","./src/pages/users/userspage.tsx","./src/pages/vip-roles/viprolespage.tsx","./src/pages/withdrawals/withdrawalspage.tsx"],"version":"5.6.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/client.ts","./src/components/richeditor.tsx","./src/components/modules/user/setvipmodal.tsx","./src/components/modules/user/userdetailmodal.tsx","./src/components/ui/pagination.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/dialog.tsx","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/select.tsx","./src/components/ui/slider.tsx","./src/components/ui/switch.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/components/ui/textarea.tsx","./src/hooks/usedebounce.ts","./src/layouts/adminlayout.tsx","./src/lib/utils.ts","./src/pages/admin-users/adminuserspage.tsx","./src/pages/api-doc/apidocpage.tsx","./src/pages/author-settings/authorsettingspage.tsx","./src/pages/chapters/chapterspage.tsx","./src/pages/content/chaptertree.tsx","./src/pages/content/contentpage.tsx","./src/pages/dashboard/dashboardpage.tsx","./src/pages/distribution/distributionpage.tsx","./src/pages/find-partner/findpartnerpage.tsx","./src/pages/find-partner/tabs/ckbconfigpanel.tsx","./src/pages/find-partner/tabs/ckbstatstab.tsx","./src/pages/find-partner/tabs/findpartnertab.tsx","./src/pages/find-partner/tabs/matchpooltab.tsx","./src/pages/find-partner/tabs/matchrecordstab.tsx","./src/pages/find-partner/tabs/mentorbookingtab.tsx","./src/pages/find-partner/tabs/mentortab.tsx","./src/pages/find-partner/tabs/resourcedockingtab.tsx","./src/pages/find-partner/tabs/teamrecruittab.tsx","./src/pages/login/loginpage.tsx","./src/pages/match/matchpage.tsx","./src/pages/match-records/matchrecordspage.tsx","./src/pages/mentor-consultations/mentorconsultationspage.tsx","./src/pages/mentors/mentorspage.tsx","./src/pages/not-found/notfoundpage.tsx","./src/pages/orders/orderspage.tsx","./src/pages/payment/paymentpage.tsx","./src/pages/qrcodes/qrcodespage.tsx","./src/pages/referral-settings/referralsettingspage.tsx","./src/pages/settings/settingspage.tsx","./src/pages/site/sitepage.tsx","./src/pages/users/userspage.tsx","./src/pages/vip-roles/viprolespage.tsx","./src/pages/withdrawals/withdrawalspage.tsx","./src/utils/toast.ts"],"version":"5.6.3"} \ No newline at end of file