From e75092eaaddf711e8be94c72fa968a4862f13a99 Mon Sep 17 00:00:00 2001 From: Alex-larget <33240357+Alex-larget@users.noreply.github.com> Date: Mon, 16 Mar 2026 13:30:05 +0800 Subject: [PATCH] Refactor mini program environment configuration and remove deprecated debug features - Simplified the environment configuration in app.js by removing the debug environment options and related functions. - Set a default API base URL for production while allowing commented options for local and testing environments. - Cleaned up settings.js by removing the debug environment label and switching functionality, streamlining the user interface. - Updated documentation to reflect the removal of debug features and added a summary of synchronization requirements in the planning document. --- .cursor/docs/目录无法加载-排查分析.md | 74 +++++ macos-vm/export-macos-vm.ps1 | 20 ++ macos-vm/安装mac.bat | 62 ++++ macos-vm/迁移-macos-vm-到E盘.bat | 57 ++++ miniprogram/app.js | 65 +--- miniprogram/pages/settings/settings.js | 17 +- miniprogram/pages/settings/settings.wxml | 9 - scripts/test/check-catalog-api.py | 122 +++++++ scripts/test/process/cleanup_test_data.py | 75 +++++ .../{index-BZAN98xm.js => index-BQTdJZ32.js} | 246 +++++++------- soul-admin/dist/index.html | 2 +- soul-api/wechat/info.log | 307 ++++++++++++++++++ .../1、需求/链接人与事-存客宝同步-需求规划.md | 3 +- 开发文档/1、需求/链接人与事-所有同步需求.md | 64 ++++ 开发文档/1、需求/需求汇总.md | 1 + 15 files changed, 915 insertions(+), 209 deletions(-) create mode 100644 .cursor/docs/目录无法加载-排查分析.md create mode 100644 macos-vm/export-macos-vm.ps1 create mode 100644 macos-vm/安装mac.bat create mode 100644 macos-vm/迁移-macos-vm-到E盘.bat create mode 100644 scripts/test/check-catalog-api.py create mode 100644 scripts/test/process/cleanup_test_data.py rename soul-admin/dist/assets/{index-BZAN98xm.js => index-BQTdJZ32.js} (63%) create mode 100644 开发文档/1、需求/链接人与事-所有同步需求.md diff --git a/.cursor/docs/目录无法加载-排查分析.md b/.cursor/docs/目录无法加载-排查分析.md new file mode 100644 index 00000000..d420e983 --- /dev/null +++ b/.cursor/docs/目录无法加载-排查分析.md @@ -0,0 +1,74 @@ +# 正式版小程序「目录无法加载数据」排查分析 + +## 一、数据流梳理 + +| 页面/时机 | 接口 | 用途 | +|----------|------|------| +| App onLaunch | `GET /api/miniprogram/book/all-chapters` | 预加载全书章节到 globalData.bookData | +| 目录页 onLoad | `GET /api/miniprogram/book/parts` | **主接口**:懒加载篇章列表(不含章节详情) | +| 目录页展开篇章 | `GET /api/miniprogram/book/chapters-by-part?partId=xxx` | 按篇章拉取章节列表 | + +**目录页展示依赖的是 `book/parts`**,不依赖 `all-chapters`。`all-chapters` 失败只会影响首页等处的预加载,目录页应能独立加载。 + +--- + +## 二、后端接口验证结果 + +运行 `SOUL_TEST_ENV=soulapi python scripts/test/check-catalog-api.py` 实测: + +- **book/parts**:✅ 正常,返回 6 个篇章、90 个章节、5 个固定模块 +- **all-chapters**:偶发 SSL 连接中断(大响应体时) +- **health**:偶发 SSL 握手超时 + +**结论**:正式环境 soulapi 的 `book/parts` 接口可用且数据正常,后端不是主要瓶颈。 + +--- + +## 三、可能原因与排查步骤 + +### 1. baseUrl 指向错误 + +- **现象**:正式版请求到 souldev 或 localhost +- **处理**:`app.js` 中 baseUrl 改为注释切换方式,正式环境使用 `https://soulapi.quwanzhi.com` + +### 2. 服务器域名未配置(优先排查) + +- **现象**:正式版请求失败,开发工具勾选「不校验合法域名」时正常 +- **处理**:微信公众平台 → 开发 → 开发管理 → 开发设置 → 服务器域名 → **request 合法域名** +- **必须包含**:`https://soulapi.quwanzhi.com` +- **注意**:正式版、体验版都会校验,缺配置会导致请求被拦截 + +### 3. 正式环境数据库为空 + +- **现象**:接口返回 `parts: []`、`totalSections: 0` +- **排查**:执行诊断脚本,若 parts 为空则检查正式库 `chapters` 表 +- **处理**:确认正式库已导入 `soul_miniprogram.sql` 及必要迁移脚本 + +### 4. SSL/网络不稳定 + +- **现象**:偶发连接中断、超时 +- **排查**:多次调用诊断脚本,观察是否间歇失败 +- **处理**:检查正式服务器 SSL 配置、反向代理、超时设置 + +### 5. 前端错误处理导致无提示 + +- **现象**:请求失败但用户只看到空白 +- **代码**:`chapters.js` 的 `loadParts` 在 catch 中 `setData({ bookData: [], totalSections: 0 })`,不弹窗 +- **建议**:可在 catch 中增加 `wx.showToast({ title: '加载失败,请重试', icon: 'none' })` 便于用户感知 + +--- + +## 四、建议操作顺序 + +1. **确认 request 合法域名**:在微信公众平台添加 `https://soulapi.quwanzhi.com` +2. **本地验证接口**:`SOUL_TEST_ENV=soulapi python scripts/test/check-catalog-api.py` +3. **正式版真机测试**:清除小程序缓存后重新打开,观察目录页是否加载 +4. **若仍失败**:在 `chapters.js` 的 `loadParts` 中加 `console.log` 或 `wx.showModal` 输出错误信息,便于定位 + +--- + +## 五、相关文件 + +- 小程序:`miniprogram/app.js`(baseUrl)、`miniprogram/pages/chapters/chapters.js`(loadParts) +- 后端:`soul-api/internal/handler/book.go`(BookParts、BookChaptersByPart) +- 诊断脚本:`scripts/test/check-catalog-api.py` diff --git a/macos-vm/export-macos-vm.ps1 b/macos-vm/export-macos-vm.ps1 new file mode 100644 index 00000000..787ff63f --- /dev/null +++ b/macos-vm/export-macos-vm.ps1 @@ -0,0 +1,20 @@ +$ErrorActionPreference = "Stop" + +$timestamp = Get-Date -Format "yyyyMMdd_HHmmss" +$src = "C:\Users\29195\Mycontent\macos-vm\OneClick-macOS-Simple-KVM" +$dst = "C:\Users\29195\Mycontent\macos-vm\macos-vm-snapshot-$timestamp.zip" + +Write-Host "打包目录: $src" +Write-Host "目标文件: $dst" + +if (-not (Test-Path $src)) { + Write-Error "源目录不存在:$src" +} + +if (Test-Path $dst) { + Remove-Item $dst -Force +} + +Compress-Archive -Path $src -DestinationPath $dst -Force +Write-Host '打包完成.' + diff --git a/macos-vm/安装mac.bat b/macos-vm/安装mac.bat new file mode 100644 index 00000000..9932eae6 --- /dev/null +++ b/macos-vm/安装mac.bat @@ -0,0 +1,62 @@ +@echo off +chcp 65001 >nul +title 安装 macOS 虚拟机(龙虾方案) + +setlocal + +echo ============================================ +echo 安装 macOS 虚拟机(WSL2 + QEMU + OneClick) +echo ============================================ +echo. + +rem 1. 定位 Python 安装脚本(仓库内已有) +set "ROOT=%~dp0.." +set "PY_SCRIPT=%ROOT%开发文档\服务器管理\scripts\lobster_macos_vm.py" + +if not exist "%PY_SCRIPT%" ( + echo [错误] 找不到 Python 安装脚本: + echo %PY_SCRIPT% + echo 请确认仓库已完整同步。 + pause + exit /b 1 +) + +rem 2. 检查 Python +where python >nul 2>&1 +if errorlevel 1 ( + where py >nul 2>&1 + if errorlevel 1 ( + echo [错误] 未检测到 Python 3,请先安装 Python 3 再运行本脚本。 + echo 将打开 Python 官网下載頁面,請安裝完後重新運行本腳本。 + start "" "https://www.python.org/downloads/windows/" + pause + exit /b 1 + ) +) + +rem 3. 检查 / 引导安装 TightVNC +echo [1] 检查 TightVNC Viewer ... +set "TVN=%ProgramFiles%\TightVNC\tvnviewer.exe" +if not exist "%TVN%" set "TVN=%ProgramFiles(x86)%\TightVNC\tvnviewer.exe" + +if exist "%TVN%" ( + echo 已检测到 TightVNC: %TVN% +) else ( + echo 未检测到 TightVNC,將打開官網請手動下載並安裝。 + start "" "https://www.tightvnc.com/download.php" +) + +echo. +echo [2] 開始調用 Python 腳本,一鍵安裝 macOS 虛擬機 ... +echo 腳本將檢查 WSL/Ubuntu、下載 OneClick、安裝 QEMU、下載 macOS 恢復鏡像等。 +echo. + +python "%PY_SCRIPT%" || py -3 "%PY_SCRIPT%" + +echo. +echo [3] 安裝流程結束(若上方無紅色錯誤信息,即表示完成)。 +echo 之後可使用同目錄下的「一键启动-macOS虚拟机.bat」啟動虛擬機。 +echo ============================================ +echo. +pause + diff --git a/macos-vm/迁移-macos-vm-到E盘.bat b/macos-vm/迁移-macos-vm-到E盘.bat new file mode 100644 index 00000000..ff8acc69 --- /dev/null +++ b/macos-vm/迁移-macos-vm-到E盘.bat @@ -0,0 +1,57 @@ +@echo off +chcp 65001 >nul +title 迁移 macOS 虚拟机 到 E:\Gongsi\Mycontent\macos-vm + +echo ============================================ +echo 迁移 macOS 虚拟机目录 到 E:\Gongsi\Mycontent\macos-vm +echo ============================================ +echo. + +setlocal + +set "SRC=C:\Users\%USERNAME%\Mycontent\macos-vm" +set "DST=E:\Gongsi\Mycontent\macos-vm" + +echo [1] 源目录: %SRC% +echo [1] 目标目录: %DST% +echo. + +if not exist "%SRC%" ( + echo [错误] 未找到源目录: %SRC% + echo 请确认当前用户下已存在 macos-vm 目录。 + pause + exit /b 1 +) + +rem 尝试关闭正在运行的 QEMU(通过 WSL) +echo [2] 尝试关闭正在运行的 macOS 虚拟机(如有)... +wsl -d Ubuntu-24.04 -e bash -lc "ps -ef | grep qemu-system-x86_64 | grep -v grep || true" >nul 2>&1 +for /f "tokens=2" %%P in ('wsl -d Ubuntu-24.04 -e bash -lc "ps -ef | grep qemu-system-x86_64 | grep -v grep || true" ^| find "qemu-system-x86_64"') do ( + echo 检测到 QEMU 进程 PID=%%P,正在尝试结束... + wsl -d Ubuntu-24.04 -e bash -lc "sudo kill -TERM %%P; sleep 2; ps -p %%P >/dev/null && sudo kill -KILL %%P || true" >nul 2>&1 +) + +echo [3] 创建目标目录(如不存在)... +mkdir "%DST%" 2>nul + +echo [4] 使用 robocopy 迁移所有文件(可能需要一段时间)... +echo. +robocopy "%SRC%" "%DST%" /MIR + +if errorlevel 8 ( + echo. + echo [警告] robocopy 返回代码 %errorlevel%(>=8),可能有错误,請檢查上方輸出。 + echo 不會自動刪除源目錄,請手動確認。 + pause + exit /b 1 +) + +echo. +echo [5] 迁移完成。 +echo 源目录: %SRC% +echo 目标目录: %DST% +echo. +echo 如確認新位置可以正常啟動虛擬機,可手動刪除源目錄以釋放 C 盤空間。 +echo ============================================ +pause + diff --git a/miniprogram/app.js b/miniprogram/app.js index ac5ce62e..a3755b46 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -5,42 +5,12 @@ const { parseScene } = require('./utils/scene.js') -// 调试环境配置:''=自动 | localhost | souldev | soulapi -const DEBUG_ENV_OPTIONS = [ - { key: '', label: '自动', url: null }, - { key: 'localhost', label: '本地', url: 'http://localhost:8080' }, - { key: 'souldev', label: '测试', url: 'https://souldev.quwanzhi.com' }, - { key: 'soulapi', label: '正式', url: 'https://soulapi.quwanzhi.com' } -] -const STORAGE_KEY_DEBUG_ENV = 'debug_env_override' - -// 根据小程序环境版本或调试覆盖选择 API 地址 -function getBaseUrlByEnv(override) { - if (override) { - const opt = DEBUG_ENV_OPTIONS.find(o => o.key === override) - if (opt && opt.url) return opt.url - } - try { - const accountInfo = wx.getAccountInfoSync() - const env = accountInfo?.miniProgram?.envVersion || 'release' - const urls = { - develop: 'http://localhost:8080', // 开发版(本地调试) - trial: 'https://souldev.quwanzhi.com', // 体验版 - release: 'https://soulapi.quwanzhi.com' // 正式版 - } - return urls[env] || urls.release - } catch (e) { - console.warn('[App] 获取环境失败,使用正式版:', e) - return 'https://soulapi.quwanzhi.com' - } -} - App({ globalData: { - // API基础地址 - 由 getBaseUrlByEnv() 在 onLaunch 时按环境自动设置 - baseUrl: '', - // 调试环境覆盖:'' | localhost | souldev | soulapi,持久化到 storage - debugEnvOverride: '', + // API 基础地址(切换环境时注释/取消注释) + baseUrl: 'https://soulapi.quwanzhi.com', + // baseUrl: 'http://localhost:8080', // 本地调试 + // baseUrl: 'https://souldev.quwanzhi.com', // 测试环境 // 小程序配置 - 真实AppID @@ -100,8 +70,8 @@ App({ }, onLaunch(options) { - this.globalData.debugEnvOverride = wx.getStorageSync(STORAGE_KEY_DEBUG_ENV) || '' - this.globalData.baseUrl = getBaseUrlByEnv(this.globalData.debugEnvOverride) + // 清理已废弃的调试环境 storage(取消环境切换后不再使用) + try { wx.removeStorageSync('debug_env_override') } catch (_) {} this.globalData.readSectionIds = wx.getStorageSync('readSectionIds') || [] // 获取系统信息 this.getSystemInfo() @@ -280,28 +250,6 @@ App({ return '' }, - // 调试:获取当前 API 环境信息 - getDebugEnvInfo() { - const override = this.globalData.debugEnvOverride || '' - const opt = DEBUG_ENV_OPTIONS.find(o => o.key === override) - return { - override, - label: opt ? opt.label : '自动', - baseUrl: this.globalData.baseUrl - } - }, - - // 调试:一键切换 API 环境(自动→本地→测试→正式→自动),持久化到 storage - switchDebugEnv() { - const idx = DEBUG_ENV_OPTIONS.findIndex(o => o.key === this.globalData.debugEnvOverride) - const nextIdx = (idx + 1) % DEBUG_ENV_OPTIONS.length - const next = DEBUG_ENV_OPTIONS[nextIdx] - this.globalData.debugEnvOverride = next.key - this.globalData.baseUrl = getBaseUrlByEnv(next.key) - wx.setStorageSync(STORAGE_KEY_DEBUG_ENV, next.key) - return next - }, - /** * 自定义导航栏「返回」:有上一页则返回,否则跳转首页(解决从分享进入时点返回无效的问题) */ @@ -480,7 +428,6 @@ App({ return new Promise((resolve, reject) => { const token = wx.getStorageSync('token') - wx.request({ url: this.globalData.baseUrl + url, method: options.method || 'GET', diff --git a/miniprogram/pages/settings/settings.js b/miniprogram/pages/settings/settings.js index d9dbd619..999a064a 100644 --- a/miniprogram/pages/settings/settings.js +++ b/miniprogram/pages/settings/settings.js @@ -14,8 +14,6 @@ Page({ // 切换账号(开发) showSwitchAccountModal: false, - // 调试环境:当前 API 环境标签 - apiEnvLabel: '自动', switchAccountUserId: '', switchAccountLoading: false, @@ -38,30 +36,17 @@ Page({ wx.showShareMenu({ withShareTimeline: true }) const accountInfo = wx.getAccountInfoSync ? wx.getAccountInfoSync() : null const envVersion = accountInfo?.miniProgram?.envVersion || '' - const envInfo = app.getDebugEnvInfo() this.setData({ statusBarHeight: app.globalData.statusBarHeight, isLoggedIn: app.globalData.isLoggedIn, userInfo: app.globalData.userInfo, - isDevMode: envVersion === 'develop', - apiEnvLabel: envInfo.label + isDevMode: envVersion === 'develop' }) this.loadBindingInfo() }, onShow() { this.loadBindingInfo() - if (this.data.isDevMode) { - const envInfo = getApp().getDebugEnvInfo() - this.setData({ apiEnvLabel: envInfo.label }) - } - }, - - // 一键切换 API 环境(开发版) - switchApiEnv() { - const next = getApp().switchDebugEnv() - this.setData({ apiEnvLabel: next.label }) - wx.showToast({ title: `已切到 ${next.label}`, icon: 'none' }) }, // 加载绑定信息 diff --git a/miniprogram/pages/settings/settings.wxml b/miniprogram/pages/settings/settings.wxml index cd7bcb39..7c8f5d6d 100644 --- a/miniprogram/pages/settings/settings.wxml +++ b/miniprogram/pages/settings/settings.wxml @@ -109,15 +109,6 @@ 提示:绑定微信号才能使用提现功能 - - - - 🌐 - 切换环境 - 当前:{{apiEnvLabel}}(点击循环:自动→本地→测试→正式) - - - diff --git a/scripts/test/check-catalog-api.py b/scripts/test/check-catalog-api.py new file mode 100644 index 00000000..ab8e9e18 --- /dev/null +++ b/scripts/test/check-catalog-api.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +目录接口诊断脚本 - 检查正式环境 soulapi 的 /api/miniprogram/book/* 是否正常 +用法: + python scripts/test/check-catalog-api.py + SOUL_TEST_ENV=soulapi python scripts/test/check-catalog-api.py +""" +import json +import sys +from pathlib import Path + +# 加载测试配置 +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from config import API_BASE, ENV_LABEL, get_env_banner + +try: + import urllib.request + import urllib.error + _urlopen = urllib.request.urlopen + _Request = urllib.request.Request + _HTTPError = urllib.error.HTTPError + _URLError = urllib.error.URLError +except ImportError: + import urllib2 + _urlopen = urllib2.urlopen + _Request = urllib2.Request + _HTTPError = urllib2.HTTPError + _URLError = urllib2.URLError + +def fetch(url, timeout=10): + """GET 请求,返回 (parsed_json, status_code, error_msg)""" + try: + req = _Request(url) + req.get_method = lambda: "GET" + req.add_header("Content-Type", "application/json") + resp = _urlopen(req, timeout=timeout) + body = resp.read().decode("utf-8", errors="replace") + code = getattr(resp, "status", resp.getcode() if hasattr(resp, "getcode") else 200) + try: + data = json.loads(body) + except json.JSONDecodeError: + return None, code, "非 JSON 响应: " + body[:200] + return data, code, None + except _HTTPError as e: + try: + body = e.read().decode("utf-8", errors="replace") + data = json.loads(body) if body else {} + except Exception: + data = {} + return data, e.code, str(e) + except _URLError as e: + return None, None, str(e.reason) if hasattr(e, "reason") else str(e) + except Exception as e: + return None, None, str(e) + + +def main(): + print(get_env_banner()) + base = API_BASE.rstrip("/") + + endpoints = [ + ("/api/miniprogram/book/parts", "目录-篇章列表(目录页主接口)"), + ("/api/miniprogram/book/all-chapters", "全书章节(app.loadBookData)"), + ("/health", "健康检查"), + ] + + all_ok = True + for path, desc in endpoints: + url = base + path + print(f"\n--- {desc} ---") + print(f"URL: {url}") + data, code, err = fetch(url) + if err: + print("[FAIL] 请求失败:", err) + all_ok = False + continue + if code and code != 200: + print("[FAIL] HTTP", code) + if data: + print(f" 响应: {json.dumps(data, ensure_ascii=False)[:300]}") + all_ok = False + continue + if not data: + print("[FAIL] 无响应体") + all_ok = False + continue + + success = data.get("success") + if path == "/health": + status = data.get("status", "?") + print("[OK] status=%s, version=%s" % (status, data.get("version", "?"))) + elif path == "/api/miniprogram/book/parts": + parts = data.get("parts") or [] + total = data.get("totalSections", 0) + fixed = data.get("fixedSections") or [] + print("[OK] success=%s, parts=%d, totalSections=%d, fixedSections=%d" % (success, len(parts), total, len(fixed))) + if not parts and total == 0: + print(" [WARN] 篇章为空! 请检查正式环境数据库 chapters 表") + elif parts: + print(" 首篇章: id=%s, title=%s" % (parts[0].get("id"), parts[0].get("title"))) + elif path == "/api/miniprogram/book/all-chapters": + arr = data.get("data") or data.get("chapters") or [] + print("[OK] success=%s, data=%d 条" % (success, len(arr))) + if not arr: + print(" [WARN] 章节列表为空! 请检查 chapters 表") + elif arr: + first = arr[0] if isinstance(arr[0], dict) else {} + print(" 首条: id=%s, partTitle=%s" % (first.get("id"), first.get("partTitle"))) + + print("\n" + "=" * 50) + if all_ok: + print("[OK] 所有接口正常,若小程序仍无法加载,请检查:") + print(" 1. 微信公众平台 → 服务器域名 → request 合法域名 是否包含 soulapi.quwanzhi.com") + print(" 2. 正式版小程序 baseUrl 是否为 https://soulapi.quwanzhi.com") + else: + print("[FAIL] 存在异常,请根据上述输出排查后端或数据库") + print("=" * 50) + + +if __name__ == "__main__": + main() diff --git a/scripts/test/process/cleanup_test_data.py b/scripts/test/process/cleanup_test_data.py new file mode 100644 index 00000000..8acdd8b4 --- /dev/null +++ b/scripts/test/process/cleanup_test_data.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +""" +清理流程测试产生的数据:persons(测试自动创建_、测试新人物_)、chapters(t 开头的 6 位数字 id) +用法:cd scripts/test && python process/cleanup_test_data.py +""" +import os +import re +import sys + +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +import requests + +API_BASE = os.environ.get("SOUL_API_BASE", "http://localhost:8080").rstrip("/") +ADMIN_USER = os.environ.get("SOUL_ADMIN_USERNAME", "admin") +ADMIN_PASS = os.environ.get("SOUL_ADMIN_PASSWORD", "admin123") + + +def main(): + r = requests.post( + f"{API_BASE}/api/admin", + json={"username": ADMIN_USER, "password": ADMIN_PASS}, + timeout=10, + ) + if not r.json().get("success") or not r.json().get("token"): + print("登录失败") + return 1 + token = r.json()["token"] + headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"} + + # 1. 删除测试 Person + rp = requests.get(f"{API_BASE}/api/db/persons", headers=headers, timeout=10) + if rp.json().get("success"): + persons = rp.json().get("persons") or [] + for p in persons: + name = p.get("name") or "" + if name.startswith("测试自动创建_") or name.startswith("测试新人物_"): + pid = p.get("personId") + rd = requests.delete( + f"{API_BASE}/api/db/persons?personId={pid}", + headers=headers, + timeout=10, + ) + if rd.json().get("success"): + print(f" 已删除 Person: {name} ({pid})") + else: + print(f" 删除 Person 失败: {name} - {rd.json()}") + + # 2. 删除测试 Chapter(id 形如 t123456) + rl = requests.get( + f"{API_BASE}/api/db/book?action=list", + headers=headers, + timeout=10, + ) + if rl.json().get("success"): + sections = rl.json().get("sections") or [] + for s in sections: + sid = s.get("id") or "" + if re.match(r"^t\d{6}$", sid): + rd = requests.delete( + f"{API_BASE}/api/db/book?id={sid}", + headers=headers, + timeout=10, + ) + if rd.json().get("success"): + print(f" 已删除 Chapter: {sid} ({s.get('title', '')})") + else: + print(f" 删除 Chapter 失败: {sid} - {rd.json()}") + + print("清理完成") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/soul-admin/dist/assets/index-BZAN98xm.js b/soul-admin/dist/assets/index-BQTdJZ32.js similarity index 63% rename from soul-admin/dist/assets/index-BZAN98xm.js rename to soul-admin/dist/assets/index-BQTdJZ32.js index f1dd777c..a2cea3ce 100644 --- a/soul-admin/dist/assets/index-BZAN98xm.js +++ b/soul-admin/dist/assets/index-BQTdJZ32.js @@ -1,4 +1,4 @@ -function h3(t,e){for(var n=0;nr[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)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(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function EN(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pm={exports:{}},wc={},mm={exports:{}},ut={};/** +function h3(t,e){for(var n=0;nr[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)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(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function TN(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mm={exports:{}},Nc={},gm={exports:{}},ft={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ function h3(t,e){for(var n=0;n>>1,H=z[$];if(0>>1;$i(fe,G))Xi(de,fe)?(z[$]=de,z[X]=G,$=X):(z[$]=fe,z[W]=G,$=W);else if(Xi(de,G))z[$]=de,z[X]=G,$=X;else break e}}return ie}function i(z,ie){var G=z.sortIndex-ie.sortIndex;return G!==0?G:z.id-ie.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,w=!1,N=!1,b=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(z){for(var ie=n(h);ie!==null;){if(ie.callback===null)r(h);else if(ie.startTime<=z)r(h),ie.sortIndex=ie.expirationTime,e(u,ie);else break;ie=n(h)}}function T(z){if(N=!1,E(z),!w)if(n(u)!==null)w=!0,F(I);else{var ie=n(h);ie!==null&&re(T,ie.startTime-z)}}function I(z,ie){w=!1,N&&(N=!1,k(P),P=-1),y=!0;var G=g;try{for(E(ie),m=n(u);m!==null&&(!(m.expirationTime>ie)||z&&!J());){var $=m.callback;if(typeof $=="function"){m.callback=null,g=m.priorityLevel;var H=$(m.expirationTime<=ie);ie=t.unstable_now(),typeof H=="function"?m.callback=H:m===n(u)&&r(u),E(ie)}else r(u);m=n(u)}if(m!==null)var ce=!0;else{var W=n(h);W!==null&&re(T,W.startTime-ie),ce=!1}return ce}finally{m=null,g=G,y=!1}}var O=!1,D=null,P=-1,L=5,_=-1;function J(){return!(t.unstable_now()-_z||125$?(z.sortIndex=G,e(h,z),n(u)===null&&z===n(h)&&(N?(k(P),P=-1):N=!0,re(T,G-$))):(z.sortIndex=H,e(u,z),w||y||(w=!0,F(I))),z},t.unstable_shouldYield=J,t.unstable_wrapCallback=function(z){var ie=g;return function(){var G=g;g=ie;try{return z.apply(this,arguments)}finally{g=G}}}})(ym)),ym}var yb;function x3(){return yb||(yb=1,xm.exports=g3()),xm.exports}/** + */var yb;function g3(){return yb||(yb=1,(function(t){function e(z,ie){var G=z.length;z.push(ie);e:for(;0>>1,V=z[$];if(0>>1;$i(fe,G))Xi(de,fe)?(z[$]=de,z[X]=G,$=X):(z[$]=fe,z[W]=G,$=W);else if(Xi(de,G))z[$]=de,z[X]=G,$=X;else break e}}return ie}function i(z,ie){var G=z.sortIndex-ie.sortIndex;return G!==0?G:z.id-ie.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,w=!1,N=!1,b=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(z){for(var ie=n(h);ie!==null;){if(ie.callback===null)r(h);else if(ie.startTime<=z)r(h),ie.sortIndex=ie.expirationTime,e(u,ie);else break;ie=n(h)}}function T(z){if(N=!1,E(z),!w)if(n(u)!==null)w=!0,F(I);else{var ie=n(h);ie!==null&&re(T,ie.startTime-z)}}function I(z,ie){w=!1,N&&(N=!1,k(P),P=-1),y=!0;var G=g;try{for(E(ie),m=n(u);m!==null&&(!(m.expirationTime>ie)||z&&!J());){var $=m.callback;if(typeof $=="function"){m.callback=null,g=m.priorityLevel;var V=$(m.expirationTime<=ie);ie=t.unstable_now(),typeof V=="function"?m.callback=V:m===n(u)&&r(u),E(ie)}else r(u);m=n(u)}if(m!==null)var ce=!0;else{var W=n(h);W!==null&&re(T,W.startTime-ie),ce=!1}return ce}finally{m=null,g=G,y=!1}}var O=!1,D=null,P=-1,L=5,_=-1;function J(){return!(t.unstable_now()-_z||125$?(z.sortIndex=G,e(h,z),n(u)===null&&z===n(h)&&(N?(k(P),P=-1):N=!0,re(T,G-$))):(z.sortIndex=V,e(u,z),w||y||(w=!0,F(I))),z},t.unstable_shouldYield=J,t.unstable_wrapCallback=function(z){var ie=g;return function(){var G=g;g=ie;try{return z.apply(this,arguments)}finally{g=G}}}})(vm)),vm}var vb;function x3(){return vb||(vb=1,ym.exports=g3()),ym.exports}/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ function h3(t,e){for(var n=0;n"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 w(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 N(l,d,p,x,j,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=j,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){b[l]=new N(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];b[d]=new N(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){b[l]=new N(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){b[l]=new N(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){b[l]=new N(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){b[l]=new N(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){b[l]=new N(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){b[l]=new N(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){b[l]=new N(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function C(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,C);b[d]=new N(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,C);b[d]=new N(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,C);b[d]=new N(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){b[l]=new N(l,1,!1,l.toLowerCase(),null,!1,!1)}),b.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){b[l]=new N(l,1,!1,l.toLowerCase(),null,!0,!0)});function E(l,d,p,x){var j=b.hasOwnProperty(d)?b[d]:null;(j!==null?j.type!==0:x||!(2"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 w(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 N(l,d,p,x,j,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=j,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){b[l]=new N(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];b[d]=new N(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){b[l]=new N(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){b[l]=new N(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){b[l]=new N(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){b[l]=new N(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){b[l]=new N(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){b[l]=new N(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){b[l]=new N(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function C(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,C);b[d]=new N(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,C);b[d]=new N(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,C);b[d]=new N(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){b[l]=new N(l,1,!1,l.toLowerCase(),null,!1,!1)}),b.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){b[l]=new N(l,1,!1,l.toLowerCase(),null,!0,!0)});function E(l,d,p,x){var j=b.hasOwnProperty(d)?b[d]:null;(j!==null?j.type!==0:x||!(2B||j[A]!==S[B]){var K=` -`+j[A].replace(" at new "," at ");return l.displayName&&K.includes("")&&(K=K.replace("",l.displayName)),K}while(1<=A&&0<=B);break}}}finally{ce=!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=W(l.type,!1),l;case 11:return l=W(l.type.render,!1),l;case 1:return l=W(l.type,!0),l;default:return""}}function X(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 D:return"Fragment";case O:return"Portal";case L:return"Profiler";case P:return"StrictMode";case Y:return"Suspense";case U:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case J:return(l.displayName||"Context")+".Consumer";case _:return(l._context.displayName||"Context")+".Provider";case ee:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case R:return d=l.displayName||null,d!==null?d:X(l.type)||"Memo";case F:d=l._payload,l=l._init;try{return X(l(d))}catch{}}return null}function de(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 X(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 he(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function we(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function Te(l){var d=we(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 j=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return j.call(this)},set:function(A){x=""+A,S.call(this,A)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(A){x=""+A},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function Ve(l){l._valueTracker||(l._valueTracker=Te(l))}function He(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=we(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function gt(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 Pt(l,d){var p=d.checked;return G({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function yn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=he(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 ht(l,d){d=d.checked,d!=null&&E(l,"checked",d,!1)}function At(l,d){ht(l,d);var p=he(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")?Pe(l,d.type,p):d.hasOwnProperty("defaultValue")&&Pe(l,d.type,he(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function ne(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 Pe(l,d,p){(d!=="number"||gt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Qe=Array.isArray;function xt(l,d,p,x){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=Dt.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Zr(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var ar={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},me=["Webkit","ms","Moz","O"];Object.keys(ar).forEach(function(l){me.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),ar[d]=ar[l]})});function ve(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||ar.hasOwnProperty(l)&&ar[l]?(""+d).trim():d+"px"}function or(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=ve(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,j):l[p]=j}}var Hs=G({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 ki(l,d){if(d){if(Hs[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 Si(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 Sr=null;function Aa(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var _r=null,es=null,lr=null;function Ci(l){if(l=ac(l)){if(typeof _r!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Od(d),_r(l.stateNode,l.type,d))}}function Ia(l){es?lr?lr.push(l):lr=[l]:es=l}function Ws(){if(es){var l=es,d=lr;if(lr=es=null,Ci(l),d)for(l=0;l>>=0,l===0?32:31-(Mn(l)/cr|0)|0}var Jt=64,_n=4194304;function ss(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 Ss(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,j=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var B=A&~j;B!==0?x=ss(B):(S&=A,S!==0&&(x=ss(S)))}else A=p&~j,A!==0?x=ss(A):S!==0&&(x=ss(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&j)===0&&(j=x&-x,S=d&-d,j>=S||j===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 Qs(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-et(d),l[d]=p}function vd(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=Ql),ay=" ",oy=!1;function ly(l,d){switch(l){case"keyup":return oE.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Lo=!1;function cE(l,d){switch(l){case"compositionend":return cy(d);case"keypress":return d.which!==32?null:(oy=!0,ay);case"textInput":return l=d.data,l===ay&&oy?null:l;default:return null}}function dE(l,d){if(Lo)return l==="compositionend"||!Gf&&ly(l,d)?(l=ey(),jd=Vf=Ri=null,Lo=!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=gy(p)}}function yy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?yy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function vy(){for(var l=window,d=gt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=gt(l.document)}return d}function Qf(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 vE(l){var d=vy(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&yy(p.ownerDocument.documentElement,p)){if(x!==null&&Qf(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 j=p.textContent.length,S=Math.min(x.start,j);x=x.end===void 0?S:Math.min(x.end,j),!l.extend&&S>x&&(j=x,x=S,S=j),j=xy(p,S);var A=xy(p,x);j&&A&&(l.rangeCount!==1||l.anchorNode!==j.node||l.anchorOffset!==j.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(j.node,j.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(A.node,A.offset)):(d.setEnd(A.node,A.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,_o=null,Xf=null,tc=null,Zf=!1;function by(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Zf||_o==null||_o!==gt(x)||(x=_o,"selectionStart"in x&&Qf(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}),tc&&ec(tc,x)||(tc=x,x=Id(Xf,"onSelect"),0Vo||(l.current=up[Vo],up[Vo]=null,Vo--)}function Lt(l,d){Vo++,up[Vo]=l.current,l.current=d}var Li={},qn=Di(Li),xr=Di(!1),za=Li;function Ho(l,d){var p=l.type.contextTypes;if(!p)return Li;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var j={},S;for(S in p)j[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=j),j}function yr(l){return l=l.childContextTypes,l!=null}function Dd(){Ht(xr),Ht(qn)}function Dy(l,d,p){if(qn.current!==Li)throw Error(n(168));Lt(qn,d),Lt(xr,p)}function Ly(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var j in x)if(!(j in d))throw Error(n(108,de(l)||"Unknown",j));return G({},p,x)}function Ld(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Li,za=qn.current,Lt(qn,l),Lt(xr,xr.current),!0}function _y(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Ly(l,d,za),x.__reactInternalMemoizedMergedChildContext=l,Ht(xr),Ht(qn),Lt(qn,l)):Ht(xr),Lt(xr,p)}var ei=null,_d=!1,hp=!1;function zy(l){ei===null?ei=[l]:ei.push(l)}function IE(l){_d=!0,zy(l)}function _i(){if(!hp&&ei!==null){hp=!0;var l=0,d=yt;try{var p=ei;for(yt=1;l>=A,j-=A,ti=1<<32-et(d)+j|p<tt?(Rn=Ye,Ye=null):Rn=Ye.sibling;var vt=be(se,Ye,le[tt],Ee);if(vt===null){Ye===null&&(Ye=Rn);break}l&&Ye&&vt.alternate===null&&d(se,Ye),Q=S(vt,Q,tt),Je===null?Be=vt:Je.sibling=vt,Je=vt,Ye=Rn}if(tt===le.length)return p(se,Ye),Yt&&Fa(se,tt),Be;if(Ye===null){for(;tttt?(Rn=Ye,Ye=null):Rn=Ye.sibling;var Ki=be(se,Ye,vt.value,Ee);if(Ki===null){Ye===null&&(Ye=Rn);break}l&&Ye&&Ki.alternate===null&&d(se,Ye),Q=S(Ki,Q,tt),Je===null?Be=Ki:Je.sibling=Ki,Je=Ki,Ye=Rn}if(vt.done)return p(se,Ye),Yt&&Fa(se,tt),Be;if(Ye===null){for(;!vt.done;tt++,vt=le.next())vt=ke(se,vt.value,Ee),vt!==null&&(Q=S(vt,Q,tt),Je===null?Be=vt:Je.sibling=vt,Je=vt);return Yt&&Fa(se,tt),Be}for(Ye=x(se,Ye);!vt.done;tt++,vt=le.next())vt=Oe(Ye,se,tt,vt.value,Ee),vt!==null&&(l&&vt.alternate!==null&&Ye.delete(vt.key===null?tt:vt.key),Q=S(vt,Q,tt),Je===null?Be=vt:Je.sibling=vt,Je=vt);return l&&Ye.forEach(function(u3){return d(se,u3)}),Yt&&Fa(se,tt),Be}function mn(se,Q,le,Ee){if(typeof le=="object"&&le!==null&&le.type===D&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case I:e:{for(var Be=le.key,Je=Q;Je!==null;){if(Je.key===Be){if(Be=le.type,Be===D){if(Je.tag===7){p(se,Je.sibling),Q=j(Je,le.props.children),Q.return=se,se=Q;break e}}else if(Je.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===F&&Wy(Be)===Je.type){p(se,Je.sibling),Q=j(Je,le.props),Q.ref=oc(se,Je,le),Q.return=se,se=Q;break e}p(se,Je);break}else d(se,Je);Je=Je.sibling}le.type===D?(Q=Ga(le.props.children,se.mode,Ee,le.key),Q.return=se,se=Q):(Ee=uu(le.type,le.key,le.props,null,se.mode,Ee),Ee.ref=oc(se,Q,le),Ee.return=se,se=Ee)}return A(se);case O:e:{for(Je=le.key;Q!==null;){if(Q.key===Je)if(Q.tag===4&&Q.stateNode.containerInfo===le.containerInfo&&Q.stateNode.implementation===le.implementation){p(se,Q.sibling),Q=j(Q,le.children||[]),Q.return=se,se=Q;break e}else{p(se,Q);break}else d(se,Q);Q=Q.sibling}Q=cm(le,se.mode,Ee),Q.return=se,se=Q}return A(se);case F:return Je=le._init,mn(se,Q,Je(le._payload),Ee)}if(Qe(le))return _e(se,Q,le,Ee);if(ie(le))return Fe(se,Q,le,Ee);Bd(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,Q!==null&&Q.tag===6?(p(se,Q.sibling),Q=j(Q,le),Q.return=se,se=Q):(p(se,Q),Q=lm(le,se.mode,Ee),Q.return=se,se=Q),A(se)):p(se,Q)}return mn}var qo=Uy(!0),Ky=Uy(!1),Vd=Di(null),Hd=null,Go=null,yp=null;function vp(){yp=Go=Hd=null}function bp(l){var d=Vd.current;Ht(Vd),l._currentValue=d}function wp(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){Hd=l,yp=Go=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(vr=!0),l.firstContext=null)}function Vr(l){var d=l._currentValue;if(yp!==l)if(l={context:l,memoizedValue:d,next:null},Go===null){if(Hd===null)throw Error(n(308));Go=l,Hd.dependencies={lanes:0,firstContext:l}}else Go=Go.next=l;return d}var Ba=null;function Np(l){Ba===null?Ba=[l]:Ba.push(l)}function qy(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,Np(d)):(p.next=j.next,j.next=p),d.interleaved=p,ri(l,x)}function ri(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 zi=!1;function jp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gy(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 si(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function $i(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(mt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,ri(l,p)}return j=x.interleaved,j===null?(d.next=d,Np(x)):(d.next=j.next,j.next=d),x.interleaved=d,ri(l,p)}function Wd(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,Po(l,p)}}function Jy(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState:x.baseState,firstBaseUpdate:j,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 Ud(l,d,p,x){var j=l.updateQueue;zi=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,B=j.shared.pending;if(B!==null){j.shared.pending=null;var K=B,ue=K.next;K.next=null,A===null?S=ue:A.next=ue,A=K;var Ne=l.alternate;Ne!==null&&(Ne=Ne.updateQueue,B=Ne.lastBaseUpdate,B!==A&&(B===null?Ne.firstBaseUpdate=ue:B.next=ue,Ne.lastBaseUpdate=K))}if(S!==null){var ke=j.baseState;A=0,Ne=ue=K=null,B=S;do{var be=B.lane,Oe=B.eventTime;if((x&be)===be){Ne!==null&&(Ne=Ne.next={eventTime:Oe,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var _e=l,Fe=B;switch(be=d,Oe=p,Fe.tag){case 1:if(_e=Fe.payload,typeof _e=="function"){ke=_e.call(Oe,ke,be);break e}ke=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Fe.payload,be=typeof _e=="function"?_e.call(Oe,ke,be):_e,be==null)break e;ke=G({},ke,be);break e;case 2:zi=!0}}B.callback!==null&&B.lane!==0&&(l.flags|=64,be=j.effects,be===null?j.effects=[B]:be.push(B))}else Oe={eventTime:Oe,lane:be,tag:B.tag,payload:B.payload,callback:B.callback,next:null},Ne===null?(ue=Ne=Oe,K=ke):Ne=Ne.next=Oe,A|=be;if(B=B.next,B===null){if(B=j.shared.pending,B===null)break;be=B,B=be.next,be.next=null,j.lastBaseUpdate=be,j.shared.pending=null}}while(!0);if(Ne===null&&(K=ke),j.baseState=K,j.firstBaseUpdate=ue,j.lastBaseUpdate=Ne,d=j.shared.interleaved,d!==null){j=d;do A|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);Wa|=A,l.lanes=A,l.memoizedState=ke}}function Yy(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Tp.transition;Tp.transition={};try{l(!1),d()}finally{yt=p,Tp.transition=x}}function mv(){return Hr().memoizedState}function DE(l,d,p){var x=Hi(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},gv(l))xv(d,p);else if(p=qy(l,d,p,x),p!==null){var j=ur();hs(p,l,x,j),yv(p,d,x)}}function LE(l,d,p){var x=Hi(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(gv(l))xv(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,B=S(A,p);if(j.hasEagerState=!0,j.eagerState=B,as(B,A)){var K=d.interleaved;K===null?(j.next=j,Np(d)):(j.next=K.next,K.next=j),d.interleaved=j;return}}catch{}finally{}p=qy(l,d,j,x),p!==null&&(j=ur(),hs(p,l,x,j),yv(p,d,x))}}function gv(l){var d=l.alternate;return l===en||d!==null&&d===en}function xv(l,d){uc=Gd=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function yv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Po(l,p)}}var Qd={readContext:Vr,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useInsertionEffect:Gn,useLayoutEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useMutableSource:Gn,useSyncExternalStore:Gn,useId:Gn,unstable_isNewReconciler:!1},_E={readContext:Vr,useCallback:function(l,d){return Ms().memoizedState=[l,d===void 0?null:d],l},useContext:Vr,useEffect:ov,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Jd(4194308,4,dv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Jd(4194308,4,l,d)},useInsertionEffect:function(l,d){return Jd(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=DE.bind(null,en,l),[x.memoizedState,l]},useRef:function(l){var d=Ms();return l={current:l},d.memoizedState=l},useState:iv,useDebugValue:Dp,useDeferredValue:function(l){return Ms().memoizedState=l},useTransition:function(){var l=iv(!1),d=l[0];return l=OE.bind(null,l[1]),Ms().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=en,j=Ms();if(Yt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),In===null)throw Error(n(349));(Ha&30)!==0||ev(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,ov(nv.bind(null,x,S,l),[l]),x.flags|=2048,pc(9,tv.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=Ms(),d=In.identifierPrefix;if(Yt){var p=ni,x=ti;p=(x&~(1<<32-et(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=hc++,0")&&(K=K.replace("",l.displayName)),K}while(1<=A&&0<=B);break}}}finally{ce=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?V(l):""}function fe(l){switch(l.tag){case 5:return V(l.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return l=W(l.type,!1),l;case 11:return l=W(l.type.render,!1),l;case 1:return l=W(l.type,!0),l;default:return""}}function X(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 D:return"Fragment";case O:return"Portal";case L:return"Profiler";case P:return"StrictMode";case Y:return"Suspense";case U:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case J:return(l.displayName||"Context")+".Consumer";case _:return(l._context.displayName||"Context")+".Provider";case ee:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case R:return d=l.displayName||null,d!==null?d:X(l.type)||"Memo";case F:d=l._payload,l=l._init;try{return X(l(d))}catch{}}return null}function de(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 X(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 he(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function be(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function Te(l){var d=be(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 j=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return j.call(this)},set:function(A){x=""+A,S.call(this,A)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(A){x=""+A},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function Ve(l){l._valueTracker||(l._valueTracker=Te(l))}function He(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=be(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function vt(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 Dt(l,d){var p=d.checked;return G({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function vn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=he(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 pt(l,d){d=d.checked,d!=null&&E(l,"checked",d,!1)}function Rt(l,d){pt(l,d);var p=he(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")?Pe(l,d.type,p):d.hasOwnProperty("defaultValue")&&Pe(l,d.type,he(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function ne(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 Pe(l,d,p){(d!=="number"||vt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Ze=Array.isArray;function bt(l,d,p,x){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=_t.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function ts(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var lr={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},me=["Webkit","ms","Moz","O"];Object.keys(lr).forEach(function(l){me.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),lr[d]=lr[l]})});function ye(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||lr.hasOwnProperty(l)&&lr[l]?(""+d).trim():d+"px"}function cr(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=ye(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,j):l[p]=j}}var Vs=G({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 Ni(l,d){if(d){if(Vs[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 ji(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 Cr=null;function Ia(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var zr=null,ns=null,dr=null;function ki(l){if(l=oc(l)){if(typeof zr!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Dd(d),zr(l.stateNode,l.type,d))}}function Ra(l){ns?dr?dr.push(l):dr=[l]:ns=l}function Hs(){if(ns){var l=ns,d=dr;if(dr=ns=null,ki(l),d)for(l=0;l>>=0,l===0?32:31-(In(l)/ur|0)|0}var Zt=64,$n=4194304;function ls(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 Ss(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,j=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var B=A&~j;B!==0?x=ls(B):(S&=A,S!==0&&(x=ls(S)))}else A=p&~j,A!==0?x=ls(A):S!==0&&(x=ls(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&j)===0&&(j=x&-x,S=d&-d,j>=S||j===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 Ri(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-tt(d),l[d]=p}function Wl(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=Xl),oy=" ",ly=!1;function cy(l,d){switch(l){case"keyup":return oE.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Oo=!1;function cE(l,d){switch(l){case"compositionend":return dy(d);case"keypress":return d.which!==32?null:(ly=!0,oy);case"textInput":return l=d.data,l===oy&&ly?null:l;default:return null}}function dE(l,d){if(Oo)return l==="compositionend"||!Jf&&cy(l,d)?(l=ty(),kd=Hf=Pi=null,Oo=!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=xy(p)}}function vy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?vy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function by(){for(var l=window,d=vt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=vt(l.document)}return d}function Xf(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 vE(l){var d=by(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&vy(p.ownerDocument.documentElement,p)){if(x!==null&&Xf(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 j=p.textContent.length,S=Math.min(x.start,j);x=x.end===void 0?S:Math.min(x.end,j),!l.extend&&S>x&&(j=x,x=S,S=j),j=yy(p,S);var A=yy(p,x);j&&A&&(l.rangeCount!==1||l.anchorNode!==j.node||l.anchorOffset!==j.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(j.node,j.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(A.node,A.offset)):(d.setEnd(A.node,A.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,Do=null,Zf=null,nc=null,ep=!1;function wy(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;ep||Do==null||Do!==vt(x)||(x=Do,"selectionStart"in x&&Xf(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}),nc&&tc(nc,x)||(nc=x,x=Rd(Zf,"onSelect"),0Fo||(l.current=hp[Fo],hp[Fo]=null,Fo--)}function $t(l,d){Fo++,hp[Fo]=l.current,l.current=d}var _i={},Jn=Li(_i),yr=Li(!1),$a=_i;function Bo(l,d){var p=l.type.contextTypes;if(!p)return _i;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var j={},S;for(S in p)j[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=j),j}function vr(l){return l=l.childContextTypes,l!=null}function Ld(){qt(yr),qt(Jn)}function Ly(l,d,p){if(Jn.current!==_i)throw Error(n(168));$t(Jn,d),$t(yr,p)}function _y(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var j in x)if(!(j in d))throw Error(n(108,de(l)||"Unknown",j));return G({},p,x)}function _d(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||_i,$a=Jn.current,$t(Jn,l),$t(yr,yr.current),!0}function zy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=_y(l,d,$a),x.__reactInternalMemoizedMergedChildContext=l,qt(yr),qt(Jn),$t(Jn,l)):qt(yr),$t(yr,p)}var Xs=null,zd=!1,fp=!1;function $y(l){Xs===null?Xs=[l]:Xs.push(l)}function IE(l){zd=!0,$y(l)}function zi(){if(!fp&&Xs!==null){fp=!0;var l=0,d=wt;try{var p=Xs;for(wt=1;l>=A,j-=A,Zs=1<<32-tt(d)+j|p<nt?(On=Xe,Xe=null):On=Xe.sibling;var jt=ve(se,Xe,le[nt],Ee);if(jt===null){Xe===null&&(Xe=On);break}l&&Xe&&jt.alternate===null&&d(se,Xe),Q=S(jt,Q,nt),Qe===null?Be=jt:Qe.sibling=jt,Qe=jt,Xe=On}if(nt===le.length)return p(se,Xe),en&&Ba(se,nt),Be;if(Xe===null){for(;ntnt?(On=Xe,Xe=null):On=Xe.sibling;var qi=ve(se,Xe,jt.value,Ee);if(qi===null){Xe===null&&(Xe=On);break}l&&Xe&&qi.alternate===null&&d(se,Xe),Q=S(qi,Q,nt),Qe===null?Be=qi:Qe.sibling=qi,Qe=qi,Xe=On}if(jt.done)return p(se,Xe),en&&Ba(se,nt),Be;if(Xe===null){for(;!jt.done;nt++,jt=le.next())jt=ke(se,jt.value,Ee),jt!==null&&(Q=S(jt,Q,nt),Qe===null?Be=jt:Qe.sibling=jt,Qe=jt);return en&&Ba(se,nt),Be}for(Xe=x(se,Xe);!jt.done;nt++,jt=le.next())jt=Oe(Xe,se,nt,jt.value,Ee),jt!==null&&(l&&jt.alternate!==null&&Xe.delete(jt.key===null?nt:jt.key),Q=S(jt,Q,nt),Qe===null?Be=jt:Qe.sibling=jt,Qe=jt);return l&&Xe.forEach(function(u3){return d(se,u3)}),en&&Ba(se,nt),Be}function gn(se,Q,le,Ee){if(typeof le=="object"&&le!==null&&le.type===D&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case I:e:{for(var Be=le.key,Qe=Q;Qe!==null;){if(Qe.key===Be){if(Be=le.type,Be===D){if(Qe.tag===7){p(se,Qe.sibling),Q=j(Qe,le.props.children),Q.return=se,se=Q;break e}}else if(Qe.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===F&&Uy(Be)===Qe.type){p(se,Qe.sibling),Q=j(Qe,le.props),Q.ref=lc(se,Qe,le),Q.return=se,se=Q;break e}p(se,Qe);break}else d(se,Qe);Qe=Qe.sibling}le.type===D?(Q=Ja(le.props.children,se.mode,Ee,le.key),Q.return=se,se=Q):(Ee=hu(le.type,le.key,le.props,null,se.mode,Ee),Ee.ref=lc(se,Q,le),Ee.return=se,se=Ee)}return A(se);case O:e:{for(Qe=le.key;Q!==null;){if(Q.key===Qe)if(Q.tag===4&&Q.stateNode.containerInfo===le.containerInfo&&Q.stateNode.implementation===le.implementation){p(se,Q.sibling),Q=j(Q,le.children||[]),Q.return=se,se=Q;break e}else{p(se,Q);break}else d(se,Q);Q=Q.sibling}Q=dm(le,se.mode,Ee),Q.return=se,se=Q}return A(se);case F:return Qe=le._init,gn(se,Q,Qe(le._payload),Ee)}if(Ze(le))return _e(se,Q,le,Ee);if(ie(le))return Fe(se,Q,le,Ee);Vd(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,Q!==null&&Q.tag===6?(p(se,Q.sibling),Q=j(Q,le),Q.return=se,se=Q):(p(se,Q),Q=cm(le,se.mode,Ee),Q.return=se,se=Q),A(se)):p(se,Q)}return gn}var Uo=Ky(!0),qy=Ky(!1),Hd=Li(null),Wd=null,Ko=null,vp=null;function bp(){vp=Ko=Wd=null}function wp(l){var d=Hd.current;qt(Hd),l._currentValue=d}function Np(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 qo(l,d){Wd=l,vp=Ko=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(br=!0),l.firstContext=null)}function Wr(l){var d=l._currentValue;if(vp!==l)if(l={context:l,memoizedValue:d,next:null},Ko===null){if(Wd===null)throw Error(n(308));Ko=l,Wd.dependencies={lanes:0,firstContext:l}}else Ko=Ko.next=l;return d}var Va=null;function jp(l){Va===null?Va=[l]:Va.push(l)}function Gy(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,jp(d)):(p.next=j.next,j.next=p),d.interleaved=p,ti(l,x)}function ti(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 $i=!1;function kp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jy(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 ni(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Fi(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(xt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,ti(l,p)}return j=x.interleaved,j===null?(d.next=d,jp(x)):(d.next=j.next,j.next=d),x.interleaved=d,ti(l,p)}function Ud(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,Io(l,p)}}function Yy(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState:x.baseState,firstBaseUpdate:j,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 Kd(l,d,p,x){var j=l.updateQueue;$i=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,B=j.shared.pending;if(B!==null){j.shared.pending=null;var K=B,ue=K.next;K.next=null,A===null?S=ue:A.next=ue,A=K;var Ne=l.alternate;Ne!==null&&(Ne=Ne.updateQueue,B=Ne.lastBaseUpdate,B!==A&&(B===null?Ne.firstBaseUpdate=ue:B.next=ue,Ne.lastBaseUpdate=K))}if(S!==null){var ke=j.baseState;A=0,Ne=ue=K=null,B=S;do{var ve=B.lane,Oe=B.eventTime;if((x&ve)===ve){Ne!==null&&(Ne=Ne.next={eventTime:Oe,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var _e=l,Fe=B;switch(ve=d,Oe=p,Fe.tag){case 1:if(_e=Fe.payload,typeof _e=="function"){ke=_e.call(Oe,ke,ve);break e}ke=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Fe.payload,ve=typeof _e=="function"?_e.call(Oe,ke,ve):_e,ve==null)break e;ke=G({},ke,ve);break e;case 2:$i=!0}}B.callback!==null&&B.lane!==0&&(l.flags|=64,ve=j.effects,ve===null?j.effects=[B]:ve.push(B))}else Oe={eventTime:Oe,lane:ve,tag:B.tag,payload:B.payload,callback:B.callback,next:null},Ne===null?(ue=Ne=Oe,K=ke):Ne=Ne.next=Oe,A|=ve;if(B=B.next,B===null){if(B=j.shared.pending,B===null)break;ve=B,B=ve.next,ve.next=null,j.lastBaseUpdate=ve,j.shared.pending=null}}while(!0);if(Ne===null&&(K=ke),j.baseState=K,j.firstBaseUpdate=ue,j.lastBaseUpdate=Ne,d=j.shared.interleaved,d!==null){j=d;do A|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);Ua|=A,l.lanes=A,l.memoizedState=ke}}function Qy(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Mp.transition;Mp.transition={};try{l(!1),d()}finally{wt=p,Mp.transition=x}}function gv(){return Ur().memoizedState}function DE(l,d,p){var x=Wi(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},xv(l))yv(d,p);else if(p=Gy(l,d,p,x),p!==null){var j=fr();ps(p,l,x,j),vv(p,d,x)}}function LE(l,d,p){var x=Wi(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(xv(l))yv(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,B=S(A,p);if(j.hasEagerState=!0,j.eagerState=B,cs(B,A)){var K=d.interleaved;K===null?(j.next=j,jp(d)):(j.next=K.next,K.next=j),d.interleaved=j;return}}catch{}finally{}p=Gy(l,d,j,x),p!==null&&(j=fr(),ps(p,l,x,j),vv(p,d,x))}}function xv(l){var d=l.alternate;return l===sn||d!==null&&d===sn}function yv(l,d){hc=Jd=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function vv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Io(l,p)}}var Xd={readContext:Wr,useCallback:Yn,useContext:Yn,useEffect:Yn,useImperativeHandle:Yn,useInsertionEffect:Yn,useLayoutEffect:Yn,useMemo:Yn,useReducer:Yn,useRef:Yn,useState:Yn,useDebugValue:Yn,useDeferredValue:Yn,useTransition:Yn,useMutableSource:Yn,useSyncExternalStore:Yn,useId:Yn,unstable_isNewReconciler:!1},_E={readContext:Wr,useCallback:function(l,d){return Ts().memoizedState=[l,d===void 0?null:d],l},useContext:Wr,useEffect:lv,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Yd(4194308,4,uv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Yd(4194308,4,l,d)},useInsertionEffect:function(l,d){return Yd(4,2,l,d)},useMemo:function(l,d){var p=Ts();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=Ts();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=DE.bind(null,sn,l),[x.memoizedState,l]},useRef:function(l){var d=Ts();return l={current:l},d.memoizedState=l},useState:av,useDebugValue:Lp,useDeferredValue:function(l){return Ts().memoizedState=l},useTransition:function(){var l=av(!1),d=l[0];return l=OE.bind(null,l[1]),Ts().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=sn,j=Ts();if(en){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Pn===null)throw Error(n(349));(Wa&30)!==0||tv(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,lv(rv.bind(null,x,S,l),[l]),x.flags|=2048,mc(9,nv.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=Ts(),d=Pn.identifierPrefix;if(en){var p=ei,x=Zs;p=(x&~(1<<32-tt(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=fc++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[Es]=d,l[ic]=x,zv(l,d,!1,!1),d.stateNode=l;e:{switch(A=Si(p,x),p){case"dialog":Vt("cancel",l),Vt("close",l),j=x;break;case"iframe":case"object":case"embed":Vt("load",l),j=x;break;case"video":case"audio":for(j=0;jel&&(d.flags|=128,x=!0,mc(S,!1),d.lanes=4194304)}else{if(!x)if(l=Kd(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),mc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Yt)return Jn(d),null}else 2*Tt()-S.renderingStartTime>el&&p!==1073741824&&(d.flags|=128,x=!0,mc(S,!1),d.lanes=4194304);S.isBackwards?(A.sibling=d.child,d.child=A):(p=S.last,p!==null?p.sibling=A:d.child=A,S.last=A)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=Tt(),d.sibling=null,p=Zt.current,Lt(Zt,x?p&1|2:p&1),d):(Jn(d),null);case 22:case 23:return im(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Ar&1073741824)!==0&&(Jn(d),d.subtreeFlags&6&&(d.flags|=8192)):Jn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function UE(l,d){switch(pp(d),d.tag){case 1:return yr(d.type)&&Dd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Yo(),Ht(xr),Ht(qn),Ep(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Sp(d),null;case 13:if(Ht(Zt),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Ko()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Ht(Zt),null;case 4:return Yo(),null;case 10:return bp(d.type._context),null;case 22:case 23:return im(),null;case 24:return null;default:return null}}var tu=!1,Yn=!1,KE=typeof WeakSet=="function"?WeakSet:Set,De=null;function Xo(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){ln(l,d,x)}else p.current=null}function qp(l,d,p){try{p()}catch(x){ln(l,d,x)}}var Bv=!1;function qE(l,d){if(ip=wd,l=vy(),Qf(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 j=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,B=-1,K=-1,ue=0,Ne=0,ke=l,be=null;t:for(;;){for(var Oe;ke!==p||j!==0&&ke.nodeType!==3||(B=A+j),ke!==S||x!==0&&ke.nodeType!==3||(K=A+x),ke.nodeType===3&&(A+=ke.nodeValue.length),(Oe=ke.firstChild)!==null;)be=ke,ke=Oe;for(;;){if(ke===l)break t;if(be===p&&++ue===j&&(B=A),be===S&&++Ne===x&&(K=A),(Oe=ke.nextSibling)!==null)break;ke=be,be=ke.parentNode}ke=Oe}p=B===-1||K===-1?null:{start:B,end:K}}else p=null}p=p||{start:0,end:0}}else p=null;for(ap={focusedElem:l,selectionRange:p},wd=!1,De=d;De!==null;)if(d=De,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,De=l;else for(;De!==null;){d=De;try{var _e=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Fe=_e.memoizedProps,mn=_e.memoizedState,se=d.stateNode,Q=se.getSnapshotBeforeUpdate(d.elementType===d.type?Fe:cs(d.type,Fe),mn);se.__reactInternalSnapshotBeforeUpdate=Q}break;case 3:var le=d.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ee){ln(d,d.return,Ee)}if(l=d.sibling,l!==null){l.return=d.return,De=l;break}De=d.return}return _e=Bv,Bv=!1,_e}function gc(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&l)===l){var S=j.destroy;j.destroy=void 0,S!==void 0&&qp(d,p,S)}j=j.next}while(j!==x)}}function nu(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 Gp(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 Vv(l){var d=l.alternate;d!==null&&(l.alternate=null,Vv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Es],delete d[ic],delete d[dp],delete d[ME],delete d[AE])),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 Hv(l){return l.tag===5||l.tag===3||l.tag===4}function Wv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Hv(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 Jp(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=Pd));else if(x!==4&&(l=l.child,l!==null))for(Jp(l,d,p),l=l.sibling;l!==null;)Jp(l,d,p),l=l.sibling}function Yp(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(Yp(l,d,p),l=l.sibling;l!==null;)Yp(l,d,p),l=l.sibling}var zn=null,ds=!1;function Fi(l,d,p){for(p=p.child;p!==null;)Uv(l,d,p),p=p.sibling}function Uv(l,d,p){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(V,p)}catch{}switch(p.tag){case 5:Yn||Xo(p,d);case 6:var x=zn,j=ds;zn=null,Fi(l,d,p),zn=x,ds=j,zn!==null&&(ds?(l=zn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):zn.removeChild(p.stateNode));break;case 18:zn!==null&&(ds?(l=zn,p=p.stateNode,l.nodeType===8?cp(l.parentNode,p):l.nodeType===1&&cp(l,p),Gl(l)):cp(zn,p.stateNode));break;case 4:x=zn,j=ds,zn=p.stateNode.containerInfo,ds=!0,Fi(l,d,p),zn=x,ds=j;break;case 0:case 11:case 14:case 15:if(!Yn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){j=x=x.next;do{var S=j,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&qp(p,d,A),j=j.next}while(j!==x)}Fi(l,d,p);break;case 1:if(!Yn&&(Xo(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(B){ln(p,d,B)}Fi(l,d,p);break;case 21:Fi(l,d,p);break;case 22:p.mode&1?(Yn=(x=Yn)||p.memoizedState!==null,Fi(l,d,p),Yn=x):Fi(l,d,p);break;default:Fi(l,d,p)}}function Kv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new KE),d.forEach(function(x){var j=n3.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function us(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=A),x&=~S}if(x=j,x=Tt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*JE(x/1960))-x,10l?16:l,Vi===null)var x=!1;else{if(l=Vi,Vi=null,ou=0,(mt&6)!==0)throw Error(n(331));var j=mt;for(mt|=4,De=l.current;De!==null;){var S=De,A=S.child;if((De.flags&16)!==0){var B=S.deletions;if(B!==null){for(var K=0;KTt()-Zp?Ka(l,0):Xp|=p),wr(l,d)}function ib(l,d){d===0&&((l.mode&1)===0?d=1:(d=_n,_n<<=1,(_n&130023424)===0&&(_n=4194304)));var p=ur();l=ri(l,d),l!==null&&(Qs(l,d,p),wr(l,p))}function t3(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),ib(l,p)}function n3(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,j=l.memoizedState;j!==null&&(p=j.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),ib(l,p)}var ab;ab=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||xr.current)vr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return vr=!1,HE(l,d,p);vr=(l.flags&131072)!==0}else vr=!1,Yt&&(d.flags&1048576)!==0&&$y(d,$d,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;eu(l,d),l=d.pendingProps;var j=Ho(d,qn.current);Jo(d,p),j=Ap(null,d,x,l,j,p);var S=Ip();return d.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,yr(x)?(S=!0,Ld(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,jp(d),j.updater=Xd,d.stateNode=j,j._reactInternals=d,_p(d,x,l,p),d=Bp(null,d,x,!0,S,p)):(d.tag=0,Yt&&S&&fp(d),dr(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(eu(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=s3(x),l=cs(x,l),j){case 0:d=Fp(null,d,x,l,p);break e;case 1:d=Rv(null,d,x,l,p);break e;case 11:d=Ev(null,d,x,l,p);break e;case 14:d=Tv(null,d,x,cs(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:cs(x,j),Fp(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:cs(x,j),Rv(l,d,x,j,p);case 3:e:{if(Pv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,Gy(l,d),Ud(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=Qo(Error(n(423)),d),d=Ov(l,d,x,p,j);break e}else if(x!==j){j=Qo(Error(n(424)),d),d=Ov(l,d,x,p,j);break e}else for(Mr=Oi(d.stateNode.containerInfo.firstChild),Tr=d,Yt=!0,ls=null,p=Ky(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Ko(),x===j){d=ii(l,d,p);break e}dr(l,d,x,p)}d=d.child}return d;case 5:return Qy(d),l===null&&gp(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,op(x,j)?A=null:S!==null&&op(x,S)&&(d.flags|=32),Iv(l,d),dr(l,d,A,p),d.child;case 6:return l===null&&gp(d),null;case 13:return Dv(l,d,p);case 4:return kp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=qo(d,null,x,p):dr(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:cs(x,j),Ev(l,d,x,j,p);case 7:return dr(l,d,d.pendingProps,p),d.child;case 8:return dr(l,d,d.pendingProps.children,p),d.child;case 12:return dr(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,j=d.pendingProps,S=d.memoizedProps,A=j.value,Lt(Vd,x._currentValue),x._currentValue=A,S!==null)if(as(S.value,A)){if(S.children===j.children&&!xr.current){d=ii(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var B=S.dependencies;if(B!==null){A=S.child;for(var K=B.firstContext;K!==null;){if(K.context===x){if(S.tag===1){K=si(-1,p&-p),K.tag=2;var ue=S.updateQueue;if(ue!==null){ue=ue.shared;var Ne=ue.pending;Ne===null?K.next=K:(K.next=Ne.next,Ne.next=K),ue.pending=K}}S.lanes|=p,K=S.alternate,K!==null&&(K.lanes|=p),wp(S.return,p,d),B.lanes|=p;break}K=K.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,B=A.alternate,B!==null&&(B.lanes|=p),wp(A,p,d),A=S.sibling}else A=S.child;if(A!==null)A.return=S;else for(A=S;A!==null;){if(A===d){A=null;break}if(S=A.sibling,S!==null){S.return=A.return,A=S;break}A=A.return}S=A}dr(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,Jo(d,p),j=Vr(j),x=x(j),d.flags|=1,dr(l,d,x,p),d.child;case 14:return x=d.type,j=cs(x,d.pendingProps),j=cs(x.type,j),Tv(l,d,x,j,p);case 15:return Mv(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:cs(x,j),eu(l,d),d.tag=1,yr(x)?(l=!0,Ld(d)):l=!1,Jo(d,p),bv(d,x,j),_p(d,x,j,p),Bp(null,d,x,!0,l,p);case 19:return _v(l,d,p);case 22:return Av(l,d,p)}throw Error(n(156,d.tag))};function ob(l,d){return To(l,d)}function r3(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 Ur(l,d,p,x){return new r3(l,d,p,x)}function om(l){return l=l.prototype,!(!l||!l.isReactComponent)}function s3(l){if(typeof l=="function")return om(l)?1:0;if(l!=null){if(l=l.$$typeof,l===ee)return 11;if(l===R)return 14}return 2}function Ui(l,d){var p=l.alternate;return p===null?(p=Ur(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 uu(l,d,p,x,j,S){var A=2;if(x=l,typeof l=="function")om(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case D:return Ga(p.children,j,S,d);case P:A=8,j|=8;break;case L:return l=Ur(12,p,d,j|2),l.elementType=L,l.lanes=S,l;case Y:return l=Ur(13,p,d,j),l.elementType=Y,l.lanes=S,l;case U:return l=Ur(19,p,d,j),l.elementType=U,l.lanes=S,l;case re:return hu(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case _:A=10;break e;case J:A=9;break e;case ee:A=11;break e;case R:A=14;break e;case F:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Ur(A,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function Ga(l,d,p,x){return l=Ur(7,l,x,d),l.lanes=p,l}function hu(l,d,p,x){return l=Ur(22,l,x,d),l.elementType=re,l.lanes=p,l.stateNode={isHidden:!1},l}function lm(l,d,p){return l=Ur(6,l,null,d),l.lanes=p,l}function cm(l,d,p){return d=Ur(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function i3(l,d,p,x,j){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=Ro(0),this.expirationTimes=Ro(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ro(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function dm(l,d,p,x,j,S,A,B,K){return l=new i3(l,d,p,B,K),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Ur(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},jp(S),l}function a3(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(),gm.exports=y3(),gm.exports}var wb;function v3(){if(wb)return vu;wb=1;var t=TN();return vu.createRoot=t.createRoot,vu.hydrateRoot=t.hydrateRoot,vu}var b3=v3(),dd=TN();const MN=EN(dd);/** +`+S.stack}return{value:l,source:d,stack:j,digest:null}}function $p(l,d,p){return{value:l,source:null,stack:p??null,digest:d??null}}function Fp(l,d){try{console.error(d.value)}catch(p){setTimeout(function(){throw p})}}var FE=typeof WeakMap=="function"?WeakMap:Map;function jv(l,d,p){p=ni(-1,p),p.tag=3,p.payload={element:null};var x=d.value;return p.callback=function(){au||(au=!0,tm=x),Fp(l,d)},p}function kv(l,d,p){p=ni(-1,p),p.tag=3;var x=l.type.getDerivedStateFromError;if(typeof x=="function"){var j=d.value;p.payload=function(){return x(j)},p.callback=function(){Fp(l,d)}}var S=l.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(p.callback=function(){Fp(l,d),typeof x!="function"&&(Vi===null?Vi=new Set([this]):Vi.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})}),p}function Sv(l,d,p){var x=l.pingCache;if(x===null){x=l.pingCache=new FE;var j=new Set;x.set(d,j)}else j=x.get(d),j===void 0&&(j=new Set,x.set(d,j));j.has(p)||(j.add(p),l=e3.bind(null,l,d,p),d.then(l,l))}function Cv(l){do{var d;if((d=l.tag===13)&&(d=l.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return l;l=l.return}while(l!==null);return null}function Ev(l,d,p,x,j){return(l.mode&1)===0?(l===d?l.flags|=65536:(l.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(d=ni(-1,1),d.tag=2,Fi(p,d,1))),p.lanes|=1),l):(l.flags|=65536,l.lanes=j,l)}var BE=T.ReactCurrentOwner,br=!1;function hr(l,d,p,x){d.child=l===null?qy(d,null,p,x):Uo(d,l.child,p,x)}function Tv(l,d,p,x,j){p=p.render;var S=d.ref;return qo(d,j),x=Ip(l,d,p,x,S,j),p=Rp(),l!==null&&!br?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~j,ri(l,d,j)):(en&&p&&pp(d),d.flags|=1,hr(l,d,x,j),d.child)}function Mv(l,d,p,x,j){if(l===null){var S=p.type;return typeof S=="function"&&!lm(S)&&S.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(d.tag=15,d.type=S,Av(l,d,S,x,j)):(l=hu(p.type,null,x,d,d.mode,j),l.ref=d.ref,l.return=d,d.child=l)}if(S=l.child,(l.lanes&j)===0){var A=S.memoizedProps;if(p=p.compare,p=p!==null?p:tc,p(A,x)&&l.ref===d.ref)return ri(l,d,j)}return d.flags|=1,l=Ki(S,x),l.ref=d.ref,l.return=d,d.child=l}function Av(l,d,p,x,j){if(l!==null){var S=l.memoizedProps;if(tc(S,x)&&l.ref===d.ref)if(br=!1,d.pendingProps=x=S,(l.lanes&j)!==0)(l.flags&131072)!==0&&(br=!0);else return d.lanes=l.lanes,ri(l,d,j)}return Bp(l,d,p,x,j)}function Iv(l,d,p){var x=d.pendingProps,j=x.children,S=l!==null?l.memoizedState:null;if(x.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},$t(Qo,Ir),Ir|=p;else{if((p&1073741824)===0)return l=S!==null?S.baseLanes|p:p,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:l,cachePool:null,transitions:null},d.updateQueue=null,$t(Qo,Ir),Ir|=l,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=S!==null?S.baseLanes:p,$t(Qo,Ir),Ir|=x}else S!==null?(x=S.baseLanes|p,d.memoizedState=null):x=p,$t(Qo,Ir),Ir|=x;return hr(l,d,j,p),d.child}function Rv(l,d){var p=d.ref;(l===null&&p!==null||l!==null&&l.ref!==p)&&(d.flags|=512,d.flags|=2097152)}function Bp(l,d,p,x,j){var S=vr(p)?$a:Jn.current;return S=Bo(d,S),qo(d,j),p=Ip(l,d,p,x,S,j),x=Rp(),l!==null&&!br?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~j,ri(l,d,j)):(en&&x&&pp(d),d.flags|=1,hr(l,d,p,j),d.child)}function Pv(l,d,p,x,j){if(vr(p)){var S=!0;_d(d)}else S=!1;if(qo(d,j),d.stateNode===null)tu(l,d),wv(d,p,x),zp(d,p,x,j),x=!0;else if(l===null){var A=d.stateNode,B=d.memoizedProps;A.props=B;var K=A.context,ue=p.contextType;typeof ue=="object"&&ue!==null?ue=Wr(ue):(ue=vr(p)?$a:Jn.current,ue=Bo(d,ue));var Ne=p.getDerivedStateFromProps,ke=typeof Ne=="function"||typeof A.getSnapshotBeforeUpdate=="function";ke||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(B!==x||K!==ue)&&Nv(d,A,x,ue),$i=!1;var ve=d.memoizedState;A.state=ve,Kd(d,x,A,j),K=d.memoizedState,B!==x||ve!==K||yr.current||$i?(typeof Ne=="function"&&(_p(d,p,Ne,x),K=d.memoizedState),(B=$i||bv(d,p,B,x,ve,K,ue))?(ke||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(d.flags|=4194308)):(typeof A.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=x,d.memoizedState=K),A.props=x,A.state=K,A.context=ue,x=B):(typeof A.componentDidMount=="function"&&(d.flags|=4194308),x=!1)}else{A=d.stateNode,Jy(l,d),B=d.memoizedProps,ue=d.type===d.elementType?B:us(d.type,B),A.props=ue,ke=d.pendingProps,ve=A.context,K=p.contextType,typeof K=="object"&&K!==null?K=Wr(K):(K=vr(p)?$a:Jn.current,K=Bo(d,K));var Oe=p.getDerivedStateFromProps;(Ne=typeof Oe=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(B!==ke||ve!==K)&&Nv(d,A,x,K),$i=!1,ve=d.memoizedState,A.state=ve,Kd(d,x,A,j);var _e=d.memoizedState;B!==ke||ve!==_e||yr.current||$i?(typeof Oe=="function"&&(_p(d,p,Oe,x),_e=d.memoizedState),(ue=$i||bv(d,p,ue,x,ve,_e,K)||!1)?(Ne||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(x,_e,K),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(x,_e,K)),typeof A.componentDidUpdate=="function"&&(d.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof A.componentDidUpdate!="function"||B===l.memoizedProps&&ve===l.memoizedState||(d.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||B===l.memoizedProps&&ve===l.memoizedState||(d.flags|=1024),d.memoizedProps=x,d.memoizedState=_e),A.props=x,A.state=_e,A.context=K,x=ue):(typeof A.componentDidUpdate!="function"||B===l.memoizedProps&&ve===l.memoizedState||(d.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||B===l.memoizedProps&&ve===l.memoizedState||(d.flags|=1024),x=!1)}return Vp(l,d,p,x,S,j)}function Vp(l,d,p,x,j,S){Rv(l,d);var A=(d.flags&128)!==0;if(!x&&!A)return j&&zy(d,p,!1),ri(l,d,S);x=d.stateNode,BE.current=d;var B=A&&typeof p.getDerivedStateFromError!="function"?null:x.render();return d.flags|=1,l!==null&&A?(d.child=Uo(d,l.child,null,S),d.child=Uo(d,null,B,S)):hr(l,d,B,S),d.memoizedState=x.state,j&&zy(d,p,!0),d.child}function Ov(l){var d=l.stateNode;d.pendingContext?Ly(l,d.pendingContext,d.pendingContext!==d.context):d.context&&Ly(l,d.context,!1),Sp(l,d.containerInfo)}function Dv(l,d,p,x,j){return Wo(),yp(j),d.flags|=256,hr(l,d,p,x),d.child}var Hp={dehydrated:null,treeContext:null,retryLane:0};function Wp(l){return{baseLanes:l,cachePool:null,transitions:null}}function Lv(l,d,p){var x=d.pendingProps,j=rn.current,S=!1,A=(d.flags&128)!==0,B;if((B=A)||(B=l!==null&&l.memoizedState===null?!1:(j&2)!==0),B?(S=!0,d.flags&=-129):(l===null||l.memoizedState!==null)&&(j|=1),$t(rn,j&1),l===null)return xp(d),l=d.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((d.mode&1)===0?d.lanes=1:l.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(A=x.children,l=x.fallback,S?(x=d.mode,S=d.child,A={mode:"hidden",children:A},(x&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=A):S=fu(A,x,0,null),l=Ja(l,x,p,null),S.return=d,l.return=d,S.sibling=l,d.child=S,d.child.memoizedState=Wp(p),d.memoizedState=Hp,l):Up(d,A));if(j=l.memoizedState,j!==null&&(B=j.dehydrated,B!==null))return VE(l,d,A,x,B,j,p);if(S){S=x.fallback,A=d.mode,j=l.child,B=j.sibling;var K={mode:"hidden",children:x.children};return(A&1)===0&&d.child!==j?(x=d.child,x.childLanes=0,x.pendingProps=K,d.deletions=null):(x=Ki(j,K),x.subtreeFlags=j.subtreeFlags&14680064),B!==null?S=Ki(B,S):(S=Ja(S,A,p,null),S.flags|=2),S.return=d,x.return=d,x.sibling=S,d.child=x,x=S,S=d.child,A=l.child.memoizedState,A=A===null?Wp(p):{baseLanes:A.baseLanes|p,cachePool:null,transitions:A.transitions},S.memoizedState=A,S.childLanes=l.childLanes&~p,d.memoizedState=Hp,x}return S=l.child,l=S.sibling,x=Ki(S,{mode:"visible",children:x.children}),(d.mode&1)===0&&(x.lanes=p),x.return=d,x.sibling=null,l!==null&&(p=d.deletions,p===null?(d.deletions=[l],d.flags|=16):p.push(l)),d.child=x,d.memoizedState=null,x}function Up(l,d){return d=fu({mode:"visible",children:d},l.mode,0,null),d.return=l,l.child=d}function eu(l,d,p,x){return x!==null&&yp(x),Uo(d,l.child,null,p),l=Up(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function VE(l,d,p,x,j,S,A){if(p)return d.flags&256?(d.flags&=-257,x=$p(Error(n(422))),eu(l,d,A,x)):d.memoizedState!==null?(d.child=l.child,d.flags|=128,null):(S=x.fallback,j=d.mode,x=fu({mode:"visible",children:x.children},j,0,null),S=Ja(S,j,A,null),S.flags|=2,x.return=d,S.return=d,x.sibling=S,d.child=x,(d.mode&1)!==0&&Uo(d,l.child,null,A),d.child.memoizedState=Wp(A),d.memoizedState=Hp,S);if((d.mode&1)===0)return eu(l,d,A,null);if(j.data==="$!"){if(x=j.nextSibling&&j.nextSibling.dataset,x)var B=x.dgst;return x=B,S=Error(n(419)),x=$p(S,x,void 0),eu(l,d,A,x)}if(B=(A&l.childLanes)!==0,br||B){if(x=Pn,x!==null){switch(A&-A){case 4:j=2;break;case 16:j=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:j=32;break;case 536870912:j=268435456;break;default:j=0}j=(j&(x.suspendedLanes|A))!==0?0:j,j!==0&&j!==S.retryLane&&(S.retryLane=j,ti(l,j),ps(x,l,j,-1))}return om(),x=$p(Error(n(421))),eu(l,d,A,x)}return j.data==="$?"?(d.flags|=128,d.child=l.child,d=t3.bind(null,l),j._reactRetry=d,null):(l=S.treeContext,Ar=Di(j.nextSibling),Mr=d,en=!0,ds=null,l!==null&&(Vr[Hr++]=Zs,Vr[Hr++]=ei,Vr[Hr++]=Fa,Zs=l.id,ei=l.overflow,Fa=d),d=Up(d,x.children),d.flags|=4096,d)}function _v(l,d,p){l.lanes|=d;var x=l.alternate;x!==null&&(x.lanes|=d),Np(l.return,d,p)}function Kp(l,d,p,x,j){var S=l.memoizedState;S===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:x,tail:p,tailMode:j}:(S.isBackwards=d,S.rendering=null,S.renderingStartTime=0,S.last=x,S.tail=p,S.tailMode=j)}function zv(l,d,p){var x=d.pendingProps,j=x.revealOrder,S=x.tail;if(hr(l,d,x.children,p),x=rn.current,(x&2)!==0)x=x&1|2,d.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&_v(l,p,d);else if(l.tag===19)_v(l,p,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}x&=1}if($t(rn,x),(d.mode&1)===0)d.memoizedState=null;else switch(j){case"forwards":for(p=d.child,j=null;p!==null;)l=p.alternate,l!==null&&qd(l)===null&&(j=p),p=p.sibling;p=j,p===null?(j=d.child,d.child=null):(j=p.sibling,p.sibling=null),Kp(d,!1,j,p,S);break;case"backwards":for(p=null,j=d.child,d.child=null;j!==null;){if(l=j.alternate,l!==null&&qd(l)===null){d.child=j;break}l=j.sibling,j.sibling=p,p=j,j=l}Kp(d,!0,p,null,S);break;case"together":Kp(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function tu(l,d){(d.mode&1)===0&&l!==null&&(l.alternate=null,d.alternate=null,d.flags|=2)}function ri(l,d,p){if(l!==null&&(d.dependencies=l.dependencies),Ua|=d.lanes,(p&d.childLanes)===0)return null;if(l!==null&&d.child!==l.child)throw Error(n(153));if(d.child!==null){for(l=d.child,p=Ki(l,l.pendingProps),d.child=p,p.return=d;l.sibling!==null;)l=l.sibling,p=p.sibling=Ki(l,l.pendingProps),p.return=d;p.sibling=null}return d.child}function HE(l,d,p){switch(d.tag){case 3:Ov(d),Wo();break;case 5:Xy(d);break;case 1:vr(d.type)&&_d(d);break;case 4:Sp(d,d.stateNode.containerInfo);break;case 10:var x=d.type._context,j=d.memoizedProps.value;$t(Hd,x._currentValue),x._currentValue=j;break;case 13:if(x=d.memoizedState,x!==null)return x.dehydrated!==null?($t(rn,rn.current&1),d.flags|=128,null):(p&d.child.childLanes)!==0?Lv(l,d,p):($t(rn,rn.current&1),l=ri(l,d,p),l!==null?l.sibling:null);$t(rn,rn.current&1);break;case 19:if(x=(p&d.childLanes)!==0,(l.flags&128)!==0){if(x)return zv(l,d,p);d.flags|=128}if(j=d.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),$t(rn,rn.current),x)break;return null;case 22:case 23:return d.lanes=0,Iv(l,d,p)}return ri(l,d,p)}var $v,qp,Fv,Bv;$v=function(l,d){for(var p=d.child;p!==null;){if(p.tag===5||p.tag===6)l.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},qp=function(){},Fv=function(l,d,p,x){var j=l.memoizedProps;if(j!==x){l=d.stateNode,Ha(Es.current);var S=null;switch(p){case"input":j=Dt(l,j),x=Dt(l,x),S=[];break;case"select":j=G({},j,{value:void 0}),x=G({},x,{value:void 0}),S=[];break;case"textarea":j=mt(l,j),x=mt(l,x),S=[];break;default:typeof j.onClick!="function"&&typeof x.onClick=="function"&&(l.onclick=Od)}Ni(p,x);var A;p=null;for(ue in j)if(!x.hasOwnProperty(ue)&&j.hasOwnProperty(ue)&&j[ue]!=null)if(ue==="style"){var B=j[ue];for(A in B)B.hasOwnProperty(A)&&(p||(p={}),p[A]="")}else ue!=="dangerouslySetInnerHTML"&&ue!=="children"&&ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&ue!=="autoFocus"&&(i.hasOwnProperty(ue)?S||(S=[]):(S=S||[]).push(ue,null));for(ue in x){var K=x[ue];if(B=j!=null?j[ue]:void 0,x.hasOwnProperty(ue)&&K!==B&&(K!=null||B!=null))if(ue==="style")if(B){for(A in B)!B.hasOwnProperty(A)||K&&K.hasOwnProperty(A)||(p||(p={}),p[A]="");for(A in K)K.hasOwnProperty(A)&&B[A]!==K[A]&&(p||(p={}),p[A]=K[A])}else p||(S||(S=[]),S.push(ue,p)),p=K;else ue==="dangerouslySetInnerHTML"?(K=K?K.__html:void 0,B=B?B.__html:void 0,K!=null&&B!==K&&(S=S||[]).push(ue,K)):ue==="children"?typeof K!="string"&&typeof K!="number"||(S=S||[]).push(ue,""+K):ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&(i.hasOwnProperty(ue)?(K!=null&&ue==="onScroll"&&Kt("scroll",l),S||B===K||(S=[])):(S=S||[]).push(ue,K))}p&&(S=S||[]).push("style",p);var ue=S;(d.updateQueue=ue)&&(d.flags|=4)}},Bv=function(l,d,p,x){p!==x&&(d.flags|=4)};function gc(l,d){if(!en)switch(l.tailMode){case"hidden":d=l.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?l.tail=null:p.sibling=null;break;case"collapsed":p=l.tail;for(var x=null;p!==null;)p.alternate!==null&&(x=p),p=p.sibling;x===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:x.sibling=null}}function Qn(l){var d=l.alternate!==null&&l.alternate.child===l.child,p=0,x=0;if(d)for(var j=l.child;j!==null;)p|=j.lanes|j.childLanes,x|=j.subtreeFlags&14680064,x|=j.flags&14680064,j.return=l,j=j.sibling;else for(j=l.child;j!==null;)p|=j.lanes|j.childLanes,x|=j.subtreeFlags,x|=j.flags,j.return=l,j=j.sibling;return l.subtreeFlags|=x,l.childLanes=p,d}function WE(l,d,p){var x=d.pendingProps;switch(mp(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qn(d),null;case 1:return vr(d.type)&&Ld(),Qn(d),null;case 3:return x=d.stateNode,Go(),qt(yr),qt(Jn),Tp(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(l===null||l.child===null)&&(Bd(d)?d.flags|=4:l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,ds!==null&&(sm(ds),ds=null))),qp(l,d),Qn(d),null;case 5:Cp(d);var j=Ha(uc.current);if(p=d.type,l!==null&&d.stateNode!=null)Fv(l,d,p,x,j),l.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!x){if(d.stateNode===null)throw Error(n(166));return Qn(d),null}if(l=Ha(Es.current),Bd(d)){x=d.stateNode,p=d.type;var S=d.memoizedProps;switch(x[Cs]=d,x[ac]=S,l=(d.mode&1)!==0,p){case"dialog":Kt("cancel",x),Kt("close",x);break;case"iframe":case"object":case"embed":Kt("load",x);break;case"video":case"audio":for(j=0;j<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[Cs]=d,l[ac]=x,$v(l,d,!1,!1),d.stateNode=l;e:{switch(A=ji(p,x),p){case"dialog":Kt("cancel",l),Kt("close",l),j=x;break;case"iframe":case"object":case"embed":Kt("load",l),j=x;break;case"video":case"audio":for(j=0;jXo&&(d.flags|=128,x=!0,gc(S,!1),d.lanes=4194304)}else{if(!x)if(l=qd(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),gc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!en)return Qn(d),null}else 2*zt()-S.renderingStartTime>Xo&&p!==1073741824&&(d.flags|=128,x=!0,gc(S,!1),d.lanes=4194304);S.isBackwards?(A.sibling=d.child,d.child=A):(p=S.last,p!==null?p.sibling=A:d.child=A,S.last=A)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=zt(),d.sibling=null,p=rn.current,$t(rn,x?p&1|2:p&1),d):(Qn(d),null);case 22:case 23:return am(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Ir&1073741824)!==0&&(Qn(d),d.subtreeFlags&6&&(d.flags|=8192)):Qn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function UE(l,d){switch(mp(d),d.tag){case 1:return vr(d.type)&&Ld(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Go(),qt(yr),qt(Jn),Tp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Cp(d),null;case 13:if(qt(rn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Wo()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return qt(rn),null;case 4:return Go(),null;case 10:return wp(d.type._context),null;case 22:case 23:return am(),null;case 24:return null;default:return null}}var nu=!1,Xn=!1,KE=typeof WeakSet=="function"?WeakSet:Set,De=null;function Yo(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){cn(l,d,x)}else p.current=null}function Gp(l,d,p){try{p()}catch(x){cn(l,d,x)}}var Vv=!1;function qE(l,d){if(ap=Nd,l=by(),Xf(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 j=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,B=-1,K=-1,ue=0,Ne=0,ke=l,ve=null;t:for(;;){for(var Oe;ke!==p||j!==0&&ke.nodeType!==3||(B=A+j),ke!==S||x!==0&&ke.nodeType!==3||(K=A+x),ke.nodeType===3&&(A+=ke.nodeValue.length),(Oe=ke.firstChild)!==null;)ve=ke,ke=Oe;for(;;){if(ke===l)break t;if(ve===p&&++ue===j&&(B=A),ve===S&&++Ne===x&&(K=A),(Oe=ke.nextSibling)!==null)break;ke=ve,ve=ke.parentNode}ke=Oe}p=B===-1||K===-1?null:{start:B,end:K}}else p=null}p=p||{start:0,end:0}}else p=null;for(op={focusedElem:l,selectionRange:p},Nd=!1,De=d;De!==null;)if(d=De,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,De=l;else for(;De!==null;){d=De;try{var _e=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Fe=_e.memoizedProps,gn=_e.memoizedState,se=d.stateNode,Q=se.getSnapshotBeforeUpdate(d.elementType===d.type?Fe:us(d.type,Fe),gn);se.__reactInternalSnapshotBeforeUpdate=Q}break;case 3:var le=d.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ee){cn(d,d.return,Ee)}if(l=d.sibling,l!==null){l.return=d.return,De=l;break}De=d.return}return _e=Vv,Vv=!1,_e}function xc(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&l)===l){var S=j.destroy;j.destroy=void 0,S!==void 0&&Gp(d,p,S)}j=j.next}while(j!==x)}}function ru(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 Jp(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 Hv(l){var d=l.alternate;d!==null&&(l.alternate=null,Hv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Cs],delete d[ac],delete d[up],delete d[ME],delete d[AE])),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 Wv(l){return l.tag===5||l.tag===3||l.tag===4}function Uv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Wv(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 Yp(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=Od));else if(x!==4&&(l=l.child,l!==null))for(Yp(l,d,p),l=l.sibling;l!==null;)Yp(l,d,p),l=l.sibling}function Qp(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(Qp(l,d,p),l=l.sibling;l!==null;)Qp(l,d,p),l=l.sibling}var Fn=null,hs=!1;function Bi(l,d,p){for(p=p.child;p!==null;)Kv(l,d,p),p=p.sibling}function Kv(l,d,p){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(H,p)}catch{}switch(p.tag){case 5:Xn||Yo(p,d);case 6:var x=Fn,j=hs;Fn=null,Bi(l,d,p),Fn=x,hs=j,Fn!==null&&(hs?(l=Fn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Fn.removeChild(p.stateNode));break;case 18:Fn!==null&&(hs?(l=Fn,p=p.stateNode,l.nodeType===8?dp(l.parentNode,p):l.nodeType===1&&dp(l,p),Jl(l)):dp(Fn,p.stateNode));break;case 4:x=Fn,j=hs,Fn=p.stateNode.containerInfo,hs=!0,Bi(l,d,p),Fn=x,hs=j;break;case 0:case 11:case 14:case 15:if(!Xn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){j=x=x.next;do{var S=j,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&Gp(p,d,A),j=j.next}while(j!==x)}Bi(l,d,p);break;case 1:if(!Xn&&(Yo(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(B){cn(p,d,B)}Bi(l,d,p);break;case 21:Bi(l,d,p);break;case 22:p.mode&1?(Xn=(x=Xn)||p.memoizedState!==null,Bi(l,d,p),Xn=x):Bi(l,d,p);break;default:Bi(l,d,p)}}function qv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new KE),d.forEach(function(x){var j=n3.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function fs(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=A),x&=~S}if(x=j,x=zt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*JE(x/1960))-x,10l?16:l,Hi===null)var x=!1;else{if(l=Hi,Hi=null,lu=0,(xt&6)!==0)throw Error(n(331));var j=xt;for(xt|=4,De=l.current;De!==null;){var S=De,A=S.child;if((De.flags&16)!==0){var B=S.deletions;if(B!==null){for(var K=0;Kzt()-em?qa(l,0):Zp|=p),Nr(l,d)}function ab(l,d){d===0&&((l.mode&1)===0?d=1:(d=$n,$n<<=1,($n&130023424)===0&&($n=4194304)));var p=fr();l=ti(l,d),l!==null&&(Ri(l,d,p),Nr(l,p))}function t3(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),ab(l,p)}function n3(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,j=l.memoizedState;j!==null&&(p=j.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),ab(l,p)}var ob;ob=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||yr.current)br=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return br=!1,HE(l,d,p);br=(l.flags&131072)!==0}else br=!1,en&&(d.flags&1048576)!==0&&Fy(d,Fd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;tu(l,d),l=d.pendingProps;var j=Bo(d,Jn.current);qo(d,p),j=Ip(null,d,x,l,j,p);var S=Rp();return d.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,vr(x)?(S=!0,_d(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,kp(d),j.updater=Zd,d.stateNode=j,j._reactInternals=d,zp(d,x,l,p),d=Vp(null,d,x,!0,S,p)):(d.tag=0,en&&S&&pp(d),hr(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(tu(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=s3(x),l=us(x,l),j){case 0:d=Bp(null,d,x,l,p);break e;case 1:d=Pv(null,d,x,l,p);break e;case 11:d=Tv(null,d,x,l,p);break e;case 14:d=Mv(null,d,x,us(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:us(x,j),Bp(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:us(x,j),Pv(l,d,x,j,p);case 3:e:{if(Ov(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,Jy(l,d),Kd(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=Jo(Error(n(423)),d),d=Dv(l,d,x,p,j);break e}else if(x!==j){j=Jo(Error(n(424)),d),d=Dv(l,d,x,p,j);break e}else for(Ar=Di(d.stateNode.containerInfo.firstChild),Mr=d,en=!0,ds=null,p=qy(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Wo(),x===j){d=ri(l,d,p);break e}hr(l,d,x,p)}d=d.child}return d;case 5:return Xy(d),l===null&&xp(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,lp(x,j)?A=null:S!==null&&lp(x,S)&&(d.flags|=32),Rv(l,d),hr(l,d,A,p),d.child;case 6:return l===null&&xp(d),null;case 13:return Lv(l,d,p);case 4:return Sp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=Uo(d,null,x,p):hr(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:us(x,j),Tv(l,d,x,j,p);case 7:return hr(l,d,d.pendingProps,p),d.child;case 8:return hr(l,d,d.pendingProps.children,p),d.child;case 12:return hr(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,j=d.pendingProps,S=d.memoizedProps,A=j.value,$t(Hd,x._currentValue),x._currentValue=A,S!==null)if(cs(S.value,A)){if(S.children===j.children&&!yr.current){d=ri(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var B=S.dependencies;if(B!==null){A=S.child;for(var K=B.firstContext;K!==null;){if(K.context===x){if(S.tag===1){K=ni(-1,p&-p),K.tag=2;var ue=S.updateQueue;if(ue!==null){ue=ue.shared;var Ne=ue.pending;Ne===null?K.next=K:(K.next=Ne.next,Ne.next=K),ue.pending=K}}S.lanes|=p,K=S.alternate,K!==null&&(K.lanes|=p),Np(S.return,p,d),B.lanes|=p;break}K=K.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,B=A.alternate,B!==null&&(B.lanes|=p),Np(A,p,d),A=S.sibling}else A=S.child;if(A!==null)A.return=S;else for(A=S;A!==null;){if(A===d){A=null;break}if(S=A.sibling,S!==null){S.return=A.return,A=S;break}A=A.return}S=A}hr(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,qo(d,p),j=Wr(j),x=x(j),d.flags|=1,hr(l,d,x,p),d.child;case 14:return x=d.type,j=us(x,d.pendingProps),j=us(x.type,j),Mv(l,d,x,j,p);case 15:return Av(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:us(x,j),tu(l,d),d.tag=1,vr(x)?(l=!0,_d(d)):l=!1,qo(d,p),wv(d,x,j),zp(d,x,j,p),Vp(null,d,x,!0,l,p);case 19:return zv(l,d,p);case 22:return Iv(l,d,p)}throw Error(n(156,d.tag))};function lb(l,d){return Ei(l,d)}function r3(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 qr(l,d,p,x){return new r3(l,d,p,x)}function lm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function s3(l){if(typeof l=="function")return lm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===ee)return 11;if(l===R)return 14}return 2}function Ki(l,d){var p=l.alternate;return p===null?(p=qr(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 hu(l,d,p,x,j,S){var A=2;if(x=l,typeof l=="function")lm(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case D:return Ja(p.children,j,S,d);case P:A=8,j|=8;break;case L:return l=qr(12,p,d,j|2),l.elementType=L,l.lanes=S,l;case Y:return l=qr(13,p,d,j),l.elementType=Y,l.lanes=S,l;case U:return l=qr(19,p,d,j),l.elementType=U,l.lanes=S,l;case re:return fu(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case _:A=10;break e;case J:A=9;break e;case ee:A=11;break e;case R:A=14;break e;case F:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=qr(A,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function Ja(l,d,p,x){return l=qr(7,l,x,d),l.lanes=p,l}function fu(l,d,p,x){return l=qr(22,l,x,d),l.elementType=re,l.lanes=p,l.stateNode={isHidden:!1},l}function cm(l,d,p){return l=qr(6,l,null,d),l.lanes=p,l}function dm(l,d,p){return d=qr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function i3(l,d,p,x,j){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=Hl(0),this.expirationTimes=Hl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hl(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function um(l,d,p,x,j,S,A,B,K){return l=new i3(l,d,p,B,K),d===1?(d=1,S===!0&&(d|=8)):d=0,S=qr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},kp(S),l}function a3(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(),xm.exports=y3(),xm.exports}var Nb;function v3(){if(Nb)return bu;Nb=1;var t=MN();return bu.createRoot=t.createRoot,bu.hydrateRoot=t.hydrateRoot,bu}var b3=v3(),ud=MN();const AN=TN(ud);/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+S.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Kc(){return Kc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Ex(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function N3(){return Math.random().toString(36).substr(2,8)}function jb(t,e){return{usr:t.state,key:t.key,idx:e}}function gg(t,e,n,r){return n===void 0&&(n=null),Kc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Rl(e):e,{state:n,key:e&&e.key||r||N3()})}function sh(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 Rl(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 j3(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,c=sa.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Kc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=sa.Pop;let b=f(),k=b==null?null:b-h;h=b,u&&u({action:c,location:N.location,delta:k})}function g(b,k){c=sa.Push;let C=gg(N.location,b,k);h=f()+1;let E=jb(C,h),T=N.createHref(C);try{o.pushState(E,"",T)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(T)}a&&u&&u({action:c,location:N.location,delta:1})}function y(b,k){c=sa.Replace;let C=gg(N.location,b,k);h=f();let E=jb(C,h),T=N.createHref(C);o.replaceState(E,"",T),a&&u&&u({action:c,location:N.location,delta:0})}function w(b){let k=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof b=="string"?b:sh(b);return C=C.replace(/ $/,"%20"),xn(k,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,k)}let N={get action(){return c},get location(){return t(i,o)},listen(b){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(Nb,m),u=b,()=>{i.removeEventListener(Nb,m),u=null}},createHref(b){return e(i,b)},createURL:w,encodeLocation(b){let k=w(b);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(b){return o.go(b)}};return N}var kb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(kb||(kb={}));function k3(t,e,n){return n===void 0&&(n="/"),S3(t,e,n)}function S3(t,e,n,r){let i=typeof e=="string"?Rl(e):e,a=Tx(i.pathname||"/",n);if(a==null)return null;let o=AN(t);C3(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("/")&&(xn(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=ca([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(xn(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),AN(a.children,e,f,h)),!(a.path==null&&!a.index)&&e.push({path:h,score:P3(h,a.index),routesMeta:f})};return t.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))i(a,o);else for(let u of IN(a.path))i(a,o,u)}),e}function IN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=IN(r.join("/")),c=[];return c.push(...o.map(u=>u===""?a:[a,u].join("/"))),i&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function C3(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:O3(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const E3=/^:[\w-]+$/,T3=3,M3=2,A3=1,I3=10,R3=-2,Sb=t=>t==="*";function P3(t,e){let n=t.split("/"),r=n.length;return n.some(Sb)&&(r+=R3),e&&(r+=M3),n.filter(i=>!Sb(i)).reduce((i,a)=>i+(E3.test(a)?T3:a===""?A3:I3),r)}function O3(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function D3(t,e,n){let{routesMeta:r}=t,i={},a="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let N=c[m]||"";o=a.slice(0,a.length-N.length).replace(/(.)\/+$/,"$1")}const w=c[m];return y&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:o,pattern:t}}function _3(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Ex(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=[],i="^"+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:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function z3(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ex(!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 Tx(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 $3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,F3=t=>$3.test(t);function B3(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Rl(t):t,a;if(n)if(F3(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Ex(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=Cb(n.substring(1),"/"):a=Cb(n,e)}else a=e;return{pathname:a,search:W3(r),hash:U3(i)}}function Cb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function vm(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 V3(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Mx(t,e){let n=V3(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Ax(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Rl(t):(i=Kc({},t),xn(!i.pathname||!i.pathname.includes("?"),vm("?","pathname","search",i)),xn(!i.pathname||!i.pathname.includes("#"),vm("#","pathname","hash",i)),xn(!i.search||!i.search.includes("#"),vm("#","search","hash",i)));let a=t===""||i.pathname==="",o=a?"/":i.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;i.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=B3(i,c),h=o&&o!=="/"&&o.endsWith("/"),f=(a||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const ca=t=>t.join("/").replace(/\/\/+/g,"/"),H3=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),W3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,U3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function K3(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const RN=["post","put","patch","delete"];new Set(RN);const q3=["get",...RN];new Set(q3);/** + */function qc(){return qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Tx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function N3(){return Math.random().toString(36).substr(2,8)}function kb(t,e){return{usr:t.state,key:t.key,idx:e}}function xg(t,e,n,r){return n===void 0&&(n=null),qc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Al(e):e,{state:n,key:e&&e.key||r||N3()})}function ih(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 j3(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,c=ia.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(qc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=ia.Pop;let b=f(),k=b==null?null:b-h;h=b,u&&u({action:c,location:N.location,delta:k})}function g(b,k){c=ia.Push;let C=xg(N.location,b,k);h=f()+1;let E=kb(C,h),T=N.createHref(C);try{o.pushState(E,"",T)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(T)}a&&u&&u({action:c,location:N.location,delta:1})}function y(b,k){c=ia.Replace;let C=xg(N.location,b,k);h=f();let E=kb(C,h),T=N.createHref(C);o.replaceState(E,"",T),a&&u&&u({action:c,location:N.location,delta:0})}function w(b){let k=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof b=="string"?b:ih(b);return C=C.replace(/ $/,"%20"),yn(k,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,k)}let N={get action(){return c},get location(){return t(i,o)},listen(b){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(jb,m),u=b,()=>{i.removeEventListener(jb,m),u=null}},createHref(b){return e(i,b)},createURL:w,encodeLocation(b){let k=w(b);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(b){return o.go(b)}};return N}var Sb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Sb||(Sb={}));function k3(t,e,n){return n===void 0&&(n="/"),S3(t,e,n)}function S3(t,e,n,r){let i=typeof e=="string"?Al(e):e,a=Mx(i.pathname||"/",n);if(a==null)return null;let o=IN(t);C3(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("/")&&(yn(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=da([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(yn(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),IN(a.children,e,f,h)),!(a.path==null&&!a.index)&&e.push({path:h,score:P3(h,a.index),routesMeta:f})};return t.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))i(a,o);else for(let u of RN(a.path))i(a,o,u)}),e}function RN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=RN(r.join("/")),c=[];return c.push(...o.map(u=>u===""?a:[a,u].join("/"))),i&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function C3(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:O3(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const E3=/^:[\w-]+$/,T3=3,M3=2,A3=1,I3=10,R3=-2,Cb=t=>t==="*";function P3(t,e){let n=t.split("/"),r=n.length;return n.some(Cb)&&(r+=R3),e&&(r+=M3),n.filter(i=>!Cb(i)).reduce((i,a)=>i+(E3.test(a)?T3:a===""?A3:I3),r)}function O3(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function D3(t,e,n){let{routesMeta:r}=t,i={},a="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let N=c[m]||"";o=a.slice(0,a.length-N.length).replace(/(.)\/+$/,"$1")}const w=c[m];return y&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:o,pattern:t}}function _3(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Tx(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=[],i="^"+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:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function z3(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Tx(!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 Mx(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 $3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,F3=t=>$3.test(t);function B3(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Al(t):t,a;if(n)if(F3(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Tx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=Eb(n.substring(1),"/"):a=Eb(n,e)}else a=e;return{pathname:a,search:W3(r),hash:U3(i)}}function Eb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function bm(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 V3(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Ax(t,e){let n=V3(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Ix(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Al(t):(i=qc({},t),yn(!i.pathname||!i.pathname.includes("?"),bm("?","pathname","search",i)),yn(!i.pathname||!i.pathname.includes("#"),bm("#","pathname","hash",i)),yn(!i.search||!i.search.includes("#"),bm("#","search","hash",i)));let a=t===""||i.pathname==="",o=a?"/":i.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;i.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=B3(i,c),h=o&&o!=="/"&&o.endsWith("/"),f=(a||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const da=t=>t.join("/").replace(/\/\/+/g,"/"),H3=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),W3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,U3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function K3(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const PN=["post","put","patch","delete"];new Set(PN);const q3=["get",...PN];new Set(q3);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+S.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function qc(){return qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),v.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=Ax(h,JSON.parse(o),a,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:ca([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,a,t])}const Q3=v.createContext(null);function X3(t){let e=v.useContext(Ni).outlet;return e&&v.createElement(Q3.Provider,{value:t},e)}function DN(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=v.useContext(wa),{matches:i}=v.useContext(Ni),{pathname:a}=Na(),o=JSON.stringify(Mx(i,r.v7_relativeSplatPath));return v.useMemo(()=>Ax(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function Z3(t,e){return eT(t,e)}function eT(t,e,n,r){Pl()||xn(!1);let{navigator:i}=v.useContext(wa),{matches:a}=v.useContext(Ni),o=a[a.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Na(),f;if(e){var m;let b=typeof e=="string"?Rl(e):e;u==="/"||(m=b.pathname)!=null&&m.startsWith(u)||xn(!1),f=b}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let b=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(b.length).join("/")}let w=k3(t,{pathname:y}),N=iT(w&&w.map(b=>Object.assign({},b,{params:Object.assign({},c,b.params),pathname:ca([u,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?u:ca([u,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),a,n,r);return e&&N?v.createElement(lf.Provider,{value:{location:qc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:sa.Pop}},N):N}function tT(){let t=cT(),e=K3(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:i},n):null,null)}const nT=v.createElement(tT,null);class rT extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?v.createElement(Ni.Provider,{value:this.props.routeContext},v.createElement(PN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sT(t){let{routeContext:e,match:n,children:r}=t,i=v.useContext(Ix);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Ni.Provider,{value:e},r)}function iT(t,e,n,r){var i;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=(i=n)==null?void 0:i.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||xn(!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,w=!1,N=null,b=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,N=m.route.errorElement||nT,u&&(h<0&&g===0?(uT("route-fallback"),w=!0,b=null):h===g&&(w=!0,b=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),C=()=>{let E;return y?E=N:w?E=b:m.route.Component?E=v.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=f,v.createElement(sT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:E})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?v.createElement(rT,{location:n.location,revalidation:n.revalidation,component:N,error:y,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):C()},null)}var LN=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(LN||{}),_N=(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})(_N||{});function aT(t){let e=v.useContext(Ix);return e||xn(!1),e}function oT(t){let e=v.useContext(G3);return e||xn(!1),e}function lT(t){let e=v.useContext(Ni);return e||xn(!1),e}function zN(t){let e=lT(),n=e.matches[e.matches.length-1];return n.route.id||xn(!1),n.route.id}function cT(){var t;let e=v.useContext(PN),n=oT(),r=zN();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function dT(){let{router:t}=aT(LN.UseNavigateStable),e=zN(_N.UseNavigateStable),n=v.useRef(!1);return ON(()=>{n.current=!0}),v.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,qc({fromRouteId:e},a)))},[t,e])}const Eb={};function uT(t,e,n){Eb[t]||(Eb[t]=!0)}function hT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function bm(t){let{to:e,replace:n,state:r,relative:i}=t;Pl()||xn(!1);let{future:a,static:o}=v.useContext(wa),{matches:c}=v.useContext(Ni),{pathname:u}=Na(),h=ja(),f=Ax(e,Mx(c,a.v7_relativeSplatPath),u,i==="path"),m=JSON.stringify(f);return v.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:i}),[h,m,i,n,r]),null}function fT(t){return X3(t.context)}function Wt(t){xn(!1)}function pT(t){let{basename:e="/",children:n=null,location:r,navigationType:i=sa.Pop,navigator:a,static:o=!1,future:c}=t;Pl()&&xn(!1);let u=e.replace(/^\/*/,"/"),h=v.useMemo(()=>({basename:u,navigator:a,static:o,future:qc({v7_relativeSplatPath:!1},c)}),[u,c,a,o]);typeof r=="string"&&(r=Rl(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:w="default"}=r,N=v.useMemo(()=>{let b=Tx(f,u);return b==null?null:{location:{pathname:b,search:m,hash:g,state:y,key:w},navigationType:i}},[u,f,m,g,y,w,i]);return N==null?null:v.createElement(wa.Provider,{value:h},v.createElement(lf.Provider,{children:n,value:N}))}function mT(t){let{children:e,location:n}=t;return Z3(xg(e),n)}new Promise(()=>{});function xg(t,e){e===void 0&&(e=[]);let n=[];return v.Children.forEach(t,(r,i)=>{if(!v.isValidElement(r))return;let a=[...e,i];if(r.type===v.Fragment){n.push.apply(n,xg(r.props.children,a));return}r.type!==Wt&&xn(!1),!r.props.index||!r.props.children||xn(!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=xg(r.props.children,a)),n.push(o)}),n}/** + */function Gc(){return Gc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),v.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=Ix(h,JSON.parse(o),a,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:da([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,a,t])}const Q3=v.createContext(null);function X3(t){let e=v.useContext(bi).outlet;return e&&v.createElement(Q3.Provider,{value:t},e)}function LN(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=v.useContext(Na),{matches:i}=v.useContext(bi),{pathname:a}=ja(),o=JSON.stringify(Ax(i,r.v7_relativeSplatPath));return v.useMemo(()=>Ix(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function Z3(t,e){return eT(t,e)}function eT(t,e,n,r){Il()||yn(!1);let{navigator:i}=v.useContext(Na),{matches:a}=v.useContext(bi),o=a[a.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=ja(),f;if(e){var m;let b=typeof e=="string"?Al(e):e;u==="/"||(m=b.pathname)!=null&&m.startsWith(u)||yn(!1),f=b}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let b=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(b.length).join("/")}let w=k3(t,{pathname:y}),N=iT(w&&w.map(b=>Object.assign({},b,{params:Object.assign({},c,b.params),pathname:da([u,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?u:da([u,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),a,n,r);return e&&N?v.createElement(cf.Provider,{value:{location:Gc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:ia.Pop}},N):N}function tT(){let t=cT(),e=K3(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:i},n):null,null)}const nT=v.createElement(tT,null);class rT extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?v.createElement(bi.Provider,{value:this.props.routeContext},v.createElement(ON.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sT(t){let{routeContext:e,match:n,children:r}=t,i=v.useContext(Rx);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(bi.Provider,{value:e},r)}function iT(t,e,n,r){var i;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=(i=n)==null?void 0:i.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||yn(!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,w=!1,N=null,b=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,N=m.route.errorElement||nT,u&&(h<0&&g===0?(uT("route-fallback"),w=!0,b=null):h===g&&(w=!0,b=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),C=()=>{let E;return y?E=N:w?E=b:m.route.Component?E=v.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=f,v.createElement(sT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:E})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?v.createElement(rT,{location:n.location,revalidation:n.revalidation,component:N,error:y,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):C()},null)}var _N=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(_N||{}),zN=(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})(zN||{});function aT(t){let e=v.useContext(Rx);return e||yn(!1),e}function oT(t){let e=v.useContext(G3);return e||yn(!1),e}function lT(t){let e=v.useContext(bi);return e||yn(!1),e}function $N(t){let e=lT(),n=e.matches[e.matches.length-1];return n.route.id||yn(!1),n.route.id}function cT(){var t;let e=v.useContext(ON),n=oT(),r=$N();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function dT(){let{router:t}=aT(_N.UseNavigateStable),e=$N(zN.UseNavigateStable),n=v.useRef(!1);return DN(()=>{n.current=!0}),v.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Gc({fromRouteId:e},a)))},[t,e])}const Tb={};function uT(t,e,n){Tb[t]||(Tb[t]=!0)}function hT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function wm(t){let{to:e,replace:n,state:r,relative:i}=t;Il()||yn(!1);let{future:a,static:o}=v.useContext(Na),{matches:c}=v.useContext(bi),{pathname:u}=ja(),h=ka(),f=Ix(e,Ax(c,a.v7_relativeSplatPath),u,i==="path"),m=JSON.stringify(f);return v.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:i}),[h,m,i,n,r]),null}function fT(t){return X3(t.context)}function Gt(t){yn(!1)}function pT(t){let{basename:e="/",children:n=null,location:r,navigationType:i=ia.Pop,navigator:a,static:o=!1,future:c}=t;Il()&&yn(!1);let u=e.replace(/^\/*/,"/"),h=v.useMemo(()=>({basename:u,navigator:a,static:o,future:Gc({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:w="default"}=r,N=v.useMemo(()=>{let b=Mx(f,u);return b==null?null:{location:{pathname:b,search:m,hash:g,state:y,key:w},navigationType:i}},[u,f,m,g,y,w,i]);return N==null?null:v.createElement(Na.Provider,{value:h},v.createElement(cf.Provider,{children:n,value:N}))}function mT(t){let{children:e,location:n}=t;return Z3(yg(e),n)}new Promise(()=>{});function yg(t,e){e===void 0&&(e=[]);let n=[];return v.Children.forEach(t,(r,i)=>{if(!v.isValidElement(r))return;let a=[...e,i];if(r.type===v.Fragment){n.push.apply(n,yg(r.props.children,a));return}r.type!==Gt&&yn(!1),!r.props.index||!r.props.children||yn(!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=yg(r.props.children,a)),n.push(o)}),n}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. @@ -64,12 +64,12 @@ Error generating stack: `+S.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function yg(){return yg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function xT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yT(t,e){return t.button===0&&(!e||e==="_self")&&!xT(t)}function vg(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(i=>[n,i]):[[n,r]])},[]))}function vT(t,e){let n=vg(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(a=>{n.append(i,a)})}),n}const bT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],wT="6";try{window.__reactRouterVersion=wT}catch{}const NT="startTransition",Tb=of[NT];function jT(t){let{basename:e,children:n,future:r,window:i}=t,a=v.useRef();a.current==null&&(a.current=w3({window:i,v5Compat:!0}));let o=a.current,[c,u]=v.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=v.useCallback(m=>{h&&Tb?Tb(()=>u(m)):u(m)},[u,h]);return v.useLayoutEffect(()=>o.listen(f),[o,f]),v.useEffect(()=>hT(r),[r]),v.createElement(pT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const kT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ST=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bg=v.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=gT(e,bT),{basename:y}=v.useContext(wa),w,N=!1;if(typeof h=="string"&&ST.test(h)&&(w=h,kT))try{let E=new URL(window.location.href),T=h.startsWith("//")?new URL(E.protocol+h):new URL(h),I=Tx(T.pathname,y);T.origin===E.origin&&I!=null?h=I+T.search+T.hash:N=!0}catch{}let b=J3(h,{relative:i}),k=CT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:i,viewTransition:m});function C(E){r&&r(E),E.defaultPrevented||k(E)}return v.createElement("a",yg({},g,{href:w||b,onClick:N||a?r:C,ref:n,target:u}))});var Mb;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Mb||(Mb={}));var Ab;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Ab||(Ab={}));function CT(t,e){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:c}=e===void 0?{}:e,u=ja(),h=Na(),f=DN(t,{relative:o});return v.useCallback(m=>{if(yT(m,n)){m.preventDefault();let g=r!==void 0?r:sh(h)===sh(f);u(t,{replace:g,state:i,preventScrollReset:a,relative:o,viewTransition:c})}},[h,u,f,r,i,n,t,a,o,c])}function $N(t){let e=v.useRef(vg(t)),n=v.useRef(!1),r=Na(),i=v.useMemo(()=>vT(r.search,n.current?null:e.current),[r.search]),a=ja(),o=v.useCallback((c,u)=>{const h=vg(typeof c=="function"?c(i):c);n.current=!0,a("?"+h,u)},[a,i]);return[i,o]}/** + */function vg(){return vg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function xT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yT(t,e){return t.button===0&&(!e||e==="_self")&&!xT(t)}function bg(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(i=>[n,i]):[[n,r]])},[]))}function vT(t,e){let n=bg(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(a=>{n.append(i,a)})}),n}const bT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],wT="6";try{window.__reactRouterVersion=wT}catch{}const NT="startTransition",Mb=lf[NT];function jT(t){let{basename:e,children:n,future:r,window:i}=t,a=v.useRef();a.current==null&&(a.current=w3({window:i,v5Compat:!0}));let o=a.current,[c,u]=v.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=v.useCallback(m=>{h&&Mb?Mb(()=>u(m)):u(m)},[u,h]);return v.useLayoutEffect(()=>o.listen(f),[o,f]),v.useEffect(()=>hT(r),[r]),v.createElement(pT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const kT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ST=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wg=v.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=gT(e,bT),{basename:y}=v.useContext(Na),w,N=!1;if(typeof h=="string"&&ST.test(h)&&(w=h,kT))try{let E=new URL(window.location.href),T=h.startsWith("//")?new URL(E.protocol+h):new URL(h),I=Mx(T.pathname,y);T.origin===E.origin&&I!=null?h=I+T.search+T.hash:N=!0}catch{}let b=J3(h,{relative:i}),k=CT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:i,viewTransition:m});function C(E){r&&r(E),E.defaultPrevented||k(E)}return v.createElement("a",vg({},g,{href:w||b,onClick:N||a?r:C,ref:n,target:u}))});var Ab;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Ab||(Ab={}));var Ib;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Ib||(Ib={}));function CT(t,e){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:c}=e===void 0?{}:e,u=ka(),h=ja(),f=LN(t,{relative:o});return v.useCallback(m=>{if(yT(m,n)){m.preventDefault();let g=r!==void 0?r:ih(h)===ih(f);u(t,{replace:g,state:i,preventScrollReset:a,relative:o,viewTransition:c})}},[h,u,f,r,i,n,t,a,o,c])}function FN(t){let e=v.useRef(bg(t)),n=v.useRef(!1),r=ja(),i=v.useMemo(()=>vT(r.search,n.current?null:e.current),[r.search]),a=ka(),o=v.useCallback((c,u)=>{const h=bg(typeof c=="function"?c(i):c);n.current=!0,a("?"+h,u)},[a,i]);return[i,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 ET=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),TT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Ib=t=>{const e=TT(t);return e.charAt(0).toUpperCase()+e.slice(1)},FN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),MT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** + */const ET=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),TT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Rb=t=>{const e=TT(t);return e.charAt(0).toUpperCase()+e.slice(1)},BN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),MT=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. @@ -79,22 +79,22 @@ Error generating stack: `+S.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IT=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:o,...c},u)=>v.createElement("svg",{ref:u,...AT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:FN("lucide",i),...!a&&!MT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>v.createElement(h,f)),...Array.isArray(a)?a:[a]]));/** + */const IT=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:o,...c},u)=>v.createElement("svg",{ref:u,...AT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:BN("lucide",i),...!a&&!MT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>v.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=v.forwardRef(({className:r,...i},a)=>v.createElement(IT,{ref:a,iconNode:e,className:FN(`lucide-${ET(Ib(t))}`,`lucide-${t}`,r),...i}));return n.displayName=Ib(t),n};/** + */const Ce=(t,e)=>{const n=v.forwardRef(({className:r,...i},a)=>v.createElement(IT,{ref:a,iconNode:e,className:BN(`lucide-${ET(Rb(t))}`,`lucide-${t}`,r),...i}));return n.displayName=Rb(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 RT=[["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"}]],wm=Ce("arrow-up-down",RT);/** + */const RT=[["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"}]],Nm=Ce("arrow-up-down",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 PT=[["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"}]],Rb=Ce("bitcoin",PT);/** + */const PT=[["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"}]],Pb=Ce("bitcoin",PT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -104,12 +104,12 @@ Error generating stack: `+S.message+` * * 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:"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"}]],Yr=Ce("book-open",LT);/** + */const LT=[["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"}]],Xr=Ce("book-open",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:"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"}]],ih=Ce("calendar",_T);/** + */const _T=[["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"}]],ah=Ce("calendar",_T);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -119,12 +119,12 @@ Error generating stack: `+S.message+` * * 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:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cf=Ce("check",FT);/** + */const FT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],df=Ce("check",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:"m6 9 6 6 6-6",key:"qrunsl"}]],Gc=Ce("chevron-down",BT);/** + */const BT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Jc=Ce("chevron-down",BT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -134,47 +134,47 @@ Error generating stack: `+S.message+` * * 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:"m9 18 6-6-6-6",key:"mthhwq"}]],fl=Ce("chevron-right",WT);/** + */const WT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ul=Ce("chevron-right",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=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],BN=Ce("chevron-up",UT);/** + */const UT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],VN=Ce("chevron-up",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"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],VN=Ce("circle-alert",KT);/** + */const KT=[["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"}]],HN=Ce("circle-alert",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:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Pb=Ce("circle-check-big",qT);/** + */const qT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ob=Ce("circle-check-big",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:"m9 12 2 2 4-4",key:"dzmm74"}]],wg=Ce("circle-check",GT);/** + */const GT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ng=Ce("circle-check",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=[["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"}]],HN=Ce("circle-question-mark",JT);/** + */const JT=[["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"}]],WN=Ce("circle-question-mark",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=[["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"}]],Nm=Ce("circle-user",YT);/** + */const YT=[["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"}]],jm=Ce("circle-user",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=[["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"}]],WN=Ce("circle-x",QT);/** + */const QT=[["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"}]],UN=Ce("circle-x",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=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ng=Ce("clock",XT);/** + */const XT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],jg=Ce("clock",XT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -184,22 +184,22 @@ Error generating stack: `+S.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tM=[["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"}]],UN=Ce("copy",tM);/** + */const tM=[["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"}]],KN=Ce("copy",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=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Ob=Ce("credit-card",nM);/** + */const nM=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Db=Ce("credit-card",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:"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"}]],xl=Ce("crown",rM);/** + */const rM=[["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"}]],ml=Ce("crown",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 sM=[["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"}]],ah=Ce("dollar-sign",sM);/** + */const sM=[["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"}]],oh=Ce("dollar-sign",sM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -209,12 +209,12 @@ Error generating stack: `+S.message+` * * 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:"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"}]],_s=Ce("external-link",oM);/** + */const oM=[["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"}]],Ls=Ce("external-link",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 lM=[["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"}]],jg=Ce("eye",lM);/** + */const lM=[["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"}]],kg=Ce("eye",lM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -224,7 +224,7 @@ Error generating stack: `+S.message+` * * 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:"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"}]],KN=Ce("funnel",uM);/** + */const uM=[["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"}]],qN=Ce("funnel",uM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -239,7 +239,7 @@ Error generating stack: `+S.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gM=[["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"}]],kg=Ce("globe",gM);/** + */const gM=[["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"}]],Sg=Ce("globe",gM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -249,7 +249,7 @@ Error generating stack: `+S.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vM=[["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"}]],oi=Ce("grip-vertical",vM);/** + */const vM=[["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"}]],ii=Ce("grip-vertical",vM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -259,7 +259,7 @@ Error generating stack: `+S.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NM=[["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"}]],Db=Ce("hash",NM);/** + */const NM=[["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"}]],Lb=Ce("hash",NM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -284,12 +284,12 @@ Error generating stack: `+S.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IM=[["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"}]],qN=Ce("image",IM);/** + */const IM=[["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"}]],GN=Ce("image",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 RM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],bu=Ce("info",RM);/** + */const RM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],wu=Ce("info",RM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -309,12 +309,12 @@ Error generating stack: `+S.message+` * * 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:"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"}]],gs=Ce("link-2",$M);/** + */const $M=[["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"}]],ys=Ce("link-2",$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 FM=[["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"}]],Sg=Ce("link",FM);/** + */const FM=[["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"}]],Cg=Ce("link",FM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -339,7 +339,7 @@ Error generating stack: `+S.message+` * * 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:"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"}]],GN=Ce("map-pin",JM);/** + */const JM=[["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"}]],JN=Ce("map-pin",JM);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -359,7 +359,7 @@ Error generating stack: `+S.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nA=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],pl=Ce("navigation",nA);/** + */const nA=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],hl=Ce("navigation",nA);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -369,12 +369,12 @@ Error generating stack: `+S.message+` * * 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 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"}]],_t=Ce("pen-line",iA);/** + */const iA=[["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"}]],Ft=Ce("pen-line",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 aA=[["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"}]],JN=Ce("pencil",aA);/** + */const aA=[["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"}]],YN=Ce("pencil",aA);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -394,12 +394,12 @@ Error generating stack: `+S.message+` * * 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:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],dn=Ce("plus",fA);/** + */const fA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],un=Ce("plus",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 pA=[["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"}]],Lb=Ce("qr-code",pA);/** + */const pA=[["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"}]],_b=Ce("qr-code",pA);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -414,17 +414,17 @@ Error generating stack: `+S.message+` * * 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:"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"}]],Ge=Ce("refresh-cw",vA);/** + */const vA=[["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"}]],Je=Ce("refresh-cw",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:"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"}]],gn=Ce("save",bA);/** + */const bA=[["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"}]],xn=Ce("save",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:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],da=Ce("search",wA);/** + */const wA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ua=Ce("search",wA);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -434,32 +434,32 @@ Error generating stack: `+S.message+` * * 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:"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"}]],so=Ce("settings",kA);/** + */const kA=[["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"}]],io=Ce("settings",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:"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"}]],wu=Ce("settings-2",SA);/** + */const SA=[["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"}]],Nu=Ce("settings-2",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:"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"}]],Rx=Ce("shield-check",CA);/** + */const CA=[["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"}]],Px=Ce("shield-check",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 EA=[["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"}]],Cg=Ce("shopping-bag",EA);/** + */const EA=[["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"}]],Eg=Ce("shopping-bag",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=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],uo=Ce("smartphone",TA);/** + */const TA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ho=Ce("smartphone",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 MA=[["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"}]],ml=Ce("star",MA);/** + */const MA=[["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"}]],fl=Ce("star",MA);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -474,27 +474,27 @@ Error generating stack: `+S.message+` * * 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.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"}]],qu=Ce("tag",OA);/** + */const OA=[["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"}]],Gu=Ce("tag",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:"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"}]],Bn=Ce("trash-2",DA);/** + */const DA=[["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"}]],Hn=Ce("trash-2",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 LA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Oc=Ce("trending-up",LA);/** + */const LA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Dc=Ce("trending-up",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:"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"}]],_b=Ce("trophy",_A);/** + */const _A=[["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"}]],zb=Ce("trophy",_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:"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"}]],YN=Ce("undo-2",zA);/** + */const zA=[["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"}]],QN=Ce("undo-2",zA);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. @@ -504,42 +504,42 @@ Error generating stack: `+S.message+` * * 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:"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"}]],oh=Ce("upload",BA);/** + */const BA=[["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"}]],lh=Ce("upload",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:"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"}]],Eg=Ce("user-plus",VA);/** + */const VA=[["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"}]],Tg=Ce("user-plus",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:"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"}]],yl=Ce("user",HA);/** + */const HA=[["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"}]],gl=Ce("user",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 WA=[["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"}]],Un=Ce("users",WA);/** + */const WA=[["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"}]],qn=Ce("users",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 UA=[["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"}]],jl=Ce("wallet",UA);/** + */const UA=[["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"}]],wl=Ce("wallet",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 KA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xn=Ce("x",KA);/** + */const KA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],er=Ce("x",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 qA=[["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"}]],ia=Ce("zap",qA),Px="admin_token";function Ox(){try{return localStorage.getItem(Px)}catch{return null}}function GA(t){try{localStorage.setItem(Px,t)}catch{}}function JA(){try{localStorage.removeItem(Px)}catch{}}const YA="https://soulapi.quwanzhi.com",QA=15e3,zb=6e4,XA=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):YA};function ho(t){const e=XA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function df(t,e={}){const{data:n,...r}=e,i=ho(t),a=new Headers(r.headers),o=Ox();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=r.timeout??QA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(i,{...r,headers:a,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),y=(m.headers.get("Content-Type")||"").includes("application/json")?await m.json():m,w=N=>{const b=N,k=((b==null?void 0:b.message)||(b==null?void 0:b.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){w(y);const N=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw N.status=m.status,N.data=y,N}return w(y),y}function Le(t,e){return df(t,{...e,method:"GET"})}function wt(t,e,n){return df(t,{...n,method:"POST",data:e})}function Mt(t,e,n){return df(t,{...n,method:"PUT",data:e})}function Ps(t,e){return df(t,{...e,method:"DELETE"})}function ZA(){const[t,e]=v.useState(!1),[n,r]=v.useState("");return v.useEffect(()=>{const i=a=>{const o=a.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",i),()=>window.removeEventListener("recharge-alert",i)},[]),t?s.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 bg-red-900/80 border-b border-red-600/50 text-red-100",role:"alert",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(VN,{className:"w-5 h-5 shrink-0 text-red-400"}),s.jsxs("span",{className:"text-sm font-medium",children:[n,s.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),s.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:s.jsx(Xn,{className:"w-4 h-4"})})]}):null}const eI=[{icon:zM,label:"数据概览",href:"/dashboard"},{icon:Yr,label:"内容管理",href:"/content"},{icon:Un,label:"用户管理",href:"/users"},{icon:mM,label:"找伙伴",href:"/find-partner"},{icon:jl,label:"推广中心",href:"/distribution"}];function tI(){const t=Na(),e=ja(),[n,r]=v.useState(!1),[i,a]=v.useState(!1);v.useEffect(()=>{r(!0)},[]),v.useEffect(()=>{if(!n)return;a(!1);let c=!1;return Le("/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()=>{JA();try{await wt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!i?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[eI.map(c=>{const u=t.pathname===c.href;return s.jsxs(bg,{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:[s.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(bg,{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:[s.jsx(so,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.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:[s.jsx(GM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(ZA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(fT,{})})]})]})}function $b(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Dx(...t){return e=>{let n=!1;const r=t.map(i=>{const a=$b(i,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i{let{children:a,...o}=r;QN(a)&&typeof lh=="function"&&(a=lh(a._payload));const c=v.Children.toArray(a),u=c.find(aI);if(u){const h=u.props.children,f=c.map(m=>m===u?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:i,children:v.isValidElement(h)?v.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}var ZN=XN("Slot");function sI(t){const e=v.forwardRef((n,r)=>{let{children:i,...a}=n;if(QN(i)&&typeof lh=="function"&&(i=lh(i._payload)),v.isValidElement(i)){const o=lI(i),c=oI(a,i.props);return i.type!==v.Fragment&&(c.ref=r?Dx(r,o):o),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iI=Symbol("radix.slottable");function aI(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iI}function oI(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...c)=>{const u=a(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function lI(t){var r,i;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=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function ej(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Bb=tj,nj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Bb(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:a}=e,o=Object.keys(i).map(h=>{const f=n==null?void 0:n[h],m=a==null?void 0:a[h];if(f===null)return null;const g=Fb(f)||Fb(m);return i[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(w=>{let[N,b]=w;return Array.isArray(b)?b.includes({...a,...c}[N]):{...a,...c}[N]===b})?[...h,m,g]:h},[]);return Bb(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},cI=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),rj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),ch="-",Vb=[],uI="arbitrary..",hI=t=>{const e=pI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return fI(o);const c=o.split(ch),u=c[0]===""&&c.length>1?1:0;return sj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?cI(h,u):u:h||Vb}return n[o]||Vb}}},sj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],a=n.nextPart.get(i);if(a){const h=sj(t,e+1,a);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(ch):t.slice(e).join(ch),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?uI+r:void 0})(),pI=t=>{const{theme:e,classGroups:n}=t;return mI(n,e)},mI=(t,e)=>{const n=rj();for(const r in t){const i=t[r];Lx(i,n,r,e)}return n},Lx=(t,e,n,r)=>{const i=t.length;for(let a=0;a{if(typeof t=="string"){xI(t,e,n);return}if(typeof t=="function"){yI(t,e,n,r);return}vI(t,e,n,r)},xI=(t,e,n)=>{const r=t===""?e:ij(e,t);r.classGroupId=n},yI=(t,e,n,r)=>{if(bI(t)){Lx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(dI(n,t))},vI=(t,e,n,r)=>{const i=Object.entries(t),a=i.length;for(let o=0;o{let n=t;const r=e.split(ch),i=r.length;for(let a=0;a"isThemeGetter"in t&&t.isThemeGetter===!0,wI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(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 i(a,o),o},set(a,o){a in n?n[a]=o:i(a,o)}}},Tg="!",Hb=":",NI=[],Wb=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),jI=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const a=[];let o=0,c=0,u=0,h;const f=i.length;for(let N=0;Nu?h-u:void 0;return Wb(a,y,g,w)};if(e){const i=e+Hb,a=r;r=o=>o.startsWith(i)?a(o.slice(i.length)):Wb(NI,!1,o,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},kI=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},SI=t=>({cache:wI(t.cacheSize),parseClassName:jI(t),sortModifiers:kI(t),...hI(t)}),CI=/\s+/,EI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=e,o=[],c=t.trim().split(CI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:N}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let b=!!N,k=r(b?w.substring(0,N):w);if(!k){if(!b){u=f+(u.length>0?" "+u:u);continue}if(k=r(w),!k){u=f+(u.length>0?" "+u:u);continue}b=!1}const C=g.length===0?"":g.length===1?g[0]:a(g).join(":"),E=y?C+Tg:C,T=E+k;if(o.indexOf(T)>-1)continue;o.push(T);const I=i(k,b);for(let O=0;O0?" "+u:u)}return u},TI=(...t)=>{let e=0,n,r,i="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,i,a;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=SI(h),r=n.cache.get,i=n.cache.set,a=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=EI(u,n);return i(u,f),f};return a=o,(...u)=>a(TI(...u))},AI=[],Cn=t=>{const e=n=>n[t]||AI;return e.isThemeGetter=!0,e},oj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,II=/^\d+\/\d+$/,RI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PI=/\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$/,OI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nl=t=>II.test(t),ct=t=>!!t&&!Number.isNaN(Number(t)),qi=t=>!!t&&Number.isInteger(Number(t)),jm=t=>t.endsWith("%")&&ct(t.slice(0,-1)),li=t=>RI.test(t),_I=()=>!0,zI=t=>PI.test(t)&&!OI.test(t),cj=()=>!1,$I=t=>DI.test(t),FI=t=>LI.test(t),BI=t=>!ze(t)&&!$e(t),VI=t=>Ol(t,hj,cj),ze=t=>oj.test(t),Ja=t=>Ol(t,fj,zI),km=t=>Ol(t,qI,ct),Ub=t=>Ol(t,dj,cj),HI=t=>Ol(t,uj,FI),Nu=t=>Ol(t,pj,$I),$e=t=>lj.test(t),Nc=t=>Dl(t,fj),WI=t=>Dl(t,GI),Kb=t=>Dl(t,dj),UI=t=>Dl(t,hj),KI=t=>Dl(t,uj),ju=t=>Dl(t,pj,!0),Ol=(t,e,n)=>{const r=oj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Dl=(t,e,n=!1)=>{const r=lj.exec(t);return r?r[1]?e(r[1]):n:!1},dj=t=>t==="position"||t==="percentage",uj=t=>t==="image"||t==="url",hj=t=>t==="length"||t==="size"||t==="bg-size",fj=t=>t==="length",qI=t=>t==="number",GI=t=>t==="family-name",pj=t=>t==="shadow",JI=()=>{const t=Cn("color"),e=Cn("font"),n=Cn("text"),r=Cn("font-weight"),i=Cn("tracking"),a=Cn("leading"),o=Cn("breakpoint"),c=Cn("container"),u=Cn("spacing"),h=Cn("radius"),f=Cn("shadow"),m=Cn("inset-shadow"),g=Cn("text-shadow"),y=Cn("drop-shadow"),w=Cn("blur"),N=Cn("perspective"),b=Cn("aspect"),k=Cn("ease"),C=Cn("animate"),E=()=>["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"],I=()=>[...T(),$e,ze],O=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],P=()=>[$e,ze,u],L=()=>[nl,"full","auto",...P()],_=()=>[qi,"none","subgrid",$e,ze],J=()=>["auto",{span:["full",qi,$e,ze]},qi,$e,ze],ee=()=>[qi,"auto",$e,ze],Y=()=>["auto","min","max","fr",$e,ze],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...P()],re=()=>[nl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],z=()=>[t,$e,ze],ie=()=>[...T(),Kb,Ub,{position:[$e,ze]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",UI,VI,{size:[$e,ze]}],H=()=>[jm,Nc,Ja],ce=()=>["","none","full",h,$e,ze],W=()=>["",ct,Nc,Ja],fe=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[ct,jm,Kb,Ub],he=()=>["","none",w,$e,ze],we=()=>["none",ct,$e,ze],Te=()=>["none",ct,$e,ze],Ve=()=>[ct,$e,ze],He=()=>[nl,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[li],breakpoint:[li],color:[_I],container:[li],"drop-shadow":[li],ease:["in","out","in-out"],font:[BI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[li],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[li],shadow:[li],spacing:["px",ct],text:[li],"text-shadow":[li],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nl,ze,$e,b]}],container:["container"],columns:[{columns:[ct,ze,$e,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:I()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[qi,"auto",$e,ze]}],basis:[{basis:[nl,"full","auto",c,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ct,nl,"auto","initial","none",ze]}],grow:[{grow:["",ct,$e,ze]}],shrink:[{shrink:["",ct,$e,ze]}],order:[{order:[qi,"first","last","none",$e,ze]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"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:[...U(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],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:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:re()}],w:[{w:[c,"screen",...re()]}],"min-w":[{"min-w":[c,"screen","none",...re()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...re()]}],h:[{h:["screen","lh",...re()]}],"min-h":[{"min-h":["screen","lh","none",...re()]}],"max-h":[{"max-h":["screen","lh",...re()]}],"font-size":[{text:["base",n,Nc,Ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,$e,km]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jm,ze]}],"font-family":[{font:[WI,ze,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:[i,$e,ze]}],"line-clamp":[{"line-clamp":[ct,"none",$e,km]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",$e,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[ct,"from-font","auto",$e,Ja]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[ct,"auto",$e,ze]}],"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,ze]}],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,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qi,$e,ze],radial:["",$e,ze],conic:[qi,$e,ze]},KI,HI]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ct,$e,ze]}],"outline-w":[{outline:["",ct,Nc,Ja]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,ju,Nu]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",m,ju,Nu]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[ct,Ja]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",g,ju,Nu]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[ct,$e,ze]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[$e,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"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":[ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,ze]}],filter:[{filter:["","none",$e,ze]}],blur:[{blur:he()}],brightness:[{brightness:[ct,$e,ze]}],contrast:[{contrast:[ct,$e,ze]}],"drop-shadow":[{"drop-shadow":["","none",y,ju,Nu]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",ct,$e,ze]}],"hue-rotate":[{"hue-rotate":[ct,$e,ze]}],invert:[{invert:["",ct,$e,ze]}],saturate:[{saturate:[ct,$e,ze]}],sepia:[{sepia:["",ct,$e,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,ze]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[ct,$e,ze]}],"backdrop-contrast":[{"backdrop-contrast":[ct,$e,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ct,$e,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ct,$e,ze]}],"backdrop-invert":[{"backdrop-invert":["",ct,$e,ze]}],"backdrop-opacity":[{"backdrop-opacity":[ct,$e,ze]}],"backdrop-saturate":[{"backdrop-saturate":[ct,$e,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",ct,$e,ze]}],"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,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ct,"initial",$e,ze]}],ease:[{ease:["linear","initial",k,$e,ze]}],delay:[{delay:[ct,$e,ze]}],animate:[{animate:["none",C,$e,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,$e,ze]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Ve()}],"skew-x":[{"skew-x":Ve()}],"skew-y":[{"skew-y":Ve()}],transform:[{transform:[$e,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:He()}],"translate-x":[{"translate-x":He()}],"translate-y":[{"translate-y":He()}],"translate-z":[{"translate-z":He()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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,ze]}],"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,ze]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[ct,Nc,Ja,km]}],stroke:[{stroke:["none",...z()]}],"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"]}},YI=MI(JI);function Ct(...t){return YI(tj(t))}const QI=nj("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 te({className:t,variant:e,size:n,asChild:r=!1,...i}){const a=r?ZN:"button";return s.jsx(a,{"data-slot":"button",className:Ct(QI({variant:e,size:n,className:t})),...i})}function oe({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Ct("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 XI(){const t=ja(),[e,n]=v.useState(""),[r,i]=v.useState(""),[a,o]=v.useState(""),[c,u]=v.useState(!1),h=async()=>{o(""),u(!0);try{const f=await wt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){GA(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 s.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),s.jsxs("div",{className:"w-full max-w-md relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.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:s.jsx(Rx,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(yl,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(oe,{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]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(KM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(oe,{type:"password",value:r,onChange:f=>i(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&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:a}),s.jsx(te,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Me=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Me.displayName="Card";const rt=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex flex-col space-y-1.5 p-6",t),...e}));rt.displayName="CardHeader";const st=v.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Ct("font-semibold leading-none tracking-tight",t),...e}));st.displayName="CardTitle";const $t=v.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Ct("text-sm text-muted-foreground",t),...e}));$t.displayName="CardDescription";const Ae=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("p-6 pt-0",t),...e}));Ae.displayName="CardContent";const ZI=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex items-center p-6 pt-0",t),...e}));ZI.displayName="CardFooter";const e5={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Sm(t,e="info",n=3e3){const r=`toast-${Date.now()}`,i=e5[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:i.bg,border:`1.5px solid ${i.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:i.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=i.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 ae={success:(t,e)=>Sm(t,"success",e),error:(t,e)=>Sm(t,"error",e),info:(t,e)=>Sm(t,"info",e)};function at(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function t5(t,e){const n=v.createContext(e),r=a=>{const{children:o,...c}=a,u=v.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function i(a){const o=v.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,i]}function ka(t,e=[]){let n=[];function r(a,o){const c=v.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...w}=m,N=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,b=v.useMemo(()=>w,Object.values(w));return s.jsx(N.Provider,{value:b,children:y})};h.displayName=a+"Provider";function f(m,g){var N;const y=((N=g==null?void 0:g[t])==null?void 0:N[u])||c,w=v.useContext(y);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,f]}const i=()=>{const a=n.map(o=>v.createContext(o));return function(c){const u=(c==null?void 0:c[t])||a;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return i.scopeName=t,[r,n5(i,...e)]}function n5(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(a)[`__scope${h}`];return{...c,...m}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Zn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},r5=of[" useId ".trim().toString()]||(()=>{}),s5=0;function ua(t){const[e,n]=v.useState(r5());return Zn(()=>{n(r=>r??String(s5++))},[t]),e?`radix-${e}`:""}var i5=of[" useInsertionEffect ".trim().toString()]||Zn;function fo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,a,o]=a5({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:i;{const f=v.useRef(t!==void 0);v.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=v.useCallback(f=>{var m;if(c){const g=o5(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 a5({defaultProp:t,onChange:e}){const[n,r]=v.useState(t),i=v.useRef(n),a=v.useRef(e);return i5(()=>{a.current=e},[e]),v.useEffect(()=>{var o;i.current!==n&&((o=a.current)==null||o.call(a,n),i.current=n)},[n,i]),[n,r,a]}function o5(t){return typeof t=="function"}function Jc(t){const e=l5(t),n=v.forwardRef((r,i)=>{const{children:a,...o}=r,c=v.Children.toArray(a),u=c.find(d5);if(u){const h=u.props.children,f=c.map(m=>m===u?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:i,children:v.isValidElement(h)?v.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}function l5(t){const e=v.forwardRef((n,r)=>{const{children:i,...a}=n;if(v.isValidElement(i)){const o=h5(i),c=u5(a,i.props);return i.type!==v.Fragment&&(c.ref=r?Dx(r,o):o),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var c5=Symbol("radix.slottable");function d5(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===c5}function u5(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...c)=>{const u=a(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function h5(t){var r,i;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=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var f5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dt=f5.reduce((t,e)=>{const n=Jc(`Primitive.${e}`),r=v.forwardRef((i,a)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function p5(t,e){t&&dd.flushSync(()=>t.dispatchEvent(e))}function ga(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function m5(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var g5="DismissableLayer",Mg="dismissableLayer.update",x5="dismissableLayer.pointerDownOutside",y5="dismissableLayer.focusOutside",qb,mj=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_x=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,h=v.useContext(mj),[f,m]=v.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),w=St(e,D=>m(D)),N=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=N.indexOf(b),C=f?N.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,T=C>=k,I=w5(D=>{const P=D.target,L=[...h.branches].some(_=>_.contains(P));!T||L||(i==null||i(D),o==null||o(D),D.defaultPrevented||c==null||c())},g),O=N5(D=>{const P=D.target;[...h.branches].some(_=>_.contains(P))||(a==null||a(D),o==null||o(D),D.defaultPrevented||c==null||c())},g);return m5(D=>{C===h.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},g),v.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(qb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Gb(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=qb)}},[f,g,n,h]),v.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Gb())},[f,h]),v.useEffect(()=>{const D=()=>y({});return document.addEventListener(Mg,D),()=>document.removeEventListener(Mg,D)},[]),s.jsx(dt.div,{...u,ref:w,style:{pointerEvents:E?T?"auto":"none":void 0,...t.style},onFocusCapture:at(t.onFocusCapture,O.onFocusCapture),onBlurCapture:at(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:at(t.onPointerDownCapture,I.onPointerDownCapture)})});_x.displayName=g5;var v5="DismissableLayerBranch",b5=v.forwardRef((t,e)=>{const n=v.useContext(mj),r=v.useRef(null),i=St(e,r);return v.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(dt.div,{...t,ref:i})});b5.displayName=v5;function w5(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const a=c=>{if(c.target&&!r.current){let u=function(){gj(x5,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function N5(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t),r=v.useRef(!1);return v.useEffect(()=>{const i=a=>{a.target&&!r.current&&gj(y5,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Gb(){const t=new CustomEvent(Mg);document.dispatchEvent(t)}function gj(t,e,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?p5(i,a):i.dispatchEvent(a)}var Cm="focusScope.autoFocusOnMount",Em="focusScope.autoFocusOnUnmount",Jb={bubbles:!1,cancelable:!0},j5="FocusScope",zx=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=t,[c,u]=v.useState(null),h=ga(i),f=ga(a),m=v.useRef(null),g=St(e,N=>u(N)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let N=function(E){if(y.paused||!c)return;const T=E.target;c.contains(T)?m.current=T:Yi(m.current,{select:!0})},b=function(E){if(y.paused||!c)return;const T=E.relatedTarget;T!==null&&(c.contains(T)||Yi(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const I of E)I.removedNodes.length>0&&Yi(c)};document.addEventListener("focusin",N),document.addEventListener("focusout",b);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",b),C.disconnect()}}},[r,c,y.paused]),v.useEffect(()=>{if(c){Qb.add(y);const N=document.activeElement;if(!c.contains(N)){const k=new CustomEvent(Cm,Jb);c.addEventListener(Cm,h),c.dispatchEvent(k),k.defaultPrevented||(k5(M5(xj(c)),{select:!0}),document.activeElement===N&&Yi(c))}return()=>{c.removeEventListener(Cm,h),setTimeout(()=>{const k=new CustomEvent(Em,Jb);c.addEventListener(Em,f),c.dispatchEvent(k),k.defaultPrevented||Yi(N??document.body,{select:!0}),c.removeEventListener(Em,f),Qb.remove(y)},0)}}},[c,h,f,y]);const w=v.useCallback(N=>{if(!n&&!r||y.paused)return;const b=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,k=document.activeElement;if(b&&k){const C=N.currentTarget,[E,T]=S5(C);E&&T?!N.shiftKey&&k===T?(N.preventDefault(),n&&Yi(E,{select:!0})):N.shiftKey&&k===E&&(N.preventDefault(),n&&Yi(T,{select:!0})):k===C&&N.preventDefault()}},[n,r,y.paused]);return s.jsx(dt.div,{tabIndex:-1,...o,ref:g,onKeyDown:w})});zx.displayName=j5;function k5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Yi(r,{select:e}),document.activeElement!==n)return}function S5(t){const e=xj(t),n=Yb(e,t),r=Yb(e.reverse(),t);return[n,r]}function xj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Yb(t,e){for(const n of t)if(!C5(n,{upTo:e}))return n}function C5(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 E5(t){return t instanceof HTMLInputElement&&"select"in t}function Yi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&E5(t)&&e&&t.select()}}var Qb=T5();function T5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Xb(t,e),t.unshift(e)},remove(e){var n;t=Xb(t,e),(n=t[0])==null||n.resume()}}}function Xb(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function M5(t){return t.filter(e=>e.tagName!=="A")}var A5="Portal",$x=v.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,a]=v.useState(!1);Zn(()=>a(!0),[]);const o=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?MN.createPortal(s.jsx(dt.div,{...r,ref:e}),o):null});$x.displayName=A5;function I5(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var ud=t=>{const{present:e,children:n}=t,r=R5(e),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),a=St(r.ref,P5(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:a}):null};ud.displayName="Presence";function R5(t){const[e,n]=v.useState(),r=v.useRef(null),i=v.useRef(t),a=v.useRef("none"),o=t?"mounted":"unmounted",[c,u]=I5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const h=ku(r.current);a.current=c==="mounted"?h:"none"},[c]),Zn(()=>{const h=r.current,f=i.current;if(f!==t){const g=a.current,y=ku(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,u]),Zn(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const N=ku(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&N&&(u("ANIMATION_END"),!i.current)){const b=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},g=y=>{y.target===e&&(a.current=ku(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:v.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function ku(t){return(t==null?void 0:t.animationName)||"none"}function P5(t){var r,i;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=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Tm=0;function yj(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Zb()),document.body.insertAdjacentElement("beforeend",t[1]??Zb()),Tm++,()=>{Tm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Tm--}},[])}function Zb(){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 Os=function(){return Os=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return Y5;var e=Q5(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])}},Z5=Nj(),vl="data-scroll-locked",eR=function(t,e,n,r){var i=t.left,a=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` + */const qA=[["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"}]],aa=Ce("zap",qA),Ox="admin_token";function Dx(){try{return localStorage.getItem(Ox)}catch{return null}}function GA(t){try{localStorage.setItem(Ox,t)}catch{}}function JA(){try{localStorage.removeItem(Ox)}catch{}}const YA="https://soulapi.quwanzhi.com",QA=15e3,$b=6e4,XA=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):YA};function fo(t){const e=XA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function uf(t,e={}){const{data:n,...r}=e,i=fo(t),a=new Headers(r.headers),o=Dx();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=r.timeout??QA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(i,{...r,headers:a,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),y=(m.headers.get("Content-Type")||"").includes("application/json")?await m.json():m,w=N=>{const b=N,k=((b==null?void 0:b.message)||(b==null?void 0:b.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){w(y);const N=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw N.status=m.status,N.data=y,N}return w(y),y}function Le(t,e){return uf(t,{...e,method:"GET"})}function yt(t,e,n){return uf(t,{...n,method:"POST",data:e})}function It(t,e,n){return uf(t,{...n,method:"PUT",data:e})}function Rs(t,e){return uf(t,{...e,method:"DELETE"})}function ZA(){const[t,e]=v.useState(!1),[n,r]=v.useState("");return v.useEffect(()=>{const i=a=>{const o=a.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",i),()=>window.removeEventListener("recharge-alert",i)},[]),t?s.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 bg-red-900/80 border-b border-red-600/50 text-red-100",role:"alert",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(HN,{className:"w-5 h-5 shrink-0 text-red-400"}),s.jsxs("span",{className:"text-sm font-medium",children:[n,s.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),s.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:s.jsx(er,{className:"w-4 h-4"})})]}):null}const eI=[{icon:zM,label:"数据概览",href:"/dashboard"},{icon:Xr,label:"内容管理",href:"/content"},{icon:qn,label:"用户管理",href:"/users"},{icon:mM,label:"找伙伴",href:"/find-partner"},{icon:wl,label:"推广中心",href:"/distribution"}];function tI(){const t=ja(),e=ka(),[n,r]=v.useState(!1),[i,a]=v.useState(!1);v.useEffect(()=>{r(!0)},[]),v.useEffect(()=>{if(!n)return;a(!1);let c=!1;return Le("/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()=>{JA();try{await yt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!i?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[eI.map(c=>{const u=t.pathname===c.href;return s.jsxs(wg,{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:[s.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(wg,{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:[s.jsx(io,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.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:[s.jsx(GM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(ZA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(fT,{})})]})]})}function Fb(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Lx(...t){return e=>{let n=!1;const r=t.map(i=>{const a=Fb(i,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i{let{children:a,...o}=r;XN(a)&&typeof ch=="function"&&(a=ch(a._payload));const c=v.Children.toArray(a),u=c.find(aI);if(u){const h=u.props.children,f=c.map(m=>m===u?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:i,children:v.isValidElement(h)?v.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}var ej=ZN("Slot");function sI(t){const e=v.forwardRef((n,r)=>{let{children:i,...a}=n;if(XN(i)&&typeof ch=="function"&&(i=ch(i._payload)),v.isValidElement(i)){const o=lI(i),c=oI(a,i.props);return i.type!==v.Fragment&&(c.ref=r?Lx(r,o):o),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iI=Symbol("radix.slottable");function aI(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iI}function oI(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...c)=>{const u=a(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function lI(t){var r,i;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=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function tj(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Vb=nj,rj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Vb(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:a}=e,o=Object.keys(i).map(h=>{const f=n==null?void 0:n[h],m=a==null?void 0:a[h];if(f===null)return null;const g=Bb(f)||Bb(m);return i[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(w=>{let[N,b]=w;return Array.isArray(b)?b.includes({...a,...c}[N]):{...a,...c}[N]===b})?[...h,m,g]:h},[]);return Vb(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},cI=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),sj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),dh="-",Hb=[],uI="arbitrary..",hI=t=>{const e=pI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return fI(o);const c=o.split(dh),u=c[0]===""&&c.length>1?1:0;return ij(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?cI(h,u):u:h||Hb}return n[o]||Hb}}},ij=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],a=n.nextPart.get(i);if(a){const h=ij(t,e+1,a);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(dh):t.slice(e).join(dh),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?uI+r:void 0})(),pI=t=>{const{theme:e,classGroups:n}=t;return mI(n,e)},mI=(t,e)=>{const n=sj();for(const r in t){const i=t[r];_x(i,n,r,e)}return n},_x=(t,e,n,r)=>{const i=t.length;for(let a=0;a{if(typeof t=="string"){xI(t,e,n);return}if(typeof t=="function"){yI(t,e,n,r);return}vI(t,e,n,r)},xI=(t,e,n)=>{const r=t===""?e:aj(e,t);r.classGroupId=n},yI=(t,e,n,r)=>{if(bI(t)){_x(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(dI(n,t))},vI=(t,e,n,r)=>{const i=Object.entries(t),a=i.length;for(let o=0;o{let n=t;const r=e.split(dh),i=r.length;for(let a=0;a"isThemeGetter"in t&&t.isThemeGetter===!0,wI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(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 i(a,o),o},set(a,o){a in n?n[a]=o:i(a,o)}}},Mg="!",Wb=":",NI=[],Ub=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),jI=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const a=[];let o=0,c=0,u=0,h;const f=i.length;for(let N=0;Nu?h-u:void 0;return Ub(a,y,g,w)};if(e){const i=e+Wb,a=r;r=o=>o.startsWith(i)?a(o.slice(i.length)):Ub(NI,!1,o,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},kI=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},SI=t=>({cache:wI(t.cacheSize),parseClassName:jI(t),sortModifiers:kI(t),...hI(t)}),CI=/\s+/,EI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=e,o=[],c=t.trim().split(CI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:N}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let b=!!N,k=r(b?w.substring(0,N):w);if(!k){if(!b){u=f+(u.length>0?" "+u:u);continue}if(k=r(w),!k){u=f+(u.length>0?" "+u:u);continue}b=!1}const C=g.length===0?"":g.length===1?g[0]:a(g).join(":"),E=y?C+Mg:C,T=E+k;if(o.indexOf(T)>-1)continue;o.push(T);const I=i(k,b);for(let O=0;O0?" "+u:u)}return u},TI=(...t)=>{let e=0,n,r,i="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,i,a;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=SI(h),r=n.cache.get,i=n.cache.set,a=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=EI(u,n);return i(u,f),f};return a=o,(...u)=>a(TI(...u))},AI=[],Tn=t=>{const e=n=>n[t]||AI;return e.isThemeGetter=!0,e},lj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,II=/^\d+\/\d+$/,RI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PI=/\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$/,OI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,el=t=>II.test(t),ut=t=>!!t&&!Number.isNaN(Number(t)),Gi=t=>!!t&&Number.isInteger(Number(t)),km=t=>t.endsWith("%")&&ut(t.slice(0,-1)),ai=t=>RI.test(t),_I=()=>!0,zI=t=>PI.test(t)&&!OI.test(t),dj=()=>!1,$I=t=>DI.test(t),FI=t=>LI.test(t),BI=t=>!ze(t)&&!$e(t),VI=t=>Rl(t,fj,dj),ze=t=>lj.test(t),Ya=t=>Rl(t,pj,zI),Sm=t=>Rl(t,qI,ut),Kb=t=>Rl(t,uj,dj),HI=t=>Rl(t,hj,FI),ju=t=>Rl(t,mj,$I),$e=t=>cj.test(t),jc=t=>Pl(t,pj),WI=t=>Pl(t,GI),qb=t=>Pl(t,uj),UI=t=>Pl(t,fj),KI=t=>Pl(t,hj),ku=t=>Pl(t,mj,!0),Rl=(t,e,n)=>{const r=lj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Pl=(t,e,n=!1)=>{const r=cj.exec(t);return r?r[1]?e(r[1]):n:!1},uj=t=>t==="position"||t==="percentage",hj=t=>t==="image"||t==="url",fj=t=>t==="length"||t==="size"||t==="bg-size",pj=t=>t==="length",qI=t=>t==="number",GI=t=>t==="family-name",mj=t=>t==="shadow",JI=()=>{const t=Tn("color"),e=Tn("font"),n=Tn("text"),r=Tn("font-weight"),i=Tn("tracking"),a=Tn("leading"),o=Tn("breakpoint"),c=Tn("container"),u=Tn("spacing"),h=Tn("radius"),f=Tn("shadow"),m=Tn("inset-shadow"),g=Tn("text-shadow"),y=Tn("drop-shadow"),w=Tn("blur"),N=Tn("perspective"),b=Tn("aspect"),k=Tn("ease"),C=Tn("animate"),E=()=>["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"],I=()=>[...T(),$e,ze],O=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],P=()=>[$e,ze,u],L=()=>[el,"full","auto",...P()],_=()=>[Gi,"none","subgrid",$e,ze],J=()=>["auto",{span:["full",Gi,$e,ze]},Gi,$e,ze],ee=()=>[Gi,"auto",$e,ze],Y=()=>["auto","min","max","fr",$e,ze],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...P()],re=()=>[el,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],z=()=>[t,$e,ze],ie=()=>[...T(),qb,Kb,{position:[$e,ze]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",UI,VI,{size:[$e,ze]}],V=()=>[km,jc,Ya],ce=()=>["","none","full",h,$e,ze],W=()=>["",ut,jc,Ya],fe=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[ut,km,qb,Kb],he=()=>["","none",w,$e,ze],be=()=>["none",ut,$e,ze],Te=()=>["none",ut,$e,ze],Ve=()=>[ut,$e,ze],He=()=>[el,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ai],breakpoint:[ai],color:[_I],container:[ai],"drop-shadow":[ai],ease:["in","out","in-out"],font:[BI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ai],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ai],shadow:[ai],spacing:["px",ut],text:[ai],"text-shadow":[ai],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",el,ze,$e,b]}],container:["container"],columns:[{columns:[ut,ze,$e,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:I()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Gi,"auto",$e,ze]}],basis:[{basis:[el,"full","auto",c,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,el,"auto","initial","none",ze]}],grow:[{grow:["",ut,$e,ze]}],shrink:[{shrink:["",ut,$e,ze]}],order:[{order:[Gi,"first","last","none",$e,ze]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"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:[...U(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],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:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:re()}],w:[{w:[c,"screen",...re()]}],"min-w":[{"min-w":[c,"screen","none",...re()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...re()]}],h:[{h:["screen","lh",...re()]}],"min-h":[{"min-h":["screen","lh","none",...re()]}],"max-h":[{"max-h":["screen","lh",...re()]}],"font-size":[{text:["base",n,jc,Ya]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,$e,Sm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",km,ze]}],"font-family":[{font:[WI,ze,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:[i,$e,ze]}],"line-clamp":[{"line-clamp":[ut,"none",$e,Sm]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",$e,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",$e,Ya]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[ut,"auto",$e,ze]}],"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,ze]}],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,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gi,$e,ze],radial:["",$e,ze],conic:[Gi,$e,ze]},KI,HI]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,$e,ze]}],"outline-w":[{outline:["",ut,jc,Ya]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,ku,ju]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",m,ku,ju]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[ut,Ya]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",g,ku,ju]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[ut,$e,ze]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[$e,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"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":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,ze]}],filter:[{filter:["","none",$e,ze]}],blur:[{blur:he()}],brightness:[{brightness:[ut,$e,ze]}],contrast:[{contrast:[ut,$e,ze]}],"drop-shadow":[{"drop-shadow":["","none",y,ku,ju]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",ut,$e,ze]}],"hue-rotate":[{"hue-rotate":[ut,$e,ze]}],invert:[{invert:["",ut,$e,ze]}],saturate:[{saturate:[ut,$e,ze]}],sepia:[{sepia:["",ut,$e,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,ze]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[ut,$e,ze]}],"backdrop-contrast":[{"backdrop-contrast":[ut,$e,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,$e,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,$e,ze]}],"backdrop-invert":[{"backdrop-invert":["",ut,$e,ze]}],"backdrop-opacity":[{"backdrop-opacity":[ut,$e,ze]}],"backdrop-saturate":[{"backdrop-saturate":[ut,$e,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,$e,ze]}],"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,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",$e,ze]}],ease:[{ease:["linear","initial",k,$e,ze]}],delay:[{delay:[ut,$e,ze]}],animate:[{animate:["none",C,$e,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,$e,ze]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Ve()}],"skew-x":[{"skew-x":Ve()}],"skew-y":[{"skew-y":Ve()}],transform:[{transform:[$e,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:He()}],"translate-x":[{"translate-x":He()}],"translate-y":[{"translate-y":He()}],"translate-z":[{"translate-z":He()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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,ze]}],"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,ze]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[ut,jc,Ya,Sm]}],stroke:[{stroke:["none",...z()]}],"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"]}},YI=MI(JI);function Mt(...t){return YI(nj(t))}const QI=rj("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 te({className:t,variant:e,size:n,asChild:r=!1,...i}){const a=r?ej:"button";return s.jsx(a,{"data-slot":"button",className:Mt(QI({variant:e,size:n,className:t})),...i})}function oe({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Mt("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 XI(){const t=ka(),[e,n]=v.useState(""),[r,i]=v.useState(""),[a,o]=v.useState(""),[c,u]=v.useState(!1),h=async()=>{o(""),u(!0);try{const f=await yt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){GA(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 s.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),s.jsxs("div",{className:"w-full max-w-md relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.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:s.jsx(Px,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(gl,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(oe,{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]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(KM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(oe,{type:"password",value:r,onChange:f=>i(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&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:a}),s.jsx(te,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Me=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Mt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Me.displayName="Card";const rt=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Mt("flex flex-col space-y-1.5 p-6",t),...e}));rt.displayName="CardHeader";const st=v.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Mt("font-semibold leading-none tracking-tight",t),...e}));st.displayName="CardTitle";const Vt=v.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Mt("text-sm text-muted-foreground",t),...e}));Vt.displayName="CardDescription";const Ae=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Mt("p-6 pt-0",t),...e}));Ae.displayName="CardContent";const ZI=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Mt("flex items-center p-6 pt-0",t),...e}));ZI.displayName="CardFooter";const e5={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Cm(t,e="info",n=3e3){const r=`toast-${Date.now()}`,i=e5[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:i.bg,border:`1.5px solid ${i.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:i.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=i.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 ae={success:(t,e)=>Cm(t,"success",e),error:(t,e)=>Cm(t,"error",e),info:(t,e)=>Cm(t,"info",e)};function ot(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function t5(t,e){const n=v.createContext(e),r=a=>{const{children:o,...c}=a,u=v.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function i(a){const o=v.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,i]}function Sa(t,e=[]){let n=[];function r(a,o){const c=v.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...w}=m,N=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,b=v.useMemo(()=>w,Object.values(w));return s.jsx(N.Provider,{value:b,children:y})};h.displayName=a+"Provider";function f(m,g){var N;const y=((N=g==null?void 0:g[t])==null?void 0:N[u])||c,w=v.useContext(y);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,f]}const i=()=>{const a=n.map(o=>v.createContext(o));return function(c){const u=(c==null?void 0:c[t])||a;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return i.scopeName=t,[r,n5(i,...e)]}function n5(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(a)[`__scope${h}`];return{...c,...m}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var tr=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},r5=lf[" useId ".trim().toString()]||(()=>{}),s5=0;function ha(t){const[e,n]=v.useState(r5());return tr(()=>{n(r=>r??String(s5++))},[t]),e?`radix-${e}`:""}var i5=lf[" useInsertionEffect ".trim().toString()]||tr;function po({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,a,o]=a5({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:i;{const f=v.useRef(t!==void 0);v.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=v.useCallback(f=>{var m;if(c){const g=o5(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 a5({defaultProp:t,onChange:e}){const[n,r]=v.useState(t),i=v.useRef(n),a=v.useRef(e);return i5(()=>{a.current=e},[e]),v.useEffect(()=>{var o;i.current!==n&&((o=a.current)==null||o.call(a,n),i.current=n)},[n,i]),[n,r,a]}function o5(t){return typeof t=="function"}function Yc(t){const e=l5(t),n=v.forwardRef((r,i)=>{const{children:a,...o}=r,c=v.Children.toArray(a),u=c.find(d5);if(u){const h=u.props.children,f=c.map(m=>m===u?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:i,children:v.isValidElement(h)?v.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}function l5(t){const e=v.forwardRef((n,r)=>{const{children:i,...a}=n;if(v.isValidElement(i)){const o=h5(i),c=u5(a,i.props);return i.type!==v.Fragment&&(c.ref=r?Lx(r,o):o),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var c5=Symbol("radix.slottable");function d5(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===c5}function u5(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...c)=>{const u=a(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function h5(t){var r,i;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=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var f5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=f5.reduce((t,e)=>{const n=Yc(`Primitive.${e}`),r=v.forwardRef((i,a)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function p5(t,e){t&&ud.flushSync(()=>t.dispatchEvent(e))}function xa(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function m5(t,e=globalThis==null?void 0:globalThis.document){const n=xa(t);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var g5="DismissableLayer",Ag="dismissableLayer.update",x5="dismissableLayer.pointerDownOutside",y5="dismissableLayer.focusOutside",Gb,gj=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zx=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,h=v.useContext(gj),[f,m]=v.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),w=Tt(e,D=>m(D)),N=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=N.indexOf(b),C=f?N.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,T=C>=k,I=w5(D=>{const P=D.target,L=[...h.branches].some(_=>_.contains(P));!T||L||(i==null||i(D),o==null||o(D),D.defaultPrevented||c==null||c())},g),O=N5(D=>{const P=D.target;[...h.branches].some(_=>_.contains(P))||(a==null||a(D),o==null||o(D),D.defaultPrevented||c==null||c())},g);return m5(D=>{C===h.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},g),v.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Gb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Jb(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Gb)}},[f,g,n,h]),v.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Jb())},[f,h]),v.useEffect(()=>{const D=()=>y({});return document.addEventListener(Ag,D),()=>document.removeEventListener(Ag,D)},[]),s.jsx(ht.div,{...u,ref:w,style:{pointerEvents:E?T?"auto":"none":void 0,...t.style},onFocusCapture:ot(t.onFocusCapture,O.onFocusCapture),onBlurCapture:ot(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ot(t.onPointerDownCapture,I.onPointerDownCapture)})});zx.displayName=g5;var v5="DismissableLayerBranch",b5=v.forwardRef((t,e)=>{const n=v.useContext(gj),r=v.useRef(null),i=Tt(e,r);return v.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(ht.div,{...t,ref:i})});b5.displayName=v5;function w5(t,e=globalThis==null?void 0:globalThis.document){const n=xa(t),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const a=c=>{if(c.target&&!r.current){let u=function(){xj(x5,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function N5(t,e=globalThis==null?void 0:globalThis.document){const n=xa(t),r=v.useRef(!1);return v.useEffect(()=>{const i=a=>{a.target&&!r.current&&xj(y5,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Jb(){const t=new CustomEvent(Ag);document.dispatchEvent(t)}function xj(t,e,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?p5(i,a):i.dispatchEvent(a)}var Em="focusScope.autoFocusOnMount",Tm="focusScope.autoFocusOnUnmount",Yb={bubbles:!1,cancelable:!0},j5="FocusScope",$x=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=t,[c,u]=v.useState(null),h=xa(i),f=xa(a),m=v.useRef(null),g=Tt(e,N=>u(N)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let N=function(E){if(y.paused||!c)return;const T=E.target;c.contains(T)?m.current=T:Qi(m.current,{select:!0})},b=function(E){if(y.paused||!c)return;const T=E.relatedTarget;T!==null&&(c.contains(T)||Qi(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const I of E)I.removedNodes.length>0&&Qi(c)};document.addEventListener("focusin",N),document.addEventListener("focusout",b);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",b),C.disconnect()}}},[r,c,y.paused]),v.useEffect(()=>{if(c){Xb.add(y);const N=document.activeElement;if(!c.contains(N)){const k=new CustomEvent(Em,Yb);c.addEventListener(Em,h),c.dispatchEvent(k),k.defaultPrevented||(k5(M5(yj(c)),{select:!0}),document.activeElement===N&&Qi(c))}return()=>{c.removeEventListener(Em,h),setTimeout(()=>{const k=new CustomEvent(Tm,Yb);c.addEventListener(Tm,f),c.dispatchEvent(k),k.defaultPrevented||Qi(N??document.body,{select:!0}),c.removeEventListener(Tm,f),Xb.remove(y)},0)}}},[c,h,f,y]);const w=v.useCallback(N=>{if(!n&&!r||y.paused)return;const b=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,k=document.activeElement;if(b&&k){const C=N.currentTarget,[E,T]=S5(C);E&&T?!N.shiftKey&&k===T?(N.preventDefault(),n&&Qi(E,{select:!0})):N.shiftKey&&k===E&&(N.preventDefault(),n&&Qi(T,{select:!0})):k===C&&N.preventDefault()}},[n,r,y.paused]);return s.jsx(ht.div,{tabIndex:-1,...o,ref:g,onKeyDown:w})});$x.displayName=j5;function k5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Qi(r,{select:e}),document.activeElement!==n)return}function S5(t){const e=yj(t),n=Qb(e,t),r=Qb(e.reverse(),t);return[n,r]}function yj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Qb(t,e){for(const n of t)if(!C5(n,{upTo:e}))return n}function C5(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 E5(t){return t instanceof HTMLInputElement&&"select"in t}function Qi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&E5(t)&&e&&t.select()}}var Xb=T5();function T5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Zb(t,e),t.unshift(e)},remove(e){var n;t=Zb(t,e),(n=t[0])==null||n.resume()}}}function Zb(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function M5(t){return t.filter(e=>e.tagName!=="A")}var A5="Portal",Fx=v.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,a]=v.useState(!1);tr(()=>a(!0),[]);const o=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?AN.createPortal(s.jsx(ht.div,{...r,ref:e}),o):null});Fx.displayName=A5;function I5(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var hd=t=>{const{present:e,children:n}=t,r=R5(e),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),a=Tt(r.ref,P5(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:a}):null};hd.displayName="Presence";function R5(t){const[e,n]=v.useState(),r=v.useRef(null),i=v.useRef(t),a=v.useRef("none"),o=t?"mounted":"unmounted",[c,u]=I5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const h=Su(r.current);a.current=c==="mounted"?h:"none"},[c]),tr(()=>{const h=r.current,f=i.current;if(f!==t){const g=a.current,y=Su(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,u]),tr(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const N=Su(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&N&&(u("ANIMATION_END"),!i.current)){const b=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},g=y=>{y.target===e&&(a.current=Su(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:v.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Su(t){return(t==null?void 0:t.animationName)||"none"}function P5(t){var r,i;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=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Mm=0;function vj(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??e1()),document.body.insertAdjacentElement("beforeend",t[1]??e1()),Mm++,()=>{Mm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Mm--}},[])}function e1(){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 Ps=function(){return Ps=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return Y5;var e=Q5(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])}},Z5=jj(),xl="data-scroll-locked",eR=function(t,e,n,r){var i=t.left,a=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` .`.concat(D5,` { overflow: hidden `).concat(r,`; padding-right: `).concat(c,"px ").concat(r,`; } - body[`).concat(vl,`] { + body[`).concat(xl,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` @@ -552,42 +552,42 @@ Error generating stack: `+S.message+` `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` } - .`).concat(Gu,` { + .`).concat(Ju,` { right: `).concat(c,"px ").concat(r,`; } - .`).concat(Ju,` { + .`).concat(Yu,` { margin-right: `).concat(c,"px ").concat(r,`; } - .`).concat(Gu," .").concat(Gu,` { + .`).concat(Ju," .").concat(Ju,` { right: 0 `).concat(r,`; } - .`).concat(Ju," .").concat(Ju,` { + .`).concat(Yu," .").concat(Yu,` { margin-right: 0 `).concat(r,`; } - body[`).concat(vl,`] { + body[`).concat(xl,`] { `).concat(L5,": ").concat(c,`px; } -`)},t1=function(){var t=parseInt(document.body.getAttribute(vl)||"0",10);return isFinite(t)?t:0},tR=function(){v.useEffect(function(){return document.body.setAttribute(vl,(t1()+1).toString()),function(){var t=t1()-1;t<=0?document.body.removeAttribute(vl):document.body.setAttribute(vl,t.toString())}},[])},nR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;tR();var a=v.useMemo(function(){return X5(i)},[i]);return v.createElement(Z5,{styles:eR(a,!e,i,n?"":"!important")})},Ag=!1;if(typeof window<"u")try{var Su=Object.defineProperty({},"passive",{get:function(){return Ag=!0,!0}});window.addEventListener("test",Su,Su),window.removeEventListener("test",Su,Su)}catch{Ag=!1}var rl=Ag?{passive:!1}:!1,rR=function(t){return t.tagName==="TEXTAREA"},jj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!rR(t)&&n[e]==="visible")},sR=function(t){return jj(t,"overflowY")},iR=function(t){return jj(t,"overflowX")},n1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=kj(t,r);if(i){var a=Sj(t,r),o=a[1],c=a[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},aR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},oR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},kj=function(t,e){return t==="v"?sR(e):iR(e)},Sj=function(t,e){return t==="v"?aR(e):oR(e)},lR=function(t,e){return t==="h"&&e==="rtl"?-1:1},cR=function(t,e,n,r,i){var a=lR(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=Sj(t,c),w=y[0],N=y[1],b=y[2],k=N-b-a*w;(w||k)&&kj(t,c)&&(m+=k,g+=w);var C=c.parentNode;c=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}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},Cu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},r1=function(t){return[t.deltaX,t.deltaY]},s1=function(t){return t&&"current"in t?t.current:t},dR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},uR=function(t){return` +`)},n1=function(){var t=parseInt(document.body.getAttribute(xl)||"0",10);return isFinite(t)?t:0},tR=function(){v.useEffect(function(){return document.body.setAttribute(xl,(n1()+1).toString()),function(){var t=n1()-1;t<=0?document.body.removeAttribute(xl):document.body.setAttribute(xl,t.toString())}},[])},nR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;tR();var a=v.useMemo(function(){return X5(i)},[i]);return v.createElement(Z5,{styles:eR(a,!e,i,n?"":"!important")})},Ig=!1;if(typeof window<"u")try{var Cu=Object.defineProperty({},"passive",{get:function(){return Ig=!0,!0}});window.addEventListener("test",Cu,Cu),window.removeEventListener("test",Cu,Cu)}catch{Ig=!1}var tl=Ig?{passive:!1}:!1,rR=function(t){return t.tagName==="TEXTAREA"},kj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!rR(t)&&n[e]==="visible")},sR=function(t){return kj(t,"overflowY")},iR=function(t){return kj(t,"overflowX")},r1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Sj(t,r);if(i){var a=Cj(t,r),o=a[1],c=a[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},aR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},oR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Sj=function(t,e){return t==="v"?sR(e):iR(e)},Cj=function(t,e){return t==="v"?aR(e):oR(e)},lR=function(t,e){return t==="h"&&e==="rtl"?-1:1},cR=function(t,e,n,r,i){var a=lR(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=Cj(t,c),w=y[0],N=y[1],b=y[2],k=N-b-a*w;(w||k)&&Sj(t,c)&&(m+=k,g+=w);var C=c.parentNode;c=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}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},Eu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},s1=function(t){return[t.deltaX,t.deltaY]},i1=function(t){return t&&"current"in t?t.current:t},dR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},uR=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},hR=0,sl=[];function fR(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(hR++)[0],a=v.useState(Nj)[0],o=v.useRef(t);v.useEffect(function(){o.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var N=O5([t.lockRef.current],(t.shards||[]).map(s1),!0).filter(Boolean);return N.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),N.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=v.useCallback(function(N,b){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!o.current.allowPinchZoom;var k=Cu(N),C=n.current,E="deltaX"in N?N.deltaX:C[0]-k[0],T="deltaY"in N?N.deltaY:C[1]-k[1],I,O=N.target,D=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in N&&D==="h"&&O.type==="range")return!1;var P=window.getSelection(),L=P&&P.anchorNode,_=L?L===O||L.contains(O):!1;if(_)return!1;var J=n1(D,O);if(!J)return!0;if(J?I=D:(I=D==="v"?"h":"v",J=n1(D,O)),!J)return!1;if(!r.current&&"changedTouches"in N&&(E||T)&&(r.current=I),!I)return!0;var ee=r.current||I;return cR(ee,b,N,ee==="h"?E:T)},[]),u=v.useCallback(function(N){var b=N;if(!(!sl.length||sl[sl.length-1]!==a)){var k="deltaY"in b?r1(b):Cu(b),C=e.current.filter(function(I){return I.name===b.type&&(I.target===b.target||b.target===I.shadowParent)&&dR(I.delta,k)})[0];if(C&&C.should){b.cancelable&&b.preventDefault();return}if(!C){var E=(o.current.shards||[]).map(s1).filter(Boolean).filter(function(I){return I.contains(b.target)}),T=E.length>0?c(b,E[0]):!o.current.noIsolation;T&&b.cancelable&&b.preventDefault()}}},[]),h=v.useCallback(function(N,b,k,C){var E={name:N,delta:b,target:k,should:C,shadowParent:pR(k)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(T){return T!==E})},1)},[]),f=v.useCallback(function(N){n.current=Cu(N),r.current=void 0},[]),m=v.useCallback(function(N){h(N.type,r1(N),N.target,c(N,t.lockRef.current))},[]),g=v.useCallback(function(N){h(N.type,Cu(N),N.target,c(N,t.lockRef.current))},[]);v.useEffect(function(){return sl.push(a),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,rl),document.addEventListener("touchmove",u,rl),document.addEventListener("touchstart",f,rl),function(){sl=sl.filter(function(N){return N!==a}),document.removeEventListener("wheel",u,rl),document.removeEventListener("touchmove",u,rl),document.removeEventListener("touchstart",f,rl)}},[]);var y=t.removeScrollBar,w=t.inert;return v.createElement(v.Fragment,null,w?v.createElement(a,{styles:uR(i)}):null,y?v.createElement(nR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function pR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const mR=H5(wj,fR);var Fx=v.forwardRef(function(t,e){return v.createElement(uf,Os({},t,{ref:e,sideCar:mR}))});Fx.classNames=uf.classNames;var gR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},il=new WeakMap,Eu=new WeakMap,Tu={},Rm=0,Cj=function(t){return t&&(t.host||Cj(t.parentNode))},xR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Cj(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})},yR=function(t,e,n,r){var i=xR(e,Array.isArray(t)?t:[t]);Tu[n]||(Tu[n]=new WeakMap);var a=Tu[n],o=[],c=new Set,u=new Set(i),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};i.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),w=y!==null&&y!=="false",N=(il.get(g)||0)+1,b=(a.get(g)||0)+1;il.set(g,N),a.set(g,b),o.push(g),N===1&&w&&Eu.set(g,!0),b===1&&g.setAttribute(n,"true"),w||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Rm++,function(){o.forEach(function(m){var g=il.get(m)-1,y=a.get(m)-1;il.set(m,g),a.set(m,y),g||(Eu.has(m)||m.removeAttribute(r),Eu.delete(m)),y||m.removeAttribute(n)}),Rm--,Rm||(il=new WeakMap,il=new WeakMap,Eu=new WeakMap,Tu={})}},Ej=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=gR(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),yR(r,i,n,"aria-hidden")):function(){return null}},hf="Dialog",[Tj]=ka(hf),[vR,bs]=Tj(hf),Mj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=t,c=v.useRef(null),u=v.useRef(null),[h,f]=fo({prop:r,defaultProp:i??!1,onChange:a,caller:hf});return s.jsx(vR,{scope:e,triggerRef:c,contentRef:u,contentId:ua(),titleId:ua(),descriptionId:ua(),open:h,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Mj.displayName=hf;var Aj="DialogTrigger",bR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs(Aj,n),a=St(e,i.triggerRef);return s.jsx(dt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Hx(i.open),...r,ref:a,onClick:at(t.onClick,i.onOpenToggle)})});bR.displayName=Aj;var Bx="DialogPortal",[wR,Ij]=Tj(Bx,{forceMount:void 0}),Rj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,a=bs(Bx,e);return s.jsx(wR,{scope:e,forceMount:n,children:v.Children.map(r,o=>s.jsx(ud,{present:n||a.open,children:s.jsx($x,{asChild:!0,container:i,children:o})}))})};Rj.displayName=Bx;var dh="DialogOverlay",Pj=v.forwardRef((t,e)=>{const n=Ij(dh,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=bs(dh,t.__scopeDialog);return a.modal?s.jsx(ud,{present:r||a.open,children:s.jsx(jR,{...i,ref:e})}):null});Pj.displayName=dh;var NR=Jc("DialogOverlay.RemoveScroll"),jR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs(dh,n);return s.jsx(Fx,{as:NR,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(dt.div,{"data-state":Hx(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),po="DialogContent",Oj=v.forwardRef((t,e)=>{const n=Ij(po,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=bs(po,t.__scopeDialog);return s.jsx(ud,{present:r||a.open,children:a.modal?s.jsx(kR,{...i,ref:e}):s.jsx(SR,{...i,ref:e})})});Oj.displayName=po;var kR=v.forwardRef((t,e)=>{const n=bs(po,t.__scopeDialog),r=v.useRef(null),i=St(e,n.contentRef,r);return v.useEffect(()=>{const a=r.current;if(a)return Ej(a)},[]),s.jsx(Dj,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:at(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:at(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&a.preventDefault()}),onFocusOutside:at(t.onFocusOutside,a=>a.preventDefault())})}),SR=v.forwardRef((t,e)=>{const n=bs(po,t.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return s.jsx(Dj,{...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,i.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"&&(i.current=!0));const o=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),Dj=v.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=t,c=bs(po,n),u=v.useRef(null),h=St(e,u);return yj(),s.jsxs(s.Fragment,{children:[s.jsx(zx,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:s.jsx(_x,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Hx(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(CR,{titleId:c.titleId}),s.jsx(TR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Vx="DialogTitle",Lj=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs(Vx,n);return s.jsx(dt.h2,{id:i.titleId,...r,ref:e})});Lj.displayName=Vx;var _j="DialogDescription",zj=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs(_j,n);return s.jsx(dt.p,{id:i.descriptionId,...r,ref:e})});zj.displayName=_j;var $j="DialogClose",Fj=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs($j,n);return s.jsx(dt.button,{type:"button",...r,ref:e,onClick:at(t.onClick,()=>i.onOpenChange(!1))})});Fj.displayName=$j;function Hx(t){return t?"open":"closed"}var Bj="DialogTitleWarning",[HV,Vj]=t5(Bj,{contentName:po,titleName:Vx,docsSlug:"dialog"}),CR=({titleId:t})=>{const e=Vj(Bj),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. +`)},hR=0,nl=[];function fR(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(hR++)[0],a=v.useState(jj)[0],o=v.useRef(t);v.useEffect(function(){o.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var N=O5([t.lockRef.current],(t.shards||[]).map(i1),!0).filter(Boolean);return N.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),N.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=v.useCallback(function(N,b){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!o.current.allowPinchZoom;var k=Eu(N),C=n.current,E="deltaX"in N?N.deltaX:C[0]-k[0],T="deltaY"in N?N.deltaY:C[1]-k[1],I,O=N.target,D=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in N&&D==="h"&&O.type==="range")return!1;var P=window.getSelection(),L=P&&P.anchorNode,_=L?L===O||L.contains(O):!1;if(_)return!1;var J=r1(D,O);if(!J)return!0;if(J?I=D:(I=D==="v"?"h":"v",J=r1(D,O)),!J)return!1;if(!r.current&&"changedTouches"in N&&(E||T)&&(r.current=I),!I)return!0;var ee=r.current||I;return cR(ee,b,N,ee==="h"?E:T)},[]),u=v.useCallback(function(N){var b=N;if(!(!nl.length||nl[nl.length-1]!==a)){var k="deltaY"in b?s1(b):Eu(b),C=e.current.filter(function(I){return I.name===b.type&&(I.target===b.target||b.target===I.shadowParent)&&dR(I.delta,k)})[0];if(C&&C.should){b.cancelable&&b.preventDefault();return}if(!C){var E=(o.current.shards||[]).map(i1).filter(Boolean).filter(function(I){return I.contains(b.target)}),T=E.length>0?c(b,E[0]):!o.current.noIsolation;T&&b.cancelable&&b.preventDefault()}}},[]),h=v.useCallback(function(N,b,k,C){var E={name:N,delta:b,target:k,should:C,shadowParent:pR(k)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(T){return T!==E})},1)},[]),f=v.useCallback(function(N){n.current=Eu(N),r.current=void 0},[]),m=v.useCallback(function(N){h(N.type,s1(N),N.target,c(N,t.lockRef.current))},[]),g=v.useCallback(function(N){h(N.type,Eu(N),N.target,c(N,t.lockRef.current))},[]);v.useEffect(function(){return nl.push(a),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,tl),document.addEventListener("touchmove",u,tl),document.addEventListener("touchstart",f,tl),function(){nl=nl.filter(function(N){return N!==a}),document.removeEventListener("wheel",u,tl),document.removeEventListener("touchmove",u,tl),document.removeEventListener("touchstart",f,tl)}},[]);var y=t.removeScrollBar,w=t.inert;return v.createElement(v.Fragment,null,w?v.createElement(a,{styles:uR(i)}):null,y?v.createElement(nR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function pR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const mR=H5(Nj,fR);var Bx=v.forwardRef(function(t,e){return v.createElement(hf,Ps({},t,{ref:e,sideCar:mR}))});Bx.classNames=hf.classNames;var gR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rl=new WeakMap,Tu=new WeakMap,Mu={},Pm=0,Ej=function(t){return t&&(t.host||Ej(t.parentNode))},xR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Ej(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})},yR=function(t,e,n,r){var i=xR(e,Array.isArray(t)?t:[t]);Mu[n]||(Mu[n]=new WeakMap);var a=Mu[n],o=[],c=new Set,u=new Set(i),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};i.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),w=y!==null&&y!=="false",N=(rl.get(g)||0)+1,b=(a.get(g)||0)+1;rl.set(g,N),a.set(g,b),o.push(g),N===1&&w&&Tu.set(g,!0),b===1&&g.setAttribute(n,"true"),w||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Pm++,function(){o.forEach(function(m){var g=rl.get(m)-1,y=a.get(m)-1;rl.set(m,g),a.set(m,y),g||(Tu.has(m)||m.removeAttribute(r),Tu.delete(m)),y||m.removeAttribute(n)}),Pm--,Pm||(rl=new WeakMap,rl=new WeakMap,Tu=new WeakMap,Mu={})}},Tj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=gR(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),yR(r,i,n,"aria-hidden")):function(){return null}},ff="Dialog",[Mj]=Sa(ff),[vR,Ns]=Mj(ff),Aj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=t,c=v.useRef(null),u=v.useRef(null),[h,f]=po({prop:r,defaultProp:i??!1,onChange:a,caller:ff});return s.jsx(vR,{scope:e,triggerRef:c,contentRef:u,contentId:ha(),titleId:ha(),descriptionId:ha(),open:h,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Aj.displayName=ff;var Ij="DialogTrigger",bR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(Ij,n),a=Tt(e,i.triggerRef);return s.jsx(ht.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Wx(i.open),...r,ref:a,onClick:ot(t.onClick,i.onOpenToggle)})});bR.displayName=Ij;var Vx="DialogPortal",[wR,Rj]=Mj(Vx,{forceMount:void 0}),Pj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,a=Ns(Vx,e);return s.jsx(wR,{scope:e,forceMount:n,children:v.Children.map(r,o=>s.jsx(hd,{present:n||a.open,children:s.jsx(Fx,{asChild:!0,container:i,children:o})}))})};Pj.displayName=Vx;var uh="DialogOverlay",Oj=v.forwardRef((t,e)=>{const n=Rj(uh,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=Ns(uh,t.__scopeDialog);return a.modal?s.jsx(hd,{present:r||a.open,children:s.jsx(jR,{...i,ref:e})}):null});Oj.displayName=uh;var NR=Yc("DialogOverlay.RemoveScroll"),jR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(uh,n);return s.jsx(Bx,{as:NR,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(ht.div,{"data-state":Wx(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),mo="DialogContent",Dj=v.forwardRef((t,e)=>{const n=Rj(mo,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=Ns(mo,t.__scopeDialog);return s.jsx(hd,{present:r||a.open,children:a.modal?s.jsx(kR,{...i,ref:e}):s.jsx(SR,{...i,ref:e})})});Dj.displayName=mo;var kR=v.forwardRef((t,e)=>{const n=Ns(mo,t.__scopeDialog),r=v.useRef(null),i=Tt(e,n.contentRef,r);return v.useEffect(()=>{const a=r.current;if(a)return Tj(a)},[]),s.jsx(Lj,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ot(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ot(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&a.preventDefault()}),onFocusOutside:ot(t.onFocusOutside,a=>a.preventDefault())})}),SR=v.forwardRef((t,e)=>{const n=Ns(mo,t.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return s.jsx(Lj,{...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,i.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"&&(i.current=!0));const o=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),Lj=v.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=t,c=Ns(mo,n),u=v.useRef(null),h=Tt(e,u);return vj(),s.jsxs(s.Fragment,{children:[s.jsx($x,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:s.jsx(zx,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Wx(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(CR,{titleId:c.titleId}),s.jsx(TR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Hx="DialogTitle",_j=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(Hx,n);return s.jsx(ht.h2,{id:i.titleId,...r,ref:e})});_j.displayName=Hx;var zj="DialogDescription",$j=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(zj,n);return s.jsx(ht.p,{id:i.descriptionId,...r,ref:e})});$j.displayName=zj;var Fj="DialogClose",Bj=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(Fj,n);return s.jsx(ht.button,{type:"button",...r,ref:e,onClick:ot(t.onClick,()=>i.onOpenChange(!1))})});Bj.displayName=Fj;function Wx(t){return t?"open":"closed"}var Vj="DialogTitleWarning",[HV,Hj]=t5(Vj,{contentName:mo,titleName:Hx,docsSlug:"dialog"}),CR=({titleId:t})=>{const e=Hj(Vj),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 v.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},ER="DialogDescriptionWarning",TR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vj(ER).contentName}}.`;return v.useEffect(()=>{var a;const i=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},MR=Mj,AR=Rj,IR=Pj,RR=Oj,PR=Lj,OR=zj,DR=Fj;function Kt(t){return s.jsx(MR,{"data-slot":"dialog",...t})}function LR(t){return s.jsx(AR,{...t})}const Hj=v.forwardRef(({className:t,...e},n)=>s.jsx(IR,{ref:n,className:Ct("fixed inset-0 z-50 bg-black/50",t),...e}));Hj.displayName="DialogOverlay";const zt=v.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},i)=>s.jsxs(LR,{children:[s.jsx(Hj,{}),s.jsxs(RR,{ref:i,"aria-describedby":void 0,className:Ct("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&&s.jsxs(DR,{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:[s.jsx(Xn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zt.displayName="DialogContent";function qt({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col gap-2 text-center sm:text-left",t),...e})}function hn({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Gt(t){return s.jsx(PR,{className:"text-lg font-semibold leading-none",...t})}function Wx(t){return s.jsx(OR,{className:"text-sm text-muted-foreground",...t})}const _R=nj("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 Ue({className:t,variant:e,asChild:n=!1,...r}){const i=n?ZN:"span";return s.jsx(i,{className:Ct(_R({variant:e}),t),...r})}var zR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$R=zR.reduce((t,e)=>{const n=XN(`Primitive.${e}`),r=v.forwardRef((i,a)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),FR="Label",Wj=v.forwardRef((t,e)=>s.jsx($R.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Wj.displayName=FR;var Uj=Wj;const Z=v.forwardRef(({className:t,...e},n)=>s.jsx(Uj,{ref:n,className:Ct("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Z.displayName=Uj.displayName;function Ux(t){const e=t+"CollectionProvider",[n,r]=ka(e),[i,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=N=>{const{scope:b,children:k}=N,C=hr.useRef(null),E=hr.useRef(new Map).current;return s.jsx(i,{scope:b,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Jc(c),h=hr.forwardRef((N,b)=>{const{scope:k,children:C}=N,E=a(c,k),T=St(b,E.collectionRef);return s.jsx(u,{ref:T,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Jc(f),y=hr.forwardRef((N,b)=>{const{scope:k,children:C,...E}=N,T=hr.useRef(null),I=St(b,T),O=a(f,k);return hr.useEffect(()=>(O.itemMap.set(T,{ref:T,...E}),()=>void O.itemMap.delete(T))),s.jsx(g,{[m]:"",ref:I,children:C})});y.displayName=f;function w(N){const b=a(t+"CollectionConsumer",N);return hr.useCallback(()=>{const C=b.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(b.itemMap.values()).sort((O,D)=>E.indexOf(O.ref.current)-E.indexOf(D.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},w,r]}var BR=v.createContext(void 0);function ff(t){const e=v.useContext(BR);return t||e||"ltr"}var Pm="rovingFocusGroup.onEntryFocus",VR={bubbles:!1,cancelable:!0},hd="RovingFocusGroup",[Ig,Kj,HR]=Ux(hd),[WR,qj]=ka(hd,[HR]),[UR,KR]=WR(hd),Gj=v.forwardRef((t,e)=>s.jsx(Ig.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Ig.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(qR,{...t,ref:e})})}));Gj.displayName=hd;var qR=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=v.useRef(null),y=St(e,g),w=ff(a),[N,b]=fo({prop:o,defaultProp:c??null,onChange:u,caller:hd}),[k,C]=v.useState(!1),E=ga(h),T=Kj(n),I=v.useRef(!1),[O,D]=v.useState(0);return v.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Pm,E),()=>P.removeEventListener(Pm,E)},[E]),s.jsx(UR,{scope:n,orientation:r,dir:w,loop:i,currentTabStopId:N,onItemFocus:v.useCallback(P=>b(P),[b]),onItemShiftTab:v.useCallback(()=>C(!0),[]),onFocusableItemAdd:v.useCallback(()=>D(P=>P+1),[]),onFocusableItemRemove:v.useCallback(()=>D(P=>P-1),[]),children:s.jsx(dt.div,{tabIndex:k||O===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:at(t.onMouseDown,()=>{I.current=!0}),onFocus:at(t.onFocus,P=>{const L=!I.current;if(P.target===P.currentTarget&&L&&!k){const _=new CustomEvent(Pm,VR);if(P.currentTarget.dispatchEvent(_),!_.defaultPrevented){const J=T().filter(F=>F.focusable),ee=J.find(F=>F.active),Y=J.find(F=>F.id===N),R=[ee,Y,...J].filter(Boolean).map(F=>F.ref.current);Qj(R,f)}}I.current=!1}),onBlur:at(t.onBlur,()=>C(!1))})})}),Jj="RovingFocusGroupItem",Yj=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...c}=t,u=ua(),h=a||u,f=KR(Jj,n),m=f.currentTabStopId===h,g=Kj(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:N}=f;return v.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),s.jsx(Ig.ItemSlot,{scope:n,id:h,focusable:r,active:i,children:s.jsx(dt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:at(t.onMouseDown,b=>{r?f.onItemFocus(h):b.preventDefault()}),onFocus:at(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:at(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){f.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const k=YR(b,f.orientation,f.dir);if(k!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const T=E.indexOf(b.currentTarget);E=f.loop?QR(E,T+1):E.slice(T+1)}setTimeout(()=>Qj(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:N!=null}):o})})});Yj.displayName=Jj;var GR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function YR(t,e,n){const r=JR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GR[r]}function Qj(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function QR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var XR=Gj,ZR=Yj,pf="Tabs",[eP]=ka(pf,[qj]),Xj=qj(),[tP,Kx]=eP(pf),Zj=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=ff(c),[m,g]=fo({prop:r,onChange:i,defaultProp:a??"",caller:pf});return s.jsx(tP,{scope:n,baseId:ua(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(dt.div,{dir:f,"data-orientation":o,...h,ref:e})})});Zj.displayName=pf;var ek="TabsList",tk=v.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,a=Kx(ek,n),o=Xj(n);return s.jsx(XR,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:s.jsx(dt.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:e})})});tk.displayName=ek;var nk="TabsTrigger",rk=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=t,o=Kx(nk,n),c=Xj(n),u=ak(o.baseId,r),h=ok(o.baseId,r),f=r===o.value;return s.jsx(ZR,{asChild:!0,...c,focusable:!i,active:f,children:s.jsx(dt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...a,ref:e,onMouseDown:at(t.onMouseDown,m=>{!i&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:at(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:at(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!i&&m&&o.onValueChange(r)})})})});rk.displayName=nk;var sk="TabsContent",ik=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=t,c=Kx(sk,n),u=ak(c.baseId,r),h=ok(c.baseId,r),f=r===c.value,m=v.useRef(f);return v.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(ud,{present:i||f,children:({present:g})=>s.jsx(dt.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})})});ik.displayName=sk;function ak(t,e){return`${t}-trigger-${e}`}function ok(t,e){return`${t}-content-${e}`}var nP=Zj,lk=tk,ck=rk,dk=ik;const fd=nP,Ll=v.forwardRef(({className:t,...e},n)=>s.jsx(lk,{ref:n,className:Ct("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Ll.displayName=lk.displayName;const tn=v.forwardRef(({className:t,...e},n)=>s.jsx(ck,{ref:n,className:Ct("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}));tn.displayName=ck.displayName;const nn=v.forwardRef(({className:t,...e},n)=>s.jsx(dk,{ref:n,className:Ct("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));nn.displayName=dk.displayName;function qx(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function Gx(t){const[e,n]=v.useState(void 0);return Zn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[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 mf="Switch",[rP]=ka(mf),[sP,iP]=rP(mf),uk=v.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=v.useState(null),w=St(e,E=>y(E)),N=v.useRef(!1),b=g?f||!!g.closest("form"):!0,[k,C]=fo({prop:i,defaultProp:a??!1,onChange:h,caller:mf});return s.jsxs(sP,{scope:n,checked:k,disabled:c,children:[s.jsx(dt.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":mk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:w,onClick:at(t.onClick,E=>{C(T=>!T),b&&(N.current=E.isPropagationStopped(),N.current||E.stopPropagation())})}),b&&s.jsx(pk,{control:g,bubbles:!N.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});uk.displayName=mf;var hk="SwitchThumb",fk=v.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=iP(hk,n);return s.jsx(dt.span,{"data-state":mk(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});fk.displayName=hk;var aP="SwitchBubbleInput",pk=v.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...i},a)=>{const o=v.useRef(null),c=St(o,a),u=qx(n),h=Gx(e);return v.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const w=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(w)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:c,style:{...i.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});pk.displayName=aP;function mk(t){return t?"checked":"unchecked"}var gk=uk,oP=fk;const Et=v.forwardRef(({className:t,...e},n)=>s.jsx(gk,{className:Ct("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:s.jsx(oP,{className:Ct("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")})}));Et.displayName=gk.displayName;function Jx({open:t,onClose:e,userId:n,onUserUpdated:r}){var ar;const[i,a]=v.useState(null),[o,c]=v.useState([]),[u,h]=v.useState([]),[f,m]=v.useState(!1),[g,y]=v.useState(!1),[w,N]=v.useState(!1),[b,k]=v.useState("info"),[C,E]=v.useState(""),[T,I]=v.useState(""),[O,D]=v.useState([]),[P,L]=v.useState(""),[_,J]=v.useState(""),[ee,Y]=v.useState(""),[U,R]=v.useState(!1),[F,re]=v.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[z,ie]=v.useState([]),[G,$]=v.useState(!1),[H,ce]=v.useState(!1),[W,fe]=v.useState(null),[X,de]=v.useState(null),[he,we]=v.useState(""),[Te,Ve]=v.useState(""),[He,gt]=v.useState(""),[Pt,yn]=v.useState(!1),[ht,At]=v.useState(null),[ne,Pe]=v.useState("");v.useEffect(()=>{t&&n&&(k("info"),fe(null),de(null),At(null),Pe(""),J(""),Y(""),Qe(),Le("/api/db/vip-roles").then(me=>{me!=null&&me.success&&me.data&&ie(me.data)}).catch(()=>{}))},[t,n]);async function Qe(){if(n){m(!0);try{const me=await Le(`/api/db/users?id=${encodeURIComponent(n)}`);if(me!=null&&me.success&&me.user){const ve=me.user;a(ve),E(ve.phone||""),I(ve.nickname||""),we(ve.phone||""),Ve(ve.wechatId||""),gt(ve.openId||"");try{D(typeof ve.tags=="string"?JSON.parse(ve.tags||"[]"):[])}catch{D([])}re({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 Le(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);ve!=null&&ve.success&&ve.tracks&&c(ve.tracks)}catch{c([])}try{const ve=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ve!=null&&ve.success&&ve.referrals&&h(ve.referrals)}catch{h([])}}catch(me){console.error("Load user detail error:",me)}finally{m(!1)}}}async function xt(){if(!(i!=null&&i.phone)){ae.info("用户未绑定手机号,无法同步");return}y(!0);try{const me=await wt("/api/ckb/sync",{action:"full_sync",phone:i.phone,userId:i.id});me!=null&&me.success?(ae.success("同步成功"),Qe()):ae.error("同步失败: "+(me==null?void 0:me.error))}catch(me){console.error("Sync CKB error:",me),ae.error("同步失败")}finally{y(!1)}}async function ft(){if(i){N(!0);try{const me={id:i.id,phone:C||void 0,nickname:T||void 0,tags:JSON.stringify(O)},ve=await Mt("/api/db/users",me);ve!=null&&ve.success?(ae.success("保存成功"),Qe(),r==null||r()):ae.error("保存失败: "+(ve==null?void 0:ve.error))}catch(me){console.error("Save user error:",me),ae.error("保存失败")}finally{N(!1)}}}const pt=()=>{P&&!O.includes(P)&&(D([...O,P]),L(""))},Nt=me=>D(O.filter(ve=>ve!==me));async function Xt(){if(i){if(!_){ae.error("请输入新密码");return}if(_!==ee){ae.error("两次密码不一致");return}if(_.length<6){ae.error("密码至少 6 位");return}R(!0);try{const me=await Mt("/api/db/users",{id:i.id,password:_});me!=null&&me.success?(ae.success("修改成功"),J(""),Y("")):ae.error("修改失败: "+((me==null?void 0:me.error)||""))}catch{ae.error("修改失败")}finally{R(!1)}}}async function Ot(){if(i){if(F.isVip&&!F.vipExpireDate.trim()){ae.error("开启 VIP 请填写有效到期日");return}$(!0);try{const me={id:i.id,isVip:F.isVip,vipExpireDate:F.isVip?F.vipExpireDate:void 0,vipRole:F.vipRole||void 0,vipName:F.vipName||void 0,vipProject:F.vipProject||void 0,vipContact:F.vipContact||void 0,vipBio:F.vipBio||void 0},ve=await Mt("/api/db/users",me);ve!=null&&ve.success?(ae.success("VIP 设置已保存"),Qe(),r==null||r()):ae.error("保存失败: "+((ve==null?void 0:ve.error)||""))}catch{ae.error("保存失败")}finally{$(!1)}}}async function Tn(){if(!he&&!He&&!Te){de("请至少输入手机号、微信号或 OpenID 中的一项");return}ce(!0),de(null),fe(null);try{const me=new URLSearchParams;he&&me.set("phone",he),He&&me.set("openId",He),Te&&me.set("wechatId",Te);const ve=await Le(`/api/admin/shensheshou/query?${me}`);ve!=null&&ve.success&&ve.data?(fe(ve.data),i&&await Dt(ve.data)):de((ve==null?void 0:ve.error)||"未查询到数据,该用户可能未在神射手收录")}catch(me){console.error("SSS query error:",me),de("请求失败,请检查神射手接口配置")}finally{ce(!1)}}async function Dt(me){if(i)try{await wt("/api/admin/shensheshou/enrich",{userId:i.id,phone:he||i.phone||"",openId:He||i.openId||"",wechatId:Te||i.wechatId||""}),Qe()}catch(ve){console.error("SSS enrich error:",ve)}}async function Kn(){if(i){yn(!0),At(null);try{const me={users:[{phone:i.phone||"",name:i.nickname||"",openId:i.openId||"",tags:O}]},ve=await wt("/api/admin/shensheshou/ingest",me);ve!=null&&ve.success&&ve.data?At(ve.data):At({error:(ve==null?void 0:ve.error)||"推送失败"})}catch(me){console.error("SSS ingest error:",me),At({error:"请求失败"})}finally{yn(!1)}}}const Zr=me=>{const or={view_chapter:Yr,purchase:Cg,match:Un,login:yl,register:yl,share:gs,bind_phone:dA,bind_wechat:ZM,fill_profile:qu,visit_page:pl}[me]||Ng;return s.jsx(or,{className:"w-4 h-4"})};return t?s.jsx(Kt,{open:t,onOpenChange:()=>e(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(yl,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(i==null?void 0:i.phone)&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(i==null?void 0:i.isVip)&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i?s.jsxs("div",{className:"flex flex-col h-[75vh]",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:i.avatar?s.jsx("img",{src:i.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((ar=i.nickname)==null?void 0:ar.charAt(0))||"?"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h3",{className:"text-lg font-bold text-white",children:i.nickname}),i.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),i.hasFullBook&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),i.vipRole&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:i.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[i.phone?`📱 ${i.phone}`:"未绑定手机",i.wechatId&&` · 💬 ${i.wechatId}`,i.mbti&&` · ${i.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",i.id.slice(0,16),"…"]}),i.referralCode&&s.jsxs("p",{className:"text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"推广码:"}),s.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:i.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(i.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(fd,{value:b,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs(Ll,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[s.jsx(tn,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),s.jsx(tn,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(pl,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),s.jsx(tn,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),s.jsxs(tn,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(ia,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),s.jsxs(nn,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:C,onChange:me=>E(me.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:T,onChange:me=>I(me.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[i.openId&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),s.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:i.openId})]}),i.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(GN,{className:"w-4 h-4 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),s.jsx("p",{className:"text-white",children:i.region})]})]}),i.industry&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),s.jsx("p",{className:"text-white",children:i.industry})]}),i.position&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),s.jsx("p",{className:"text-white",children:i.position})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:i.referralCount??0})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),s.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(i.pendingEarnings??0).toFixed(2)]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),s.jsx("p",{className:"text-sm text-white",children:i.createdAt?new Date(i.createdAt).toLocaleDateString():"-"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(LM,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(oe,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:_,onChange:me=>J(me.target.value)}),s.jsx(oe,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:ee,onChange:me=>Y(me.target.value)}),s.jsx(te,{size:"sm",onClick:Xt,disabled:U||!_||!ee,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:U?"保存中...":"确认修改"})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(xl,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-400 text-sm",children:"VIP 会员"}),s.jsx(Et,{checked:F.isVip,onCheckedChange:me=>re(ve=>({...ve,isVip:me}))})]}),F.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(oe,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:F.vipExpireDate,onChange:me=>re(ve=>({...ve,vipExpireDate:me.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:F.vipRole,onChange:me=>re(ve=>({...ve,vipRole:me.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),z.map(me=>s.jsx("option",{value:me.name,children:me.name},me.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:F.vipName,onChange:me=>re(ve=>({...ve,vipName:me.target.value}))})]}),s.jsx(te,{size:"sm",onClick:Ot,disabled:G,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:G?"保存中...":"保存 VIP"})]})]})]}),i.isVip&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(xl,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:i.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[i.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:i.vipName})]}),i.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:i.vipProject})]}),i.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:i.vipContact})]}),i.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(i.vipExpireDate).toLocaleDateString()})]})]}),i.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:i.vipBio})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(uo,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"微信归属"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:ne,onChange:me=>Pe(me.target.value)}),s.jsxs(te,{size:"sm",onClick:async()=>{if(!(!ne||!i))try{await Mt("/api/db/users",{id:i.id,wechatId:ne}),ae.success("已保存微信归属"),Qe()}catch{ae.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[s.jsx(gn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),i.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:i.wechatId})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(gs,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(te,{size:"sm",onClick:xt,disabled:g||!i.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"同步状态:"}),i.ckbSyncedAt?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"最后同步:"}),s.jsx("span",{className:"text-gray-300 ml-1",children:i.ckbSyncedAt?new Date(i.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),s.jsxs(nn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(qu,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),s.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:[s.jsx(wg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),s.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(me=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:me.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:me.tags.map(ve=>s.jsxs("button",{type:"button",onClick:()=>{O.includes(ve)?Nt(ve):D([...O,ve])},className:`px-2 py-0.5 rounded text-xs border transition-all ${O.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:[O.includes(ve)?"✓ ":"",ve]},ve))})]},me.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[O.map((me,ve)=>s.jsxs(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[me,s.jsx("button",{type:"button",onClick:()=>Nt(me),className:"ml-1 hover:text-red-400",children:s.jsx(Xn,{className:"w-3 h-3"})})]},ve)),O.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:P,onChange:me=>L(me.target.value),onKeyDown:me=>me.key==="Enter"&&pt()}),s.jsx(te,{onClick:pt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),i.ckbTags&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(qu,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof i.ckbTags=="string"?i.ckbTags.split(","):[]).map((me,ve)=>s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:me.trim()},ve))})]})]}),s.jsxs(nn,{value:"journey",className:"flex-1 overflow-auto",children:[s.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(pl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),s.jsx("div",{className:"space-y-2",children:o.length>0?o.map((me,ve)=>s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Zr(me.action)}),ve0?u.map((me,ve)=>{var Hs;const or=me;return s.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((Hs=or.nickname)==null?void 0:Hs.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:or.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[or.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-xs",children:or.createdAt?new Date(or.createdAt).toLocaleDateString():""})]})]},or.id||ve)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),s.jsxs(nn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ia,{className:"w-5 h-5 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:he,onChange:me=>we(me.target.value)})]}),s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:Te,onChange:me=>Ve(me.target.value)})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:He,onChange:me=>gt(me.target.value)})]})]}),s.jsx(te,{onClick:Tn,disabled:H,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:H?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(da,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),X&&s.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:X}),W&&s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),s.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:W.rfm_score??"-"})]}),s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:W.user_level??"-"})]})]}),W.tags&&W.tags.length>0&&s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:W.tags.map((me,ve)=>s.jsx(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:me},ve))})]}),W.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",W.last_active]})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx(ia,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),s.jsx(te,{onClick:Kn,disabled:Pt||!i.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Pt?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(ia,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!i.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),ht&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:ht.error?s.jsx("p",{className:"text-red-400",children:String(ht.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(wg,{className:"w-4 h-4"})," 推送成功"]}),ht.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(ht.new_tags_added??0)]})]})})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[s.jsxs(te,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(te,{onClick:ft,disabled:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),w?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function lP(){const t=ja(),[e,n]=v.useState(!0),[r,i]=v.useState(!0),[a,o]=v.useState(!0),[c,u]=v.useState([]),[h,f]=v.useState([]),[m,g]=v.useState(0),[y,w]=v.useState(0),[N,b]=v.useState(0),[k,C]=v.useState(0),[E,T]=v.useState(null),[I,O]=v.useState(null),[D,P]=v.useState(!1),L=U=>{const R=U;if((R==null?void 0:R.status)===401)T("登录已过期,请重新登录");else{if((R==null?void 0:R.name)==="AbortError")return;T("加载失败,请检查网络或联系管理员")}};async function _(U){const R=U?{signal:U}:void 0;n(!0),T(null);try{const z=await Le("/api/admin/dashboard/stats",R);z!=null&&z.success&&(g(z.totalUsers??0),w(z.paidOrderCount??0),b(z.totalRevenue??0),C(z.conversionRate??0))}catch(z){if((z==null?void 0:z.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",z);try{const ie=await Le("/api/admin/dashboard/overview",R);ie!=null&&ie.success&&(g(ie.totalUsers??0),w(ie.paidOrderCount??0),b(ie.totalRevenue??0),C(ie.conversionRate??0))}catch(ie){L(ie)}}}finally{n(!1)}i(!0),o(!0);const F=async()=>{try{const z=await Le("/api/admin/dashboard/recent-orders",R);if(z!=null&&z.success&&z.recentOrders)f(z.recentOrders);else throw new Error("no data")}catch(z){if((z==null?void 0:z.name)!=="AbortError")try{const ie=await Le("/api/admin/orders?page=1&pageSize=20&status=paid",R),$=((ie==null?void 0:ie.orders)??[]).filter(H=>["paid","completed","success"].includes(H.status||""));f($.slice(0,5))}catch{f([])}}finally{i(!1)}},re=async()=>{try{const z=await Le("/api/admin/dashboard/new-users",R);if(z!=null&&z.success&&z.newUsers)u(z.newUsers);else throw new Error("no data")}catch(z){if((z==null?void 0:z.name)!=="AbortError")try{const ie=await Le("/api/db/users?page=1&pageSize=10",R);u((ie==null?void 0:ie.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([F(),re()])}v.useEffect(()=>{const U=new AbortController;_(U.signal);const R=setInterval(()=>_(),3e4);return()=>{U.abort(),clearInterval(R)}},[]);const J=m,ee=U=>{const R=U.productType||"",F=U.description||"";if(F){if(R==="section"&&F.includes("章节")){if(F.includes("-")){const re=F.split("-");if(re.length>=3)return{title:`第${re[1]}章 第${re[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:F,subtitle:"章节购买"}}return R==="fullbook"||F.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:R==="match"||F.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:F,subtitle:R==="section"?"单章":R==="fullbook"?"全书":"其他"}}return R==="section"?{title:`章节 ${U.productId||""}`,subtitle:"单章购买"}:R==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:R==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:R||"其他"}},Y=[{title:"总用户数",value:e?null:J,icon:Un,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(N??0).toFixed(2)}`,icon:Oc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,icon:Cg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,icon:Yr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),E&&s.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:[s.jsx("span",{children:E}),s.jsx("button",{type:"button",onClick:()=>_(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:Y.map((U,R)=>s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>U.link&&t(U.link),children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(st,{className:"text-sm font-medium text-gray-400",children:U.title}),s.jsx("div",{className:`p-2 rounded-lg ${U.bg}`,children:s.jsx(U.icon,{className:`w-4 h-4 ${U.color}`})})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-[2rem] flex items-center",children:U.value!=null?U.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Ge,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),s.jsx(fl,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},R))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsx(st,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>_(),disabled:r||a,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||a?s.jsx(Ge,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Ge,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ge,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,5).map(U=>{var ie;const R=U.referrerId?c.find(G=>G.id===U.referrerId):void 0,F=U.referralCode||(R==null?void 0:R.referralCode)||(R==null?void 0:R.nickname)||(U.referrerId?String(U.referrerId).slice(0,8):""),re=ee(U),z=U.userNickname||((ie=c.find(G=>G.id===U.userId))==null?void 0:ie.nickname)||"匿名用户";return s.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:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[U.userAvatar?s.jsx("img",{src:U.userAvatar,alt:z,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:G=>{G.currentTarget.style.display="none";const $=G.currentTarget.nextElementSibling;$&&$.classList.remove("hidden")}}):null,s.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 ${U.userAvatar?"hidden":""}`,children:z.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{U.userId&&(O(U.userId),P(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:z}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",children:re.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[re.subtitle&&re.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:re.subtitle}),s.jsx("span",{children:new Date(U.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),F&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",F]})]})]}),s.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(U.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:U.paymentMethod||"微信"})]})]},U.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Cg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"新注册用户"})}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-3",children:a&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ge,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(U=>{var R;return s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((R=U.nickname)==null?void 0:R.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{O(U.id),P(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:U.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:U.phone||"-"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:U.createdAt?new Date(U.createdAt).toLocaleDateString():"-"})]},U.id)}),c.length===0&&!a&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsx(Jx,{open:D,onClose:()=>{P(!1),O(null)},userId:I,onUserUpdated:()=>_()})]})}const er=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Ct("w-full caption-bottom text-sm",t),...e})}));er.displayName="Table";const tr=v.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Ct("[&_tr]:border-b",t),...e}));tr.displayName="TableHeader";const nr=v.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Ct("[&_tr:last-child]:border-0",t),...e}));nr.displayName="TableBody";const it=v.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Ct("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));it.displayName="TableRow";const je=v.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Ct("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableHead";const xe=v.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Ct("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));xe.displayName="TableCell";function Yx(t,e){const[n,r]=v.useState(t);return v.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function xs({page:t,totalPages:e,total:n,pageSize:r,onPageChange:i,onPageSizeChange:a,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!a?null:s.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[s.jsxs("span",{children:["共 ",n," 条"]}),a&&s.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=>s.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>i(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:"首页"}),s.jsx("button",{type:"button",onClick:()=>i(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:"上一页"}),s.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),s.jsx("button",{type:"button",onClick:()=>i(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:"下一页"}),s.jsx("button",{type:"button",onClick:()=>i(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 cP(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[i,a]=v.useState(0),[o,c]=v.useState(0),[u,h]=v.useState(0),[f,m]=v.useState(1),[g,y]=v.useState(10),[w,N]=v.useState(""),b=Yx(w,300),[k,C]=v.useState("all"),[E,T]=v.useState(!0),[I,O]=v.useState(null),[D,P]=v.useState(null),[L,_]=v.useState(""),[J,ee]=v.useState(!1);async function Y(){T(!0),O(null);try{const G=k==="all"?"":k==="completed"?"completed":k,$=new URLSearchParams({page:String(f),pageSize:String(g),...G&&{status:G},...b&&{search:b}}),[H,ce]=await Promise.all([Le(`/api/admin/orders?${$}`),Le("/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)),ce!=null&&ce.success&&ce.users&&r(ce.users)}catch(G){console.error("加载订单失败",G),O("加载订单失败,请检查网络后重试")}finally{T(!1)}}v.useEffect(()=>{m(1)},[b,k]),v.useEffect(()=>{Y()},[f,g,b,k]);const U=G=>{var $;return G.userNickname||(($=n.find(H=>H.id===G.userId))==null?void 0:$.nickname)||"匿名用户"},R=G=>{var $;return(($=n.find(H=>H.id===G))==null?void 0:$.phone)||"-"},F=G=>{const $=G.productType||G.type||"",H=G.description||"";if(H){if($==="section"&&H.includes("章节")){if(H.includes("-")){const ce=H.split("-");if(ce.length>=3)return{name:`第${ce[1]}章 第${ce[2]}节`,type:"《一场Soul的创业实验》"}}return{name:H,type:"章节购买"}}return $==="fullbook"||H.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:$==="vip"||H.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:$==="match"||H.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:H,type:"其他"}}return $==="section"?{name:`章节 ${G.productId||G.sectionId||""}`,type:"单章"}:$==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:$==="vip"?{name:"VIP年度会员",type:"VIP"}:$==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:$||"其他"}},re=Math.ceil(i/g)||1;async function z(){var G;if(!(!(D!=null&&D.orderSn)&&!(D!=null&&D.id))){ee(!0),O(null);try{const $=await Mt("/api/admin/orders/refund",{orderSn:D.orderSn||D.id,reason:L||void 0});$!=null&&$.success?(P(null),_(""),Y()):O(($==null?void 0:$.error)||"退款失败")}catch($){const H=$;O(((G=H==null?void 0:H.data)==null?void 0:G.error)||"退款失败,请检查网络后重试")}finally{ee(!1)}}}function ie(){if(t.length===0){ae.info("暂无数据可导出");return}const G=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],$=t.map(X=>{const de=F(X);return[X.orderSn||X.id||"",U(X),R(X.userId),de.name,Number(X.amount||0).toFixed(2),X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付",X.status==="refunded"?"已退款":X.status==="paid"||X.status==="completed"?"已完成":X.status==="pending"||X.status==="created"?"待支付":"已失败",X.status==="refunded"&&X.refundReason?X.refundReason:"-",X.referrerEarnings?Number(X.referrerEarnings).toFixed(2):"-",X.createdAt?new Date(X.createdAt).toLocaleString("zh-CN"):""].join(",")}),H="\uFEFF"+[G.join(","),...$].join(` -`),ce=new Blob([H],{type:"text/csv;charset=utf-8"}),W=URL.createObjectURL(ce),fe=document.createElement("a");fe.href=W,fe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,fe.click(),URL.revokeObjectURL(W)}return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>O(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(te,{variant:"outline",onClick:Y,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(oe,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:w,onChange:G=>N(G.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(KN,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:G=>C(G.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(te,{variant:"outline",onClick:ie,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(aM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:E?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"订单号"}),s.jsx(je,{className:"text-gray-400",children:"用户"}),s.jsx(je,{className:"text-gray-400",children:"商品"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"支付方式"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"退款原因"}),s.jsx(je,{className:"text-gray-400",children:"分销佣金"}),s.jsx(je,{className:"text-gray-400",children:"下单时间"}),s.jsx(je,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(nr,{children:[t.map(G=>{const $=F(G);return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(xe,{className:"font-mono text-xs text-gray-400",children:[(G.orderSn||G.id||"").slice(0,12),"..."]}),s.jsx(xe,{children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:U(G)}),s.jsx("p",{className:"text-gray-500 text-xs",children:R(G.userId)})]})}),s.jsx(xe,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[$.name,(G.productType||G.type)==="vip"&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:$.type})]})}),s.jsxs(xe,{className:"text-[#38bdac] font-bold",children:["¥",Number(G.amount||0).toFixed(2)]}),s.jsx(xe,{className:"text-gray-300",children:G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付"}),s.jsx(xe,{children:G.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):G.status==="paid"||G.status==="completed"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):G.status==="pending"||G.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),s.jsx(xe,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:G.refundReason,children:G.status==="refunded"&&G.refundReason?G.refundReason:"-"}),s.jsx(xe,{className:"text-[#FFD700]",children:G.referrerEarnings?`¥${Number(G.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(xe,{className:"text-gray-400 text-sm",children:new Date(G.createdAt).toLocaleString("zh-CN")}),s.jsx(xe,{children:(G.status==="paid"||G.status==="completed")&&s.jsxs(te,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{P(G),_("")},children:[s.jsx(YN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},G.id)}),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(xs,{page:f,totalPages:re,total:i,pageSize:g,onPageChange:m,onPageSizeChange:G=>{y(G),m(1)}})]})})}),s.jsx(Kt,{open:!!D,onOpenChange:G=>!G&&P(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"订单退款"})}),D&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",D.orderSn||D.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(D.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:L,onChange:G=>_(G.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>P(null),disabled:J,children:"取消"}),s.jsx(te,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:z,disabled:J,children:J?"退款中...":"确认退款"})]})]})})]})}const _l=v.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Ct("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}));_l.displayName="Textarea";const Mu=[{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 dP(){var Js,Ai,ks,Oa,Da;const[t,e]=$N(),n=t.get("pool"),[r,i]=v.useState([]),[a,o]=v.useState(0),[c,u]=v.useState(1),[h,f]=v.useState(10),[m,g]=v.useState(""),y=Yx(m,300),w=n==="vip"?"vip":n==="complete"?"complete":"all",[N,b]=v.useState(w),[k,C]=v.useState(!0),[E,T]=v.useState(!1),[I,O]=v.useState(null),[D,P]=v.useState(!1),[L,_]=v.useState("desc");v.useEffect(()=>{n==="vip"?b("vip"):n==="complete"?b("complete"):n==="all"&&b("all")},[n]);const[J,ee]=v.useState(!1),[Y,U]=v.useState(null),[R,F]=v.useState(!1),[re,z]=v.useState(!1),[ie,G]=v.useState({referrals:[],stats:{}}),[$,H]=v.useState(!1),[ce,W]=v.useState(null),[fe,X]=v.useState(!1),[de,he]=v.useState(null),[we,Te]=v.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Ve,He]=v.useState([]),[gt,Pt]=v.useState(!1),[yn,ht]=v.useState(!1),[At,ne]=v.useState(null),[Pe,Qe]=v.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[xt,ft]=v.useState([]),[pt,Nt]=v.useState(!1),[Xt,Ot]=v.useState(null),[Tn,Dt]=v.useState(null),[Kn,Zr]=v.useState({}),[ar,me]=v.useState(!1);async function ve(V=!1){var Re;C(!0),V&&T(!0),O(null);try{if(D){const Xe=new URLSearchParams({search:y,limit:String(h*5)}),et=await Le(`/api/db/users/rfm?${Xe}`);if(et!=null&&et.success){let Mn=et.users||[];L==="asc"&&(Mn=[...Mn].reverse());const cr=(c-1)*h;i(Mn.slice(cr,cr+h)),o(((Re=et.users)==null?void 0:Re.length)??0),Mn.length===0&&(P(!1),O("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else P(!1),O((et==null?void 0:et.error)||"RFM 加载失败,已切回普通模式")}else{const Xe=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...N==="vip"&&{vip:"true"},...N==="complete"&&{pool:"complete"}}),et=await Le(`/api/db/users?${Xe}`);et!=null&&et.success?(i(et.users||[]),o(et.total??0)):O((et==null?void 0:et.error)||"加载失败")}}catch(Xe){console.error("Load users error:",Xe),O("网络错误")}finally{C(!1),V&&T(!1)}}v.useEffect(()=>{u(1)},[y,N,D]),v.useEffect(()=>{ve()},[c,h,y,N,D,L]);const or=Math.ceil(a/h)||1,Hs=()=>{D?L==="desc"?_("asc"):(P(!1),_("desc")):(P(!0),_("desc"))},ki=V=>({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"})[V||""]||"bg-gray-500/20 text-gray-400";async function Si(V){if(confirm("确定要删除这个用户吗?"))try{const Re=await Ps(`/api/db/users?id=${encodeURIComponent(V)}`);Re!=null&&Re.success?ve():ae.error("删除失败: "+((Re==null?void 0:Re.error)||""))}catch{ae.error("删除失败")}}const Sr=V=>{U(V),Te({phone:V.phone||"",nickname:V.nickname||"",password:"",isAdmin:!!(V.isAdmin??!1),hasFullBook:!!(V.hasFullBook??!1)}),ee(!0)},Aa=()=>{U(null),Te({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),ee(!0)};async function _r(){if(!we.phone||!we.nickname){ae.error("请填写手机号和昵称");return}F(!0);try{if(Y){const V=await Mt("/api/db/users",{id:Y.id,phone:we.phone||void 0,nickname:we.nickname,isAdmin:we.isAdmin,hasFullBook:we.hasFullBook,...we.password&&{password:we.password}});if(!(V!=null&&V.success)){ae.error("更新失败: "+((V==null?void 0:V.error)||""));return}}else{const V=await wt("/api/db/users",{phone:we.phone,nickname:we.nickname,password:we.password,isAdmin:we.isAdmin});if(!(V!=null&&V.success)){ae.error("创建失败: "+((V==null?void 0:V.error)||""));return}}ee(!1),ve()}catch{ae.error("保存失败")}finally{F(!1)}}async function es(V){W(V),z(!0),H(!0);try{const Re=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(V.id)}`);Re!=null&&Re.success?G({referrals:Re.referrals||[],stats:Re.stats||{}}):G({referrals:[],stats:{}})}catch{G({referrals:[],stats:{}})}finally{H(!1)}}const lr=v.useCallback(async()=>{Pt(!0);try{const V=await Le("/api/db/user-rules");V!=null&&V.success&&He(V.rules||[])}catch{}finally{Pt(!1)}},[]);async function Ci(){if(!Pe.title){ae.error("请填写规则标题");return}F(!0);try{if(At){const V=await Mt("/api/db/user-rules",{id:At.id,...Pe});if(!(V!=null&&V.success)){ae.error("更新失败: "+((V==null?void 0:V.error)||""));return}}else{const V=await wt("/api/db/user-rules",Pe);if(!(V!=null&&V.success)){ae.error("创建失败: "+((V==null?void 0:V.error)||""));return}}ht(!1),lr()}catch{ae.error("保存失败")}finally{F(!1)}}async function Ia(V){if(confirm("确定删除?"))try{const Re=await Ps(`/api/db/user-rules?id=${V}`);Re!=null&&Re.success&&lr()}catch{}}async function Ws(V){try{await Mt("/api/db/user-rules",{id:V.id,enabled:!V.enabled}),lr()}catch{}}const ot=v.useCallback(async()=>{Nt(!0);try{const V=await Le("/api/db/vip-members?limit=500");if(V!=null&&V.success&&V.data){const Re=[...V.data].map((Xe,et)=>({...Xe,vipSort:typeof Xe.vipSort=="number"?Xe.vipSort:et+1}));Re.sort((Xe,et)=>(Xe.vipSort??999999)-(et.vipSort??999999)),ft(Re)}else V&&V.error&&ae.error(V.error)}catch{ae.error("加载超级个体列表失败")}finally{Nt(!1)}},[]),[Ln,ts]=v.useState(!1),[Cr,ns]=v.useState(null),[rn,zr]=v.useState(""),[Us,$r]=v.useState(!1),Ks=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],jn=V=>{ns(V),zr(V.vipRole||""),ts(!0)},rs=async V=>{const Re=V.trim();if(Cr){if(!Re){ae.error("请选择或输入标签");return}$r(!0);try{const Xe=await Mt("/api/db/users",{id:Cr.id,vipRole:Re});if(!(Xe!=null&&Xe.success)){ae.error((Xe==null?void 0:Xe.error)||"更新超级个体标签失败");return}ae.success("已更新超级个体标签"),ts(!1),ns(null),await ot()}catch{ae.error("更新超级个体标签失败")}finally{$r(!1)}}},[Hl,Ei]=v.useState(!1),[qs,mr]=v.useState(null),[Ra,Ti]=v.useState(""),[Gs,Ns]=v.useState(!1),Mi=V=>{mr(V),Ti(V.vipSort!=null?String(V.vipSort):""),Ei(!0)},To=async()=>{if(!qs)return;const V=Number(Ra);if(!Number.isFinite(V)){ae.error("请输入有效的数字序号");return}Ns(!0);try{const Re=await Mt("/api/db/users",{id:qs.id,vipSort:V});if(!(Re!=null&&Re.success)){ae.error((Re==null?void 0:Re.error)||"更新排序序号失败");return}ae.success("已更新排序序号"),Ei(!1),mr(null),await ot()}catch{ae.error("更新排序序号失败")}finally{Ns(!1)}},js=(V,Re)=>{V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",Re),Ot(Re)},Pa=(V,Re)=>{V.preventDefault(),Tn!==Re&&Dt(Re)},Mo=()=>{Ot(null),Dt(null)},Tt=async(V,Re)=>{V.preventDefault();const Xe=V.dataTransfer.getData("text/plain")||Xt;if(Ot(null),Dt(null),!Xe||Xe===Re)return;const et=xt.find(Jt=>Jt.id===Xe),Mn=xt.find(Jt=>Jt.id===Re);if(!et||!Mn)return;const cr=et.vipSort??xt.findIndex(Jt=>Jt.id===Xe)+1,Io=Mn.vipSort??xt.findIndex(Jt=>Jt.id===Re)+1;ft(Jt=>{const _n=[...Jt],ss=_n.findIndex(Ii=>Ii.id===Xe),Ss=_n.findIndex(Ii=>Ii.id===Re);if(ss===-1||Ss===-1)return Jt;const Ys=[..._n],[Wl,La]=[Ys[ss],Ys[Ss]];return Ys[ss]={...La,vipSort:cr},Ys[Ss]={...Wl,vipSort:Io},Ys});try{const[Jt,_n]=await Promise.all([Mt("/api/db/users",{id:Xe,vipSort:Io}),Mt("/api/db/users",{id:Re,vipSort:cr})]);if(!(Jt!=null&&Jt.success)||!(_n!=null&&_n.success)){ae.error((Jt==null?void 0:Jt.error)||(_n==null?void 0:_n.error)||"更新排序失败"),await ot();return}ae.success("已更新排序"),await ot()}catch{ae.error("更新排序失败"),await ot()}},Ao=v.useCallback(async()=>{me(!0);try{const V=await Le("/api/db/users/journey-stats");V!=null&&V.success&&V.stats&&Zr(V.stats)}catch{}finally{me(!1)}},[]);return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>O(null),children:"×"})]}),s.jsx("div",{className:"flex justify-between items-center mb-6",children:s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",a," 位注册用户",D&&" · RFM 排序中"]})]})}),s.jsxs(fd,{defaultValue:"users",className:"w-full",children:[s.jsxs(Ll,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(tn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Un,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Ao,children:[s.jsx(pl,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(tn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:lr,children:[s.jsx(so,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(tn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ot,children:[s.jsx(xl,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(nn,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(te,{variant:"outline",onClick:()=>ve(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:N,onChange:V=>{const Re=V.target.value;b(Re),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:[s.jsx("option",{value:"all",children:"全部用户"}),s.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),s.jsx("option",{value:"complete",children:"完善资料用户"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(oe,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:V=>g(V.target.value)})]}),s.jsxs(te,{onClick:Aa,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Eg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"用户信息"}),s.jsx(je,{className:"text-gray-400",children:"绑定信息"}),s.jsx(je,{className:"text-gray-400",children:"购买状态"}),s.jsx(je,{className:"text-gray-400",children:"分销收益"}),s.jsxs(je,{className:"text-gray-400 cursor-pointer select-none",onClick:Hs,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Oc,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),D?L==="desc"?s.jsx(Gc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(BN,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(wm,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),D&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(je,{className:"text-gray-400",children:"注册时间"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(nr,{children:[r.map(V=>{var Re,Xe,et;return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:V.avatar?s.jsx("img",{src:V.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Re=V.nickname)==null?void 0:Re.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{he(V.id),X(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:V.nickname}),V.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),V.openId&&!((Xe=V.id)!=null&&Xe.startsWith("user_"))&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsx("p",{className:"text-xs text-gray-500 font-mono",children:V.openId?V.openId.slice(0,12)+"...":(et=V.id)==null?void 0:et.slice(0,12)})]})]})}),s.jsx(xe,{children:s.jsxs("div",{className:"space-y-1",children:[V.phone&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"📱"}),s.jsx("span",{className:"text-gray-300",children:V.phone})]}),V.wechatId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"💬"}),s.jsx("span",{className:"text-gray-300",children:V.wechatId})]}),V.openId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"🔗"}),s.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:V.openId,children:[V.openId.slice(0,12),"..."]})]}),!V.phone&&!V.wechatId&&!V.openId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(xe,{children:V.hasFullBook?s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),s.jsx(xe,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(V.earnings||0)).toFixed(2)]}),parseFloat(String(V.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(V.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>es(V),role:"button",tabIndex:0,onKeyDown:Mn=>Mn.key==="Enter"&&es(V),children:[s.jsx(Un,{className:"w-3 h-3"})," 绑定",V.referralCount||0,"人"]})]})}),s.jsx(xe,{children:V.rfmScore!==void 0?s.jsx("div",{className:"flex flex-col gap-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:V.rfmScore}),s.jsx(Ue,{className:`border-0 text-xs ${ki(V.rfmLevel)}`,children:V.rfmLevel})]})}):s.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",s.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),s.jsx(xe,{className:"text-gray-400",children:V.createdAt?new Date(V.createdAt).toLocaleDateString():"-"}),s.jsx(xe,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{he(V.id),X(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(jg,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Sr(V),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(_t,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Si(V.id),title:"删除",children:s.jsx(Bn,{className:"w-4 h-4"})})]})})]},V.id)}),r.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(xs,{page:c,totalPages:or,total:a,pageSize:h,onPageChange:u,onPageSizeChange:V=>{f(V),u(1)}})]})})})]}),s.jsxs(nn,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(te,{variant:"outline",onClick:Ao,disabled:ar,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${ar?"animate-spin":""}`})," 刷新数据"]})]}),s.jsxs("div",{className:"relative mb-8",children:[s.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"}),s.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:Mu.map((V,Re)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${V.color} text-center cursor-default`,children:[s.jsx("div",{className:"text-2xl mb-1",children:V.icon}),s.jsx("div",{className:`text-xs font-medium ${V.color.split(" ").find(Xe=>Xe.startsWith("text-"))}`,children:V.label}),Kn[V.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Kn[V.id]})," 人"]}),s.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:Re+1})]}),Res.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:V.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:V.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",V.next]})]})]},V.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Yr,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),ar?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ge,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Kn).length>0?s.jsx("div",{className:"space-y-2",children:Mu.map(V=>{const Re=Kn[V.id]||0,Xe=Math.max(...Mu.map(Mn=>Kn[Mn.id]||0),1),et=Math.round(Re/Xe*100);return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[V.icon," ",V.label]}),s.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${et}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Re})]},V.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),s.jsxs(nn,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(te,{variant:"outline",onClick:lr,disabled:gt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${gt?"animate-spin":""}`})," 刷新"]}),s.jsxs(te,{onClick:()=>{ne(null),Qe({title:"",description:"",trigger:"",sort:0,enabled:!0}),ht(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),gt?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Ve.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Yr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(te,{onClick:lr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ge,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Ve.map(V=>s.jsx("div",{className:`p-4 rounded-lg border transition-all ${V.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.jsx(_t,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium",children:V.title}),V.trigger&&s.jsxs(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",V.trigger]}),s.jsx(Ue,{className:`text-xs border-0 ${V.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:V.enabled?"启用":"禁用"})]}),V.description&&s.jsx("p",{className:"text-gray-400 text-sm ml-6",children:V.description})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[s.jsx(Et,{checked:V.enabled,onCheckedChange:()=>Ws(V)}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{ne(V),Qe({title:V.title,description:V.description,trigger:V.trigger,sort:V.sort,enabled:V.enabled}),ht(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(_t,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Ia(V.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Bn,{className:"w-4 h-4"})})]})]})},V.id))})]}),s.jsxs(nn,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(te,{variant:"outline",onClick:ot,disabled:pt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${pt?"animate-spin":""}`})," ","刷新"]})})]}),pt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):xt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(xl,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-16",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),s.jsx(je,{className:"text-gray-400 w-24",children:"排序值"}),s.jsx(je,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),s.jsx(nr,{children:xt.map((V,Re)=>{var Mn;const Xe=Xt===V.id,et=Tn===V.id;return s.jsxs(it,{draggable:!0,onDragStart:cr=>js(cr,V.id),onDragOver:cr=>Pa(cr,V.id),onDrop:cr=>Tt(cr,V.id),onDragEnd:Mo,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Xe?"opacity-60":""} ${et?"bg-[#38bdac]/10":""}`,children:[s.jsx(xe,{className:"text-gray-300",children:Re+1}),s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[V.avatar?s.jsx("img",{src:V.avatar,className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((Mn=V.name)==null?void 0:Mn[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:V.name})})]})}),s.jsx(xe,{className:"text-gray-300 whitespace-nowrap",children:V.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(xe,{className:"text-gray-300",children:V.vipSort??Re+1}),s.jsx(xe,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>jn(V),title:"设置超级个体标签",children:s.jsx(qu,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{he(V.id),X(!0)},title:"编辑资料",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Mi(V),title:"设置排序序号",children:s.jsx(wm,{className:"w-3.5 h-3.5"})})]})})]},V.id)})})]})})})]})]}),s.jsx(Kt,{open:Hl,onOpenChange:V=>{Ei(V),V||mr(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(wm,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",qs==null?void 0:qs.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:Ra,onChange:V=>Ti(V.target.value)})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>Ei(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:To,disabled:Gs,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),Gs?"保存中...":"保存"]})]})]})}),s.jsx(Kt,{open:Ln,onOpenChange:V=>{ts(V),V||ns(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(xl,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Cr==null?void 0:Cr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Ks.map(V=>s.jsx(te,{variant:rn===V?"default":"outline",size:"sm",className:rn===V?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>zr(V),children:V},V))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:rn,onChange:V=>zr(V.target.value)})]})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>ts(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:()=>rs(rn),disabled:Us,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),Us?"保存中...":"保存"]})]})]})}),s.jsx(Kt,{open:J,onOpenChange:ee,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[Y?s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Eg,{className:"w-5 h-5 text-[#38bdac]"}),Y?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:we.phone,onChange:V=>Te({...we,phone:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:we.nickname,onChange:V=>Te({...we,nickname:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:Y?"新密码 (留空则不修改)":"密码"}),s.jsx(oe,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:Y?"留空则不修改":"请输入密码",value:we.password,onChange:V=>Te({...we,password:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Et,{checked:we.isAdmin,onCheckedChange:V=>Te({...we,isAdmin:V})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"已购全书"}),s.jsx(Et,{checked:we.hasFullBook,onCheckedChange:V=>Te({...we,hasFullBook:V})})]})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>ee(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:_r,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Kt,{open:yn,onOpenChange:ht,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}),At?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Pe.title,onChange:V=>Qe({...Pe,title:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则描述"}),s.jsx(_l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Pe.description,onChange:V=>Qe({...Pe,description:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"触发条件"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Pe.trigger,onChange:V=>Qe({...Pe,trigger:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(Z,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Et,{checked:Pe.enabled,onCheckedChange:V=>Qe({...Pe,enabled:V})})]})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>ht(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:Ci,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Kt,{open:re,onOpenChange:z,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",ce==null?void 0:ce.nickname]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((Js=ie.stats)==null?void 0:Js.total)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Ai=ie.stats)==null?void 0:Ai.purchased)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((ks=ie.stats)==null?void 0:ks.earnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((Oa=ie.stats)==null?void 0:Oa.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),$?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ge,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Da=ie.referrals)==null?void 0:Da.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(ie.referrals??[]).map((V,Re)=>{var et;const Xe=V;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((et=Xe.nickname)==null?void 0:et.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Xe.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Xe.phone||(Xe.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Xe.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Xe.status==="paid"&&s.jsxs(Ue,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Xe.purchasedSections,"章"]}),Xe.status==="free"&&s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Xe.createdAt?new Date(Xe.createdAt).toLocaleDateString():""})]})]},Xe.id||Re)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(hn,{children:s.jsx(te,{variant:"outline",onClick:()=>z(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(Jx,{open:fe,onClose:()=>X(!1),userId:de,onUserUpdated:ve})]})}function uh(t,[e,n]){return Math.min(n,Math.max(e,t))}var xk=["PageUp","PageDown"],yk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],vk={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},zl="Slider",[Rg,uP,hP]=Ux(zl),[bk]=ka(zl,[hP]),[fP,gf]=bk(zl),wk=v.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=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:w,...N}=t,b=v.useRef(new Set),k=v.useRef(0),E=o==="horizontal"?pP:mP,[T=[],I]=fo({prop:f,defaultProp:h,onChange:J=>{var Y;(Y=[...b.current][k.current])==null||Y.focus(),m(J)}}),O=v.useRef(T);function D(J){const ee=bP(T,J);_(J,ee)}function P(J){_(J,k.current)}function L(){const J=O.current[k.current];T[k.current]!==J&&g(T)}function _(J,ee,{commit:Y}={commit:!1}){const U=kP(a),R=SP(Math.round((J-r)/a)*a+r,U),F=uh(R,[r,i]);I((re=[])=>{const z=yP(re,F,ee);if(jP(z,u*a)){k.current=z.indexOf(F);const ie=String(z)!==String(re);return ie&&Y&&g(z),ie?z:re}else return re})}return s.jsx(fP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:k,thumbs:b.current,values:T,orientation:o,form:w,children:s.jsx(Rg.Provider,{scope:t.__scopeSlider,children:s.jsx(Rg.Slot,{scope:t.__scopeSlider,children:s.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...N,ref:e,onPointerDown:at(N.onPointerDown,()=>{c||(O.current=T)}),min:r,max:i,inverted:y,onSlideStart:c?void 0:D,onSlideMove:c?void 0:P,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&_(r,0,{commit:!0}),onEndKeyDown:()=>!c&&_(i,T.length-1,{commit:!0}),onStepKeyDown:({event:J,direction:ee})=>{if(!c){const R=xk.includes(J.key)||J.shiftKey&&yk.includes(J.key)?10:1,F=k.current,re=T[F],z=a*R*ee;_(re+z,F,{commit:!0})}}})})})})});wk.displayName=zl;var[Nk,jk]=bk(zl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),pP=v.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=v.useState(null),y=St(e,E=>g(E)),w=v.useRef(void 0),N=ff(i),b=N==="ltr",k=b&&!a||!b&&a;function C(E){const T=w.current||m.getBoundingClientRect(),I=[0,T.width],D=Qx(I,k?[n,r]:[r,n]);return w.current=T,D(E-T.left)}return s.jsx(Nk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(kk,{dir:N,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const T=C(E.clientX);o==null||o(T)},onSlideMove:E=>{const T=C(E.clientX);c==null||c(T)},onSlideEnd:()=>{w.current=void 0,u==null||u()},onStepKeyDown:E=>{const I=vk[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:I?-1:1})}})})}),mP=v.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=v.useRef(null),m=St(e,f),g=v.useRef(void 0),y=!i;function w(N){const b=g.current||f.current.getBoundingClientRect(),k=[0,b.height],E=Qx(k,y?[r,n]:[n,r]);return g.current=b,E(N-b.top)}return s.jsx(Nk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(kk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const b=w(N.clientY);a==null||a(b)},onSlideMove:N=>{const b=w(N.clientY);o==null||o(b)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:N=>{const k=vk[y?"from-bottom":"from-top"].includes(N.key);u==null||u({event:N,direction:k?-1:1})}})})}),kk=v.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=gf(zl,n);return s.jsx(dt.span,{...h,ref:e,onKeyDown:at(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):xk.concat(yk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:at(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:at(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&i(m)}),onPointerUp:at(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),a(m))})})}),Sk="SliderTrack",Ck=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=gf(Sk,n);return s.jsx(dt.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});Ck.displayName=Sk;var Pg="SliderRange",Ek=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=gf(Pg,n),a=jk(Pg,n),o=v.useRef(null),c=St(e,o),u=i.values.length,h=i.values.map(g=>Ak(g,i.min,i.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(dt.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[a.startEdge]:f+"%",[a.endEdge]:m+"%"}})});Ek.displayName=Pg;var Og="SliderThumb",Tk=v.forwardRef((t,e)=>{const n=uP(t.__scopeSlider),[r,i]=v.useState(null),a=St(e,c=>i(c)),o=v.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(gP,{...t,ref:a,index:o})}),gP=v.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...a}=t,o=gf(Og,n),c=jk(Og,n),[u,h]=v.useState(null),f=St(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=Gx(u),y=o.values[r],w=y===void 0?0:Ak(y,o.min,o.max),N=vP(r,o.values.length),b=g==null?void 0:g[c.size],k=b?wP(b,w,c.direction):0;return v.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${w}% + ${k}px)`},children:[s.jsx(Rg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(dt.span,{role:"slider","aria-label":t["aria-label"]||N,"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:at(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(Mk,{name:i??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Tk.displayName=Og;var xP="RadioBubbleInput",Mk=v.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const i=v.useRef(null),a=St(i,r),o=qx(e);return v.useEffect(()=>{const c=i.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]),s.jsx(dt.input,{style:{display:"none"},...n,ref:a,defaultValue:e})});Mk.displayName=xP;function yP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,a)=>i-a)}function Ak(t,e,n){const a=100/(n-e)*(t-e);return uh(a,[0,100])}function vP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function bP(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function wP(t,e,n){const r=t/2,a=Qx([0,50],[0,r]);return(r-a(e)*n)*n}function NP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function jP(t,e){if(e>0){const n=NP(t);return Math.min(...n)>=e}return!0}function Qx(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 kP(t){return(String(t).split(".")[1]||"").length}function SP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var CP=wk,EP=Ck,TP=Ek,MP=Tk;function AP({className:t,defaultValue:e,value:n,min:r=0,max:i=100,...a}){const o=v.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,i],[n,e,r,i]);return s.jsxs(CP,{defaultValue:e,value:n,min:r,max:i,className:Ct("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...a,children:[s.jsx(EP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(TP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(MP,{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 IP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function Ik(t){const[e,n]=v.useState(IP),[r,i]=v.useState(!0),[a,o]=v.useState(!1);v.useEffect(()=>{Le("/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(()=>i(!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 wt("/api/admin/referral-settings",h);if(!f||f.success===!1){ae.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}ae.success(`✅ 分销配置已保存成功! +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},ER="DialogDescriptionWarning",TR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Hj(ER).contentName}}.`;return v.useEffect(()=>{var a;const i=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},MR=Aj,AR=Pj,IR=Oj,RR=Dj,PR=_j,OR=$j,DR=Bj;function Yt(t){return s.jsx(MR,{"data-slot":"dialog",...t})}function LR(t){return s.jsx(AR,{...t})}const Wj=v.forwardRef(({className:t,...e},n)=>s.jsx(IR,{ref:n,className:Mt("fixed inset-0 z-50 bg-black/50",t),...e}));Wj.displayName="DialogOverlay";const Bt=v.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},i)=>s.jsxs(LR,{children:[s.jsx(Wj,{}),s.jsxs(RR,{ref:i,"aria-describedby":void 0,className:Mt("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&&s.jsxs(DR,{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:[s.jsx(er,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Bt.displayName="DialogContent";function Qt({className:t,...e}){return s.jsx("div",{className:Mt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function fn({className:t,...e}){return s.jsx("div",{className:Mt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Xt(t){return s.jsx(PR,{className:"text-lg font-semibold leading-none",...t})}function Ux(t){return s.jsx(OR,{className:"text-sm text-muted-foreground",...t})}const _R=rj("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 Ue({className:t,variant:e,asChild:n=!1,...r}){const i=n?ej:"span";return s.jsx(i,{className:Mt(_R({variant:e}),t),...r})}var zR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$R=zR.reduce((t,e)=>{const n=ZN(`Primitive.${e}`),r=v.forwardRef((i,a)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),FR="Label",Uj=v.forwardRef((t,e)=>s.jsx($R.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Uj.displayName=FR;var Kj=Uj;const Z=v.forwardRef(({className:t,...e},n)=>s.jsx(Kj,{ref:n,className:Mt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Z.displayName=Kj.displayName;function Kx(t){const e=t+"CollectionProvider",[n,r]=Sa(e),[i,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=N=>{const{scope:b,children:k}=N,C=pr.useRef(null),E=pr.useRef(new Map).current;return s.jsx(i,{scope:b,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Yc(c),h=pr.forwardRef((N,b)=>{const{scope:k,children:C}=N,E=a(c,k),T=Tt(b,E.collectionRef);return s.jsx(u,{ref:T,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Yc(f),y=pr.forwardRef((N,b)=>{const{scope:k,children:C,...E}=N,T=pr.useRef(null),I=Tt(b,T),O=a(f,k);return pr.useEffect(()=>(O.itemMap.set(T,{ref:T,...E}),()=>void O.itemMap.delete(T))),s.jsx(g,{[m]:"",ref:I,children:C})});y.displayName=f;function w(N){const b=a(t+"CollectionConsumer",N);return pr.useCallback(()=>{const C=b.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(b.itemMap.values()).sort((O,D)=>E.indexOf(O.ref.current)-E.indexOf(D.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},w,r]}var BR=v.createContext(void 0);function pf(t){const e=v.useContext(BR);return t||e||"ltr"}var Om="rovingFocusGroup.onEntryFocus",VR={bubbles:!1,cancelable:!0},fd="RovingFocusGroup",[Rg,qj,HR]=Kx(fd),[WR,Gj]=Sa(fd,[HR]),[UR,KR]=WR(fd),Jj=v.forwardRef((t,e)=>s.jsx(Rg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Rg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(qR,{...t,ref:e})})}));Jj.displayName=fd;var qR=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=v.useRef(null),y=Tt(e,g),w=pf(a),[N,b]=po({prop:o,defaultProp:c??null,onChange:u,caller:fd}),[k,C]=v.useState(!1),E=xa(h),T=qj(n),I=v.useRef(!1),[O,D]=v.useState(0);return v.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Om,E),()=>P.removeEventListener(Om,E)},[E]),s.jsx(UR,{scope:n,orientation:r,dir:w,loop:i,currentTabStopId:N,onItemFocus:v.useCallback(P=>b(P),[b]),onItemShiftTab:v.useCallback(()=>C(!0),[]),onFocusableItemAdd:v.useCallback(()=>D(P=>P+1),[]),onFocusableItemRemove:v.useCallback(()=>D(P=>P-1),[]),children:s.jsx(ht.div,{tabIndex:k||O===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:ot(t.onMouseDown,()=>{I.current=!0}),onFocus:ot(t.onFocus,P=>{const L=!I.current;if(P.target===P.currentTarget&&L&&!k){const _=new CustomEvent(Om,VR);if(P.currentTarget.dispatchEvent(_),!_.defaultPrevented){const J=T().filter(F=>F.focusable),ee=J.find(F=>F.active),Y=J.find(F=>F.id===N),R=[ee,Y,...J].filter(Boolean).map(F=>F.ref.current);Xj(R,f)}}I.current=!1}),onBlur:ot(t.onBlur,()=>C(!1))})})}),Yj="RovingFocusGroupItem",Qj=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...c}=t,u=ha(),h=a||u,f=KR(Yj,n),m=f.currentTabStopId===h,g=qj(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:N}=f;return v.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),s.jsx(Rg.ItemSlot,{scope:n,id:h,focusable:r,active:i,children:s.jsx(ht.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:ot(t.onMouseDown,b=>{r?f.onItemFocus(h):b.preventDefault()}),onFocus:ot(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:ot(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){f.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const k=YR(b,f.orientation,f.dir);if(k!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const T=E.indexOf(b.currentTarget);E=f.loop?QR(E,T+1):E.slice(T+1)}setTimeout(()=>Xj(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:N!=null}):o})})});Qj.displayName=Yj;var GR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function YR(t,e,n){const r=JR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GR[r]}function Xj(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function QR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var XR=Jj,ZR=Qj,mf="Tabs",[eP]=Sa(mf,[Gj]),Zj=Gj(),[tP,qx]=eP(mf),ek=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=pf(c),[m,g]=po({prop:r,onChange:i,defaultProp:a??"",caller:mf});return s.jsx(tP,{scope:n,baseId:ha(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(ht.div,{dir:f,"data-orientation":o,...h,ref:e})})});ek.displayName=mf;var tk="TabsList",nk=v.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,a=qx(tk,n),o=Zj(n);return s.jsx(XR,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:s.jsx(ht.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:e})})});nk.displayName=tk;var rk="TabsTrigger",sk=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=t,o=qx(rk,n),c=Zj(n),u=ok(o.baseId,r),h=lk(o.baseId,r),f=r===o.value;return s.jsx(ZR,{asChild:!0,...c,focusable:!i,active:f,children:s.jsx(ht.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...a,ref:e,onMouseDown:ot(t.onMouseDown,m=>{!i&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:ot(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:ot(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!i&&m&&o.onValueChange(r)})})})});sk.displayName=rk;var ik="TabsContent",ak=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=t,c=qx(ik,n),u=ok(c.baseId,r),h=lk(c.baseId,r),f=r===c.value,m=v.useRef(f);return v.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(hd,{present:i||f,children:({present:g})=>s.jsx(ht.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})})});ak.displayName=ik;function ok(t,e){return`${t}-trigger-${e}`}function lk(t,e){return`${t}-content-${e}`}var nP=ek,ck=nk,dk=sk,uk=ak;const pd=nP,Ol=v.forwardRef(({className:t,...e},n)=>s.jsx(ck,{ref:n,className:Mt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Ol.displayName=ck.displayName;const an=v.forwardRef(({className:t,...e},n)=>s.jsx(dk,{ref:n,className:Mt("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}));an.displayName=dk.displayName;const on=v.forwardRef(({className:t,...e},n)=>s.jsx(uk,{ref:n,className:Mt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));on.displayName=uk.displayName;function Gx(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function Jx(t){const[e,n]=v.useState(void 0);return tr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[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 gf="Switch",[rP]=Sa(gf),[sP,iP]=rP(gf),hk=v.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=v.useState(null),w=Tt(e,E=>y(E)),N=v.useRef(!1),b=g?f||!!g.closest("form"):!0,[k,C]=po({prop:i,defaultProp:a??!1,onChange:h,caller:gf});return s.jsxs(sP,{scope:n,checked:k,disabled:c,children:[s.jsx(ht.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":gk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:w,onClick:ot(t.onClick,E=>{C(T=>!T),b&&(N.current=E.isPropagationStopped(),N.current||E.stopPropagation())})}),b&&s.jsx(mk,{control:g,bubbles:!N.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});hk.displayName=gf;var fk="SwitchThumb",pk=v.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=iP(fk,n);return s.jsx(ht.span,{"data-state":gk(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});pk.displayName=fk;var aP="SwitchBubbleInput",mk=v.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...i},a)=>{const o=v.useRef(null),c=Tt(o,a),u=Gx(n),h=Jx(e);return v.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const w=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(w)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:c,style:{...i.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});mk.displayName=aP;function gk(t){return t?"checked":"unchecked"}var xk=hk,oP=pk;const At=v.forwardRef(({className:t,...e},n)=>s.jsx(xk,{className:Mt("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:s.jsx(oP,{className:Mt("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")})}));At.displayName=xk.displayName;function Yx({open:t,onClose:e,userId:n,onUserUpdated:r}){var lr;const[i,a]=v.useState(null),[o,c]=v.useState([]),[u,h]=v.useState([]),[f,m]=v.useState(!1),[g,y]=v.useState(!1),[w,N]=v.useState(!1),[b,k]=v.useState("info"),[C,E]=v.useState(""),[T,I]=v.useState(""),[O,D]=v.useState([]),[P,L]=v.useState(""),[_,J]=v.useState(""),[ee,Y]=v.useState(""),[U,R]=v.useState(!1),[F,re]=v.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[z,ie]=v.useState([]),[G,$]=v.useState(!1),[V,ce]=v.useState(!1),[W,fe]=v.useState(null),[X,de]=v.useState(null),[he,be]=v.useState(""),[Te,Ve]=v.useState(""),[He,vt]=v.useState(""),[Dt,vn]=v.useState(!1),[pt,Rt]=v.useState(null),[ne,Pe]=v.useState("");v.useEffect(()=>{t&&n&&(k("info"),fe(null),de(null),Rt(null),Pe(""),J(""),Y(""),Ze(),Le("/api/db/vip-roles").then(me=>{me!=null&&me.success&&me.data&&ie(me.data)}).catch(()=>{}))},[t,n]);async function Ze(){if(n){m(!0);try{const me=await Le(`/api/db/users?id=${encodeURIComponent(n)}`);if(me!=null&&me.success&&me.user){const ye=me.user;a(ye),E(ye.phone||""),I(ye.nickname||""),be(ye.phone||""),Ve(ye.wechatId||""),vt(ye.openId||"");try{D(typeof ye.tags=="string"?JSON.parse(ye.tags||"[]"):[])}catch{D([])}re({isVip:!!(ye.isVip??!1),vipExpireDate:ye.vipExpireDate?String(ye.vipExpireDate).slice(0,10):"",vipRole:String(ye.vipRole??""),vipName:String(ye.vipName??""),vipProject:String(ye.vipProject??""),vipContact:String(ye.vipContact??""),vipBio:String(ye.vipBio??"")})}try{const ye=await Le(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);ye!=null&&ye.success&&ye.tracks&&c(ye.tracks)}catch{c([])}try{const ye=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ye!=null&&ye.success&&ye.referrals&&h(ye.referrals)}catch{h([])}}catch(me){console.error("Load user detail error:",me)}finally{m(!1)}}}async function bt(){if(!(i!=null&&i.phone)){ae.info("用户未绑定手机号,无法同步");return}y(!0);try{const me=await yt("/api/ckb/sync",{action:"full_sync",phone:i.phone,userId:i.id});me!=null&&me.success?(ae.success("同步成功"),Ze()):ae.error("同步失败: "+(me==null?void 0:me.error))}catch(me){console.error("Sync CKB error:",me),ae.error("同步失败")}finally{y(!1)}}async function mt(){if(i){N(!0);try{const me={id:i.id,phone:C||void 0,nickname:T||void 0,tags:JSON.stringify(O)},ye=await It("/api/db/users",me);ye!=null&&ye.success?(ae.success("保存成功"),Ze(),r==null||r()):ae.error("保存失败: "+(ye==null?void 0:ye.error))}catch(me){console.error("Save user error:",me),ae.error("保存失败")}finally{N(!1)}}}const gt=()=>{P&&!O.includes(P)&&(D([...O,P]),L(""))},St=me=>D(O.filter(ye=>ye!==me));async function nn(){if(i){if(!_){ae.error("请输入新密码");return}if(_!==ee){ae.error("两次密码不一致");return}if(_.length<6){ae.error("密码至少 6 位");return}R(!0);try{const me=await It("/api/db/users",{id:i.id,password:_});me!=null&&me.success?(ae.success("修改成功"),J(""),Y("")):ae.error("修改失败: "+((me==null?void 0:me.error)||""))}catch{ae.error("修改失败")}finally{R(!1)}}}async function Lt(){if(i){if(F.isVip&&!F.vipExpireDate.trim()){ae.error("开启 VIP 请填写有效到期日");return}$(!0);try{const me={id:i.id,isVip:F.isVip,vipExpireDate:F.isVip?F.vipExpireDate:void 0,vipRole:F.vipRole||void 0,vipName:F.vipName||void 0,vipProject:F.vipProject||void 0,vipContact:F.vipContact||void 0,vipBio:F.vipBio||void 0},ye=await It("/api/db/users",me);ye!=null&&ye.success?(ae.success("VIP 设置已保存"),Ze(),r==null||r()):ae.error("保存失败: "+((ye==null?void 0:ye.error)||""))}catch{ae.error("保存失败")}finally{$(!1)}}}async function An(){if(!he&&!He&&!Te){de("请至少输入手机号、微信号或 OpenID 中的一项");return}ce(!0),de(null),fe(null);try{const me=new URLSearchParams;he&&me.set("phone",he),He&&me.set("openId",He),Te&&me.set("wechatId",Te);const ye=await Le(`/api/admin/shensheshou/query?${me}`);ye!=null&&ye.success&&ye.data?(fe(ye.data),i&&await _t(ye.data)):de((ye==null?void 0:ye.error)||"未查询到数据,该用户可能未在神射手收录")}catch(me){console.error("SSS query error:",me),de("请求失败,请检查神射手接口配置")}finally{ce(!1)}}async function _t(me){if(i)try{await yt("/api/admin/shensheshou/enrich",{userId:i.id,phone:he||i.phone||"",openId:He||i.openId||"",wechatId:Te||i.wechatId||""}),Ze()}catch(ye){console.error("SSS enrich error:",ye)}}async function Gn(){if(i){vn(!0),Rt(null);try{const me={users:[{phone:i.phone||"",name:i.nickname||"",openId:i.openId||"",tags:O}]},ye=await yt("/api/admin/shensheshou/ingest",me);ye!=null&&ye.success&&ye.data?Rt(ye.data):Rt({error:(ye==null?void 0:ye.error)||"推送失败"})}catch(me){console.error("SSS ingest error:",me),Rt({error:"请求失败"})}finally{vn(!1)}}}const ts=me=>{const cr={view_chapter:Xr,purchase:Eg,match:qn,login:gl,register:gl,share:ys,bind_phone:dA,bind_wechat:ZM,fill_profile:Gu,visit_page:hl}[me]||jg;return s.jsx(cr,{className:"w-4 h-4"})};return t?s.jsx(Yt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(gl,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(i==null?void 0:i.phone)&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(i==null?void 0:i.isVip)&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i?s.jsxs("div",{className:"flex flex-col h-[75vh]",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:i.avatar?s.jsx("img",{src:i.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((lr=i.nickname)==null?void 0:lr.charAt(0))||"?"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h3",{className:"text-lg font-bold text-white",children:i.nickname}),i.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),i.hasFullBook&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),i.vipRole&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:i.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[i.phone?`📱 ${i.phone}`:"未绑定手机",i.wechatId&&` · 💬 ${i.wechatId}`,i.mbti&&` · ${i.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",i.id.slice(0,16),"…"]}),i.referralCode&&s.jsxs("p",{className:"text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"推广码:"}),s.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:i.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(i.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(pd,{value:b,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs(Ol,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[s.jsx(an,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),s.jsx(an,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),s.jsxs(an,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(hl,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),s.jsx(an,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),s.jsxs(an,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(aa,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),s.jsxs(on,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:C,onChange:me=>E(me.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:T,onChange:me=>I(me.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[i.openId&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),s.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:i.openId})]}),i.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(JN,{className:"w-4 h-4 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),s.jsx("p",{className:"text-white",children:i.region})]})]}),i.industry&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),s.jsx("p",{className:"text-white",children:i.industry})]}),i.position&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),s.jsx("p",{className:"text-white",children:i.position})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:i.referralCount??0})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),s.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(i.pendingEarnings??0).toFixed(2)]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),s.jsx("p",{className:"text-sm text-white",children:i.createdAt?new Date(i.createdAt).toLocaleDateString():"-"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(LM,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(oe,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:_,onChange:me=>J(me.target.value)}),s.jsx(oe,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:ee,onChange:me=>Y(me.target.value)}),s.jsx(te,{size:"sm",onClick:nn,disabled:U||!_||!ee,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:U?"保存中...":"确认修改"})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ml,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-400 text-sm",children:"VIP 会员"}),s.jsx(At,{checked:F.isVip,onCheckedChange:me=>re(ye=>({...ye,isVip:me}))})]}),F.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(oe,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:F.vipExpireDate,onChange:me=>re(ye=>({...ye,vipExpireDate:me.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:F.vipRole,onChange:me=>re(ye=>({...ye,vipRole:me.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),z.map(me=>s.jsx("option",{value:me.name,children:me.name},me.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:F.vipName,onChange:me=>re(ye=>({...ye,vipName:me.target.value}))})]}),s.jsx(te,{size:"sm",onClick:Lt,disabled:G,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:G?"保存中...":"保存 VIP"})]})]})]}),i.isVip&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ml,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:i.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[i.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:i.vipName})]}),i.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:i.vipProject})]}),i.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:i.vipContact})]}),i.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(i.vipExpireDate).toLocaleDateString()})]})]}),i.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:i.vipBio})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ho,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"微信归属"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:ne,onChange:me=>Pe(me.target.value)}),s.jsxs(te,{size:"sm",onClick:async()=>{if(!(!ne||!i))try{await It("/api/db/users",{id:i.id,wechatId:ne}),ae.success("已保存微信归属"),Ze()}catch{ae.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[s.jsx(xn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),i.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:i.wechatId})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ys,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(te,{size:"sm",onClick:bt,disabled:g||!i.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"同步状态:"}),i.ckbSyncedAt?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"最后同步:"}),s.jsx("span",{className:"text-gray-300 ml-1",children:i.ckbSyncedAt?new Date(i.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),s.jsxs(on,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Gu,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),s.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:[s.jsx(Ng,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),s.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(me=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:me.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:me.tags.map(ye=>s.jsxs("button",{type:"button",onClick:()=>{O.includes(ye)?St(ye):D([...O,ye])},className:`px-2 py-0.5 rounded text-xs border transition-all ${O.includes(ye)?"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:[O.includes(ye)?"✓ ":"",ye]},ye))})]},me.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[O.map((me,ye)=>s.jsxs(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[me,s.jsx("button",{type:"button",onClick:()=>St(me),className:"ml-1 hover:text-red-400",children:s.jsx(er,{className:"w-3 h-3"})})]},ye)),O.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:P,onChange:me=>L(me.target.value),onKeyDown:me=>me.key==="Enter"&>()}),s.jsx(te,{onClick:gt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),i.ckbTags&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Gu,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof i.ckbTags=="string"?i.ckbTags.split(","):[]).map((me,ye)=>s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:me.trim()},ye))})]})]}),s.jsxs(on,{value:"journey",className:"flex-1 overflow-auto",children:[s.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(hl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),s.jsx("div",{className:"space-y-2",children:o.length>0?o.map((me,ye)=>s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:ts(me.action)}),ye0?u.map((me,ye)=>{var Vs;const cr=me;return s.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((Vs=cr.nickname)==null?void 0:Vs.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:cr.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[cr.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-xs",children:cr.createdAt?new Date(cr.createdAt).toLocaleDateString():""})]})]},cr.id||ye)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),s.jsxs(on,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(aa,{className:"w-5 h-5 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:he,onChange:me=>be(me.target.value)})]}),s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:Te,onChange:me=>Ve(me.target.value)})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:He,onChange:me=>vt(me.target.value)})]})]}),s.jsx(te,{onClick:An,disabled:V,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:V?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ua,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),X&&s.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:X}),W&&s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),s.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:W.rfm_score??"-"})]}),s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:W.user_level??"-"})]})]}),W.tags&&W.tags.length>0&&s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:W.tags.map((me,ye)=>s.jsx(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:me},ye))})]}),W.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",W.last_active]})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx(aa,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),s.jsx(te,{onClick:Gn,disabled:Dt||!i.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Dt?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(aa,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!i.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),pt&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:pt.error?s.jsx("p",{className:"text-red-400",children:String(pt.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(Ng,{className:"w-4 h-4"})," 推送成功"]}),pt.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(pt.new_tags_added??0)]})]})})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[s.jsxs(te,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(te,{onClick:mt,disabled:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),w?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function lP(){const t=ka(),[e,n]=v.useState(!0),[r,i]=v.useState(!0),[a,o]=v.useState(!0),[c,u]=v.useState([]),[h,f]=v.useState([]),[m,g]=v.useState(0),[y,w]=v.useState(0),[N,b]=v.useState(0),[k,C]=v.useState(0),[E,T]=v.useState(null),[I,O]=v.useState(null),[D,P]=v.useState(!1),L=U=>{const R=U;if((R==null?void 0:R.status)===401)T("登录已过期,请重新登录");else{if((R==null?void 0:R.name)==="AbortError")return;T("加载失败,请检查网络或联系管理员")}};async function _(U){const R=U?{signal:U}:void 0;n(!0),T(null);try{const z=await Le("/api/admin/dashboard/stats",R);z!=null&&z.success&&(g(z.totalUsers??0),w(z.paidOrderCount??0),b(z.totalRevenue??0),C(z.conversionRate??0))}catch(z){if((z==null?void 0:z.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",z);try{const ie=await Le("/api/admin/dashboard/overview",R);ie!=null&&ie.success&&(g(ie.totalUsers??0),w(ie.paidOrderCount??0),b(ie.totalRevenue??0),C(ie.conversionRate??0))}catch(ie){L(ie)}}}finally{n(!1)}i(!0),o(!0);const F=async()=>{try{const z=await Le("/api/admin/dashboard/recent-orders",R);if(z!=null&&z.success&&z.recentOrders)f(z.recentOrders);else throw new Error("no data")}catch(z){if((z==null?void 0:z.name)!=="AbortError")try{const ie=await Le("/api/admin/orders?page=1&pageSize=20&status=paid",R),$=((ie==null?void 0:ie.orders)??[]).filter(V=>["paid","completed","success"].includes(V.status||""));f($.slice(0,5))}catch{f([])}}finally{i(!1)}},re=async()=>{try{const z=await Le("/api/admin/dashboard/new-users",R);if(z!=null&&z.success&&z.newUsers)u(z.newUsers);else throw new Error("no data")}catch(z){if((z==null?void 0:z.name)!=="AbortError")try{const ie=await Le("/api/db/users?page=1&pageSize=10",R);u((ie==null?void 0:ie.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([F(),re()])}v.useEffect(()=>{const U=new AbortController;_(U.signal);const R=setInterval(()=>_(),3e4);return()=>{U.abort(),clearInterval(R)}},[]);const J=m,ee=U=>{const R=U.productType||"",F=U.description||"";if(F){if(R==="section"&&F.includes("章节")){if(F.includes("-")){const re=F.split("-");if(re.length>=3)return{title:`第${re[1]}章 第${re[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:F,subtitle:"章节购买"}}return R==="fullbook"||F.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:R==="match"||F.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:F,subtitle:R==="section"?"单章":R==="fullbook"?"全书":"其他"}}return R==="section"?{title:`章节 ${U.productId||""}`,subtitle:"单章购买"}:R==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:R==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:R||"其他"}},Y=[{title:"总用户数",value:e?null:J,icon:qn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(N??0).toFixed(2)}`,icon:Dc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,icon:Eg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,icon:Xr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),E&&s.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:[s.jsx("span",{children:E}),s.jsx("button",{type:"button",onClick:()=>_(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:Y.map((U,R)=>s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>U.link&&t(U.link),children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(st,{className:"text-sm font-medium text-gray-400",children:U.title}),s.jsx("div",{className:`p-2 rounded-lg ${U.bg}`,children:s.jsx(U.icon,{className:`w-4 h-4 ${U.color}`})})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-[2rem] flex items-center",children:U.value!=null?U.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Je,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),s.jsx(ul,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},R))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsx(st,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>_(),disabled:r||a,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||a?s.jsx(Je,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Je,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Je,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,5).map(U=>{var ie;const R=U.referrerId?c.find(G=>G.id===U.referrerId):void 0,F=U.referralCode||(R==null?void 0:R.referralCode)||(R==null?void 0:R.nickname)||(U.referrerId?String(U.referrerId).slice(0,8):""),re=ee(U),z=U.userNickname||((ie=c.find(G=>G.id===U.userId))==null?void 0:ie.nickname)||"匿名用户";return s.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:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[U.userAvatar?s.jsx("img",{src:U.userAvatar,alt:z,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:G=>{G.currentTarget.style.display="none";const $=G.currentTarget.nextElementSibling;$&&$.classList.remove("hidden")}}):null,s.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 ${U.userAvatar?"hidden":""}`,children:z.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{U.userId&&(O(U.userId),P(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:z}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",children:re.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[re.subtitle&&re.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:re.subtitle}),s.jsx("span",{children:new Date(U.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),F&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",F]})]})]}),s.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(U.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:U.paymentMethod||"微信"})]})]},U.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Eg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"新注册用户"})}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-3",children:a&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Je,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(U=>{var R;return s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((R=U.nickname)==null?void 0:R.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{O(U.id),P(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:U.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:U.phone||"-"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:U.createdAt?new Date(U.createdAt).toLocaleDateString():"-"})]},U.id)}),c.length===0&&!a&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsx(Yx,{open:D,onClose:()=>{P(!1),O(null)},userId:I,onUserUpdated:()=>_()})]})}const nr=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Mt("w-full caption-bottom text-sm",t),...e})}));nr.displayName="Table";const rr=v.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Mt("[&_tr]:border-b",t),...e}));rr.displayName="TableHeader";const sr=v.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Mt("[&_tr:last-child]:border-0",t),...e}));sr.displayName="TableBody";const it=v.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Mt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));it.displayName="TableRow";const je=v.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Mt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableHead";const xe=v.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Mt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));xe.displayName="TableCell";function Qx(t,e){const[n,r]=v.useState(t);return v.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function vs({page:t,totalPages:e,total:n,pageSize:r,onPageChange:i,onPageSizeChange:a,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!a?null:s.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[s.jsxs("span",{children:["共 ",n," 条"]}),a&&s.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=>s.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>i(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:"首页"}),s.jsx("button",{type:"button",onClick:()=>i(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:"上一页"}),s.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),s.jsx("button",{type:"button",onClick:()=>i(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:"下一页"}),s.jsx("button",{type:"button",onClick:()=>i(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 cP(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[i,a]=v.useState(0),[o,c]=v.useState(0),[u,h]=v.useState(0),[f,m]=v.useState(1),[g,y]=v.useState(10),[w,N]=v.useState(""),b=Qx(w,300),[k,C]=v.useState("all"),[E,T]=v.useState(!0),[I,O]=v.useState(null),[D,P]=v.useState(null),[L,_]=v.useState(""),[J,ee]=v.useState(!1);async function Y(){T(!0),O(null);try{const G=k==="all"?"":k==="completed"?"completed":k,$=new URLSearchParams({page:String(f),pageSize:String(g),...G&&{status:G},...b&&{search:b}}),[V,ce]=await Promise.all([Le(`/api/admin/orders?${$}`),Le("/api/db/users?page=1&pageSize=500")]);V!=null&&V.success&&(e(V.orders||[]),a(V.total??0),c(V.totalRevenue??0),h(V.todayRevenue??0)),ce!=null&&ce.success&&ce.users&&r(ce.users)}catch(G){console.error("加载订单失败",G),O("加载订单失败,请检查网络后重试")}finally{T(!1)}}v.useEffect(()=>{m(1)},[b,k]),v.useEffect(()=>{Y()},[f,g,b,k]);const U=G=>{var $;return G.userNickname||(($=n.find(V=>V.id===G.userId))==null?void 0:$.nickname)||"匿名用户"},R=G=>{var $;return(($=n.find(V=>V.id===G))==null?void 0:$.phone)||"-"},F=G=>{const $=G.productType||G.type||"",V=G.description||"";if(V){if($==="section"&&V.includes("章节")){if(V.includes("-")){const ce=V.split("-");if(ce.length>=3)return{name:`第${ce[1]}章 第${ce[2]}节`,type:"《一场Soul的创业实验》"}}return{name:V,type:"章节购买"}}return $==="fullbook"||V.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:$==="vip"||V.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:$==="match"||V.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:V,type:"其他"}}return $==="section"?{name:`章节 ${G.productId||G.sectionId||""}`,type:"单章"}:$==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:$==="vip"?{name:"VIP年度会员",type:"VIP"}:$==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:$||"其他"}},re=Math.ceil(i/g)||1;async function z(){var G;if(!(!(D!=null&&D.orderSn)&&!(D!=null&&D.id))){ee(!0),O(null);try{const $=await It("/api/admin/orders/refund",{orderSn:D.orderSn||D.id,reason:L||void 0});$!=null&&$.success?(P(null),_(""),Y()):O(($==null?void 0:$.error)||"退款失败")}catch($){const V=$;O(((G=V==null?void 0:V.data)==null?void 0:G.error)||"退款失败,请检查网络后重试")}finally{ee(!1)}}}function ie(){if(t.length===0){ae.info("暂无数据可导出");return}const G=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],$=t.map(X=>{const de=F(X);return[X.orderSn||X.id||"",U(X),R(X.userId),de.name,Number(X.amount||0).toFixed(2),X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付",X.status==="refunded"?"已退款":X.status==="paid"||X.status==="completed"?"已完成":X.status==="pending"||X.status==="created"?"待支付":"已失败",X.status==="refunded"&&X.refundReason?X.refundReason:"-",X.referrerEarnings?Number(X.referrerEarnings).toFixed(2):"-",X.createdAt?new Date(X.createdAt).toLocaleString("zh-CN"):""].join(",")}),V="\uFEFF"+[G.join(","),...$].join(` +`),ce=new Blob([V],{type:"text/csv;charset=utf-8"}),W=URL.createObjectURL(ce),fe=document.createElement("a");fe.href=W,fe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,fe.click(),URL.revokeObjectURL(W)}return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>O(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(te,{variant:"outline",onClick:Y,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(oe,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:w,onChange:G=>N(G.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qN,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:G=>C(G.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(te,{variant:"outline",onClick:ie,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(aM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:E?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"订单号"}),s.jsx(je,{className:"text-gray-400",children:"用户"}),s.jsx(je,{className:"text-gray-400",children:"商品"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"支付方式"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"退款原因"}),s.jsx(je,{className:"text-gray-400",children:"分销佣金"}),s.jsx(je,{className:"text-gray-400",children:"下单时间"}),s.jsx(je,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(sr,{children:[t.map(G=>{const $=F(G);return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(xe,{className:"font-mono text-xs text-gray-400",children:[(G.orderSn||G.id||"").slice(0,12),"..."]}),s.jsx(xe,{children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:U(G)}),s.jsx("p",{className:"text-gray-500 text-xs",children:R(G.userId)})]})}),s.jsx(xe,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[$.name,(G.productType||G.type)==="vip"&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:$.type})]})}),s.jsxs(xe,{className:"text-[#38bdac] font-bold",children:["¥",Number(G.amount||0).toFixed(2)]}),s.jsx(xe,{className:"text-gray-300",children:G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付"}),s.jsx(xe,{children:G.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):G.status==="paid"||G.status==="completed"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):G.status==="pending"||G.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),s.jsx(xe,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:G.refundReason,children:G.status==="refunded"&&G.refundReason?G.refundReason:"-"}),s.jsx(xe,{className:"text-[#FFD700]",children:G.referrerEarnings?`¥${Number(G.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(xe,{className:"text-gray-400 text-sm",children:new Date(G.createdAt).toLocaleString("zh-CN")}),s.jsx(xe,{children:(G.status==="paid"||G.status==="completed")&&s.jsxs(te,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{P(G),_("")},children:[s.jsx(QN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},G.id)}),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(vs,{page:f,totalPages:re,total:i,pageSize:g,onPageChange:m,onPageSizeChange:G=>{y(G),m(1)}})]})})}),s.jsx(Yt,{open:!!D,onOpenChange:G=>!G&&P(null),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"订单退款"})}),D&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",D.orderSn||D.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(D.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:L,onChange:G=>_(G.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>P(null),disabled:J,children:"取消"}),s.jsx(te,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:z,disabled:J,children:J?"退款中...":"确认退款"})]})]})})]})}const Dl=v.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Mt("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}));Dl.displayName="Textarea";const Au=[{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 dP(){var Ti,Mi,ks,La,Ai;const[t,e]=FN(),n=t.get("pool"),[r,i]=v.useState([]),[a,o]=v.useState(0),[c,u]=v.useState(1),[h,f]=v.useState(10),[m,g]=v.useState(""),y=Qx(m,300),w=n==="vip"?"vip":n==="complete"?"complete":"all",[N,b]=v.useState(w),[k,C]=v.useState(!0),[E,T]=v.useState(!1),[I,O]=v.useState(null),[D,P]=v.useState(!1),[L,_]=v.useState("desc");v.useEffect(()=>{n==="vip"?b("vip"):n==="complete"?b("complete"):n==="all"&&b("all")},[n]);const[J,ee]=v.useState(!1),[Y,U]=v.useState(null),[R,F]=v.useState(!1),[re,z]=v.useState(!1),[ie,G]=v.useState({referrals:[],stats:{}}),[$,V]=v.useState(!1),[ce,W]=v.useState(null),[fe,X]=v.useState(!1),[de,he]=v.useState(null),[be,Te]=v.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Ve,He]=v.useState([]),[vt,Dt]=v.useState(!1),[vn,pt]=v.useState(!1),[Rt,ne]=v.useState(null),[Pe,Ze]=v.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[bt,mt]=v.useState([]),[gt,St]=v.useState(!1),[nn,Lt]=v.useState(null),[An,_t]=v.useState(null),[Gn,ts]=v.useState({}),[lr,me]=v.useState(!1);async function ye(H=!1){var Re;C(!0),H&&T(!0),O(null);try{if(D){const Ye=new URLSearchParams({search:y,limit:String(h*5)}),tt=await Le(`/api/db/users/rfm?${Ye}`);if(tt!=null&&tt.success){let In=tt.users||[];L==="asc"&&(In=[...In].reverse());const ur=(c-1)*h;i(In.slice(ur,ur+h)),o(((Re=tt.users)==null?void 0:Re.length)??0),In.length===0&&(P(!1),O("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else P(!1),O((tt==null?void 0:tt.error)||"RFM 加载失败,已切回普通模式")}else{const Ye=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...N==="vip"&&{vip:"true"},...N==="complete"&&{pool:"complete"}}),tt=await Le(`/api/db/users?${Ye}`);tt!=null&&tt.success?(i(tt.users||[]),o(tt.total??0)):O((tt==null?void 0:tt.error)||"加载失败")}}catch(Ye){console.error("Load users error:",Ye),O("网络错误")}finally{C(!1),H&&T(!1)}}v.useEffect(()=>{u(1)},[y,N,D]),v.useEffect(()=>{ye()},[c,h,y,N,D,L]);const cr=Math.ceil(a/h)||1,Vs=()=>{D?L==="desc"?_("asc"):(P(!1),_("desc")):(P(!0),_("desc"))},Ni=H=>({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"})[H||""]||"bg-gray-500/20 text-gray-400";async function ji(H){if(confirm("确定要删除这个用户吗?"))try{const Re=await Rs(`/api/db/users?id=${encodeURIComponent(H)}`);Re!=null&&Re.success?ye():ae.error("删除失败: "+((Re==null?void 0:Re.error)||""))}catch{ae.error("删除失败")}}const Cr=H=>{U(H),Te({phone:H.phone||"",nickname:H.nickname||"",password:"",isAdmin:!!(H.isAdmin??!1),hasFullBook:!!(H.hasFullBook??!1)}),ee(!0)},Ia=()=>{U(null),Te({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),ee(!0)};async function zr(){if(!be.phone||!be.nickname){ae.error("请填写手机号和昵称");return}F(!0);try{if(Y){const H=await It("/api/db/users",{id:Y.id,phone:be.phone||void 0,nickname:be.nickname,isAdmin:be.isAdmin,hasFullBook:be.hasFullBook,...be.password&&{password:be.password}});if(!(H!=null&&H.success)){ae.error("更新失败: "+((H==null?void 0:H.error)||""));return}}else{const H=await yt("/api/db/users",{phone:be.phone,nickname:be.nickname,password:be.password,isAdmin:be.isAdmin});if(!(H!=null&&H.success)){ae.error("创建失败: "+((H==null?void 0:H.error)||""));return}}ee(!1),ye()}catch{ae.error("保存失败")}finally{F(!1)}}async function ns(H){W(H),z(!0),V(!0);try{const Re=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(H.id)}`);Re!=null&&Re.success?G({referrals:Re.referrals||[],stats:Re.stats||{}}):G({referrals:[],stats:{}})}catch{G({referrals:[],stats:{}})}finally{V(!1)}}const dr=v.useCallback(async()=>{Dt(!0);try{const H=await Le("/api/db/user-rules");H!=null&&H.success&&He(H.rules||[])}catch{}finally{Dt(!1)}},[]);async function ki(){if(!Pe.title){ae.error("请填写规则标题");return}F(!0);try{if(Rt){const H=await It("/api/db/user-rules",{id:Rt.id,...Pe});if(!(H!=null&&H.success)){ae.error("更新失败: "+((H==null?void 0:H.error)||""));return}}else{const H=await yt("/api/db/user-rules",Pe);if(!(H!=null&&H.success)){ae.error("创建失败: "+((H==null?void 0:H.error)||""));return}}pt(!1),dr()}catch{ae.error("保存失败")}finally{F(!1)}}async function Ra(H){if(confirm("确定删除?"))try{const Re=await Rs(`/api/db/user-rules?id=${H}`);Re!=null&&Re.success&&dr()}catch{}}async function Hs(H){try{await It("/api/db/user-rules",{id:H.id,enabled:!H.enabled}),dr()}catch{}}const lt=v.useCallback(async()=>{St(!0);try{const H=await Le("/api/db/vip-members?limit=500");if(H!=null&&H.success&&H.data){const Re=[...H.data].map((Ye,tt)=>({...Ye,vipSort:typeof Ye.vipSort=="number"?Ye.vipSort:tt+1}));Re.sort((Ye,tt)=>(Ye.vipSort??999999)-(tt.vipSort??999999)),mt(Re)}else H&&H.error&&ae.error(H.error)}catch{ae.error("加载超级个体列表失败")}finally{St(!1)}},[]),[zn,rs]=v.useState(!1),[Er,ss]=v.useState(null),[ln,$r]=v.useState(""),[Ws,Fr]=v.useState(!1),Us=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],Sn=H=>{ss(H),$r(H.vipRole||""),rs(!0)},is=async H=>{const Re=H.trim();if(Er){if(!Re){ae.error("请选择或输入标签");return}Fr(!0);try{const Ye=await It("/api/db/users",{id:Er.id,vipRole:Re});if(!(Ye!=null&&Ye.success)){ae.error((Ye==null?void 0:Ye.error)||"更新超级个体标签失败");return}ae.success("已更新超级个体标签"),rs(!1),ss(null),await lt()}catch{ae.error("更新超级个体标签失败")}finally{Fr(!1)}}},[Bl,Si]=v.useState(!1),[Ks,xr]=v.useState(null),[Pa,Ci]=v.useState(""),[as,Br]=v.useState(!1),Oa=H=>{xr(H),Ci(H.vipSort!=null?String(H.vipSort):""),Si(!0)},Ei=async()=>{if(!Ks)return;const H=Number(Pa);if(!Number.isFinite(H)){ae.error("请输入有效的数字序号");return}Br(!0);try{const Re=await It("/api/db/users",{id:Ks.id,vipSort:H});if(!(Re!=null&&Re.success)){ae.error((Re==null?void 0:Re.error)||"更新排序序号失败");return}ae.success("已更新排序序号"),Si(!1),xr(null),await lt()}catch{ae.error("更新排序序号失败")}finally{Br(!1)}},Mo=(H,Re)=>{H.dataTransfer.effectAllowed="move",H.dataTransfer.setData("text/plain",Re),Lt(Re)},qs=(H,Re)=>{H.preventDefault(),An!==Re&&_t(Re)},Da=()=>{Lt(null),_t(null)},zt=async(H,Re)=>{H.preventDefault();const Ye=H.dataTransfer.getData("text/plain")||nn;if(Lt(null),_t(null),!Ye||Ye===Re)return;const tt=bt.find(Zt=>Zt.id===Ye),In=bt.find(Zt=>Zt.id===Re);if(!tt||!In)return;const ur=tt.vipSort??bt.findIndex(Zt=>Zt.id===Ye)+1,Ao=In.vipSort??bt.findIndex(Zt=>Zt.id===Re)+1;mt(Zt=>{const $n=[...Zt],ls=$n.findIndex(Ii=>Ii.id===Ye),Ss=$n.findIndex(Ii=>Ii.id===Re);if(ls===-1||Ss===-1)return Zt;const Js=[...$n],[Vl,_a]=[Js[ls],Js[Ss]];return Js[ls]={..._a,vipSort:ur},Js[Ss]={...Vl,vipSort:Ao},Js});try{const[Zt,$n]=await Promise.all([It("/api/db/users",{id:Ye,vipSort:Ao}),It("/api/db/users",{id:Re,vipSort:ur})]);if(!(Zt!=null&&Zt.success)||!($n!=null&&$n.success)){ae.error((Zt==null?void 0:Zt.error)||($n==null?void 0:$n.error)||"更新排序失败"),await lt();return}ae.success("已更新排序"),await lt()}catch{ae.error("更新排序失败"),await lt()}},Gs=v.useCallback(async()=>{me(!0);try{const H=await Le("/api/db/users/journey-stats");H!=null&&H.success&&H.stats&&ts(H.stats)}catch{}finally{me(!1)}},[]);return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>O(null),children:"×"})]}),s.jsx("div",{className:"flex justify-between items-center mb-6",children:s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",a," 位注册用户",D&&" · RFM 排序中"]})]})}),s.jsxs(pd,{defaultValue:"users",className:"w-full",children:[s.jsxs(Ol,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(an,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(qn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(an,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Gs,children:[s.jsx(hl,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(an,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:dr,children:[s.jsx(io,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(an,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:lt,children:[s.jsx(ml,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(on,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(te,{variant:"outline",onClick:()=>ye(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:N,onChange:H=>{const Re=H.target.value;b(Re),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:[s.jsx("option",{value:"all",children:"全部用户"}),s.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),s.jsx("option",{value:"complete",children:"完善资料用户"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(oe,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:H=>g(H.target.value)})]}),s.jsxs(te,{onClick:Ia,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"用户信息"}),s.jsx(je,{className:"text-gray-400",children:"绑定信息"}),s.jsx(je,{className:"text-gray-400",children:"购买状态"}),s.jsx(je,{className:"text-gray-400",children:"分销收益"}),s.jsxs(je,{className:"text-gray-400 cursor-pointer select-none",onClick:Vs,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Dc,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),D?L==="desc"?s.jsx(Jc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(VN,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Nm,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),D&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(je,{className:"text-gray-400",children:"注册时间"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(sr,{children:[r.map(H=>{var Re,Ye,tt;return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:H.avatar?s.jsx("img",{src:H.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Re=H.nickname)==null?void 0:Re.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{he(H.id),X(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:H.nickname}),H.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),H.openId&&!((Ye=H.id)!=null&&Ye.startsWith("user_"))&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsx("p",{className:"text-xs text-gray-500 font-mono",children:H.openId?H.openId.slice(0,12)+"...":(tt=H.id)==null?void 0:tt.slice(0,12)})]})]})}),s.jsx(xe,{children:s.jsxs("div",{className:"space-y-1",children:[H.phone&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"📱"}),s.jsx("span",{className:"text-gray-300",children:H.phone})]}),H.wechatId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"💬"}),s.jsx("span",{className:"text-gray-300",children:H.wechatId})]}),H.openId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"🔗"}),s.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:H.openId,children:[H.openId.slice(0,12),"..."]})]}),!H.phone&&!H.wechatId&&!H.openId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(xe,{children:H.hasFullBook?s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),s.jsx(xe,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(H.earnings||0)).toFixed(2)]}),parseFloat(String(H.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(H.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>ns(H),role:"button",tabIndex:0,onKeyDown:In=>In.key==="Enter"&&ns(H),children:[s.jsx(qn,{className:"w-3 h-3"})," 绑定",H.referralCount||0,"人"]})]})}),s.jsx(xe,{children:H.rfmScore!==void 0?s.jsx("div",{className:"flex flex-col gap-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:H.rfmScore}),s.jsx(Ue,{className:`border-0 text-xs ${Ni(H.rfmLevel)}`,children:H.rfmLevel})]})}):s.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",s.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),s.jsx(xe,{className:"text-gray-400",children:H.createdAt?new Date(H.createdAt).toLocaleDateString():"-"}),s.jsx(xe,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{he(H.id),X(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(kg,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Cr(H),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>ji(H.id),title:"删除",children:s.jsx(Hn,{className:"w-4 h-4"})})]})})]},H.id)}),r.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(vs,{page:c,totalPages:cr,total:a,pageSize:h,onPageChange:u,onPageSizeChange:H=>{f(H),u(1)}})]})})})]}),s.jsxs(on,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(te,{variant:"outline",onClick:Gs,disabled:lr,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${lr?"animate-spin":""}`})," 刷新数据"]})]}),s.jsxs("div",{className:"relative mb-8",children:[s.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"}),s.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:Au.map((H,Re)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${H.color} text-center cursor-default`,children:[s.jsx("div",{className:"text-2xl mb-1",children:H.icon}),s.jsx("div",{className:`text-xs font-medium ${H.color.split(" ").find(Ye=>Ye.startsWith("text-"))}`,children:H.label}),Gn[H.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Gn[H.id]})," 人"]}),s.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:Re+1})]}),Res.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:H.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:H.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",H.next]})]})]},H.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Xr,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),lr?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Je,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Gn).length>0?s.jsx("div",{className:"space-y-2",children:Au.map(H=>{const Re=Gn[H.id]||0,Ye=Math.max(...Au.map(In=>Gn[In.id]||0),1),tt=Math.round(Re/Ye*100);return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[H.icon," ",H.label]}),s.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${tt}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Re})]},H.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),s.jsxs(on,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(te,{variant:"outline",onClick:dr,disabled:vt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${vt?"animate-spin":""}`})," 刷新"]}),s.jsxs(te,{onClick:()=>{ne(null),Ze({title:"",description:"",trigger:"",sort:0,enabled:!0}),pt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(un,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),vt?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Ve.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Xr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(te,{onClick:dr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Je,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Ve.map(H=>s.jsx("div",{className:`p-4 rounded-lg border transition-all ${H.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.jsx(Ft,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium",children:H.title}),H.trigger&&s.jsxs(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",H.trigger]}),s.jsx(Ue,{className:`text-xs border-0 ${H.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:H.enabled?"启用":"禁用"})]}),H.description&&s.jsx("p",{className:"text-gray-400 text-sm ml-6",children:H.description})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[s.jsx(At,{checked:H.enabled,onCheckedChange:()=>Hs(H)}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{ne(H),Ze({title:H.title,description:H.description,trigger:H.trigger,sort:H.sort,enabled:H.enabled}),pt(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Ra(H.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Hn,{className:"w-4 h-4"})})]})]})},H.id))})]}),s.jsxs(on,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(te,{variant:"outline",onClick:lt,disabled:gt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${gt?"animate-spin":""}`})," ","刷新"]})})]}),gt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):bt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(ml,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-16",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),s.jsx(je,{className:"text-gray-400 w-24",children:"排序值"}),s.jsx(je,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),s.jsx(sr,{children:bt.map((H,Re)=>{var In;const Ye=nn===H.id,tt=An===H.id;return s.jsxs(it,{draggable:!0,onDragStart:ur=>Mo(ur,H.id),onDragOver:ur=>qs(ur,H.id),onDrop:ur=>zt(ur,H.id),onDragEnd:Da,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Ye?"opacity-60":""} ${tt?"bg-[#38bdac]/10":""}`,children:[s.jsx(xe,{className:"text-gray-300",children:Re+1}),s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[H.avatar?s.jsx("img",{src:H.avatar,className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((In=H.name)==null?void 0:In[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:H.name})})]})}),s.jsx(xe,{className:"text-gray-300 whitespace-nowrap",children:H.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(xe,{className:"text-gray-300",children:H.vipSort??Re+1}),s.jsx(xe,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>Sn(H),title:"设置超级个体标签",children:s.jsx(Gu,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{he(H.id),X(!0)},title:"编辑资料",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Oa(H),title:"设置排序序号",children:s.jsx(Nm,{className:"w-3.5 h-3.5"})})]})})]},H.id)})})]})})})]})]}),s.jsx(Yt,{open:Bl,onOpenChange:H=>{Si(H),H||xr(null)},children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(Nm,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",Ks==null?void 0:Ks.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:Pa,onChange:H=>Ci(H.target.value)})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>Si(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:Ei,disabled:as,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),as?"保存中...":"保存"]})]})]})}),s.jsx(Yt,{open:zn,onOpenChange:H=>{rs(H),H||ss(null)},children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(ml,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Er==null?void 0:Er.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Us.map(H=>s.jsx(te,{variant:ln===H?"default":"outline",size:"sm",className:ln===H?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>$r(H),children:H},H))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:ln,onChange:H=>$r(H.target.value)})]})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>rs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:()=>is(ln),disabled:Ws,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),Ws?"保存中...":"保存"]})]})]})}),s.jsx(Yt,{open:J,onOpenChange:ee,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[Y?s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Tg,{className:"w-5 h-5 text-[#38bdac]"}),Y?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:be.phone,onChange:H=>Te({...be,phone:H.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:be.nickname,onChange:H=>Te({...be,nickname:H.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:Y?"新密码 (留空则不修改)":"密码"}),s.jsx(oe,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:Y?"留空则不修改":"请输入密码",value:be.password,onChange:H=>Te({...be,password:H.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"管理员权限"}),s.jsx(At,{checked:be.isAdmin,onCheckedChange:H=>Te({...be,isAdmin:H})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"已购全书"}),s.jsx(At,{checked:be.hasFullBook,onCheckedChange:H=>Te({...be,hasFullBook:H})})]})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>ee(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:zr,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Yt,{open:vn,onOpenChange:pt,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),Rt?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Pe.title,onChange:H=>Ze({...Pe,title:H.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则描述"}),s.jsx(Dl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Pe.description,onChange:H=>Ze({...Pe,description:H.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"触发条件"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Pe.trigger,onChange:H=>Ze({...Pe,trigger:H.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(Z,{className:"text-gray-300",children:"启用状态"})}),s.jsx(At,{checked:Pe.enabled,onCheckedChange:H=>Ze({...Pe,enabled:H})})]})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>pt(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:ki,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Yt,{open:re,onOpenChange:z,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",ce==null?void 0:ce.nickname]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((Ti=ie.stats)==null?void 0:Ti.total)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Mi=ie.stats)==null?void 0:Mi.purchased)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((ks=ie.stats)==null?void 0:ks.earnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((La=ie.stats)==null?void 0:La.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),$?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Je,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Ai=ie.referrals)==null?void 0:Ai.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(ie.referrals??[]).map((H,Re)=>{var tt;const Ye=H;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((tt=Ye.nickname)==null?void 0:tt.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Ye.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Ye.phone||(Ye.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Ye.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ye.status==="paid"&&s.jsxs(Ue,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ye.purchasedSections,"章"]}),Ye.status==="free"&&s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Ye.createdAt?new Date(Ye.createdAt).toLocaleDateString():""})]})]},Ye.id||Re)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(fn,{children:s.jsx(te,{variant:"outline",onClick:()=>z(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(Yx,{open:fe,onClose:()=>X(!1),userId:de,onUserUpdated:ye})]})}function hh(t,[e,n]){return Math.min(n,Math.max(e,t))}var yk=["PageUp","PageDown"],vk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],bk={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ll="Slider",[Pg,uP,hP]=Kx(Ll),[wk]=Sa(Ll,[hP]),[fP,xf]=wk(Ll),Nk=v.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=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:w,...N}=t,b=v.useRef(new Set),k=v.useRef(0),E=o==="horizontal"?pP:mP,[T=[],I]=po({prop:f,defaultProp:h,onChange:J=>{var Y;(Y=[...b.current][k.current])==null||Y.focus(),m(J)}}),O=v.useRef(T);function D(J){const ee=bP(T,J);_(J,ee)}function P(J){_(J,k.current)}function L(){const J=O.current[k.current];T[k.current]!==J&&g(T)}function _(J,ee,{commit:Y}={commit:!1}){const U=kP(a),R=SP(Math.round((J-r)/a)*a+r,U),F=hh(R,[r,i]);I((re=[])=>{const z=yP(re,F,ee);if(jP(z,u*a)){k.current=z.indexOf(F);const ie=String(z)!==String(re);return ie&&Y&&g(z),ie?z:re}else return re})}return s.jsx(fP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:k,thumbs:b.current,values:T,orientation:o,form:w,children:s.jsx(Pg.Provider,{scope:t.__scopeSlider,children:s.jsx(Pg.Slot,{scope:t.__scopeSlider,children:s.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...N,ref:e,onPointerDown:ot(N.onPointerDown,()=>{c||(O.current=T)}),min:r,max:i,inverted:y,onSlideStart:c?void 0:D,onSlideMove:c?void 0:P,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&_(r,0,{commit:!0}),onEndKeyDown:()=>!c&&_(i,T.length-1,{commit:!0}),onStepKeyDown:({event:J,direction:ee})=>{if(!c){const R=yk.includes(J.key)||J.shiftKey&&vk.includes(J.key)?10:1,F=k.current,re=T[F],z=a*R*ee;_(re+z,F,{commit:!0})}}})})})})});Nk.displayName=Ll;var[jk,kk]=wk(Ll,{startEdge:"left",endEdge:"right",size:"width",direction:1}),pP=v.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=v.useState(null),y=Tt(e,E=>g(E)),w=v.useRef(void 0),N=pf(i),b=N==="ltr",k=b&&!a||!b&&a;function C(E){const T=w.current||m.getBoundingClientRect(),I=[0,T.width],D=Xx(I,k?[n,r]:[r,n]);return w.current=T,D(E-T.left)}return s.jsx(jk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(Sk,{dir:N,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const T=C(E.clientX);o==null||o(T)},onSlideMove:E=>{const T=C(E.clientX);c==null||c(T)},onSlideEnd:()=>{w.current=void 0,u==null||u()},onStepKeyDown:E=>{const I=bk[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:I?-1:1})}})})}),mP=v.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=v.useRef(null),m=Tt(e,f),g=v.useRef(void 0),y=!i;function w(N){const b=g.current||f.current.getBoundingClientRect(),k=[0,b.height],E=Xx(k,y?[r,n]:[n,r]);return g.current=b,E(N-b.top)}return s.jsx(jk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(Sk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const b=w(N.clientY);a==null||a(b)},onSlideMove:N=>{const b=w(N.clientY);o==null||o(b)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:N=>{const k=bk[y?"from-bottom":"from-top"].includes(N.key);u==null||u({event:N,direction:k?-1:1})}})})}),Sk=v.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=xf(Ll,n);return s.jsx(ht.span,{...h,ref:e,onKeyDown:ot(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):yk.concat(vk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:ot(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:ot(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&i(m)}),onPointerUp:ot(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),a(m))})})}),Ck="SliderTrack",Ek=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=xf(Ck,n);return s.jsx(ht.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});Ek.displayName=Ck;var Og="SliderRange",Tk=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=xf(Og,n),a=kk(Og,n),o=v.useRef(null),c=Tt(e,o),u=i.values.length,h=i.values.map(g=>Ik(g,i.min,i.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(ht.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[a.startEdge]:f+"%",[a.endEdge]:m+"%"}})});Tk.displayName=Og;var Dg="SliderThumb",Mk=v.forwardRef((t,e)=>{const n=uP(t.__scopeSlider),[r,i]=v.useState(null),a=Tt(e,c=>i(c)),o=v.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(gP,{...t,ref:a,index:o})}),gP=v.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...a}=t,o=xf(Dg,n),c=kk(Dg,n),[u,h]=v.useState(null),f=Tt(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=Jx(u),y=o.values[r],w=y===void 0?0:Ik(y,o.min,o.max),N=vP(r,o.values.length),b=g==null?void 0:g[c.size],k=b?wP(b,w,c.direction):0;return v.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${w}% + ${k}px)`},children:[s.jsx(Pg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(ht.span,{role:"slider","aria-label":t["aria-label"]||N,"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:ot(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(Ak,{name:i??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Mk.displayName=Dg;var xP="RadioBubbleInput",Ak=v.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const i=v.useRef(null),a=Tt(i,r),o=Gx(e);return v.useEffect(()=>{const c=i.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]),s.jsx(ht.input,{style:{display:"none"},...n,ref:a,defaultValue:e})});Ak.displayName=xP;function yP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,a)=>i-a)}function Ik(t,e,n){const a=100/(n-e)*(t-e);return hh(a,[0,100])}function vP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function bP(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function wP(t,e,n){const r=t/2,a=Xx([0,50],[0,r]);return(r-a(e)*n)*n}function NP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function jP(t,e){if(e>0){const n=NP(t);return Math.min(...n)>=e}return!0}function Xx(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 kP(t){return(String(t).split(".")[1]||"").length}function SP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var CP=Nk,EP=Ek,TP=Tk,MP=Mk;function AP({className:t,defaultValue:e,value:n,min:r=0,max:i=100,...a}){const o=v.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,i],[n,e,r,i]);return s.jsxs(CP,{defaultValue:e,value:n,min:r,max:i,className:Mt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...a,children:[s.jsx(EP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(TP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(MP,{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 IP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function Rk(t){const[e,n]=v.useState(IP),[r,i]=v.useState(!0),[a,o]=v.useState(!1);v.useEffect(()=>{Le("/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(()=>i(!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 yt("/api/admin/referral-settings",h);if(!f||f.success===!1){ae.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}ae.success(`✅ 分销配置已保存成功! • 小程序与网站的推广规则会一起生效 • 绑定关系会使用新的天数配置 • 佣金比例会立即应用到新订单 -如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),ae.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?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(jl,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),s.jsxs(te,{onClick:c,disabled:a||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(lA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx($t,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(bu,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Un,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(AP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(oe,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(bu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(bu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Un,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(oe,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(jl,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx($t,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(oe,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ue,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(Et,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(bu,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ae,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[s.jsxs("p",{children:["1. 以上配置会写入"," ",s.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),s.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),s.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function RP(){var At;const[t,e]=v.useState("overview"),[n,r]=v.useState([]),[i,a]=v.useState(null),[o,c]=v.useState([]),[u,h]=v.useState([]),[f,m]=v.useState([]),[g,y]=v.useState(!0),[w,N]=v.useState(null),[b,k]=v.useState(""),[C,E]=v.useState("all"),[T,I]=v.useState(1),[O,D]=v.useState(10),[P,L]=v.useState(0),[_,J]=v.useState(new Set),[ee,Y]=v.useState(null),[U,R]=v.useState(""),[F,re]=v.useState(!1),[z,ie]=v.useState(null),[G,$]=v.useState(""),[H,ce]=v.useState(!1);v.useEffect(()=>{W()},[]),v.useEffect(()=>{I(1)},[t,C]),v.useEffect(()=>{fe(t)},[t]),v.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&fe(t,!0)},[T,O,C,b]);async function W(){N(null);try{const ne=await Le("/api/admin/distribution/overview");ne!=null&&ne.success&&ne.overview&&a(ne.overview)}catch(ne){console.error("[Admin] 概览接口异常:",ne),N("加载概览失败")}try{const ne=await Le("/api/db/users");m((ne==null?void 0:ne.users)||[])}catch(ne){console.error("[Admin] 用户数据加载失败:",ne)}}async function fe(ne,Pe=!1){var Qe;if(!(!Pe&&_.has(ne))){y(!0);try{const xt=f;switch(ne){case"overview":break;case"orders":{try{const ft=new URLSearchParams({page:String(T),pageSize:String(O),...C!=="all"&&{status:C},...b&&{search:b}}),pt=await Le(`/api/admin/orders?${ft}`);if(pt!=null&&pt.success&&pt.orders){const Nt=pt.orders.map(Xt=>{const Ot=xt.find(Dt=>Dt.id===Xt.userId),Tn=Xt.referrerId?xt.find(Dt=>Dt.id===Xt.referrerId):null;return{...Xt,amount:parseFloat(String(Xt.amount))||0,userNickname:(Ot==null?void 0:Ot.nickname)||Xt.userNickname||"未知用户",userPhone:(Ot==null?void 0:Ot.phone)||Xt.userPhone||"-",referrerNickname:(Tn==null?void 0:Tn.nickname)||null,referrerCode:(Tn==null?void 0:Tn.referralCode)??null,type:Xt.productType||Xt.type}});r(Nt),L(pt.total??Nt.length)}else r([]),L(0)}catch(ft){console.error(ft),N("加载订单失败"),r([])}break}case"bindings":{try{const ft=new URLSearchParams({page:String(T),pageSize:String(O),...C!=="all"&&{status:C}}),pt=await Le(`/api/db/distribution?${ft}`);c((pt==null?void 0:pt.bindings)||[]),L((pt==null?void 0:pt.total)??((Qe=pt==null?void 0:pt.bindings)==null?void 0:Qe.length)??0)}catch(ft){console.error(ft),N("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const ft=C==="completed"?"success":C==="rejected"?"failed":C,pt=new URLSearchParams({...ft&&ft!=="all"&&{status:ft},page:String(T),pageSize:String(O)}),Nt=await Le(`/api/admin/withdrawals?${pt}`);if(Nt!=null&&Nt.success&&Nt.withdrawals){const Xt=Nt.withdrawals.map(Ot=>({...Ot,account:Ot.account??"未绑定微信号",status:Ot.status==="success"?"completed":Ot.status==="failed"?"rejected":Ot.status}));h(Xt),L((Nt==null?void 0:Nt.total)??Xt.length)}else Nt!=null&&Nt.success||N(`获取提现记录失败: ${(Nt==null?void 0:Nt.error)||"未知错误"}`),h([])}catch(ft){console.error(ft),N("加载提现数据失败"),h([])}break}}J(ft=>new Set(ft).add(ne))}catch(xt){console.error(xt)}finally{y(!1)}}}async function X(){N(null),J(ne=>{const Pe=new Set(ne);return Pe.delete(t),Pe}),t==="overview"&&W(),await fe(t,!0)}async function de(ne){if(confirm("确认审核通过并打款?"))try{const Pe=await Mt("/api/admin/withdrawals",{id:ne,action:"approve"});if(!(Pe!=null&&Pe.success)){const Qe=(Pe==null?void 0:Pe.message)||(Pe==null?void 0:Pe.error)||"操作失败";ae.error(Qe);return}await X()}catch(Pe){console.error(Pe),ae.error("操作失败")}}function he(ne){ie(ne),$("")}async function we(){const ne=z;if(!ne)return;const Pe=G.trim();if(!Pe){ae.error("请填写拒绝原因");return}ce(!0);try{const Qe=await Mt("/api/admin/withdrawals",{id:ne,action:"reject",errorMessage:Pe});if(!(Qe!=null&&Qe.success)){ae.error((Qe==null?void 0:Qe.error)||"操作失败");return}ae.success("已拒绝该提现申请"),ie(null),$(""),await X()}catch(Qe){console.error(Qe),ae.error("操作失败")}finally{ce(!1)}}function Te(){z&&ae.info("已取消操作"),ie(null),$("")}async function Ve(){var ne;if(!(!(ee!=null&&ee.orderSn)&&!(ee!=null&&ee.id))){re(!0),N(null);try{const Pe=await Mt("/api/admin/orders/refund",{orderSn:ee.orderSn||ee.id,reason:U||void 0});Pe!=null&&Pe.success?(Y(null),R(""),await fe("orders",!0)):N((Pe==null?void 0:Pe.error)||"退款失败")}catch(Pe){const Qe=Pe;N(((ne=Qe==null?void 0:Qe.data)==null?void 0:ne.error)||"退款失败,请检查网络后重试")}finally{re(!1)}}}function He(ne){const Pe={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"},Qe={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ue,{className:`${Pe[ne]||"bg-gray-500/20 text-gray-400"} border-0`,children:Qe[ne]||ne})}const gt=Math.ceil(P/O)||1,Pt=n,yn=o.filter(ne=>{var Qe,xt,ft,pt;if(!b)return!0;const Pe=b.toLowerCase();return((Qe=ne.refereeNickname)==null?void 0:Qe.toLowerCase().includes(Pe))||((xt=ne.refereePhone)==null?void 0:xt.includes(Pe))||((ft=ne.referrerName)==null?void 0:ft.toLowerCase().includes(Pe))||((pt=ne.referrerCode)==null?void 0:pt.toLowerCase().includes(Pe))}),ht=u.filter(ne=>{var Qe;if(!b)return!0;const Pe=b.toLowerCase();return((Qe=ne.userName)==null?void 0:Qe.toLowerCase().includes(Pe))||ne.account&&ne.account.toLowerCase().includes(Pe)});return s.jsxs("div",{className:"p-8 w-full",children:[w&&s.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:[s.jsx("span",{children:w}),s.jsx("button",{type:"button",onClick:()=>N(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),s.jsxs(te,{onClick:X,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),s.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:Oc},{key:"orders",label:"订单管理",icon:ah},{key:"bindings",label:"绑定管理",icon:gs},{key:"withdrawals",label:"提现审核",icon:jl},{key:"settings",label:"推广设置",icon:so}].map(ne=>s.jsxs("button",{type:"button",onClick:()=>{e(ne.key),E("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===ne.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[s.jsx(ne.icon,{className:"w-4 h-4"}),ne.label]},ne.key))}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ge,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[t==="overview"&&i&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayClicks}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(jg,{className:"w-6 h-6 text-blue-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayUniqueVisitors??0}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:s.jsx(Un,{className:"w-6 h-6 text-cyan-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(i.todayClickRate??0).toFixed(2)}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:s.jsx(Oc,{className:"w-6 h-6 text-amber-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayBindings})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:s.jsx(gs,{className:"w-6 h-6 text-green-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayConversions})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:s.jsx(Pb,{className:"w-6 h-6 text-purple-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),s.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",i.todayEarnings.toFixed(2)]})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:s.jsx(ah,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((At=i.todayClicksByPage)==null?void 0:At.length)??0)>0&&s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(jg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),s.jsx(Ae,{children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),s.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),s.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),s.jsx("tbody",{children:[...i.todayClicksByPage??[]].sort((ne,Pe)=>Pe.clicks-ne.clicks).map((ne,Pe)=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:ne.page||"(未区分)"}),s.jsx("td",{className:"py-2 pr-4 text-right text-white",children:ne.clicks}),s.jsxs("td",{className:"py-2 text-right text-gray-400",children:[i.todayClicks>0?(ne.clicks/i.todayClicks*100).toFixed(1):0,"%"]})]},Pe))})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Me,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:s.jsx(Ng,{className:"w-6 h-6 text-orange-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[i.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),s.jsx(Me,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(jl,{className:"w-6 h-6 text-blue-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[i.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",i.pendingWithdrawAmount.toFixed(2)]})]}),s.jsx(te,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ih,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthClicks})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthBindings})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",i.monthEarnings.toFixed(2)]})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Oc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),s.jsxs(Ae,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalClicks.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalBindings.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",i.totalEarnings.toFixed(2)]})]})]}),s.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[s.jsx("span",{className:"text-gray-300",children:"点击转化率"}),s.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[i.conversionRate,"%"]})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-white",children:i.totalDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-green-400",children:i.activeDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[n.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Pt.map(ne=>{var Pe,Qe;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Pe=ne.id)==null?void 0:Pe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:ne.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const xt=ne.productType||ne.type;return xt==="fullbook"?`${ne.bookName||"《底层逻辑》"} - 全本`:xt==="match"?"匹配次数购买":`${ne.bookName||"《底层逻辑》"} - ${ne.sectionTitle||ne.chapterTitle||`章节${ne.productId||ne.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const xt=ne.productType||ne.type;return xt==="fullbook"?"全书解锁":xt==="match"?"功能权益":ne.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof ne.amount=="number"?ne.amount.toFixed(2):parseFloat(String(ne.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:ne.paymentMethod==="wechat"?"微信支付":ne.paymentMethod==="alipay"?"支付宝":ne.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:ne.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):ne.status==="completed"||ne.status==="paid"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):ne.status==="pending"||ne.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:ne.refundReason,children:ne.status==="refunded"&&ne.refundReason?ne.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:ne.referrerId||ne.referralCode?s.jsxs("span",{title:ne.referralCode||ne.referrerCode||ne.referrerId||"",children:[ne.referrerNickname||ne.referralCode||ne.referrerCode||((Qe=ne.referrerId)==null?void 0:Qe.slice(0,8)),(ne.referralCode||ne.referrerCode)&&` (${ne.referralCode||ne.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:ne.referrerEarnings?`¥${(typeof ne.referrerEarnings=="number"?ne.referrerEarnings:parseFloat(String(ne.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:ne.createdAt?new Date(ne.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(ne.status==="paid"||ne.status==="completed")&&s.jsxs(te,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(ne),R("")},children:[s.jsx(YN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},ne.id)})})]})}),t==="orders"&&s.jsx(xs,{page:T,totalPages:gt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]}),t==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"active",children:"有效"}),s.jsx("option",{value:"converted",children:"已转化"}),s.jsx("option",{value:"expired",children:"已过期"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[yn.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:yn.map(ne=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:ne.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:ne.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:ne.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.boundAt?new Date(ne.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.expiresAt?new Date(ne.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(ne.status)}),s.jsx("td",{className:"p-4",children:ne.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",ne.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},ne.id))})]})}),t==="bindings"&&s.jsx(xs,{page:T,totalPages:gt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]}),t==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待审核"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[ht.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ht.map(ne=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[ne.userAvatar?s.jsx("img",{src:ne.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(ne.userName||ne.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:ne.userName||ne.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",ne.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ue,{className:ne.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:ne.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:ne.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.createdAt?new Date(ne.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(ne.status)}),s.jsx("td",{className:"p-4 text-right",children:ne.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(te,{size:"sm",onClick:()=>de(ne.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Pb,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(te,{size:"sm",variant:"outline",onClick:()=>he(ne.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(WN,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},ne.id))})]})}),t==="withdrawals"&&s.jsx(xs,{page:T,totalPages:gt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]})]}),s.jsx(Kt,{open:!!ee,onOpenChange:ne=>!ne&&Y(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"订单退款"})}),ee&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ee.orderSn||ee.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ee.amount=="number"?ee.amount.toFixed(2):parseFloat(String(ee.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:U,onChange:ne=>R(ne.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:F,children:"取消"}),s.jsx(te,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Ve,disabled:F,children:F?"退款中...":"确认退款"})]})]})}),s.jsx(Kt,{open:!!z,onOpenChange:ne=>!ne&&Te(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:G,onChange:ne=>$(ne.target.value)})})]})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Te,disabled:H,children:"取消"}),s.jsx(te,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:we,disabled:H||!G.trim(),children:H?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(Ik,{embedded:!0})})]})}function PP(){const[t,e]=v.useState([]),[n,r]=v.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[i,a]=v.useState(!0),[o,c]=v.useState(null),[u,h]=v.useState("all"),[f,m]=v.useState(1),[g,y]=v.useState(10),[w,N]=v.useState(0),[b,k]=v.useState(null),[C,E]=v.useState(null),[T,I]=v.useState(""),[O,D]=v.useState(!1);async function P(){var R,F,re,z,ie,G,$;a(!0),c(null);try{const H=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),ce=await Le(`/api/admin/withdrawals?${H}`);if(ce!=null&&ce.success){const W=ce.withdrawals||[];e(W),N(ce.total??((R=ce.stats)==null?void 0:R.total)??W.length),r({total:((F=ce.stats)==null?void 0:F.total)??ce.total??W.length,pendingCount:((re=ce.stats)==null?void 0:re.pendingCount)??0,pendingAmount:((z=ce.stats)==null?void 0:z.pendingAmount)??0,successCount:((ie=ce.stats)==null?void 0:ie.successCount)??0,successAmount:((G=ce.stats)==null?void 0:G.successAmount)??0,failedCount:(($=ce.stats)==null?void 0:$.failedCount)??0})}else c("加载提现记录失败")}catch(H){console.error("Load withdrawals error:",H),c("加载失败,请检查网络后重试")}finally{a(!1)}}v.useEffect(()=>{m(1)},[u]),v.useEffect(()=>{P()},[u,f,g]);const L=Math.ceil(w/g)||1;async function _(R){const F=t.find(re=>re.id===R);if(F!=null&&F.userCommissionInfo&&F.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${F.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 +如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),ae.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?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(wl,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),s.jsxs(te,{onClick:c,disabled:a||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(lA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Vt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(wu,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(qn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(AP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(oe,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(wu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(wu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(qn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(oe,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(wl,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Vt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(oe,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ue,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(At,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(wu,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ae,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[s.jsxs("p",{children:["1. 以上配置会写入"," ",s.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),s.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),s.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function RP(){var Rt;const[t,e]=v.useState("overview"),[n,r]=v.useState([]),[i,a]=v.useState(null),[o,c]=v.useState([]),[u,h]=v.useState([]),[f,m]=v.useState([]),[g,y]=v.useState(!0),[w,N]=v.useState(null),[b,k]=v.useState(""),[C,E]=v.useState("all"),[T,I]=v.useState(1),[O,D]=v.useState(10),[P,L]=v.useState(0),[_,J]=v.useState(new Set),[ee,Y]=v.useState(null),[U,R]=v.useState(""),[F,re]=v.useState(!1),[z,ie]=v.useState(null),[G,$]=v.useState(""),[V,ce]=v.useState(!1);v.useEffect(()=>{W()},[]),v.useEffect(()=>{I(1)},[t,C]),v.useEffect(()=>{fe(t)},[t]),v.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&fe(t,!0)},[T,O,C,b]);async function W(){N(null);try{const ne=await Le("/api/admin/distribution/overview");ne!=null&&ne.success&&ne.overview&&a(ne.overview)}catch(ne){console.error("[Admin] 概览接口异常:",ne),N("加载概览失败")}try{const ne=await Le("/api/db/users");m((ne==null?void 0:ne.users)||[])}catch(ne){console.error("[Admin] 用户数据加载失败:",ne)}}async function fe(ne,Pe=!1){var Ze;if(!(!Pe&&_.has(ne))){y(!0);try{const bt=f;switch(ne){case"overview":break;case"orders":{try{const mt=new URLSearchParams({page:String(T),pageSize:String(O),...C!=="all"&&{status:C},...b&&{search:b}}),gt=await Le(`/api/admin/orders?${mt}`);if(gt!=null&>.success&>.orders){const St=gt.orders.map(nn=>{const Lt=bt.find(_t=>_t.id===nn.userId),An=nn.referrerId?bt.find(_t=>_t.id===nn.referrerId):null;return{...nn,amount:parseFloat(String(nn.amount))||0,userNickname:(Lt==null?void 0:Lt.nickname)||nn.userNickname||"未知用户",userPhone:(Lt==null?void 0:Lt.phone)||nn.userPhone||"-",referrerNickname:(An==null?void 0:An.nickname)||null,referrerCode:(An==null?void 0:An.referralCode)??null,type:nn.productType||nn.type}});r(St),L(gt.total??St.length)}else r([]),L(0)}catch(mt){console.error(mt),N("加载订单失败"),r([])}break}case"bindings":{try{const mt=new URLSearchParams({page:String(T),pageSize:String(O),...C!=="all"&&{status:C}}),gt=await Le(`/api/db/distribution?${mt}`);c((gt==null?void 0:gt.bindings)||[]),L((gt==null?void 0:gt.total)??((Ze=gt==null?void 0:gt.bindings)==null?void 0:Ze.length)??0)}catch(mt){console.error(mt),N("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const mt=C==="completed"?"success":C==="rejected"?"failed":C,gt=new URLSearchParams({...mt&&mt!=="all"&&{status:mt},page:String(T),pageSize:String(O)}),St=await Le(`/api/admin/withdrawals?${gt}`);if(St!=null&&St.success&&St.withdrawals){const nn=St.withdrawals.map(Lt=>({...Lt,account:Lt.account??"未绑定微信号",status:Lt.status==="success"?"completed":Lt.status==="failed"?"rejected":Lt.status}));h(nn),L((St==null?void 0:St.total)??nn.length)}else St!=null&&St.success||N(`获取提现记录失败: ${(St==null?void 0:St.error)||"未知错误"}`),h([])}catch(mt){console.error(mt),N("加载提现数据失败"),h([])}break}}J(mt=>new Set(mt).add(ne))}catch(bt){console.error(bt)}finally{y(!1)}}}async function X(){N(null),J(ne=>{const Pe=new Set(ne);return Pe.delete(t),Pe}),t==="overview"&&W(),await fe(t,!0)}async function de(ne){if(confirm("确认审核通过并打款?"))try{const Pe=await It("/api/admin/withdrawals",{id:ne,action:"approve"});if(!(Pe!=null&&Pe.success)){const Ze=(Pe==null?void 0:Pe.message)||(Pe==null?void 0:Pe.error)||"操作失败";ae.error(Ze);return}await X()}catch(Pe){console.error(Pe),ae.error("操作失败")}}function he(ne){ie(ne),$("")}async function be(){const ne=z;if(!ne)return;const Pe=G.trim();if(!Pe){ae.error("请填写拒绝原因");return}ce(!0);try{const Ze=await It("/api/admin/withdrawals",{id:ne,action:"reject",errorMessage:Pe});if(!(Ze!=null&&Ze.success)){ae.error((Ze==null?void 0:Ze.error)||"操作失败");return}ae.success("已拒绝该提现申请"),ie(null),$(""),await X()}catch(Ze){console.error(Ze),ae.error("操作失败")}finally{ce(!1)}}function Te(){z&&ae.info("已取消操作"),ie(null),$("")}async function Ve(){var ne;if(!(!(ee!=null&&ee.orderSn)&&!(ee!=null&&ee.id))){re(!0),N(null);try{const Pe=await It("/api/admin/orders/refund",{orderSn:ee.orderSn||ee.id,reason:U||void 0});Pe!=null&&Pe.success?(Y(null),R(""),await fe("orders",!0)):N((Pe==null?void 0:Pe.error)||"退款失败")}catch(Pe){const Ze=Pe;N(((ne=Ze==null?void 0:Ze.data)==null?void 0:ne.error)||"退款失败,请检查网络后重试")}finally{re(!1)}}}function He(ne){const Pe={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"},Ze={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ue,{className:`${Pe[ne]||"bg-gray-500/20 text-gray-400"} border-0`,children:Ze[ne]||ne})}const vt=Math.ceil(P/O)||1,Dt=n,vn=o.filter(ne=>{var Ze,bt,mt,gt;if(!b)return!0;const Pe=b.toLowerCase();return((Ze=ne.refereeNickname)==null?void 0:Ze.toLowerCase().includes(Pe))||((bt=ne.refereePhone)==null?void 0:bt.includes(Pe))||((mt=ne.referrerName)==null?void 0:mt.toLowerCase().includes(Pe))||((gt=ne.referrerCode)==null?void 0:gt.toLowerCase().includes(Pe))}),pt=u.filter(ne=>{var Ze;if(!b)return!0;const Pe=b.toLowerCase();return((Ze=ne.userName)==null?void 0:Ze.toLowerCase().includes(Pe))||ne.account&&ne.account.toLowerCase().includes(Pe)});return s.jsxs("div",{className:"p-8 w-full",children:[w&&s.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:[s.jsx("span",{children:w}),s.jsx("button",{type:"button",onClick:()=>N(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),s.jsxs(te,{onClick:X,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),s.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:oh},{key:"bindings",label:"绑定管理",icon:ys},{key:"withdrawals",label:"提现审核",icon:wl},{key:"settings",label:"推广设置",icon:io}].map(ne=>s.jsxs("button",{type:"button",onClick:()=>{e(ne.key),E("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===ne.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[s.jsx(ne.icon,{className:"w-4 h-4"}),ne.label]},ne.key))}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Je,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[t==="overview"&&i&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayClicks}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(kg,{className:"w-6 h-6 text-blue-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayUniqueVisitors??0}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:s.jsx(qn,{className:"w-6 h-6 text-cyan-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(i.todayClickRate??0).toFixed(2)}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:s.jsx(Dc,{className:"w-6 h-6 text-amber-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayBindings})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:s.jsx(ys,{className:"w-6 h-6 text-green-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayConversions})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:s.jsx(Ob,{className:"w-6 h-6 text-purple-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),s.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",i.todayEarnings.toFixed(2)]})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:s.jsx(oh,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Rt=i.todayClicksByPage)==null?void 0:Rt.length)??0)>0&&s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(kg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),s.jsx(Ae,{children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),s.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),s.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),s.jsx("tbody",{children:[...i.todayClicksByPage??[]].sort((ne,Pe)=>Pe.clicks-ne.clicks).map((ne,Pe)=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:ne.page||"(未区分)"}),s.jsx("td",{className:"py-2 pr-4 text-right text-white",children:ne.clicks}),s.jsxs("td",{className:"py-2 text-right text-gray-400",children:[i.todayClicks>0?(ne.clicks/i.todayClicks*100).toFixed(1):0,"%"]})]},Pe))})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Me,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:s.jsx(jg,{className:"w-6 h-6 text-orange-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[i.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),s.jsx(Me,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(wl,{className:"w-6 h-6 text-blue-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[i.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",i.pendingWithdrawAmount.toFixed(2)]})]}),s.jsx(te,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ah,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthClicks})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthBindings})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",i.monthEarnings.toFixed(2)]})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Dc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),s.jsxs(Ae,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalClicks.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalBindings.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",i.totalEarnings.toFixed(2)]})]})]}),s.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[s.jsx("span",{className:"text-gray-300",children:"点击转化率"}),s.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[i.conversionRate,"%"]})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-white",children:i.totalDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-green-400",children:i.activeDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[n.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Dt.map(ne=>{var Pe,Ze;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Pe=ne.id)==null?void 0:Pe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:ne.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const bt=ne.productType||ne.type;return bt==="fullbook"?`${ne.bookName||"《底层逻辑》"} - 全本`:bt==="match"?"匹配次数购买":`${ne.bookName||"《底层逻辑》"} - ${ne.sectionTitle||ne.chapterTitle||`章节${ne.productId||ne.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const bt=ne.productType||ne.type;return bt==="fullbook"?"全书解锁":bt==="match"?"功能权益":ne.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof ne.amount=="number"?ne.amount.toFixed(2):parseFloat(String(ne.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:ne.paymentMethod==="wechat"?"微信支付":ne.paymentMethod==="alipay"?"支付宝":ne.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:ne.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):ne.status==="completed"||ne.status==="paid"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):ne.status==="pending"||ne.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:ne.refundReason,children:ne.status==="refunded"&&ne.refundReason?ne.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:ne.referrerId||ne.referralCode?s.jsxs("span",{title:ne.referralCode||ne.referrerCode||ne.referrerId||"",children:[ne.referrerNickname||ne.referralCode||ne.referrerCode||((Ze=ne.referrerId)==null?void 0:Ze.slice(0,8)),(ne.referralCode||ne.referrerCode)&&` (${ne.referralCode||ne.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:ne.referrerEarnings?`¥${(typeof ne.referrerEarnings=="number"?ne.referrerEarnings:parseFloat(String(ne.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:ne.createdAt?new Date(ne.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(ne.status==="paid"||ne.status==="completed")&&s.jsxs(te,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(ne),R("")},children:[s.jsx(QN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},ne.id)})})]})}),t==="orders"&&s.jsx(vs,{page:T,totalPages:vt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]}),t==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"active",children:"有效"}),s.jsx("option",{value:"converted",children:"已转化"}),s.jsx("option",{value:"expired",children:"已过期"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[vn.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:vn.map(ne=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:ne.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:ne.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:ne.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.boundAt?new Date(ne.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.expiresAt?new Date(ne.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(ne.status)}),s.jsx("td",{className:"p-4",children:ne.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",ne.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},ne.id))})]})}),t==="bindings"&&s.jsx(vs,{page:T,totalPages:vt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]}),t==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待审核"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[pt.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:pt.map(ne=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[ne.userAvatar?s.jsx("img",{src:ne.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(ne.userName||ne.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:ne.userName||ne.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",ne.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ue,{className:ne.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:ne.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:ne.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.createdAt?new Date(ne.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(ne.status)}),s.jsx("td",{className:"p-4 text-right",children:ne.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(te,{size:"sm",onClick:()=>de(ne.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ob,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(te,{size:"sm",variant:"outline",onClick:()=>he(ne.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(UN,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},ne.id))})]})}),t==="withdrawals"&&s.jsx(vs,{page:T,totalPages:vt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]})]}),s.jsx(Yt,{open:!!ee,onOpenChange:ne=>!ne&&Y(null),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"订单退款"})}),ee&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ee.orderSn||ee.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ee.amount=="number"?ee.amount.toFixed(2):parseFloat(String(ee.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:U,onChange:ne=>R(ne.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:F,children:"取消"}),s.jsx(te,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Ve,disabled:F,children:F?"退款中...":"确认退款"})]})]})}),s.jsx(Yt,{open:!!z,onOpenChange:ne=>!ne&&Te(),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:G,onChange:ne=>$(ne.target.value)})})]})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Te,disabled:V,children:"取消"}),s.jsx(te,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:be,disabled:V||!G.trim(),children:V?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(Rk,{embedded:!0})})]})}function PP(){const[t,e]=v.useState([]),[n,r]=v.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[i,a]=v.useState(!0),[o,c]=v.useState(null),[u,h]=v.useState("all"),[f,m]=v.useState(1),[g,y]=v.useState(10),[w,N]=v.useState(0),[b,k]=v.useState(null),[C,E]=v.useState(null),[T,I]=v.useState(""),[O,D]=v.useState(!1);async function P(){var R,F,re,z,ie,G,$;a(!0),c(null);try{const V=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),ce=await Le(`/api/admin/withdrawals?${V}`);if(ce!=null&&ce.success){const W=ce.withdrawals||[];e(W),N(ce.total??((R=ce.stats)==null?void 0:R.total)??W.length),r({total:((F=ce.stats)==null?void 0:F.total)??ce.total??W.length,pendingCount:((re=ce.stats)==null?void 0:re.pendingCount)??0,pendingAmount:((z=ce.stats)==null?void 0:z.pendingAmount)??0,successCount:((ie=ce.stats)==null?void 0:ie.successCount)??0,successAmount:((G=ce.stats)==null?void 0:G.successAmount)??0,failedCount:(($=ce.stats)==null?void 0:$.failedCount)??0})}else c("加载提现记录失败")}catch(V){console.error("Load withdrawals error:",V),c("加载失败,请检查网络后重试")}finally{a(!1)}}v.useEffect(()=>{m(1)},[u]),v.useEffect(()=>{P()},[u,f,g]);const L=Math.ceil(w/g)||1;async function _(R){const F=t.find(re=>re.id===R);if(F!=null&&F.userCommissionInfo&&F.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${F.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const re=await Mt("/api/admin/withdrawals",{id:R,action:"approve"});re!=null&&re.success?P():ae.error("操作失败: "+((re==null?void 0:re.error)??""))}catch{ae.error("操作失败")}finally{k(null)}}function J(R){E(R),I("")}async function ee(){const R=C;if(!R)return;const F=T.trim();if(!F){ae.error("请填写拒绝原因");return}D(!0);try{const re=await Mt("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:F});re!=null&&re.success?(ae.success("已拒绝该提现申请"),E(null),I(""),P()):ae.error("操作失败: "+((re==null?void 0:re.error)??""))}catch{ae.error("操作失败")}finally{D(!1)}}function Y(){C&&ae.info("已取消操作"),E(null),I("")}function U(R){switch(R){case"pending":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ue,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.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:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(te,{variant:"outline",onClick:P,disabled:i,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Me,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(ah,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>s.jsx(te,{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))}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:i?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(jl,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?s.jsx("img",{src:R.userAvatar,alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.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)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:R.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[U(R.status),R.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(te,{size:"sm",onClick:()=>_(R.id),disabled:b===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(cf,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(te,{size:"sm",variant:"outline",onClick:()=>J(R.id),disabled:b===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),s.jsx(xs,{page:f,totalPages:L,total:w,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})}),s.jsx(Kt,{open:!!C,onOpenChange:R=>!R&&Y(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:T,onChange:R=>I(R.target.value)})})]})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Y,disabled:O,children:"取消"}),s.jsx(te,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ee,disabled:O||!T.trim(),children:O?"提交中...":"确认拒绝"})]})]})})]})}var Om={exports:{}},Dm={};/** +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const re=await It("/api/admin/withdrawals",{id:R,action:"approve"});re!=null&&re.success?P():ae.error("操作失败: "+((re==null?void 0:re.error)??""))}catch{ae.error("操作失败")}finally{k(null)}}function J(R){E(R),I("")}async function ee(){const R=C;if(!R)return;const F=T.trim();if(!F){ae.error("请填写拒绝原因");return}D(!0);try{const re=await It("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:F});re!=null&&re.success?(ae.success("已拒绝该提现申请"),E(null),I(""),P()):ae.error("操作失败: "+((re==null?void 0:re.error)??""))}catch{ae.error("操作失败")}finally{D(!1)}}function Y(){C&&ae.info("已取消操作"),E(null),I("")}function U(R){switch(R){case"pending":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ue,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.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:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(te,{variant:"outline",onClick:P,disabled:i,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Me,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(oh,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>s.jsx(te,{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))}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:i?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(wl,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?s.jsx("img",{src:R.userAvatar,alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.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)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:R.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[U(R.status),R.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(te,{size:"sm",onClick:()=>_(R.id),disabled:b===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(df,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(te,{size:"sm",variant:"outline",onClick:()=>J(R.id),disabled:b===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),s.jsx(vs,{page:f,totalPages:L,total:w,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})}),s.jsx(Yt,{open:!!C,onOpenChange:R=>!R&&Y(),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:T,onChange:R=>I(R.target.value)})})]})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Y,disabled:O,children:"取消"}),s.jsx(te,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ee,disabled:O||!T.trim(),children:O?"提交中...":"确认拒绝"})]})]})})]})}var Dm={exports:{}},Lm={};/** * @license React * use-sync-external-store-shim.production.js * @@ -595,19 +595,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var i1;function OP(){if(i1)return Dm;i1=1;var t=cd();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,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),w=r({inst:{value:y,getSnapshot:g}}),N=w[0].inst,b=w[1];return a(function(){N.value=y,N.getSnapshot=g,u(N)&&b({inst:N})},[m,y,g]),i(function(){return u(N)&&b({inst:N}),m(function(){u(N)&&b({inst:N})})},[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 Dm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Dm}var a1;function Rk(){return a1||(a1=1,Om.exports=OP()),Om.exports}var Pk=Rk();function Fn(t){this.content=t}Fn.prototype={constructor:Fn,find:function(t){for(var e=0;e>1}};Fn.from=function(t){if(t instanceof Fn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Fn(e)};function Ok(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)n++;return n}if(i.content.size||a.content.size){let o=Ok(i.content,a.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Dk(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=t.child(--i),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,i+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,i+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){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?i?typeof i=="function"?i(c):i: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,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.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),i+=c.nodeSize),o=u}return new ge(r,i)}cutByIndex(e,n){return e==n?ge.empty:e==0&&n==this.content.length?this:new ge(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new ge(i,a)}addToStart(e){return new ge([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ge(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 i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Au(n+1,a):Au(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 ge.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ge(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ge.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),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-i.type.rank),n}};Rt.none=[];class fh extends Error{}class Ie{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=_k(this.content,e+this.openStart,n);return r&&new Ie(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ie(Lk(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 Ie.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ie(ge.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=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)i++;return new Ie(e,r,i)}}Ie.empty=new Ie(ge.empty,0,0);function Lk(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(i==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(Lk(a.content,e-i-1,n-i-1)))}function _k(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),o=t.maybeChild(i);if(a==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=_k(o.content,e-a-1,n,o);return c&&t.replaceChild(i,o.copy(c))}function DP(t,e,n){if(n.openStart>t.depth)throw new fh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new fh("Inconsistent open depths");return zk(t,e,n,0)}function zk(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Dc(t,e,n,r){let i=(e||t).node(n),a=0,o=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(io(t.nodeAfter,r),a++));for(let c=a;ci&&Lg(t,e,i+1),o=r.depth>i&&Lg(n,r,i+1),c=[];return Dc(null,t,i,c),a&&o&&e.index(i)==n.index(i)?($k(a,o),io(ao(a,Fk(t,e,n,r,i+1)),c)):(a&&io(ao(a,ph(t,e,i+1)),c),Dc(e,n,i,c),o&&io(ao(o,ph(n,r,i+1)),c)),Dc(r,null,i,c),new ge(c)}function ph(t,e,n){let r=[];if(Dc(null,t,n,r),t.depth>n){let i=Lg(t,e,n+1);io(ao(i,ph(t,e,n+1)),r)}return Dc(e,null,n,r),new ge(r)}function LP(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(ge.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Yc{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],i=e.child(n);return r?e.child(n).cut(r):i}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],i=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 mh(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=[],i=0,a=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(a),h=a-u;if(r.push(o,c,i+u),!h||(o=o.child(c),o.isText))break;a=h-1,i+=u+1}return new Yc(n,r,a)}static resolveCached(e,n){let r=o1.get(e);if(r)for(let a=0;ae&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}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()+")"),Bk(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=ge.empty,i=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,a),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=i;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 i=ge.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};xi.prototype.text=void 0;class gh extends xi{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Bk(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 gh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new gh(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 Bk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class mo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new FP(e,n);if(r.next==null)return mo.empty;let i=Vk(r);r.next&&r.err("Unexpected trailing text");let a=qP(KP(i));return GP(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 i=0;i{let a=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return a}).join(` -`)}}mo.empty=new mo(!0);class FP{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 Vk(t){let e=[];do e.push(BP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function BP(t){let e=[];do e.push(VP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function VP(t){let e=UP(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=HP(t,e);else break;return e}function l1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function HP(t,e){let n=l1(t),r=n;return t.eat(",")&&(t.next!="}"?r=l1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function WP(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let o=n[a];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function UP(t){if(t.eat("(")){let e=Vk(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=WP(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 KP(t){let e=[[]];return i(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 i(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;i(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),i(a(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(a(o.expr,c),u),i(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||i.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let a=e[r.join(",")]=new mo(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:Uk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new xi(this,this.computeAttrs(e),ge.from(n),Rt.setFrom(r))}createChecked(e=null,n,r){return n=ge.from(n),this.checkContent(n),new xi(this,this.computeAttrs(e),n,Rt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ge.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(ge.empty,!0);return a?new xi(this,e,n.append(a),Rt.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 Gk(a,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");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 JP(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class YP{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?JP(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class xf{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=qk(e,i.attrs),this.excluded=null;let a=Wk(this.attrs);this.instance=a?new Rt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Rt(this,Uk(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,o)=>r[a]=new xf(a,i++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class Jk{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Fn.from(e.nodes),n.marks=Fn.from(e.marks||{}),this.nodes=d1.compile(this.spec.nodes,this),this.marks=xf.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],o=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=mo.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?u1(this,c.split(" ")):c==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:u1(this,o.split(" "))}this.nodeFromJSON=i=>xi.fromJSON(this,i),this.markFromJSON=i=>Rt.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof d1){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,i)}text(e,n){let r=this.nodes.text;return new gh(r,r.defaultAttrs,e,Rt.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 u1(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 QP(t){return t.tag!=null}function XP(t){return t.style!=null}class ha{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(QP(i))this.tags.push(i);else if(XP(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new f1(this,n,!1);return r.addAll(e,Rt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new f1(this,n,!0);return r.addAll(e,Rt.none,n.from,n.to),Ie.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.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(i){let a=i.priority==null?50:i.priority,o=0;for(;o{r(o=p1(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{r(o=p1(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ha(e,ha.schemaRules(e)))}}const Yk={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},ZP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Qk={ol:!0,ul:!0},Qc=1,zg=2,Lc=4;function h1(t,e,n){return e!=null?(e?Qc:0)|(e==="full"?zg:0):t&&t.whitespace=="pre"?Qc|zg:n&~Lc}class Iu{constructor(e,n,r,i,a,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Rt.none,this.match=a||(o&Lc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ge.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qc)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=ge.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ge.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&&!Yk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class f1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,o=h1(null,n.preserveWhitespace,0)|(r?Lc:0);i?a=new Iu(i.type,i.attrs,Rt.none,!0,n.topMatch||i.type.contentMatch,o):r?a=new Iu(null,null,Rt.none,!0,null,o):a=new Iu(e.schema.topNodeType,null,Rt.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,i=this.top,a=i.options&zg?"full":this.localPreserveWS||(i.options&Qc)>0,{schema:o}=this.parser;if(a==="full"||i.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,i){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(i)this.addElement(e,r,i);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,i){let a=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];o!=c;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,n);this.findAtPoint(e,a)}findPlace(e,n,r){let i,a;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!i||i.length>h.length+c)&&(i=h,a=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!i)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):m1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Iu(e,n,u,i,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|=Qc)}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 i=r.length-1;i>=0;i--)e+=r[i].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,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?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&&i?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 eO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Qk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function tO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function p1(t){let e={};for(let n in t)e[n]=t[n];return e}function m1(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.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;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Yu(_m(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Yu(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new So(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=g1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return g1(e.marks)}}function g1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function _m(t){return t.document||window.document}const x1=new WeakMap;function nO(t){let e=x1.get(t);return e===void 0&&x1.set(t,e=rO(t)),e}function rO(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 i=0;i-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=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let c,u=n?t.createElementNS(n,i):t.createElement(i),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:w}=Yu(t,g,n,r);if(u.appendChild(y),w){if(c)throw new RangeError("Multiple content holes");c=w}}}return{dom:u,contentDOM:c}}const Xk=65535,Zk=Math.pow(2,16);function sO(t,e){return t+e*Zk}function y1(t){return t&Xk}function iO(t){return(t-(t&Xk))/Zk}const eS=1,tS=2,Qu=4,nS=8;class $g{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&nS)>0}get deletedBefore(){return(this.delInfo&(eS|Qu))>0}get deletedAfter(){return(this.delInfo&(tS|Qu))>0}get deletedAcross(){return(this.delInfo&Qu)>0}}class Pr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Pr.empty)return Pr.empty}recover(e){let n=0,r=y1(e);if(!this.inverted)for(let i=0;ie)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+i+(g<0?0:f);if(r)return y;let w=e==(n<0?u:m)?null:sO(c/3,e-u),N=e==u?tS:e==m?eS:Qu;return(n<0?e!=u:e!=m)&&(N|=nS),new $g(y,N,w)}i+=f-h}return r?e+i:new $g(e+i,0,null)}touches(e,n){let r=0,i=y1(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==i*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 i=0,a=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Xc;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)),i),n.openStart,n.openEnd);return bn.fromReplace(e,this.from,this.to,a)}invert(){return new ms(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 aa(n.pos,r.pos,this.mark)}merge(e){return e instanceof aa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new aa(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 aa(n.from,n.to,e.markFromJSON(n.mark))}}ir.jsonID("addMark",aa);class ms extends ir{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 Ie(Xx(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return bn.fromReplace(e,this.from,this.to,r)}invert(){return new aa(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 ms(n.pos,r.pos,this.mark)}merge(e){return e instanceof ms&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ms(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 ms(n.from,n.to,e.markFromJSON(n.mark))}}ir.jsonID("removeMark",ms);class oa extends ir{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return bn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return bn.fromReplace(e,this.pos,this.pos+1,new Ie(ge.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 i=0;ir.pos?null:new On(n.pos,r.pos,i,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 On(n.from,n.to,n.gapFrom,n.gapTo,Ie.fromJSON(e,n.slice),n.insert,!!n.structure)}}ir.jsonID("replaceAround",On);function Fg(t,e,n){let r=t.resolve(e),i=n-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function aO(t,e,n,r){let i=[],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),w=r.addToSet(m);for(let N=0;Nt.step(u)),a.forEach(u=>t.step(u))}function oO(t,e,n,r){let i=[],a=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;a++;let u=null;if(r instanceof xf){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 ms(o.from,o.to,o.style)))}function Zx(t,e,n,r=n.contentMatch,i=!0){let a=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function lO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $l(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,a=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+i,u=t.$to.indexAfter(r)-a;if(rn;w--)N||r.index(w)>0?(N=!0,f=ge.from(r.node(w).copy(f)),m++):u--;let g=ge.empty,y=0;for(let w=a,N=!1;w>n;w--)N||i.after(w+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=ge.from(n[o].type.create(n[o].attrs,r))}let i=e.start,a=e.end;t.step(new On(i,a,i,a,new Ie(r,0,0),n.length,!0))}function fO(t,e,n,r,i){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 i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&pO(t.doc,t.mapping.slice(a).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",w=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!w?h=!1:!y&&w&&(h=!0)}h===!1&&sS(t,o,c,a),Zx(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 On(m,g,m+1,g-1,new Ie(ge.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&rS(t,o,c,a),!1}})}function rS(t,e,n,r){e.forEach((i,a)=>{if(i.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(i.text);){let u=t.mapping.slice(r).map(n+1+a+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function sS(t,e,n,r){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+a);t.replaceWith(o,o+1,e.type.schema.text(` -`))}})}function pO(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function mO(t,e,n,r,i){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,i||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 On(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new Ie(ge.from(o),0,0),1,!0))}function yi(t,e,n=1,r){let i=t.resolve(e),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,f=n-2;h>a;h--,f--){let m=i.node(h),g=i.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),w=r&&r[f+1];w&&(y=y.replaceChild(0,w.type.create(w.attrs)));let N=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!N.type.validContent(y))return!1}let c=i.indexAfter(a),u=r&&r[0];return i.node(a).canReplaceWith(c,c,u?u.type:i.node(a+1).type)}function gO(t,e,n=1,r){let i=t.doc.resolve(e),a=ge.empty,o=ge.empty;for(let c=i.depth,u=i.depth-n,h=n-1;c>u;c--,h--){a=ge.from(i.node(c).copy(a));let f=r&&r[h];o=ge.from(f?f.type.create(f.attrs,o):i.node(c).copy(o))}t.step(new Pn(e,e,new Ie(a.append(o),n,n),!0))}function Sa(t,e){let n=t.resolve(e),r=n.index();return iS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function xO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i0?(a=r.node(i+1),c++,o=r.node(i).maybeChild(c)):(a=r.node(i).maybeChild(c-1),o=r.node(i+1)),a&&!a.isTextblock&&iS(a,o)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function yO(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,a=t.doc.resolve(e-n),o=a.node().type;if(i&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(i);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);sS(t,f.node(),f.before(),c)}o.inlineContent&&Zx(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 Pn(h,u.map(e+n,-1),Ie.empty,!0)),r===!0){let f=t.doc.resolve(h);rS(t,f.node(),f.before(),t.steps.length)}return t}function vO(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 i=r.depth-1;i>=0;i--){let a=r.index(i);if(r.node(i).canReplaceWith(a,a,n))return r.before(i+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let a=r.indexAfter(i);if(r.node(i).canReplaceWith(a,a,n))return r.after(i+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,i);else{let m=h.contentMatchAt(u).findWrapping(i.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 vf(t,e,n=e,r=Ie.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),a=t.resolve(n);return oS(i,a,r)?new Pn(e,n,r):new bO(i,a,r).fit()}function oS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class bO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ge.empty;for(let i=0;i<=e.depth;i++){let a=e.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=ge.from(e.node(i).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,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let a=this.placed,o=r.depth,c=i.depth;for(;o&&c&&a.childCount==1;)a=a.firstChild.content,o--,c--;let u=new Ie(a,o,c);return e>-1?new On(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Pn(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),a.type.spec.isolating&&i<=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 i,a=null;r?(a=$m(this.unplaced.content,r-1).firstChild,i=a.content):i=this.unplaced.content;let o=i.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(ge.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,i=$m(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Ie(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=$m(e,n);if(i.childCount<=1&&n>0){let a=e.size-n<=n+i.size;this.unplaced=new Ie(Ec(e,n-1,1),n-1,a?n-1:r)}else this.unplaced=new Ie(Ec(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let N=0;N1||u==0||N.content.size)&&(m=b,f.push(lS(N.mark(g.allowedMarks(N.marks)),h==1?u:0,h==c.childCount?y:-1)))}let w=h==c.childCount;w||(y=-1),this.placed=Tc(this.placed,n,ge.from(f)),this.frontier[n].match=m,w&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,b=c;N1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],a=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Fm(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=Tc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),a=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,a)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Tc(this.placed,this.depth,ge.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ge.empty,!0);n.childCount&&(this.placed=Tc(this.placed,this.frontier.length,n))}}function Ec(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ec(t.firstChild.content,e-1,n)))}function Tc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Tc(t.lastChild.content,e-1,n)))}function $m(t,e){for(let n=0;n1&&(r=r.replaceChild(0,lS(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(ge.empty,!0)))),t.copy(r)}function Fm(t,e,n,r,i){let a=t.node(e),o=i?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&&!wO(n,a.content,o)?c:null}function wO(t,e,n){for(let r=n;r0;g--,y--){let w=i.node(g).type.spec;if(w.defining||w.definingAsContext||w.isolating)break;o.indexOf(g)>-1?c=g:i.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 w=g.firstChild;if(h.push(w),y==r.openStart)break;g=w.content}for(let g=f-1;g>=0;g--){let y=h[g],w=NO(y.type);if(w&&!y.sameMarkup(i.node(Math.abs(c)-1)))f=g;else if(w||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),w=h[y];if(w)for(let N=0;N=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=i.before(y),n=a.after(y))}}function cS(t,e,n,r,i){if(er){let a=i.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(ge.empty,!0))}return t}function kO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=vO(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Ie(ge.from(r),0,0))}function SO(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),a=dS(r,i);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function dS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let a=t.start(i);if(ae.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(a==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==a-1)&&n.push(i)}return n}class bl extends ir{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 bn.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 i=n.type.create(r,null,n.marks);return bn.fromReplace(e,this.pos,this.pos+1,new Ie(ge.from(i),0,n.isLeaf?0:1))}getMap(){return Pr.empty}invert(e){return new bl(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 bl(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 bl(n.pos,n.attr,n.value)}}ir.jsonID("attr",bl);class Zc extends ir{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return bn.ok(r)}getMap(){return Pr.empty}invert(e){return new Zc(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 Zc(n.attr,n.value)}}ir.jsonID("docAttr",Zc);let kl=class extends Error{};kl=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};kl.prototype=Object.create(Error.prototype);kl.prototype.constructor=kl;kl.prototype.name="TransformError";class t0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Xc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new kl(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=Ie.empty){let i=vf(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Ie(ge.from(r),0,0))}delete(e,n){return this.replace(e,n,Ie.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return jO(this,e,n,r),this}replaceRangeWith(e,n,r){return kO(this,e,n,r),this}deleteRange(e,n){return SO(this,e,n),this}lift(e,n){return cO(this,e,n),this}join(e,n=1){return yO(this,e,n),this}wrap(e,n){return hO(this,e,n),this}setBlockType(e,n=e,r,i=null){return fO(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return mO(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new bl(e,n,r)),this}setDocAttribute(e,n){return this.step(new Zc(e,n)),this}addNodeMark(e,n){return this.step(new oa(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 Rt)n.isInSet(r.marks)&&this.step(new go(e,n));else{let i=r.marks,a,o=[];for(;a=n.isInSet(i);)o.push(new go(e,a)),i=a.removeFromSet(i);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return gO(this,e,n,r),this}addMark(e,n,r){return aO(this,e,n,r),this}removeMark(e,n,r){return oO(this,e,n,r),this}clearIncompatible(e,n,r){return Zx(this,e,n,r),this}}const Bm=Object.create(null);class Ze{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new uS(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?ll(e.node(0),e.node(a),e.before(a+1),e.index(a),n,r):ll(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 Dr(e.node(0))}static atStart(e){return ll(e,e,0,0,1)||new Dr(e)}static atEnd(e){return ll(e,e,e.content.size,e.childCount,-1)||new Dr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Bm[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 Bm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Bm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return qe.between(this.$anchor,this.$head).getBookmark()}}Ze.prototype.visible=!0;class uS{constructor(e,n){this.$from=e,this.$to=n}}let b1=!1;function w1(t){!b1&&!t.parent.inlineContent&&(b1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class qe extends Ze{constructor(e,n=e){w1(e),w1(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 Ze.near(r);let i=e.resolve(n.map(this.anchor));return new qe(i.parent.inlineContent?i:r,r)}replace(e,n=Ie.empty){if(super.replace(e,n),n==Ie.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof qe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bf(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 qe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let a=Ze.findFrom(n,r,!0)||Ze.findFrom(n,-r,!0);if(a)n=a.$head;else return Ze.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ze.findFrom(e,-r,!0)||Ze.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let c=e.child(o);if(c.isAtom){if(!a&&Ke.isSelectable(c))return Ke.create(t,n-(i<0?c.nodeSize:0))}else{let u=ll(t,c,n+i,i<0?c.childCount:0,i,a);if(u)return u}n+=c.nodeSize*i}return null}function N1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(Ze.near(t.doc.resolve(o),n))}const j1=1,Ru=2,k1=4;class EO extends t0{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|=Ru,this}ensureMarks(e){return Rt.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&Ru)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ru,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)||Rt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.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,i.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ze.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|=k1,this}get scrolledIntoView(){return(this.updated&k1)>0}}function S1(t,e){return!e||!t?t:t.bind(e)}class Mc{constructor(e,n,r){this.name=e,this.init=S1(n.init,r),this.apply=S1(n.apply,r)}}const TO=[new Mc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Mc("selection",{init(t,e){return t.selection||Ze.atStart(e.doc)},apply(t){return t.selection}}),new Mc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Mc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Vm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=TO.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 Mc(r.key,r.spec.state,r))})}}class gl{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 i=e[r],a=i.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(i,this[i.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 i=new Vm(e.schema,e.plugins),a=new gl(i);return i.fields.forEach(o=>{if(o.name=="doc")a.doc=xi.fromJSON(e.schema,n.doc);else if(o.name=="selection")a.selection=Ze.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 hS(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=hS(i,e,{})),n[r]=i}return n}class Bt{constructor(e){this.spec=e,this.props={},e.props&&hS(e.props,this,this.props),this.key=e.key?e.key.key:fS("plugin")}getState(e){return e[this.key]}}const Hm=Object.create(null);function fS(t){return t in Hm?t+"$"+ ++Hm[t]:(Hm[t]=0,t+"$")}class Qt{constructor(e="key"){this.key=fS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const r0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function pS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const mS=(t,e,n)=>{let r=pS(t,n);if(!r)return!1;let i=s0(r);if(!i){let o=r.blockRange(),c=o&&$l(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let a=i.nodeBefore;if(kS(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Sl(a,"end")||Ke.isSelectable(a)))for(let o=r.depth;;o--){let c=vf(t.doc,r.before(o),r.after(o),Ie.empty);if(c&&c.slice.size1)break}return a.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},MO=(t,e,n)=>{let r=pS(t,n);if(!r)return!1;let i=s0(r);return i?gS(t,i,e):!1},AO=(t,e,n)=>{let r=yS(t,n);if(!r)return!1;let i=i0(r);return i?gS(t,i,e):!1};function gS(t,e,n){let r=e.nodeBefore,i=r,a=e.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=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=vf(t.doc,a,u,Ie.empty);if(!h||h.from!=a||h instanceof Pn&&h.slice.size>=u-a)return!1;if(n){let f=t.tr.step(h);f.setSelection(qe.create(f.doc,a)),n(f.scrollIntoView())}return!0}function Sl(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 xS=(t,e,n)=>{let{$head:r,empty:i}=t.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=s0(r)}let o=a&&a.nodeBefore;return!o||!Ke.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ke.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function s0(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 yS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=yS(t,n);if(!r)return!1;let i=i0(r);if(!i)return!1;let a=i.nodeAfter;if(kS(t,i,e,1))return!0;if(r.parent.content.size==0&&(Sl(a,"start")||Ke.isSelectable(a))){let o=vf(t.doc,r.before(),r.after(),Ie.empty);if(o&&o.slice.size{let{$head:r,empty:i}=t.selection,a=r;if(!i)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 Ke,i;if(r){if(n.node.isTextblock||!Sa(t.doc,n.from))return!1;i=n.from}else if(i=yf(t.doc,n.from,-1),i==null)return!1;if(e){let a=t.tr.join(i);r&&a.setSelection(Ke.create(a.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},RO=(t,e)=>{let n=t.selection,r;if(n instanceof Ke){if(n.node.isTextblock||!Sa(t.doc,n.to))return!1;r=n.to}else if(r=yf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},PO=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),a=i&&$l(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)},wS=(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 a0(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 i=n.node(-1),a=n.indexAfter(-1),o=a0(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(Ze.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},NS=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Dr||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=a0(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.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(yi(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),i=r&&$l(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function DO(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Ke&&e.selection.node.isBlock)return!r.parentOffset||!yi(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=a0(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 qe||e.selection instanceof Dr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=yi(f.doc,m,a.length,a);if(g||(a[0]=c?{type:c}:null,g=yi(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)),w=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(w.index(),w.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const LO=DO(),_O=(t,e)=>{let{$from:n,to:r}=t.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),e&&e(t.tr.setSelection(Ke.create(t.doc,i))),!0)};function zO(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,a=e.index();return!r||!i||!r.type.compatibleContent(i.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)||!(i.isTextblock||Sa(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function kS(t,e,n,r){let i=e.nodeBefore,a=e.nodeAfter,o,c,u=i.type.spec.isolating||a.type.spec.isolating;if(!u&&zO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&c.matchType(o[0]||a.type).validEnd){if(n){let y=e.pos+a.nodeSize,w=ge.empty;for(let k=o.length-1;k>=0;k--)w=ge.from(o[k].create(null,w));w=ge.from(i.copy(w));let N=t.tr.step(new On(e.pos-1,y,e.pos,y,new Ie(w,1,0),o.length,!0)),b=N.doc.resolve(y+2*o.length);b.nodeAfter&&b.nodeAfter.type==i.type&&Sa(N.doc,b.pos)&&N.join(b.pos),n(N.scrollIntoView())}return!0}let f=a.type.spec.isolating||r>0&&u?null:Ze.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&$l(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Sl(a,"start",!0)&&Sl(i,"end")){let y=i,w=[];for(;w.push(y),!y.isTextblock;)y=y.lastChild;let N=a,b=1;for(;!N.isTextblock;N=N.firstChild)b++;if(y.canReplace(y.childCount,y.childCount,N.content)){if(n){let k=ge.empty;for(let E=w.length-1;E>=0;E--)k=ge.from(w[E].copy(k));let C=t.tr.step(new On(e.pos-w.length,e.pos+a.nodeSize,e.pos+b,e.pos+a.nodeSize-b,new Ie(k,w.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function SS(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(e.tr.setSelection(qe.create(e.doc,t<0?i.start(a):i.end(a)))),!0):!1}}const $O=SS(-1),FO=SS(1);function BO(t,e=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),c=o&&e0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function C1(t,e=null){return function(n,r){let i=!1;for(let a=0;a{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let f=n.doc.resolve(h),m=f.index();i=f.parent.canReplaceWith(m,m+1,t)}})}if(!i)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 mh(u,u,e.depth),e.endIndex=0;f--)a=ge.from(n[f].type.create(n[f].attrs,a));t.step(new On(e.start-(r?2:0),e.end,e.start,e.end,new Ie(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?KO(e,n,t,a):qO(e,n,a):!0:!1}}function KO(t,e,n,r){let i=t.tr,a=r.end,o=r.$to.end(r.depth);aN;w--)y-=i.child(w).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==i.childCount,h=a.node(-1),f=a.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?ge.empty:ge.from(i))))return!1;let m=a.pos,g=m+o.nodeSize;return r.step(new On(m-(c?1:0),g+(u?1:0),m+1,g-1,new Ie((c?ge.empty:ge.from(i.copy(ge.empty))).append(u?ge.empty:ge.from(i.copy(ge.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function GO(t){return function(e,n){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,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=ge.from(h?t.create():null),m=new Ie(ge.from(t.create(null,ge.from(c.type.create(null,f)))),h?3:1,0),g=a.start,y=a.end;n(e.tr.step(new On(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Vn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Cl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Bg=null;const pi=function(t,e,n){let r=Bg||(Bg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},JO=function(){Bg=null},xo=function(t,e,n,r){return n&&(E1(t,e,n,r,-1)||E1(t,e,n,r,1))},YO=/^(img|br|input|textarea|hr)$/i;function E1(t,e,n,r,i){for(var a;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Jr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||pd(t)||YO.test(t.nodeName)||t.contentEditable=="false")return!1;e=Vn(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Jr(t):0}else return!1}}function Jr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function QO(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=Jr(t)}else if(t.parentNode&&!pd(t))e=Vn(t),t=t.parentNode;else return null}}function XO(t,e){for(;;){if(t.nodeType==3&&e2),Gr=El||(zs?/Mac/.test(zs.platform):!1),TS=zs?/Win/.test(zs.platform):!1,gi=/Android \d/.test(Ca),md=!!T1&&"webkitFontSmoothing"in T1.documentElement.style,nD=md?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function rD(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 ci(t,e){return typeof t=="number"?t:t[e]}function sD(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 M1(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Cl(o);continue}let c=o,u=c==a.body,h=u?rD(a):sD(c),f=0,m=0;if(e.toph.bottom-ci(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+ci(i,"top")-h.top:e.bottom-h.bottom+ci(i,"bottom")),e.lefth.right-ci(r,"right")&&(f=e.right-h.right+ci(i,"right")),f||m)if(u)a.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,w=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let N=c.scrollLeft-y,b=c.scrollTop-w;e={left:e.left-N,top:e.top-b,right:e.right-N,bottom:e.bottom-b}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:Cl(o)}}function iD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let a=(e.left+e.right)/2,o=n+1;o=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack:MS(t.dom)}}function MS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Cl(r));return e}function aD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;AS(n,r==0?0:r-e)}function AS(t,e){for(let n=0;n=c){o=Math.max(w.bottom,o),c=Math.min(w.top,c);let N=w.left>e.left?w.left-e.left:w.right=(w.left+w.right)/2?1:0));continue}}else w.top>e.top&&!u&&w.left<=e.left&&w.right>=e.left&&(u=f,h={left:Math.max(w.left,Math.min(w.right,e.left)),top:w.top});!n&&(e.left>=w.right&&e.top>=w.top||e.left>=w.left&&e.top>=w.bottom)&&(a=m+1)}}return!n&&u&&(n=u,i=h,r=0),n&&n.nodeType==3?lD(n,i):!n||r&&n.nodeType==1?{node:t,offset:a}:IS(n,i)}function lD(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function l0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function cD(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,i,a)}function uD(t,e,n,r){let i=-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?i=c.posBefore:(!o&&u.right-1?i:t.docView.posFromDOM(e,n,-1)}function RS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let h;md&&i&&r.nodeType==1&&(h=r.childNodes[i-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=uD(t,r,i,e))}c==null&&(c=dD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function A1(t){return t.top=0&&i==r.nodeValue.length?(u--,f=1):n<0?u--:h++,jc(Qi(pi(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Jr(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Wm(u.getBoundingClientRect(),!1)}if(a==null&&i=0)}if(a==null&&i&&(n<0||i==Jr(r))){let u=r.childNodes[i-1],h=u.nodeType==3?pi(u,Jr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return jc(Qi(h,1),!1)}if(a==null&&i=0)}function jc(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 Wm(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 OS(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function pD(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return OS(t,e,()=>{let{node:a}=t.docView.domFromPos(i.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=PS(t,i.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=pi(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 mD=/[\u0590-\u08ac]/;function gD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,c=t.domSelection();return c?!mD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?a:o:OS(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:w,focusOffset:N}=t.domSelectionRange(),b=w&&!y.contains(w.nodeType==1?w:w.parentNode)||u==w&&h==N;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),b}):r.pos==r.start()||r.pos==r.end()}let I1=null,R1=null,P1=!1;function xD(t,e,n){return I1==e&&R1==n?P1:(I1=e,R1=n,P1=n=="up"||n=="down"?pD(t,e,n):gD(t,e,n))}const Xr=0,O1=1,eo=2,$s=3;class gd{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Xr,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;nVn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let a=this.getDesc(i),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 i=e;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof LS){i=e-a;break}a=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof DS&&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?Vn(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)){i=Vn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fw&&on){let w=c;c=u,u=w}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,i=0;i=r:er){let c=r+a.border,u=o-a.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?eo:O1,e==c&&n==u&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=$s:a.markDirty(e-c,n-c);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?eo:$s}r=o}this.dirty=eo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?eo:O1;n.dirty{if(!a)return i;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==Xr&&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 yD extends gd{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}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 yo extends gd{constructor(e,n,r,i,a){super(e,[],r,i),this.mark=n,this.spec=a}static create(e,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=So.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new yo(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&$s||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$s&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Xr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=Kg(a,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,i),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}=So.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=$S(f,r,n),h?u=new vD(e,n,r,i,f,m||null,g,h,a,o+1):n.isText?new Nf(e,n,r,i,f,g,a):new pa(e,n,r,i,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=()=>ge.empty)}return e}matchesNode(e,n,r){return this.dirty==Xr&&e.eq(this.node)&&xh(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,i=n,a=e.composing?this.localCompositionInfo(e,n):null,o=a&&a.pos>-1?a:null,c=a&&a.pos<0,u=new wD(this,o&&o.node,e);kD(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?Rt.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,i)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>i&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,i)||u.addNode(h,f,m,e,i),i+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==eo)&&(o&&this.protectLocalComposition(e,o),_S(this.contentDOM,this.children,e),El&&SD(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof qe)||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=CD(this.node.content,o,r-n,i-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:i}){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 yD(this,a,n,i);e.input.compositionNodes.push(o),this.children=Kg(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==$s||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Xr}updateOuterDeco(e){if(xh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=zS(this.dom,this.nodeDOM,Ug(this.outerDeco,this.node,n),Ug(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 D1(t,e,n,r,i){$S(r,e,t);let a=new pa(void 0,t,e,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}class Nf extends pa{constructor(e,n,r,i,a,o,c){super(e,n,r,i,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,i){return this.dirty==$s||this.dirty!=Xr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Xr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Xr,!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 i=this.node.cut(e,n),a=document.createTextNode(i.text);return new Nf(this.parent,i,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=$s)}get domAtom(){return!1}isText(e){return this.node.text==e}}class LS extends gd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class vD extends pa{constructor(e,n,r,i,a,o,c,u,h,f){super(e,n,r,i,a,o,c,h,f),this.spec=u}update(e,n,r,i){if(this.dirty==$s)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,i),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 _S(t,e,n){let r=t.firstChild,i=!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=yo.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,i){let a=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-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 yo)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(i-1))break;--i,a.set(c,i),o.push(c)}}return{index:i,matched:a,matches:o.reverse()}}function jD(t,e){return t.type.side-e.type.side}function kD(t,e,n,r){let i=e.locals(t),a=0;if(i.length==0){for(let h=0;ha;)c.push(i[o++]);let w=a+g.nodeSize;if(g.isText){let b=w;o!b.inline):c.slice();r(g,N,e.forChild(a,g),y),a=w}}function SD(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 CD(t,e,n,r){for(let i=0,a=0;i=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 Kg(t,e,n,r,i){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 c0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(wf(n)){for(u=o;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Ke.isSelectable(m)&&i.parent&&!(m.isInline&&ZO(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;h=new Ke(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!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!FS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function TD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Vn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&kr&&fa<=11&&(n.disabled=!0,n.disabled=!1)}function BS(t,e){if(e instanceof Ke){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(F1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else F1(t)}function F1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function d0(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||qe.between(e,n,r)}function B1(t){return t.editable&&!t.hasFocus()?!1:VS(t)}function VS(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 MD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return xo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qg(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&Ze.findFrom(a,e)}function Xi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function V1(t,e,n){let r=t.state.selection;if(r instanceof qe)if(n.indexOf("s")>-1){let{$head:i}=r,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+a.nodeSize*(e<0?-1:1));return Xi(t,new qe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=qg(t.state,e);return i&&i instanceof Ke?Xi(t,i):!1}else if(!(Gr&&n.indexOf("m")>-1)){let i=r.$head,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!a||a.isText)return!1;let c=e<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ke.isSelectable(a)?Xi(t,new Ke(e<0?t.state.doc.resolve(i.pos-a.nodeSize):i)):md?Xi(t,new qe(t.state.doc.resolve(e<0?c:c+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ke&&r.node.isInline)return Xi(t,new qe(e>0?r.$to:r.$from));{let i=qg(t.state,e);return i?Xi(t,i):!1}}}function yh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ol(t,e){return e<0?AD(t):ID(t)}function AD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,a,o=!1;for(Qr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(zc(c,-1))i=n,a=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(HS(n))break;{let c=n.previousSibling;for(;c&&zc(c,-1);)i=n.parentNode,a=Vn(c),c=c.previousSibling;if(c)n=c,r=yh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Gg(t,n,r):i&&Gg(t,i,a)}function ID(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=yh(n),a,o;for(;;)if(r{t.state==i&&vi(t)},50)}function H1(t,e){let n=t.state.doc.resolve(e);if(!(Wn||TS)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>i.top&&o1)return a.lefti.top&&o1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function W1(t,e,n){let r=t.state.selection;if(r instanceof qe&&!r.empty||n.indexOf("s")>-1||Gr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=qg(t.state,e);if(o&&o instanceof Ke)return Xi(t,o)}if(!i.parent.inlineContent){let o=e<0?i:a,c=r instanceof Dr?Ze.near(o,e):Ze.findFrom(o,e);return c?Xi(t,c):!1}return!1}function U1(t,e){if(!(t.state.selection instanceof qe))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)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 K1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function OD(t){if(!rr||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;K1(t,r,"true"),setTimeout(()=>K1(t,r,"false"),20)}return!1}function DD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function LD(t,e){let n=e.keyCode,r=DD(e);if(n==8||Gr&&n==72&&r=="c")return U1(t,-1)||ol(t,-1);if(n==46&&!e.shiftKey||Gr&&n==68&&r=="c")return U1(t,1)||ol(t,1);if(n==13||n==27)return!0;if(n==37||Gr&&n==66&&r=="c"){let i=n==37?H1(t,t.state.selection.from)=="ltr"?-1:1:-1;return V1(t,i,r)||ol(t,i)}else if(n==39||Gr&&n==70&&r=="c"){let i=n==39?H1(t,t.state.selection.from)=="ltr"?1:-1:1;return V1(t,i,r)||ol(t,i)}else{if(n==38||Gr&&n==80&&r=="c")return W1(t,-1,r)||ol(t,-1);if(n==40||Gr&&n==78&&r=="c")return OD(t)||W1(t,1,r)||ol(t,1);if(r==(Gr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function u0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:i,openEnd:a}=e;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,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")||So.fromSchema(t.state.schema),c=JS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=GS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let w=c.createElement(f[y]);for(;u.firstChild;)w.appendChild(u.firstChild);u.appendChild(w),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${a}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` + */var a1;function OP(){if(a1)return Lm;a1=1;var t=dd();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,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),w=r({inst:{value:y,getSnapshot:g}}),N=w[0].inst,b=w[1];return a(function(){N.value=y,N.getSnapshot=g,u(N)&&b({inst:N})},[m,y,g]),i(function(){return u(N)&&b({inst:N}),m(function(){u(N)&&b({inst:N})})},[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 Lm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Lm}var o1;function Pk(){return o1||(o1=1,Dm.exports=OP()),Dm.exports}var Ok=Pk();function Vn(t){this.content=t}Vn.prototype={constructor:Vn,find:function(t){for(var e=0;e>1}};Vn.from=function(t){if(t instanceof Vn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Vn(e)};function Dk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)n++;return n}if(i.content.size||a.content.size){let o=Dk(i.content,a.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Lk(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=t.child(--i),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,i+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,i+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){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?i?typeof i=="function"?i(c):i: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,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.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),i+=c.nodeSize),o=u}return new ge(r,i)}cutByIndex(e,n){return e==n?ge.empty:e==0&&n==this.content.length?this:new ge(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new ge(i,a)}addToStart(e){return new ge([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ge(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 i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Iu(n+1,a):Iu(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 ge.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ge(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ge.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),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-i.type.rank),n}};Ot.none=[];class ph extends Error{}class Ie{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=zk(this.content,e+this.openStart,n);return r&&new Ie(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ie(_k(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 Ie.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ie(ge.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=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)i++;return new Ie(e,r,i)}}Ie.empty=new Ie(ge.empty,0,0);function _k(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(i==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(_k(a.content,e-i-1,n-i-1)))}function zk(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),o=t.maybeChild(i);if(a==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=zk(o.content,e-a-1,n,o);return c&&t.replaceChild(i,o.copy(c))}function DP(t,e,n){if(n.openStart>t.depth)throw new ph("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ph("Inconsistent open depths");return $k(t,e,n,0)}function $k(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Lc(t,e,n,r){let i=(e||t).node(n),a=0,o=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(ao(t.nodeAfter,r),a++));for(let c=a;ci&&_g(t,e,i+1),o=r.depth>i&&_g(n,r,i+1),c=[];return Lc(null,t,i,c),a&&o&&e.index(i)==n.index(i)?(Fk(a,o),ao(oo(a,Bk(t,e,n,r,i+1)),c)):(a&&ao(oo(a,mh(t,e,i+1)),c),Lc(e,n,i,c),o&&ao(oo(o,mh(n,r,i+1)),c)),Lc(r,null,i,c),new ge(c)}function mh(t,e,n){let r=[];if(Lc(null,t,n,r),t.depth>n){let i=_g(t,e,n+1);ao(oo(i,mh(t,e,n+1)),r)}return Lc(e,null,n,r),new ge(r)}function LP(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(ge.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Qc{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],i=e.child(n);return r?e.child(n).cut(r):i}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],i=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 gh(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=[],i=0,a=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(a),h=a-u;if(r.push(o,c,i+u),!h||(o=o.child(c),o.isText))break;a=h-1,i+=u+1}return new Qc(n,r,a)}static resolveCached(e,n){let r=l1.get(e);if(r)for(let a=0;ae&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}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()+")"),Vk(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=ge.empty,i=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,a),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=i;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 i=ge.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};mi.prototype.text=void 0;class xh extends mi{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Vk(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 xh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xh(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 Vk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class go{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new FP(e,n);if(r.next==null)return go.empty;let i=Hk(r);r.next&&r.err("Unexpected trailing text");let a=qP(KP(i));return GP(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 i=0;i{let a=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return a}).join(` +`)}}go.empty=new go(!0);class FP{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 Hk(t){let e=[];do e.push(BP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function BP(t){let e=[];do e.push(VP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function VP(t){let e=UP(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=HP(t,e);else break;return e}function c1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function HP(t,e){let n=c1(t),r=n;return t.eat(",")&&(t.next!="}"?r=c1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function WP(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let o=n[a];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function UP(t){if(t.eat("(")){let e=Hk(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=WP(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 KP(t){let e=[[]];return i(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 i(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;i(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),i(a(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(a(o.expr,c),u),i(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||i.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let a=e[r.join(",")]=new go(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:Kk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new mi(this,this.computeAttrs(e),ge.from(n),Ot.setFrom(r))}createChecked(e=null,n,r){return n=ge.from(n),this.checkContent(n),new mi(this,this.computeAttrs(e),n,Ot.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ge.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(ge.empty,!0);return a?new mi(this,e,n.append(a),Ot.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 Jk(a,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");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 JP(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class YP{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?JP(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class yf{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Gk(e,i.attrs),this.excluded=null;let a=Uk(this.attrs);this.instance=a?new Ot(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Ot(this,Kk(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,o)=>r[a]=new yf(a,i++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class Yk{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Vn.from(e.nodes),n.marks=Vn.from(e.marks||{}),this.nodes=u1.compile(this.spec.nodes,this),this.marks=yf.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],o=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=go.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?h1(this,c.split(" ")):c==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:h1(this,o.split(" "))}this.nodeFromJSON=i=>mi.fromJSON(this,i),this.markFromJSON=i=>Ot.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof u1){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,i)}text(e,n){let r=this.nodes.text;return new xh(r,r.defaultAttrs,e,Ot.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 h1(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 QP(t){return t.tag!=null}function XP(t){return t.style!=null}class fa{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(QP(i))this.tags.push(i);else if(XP(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new p1(this,n,!1);return r.addAll(e,Ot.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new p1(this,n,!0);return r.addAll(e,Ot.none,n.from,n.to),Ie.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.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(i){let a=i.priority==null?50:i.priority,o=0;for(;o{r(o=m1(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{r(o=m1(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new fa(e,fa.schemaRules(e)))}}const Qk={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},ZP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xk={ol:!0,ul:!0},Xc=1,$g=2,_c=4;function f1(t,e,n){return e!=null?(e?Xc:0)|(e==="full"?$g:0):t&&t.whitespace=="pre"?Xc|$g:n&~_c}class Ru{constructor(e,n,r,i,a,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Ot.none,this.match=a||(o&_c?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ge.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Xc)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=ge.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ge.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&&!Qk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class p1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,o=f1(null,n.preserveWhitespace,0)|(r?_c:0);i?a=new Ru(i.type,i.attrs,Ot.none,!0,n.topMatch||i.type.contentMatch,o):r?a=new Ru(null,null,Ot.none,!0,null,o):a=new Ru(e.schema.topNodeType,null,Ot.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,i=this.top,a=i.options&$g?"full":this.localPreserveWS||(i.options&Xc)>0,{schema:o}=this.parser;if(a==="full"||i.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,i){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(i)this.addElement(e,r,i);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,i){let a=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];o!=c;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,n);this.findAtPoint(e,a)}findPlace(e,n,r){let i,a;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!i||i.length>h.length+c)&&(i=h,a=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!i)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):g1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Ru(e,n,u,i,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|=Xc)}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 i=r.length-1;i>=0;i--)e+=r[i].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,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?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&&i?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 eO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Xk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function tO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function m1(t){let e={};for(let n in t)e[n]=t[n];return e}function g1(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.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;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Qu(zm(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Qu(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Co(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=x1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return x1(e.marks)}}function x1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function zm(t){return t.document||window.document}const y1=new WeakMap;function nO(t){let e=y1.get(t);return e===void 0&&y1.set(t,e=rO(t)),e}function rO(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 i=0;i-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=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let c,u=n?t.createElementNS(n,i):t.createElement(i),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:w}=Qu(t,g,n,r);if(u.appendChild(y),w){if(c)throw new RangeError("Multiple content holes");c=w}}}return{dom:u,contentDOM:c}}const Zk=65535,eS=Math.pow(2,16);function sO(t,e){return t+e*eS}function v1(t){return t&Zk}function iO(t){return(t-(t&Zk))/eS}const tS=1,nS=2,Xu=4,rS=8;class Fg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&rS)>0}get deletedBefore(){return(this.delInfo&(tS|Xu))>0}get deletedAfter(){return(this.delInfo&(nS|Xu))>0}get deletedAcross(){return(this.delInfo&Xu)>0}}class Or{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Or.empty)return Or.empty}recover(e){let n=0,r=v1(e);if(!this.inverted)for(let i=0;ie)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+i+(g<0?0:f);if(r)return y;let w=e==(n<0?u:m)?null:sO(c/3,e-u),N=e==u?nS:e==m?tS:Xu;return(n<0?e!=u:e!=m)&&(N|=rS),new Fg(y,N,w)}i+=f-h}return r?e+i:new Fg(e+i,0,null)}touches(e,n){let r=0,i=v1(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==i*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 i=0,a=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Zc;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)),i),n.openStart,n.openEnd);return Nn.fromReplace(e,this.from,this.to,a)}invert(){return new xs(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 oa(n.pos,r.pos,this.mark)}merge(e){return e instanceof oa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new oa(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 oa(n.from,n.to,e.markFromJSON(n.mark))}}or.jsonID("addMark",oa);class xs extends or{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 Ie(Zx(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Nn.fromReplace(e,this.from,this.to,r)}invert(){return new oa(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 xs(n.pos,r.pos,this.mark)}merge(e){return e instanceof xs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xs(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 xs(n.from,n.to,e.markFromJSON(n.mark))}}or.jsonID("removeMark",xs);class la extends or{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Nn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Nn.fromReplace(e,this.pos,this.pos+1,new Ie(ge.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 i=0;ir.pos?null:new Ln(n.pos,r.pos,i,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 Ln(n.from,n.to,n.gapFrom,n.gapTo,Ie.fromJSON(e,n.slice),n.insert,!!n.structure)}}or.jsonID("replaceAround",Ln);function Bg(t,e,n){let r=t.resolve(e),i=n-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function aO(t,e,n,r){let i=[],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),w=r.addToSet(m);for(let N=0;Nt.step(u)),a.forEach(u=>t.step(u))}function oO(t,e,n,r){let i=[],a=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;a++;let u=null;if(r instanceof yf){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 xs(o.from,o.to,o.style)))}function e0(t,e,n,r=n.contentMatch,i=!0){let a=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function lO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function _l(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,a=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+i,u=t.$to.indexAfter(r)-a;if(rn;w--)N||r.index(w)>0?(N=!0,f=ge.from(r.node(w).copy(f)),m++):u--;let g=ge.empty,y=0;for(let w=a,N=!1;w>n;w--)N||i.after(w+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=ge.from(n[o].type.create(n[o].attrs,r))}let i=e.start,a=e.end;t.step(new Ln(i,a,i,a,new Ie(r,0,0),n.length,!0))}function fO(t,e,n,r,i){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 i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&pO(t.doc,t.mapping.slice(a).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",w=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!w?h=!1:!y&&w&&(h=!0)}h===!1&&iS(t,o,c,a),e0(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 Ln(m,g,m+1,g-1,new Ie(ge.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&sS(t,o,c,a),!1}})}function sS(t,e,n,r){e.forEach((i,a)=>{if(i.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(i.text);){let u=t.mapping.slice(r).map(n+1+a+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function iS(t,e,n,r){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+a);t.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function pO(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function mO(t,e,n,r,i){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,i||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 Ln(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new Ie(ge.from(o),0,0),1,!0))}function gi(t,e,n=1,r){let i=t.resolve(e),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,f=n-2;h>a;h--,f--){let m=i.node(h),g=i.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),w=r&&r[f+1];w&&(y=y.replaceChild(0,w.type.create(w.attrs)));let N=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!N.type.validContent(y))return!1}let c=i.indexAfter(a),u=r&&r[0];return i.node(a).canReplaceWith(c,c,u?u.type:i.node(a+1).type)}function gO(t,e,n=1,r){let i=t.doc.resolve(e),a=ge.empty,o=ge.empty;for(let c=i.depth,u=i.depth-n,h=n-1;c>u;c--,h--){a=ge.from(i.node(c).copy(a));let f=r&&r[h];o=ge.from(f?f.type.create(f.attrs,o):i.node(c).copy(o))}t.step(new Dn(e,e,new Ie(a.append(o),n,n),!0))}function Ca(t,e){let n=t.resolve(e),r=n.index();return aS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function xO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i0?(a=r.node(i+1),c++,o=r.node(i).maybeChild(c)):(a=r.node(i).maybeChild(c-1),o=r.node(i+1)),a&&!a.isTextblock&&aS(a,o)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function yO(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,a=t.doc.resolve(e-n),o=a.node().type;if(i&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(i);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);iS(t,f.node(),f.before(),c)}o.inlineContent&&e0(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 Dn(h,u.map(e+n,-1),Ie.empty,!0)),r===!0){let f=t.doc.resolve(h);sS(t,f.node(),f.before(),t.steps.length)}return t}function vO(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 i=r.depth-1;i>=0;i--){let a=r.index(i);if(r.node(i).canReplaceWith(a,a,n))return r.before(i+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let a=r.indexAfter(i);if(r.node(i).canReplaceWith(a,a,n))return r.after(i+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,i);else{let m=h.contentMatchAt(u).findWrapping(i.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 bf(t,e,n=e,r=Ie.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),a=t.resolve(n);return lS(i,a,r)?new Dn(e,n,r):new bO(i,a,r).fit()}function lS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class bO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ge.empty;for(let i=0;i<=e.depth;i++){let a=e.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=ge.from(e.node(i).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,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let a=this.placed,o=r.depth,c=i.depth;for(;o&&c&&a.childCount==1;)a=a.firstChild.content,o--,c--;let u=new Ie(a,o,c);return e>-1?new Ln(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Dn(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),a.type.spec.isolating&&i<=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 i,a=null;r?(a=Fm(this.unplaced.content,r-1).firstChild,i=a.content):i=this.unplaced.content;let o=i.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(ge.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,i=Fm(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Ie(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Fm(e,n);if(i.childCount<=1&&n>0){let a=e.size-n<=n+i.size;this.unplaced=new Ie(Tc(e,n-1,1),n-1,a?n-1:r)}else this.unplaced=new Ie(Tc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let N=0;N1||u==0||N.content.size)&&(m=b,f.push(cS(N.mark(g.allowedMarks(N.marks)),h==1?u:0,h==c.childCount?y:-1)))}let w=h==c.childCount;w||(y=-1),this.placed=Mc(this.placed,n,ge.from(f)),this.frontier[n].match=m,w&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,b=c;N1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],a=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Bm(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=Mc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),a=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,a)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Mc(this.placed,this.depth,ge.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ge.empty,!0);n.childCount&&(this.placed=Mc(this.placed,this.frontier.length,n))}}function Tc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Tc(t.firstChild.content,e-1,n)))}function Mc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Mc(t.lastChild.content,e-1,n)))}function Fm(t,e){for(let n=0;n1&&(r=r.replaceChild(0,cS(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(ge.empty,!0)))),t.copy(r)}function Bm(t,e,n,r,i){let a=t.node(e),o=i?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&&!wO(n,a.content,o)?c:null}function wO(t,e,n){for(let r=n;r0;g--,y--){let w=i.node(g).type.spec;if(w.defining||w.definingAsContext||w.isolating)break;o.indexOf(g)>-1?c=g:i.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 w=g.firstChild;if(h.push(w),y==r.openStart)break;g=w.content}for(let g=f-1;g>=0;g--){let y=h[g],w=NO(y.type);if(w&&!y.sameMarkup(i.node(Math.abs(c)-1)))f=g;else if(w||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),w=h[y];if(w)for(let N=0;N=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=i.before(y),n=a.after(y))}}function dS(t,e,n,r,i){if(er){let a=i.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(ge.empty,!0))}return t}function kO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=vO(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Ie(ge.from(r),0,0))}function SO(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),a=uS(r,i);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function uS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let a=t.start(i);if(ae.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(a==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==a-1)&&n.push(i)}return n}class yl extends or{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 Nn.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 i=n.type.create(r,null,n.marks);return Nn.fromReplace(e,this.pos,this.pos+1,new Ie(ge.from(i),0,n.isLeaf?0:1))}getMap(){return Or.empty}invert(e){return new yl(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 yl(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 yl(n.pos,n.attr,n.value)}}or.jsonID("attr",yl);class ed extends or{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Nn.ok(r)}getMap(){return Or.empty}invert(e){return new ed(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 ed(n.attr,n.value)}}or.jsonID("docAttr",ed);let Nl=class extends Error{};Nl=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Nl.prototype=Object.create(Error.prototype);Nl.prototype.constructor=Nl;Nl.prototype.name="TransformError";class n0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Zc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Nl(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=Ie.empty){let i=bf(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Ie(ge.from(r),0,0))}delete(e,n){return this.replace(e,n,Ie.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return jO(this,e,n,r),this}replaceRangeWith(e,n,r){return kO(this,e,n,r),this}deleteRange(e,n){return SO(this,e,n),this}lift(e,n){return cO(this,e,n),this}join(e,n=1){return yO(this,e,n),this}wrap(e,n){return hO(this,e,n),this}setBlockType(e,n=e,r,i=null){return fO(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return mO(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new yl(e,n,r)),this}setDocAttribute(e,n){return this.step(new ed(e,n)),this}addNodeMark(e,n){return this.step(new la(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 Ot)n.isInSet(r.marks)&&this.step(new xo(e,n));else{let i=r.marks,a,o=[];for(;a=n.isInSet(i);)o.push(new xo(e,a)),i=a.removeFromSet(i);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return gO(this,e,n,r),this}addMark(e,n,r){return aO(this,e,n,r),this}removeMark(e,n,r){return oO(this,e,n,r),this}clearIncompatible(e,n,r){return e0(this,e,n,r),this}}const Vm=Object.create(null);class et{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new hS(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?al(e.node(0),e.node(a),e.before(a+1),e.index(a),n,r):al(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 Lr(e.node(0))}static atStart(e){return al(e,e,0,0,1)||new Lr(e)}static atEnd(e){return al(e,e,e.content.size,e.childCount,-1)||new Lr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Vm[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 Vm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Vm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ge.between(this.$anchor,this.$head).getBookmark()}}et.prototype.visible=!0;class hS{constructor(e,n){this.$from=e,this.$to=n}}let w1=!1;function N1(t){!w1&&!t.parent.inlineContent&&(w1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ge extends et{constructor(e,n=e){N1(e),N1(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 et.near(r);let i=e.resolve(n.map(this.anchor));return new Ge(i.parent.inlineContent?i:r,r)}replace(e,n=Ie.empty){if(super.replace(e,n),n==Ie.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ge&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new wf(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 Ge(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let a=et.findFrom(n,r,!0)||et.findFrom(n,-r,!0);if(a)n=a.$head;else return et.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(et.findFrom(e,-r,!0)||et.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let c=e.child(o);if(c.isAtom){if(!a&&qe.isSelectable(c))return qe.create(t,n-(i<0?c.nodeSize:0))}else{let u=al(t,c,n+i,i<0?c.childCount:0,i,a);if(u)return u}n+=c.nodeSize*i}return null}function j1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(et.near(t.doc.resolve(o),n))}const k1=1,Pu=2,S1=4;class EO extends n0{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|=Pu,this}ensureMarks(e){return Ot.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&Pu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Pu,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)||Ot.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.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,i.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(et.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|=S1,this}get scrolledIntoView(){return(this.updated&S1)>0}}function C1(t,e){return!e||!t?t:t.bind(e)}class Ac{constructor(e,n,r){this.name=e,this.init=C1(n.init,r),this.apply=C1(n.apply,r)}}const TO=[new Ac("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ac("selection",{init(t,e){return t.selection||et.atStart(e.doc)},apply(t){return t.selection}}),new Ac("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ac("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Hm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=TO.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 Ac(r.key,r.spec.state,r))})}}class pl{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 i=e[r],a=i.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(i,this[i.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 i=new Hm(e.schema,e.plugins),a=new pl(i);return i.fields.forEach(o=>{if(o.name=="doc")a.doc=mi.fromJSON(e.schema,n.doc);else if(o.name=="selection")a.selection=et.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 fS(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=fS(i,e,{})),n[r]=i}return n}class Wt{constructor(e){this.spec=e,this.props={},e.props&&fS(e.props,this,this.props),this.key=e.key?e.key.key:pS("plugin")}getState(e){return e[this.key]}}const Wm=Object.create(null);function pS(t){return t in Wm?t+"$"+ ++Wm[t]:(Wm[t]=0,t+"$")}class tn{constructor(e="key"){this.key=pS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const s0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function mS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const gS=(t,e,n)=>{let r=mS(t,n);if(!r)return!1;let i=i0(r);if(!i){let o=r.blockRange(),c=o&&_l(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let a=i.nodeBefore;if(SS(t,i,e,-1))return!0;if(r.parent.content.size==0&&(jl(a,"end")||qe.isSelectable(a)))for(let o=r.depth;;o--){let c=bf(t.doc,r.before(o),r.after(o),Ie.empty);if(c&&c.slice.size1)break}return a.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},MO=(t,e,n)=>{let r=mS(t,n);if(!r)return!1;let i=i0(r);return i?xS(t,i,e):!1},AO=(t,e,n)=>{let r=vS(t,n);if(!r)return!1;let i=a0(r);return i?xS(t,i,e):!1};function xS(t,e,n){let r=e.nodeBefore,i=r,a=e.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=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=bf(t.doc,a,u,Ie.empty);if(!h||h.from!=a||h instanceof Dn&&h.slice.size>=u-a)return!1;if(n){let f=t.tr.step(h);f.setSelection(Ge.create(f.doc,a)),n(f.scrollIntoView())}return!0}function jl(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 yS=(t,e,n)=>{let{$head:r,empty:i}=t.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=i0(r)}let o=a&&a.nodeBefore;return!o||!qe.isSelectable(o)?!1:(e&&e(t.tr.setSelection(qe.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function i0(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 vS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=vS(t,n);if(!r)return!1;let i=a0(r);if(!i)return!1;let a=i.nodeAfter;if(SS(t,i,e,1))return!0;if(r.parent.content.size==0&&(jl(a,"start")||qe.isSelectable(a))){let o=bf(t.doc,r.before(),r.after(),Ie.empty);if(o&&o.slice.size{let{$head:r,empty:i}=t.selection,a=r;if(!i)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 qe,i;if(r){if(n.node.isTextblock||!Ca(t.doc,n.from))return!1;i=n.from}else if(i=vf(t.doc,n.from,-1),i==null)return!1;if(e){let a=t.tr.join(i);r&&a.setSelection(qe.create(a.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},RO=(t,e)=>{let n=t.selection,r;if(n instanceof qe){if(n.node.isTextblock||!Ca(t.doc,n.to))return!1;r=n.to}else if(r=vf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},PO=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),a=i&&_l(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)},NS=(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 o0(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 i=n.node(-1),a=n.indexAfter(-1),o=o0(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(et.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},jS=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Lr||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=o0(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.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(gi(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),i=r&&_l(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function DO(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof qe&&e.selection.node.isBlock)return!r.parentOffset||!gi(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=o0(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 Ge||e.selection instanceof Lr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=gi(f.doc,m,a.length,a);if(g||(a[0]=c?{type:c}:null,g=gi(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)),w=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(w.index(),w.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const LO=DO(),_O=(t,e)=>{let{$from:n,to:r}=t.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),e&&e(t.tr.setSelection(qe.create(t.doc,i))),!0)};function zO(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,a=e.index();return!r||!i||!r.type.compatibleContent(i.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)||!(i.isTextblock||Ca(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function SS(t,e,n,r){let i=e.nodeBefore,a=e.nodeAfter,o,c,u=i.type.spec.isolating||a.type.spec.isolating;if(!u&&zO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&c.matchType(o[0]||a.type).validEnd){if(n){let y=e.pos+a.nodeSize,w=ge.empty;for(let k=o.length-1;k>=0;k--)w=ge.from(o[k].create(null,w));w=ge.from(i.copy(w));let N=t.tr.step(new Ln(e.pos-1,y,e.pos,y,new Ie(w,1,0),o.length,!0)),b=N.doc.resolve(y+2*o.length);b.nodeAfter&&b.nodeAfter.type==i.type&&Ca(N.doc,b.pos)&&N.join(b.pos),n(N.scrollIntoView())}return!0}let f=a.type.spec.isolating||r>0&&u?null:et.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&_l(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&jl(a,"start",!0)&&jl(i,"end")){let y=i,w=[];for(;w.push(y),!y.isTextblock;)y=y.lastChild;let N=a,b=1;for(;!N.isTextblock;N=N.firstChild)b++;if(y.canReplace(y.childCount,y.childCount,N.content)){if(n){let k=ge.empty;for(let E=w.length-1;E>=0;E--)k=ge.from(w[E].copy(k));let C=t.tr.step(new Ln(e.pos-w.length,e.pos+a.nodeSize,e.pos+b,e.pos+a.nodeSize-b,new Ie(k,w.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function CS(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(e.tr.setSelection(Ge.create(e.doc,t<0?i.start(a):i.end(a)))),!0):!1}}const $O=CS(-1),FO=CS(1);function BO(t,e=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),c=o&&t0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function E1(t,e=null){return function(n,r){let i=!1;for(let a=0;a{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let f=n.doc.resolve(h),m=f.index();i=f.parent.canReplaceWith(m,m+1,t)}})}if(!i)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 gh(u,u,e.depth),e.endIndex=0;f--)a=ge.from(n[f].type.create(n[f].attrs,a));t.step(new Ln(e.start-(r?2:0),e.end,e.start,e.end,new Ie(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?KO(e,n,t,a):qO(e,n,a):!0:!1}}function KO(t,e,n,r){let i=t.tr,a=r.end,o=r.$to.end(r.depth);aN;w--)y-=i.child(w).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==i.childCount,h=a.node(-1),f=a.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?ge.empty:ge.from(i))))return!1;let m=a.pos,g=m+o.nodeSize;return r.step(new Ln(m-(c?1:0),g+(u?1:0),m+1,g-1,new Ie((c?ge.empty:ge.from(i.copy(ge.empty))).append(u?ge.empty:ge.from(i.copy(ge.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function GO(t){return function(e,n){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,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=ge.from(h?t.create():null),m=new Ie(ge.from(t.create(null,ge.from(c.type.create(null,f)))),h?3:1,0),g=a.start,y=a.end;n(e.tr.step(new Ln(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Wn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},kl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Vg=null;const hi=function(t,e,n){let r=Vg||(Vg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},JO=function(){Vg=null},yo=function(t,e,n,r){return n&&(T1(t,e,n,r,-1)||T1(t,e,n,r,1))},YO=/^(img|br|input|textarea|hr)$/i;function T1(t,e,n,r,i){for(var a;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Qr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||md(t)||YO.test(t.nodeName)||t.contentEditable=="false")return!1;e=Wn(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Qr(t):0}else return!1}}function Qr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function QO(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=Qr(t)}else if(t.parentNode&&!md(t))e=Wn(t),t=t.parentNode;else return null}}function XO(t,e){for(;;){if(t.nodeType==3&&e2),Yr=Sl||(_s?/Mac/.test(_s.platform):!1),MS=_s?/Win/.test(_s.platform):!1,pi=/Android \d/.test(Ea),gd=!!M1&&"webkitFontSmoothing"in M1.documentElement.style,nD=gd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function rD(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 oi(t,e){return typeof t=="number"?t:t[e]}function sD(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 A1(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=kl(o);continue}let c=o,u=c==a.body,h=u?rD(a):sD(c),f=0,m=0;if(e.toph.bottom-oi(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+oi(i,"top")-h.top:e.bottom-h.bottom+oi(i,"bottom")),e.lefth.right-oi(r,"right")&&(f=e.right-h.right+oi(i,"right")),f||m)if(u)a.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,w=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let N=c.scrollLeft-y,b=c.scrollTop-w;e={left:e.left-N,top:e.top-b,right:e.right-N,bottom:e.bottom-b}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:kl(o)}}function iD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let a=(e.left+e.right)/2,o=n+1;o=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack:AS(t.dom)}}function AS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=kl(r));return e}function aD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;IS(n,r==0?0:r-e)}function IS(t,e){for(let n=0;n=c){o=Math.max(w.bottom,o),c=Math.min(w.top,c);let N=w.left>e.left?w.left-e.left:w.right=(w.left+w.right)/2?1:0));continue}}else w.top>e.top&&!u&&w.left<=e.left&&w.right>=e.left&&(u=f,h={left:Math.max(w.left,Math.min(w.right,e.left)),top:w.top});!n&&(e.left>=w.right&&e.top>=w.top||e.left>=w.left&&e.top>=w.bottom)&&(a=m+1)}}return!n&&u&&(n=u,i=h,r=0),n&&n.nodeType==3?lD(n,i):!n||r&&n.nodeType==1?{node:t,offset:a}:RS(n,i)}function lD(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function c0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function cD(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,i,a)}function uD(t,e,n,r){let i=-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?i=c.posBefore:(!o&&u.right-1?i:t.docView.posFromDOM(e,n,-1)}function PS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let h;gd&&i&&r.nodeType==1&&(h=r.childNodes[i-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=uD(t,r,i,e))}c==null&&(c=dD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function I1(t){return t.top=0&&i==r.nodeValue.length?(u--,f=1):n<0?u--:h++,kc(Xi(hi(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Qr(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Um(u.getBoundingClientRect(),!1)}if(a==null&&i=0)}if(a==null&&i&&(n<0||i==Qr(r))){let u=r.childNodes[i-1],h=u.nodeType==3?hi(u,Qr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return kc(Xi(h,1),!1)}if(a==null&&i=0)}function kc(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 Um(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 DS(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function pD(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return DS(t,e,()=>{let{node:a}=t.docView.domFromPos(i.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=OS(t,i.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=hi(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 mD=/[\u0590-\u08ac]/;function gD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,c=t.domSelection();return c?!mD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?a:o:DS(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:w,focusOffset:N}=t.domSelectionRange(),b=w&&!y.contains(w.nodeType==1?w:w.parentNode)||u==w&&h==N;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),b}):r.pos==r.start()||r.pos==r.end()}let R1=null,P1=null,O1=!1;function xD(t,e,n){return R1==e&&P1==n?O1:(R1=e,P1=n,O1=n=="up"||n=="down"?pD(t,e,n):gD(t,e,n))}const es=0,D1=1,to=2,zs=3;class xd{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=es,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;nWn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let a=this.getDesc(i),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 i=e;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof _S){i=e-a;break}a=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof LS&&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?Wn(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)){i=Wn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fw&&on){let w=c;c=u,u=w}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,i=0;i=r:er){let c=r+a.border,u=o-a.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?to:D1,e==c&&n==u&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=zs:a.markDirty(e-c,n-c);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?to:zs}r=o}this.dirty=to}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?to:D1;n.dirty{if(!a)return i;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==es&&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 yD extends xd{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}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 vo extends xd{constructor(e,n,r,i,a){super(e,[],r,i),this.mark=n,this.spec=a}static create(e,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Co.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new vo(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&zs||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=zs&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=es){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=qg(a,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,i),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}=Co.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=FS(f,r,n),h?u=new vD(e,n,r,i,f,m||null,g,h,a,o+1):n.isText?new jf(e,n,r,i,f,g,a):new ma(e,n,r,i,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=()=>ge.empty)}return e}matchesNode(e,n,r){return this.dirty==es&&e.eq(this.node)&&yh(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,i=n,a=e.composing?this.localCompositionInfo(e,n):null,o=a&&a.pos>-1?a:null,c=a&&a.pos<0,u=new wD(this,o&&o.node,e);kD(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?Ot.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,i)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>i&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,i)||u.addNode(h,f,m,e,i),i+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==to)&&(o&&this.protectLocalComposition(e,o),zS(this.contentDOM,this.children,e),Sl&&SD(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Ge)||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=CD(this.node.content,o,r-n,i-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:i}){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 yD(this,a,n,i);e.input.compositionNodes.push(o),this.children=qg(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==zs||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=es}updateOuterDeco(e){if(yh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=$S(this.dom,this.nodeDOM,Kg(this.outerDeco,this.node,n),Kg(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 L1(t,e,n,r,i){FS(r,e,t);let a=new ma(void 0,t,e,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}class jf extends ma{constructor(e,n,r,i,a,o,c){super(e,n,r,i,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,i){return this.dirty==zs||this.dirty!=es&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=es||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=es,!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 i=this.node.cut(e,n),a=document.createTextNode(i.text);return new jf(this.parent,i,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=zs)}get domAtom(){return!1}isText(e){return this.node.text==e}}class _S extends xd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==es&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class vD extends ma{constructor(e,n,r,i,a,o,c,u,h,f){super(e,n,r,i,a,o,c,h,f),this.spec=u}update(e,n,r,i){if(this.dirty==zs)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,i),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 zS(t,e,n){let r=t.firstChild,i=!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=vo.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,i){let a=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-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 vo)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(i-1))break;--i,a.set(c,i),o.push(c)}}return{index:i,matched:a,matches:o.reverse()}}function jD(t,e){return t.type.side-e.type.side}function kD(t,e,n,r){let i=e.locals(t),a=0;if(i.length==0){for(let h=0;ha;)c.push(i[o++]);let w=a+g.nodeSize;if(g.isText){let b=w;o!b.inline):c.slice();r(g,N,e.forChild(a,g),y),a=w}}function SD(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 CD(t,e,n,r){for(let i=0,a=0;i=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 qg(t,e,n,r,i){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 d0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(Nf(n)){for(u=o;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&qe.isSelectable(m)&&i.parent&&!(m.isInline&&ZO(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;h=new qe(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!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!BS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function TD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Wn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Sr&&pa<=11&&(n.disabled=!0,n.disabled=!1)}function VS(t,e){if(e instanceof qe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(B1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else B1(t)}function B1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function u0(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Ge.between(e,n,r)}function V1(t){return t.editable&&!t.hasFocus()?!1:HS(t)}function HS(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 MD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return yo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Gg(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&et.findFrom(a,e)}function Zi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function H1(t,e,n){let r=t.state.selection;if(r instanceof Ge)if(n.indexOf("s")>-1){let{$head:i}=r,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+a.nodeSize*(e<0?-1:1));return Zi(t,new Ge(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Gg(t.state,e);return i&&i instanceof qe?Zi(t,i):!1}else if(!(Yr&&n.indexOf("m")>-1)){let i=r.$head,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!a||a.isText)return!1;let c=e<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?qe.isSelectable(a)?Zi(t,new qe(e<0?t.state.doc.resolve(i.pos-a.nodeSize):i)):gd?Zi(t,new Ge(t.state.doc.resolve(e<0?c:c+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof qe&&r.node.isInline)return Zi(t,new Ge(e>0?r.$to:r.$from));{let i=Gg(t.state,e);return i?Zi(t,i):!1}}}function vh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $c(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function il(t,e){return e<0?AD(t):ID(t)}function AD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,a,o=!1;for(Zr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if($c(c,-1))i=n,a=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(WS(n))break;{let c=n.previousSibling;for(;c&&$c(c,-1);)i=n.parentNode,a=Wn(c),c=c.previousSibling;if(c)n=c,r=vh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Jg(t,n,r):i&&Jg(t,i,a)}function ID(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=vh(n),a,o;for(;;)if(r{t.state==i&&xi(t)},50)}function W1(t,e){let n=t.state.doc.resolve(e);if(!(Kn||MS)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>i.top&&o1)return a.lefti.top&&o1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function U1(t,e,n){let r=t.state.selection;if(r instanceof Ge&&!r.empty||n.indexOf("s")>-1||Yr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Gg(t.state,e);if(o&&o instanceof qe)return Zi(t,o)}if(!i.parent.inlineContent){let o=e<0?i:a,c=r instanceof Lr?et.near(o,e):et.findFrom(o,e);return c?Zi(t,c):!1}return!1}function K1(t,e){if(!(t.state.selection instanceof Ge))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)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 q1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function OD(t){if(!ir||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;q1(t,r,"true"),setTimeout(()=>q1(t,r,"false"),20)}return!1}function DD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function LD(t,e){let n=e.keyCode,r=DD(e);if(n==8||Yr&&n==72&&r=="c")return K1(t,-1)||il(t,-1);if(n==46&&!e.shiftKey||Yr&&n==68&&r=="c")return K1(t,1)||il(t,1);if(n==13||n==27)return!0;if(n==37||Yr&&n==66&&r=="c"){let i=n==37?W1(t,t.state.selection.from)=="ltr"?-1:1:-1;return H1(t,i,r)||il(t,i)}else if(n==39||Yr&&n==70&&r=="c"){let i=n==39?W1(t,t.state.selection.from)=="ltr"?1:-1:1;return H1(t,i,r)||il(t,i)}else{if(n==38||Yr&&n==80&&r=="c")return U1(t,-1,r)||il(t,-1);if(n==40||Yr&&n==78&&r=="c")return OD(t)||U1(t,1,r)||il(t,1);if(r==(Yr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function h0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:i,openEnd:a}=e;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,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")||Co.fromSchema(t.state.schema),c=YS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=JS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let w=c.createElement(f[y]);for(;u.firstChild;)w.appendChild(u.firstChild);u.appendChild(w),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${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 WS(t,e,n,r,i){let a=i.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 Ie(ge.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,i,r,t));if(m)c=m;else{let g=i.marks(),{schema:y}=t.state,w=So.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let b=o.appendChild(document.createElement("p"));N&&b.appendChild(w.serializeNode(y.text(N,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=FD(n),md&&BD(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")||ha.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!_D.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=VD(q1(c,+f[1],+f[2]),f[4]);else if(c=Ie.maxOpen(zD(c.content,i),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const _D=/^(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 zD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),a,o=[];if(t.forEach(c=>{if(!o)return;let u=i.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&a.length&&KS(u,a,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=qS(o[o.length-1],a.length));let f=US(c,u);o.push(f),i=i.matchType(f.type),a=u}}),o)return ge.from(o)}return t}function US(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ge.from(t));return t}function KS(t,e,n,r,i){if(i1&&(a=0),i=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,a<=i).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(ge.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function q1(t,e,n){return en})),Km.createHTML(t)):t}function FD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=JS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&GS[r[1].toLowerCase()])&&(t=i.map(a=>"<"+a+">").join("")+t+i.map(a=>"").reverse().join("")),n.innerHTML=$D(t),i)for(let a=0;a=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;i=ge.from(u.create(r[c+1],i)),a++,o++}return new Ie(i,a,o)}const fr={},pr={},HD={touchstart:!0,touchmove:!0};class WD{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 UD(t){for(let e in fr){let n=fr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{qD(t,r)&&!h0(t,r)&&(t.editable||!(r.type in pr))&&n(t,r)},HD[e]?{passive:!0}:void 0)}rr&&t.dom.addEventListener("input",()=>null),Yg(t)}function la(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function KD(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 Yg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>h0(t,r))})}function h0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function qD(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 GD(t,e){!h0(t,e)&&fr[e.type]&&(t.editable||!(e.type in pr))&&fr[e.type](t,e)}pr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!QS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(gi&&Wn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),El&&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",i=>i(t,Qa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||LD(t,n)?n.preventDefault():la(t,"key")};pr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};pr.keypress=(t,e)=>{let n=e;if(QS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof qe)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,a))&&t.dispatch(a()),n.preventDefault()}};function jf(t){return{left:t.clientX,top:t.clientY}}function JD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function f0(t,e,n,r,i){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),i,!0):c(t,n,a.node(o),a.before(o),i,!1)))return!0;return!1}function wl(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 YD(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ke.isSelectable(r)?(wl(t,new Ke(n)),!0):!1}function QD(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Ke&&(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(Ke.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?i=a.before(n.$from.depth):i=a.before(o);break}}return i!=null?(wl(t,Ke.create(t.state.doc,i)),!0):!1}function XD(t,e,n,r,i){return f0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",a=>a(t,e,r))||(i?QD(t,n):YD(t,n))}function ZD(t,e,n,r){return f0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function eL(t,e,n,r){return f0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||tL(t,n,r)}function tL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(wl(t,qe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a),c=i.before(a);if(o.inlineContent)wl(t,qe.create(r,c+1,c+1+o.content.size));else if(Ke.isSelectable(o))wl(t,Ke.create(r,c));else continue;return!0}}function p0(t){return vh(t)}const YS=Gr?"metaKey":"ctrlKey";fr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=p0(t),i=Date.now(),a="singleClick";i-t.input.lastClick.time<500&&JD(n,t.input.lastClick)&&!n[YS]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=t.posAtCoords(jf(n));o&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new nL(t,o,n,!!r)):(a=="doubleClick"?ZD:eL)(t,o.pos,o.inside,n)?n.preventDefault():la(t,"pointer"))};class nL{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[YS],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=i?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 Ke&&h.from<=o&&h.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Qr&&!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)),la(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(()=>vi(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(jf(e))),this.updateAllowDefault(e),this.allowDefault||!n?la(this.view,"pointer"):XD(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||rr&&this.mightDrag&&!this.mightDrag.node.isAtom||Wn&&!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)?(wl(this.view,Ze.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):la(this.view,"pointer")}move(e){this.updateAllowDefault(e),la(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)}}fr.touchstart=t=>{t.input.lastTouch=Date.now(),p0(t),la(t,"pointer")};fr.touchmove=t=>{t.input.lastTouch=Date.now(),la(t,"pointer")};fr.contextmenu=t=>p0(t);function QS(t,e){return t.composing?!0:rr&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const rL=gi?5e3:-1;pr.compositionstart=pr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof qe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Wn&&TS&&sL(t)))t.markCursor=t.state.storedMarks||n.marks(),vh(t,!0),t.markCursor=null;else if(vh(t,!e.selection.empty),Qr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){let o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else i=o,a=-1}}t.input.composing=!0}XS(t,rL)};function sL(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"}pr.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++,XS(t,20))};function XS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>vh(t),e))}function ZS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=aL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function iL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=QO(e.focusNode,e.focusOffset),r=XO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!i||!i.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 aL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function vh(t,e=!1){if(!(gi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ZS(t),e||t.docView&&t.docView.dirty){let n=c0(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 oL(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(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ed=kr&&fa<15||El&&nD<604;fr.copy=pr.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let a=ed?null:n.clipboardData,o=r.content(),{dom:c,text:u}=u0(t,o);a?(n.preventDefault(),a.clearData(),a.setData("text/html",c.innerHTML),a.setData("text/plain",u)):oL(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function lL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function cL(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 i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?td(t,r.value,null,i,e):td(t,r.textContent,r.innerHTML,i,e)},50)}function td(t,e,n,r,i){let a=WS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,a||Ie.empty)))return!0;if(!a)return!1;let o=lL(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 e2(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," "):""}pr.paste=(t,e)=>{let n=e;if(t.composing&&!gi)return;let r=ed?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&td(t,e2(r),r.getData("text/html"),i,n)?n.preventDefault():cL(t,n)};class t2{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const dL=Gr?"altKey":"ctrlKey";function n2(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[dL]}fr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,a=i.empty?null:t.posAtCoords(jf(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof Ke?i.to-1:i.to))){if(r&&r.mightDrag)o=Ke.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=Ke.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=u0(t,c);(!n.dataTransfer.files.length||!Wn||ES>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ed?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",ed||n.dataTransfer.setData("text/plain",h),t.dragging=new t2(f,n2(t,n),o)};fr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};pr.dragover=pr.dragenter=(t,e)=>e.preventDefault();pr.drop=(t,e)=>{try{uL(t,e,t.dragging)}finally{t.dragging=null}};function uL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(jf(e));if(!r)return;let i=t.state.doc.resolve(r.pos),a=n&&n.slice;a?t.someProp("transformPasted",y=>{a=y(a,t,!1)}):a=WS(t,e2(e.dataTransfer),ed?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&n2(t,e));if(t.someProp("handleDrop",y=>y(t,e,a||Ie.empty,o))){e.preventDefault();return}if(!a)return;e.preventDefault();let c=a?aS(t.state.doc,i.pos,a):i.pos;c==null&&(c=i.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&&Ke.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))u.setSelection(new Ke(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((w,N,b,k)=>y=k),u.setSelection(d0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}fr.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())&&vi(t)},20))};fr.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)};fr.beforeinput=(t,e)=>{if(Wn&&gi&&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,Qa(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in pr)fr[t]=pr[t];function nd(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 bh{constructor(e,n){this.toDOM=e,this.spec=n||oo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:a,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new En(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof bh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&nd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ma{constructor(e,n){this.attrs=e,this.spec=n||oo}map(e,n,r,i){let a=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new En(a,o,this)}valid(e,n){return n.from=e&&(!a||a(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,i+c,a)}}map(e,n,r){return this==Qn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||oo)}mapInner(e,n,r,i,a){let o;for(let c=0;c{let h=u+r,f;if(f=s2(n,c,h)){for(i||(i=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 ma){let h=Math.max(a,u.from)-a,f=Math.min(o,u.to)-a;hi.map(e,n,oo));return ta.from(r)}forChild(e,n){if(n.isLeaf)return It.empty;let r=[];for(let i=0;in instanceof It)?e:e.reduce((n,r)=>n.concat(r instanceof It?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let b=N-w-(y-g);for(let k=0;kC+f-m)continue;let E=c[k]+f-m;y>=E?c[k+1]=g<=E?-2:-1:g>=f&&b&&(c[k]+=b,c[k+1]+=b)}m+=b}),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-i,{index:w,offset:N}=r.content.findIndex(m),b=r.maybeChild(w);if(b&&N==m&&N+b.nodeSize==y){let k=c[h+2].mapInner(n,b,f+1,t[h]+a+1,o);k!=Qn?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=fL(c,t,e,n,i,a,o),f=wh(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=s2(t,c,u+n);if(h){a=!0;let f=wh(h,c,n+u+1,r);f!=Qn&&i.push(u,u+c.nodeSize,f)}});let o=r2(a?i2(t):t,-n).sort(lo);for(let c=0;c0;)e++;t.splice(e,0,n)}function qm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Qn&&e.push(r)}),t.cursorWrapper&&e.push(It.create(t.state.doc,[t.cursorWrapper.deco])),ta.from(e)}const pL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},mL=kr&&fa<=11;class gL{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 xL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new gL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():rr&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),mL&&(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,pL)),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(B1(this.view)){if(this.suppressingSelectionUpdates)return vi(this.view);if(kr&&fa<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&xo(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=Cl(a))n.add(a);for(let a=e.anchorNode;a;a=Cl(a))if(n.has(a)){r=a;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&B1(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(Qr&&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||bL(e,m)!=y)&&g.remove()}}}let h=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(a>-1&&(e.docView.markDirty(a,o),yL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,wL(e,u)),this.handleDOMChange(a,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||vi(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;fi;b--){let k=r.childNodes[b-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){a=b;break}if(!C||C.size)break}let m=t.state.doc,g=t.someProp("domParser")||ha.fromSchema(t.state.schema),y=m.resolve(o),w=null,N=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:i,to:a,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:jL,context:y});if(h&&h[0].pos!=null){let b=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=b),w={anchor:b+o,head:k+o}}return{doc:N,sel:w,from:o,to:c}}function jL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(rr&&/^(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||rr&&/^(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 kL=/^(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 SL(t,e,n,r,i){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=c0(t,D);if(P&&!t.state.selection.eq(P)){if(Wn&&gi&&t.input.lastKeyCode===13&&Date.now()-100_(t,Qa(13,"Enter"))))return;let L=t.state.tr.setSelection(P);D=="pointer"?L.setMeta("pointer",!0):D=="key"&&L.scrollIntoView(),a&&L.setMeta("composition",a),t.dispatch(L)}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=NL(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||gi)&&i.some(D=>D.nodeType==1&&!kL.test(D.nodeName))&&(!w||w.endA>=w.endB)&&t.someProp("handleKeyDown",D=>D(t,Qa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!w)if(r&&u instanceof qe&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))w={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let D=Z1(t,t.state.doc,h.sel);if(D&&!D.eq(t.state.selection)){let P=t.state.tr.setSelection(D);a&&P.setMeta("composition",a),t.dispatch(P)}}return}t.state.selection.fromt.state.selection.from&&w.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?w.start=t.state.selection.from:w.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(w.endB+=t.state.selection.to-w.endA,w.endA=t.state.selection.to)),kr&&fa<=11&&w.endB==w.start+1&&w.endA==w.start&&w.start>h.from&&h.doc.textBetween(w.start-h.from-1,w.start-h.from+1)=="  "&&(w.start--,w.endA--,w.endB--);let N=h.doc.resolveNoCache(w.start-h.from),b=h.doc.resolveNoCache(w.endB-h.from),k=f.resolve(w.start),C=N.sameParent(b)&&N.parent.inlineContent&&k.end()>=w.endA;if((El&&t.input.lastIOSEnter>Date.now()-225&&(!C||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!C&&N.posD(t,Qa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>w.start&&EL(f,w.start,w.endA,N,b)&&t.someProp("handleKeyDown",D=>D(t,Qa(8,"Backspace")))){gi&&Wn&&t.domObserver.suppressSelectionUpdates();return}Wn&&w.endB==w.start&&(t.input.lastChromeDelete=Date.now()),gi&&!C&&N.start()!=b.start()&&b.parentOffset==0&&N.depth==b.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==w.endA&&(w.endB-=2,b=h.doc.resolveNoCache(w.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,Qa(13,"Enter"))})},20));let E=w.start,T=w.endA,I=D=>{let P=D||t.state.tr.replace(E,T,h.doc.slice(w.start-h.from,w.endB-h.from));if(h.sel){let L=Z1(t,P.doc,h.sel);L&&!(Wn&&t.composing&&L.empty&&(w.start!=w.endB||t.input.lastChromeDeletevi(t),20));let D=I(t.state.tr.delete(E,T)),P=f.resolve(w.start).marksAcross(f.resolve(w.endA));P&&D.ensureMarks(P),t.dispatch(D)}else if(w.endA==w.endB&&(O=CL(N.parent.content.cut(N.parentOffset,b.parentOffset),k.parent.content.cut(k.parentOffset,w.endA-k.start())))){let D=I(t.state.tr);O.type=="add"?D.addMark(E,T,O.mark):D.removeMark(E,T,O.mark),t.dispatch(D)}else if(N.parent.child(N.index()).isText&&N.index()==b.index()-(b.textOffset?0:1)){let D=N.parent.textBetween(N.parentOffset,b.parentOffset),P=()=>I(t.state.tr.insertText(D,E,T));t.someProp("handleTextInput",L=>L(t,E,T,D,P))||t.dispatch(P())}else t.dispatch(I());else t.dispatch(I())}function Z1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:d0(t,e.resolve(n.anchor),e.resolve(n.head))}function CL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,a=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(i.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||Gm(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function TL(t,e,n,r,i){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(i=="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 a2{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 WD,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(iw),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=rw(this),nw(this),this.nodeViews=sw(this),this.docView=D1(this.state.doc,tw(this),qm(this),this.dom,this),this.domObserver=new xL(this,(r,i,a,o)=>SL(this,r,i,a,o)),this.domObserver.start(),UD(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&&Yg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(iw),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 i=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(ZS(this),o=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=sw(this);AL(y,this.nodeViews)&&(this.nodeViews=y,a=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Yg(this),this.editable=rw(this),nw(this);let u=qm(this),h=tw(this),f=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=a||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(i.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&iD(this);if(o){this.domObserver.stop();let y=m&&(kr||Wn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ML(i.selection,e.selection);if(m){let w=Wn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=iL(this)),(a||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=D1(e.doc,h,u,this.dom,this)),w&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&MD(this))?vi(this,y):(BS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&aD(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 Ke){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&M1(this,n.getBoundingClientRect(),e)}else M1(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&&(i=a)}this.dragging=new t2(e.slice,e.move,i<0?void 0:Ke.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return hD(this,e)}coordsAtPos(e,n=1){return PS(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 i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return xD(this,n||this.state,e)}pasteHTML(e,n){return td(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return td(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return u0(this,e)}destroy(){this.docView&&(KD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],qm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,JO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return GD(this,e)}domSelectionRange(){let e=this.domSelection();return e?rr&&this.root.nodeType===11&&eD(this.dom.ownerDocument)==this.dom&&vL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}a2.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function tw(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"),[En.node(0,t.state.doc.content.size,e)]}function nw(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:En.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function rw(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ML(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 sw(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function AL(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function iw(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 xa={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:"'"},Nh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},IL=typeof navigator<"u"&&/Mac/.test(navigator.platform),RL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hn=0;Hn<10;Hn++)xa[48+Hn]=xa[96+Hn]=String(Hn);for(var Hn=1;Hn<=24;Hn++)xa[Hn+111]="F"+Hn;for(var Hn=65;Hn<=90;Hn++)xa[Hn]=String.fromCharCode(Hn+32),Nh[Hn]=String.fromCharCode(Hn);for(var Jm in xa)Nh.hasOwnProperty(Jm)||(Nh[Jm]=xa[Jm]);function PL(t){var e=IL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||RL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Nh:xa)[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 OL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),DL=typeof navigator<"u"&&/Win/.test(navigator.platform);function LL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,a,o;for(let c=0;c{for(var n in e)$L(t,n,{get:e[n],enumerable:!0})};function kf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=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 i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var Sf=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:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(a);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],c=!!t,u=t||i.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,(...w)=>{const N=this.buildProps(u,e),b=g(...w)(N);return o.push(b),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,a=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:t,editor:r,view:a,state:kf({state:i,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}},o2={};y0(o2,{blur:()=>FL,clearContent:()=>BL,clearNodes:()=>VL,command:()=>HL,createParagraphNear:()=>WL,cut:()=>UL,deleteCurrentNode:()=>KL,deleteNode:()=>qL,deleteRange:()=>GL,deleteSelection:()=>JL,enter:()=>YL,exitCode:()=>QL,extendMarkRange:()=>XL,first:()=>ZL,focus:()=>t8,forEach:()=>n8,insertContent:()=>r8,insertContentAt:()=>a8,joinBackward:()=>c8,joinDown:()=>l8,joinForward:()=>d8,joinItemBackward:()=>u8,joinItemForward:()=>h8,joinTextblockBackward:()=>f8,joinTextblockForward:()=>p8,joinUp:()=>o8,keyboardShortcut:()=>g8,lift:()=>x8,liftEmptyBlock:()=>y8,liftListItem:()=>v8,newlineInCode:()=>b8,resetAttributes:()=>w8,scrollIntoView:()=>N8,selectAll:()=>j8,selectNodeBackward:()=>k8,selectNodeForward:()=>S8,selectParentNode:()=>C8,selectTextblockEnd:()=>E8,selectTextblockStart:()=>T8,setContent:()=>M8,setMark:()=>J8,setMeta:()=>Y8,setNode:()=>Q8,setNodeSelection:()=>X8,setTextDirection:()=>Z8,setTextSelection:()=>e6,sinkListItem:()=>t6,splitBlock:()=>n6,splitListItem:()=>r6,toggleList:()=>s6,toggleMark:()=>i6,toggleNode:()=>a6,toggleWrap:()=>o6,undoInputRule:()=>l6,unsetAllMarks:()=>c6,unsetMark:()=>d6,unsetTextDirection:()=>u6,updateAttributes:()=>h6,wrapIn:()=>f6,wrapInList:()=>p6});var FL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),BL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),VL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.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 w=$l(y);if(c.type.isTextblock){const{defaultType:N}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,N)}(w||w===0)&&e.lift(y,w)})}),!0},HL=t=>e=>t(e),WL=()=>({state:t,dispatch:e})=>NS(t,e),UL=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,a=i.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 qe(r.doc.resolve(Math.max(o-1,0)))),!0},KL=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r.type){if(e){const c=i.before(a),u=i.after(a);t.delete(c,u).scrollIntoView()}return!0}return!1};function wn(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 qL=t=>({tr:e,state:n,dispatch:r})=>{const i=wn(t,n.schema),a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===i){if(r){const u=a.before(o),h=a.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},GL=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},JL=()=>({state:t,dispatch:e})=>r0(t,e),YL=()=>({commands:t})=>t.keyboardShortcut("Enter"),QL=()=>({state:t,dispatch:e})=>OO(t,e);function v0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function jh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:v0(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function l2(t,e,n={}){return t.find(r=>r.type===e&&jh(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function aw(t,e,n={}){return!!l2(t,e,n)}function b0(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(f=>f.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(f=>f.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!l2([...i.node.marks],e,n)))return;let o=i.index,c=t.start()+i.offset,u=o+1,h=c+i.node.nodeSize;for(;o>0&&aw([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:i})=>{const a=ji(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(i){const m=b0(u,a,e);if(m&&m.from<=h&&m.to>=f){const g=qe.create(o,m.from,m.to);n.setSelection(g)}}return!0},ZL=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:i,dispatch:a})=>{e={scrollIntoView:!0,...e};const o=()=>{(kh()||ow())&&r.dom.focus(),e8()&&!kh()&&!ow()&&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&&!c2(n.state.selection))return o(),!0;const c=d2(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return a&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},n8=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),r8=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),u2=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&&u2(r)}return t};function Pu(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 u2(n)}function rd(t,e,n){if(t instanceof xi||t instanceof ge)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ge.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),rd("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,c="";const u=new Jk({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?ha.fromSchema(u).parseSlice(Pu(t),n.parseOptions):ha.fromSchema(u).parse(Pu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const a=ha.fromSchema(e);return n.slice?a.parseSlice(Pu(t),n.parseOptions).content:a.parse(Pu(t),n.parseOptions)}return rd("",e,n)}function s8(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(Ze.near(t.doc.resolve(o),n))}var i8=t=>!("type"in t),a8=(t,e,n)=>({tr:r,dispatch:i,editor:a})=>{var o;if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=b=>{a.emit("contentError",{editor:a,error:b,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{rd(e,a.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(b){u(b)}try{c=rd(e,a.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:a.options.enableContentCheck})}catch(b){return u(b),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((i8(c)?c:[c]).forEach(b=>{b.check(),g=g?b.isText&&b.marks.length===0:!1,y=y?b.isBlock:!1}),f===m&&y){const{parent:b}=r.doc.resolve(f);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(f-=1,m+=1)}let N;if(g){if(Array.isArray(e))N=e.map(b=>b.text||"").join("");else if(e instanceof ge){let b="";e.forEach(k=>{k.text&&(b+=k.text)}),N=b}else typeof e=="object"&&e&&e.text?N=e.text:N=e;r.insertText(N,f,m)}else{N=c;const b=r.doc.resolve(f),k=b.node(),C=b.parentOffset===0,E=k.isText||k.isTextblock,T=k.content.size>0;C&&E&&T&&(f=Math.max(0,f-1)),r.replaceWith(f,m,N)}n.updateSelection&&s8(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:N}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:N})}return!0},o8=()=>({state:t,dispatch:e})=>IO(t,e),l8=()=>({state:t,dispatch:e})=>RO(t,e),c8=()=>({state:t,dispatch:e})=>mS(t,e),d8=()=>({state:t,dispatch:e})=>vS(t,e),u8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=yf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},h8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=yf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},f8=()=>({state:t,dispatch:e})=>MO(t,e),p8=()=>({state:t,dispatch:e})=>AO(t,e);function h2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function m8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,a,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:i})=>{const a=m8(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&&i&&r.maybeStep(f)}),!0};function ya(t,e,n={}){const{from:r,to:i,empty:a}=t.selection,o=e?wn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),w=Math.min(i,g+m.nodeSize);c.push({node:m,from:y,to:w})});const u=i-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>jh(m.node.attrs,n,{strict:!1}));return a?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var x8=(t,e={})=>({state:n,dispatch:r})=>{const i=wn(t,n.schema);return ya(n,i,e)?PO(n,r):!1},y8=()=>({state:t,dispatch:e})=>jS(t,e),v8=t=>({state:e,dispatch:n})=>{const r=wn(t,e.schema);return UO(r)(e,n)},b8=()=>({state:t,dispatch:e})=>wS(t,e);function Cf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function lw(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var w8=(t,e)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null;const c=Cf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=wn(t,r.schema)),c==="mark"&&(o=ji(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,i&&n.setNodeMarkup(m,void 0,lw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,i&&n.addMark(m,m+f.nodeSize,o.create(lw(g.attrs,e))))})})}),u},N8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),j8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Dr(t.doc);t.setSelection(n)}return!0},k8=()=>({state:t,dispatch:e})=>xS(t,e),S8=()=>({state:t,dispatch:e})=>bS(t,e),C8=()=>({state:t,dispatch:e})=>_O(t,e),E8=()=>({state:t,dispatch:e})=>FO(t,e),T8=()=>({state:t,dispatch:e})=>$O(t,e);function Qg(t,e,n={},r={}){return rd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var M8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:c})=>{const{doc:u}=a;if(r.preserveWhitespace!=="full"){const h=Qg(t,i.schema,r,{errorOnInvalidContent:e??i.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??i.options.enableContentCheck})};function f2(t,e){const n=ji(e,t.schema),{from:r,to:i,empty:a}=t.selection,o=[];a?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function p2(t,e){const n=new t0(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function A8(t){for(let e=0;e{n(i)&&r.push({node:i,pos:a})}),r}function m2(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 Ef(t){return e=>m2(e.$from,t)}function We(t,e,n){return t.config[e]===void 0&&t.parent?We(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?We(t.parent,e,n):null}):t.config[e]}function w0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=We(e,"addExtensions",n);return r?[e,...w0(r())]:e}).flat(10)}function N0(t,e){const n=So.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function g2(t){return typeof t=="function"}function jt(t,e=void 0,...n){return g2(t)?e?t.bind(e)(...n):t(...n):t}function R8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Tl(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function x2(t){const e=[],{nodeExtensions:n,markExtensions:r}=Tl(t),i=[...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:i},m=We(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let w;Array.isArray(y.types)?w=y.types:y.types==="*"?w=u:y.types==="nodes"?w=o:y.types==="marks"?w=c:w=[],w.forEach(N=>{Object.entries(y.attributes).forEach(([b,k])=>{e.push({type:N,name:b,attribute:{...a,...k}})})})})}),i.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=We(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,w])=>{const N={...a,...w};typeof(N==null?void 0:N.default)=="function"&&(N.default=N.default()),N!=null&&N.isRequired&&(N==null?void 0:N.default)===void 0&&delete N.default,e.push({type:h.name,name:y,attribute:N})})}),e}function P8(t){const e=[];let n="",r=!1,i=!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 cw(t){const e=[],n=P8(t||""),r=n.length;for(let i=0;i!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,a])=>{if(!r[i]){r[i]=a;return}if(i==="class"){const c=a?String(a).split(" "):[],u=r[i]?r[i].split(" "):[],h=c.filter(f=>!u.includes(f));r[i]=[...u,...h].join(" ")}else if(i==="style"){const c=new Map([...cw(r[i]),...cw(a)]);r[i]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[i]=a}),r},{})}function sd(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)=>kt(n,r),{})}function O8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function dw(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 i=e.reduce((a,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):O8(n.getAttribute(o.name));return c==null?a:{...a,[o.name]:c}},{});return{...r,...i}}}}function uw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&R8(n)?!1:n!=null))}function hw(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 D8(t,e){var n;const r=x2(t),{nodeExtensions:i,markExtensions:a}=Tl(t),o=(n=i.find(h=>We(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(i.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,C)=>{const E=We(C,"extendNodeSchema",m);return{...k,...E?E(h):{}}},{}),y=uw({...g,content:jt(We(h,"content",m)),marks:jt(We(h,"marks",m)),group:jt(We(h,"group",m)),inline:jt(We(h,"inline",m)),atom:jt(We(h,"atom",m)),selectable:jt(We(h,"selectable",m)),draggable:jt(We(h,"draggable",m)),code:jt(We(h,"code",m)),whitespace:jt(We(h,"whitespace",m)),linebreakReplacement:jt(We(h,"linebreakReplacement",m)),defining:jt(We(h,"defining",m)),isolating:jt(We(h,"isolating",m)),attrs:Object.fromEntries(f.map(hw))}),w=jt(We(h,"parseHTML",m));w&&(y.parseDOM=w.map(k=>dw(k,f)));const N=We(h,"renderHTML",m);N&&(y.toDOM=k=>N({node:k,HTMLAttributes:sd(k,f)}));const b=We(h,"renderText",m);return b&&(y.toText=b),[h.name,y]})),u=Object.fromEntries(a.map(h=>{const f=r.filter(b=>b.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((b,k)=>{const C=We(k,"extendMarkSchema",m);return{...b,...C?C(h):{}}},{}),y=uw({...g,inclusive:jt(We(h,"inclusive",m)),excludes:jt(We(h,"excludes",m)),group:jt(We(h,"group",m)),spanning:jt(We(h,"spanning",m)),code:jt(We(h,"code",m)),attrs:Object.fromEntries(f.map(hw))}),w=jt(We(h,"parseHTML",m));w&&(y.parseDOM=w.map(b=>dw(b,f)));const N=We(h,"renderHTML",m);return N&&(y.toDOM=b=>N({mark:b,HTMLAttributes:sd(b,f)})),[h.name,y]}));return new Jk({topNode:o,nodes:c,marks:u})}function L8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function $c(t){return t.sort((n,r)=>{const i=We(n,"priority")||100,a=We(r,"priority")||100;return i>a?-1:ir.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function v2(t,e,n){const{from:r,to:i}=e,{blockSeparator:a=` +`);return{dom:u,text:g,slice:e}}function US(t,e,n,r,i){let a=i.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 Ie(ge.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,i,r,t));if(m)c=m;else{let g=i.marks(),{schema:y}=t.state,w=Co.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let b=o.appendChild(document.createElement("p"));N&&b.appendChild(w.serializeNode(y.text(N,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=FD(n),gd&&BD(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")||fa.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!_D.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=VD(G1(c,+f[1],+f[2]),f[4]);else if(c=Ie.maxOpen(zD(c.content,i),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const _D=/^(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 zD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),a,o=[];if(t.forEach(c=>{if(!o)return;let u=i.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&a.length&&qS(u,a,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=GS(o[o.length-1],a.length));let f=KS(c,u);o.push(f),i=i.matchType(f.type),a=u}}),o)return ge.from(o)}return t}function KS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ge.from(t));return t}function qS(t,e,n,r,i){if(i1&&(a=0),i=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,a<=i).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(ge.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function G1(t,e,n){return en})),qm.createHTML(t)):t}function FD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=YS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&JS[r[1].toLowerCase()])&&(t=i.map(a=>"<"+a+">").join("")+t+i.map(a=>"").reverse().join("")),n.innerHTML=$D(t),i)for(let a=0;a=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;i=ge.from(u.create(r[c+1],i)),a++,o++}return new Ie(i,a,o)}const mr={},gr={},HD={touchstart:!0,touchmove:!0};class WD{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 UD(t){for(let e in mr){let n=mr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{qD(t,r)&&!f0(t,r)&&(t.editable||!(r.type in gr))&&n(t,r)},HD[e]?{passive:!0}:void 0)}ir&&t.dom.addEventListener("input",()=>null),Qg(t)}function ca(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function KD(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 Qg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>f0(t,r))})}function f0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function qD(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 GD(t,e){!f0(t,e)&&mr[e.type]&&(t.editable||!(e.type in gr))&&mr[e.type](t,e)}gr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!XS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(pi&&Kn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Sl&&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",i=>i(t,Xa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||LD(t,n)?n.preventDefault():ca(t,"key")};gr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};gr.keypress=(t,e)=>{let n=e;if(XS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Yr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ge)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,a))&&t.dispatch(a()),n.preventDefault()}};function kf(t){return{left:t.clientX,top:t.clientY}}function JD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function p0(t,e,n,r,i){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),i,!0):c(t,n,a.node(o),a.before(o),i,!1)))return!0;return!1}function vl(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 YD(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&qe.isSelectable(r)?(vl(t,new qe(n)),!0):!1}function QD(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof qe&&(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(qe.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?i=a.before(n.$from.depth):i=a.before(o);break}}return i!=null?(vl(t,qe.create(t.state.doc,i)),!0):!1}function XD(t,e,n,r,i){return p0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",a=>a(t,e,r))||(i?QD(t,n):YD(t,n))}function ZD(t,e,n,r){return p0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function eL(t,e,n,r){return p0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||tL(t,n,r)}function tL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(vl(t,Ge.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a),c=i.before(a);if(o.inlineContent)vl(t,Ge.create(r,c+1,c+1+o.content.size));else if(qe.isSelectable(o))vl(t,qe.create(r,c));else continue;return!0}}function m0(t){return bh(t)}const QS=Yr?"metaKey":"ctrlKey";mr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=m0(t),i=Date.now(),a="singleClick";i-t.input.lastClick.time<500&&JD(n,t.input.lastClick)&&!n[QS]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=t.posAtCoords(kf(n));o&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new nL(t,o,n,!!r)):(a=="doubleClick"?ZD:eL)(t,o.pos,o.inside,n)?n.preventDefault():ca(t,"pointer"))};class nL{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[QS],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=i?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 qe&&h.from<=o&&h.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Zr&&!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)),ca(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(()=>xi(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(kf(e))),this.updateAllowDefault(e),this.allowDefault||!n?ca(this.view,"pointer"):XD(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ir&&this.mightDrag&&!this.mightDrag.node.isAtom||Kn&&!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)?(vl(this.view,et.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ca(this.view,"pointer")}move(e){this.updateAllowDefault(e),ca(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)}}mr.touchstart=t=>{t.input.lastTouch=Date.now(),m0(t),ca(t,"pointer")};mr.touchmove=t=>{t.input.lastTouch=Date.now(),ca(t,"pointer")};mr.contextmenu=t=>m0(t);function XS(t,e){return t.composing?!0:ir&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const rL=pi?5e3:-1;gr.compositionstart=gr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ge&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Kn&&MS&&sL(t)))t.markCursor=t.state.storedMarks||n.marks(),bh(t,!0),t.markCursor=null;else if(bh(t,!e.selection.empty),Zr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){let o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else i=o,a=-1}}t.input.composing=!0}ZS(t,rL)};function sL(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"}gr.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++,ZS(t,20))};function ZS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>bh(t),e))}function e2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=aL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function iL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=QO(e.focusNode,e.focusOffset),r=XO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!i||!i.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 aL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function bh(t,e=!1){if(!(pi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),e2(t),e||t.docView&&t.docView.dirty){let n=d0(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 oL(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(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const td=Sr&&pa<15||Sl&&nD<604;mr.copy=gr.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let a=td?null:n.clipboardData,o=r.content(),{dom:c,text:u}=h0(t,o);a?(n.preventDefault(),a.clearData(),a.setData("text/html",c.innerHTML),a.setData("text/plain",u)):oL(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function lL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function cL(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 i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?nd(t,r.value,null,i,e):nd(t,r.textContent,r.innerHTML,i,e)},50)}function nd(t,e,n,r,i){let a=US(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,a||Ie.empty)))return!0;if(!a)return!1;let o=lL(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 t2(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," "):""}gr.paste=(t,e)=>{let n=e;if(t.composing&&!pi)return;let r=td?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&nd(t,t2(r),r.getData("text/html"),i,n)?n.preventDefault():cL(t,n)};class n2{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const dL=Yr?"altKey":"ctrlKey";function r2(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[dL]}mr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,a=i.empty?null:t.posAtCoords(kf(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof qe?i.to-1:i.to))){if(r&&r.mightDrag)o=qe.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=qe.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=h0(t,c);(!n.dataTransfer.files.length||!Kn||TS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(td?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",td||n.dataTransfer.setData("text/plain",h),t.dragging=new n2(f,r2(t,n),o)};mr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};gr.dragover=gr.dragenter=(t,e)=>e.preventDefault();gr.drop=(t,e)=>{try{uL(t,e,t.dragging)}finally{t.dragging=null}};function uL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(kf(e));if(!r)return;let i=t.state.doc.resolve(r.pos),a=n&&n.slice;a?t.someProp("transformPasted",y=>{a=y(a,t,!1)}):a=US(t,t2(e.dataTransfer),td?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&r2(t,e));if(t.someProp("handleDrop",y=>y(t,e,a||Ie.empty,o))){e.preventDefault();return}if(!a)return;e.preventDefault();let c=a?oS(t.state.doc,i.pos,a):i.pos;c==null&&(c=i.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&&qe.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))u.setSelection(new qe(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((w,N,b,k)=>y=k),u.setSelection(u0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}mr.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())&&xi(t)},20))};mr.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)};mr.beforeinput=(t,e)=>{if(Kn&&pi&&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,Xa(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in gr)mr[t]=gr[t];function rd(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 wh{constructor(e,n){this.toDOM=e,this.spec=n||lo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:a,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Mn(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof wh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&rd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ga{constructor(e,n){this.attrs=e,this.spec=n||lo}map(e,n,r,i){let a=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new Mn(a,o,this)}valid(e,n){return n.from=e&&(!a||a(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,i+c,a)}}map(e,n,r){return this==Zn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||lo)}mapInner(e,n,r,i,a){let o;for(let c=0;c{let h=u+r,f;if(f=i2(n,c,h)){for(i||(i=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 ga){let h=Math.max(a,u.from)-a,f=Math.min(o,u.to)-a;hi.map(e,n,lo));return na.from(r)}forChild(e,n){if(n.isLeaf)return Pt.empty;let r=[];for(let i=0;in instanceof Pt)?e:e.reduce((n,r)=>n.concat(r instanceof Pt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let b=N-w-(y-g);for(let k=0;kC+f-m)continue;let E=c[k]+f-m;y>=E?c[k+1]=g<=E?-2:-1:g>=f&&b&&(c[k]+=b,c[k+1]+=b)}m+=b}),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-i,{index:w,offset:N}=r.content.findIndex(m),b=r.maybeChild(w);if(b&&N==m&&N+b.nodeSize==y){let k=c[h+2].mapInner(n,b,f+1,t[h]+a+1,o);k!=Zn?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=fL(c,t,e,n,i,a,o),f=Nh(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=i2(t,c,u+n);if(h){a=!0;let f=Nh(h,c,n+u+1,r);f!=Zn&&i.push(u,u+c.nodeSize,f)}});let o=s2(a?a2(t):t,-n).sort(co);for(let c=0;c0;)e++;t.splice(e,0,n)}function Gm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Zn&&e.push(r)}),t.cursorWrapper&&e.push(Pt.create(t.state.doc,[t.cursorWrapper.deco])),na.from(e)}const pL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},mL=Sr&&pa<=11;class gL{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 xL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new gL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ir&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),mL&&(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,pL)),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(V1(this.view)){if(this.suppressingSelectionUpdates)return xi(this.view);if(Sr&&pa<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&yo(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=kl(a))n.add(a);for(let a=e.anchorNode;a;a=kl(a))if(n.has(a)){r=a;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&V1(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(Zr&&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||bL(e,m)!=y)&&g.remove()}}}let h=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(a>-1&&(e.docView.markDirty(a,o),yL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,wL(e,u)),this.handleDOMChange(a,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||xi(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;fi;b--){let k=r.childNodes[b-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){a=b;break}if(!C||C.size)break}let m=t.state.doc,g=t.someProp("domParser")||fa.fromSchema(t.state.schema),y=m.resolve(o),w=null,N=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:i,to:a,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:jL,context:y});if(h&&h[0].pos!=null){let b=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=b),w={anchor:b+o,head:k+o}}return{doc:N,sel:w,from:o,to:c}}function jL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ir&&/^(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||ir&&/^(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 kL=/^(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 SL(t,e,n,r,i){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=d0(t,D);if(P&&!t.state.selection.eq(P)){if(Kn&&pi&&t.input.lastKeyCode===13&&Date.now()-100_(t,Xa(13,"Enter"))))return;let L=t.state.tr.setSelection(P);D=="pointer"?L.setMeta("pointer",!0):D=="key"&&L.scrollIntoView(),a&&L.setMeta("composition",a),t.dispatch(L)}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=NL(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||pi)&&i.some(D=>D.nodeType==1&&!kL.test(D.nodeName))&&(!w||w.endA>=w.endB)&&t.someProp("handleKeyDown",D=>D(t,Xa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!w)if(r&&u instanceof Ge&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))w={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let D=ew(t,t.state.doc,h.sel);if(D&&!D.eq(t.state.selection)){let P=t.state.tr.setSelection(D);a&&P.setMeta("composition",a),t.dispatch(P)}}return}t.state.selection.fromt.state.selection.from&&w.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?w.start=t.state.selection.from:w.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(w.endB+=t.state.selection.to-w.endA,w.endA=t.state.selection.to)),Sr&&pa<=11&&w.endB==w.start+1&&w.endA==w.start&&w.start>h.from&&h.doc.textBetween(w.start-h.from-1,w.start-h.from+1)=="  "&&(w.start--,w.endA--,w.endB--);let N=h.doc.resolveNoCache(w.start-h.from),b=h.doc.resolveNoCache(w.endB-h.from),k=f.resolve(w.start),C=N.sameParent(b)&&N.parent.inlineContent&&k.end()>=w.endA;if((Sl&&t.input.lastIOSEnter>Date.now()-225&&(!C||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!C&&N.posD(t,Xa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>w.start&&EL(f,w.start,w.endA,N,b)&&t.someProp("handleKeyDown",D=>D(t,Xa(8,"Backspace")))){pi&&Kn&&t.domObserver.suppressSelectionUpdates();return}Kn&&w.endB==w.start&&(t.input.lastChromeDelete=Date.now()),pi&&!C&&N.start()!=b.start()&&b.parentOffset==0&&N.depth==b.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==w.endA&&(w.endB-=2,b=h.doc.resolveNoCache(w.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,Xa(13,"Enter"))})},20));let E=w.start,T=w.endA,I=D=>{let P=D||t.state.tr.replace(E,T,h.doc.slice(w.start-h.from,w.endB-h.from));if(h.sel){let L=ew(t,P.doc,h.sel);L&&!(Kn&&t.composing&&L.empty&&(w.start!=w.endB||t.input.lastChromeDeletexi(t),20));let D=I(t.state.tr.delete(E,T)),P=f.resolve(w.start).marksAcross(f.resolve(w.endA));P&&D.ensureMarks(P),t.dispatch(D)}else if(w.endA==w.endB&&(O=CL(N.parent.content.cut(N.parentOffset,b.parentOffset),k.parent.content.cut(k.parentOffset,w.endA-k.start())))){let D=I(t.state.tr);O.type=="add"?D.addMark(E,T,O.mark):D.removeMark(E,T,O.mark),t.dispatch(D)}else if(N.parent.child(N.index()).isText&&N.index()==b.index()-(b.textOffset?0:1)){let D=N.parent.textBetween(N.parentOffset,b.parentOffset),P=()=>I(t.state.tr.insertText(D,E,T));t.someProp("handleTextInput",L=>L(t,E,T,D,P))||t.dispatch(P())}else t.dispatch(I());else t.dispatch(I())}function ew(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:u0(t,e.resolve(n.anchor),e.resolve(n.head))}function CL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,a=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(i.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||Jm(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function TL(t,e,n,r,i){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(i=="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 o2{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 WD,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(aw),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=sw(this),rw(this),this.nodeViews=iw(this),this.docView=L1(this.state.doc,nw(this),Gm(this),this.dom,this),this.domObserver=new xL(this,(r,i,a,o)=>SL(this,r,i,a,o)),this.domObserver.start(),UD(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&&Qg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(aw),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 i=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(e2(this),o=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=iw(this);AL(y,this.nodeViews)&&(this.nodeViews=y,a=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Qg(this),this.editable=sw(this),rw(this);let u=Gm(this),h=nw(this),f=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=a||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(i.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&iD(this);if(o){this.domObserver.stop();let y=m&&(Sr||Kn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ML(i.selection,e.selection);if(m){let w=Kn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=iL(this)),(a||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=L1(e.doc,h,u,this.dom,this)),w&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&MD(this))?xi(this,y):(VS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&aD(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 qe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&A1(this,n.getBoundingClientRect(),e)}else A1(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&&(i=a)}this.dragging=new n2(e.slice,e.move,i<0?void 0:qe.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return hD(this,e)}coordsAtPos(e,n=1){return OS(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 i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return xD(this,n||this.state,e)}pasteHTML(e,n){return nd(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return nd(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return h0(this,e)}destroy(){this.docView&&(KD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Gm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,JO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return GD(this,e)}domSelectionRange(){let e=this.domSelection();return e?ir&&this.root.nodeType===11&&eD(this.dom.ownerDocument)==this.dom&&vL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}o2.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function nw(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"),[Mn.node(0,t.state.doc.content.size,e)]}function rw(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:Mn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function sw(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ML(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 iw(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function AL(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function aw(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 ya={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:"'"},jh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},IL=typeof navigator<"u"&&/Mac/.test(navigator.platform),RL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Un=0;Un<10;Un++)ya[48+Un]=ya[96+Un]=String(Un);for(var Un=1;Un<=24;Un++)ya[Un+111]="F"+Un;for(var Un=65;Un<=90;Un++)ya[Un]=String.fromCharCode(Un+32),jh[Un]=String.fromCharCode(Un);for(var Ym in ya)jh.hasOwnProperty(Ym)||(jh[Ym]=ya[Ym]);function PL(t){var e=IL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||RL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?jh:ya)[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 OL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),DL=typeof navigator<"u"&&/Win/.test(navigator.platform);function LL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,a,o;for(let c=0;c{for(var n in e)$L(t,n,{get:e[n],enumerable:!0})};function Sf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=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 i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var Cf=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:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(a);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],c=!!t,u=t||i.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,(...w)=>{const N=this.buildProps(u,e),b=g(...w)(N);return o.push(b),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,a=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:t,editor:r,view:a,state:Sf({state:i,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}},l2={};v0(l2,{blur:()=>FL,clearContent:()=>BL,clearNodes:()=>VL,command:()=>HL,createParagraphNear:()=>WL,cut:()=>UL,deleteCurrentNode:()=>KL,deleteNode:()=>qL,deleteRange:()=>GL,deleteSelection:()=>JL,enter:()=>YL,exitCode:()=>QL,extendMarkRange:()=>XL,first:()=>ZL,focus:()=>t8,forEach:()=>n8,insertContent:()=>r8,insertContentAt:()=>a8,joinBackward:()=>c8,joinDown:()=>l8,joinForward:()=>d8,joinItemBackward:()=>u8,joinItemForward:()=>h8,joinTextblockBackward:()=>f8,joinTextblockForward:()=>p8,joinUp:()=>o8,keyboardShortcut:()=>g8,lift:()=>x8,liftEmptyBlock:()=>y8,liftListItem:()=>v8,newlineInCode:()=>b8,resetAttributes:()=>w8,scrollIntoView:()=>N8,selectAll:()=>j8,selectNodeBackward:()=>k8,selectNodeForward:()=>S8,selectParentNode:()=>C8,selectTextblockEnd:()=>E8,selectTextblockStart:()=>T8,setContent:()=>M8,setMark:()=>J8,setMeta:()=>Y8,setNode:()=>Q8,setNodeSelection:()=>X8,setTextDirection:()=>Z8,setTextSelection:()=>e6,sinkListItem:()=>t6,splitBlock:()=>n6,splitListItem:()=>r6,toggleList:()=>s6,toggleMark:()=>i6,toggleNode:()=>a6,toggleWrap:()=>o6,undoInputRule:()=>l6,unsetAllMarks:()=>c6,unsetMark:()=>d6,unsetTextDirection:()=>u6,updateAttributes:()=>h6,wrapIn:()=>f6,wrapInList:()=>p6});var FL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),BL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),VL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.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 w=_l(y);if(c.type.isTextblock){const{defaultType:N}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,N)}(w||w===0)&&e.lift(y,w)})}),!0},HL=t=>e=>t(e),WL=()=>({state:t,dispatch:e})=>jS(t,e),UL=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,a=i.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 Ge(r.doc.resolve(Math.max(o-1,0)))),!0},KL=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r.type){if(e){const c=i.before(a),u=i.after(a);t.delete(c,u).scrollIntoView()}return!0}return!1};function jn(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 qL=t=>({tr:e,state:n,dispatch:r})=>{const i=jn(t,n.schema),a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===i){if(r){const u=a.before(o),h=a.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},GL=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},JL=()=>({state:t,dispatch:e})=>s0(t,e),YL=()=>({commands:t})=>t.keyboardShortcut("Enter"),QL=()=>({state:t,dispatch:e})=>OO(t,e);function b0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function kh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:b0(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function c2(t,e,n={}){return t.find(r=>r.type===e&&kh(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function ow(t,e,n={}){return!!c2(t,e,n)}function w0(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(f=>f.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(f=>f.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!c2([...i.node.marks],e,n)))return;let o=i.index,c=t.start()+i.offset,u=o+1,h=c+i.node.nodeSize;for(;o>0&&ow([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:i})=>{const a=wi(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(i){const m=w0(u,a,e);if(m&&m.from<=h&&m.to>=f){const g=Ge.create(o,m.from,m.to);n.setSelection(g)}}return!0},ZL=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:i,dispatch:a})=>{e={scrollIntoView:!0,...e};const o=()=>{(Sh()||lw())&&r.dom.focus(),e8()&&!Sh()&&!lw()&&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&&!d2(n.state.selection))return o(),!0;const c=u2(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return a&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},n8=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),r8=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),h2=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&&h2(r)}return t};function Ou(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 h2(n)}function sd(t,e,n){if(t instanceof mi||t instanceof ge)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ge.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),sd("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,c="";const u=new Yk({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?fa.fromSchema(u).parseSlice(Ou(t),n.parseOptions):fa.fromSchema(u).parse(Ou(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const a=fa.fromSchema(e);return n.slice?a.parseSlice(Ou(t),n.parseOptions).content:a.parse(Ou(t),n.parseOptions)}return sd("",e,n)}function s8(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(et.near(t.doc.resolve(o),n))}var i8=t=>!("type"in t),a8=(t,e,n)=>({tr:r,dispatch:i,editor:a})=>{var o;if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=b=>{a.emit("contentError",{editor:a,error:b,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{sd(e,a.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(b){u(b)}try{c=sd(e,a.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:a.options.enableContentCheck})}catch(b){return u(b),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((i8(c)?c:[c]).forEach(b=>{b.check(),g=g?b.isText&&b.marks.length===0:!1,y=y?b.isBlock:!1}),f===m&&y){const{parent:b}=r.doc.resolve(f);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(f-=1,m+=1)}let N;if(g){if(Array.isArray(e))N=e.map(b=>b.text||"").join("");else if(e instanceof ge){let b="";e.forEach(k=>{k.text&&(b+=k.text)}),N=b}else typeof e=="object"&&e&&e.text?N=e.text:N=e;r.insertText(N,f,m)}else{N=c;const b=r.doc.resolve(f),k=b.node(),C=b.parentOffset===0,E=k.isText||k.isTextblock,T=k.content.size>0;C&&E&&T&&(f=Math.max(0,f-1)),r.replaceWith(f,m,N)}n.updateSelection&&s8(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:N}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:N})}return!0},o8=()=>({state:t,dispatch:e})=>IO(t,e),l8=()=>({state:t,dispatch:e})=>RO(t,e),c8=()=>({state:t,dispatch:e})=>gS(t,e),d8=()=>({state:t,dispatch:e})=>bS(t,e),u8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=vf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},h8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=vf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},f8=()=>({state:t,dispatch:e})=>MO(t,e),p8=()=>({state:t,dispatch:e})=>AO(t,e);function f2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function m8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,a,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:i})=>{const a=m8(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&&i&&r.maybeStep(f)}),!0};function va(t,e,n={}){const{from:r,to:i,empty:a}=t.selection,o=e?jn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),w=Math.min(i,g+m.nodeSize);c.push({node:m,from:y,to:w})});const u=i-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>kh(m.node.attrs,n,{strict:!1}));return a?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var x8=(t,e={})=>({state:n,dispatch:r})=>{const i=jn(t,n.schema);return va(n,i,e)?PO(n,r):!1},y8=()=>({state:t,dispatch:e})=>kS(t,e),v8=t=>({state:e,dispatch:n})=>{const r=jn(t,e.schema);return UO(r)(e,n)},b8=()=>({state:t,dispatch:e})=>NS(t,e);function Ef(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function cw(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var w8=(t,e)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null;const c=Ef(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=jn(t,r.schema)),c==="mark"&&(o=wi(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,i&&n.setNodeMarkup(m,void 0,cw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,i&&n.addMark(m,m+f.nodeSize,o.create(cw(g.attrs,e))))})})}),u},N8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),j8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Lr(t.doc);t.setSelection(n)}return!0},k8=()=>({state:t,dispatch:e})=>yS(t,e),S8=()=>({state:t,dispatch:e})=>wS(t,e),C8=()=>({state:t,dispatch:e})=>_O(t,e),E8=()=>({state:t,dispatch:e})=>FO(t,e),T8=()=>({state:t,dispatch:e})=>$O(t,e);function Xg(t,e,n={},r={}){return sd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var M8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:c})=>{const{doc:u}=a;if(r.preserveWhitespace!=="full"){const h=Xg(t,i.schema,r,{errorOnInvalidContent:e??i.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??i.options.enableContentCheck})};function p2(t,e){const n=wi(e,t.schema),{from:r,to:i,empty:a}=t.selection,o=[];a?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function m2(t,e){const n=new n0(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function A8(t){for(let e=0;e{n(i)&&r.push({node:i,pos:a})}),r}function g2(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 Tf(t){return e=>g2(e.$from,t)}function We(t,e,n){return t.config[e]===void 0&&t.parent?We(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?We(t.parent,e,n):null}):t.config[e]}function N0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=We(e,"addExtensions",n);return r?[e,...N0(r())]:e}).flat(10)}function j0(t,e){const n=Co.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function x2(t){return typeof t=="function"}function Ct(t,e=void 0,...n){return x2(t)?e?t.bind(e)(...n):t(...n):t}function R8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Cl(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function y2(t){const e=[],{nodeExtensions:n,markExtensions:r}=Cl(t),i=[...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:i},m=We(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let w;Array.isArray(y.types)?w=y.types:y.types==="*"?w=u:y.types==="nodes"?w=o:y.types==="marks"?w=c:w=[],w.forEach(N=>{Object.entries(y.attributes).forEach(([b,k])=>{e.push({type:N,name:b,attribute:{...a,...k}})})})})}),i.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=We(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,w])=>{const N={...a,...w};typeof(N==null?void 0:N.default)=="function"&&(N.default=N.default()),N!=null&&N.isRequired&&(N==null?void 0:N.default)===void 0&&delete N.default,e.push({type:h.name,name:y,attribute:N})})}),e}function P8(t){const e=[];let n="",r=!1,i=!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 dw(t){const e=[],n=P8(t||""),r=n.length;for(let i=0;i!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,a])=>{if(!r[i]){r[i]=a;return}if(i==="class"){const c=a?String(a).split(" "):[],u=r[i]?r[i].split(" "):[],h=c.filter(f=>!u.includes(f));r[i]=[...u,...h].join(" ")}else if(i==="style"){const c=new Map([...dw(r[i]),...dw(a)]);r[i]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[i]=a}),r},{})}function id(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)=>Et(n,r),{})}function O8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function uw(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 i=e.reduce((a,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):O8(n.getAttribute(o.name));return c==null?a:{...a,[o.name]:c}},{});return{...r,...i}}}}function hw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&R8(n)?!1:n!=null))}function fw(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 D8(t,e){var n;const r=y2(t),{nodeExtensions:i,markExtensions:a}=Cl(t),o=(n=i.find(h=>We(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(i.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,C)=>{const E=We(C,"extendNodeSchema",m);return{...k,...E?E(h):{}}},{}),y=hw({...g,content:Ct(We(h,"content",m)),marks:Ct(We(h,"marks",m)),group:Ct(We(h,"group",m)),inline:Ct(We(h,"inline",m)),atom:Ct(We(h,"atom",m)),selectable:Ct(We(h,"selectable",m)),draggable:Ct(We(h,"draggable",m)),code:Ct(We(h,"code",m)),whitespace:Ct(We(h,"whitespace",m)),linebreakReplacement:Ct(We(h,"linebreakReplacement",m)),defining:Ct(We(h,"defining",m)),isolating:Ct(We(h,"isolating",m)),attrs:Object.fromEntries(f.map(fw))}),w=Ct(We(h,"parseHTML",m));w&&(y.parseDOM=w.map(k=>uw(k,f)));const N=We(h,"renderHTML",m);N&&(y.toDOM=k=>N({node:k,HTMLAttributes:id(k,f)}));const b=We(h,"renderText",m);return b&&(y.toText=b),[h.name,y]})),u=Object.fromEntries(a.map(h=>{const f=r.filter(b=>b.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((b,k)=>{const C=We(k,"extendMarkSchema",m);return{...b,...C?C(h):{}}},{}),y=hw({...g,inclusive:Ct(We(h,"inclusive",m)),excludes:Ct(We(h,"excludes",m)),group:Ct(We(h,"group",m)),spanning:Ct(We(h,"spanning",m)),code:Ct(We(h,"code",m)),attrs:Object.fromEntries(f.map(fw))}),w=Ct(We(h,"parseHTML",m));w&&(y.parseDOM=w.map(b=>uw(b,f)));const N=We(h,"renderHTML",m);return N&&(y.toDOM=b=>N({mark:b,HTMLAttributes:id(b,f)})),[h.name,y]}));return new Yk({topNode:o,nodes:c,marks:u})}function L8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Fc(t){return t.sort((n,r)=>{const i=We(n,"priority")||100,a=We(r,"priority")||100;return i>a?-1:ir.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function b2(t,e,n){const{from:r,to:i}=e,{blockSeparator:a=` -`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,i,(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,i-h))}),c}function _8(t,e){const n={from:0,to:t.content.size};return v2(t,n,e)}function b2(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function z8(t,e){const n=wn(e,t.schema),{from:r,to:i}=t.selection,a=[];t.doc.nodesBetween(r,i,c=>{a.push(c)});const o=a.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function w2(t,e){const n=Cf(typeof e=="string"?e:e.name,t.schema);return n==="node"?z8(t,e):n==="mark"?f2(t,e):{}}function $8(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function F8(t){const e=$8(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 N2(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,a)=>{const o=[];if(i.ranges.length)i.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}})})}),F8(r)}function j0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const a=n.resolve(t),o=b0(a,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,a)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:a,to:a+i.nodeSize,mark:o})))}),r}var B8=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let a=r,o=null;for(;a>0&&o===null;){const c=i.node(a);(c==null?void 0:c.type.name)===e?o=c:a-=1}return[o,a]};function kc(t,e){return e.nodes[t]||e.marks[t]||null}function Xu(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(a=>a.type===e&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var V8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,a,o,c)=>{var u,h;const f=((h=(u=i.type.spec).toText)==null?void 0:h.call(u,{node:i,pos:a,parent:o,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?f:f.slice(0,Math.max(0,r-a))}),n};function Xg(t,e,n={}){const{empty:r,ranges:i}=t.selection,a=e?ji(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>a?a.name===m.type.name:!0).find(m=>jh(m.attrs,n,{strict:!1}));let o=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const y=m.pos,w=g.pos;t.doc.nodesBetween(y,w,(N,b)=>{if(a&&N.inlineContent&&!N.type.allowsMarkType(a))return!1;if(!N.isText&&!N.marks.length)return;const k=Math.max(y,b),C=Math.min(w,b+N.nodeSize),E=C-k;o+=E,c.push(...N.marks.map(T=>({mark:T,from:k,to:C})))})}),o===0)return!1;const u=c.filter(m=>a?a.name===m.mark.type.name:!0).filter(m=>jh(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 H8(t,e,n={}){if(!e)return ya(t,null,n)||Xg(t,null,n);const r=Cf(e,t.schema);return r==="node"?ya(t,e,n):r==="mark"?Xg(t,e,n):!1}var W8=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const a=Ef(c=>c.type.name===e)(t.selection);if(!a)return!1;const o=t.doc.resolve(a.pos+1);return i.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function fw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function pw(t,e){const{nodeExtensions:n}=Tl(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},a=jt(We(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function Tf(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 i=!0;return t.content.forEach(a=>{i!==!1&&(Tf(a,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function j2(t){return t instanceof Ke}var k2=class S2{constructor(e){this.position=e}static fromJSON(e){return new S2(e.position)}toJSON(){return{position:this.position}}};function K8(t,e){const n=e.mapping.mapResult(t.position);return{position:new k2(n.pos),mapResult:n}}function q8(t){return new k2(t)}function G8(t,e,n){var r;const{selection:i}=e;let a=null;if(c2(i)&&(a=i.$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}=i;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),w=!!n.isInSet(f.marks)||!f.marks.some(N=>N.type.excludes(n));h=y&&w}return!h}),h})}var J8=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=n,{empty:o,ranges:c}=a,u=ji(t,r.schema);if(i)if(o){const h=f2(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 w=Math.max(y,f),N=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(w,N,u.create({...k.attrs,...e}))}):n.addMark(w,N,u.create(e))})});return G8(r,n,u)},Y8=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Q8=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const a=wn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:c})=>C1(a,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>C1(a,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},X8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=no(t,0,r.content.size),a=Ke.create(r,i);e.setSelection(a)}return!0},Z8=(t,e)=>({tr:n,state:r,dispatch:i})=>{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),i&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},e6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,o=qe.atStart(r).from,c=qe.atEnd(r).to,u=no(i,o,c),h=no(a,o,c),f=qe.create(r,u,h);e.setSelection(f)}return!0},t6=t=>({state:e,dispatch:n})=>{const r=wn(t,e.schema);return GO(r)(e,n)};function mw(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}var n6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:a,doc:o}=e,{$from:c,$to:u}=a,h=i.extensionManager.attributes,f=Xu(h,c.node().type.name,c.node().attrs);if(a instanceof Ke&&a.node.isBlock)return!c.parentOffset||!yi(o,c.pos)?!1:(r&&(t&&mw(n,i.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:A8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,w=yi(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!w&&yi(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(w=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(w&&(a instanceof qe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const N=e.mapping.map(c.before()),b=e.doc.resolve(N);c.node(-1).canReplaceWith(b.index(),b.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&mw(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return w},r6=(t,e={})=>({tr:n,state:r,dispatch:i,editor:a})=>{var o;const c=wn(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(i){let k=ge.empty;const C=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-C;P>=u.depth-3;P-=1)k=ge.from(u.node(P).copy(k));const E=u.indexAfter(-1){if(D>-1)return!1;P.isTextblock&&P.content.size===0&&(D=L+1)}),D>-1&&n.setSelection(qe.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,w={...Xu(g,m.type.name,m.attrs),...e},N={...Xu(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const b=y?[{type:c,attrs:w},{type:y,attrs:N}]:[{type:c,attrs:w}];if(!yi(n.doc,u.pos,2))return!1;if(i){const{selection:k,storedMarks:C}=r,{splittableMarks:E}=a.extensionManager,T=C||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,b).scrollIntoView(),!T||!i)return!0;const I=T.filter(O=>E.includes(O.type.name));n.ensureMarks(I)}return!0},Qm=(t,e)=>{const n=Ef(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 i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Sa(t.doc,n.pos)&&t.join(n.pos),!0},Xm=(t,e)=>{const n=Ef(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 i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Sa(t.doc,r)&&t.join(r),!0},s6=(t,e,n,r={})=>({editor:i,tr:a,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,y=wn(t,o.schema),w=wn(e,o.schema),{selection:N,storedMarks:b}=o,{$from:k,$to:C}=N,E=k.blockRange(C),T=b||N.$to.parentOffset&&N.$from.marks();if(!E)return!1;const I=Ef(O=>pw(O.type.name,m))(N);if(E.depth>=1&&I&&E.depth-I.depth<=1){if(I.node.type===y)return h.liftListItem(w);if(pw(I.node.type.name,m)&&y.validContent(I.node.content)&&c)return u().command(()=>(a.setNodeMarkup(I.pos,y),!0)).command(()=>Qm(a,y)).command(()=>Xm(a,y)).run()}return!n||!T||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>Qm(a,y)).command(()=>Xm(a,y)).run():u().command(()=>{const O=f().wrapInList(y,r),D=T.filter(P=>g.includes(P.type.name));return a.ensureMarks(D),O?!0:h.clearNodes()}).wrapInList(y,r).command(()=>Qm(a,y)).command(()=>Xm(a,y)).run()},i6=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:a=!1}=n,o=ji(t,r.schema);return Xg(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,e)},a6=(t,e,n={})=>({state:r,commands:i})=>{const a=wn(t,r.schema),o=wn(e,r.schema),c=ya(r,a,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(o,u):i.setNode(a,{...u,...n})},o6=(t,e={})=>({state:n,commands:r})=>{const i=wn(t,n.schema);return ya(n,i,e)?r.lift(i):r.wrapIn(i,e)},l6=()=>({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},c6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},d6=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var a;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=ji(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!i)return!0;if(f&&o){let{from:g,to:y}=c;const w=(a=h.marks().find(b=>b.type===u))==null?void 0:a.attrs,N=b0(h,u,w);N&&(g=N.from,y=N.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},u6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=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=i.from,o=i.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},h6=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null;const c=Cf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=wn(t,r.schema)),c==="mark"&&(o=ji(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,w,N;n.selection.empty?r.doc.nodesBetween(f,m,(b,k)=>{a&&a===b.type&&(u=!0,w=Math.max(k,f),N=Math.min(k+b.nodeSize,m),g=k,y=b)}):r.doc.nodesBetween(f,m,(b,k)=>{k=f&&k<=m&&(a&&a===b.type&&(u=!0,i&&n.setNodeMarkup(k,void 0,{...b.attrs,...e})),o&&b.marks.length&&b.marks.forEach(C=>{if(o===C.type&&(u=!0,i)){const E=Math.max(k,f),T=Math.min(k+b.nodeSize,m);n.addMark(E,T,o.create({...C.attrs,...e}))}}))}),y&&(g!==void 0&&i&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(b=>{o===b.type&&i&&n.addMark(w,N,o.create({...b.attrs,...e}))}))}),u},f6=(t,e={})=>({state:n,dispatch:r})=>{const i=wn(t,n.schema);return BO(i,e)(n,r)},p6=(t,e={})=>({state:n,dispatch:r})=>{const i=wn(t,n.schema);return VO(i,e)(n,r)},m6=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={}}},Mf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},g6=(t,e)=>{if(v0(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 Ou(t){var e;const{editor:n,from:r,to:i,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=V8(h)+a;return o.forEach(g=>{if(f)return;const y=g6(m,g.find);if(!y)return;const w=u.state.tr,N=kf({state:u.state,transaction:w}),b={from:r-(y[0].length-a.length),to:i},{commands:k,chain:C,can:E}=new Sf({editor:n,state:N});g.handler({state:N,range:b,match:y,commands:k,chain:C,can:E})===null||!w.steps.length||(g.undoable&&w.setMeta(c,{transform:w,from:r,to:i,text:a}),u.dispatch(w),f=!0)}),f}function x6(t){const{editor:e,rules:n}=t,r=new Bt({state:{init(){return null},apply(i,a,o){const c=i.getMeta(r);if(c)return c;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=N0(ge.from(f),o.schema);const{from:m}=u,g=m+f.length;Ou({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,o,c){return Ou({editor:e,from:a,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&Ou({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Ou({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function y6(t){return Object.prototype.toString.call(t).slice(8,-1)}function Du(t){return y6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function C2(t,e){const n={...t};return Du(t)&&Du(e)&&Object.keys(e).forEach(r=>{Du(e[r])&&Du(t[r])?n[r]=C2(t[r],e[r]):n[r]=e[r]}),n}var k0=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{...jt(We(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...jt(We(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>C2(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}},Co=class E2 extends k0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new E2(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.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(" ",i.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 v6(t){return typeof t=="number"}var b6=class{constructor(t){this.find=t.find,this.handler=t.handler}},w6=(t,e,n)=>{if(v0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const a=[i.text];return a.index=i.index,a.input=t,a.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(i.replaceWith)),a}):[]};function N6(t){const{editor:e,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Sf({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(y,w)=>{var N,b,k,C,E;if((b=(N=y.type)==null?void 0:N.spec)!=null&&b.code||!(y.isText||y.isTextblock||y.isInline))return;const T=(E=(C=(k=y.content)==null?void 0:k.size)!=null?C:y.nodeSize)!=null?E:0,I=Math.max(r,w),O=Math.min(i,w+T);if(I>=O)return;const D=y.isText?y.text||"":y.textBetween(I-w,O-w,void 0,"");w6(D,a.find,o).forEach(L=>{if(L.index===void 0)return;const _=I+L.index+1,J=_+L[0].length,ee={from:n.tr.mapping.map(_),to:n.tr.mapping.map(J)},Y=a.handler({state:n,range:ee,match:L,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(Y)})}),m.every(y=>y!==null)}var Lu=null,j6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function k6(t){const{editor:e,rules:n}=t;let r=null,i=!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:w})=>{const N=f.tr,b=kf({state:f,transaction:N});if(!(!N6({editor:e,state:b,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:w,dropEvent:c})||!N.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,N}};return n.map(f=>new Bt({view(m){const g=w=>{var N;r=(N=m.dom.parentElement)!=null&&N.contains(w.target)?m.dom.parentElement:null,r&&(Lu=e)},y=()=>{Lu&&(Lu=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=Lu;y!=null&&y.isEditable&&setTimeout(()=>{const w=y.state.selection;w&&y.commands.deleteRange({from:w.from,to:w.to})},10)}return!1},paste:(m,g)=>{var y;const w=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,i=!!(w!=null&&w.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const w=m[0],N=w.getMeta("uiEvent")==="paste"&&!i,b=w.getMeta("uiEvent")==="drop"&&!a,k=w.getMeta("applyPasteRules"),C=!!k;if(!N&&!b&&!C)return;if(C){let{text:I}=k;typeof I=="string"?I=I:I=N0(ge.from(I),y.schema);const{from:O}=k,D=O+I.length,P=j6(I);return u({rule:f,state:y,from:O,to:{b:D},pasteEvt:P})}const E=g.doc.content.findDiffStart(y.doc.content),T=g.doc.content.findDiffEnd(y.doc.content);if(!(!v6(E)||!T||E===T.b))return u({rule:f,state:y,from:E,to:T,pasteEvt:o})}}))}var Af=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=y2(t),this.schema=D8(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:kc(e.name,this.schema)},r=We(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return $c([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:kc(r.name,this.schema)},a=[],o=We(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&We(r,"exitable",i)&&(c.ArrowRight=()=>Co.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,w])=>[y,()=>w({editor:t})]));c={...c,...g}}const u=zL(c);a.push(u);const h=We(r,"addInputRules",i);if(fw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=x6({editor:t,rules:g}),w=Array.isArray(y)?y:[y];a.push(...w)}}const f=We(r,"addPasteRules",i);if(fw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=k6({editor:t,rules:g});a.push(...y)}}const m=We(r,"addProseMirrorPlugins",i);if(m){const g=m();a.push(...g)}return a})}get attributes(){return x2(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Tl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:wn(n.name,this.schema)},a=We(n,"addNodeView",i);if(!a)return[];const o=a();if(!o)return[];const c=(u,h,f,m,g)=>{const y=sd(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 $c([...this.extensions].reverse()).reduceRight((r,i)=>{const a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:kc(i.name,this.schema)},o=We(i,"dispatchTransaction",a);return o?c=>{o.call(a,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return $c([...this.extensions]).reduce((r,i)=>{const a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:kc(i.name,this.schema)},o=We(i,"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}=Tl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ji(n.name,this.schema)},a=We(n,"addMarkView",i);if(!a)return[];const o=(c,u,h)=>{const f=sd(c,r);return a()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{$6(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:kc(e.name,this.schema)};e.type==="mark"&&((n=jt(We(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=We(e,"onBeforeCreate",r),a=We(e,"onCreate",r),o=We(e,"onUpdate",r),c=We(e,"onSelectionUpdate",r),u=We(e,"onTransaction",r),h=We(e,"onFocus",r),f=We(e,"onBlur",r),m=We(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),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)})}};Af.resolve=y2;Af.sort=$c;Af.flatten=w0;var S6={};y0(S6,{ClipboardTextSerializer:()=>M2,Commands:()=>A2,Delete:()=>I2,Drop:()=>R2,Editable:()=>P2,FocusEvents:()=>D2,Keymap:()=>L2,Paste:()=>_2,Tabindex:()=>z2,TextDirection:()=>$2,focusEventsPluginKey:()=>O2});var pn=class T2 extends k0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new T2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},M2=pn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Bt({key:new Qt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:a}=i,o=Math.min(...a.map(f=>f.$from.pos)),c=Math.max(...a.map(f=>f.$to.pos)),u=b2(n);return v2(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),A2=pn.create({name:"commands",addCommands(){return{...o2}}}),I2=pn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;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=p2(t.before,[t,...e]);N2(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,(w,N)=>{const b=N+w.nodeSize-2,k=y.oldRange.from<=N&&b<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:w,from:N,to:b,newFrom:f.mapping.map(N),newTo:f.mapping.map(b),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,w)=>{var N,b;if(y instanceof ms){const k=g.slice(w).map(y.from,-1),C=g.slice(w).map(y.to),E=g.invert().map(k,-1),T=g.invert().map(C),I=(N=f.doc.nodeAt(k-1))==null?void 0:N.marks.some(D=>D.eq(y.mark)),O=(b=f.doc.nodeAt(C))==null?void 0:b.marks.some(D=>D.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:E,to:T},newRange:{from:k,to:C},partial:!!(O||I),editor:this.editor,transaction:t,combinedTransform:f})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(a,0):a()}}),R2=pn.create({name:"drop",addProseMirrorPlugins(){return[new Bt({key:new Qt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),P2=pn.create({name:"editable",addProseMirrorPlugins(){return[new Bt({key:new Qt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),O2=new Qt("focusEvents"),D2=pn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Bt({key:O2,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}}}})]}}),L2=pn.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,w=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,N=w.parent.type.spec.isolating,b=m.pos-m.parentOffset,k=N&&w.parent.childCount===1?b===m.pos:Ze.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()},i={...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 kh()||h2()?a:i},addProseMirrorPlugins(){return[new Bt({key:new Qt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(N=>N.getMeta("composition")))return;const r=t.some(N=>N.docChanged)&&!e.doc.eq(n.doc),i=t.some(N=>N.getMeta("preventClearDocument"));if(!r||i)return;const{empty:a,from:o,to:c}=e.selection,u=Ze.atStart(e.doc).from,h=Ze.atEnd(e.doc).to;if(a||!(o===u&&c===h)||!Tf(n.doc))return;const g=n.tr,y=kf({state:n,transaction:g}),{commands:w}=new Sf({editor:this.editor,state:y});if(w.clearNodes(),!!g.steps.length)return g}})]}}),_2=pn.create({name:"paste",addProseMirrorPlugins(){return[new Bt({key:new Qt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),z2=pn.create({name:"tabindex",addProseMirrorPlugins(){return[new Bt({key:new Qt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),$2=pn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Tl(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 Bt({key:new Qt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),C6=class Ac{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}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 i=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(!i&&!o&&u.depth<=this.depth)return;const h=new Ac(u,this.editor,i,i||o?n:null);i&&(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,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const a=i.node.attrs,o=Object.keys(n);for(let c=0;c{r&&i.length>0||(o.node.type.name===e&&a.every(u=>n[u]===o.node.attrs[u])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},E6=`.ProseMirror { +`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,i,(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,i-h))}),c}function _8(t,e){const n={from:0,to:t.content.size};return b2(t,n,e)}function w2(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function z8(t,e){const n=jn(e,t.schema),{from:r,to:i}=t.selection,a=[];t.doc.nodesBetween(r,i,c=>{a.push(c)});const o=a.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function N2(t,e){const n=Ef(typeof e=="string"?e:e.name,t.schema);return n==="node"?z8(t,e):n==="mark"?p2(t,e):{}}function $8(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function F8(t){const e=$8(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 j2(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,a)=>{const o=[];if(i.ranges.length)i.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}})})}),F8(r)}function k0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const a=n.resolve(t),o=w0(a,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,a)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:a,to:a+i.nodeSize,mark:o})))}),r}var B8=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let a=r,o=null;for(;a>0&&o===null;){const c=i.node(a);(c==null?void 0:c.type.name)===e?o=c:a-=1}return[o,a]};function Sc(t,e){return e.nodes[t]||e.marks[t]||null}function Zu(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(a=>a.type===e&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var V8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,a,o,c)=>{var u,h;const f=((h=(u=i.type.spec).toText)==null?void 0:h.call(u,{node:i,pos:a,parent:o,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?f:f.slice(0,Math.max(0,r-a))}),n};function Zg(t,e,n={}){const{empty:r,ranges:i}=t.selection,a=e?wi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>a?a.name===m.type.name:!0).find(m=>kh(m.attrs,n,{strict:!1}));let o=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const y=m.pos,w=g.pos;t.doc.nodesBetween(y,w,(N,b)=>{if(a&&N.inlineContent&&!N.type.allowsMarkType(a))return!1;if(!N.isText&&!N.marks.length)return;const k=Math.max(y,b),C=Math.min(w,b+N.nodeSize),E=C-k;o+=E,c.push(...N.marks.map(T=>({mark:T,from:k,to:C})))})}),o===0)return!1;const u=c.filter(m=>a?a.name===m.mark.type.name:!0).filter(m=>kh(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 H8(t,e,n={}){if(!e)return va(t,null,n)||Zg(t,null,n);const r=Ef(e,t.schema);return r==="node"?va(t,e,n):r==="mark"?Zg(t,e,n):!1}var W8=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const a=Tf(c=>c.type.name===e)(t.selection);if(!a)return!1;const o=t.doc.resolve(a.pos+1);return i.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function pw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function mw(t,e){const{nodeExtensions:n}=Cl(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},a=Ct(We(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function Mf(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 i=!0;return t.content.forEach(a=>{i!==!1&&(Mf(a,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function k2(t){return t instanceof qe}var S2=class C2{constructor(e){this.position=e}static fromJSON(e){return new C2(e.position)}toJSON(){return{position:this.position}}};function K8(t,e){const n=e.mapping.mapResult(t.position);return{position:new S2(n.pos),mapResult:n}}function q8(t){return new S2(t)}function G8(t,e,n){var r;const{selection:i}=e;let a=null;if(d2(i)&&(a=i.$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}=i;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),w=!!n.isInSet(f.marks)||!f.marks.some(N=>N.type.excludes(n));h=y&&w}return!h}),h})}var J8=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=n,{empty:o,ranges:c}=a,u=wi(t,r.schema);if(i)if(o){const h=p2(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 w=Math.max(y,f),N=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(w,N,u.create({...k.attrs,...e}))}):n.addMark(w,N,u.create(e))})});return G8(r,n,u)},Y8=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Q8=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const a=jn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:c})=>E1(a,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>E1(a,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},X8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=ro(t,0,r.content.size),a=qe.create(r,i);e.setSelection(a)}return!0},Z8=(t,e)=>({tr:n,state:r,dispatch:i})=>{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),i&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},e6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,o=Ge.atStart(r).from,c=Ge.atEnd(r).to,u=ro(i,o,c),h=ro(a,o,c),f=Ge.create(r,u,h);e.setSelection(f)}return!0},t6=t=>({state:e,dispatch:n})=>{const r=jn(t,e.schema);return GO(r)(e,n)};function gw(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}var n6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:a,doc:o}=e,{$from:c,$to:u}=a,h=i.extensionManager.attributes,f=Zu(h,c.node().type.name,c.node().attrs);if(a instanceof qe&&a.node.isBlock)return!c.parentOffset||!gi(o,c.pos)?!1:(r&&(t&&gw(n,i.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:A8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,w=gi(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!w&&gi(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(w=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(w&&(a instanceof Ge&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const N=e.mapping.map(c.before()),b=e.doc.resolve(N);c.node(-1).canReplaceWith(b.index(),b.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&gw(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return w},r6=(t,e={})=>({tr:n,state:r,dispatch:i,editor:a})=>{var o;const c=jn(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(i){let k=ge.empty;const C=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-C;P>=u.depth-3;P-=1)k=ge.from(u.node(P).copy(k));const E=u.indexAfter(-1){if(D>-1)return!1;P.isTextblock&&P.content.size===0&&(D=L+1)}),D>-1&&n.setSelection(Ge.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,w={...Zu(g,m.type.name,m.attrs),...e},N={...Zu(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const b=y?[{type:c,attrs:w},{type:y,attrs:N}]:[{type:c,attrs:w}];if(!gi(n.doc,u.pos,2))return!1;if(i){const{selection:k,storedMarks:C}=r,{splittableMarks:E}=a.extensionManager,T=C||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,b).scrollIntoView(),!T||!i)return!0;const I=T.filter(O=>E.includes(O.type.name));n.ensureMarks(I)}return!0},Xm=(t,e)=>{const n=Tf(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 i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Ca(t.doc,n.pos)&&t.join(n.pos),!0},Zm=(t,e)=>{const n=Tf(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 i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Ca(t.doc,r)&&t.join(r),!0},s6=(t,e,n,r={})=>({editor:i,tr:a,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,y=jn(t,o.schema),w=jn(e,o.schema),{selection:N,storedMarks:b}=o,{$from:k,$to:C}=N,E=k.blockRange(C),T=b||N.$to.parentOffset&&N.$from.marks();if(!E)return!1;const I=Tf(O=>mw(O.type.name,m))(N);if(E.depth>=1&&I&&E.depth-I.depth<=1){if(I.node.type===y)return h.liftListItem(w);if(mw(I.node.type.name,m)&&y.validContent(I.node.content)&&c)return u().command(()=>(a.setNodeMarkup(I.pos,y),!0)).command(()=>Xm(a,y)).command(()=>Zm(a,y)).run()}return!n||!T||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>Xm(a,y)).command(()=>Zm(a,y)).run():u().command(()=>{const O=f().wrapInList(y,r),D=T.filter(P=>g.includes(P.type.name));return a.ensureMarks(D),O?!0:h.clearNodes()}).wrapInList(y,r).command(()=>Xm(a,y)).command(()=>Zm(a,y)).run()},i6=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:a=!1}=n,o=wi(t,r.schema);return Zg(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,e)},a6=(t,e,n={})=>({state:r,commands:i})=>{const a=jn(t,r.schema),o=jn(e,r.schema),c=va(r,a,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(o,u):i.setNode(a,{...u,...n})},o6=(t,e={})=>({state:n,commands:r})=>{const i=jn(t,n.schema);return va(n,i,e)?r.lift(i):r.wrapIn(i,e)},l6=()=>({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},c6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},d6=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var a;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=wi(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!i)return!0;if(f&&o){let{from:g,to:y}=c;const w=(a=h.marks().find(b=>b.type===u))==null?void 0:a.attrs,N=w0(h,u,w);N&&(g=N.from,y=N.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},u6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=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=i.from,o=i.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},h6=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null;const c=Ef(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=jn(t,r.schema)),c==="mark"&&(o=wi(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,w,N;n.selection.empty?r.doc.nodesBetween(f,m,(b,k)=>{a&&a===b.type&&(u=!0,w=Math.max(k,f),N=Math.min(k+b.nodeSize,m),g=k,y=b)}):r.doc.nodesBetween(f,m,(b,k)=>{k=f&&k<=m&&(a&&a===b.type&&(u=!0,i&&n.setNodeMarkup(k,void 0,{...b.attrs,...e})),o&&b.marks.length&&b.marks.forEach(C=>{if(o===C.type&&(u=!0,i)){const E=Math.max(k,f),T=Math.min(k+b.nodeSize,m);n.addMark(E,T,o.create({...C.attrs,...e}))}}))}),y&&(g!==void 0&&i&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(b=>{o===b.type&&i&&n.addMark(w,N,o.create({...b.attrs,...e}))}))}),u},f6=(t,e={})=>({state:n,dispatch:r})=>{const i=jn(t,n.schema);return BO(i,e)(n,r)},p6=(t,e={})=>({state:n,dispatch:r})=>{const i=jn(t,n.schema);return VO(i,e)(n,r)},m6=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={}}},Af=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},g6=(t,e)=>{if(b0(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 Du(t){var e;const{editor:n,from:r,to:i,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=V8(h)+a;return o.forEach(g=>{if(f)return;const y=g6(m,g.find);if(!y)return;const w=u.state.tr,N=Sf({state:u.state,transaction:w}),b={from:r-(y[0].length-a.length),to:i},{commands:k,chain:C,can:E}=new Cf({editor:n,state:N});g.handler({state:N,range:b,match:y,commands:k,chain:C,can:E})===null||!w.steps.length||(g.undoable&&w.setMeta(c,{transform:w,from:r,to:i,text:a}),u.dispatch(w),f=!0)}),f}function x6(t){const{editor:e,rules:n}=t,r=new Wt({state:{init(){return null},apply(i,a,o){const c=i.getMeta(r);if(c)return c;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=j0(ge.from(f),o.schema);const{from:m}=u,g=m+f.length;Du({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,o,c){return Du({editor:e,from:a,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&Du({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Du({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function y6(t){return Object.prototype.toString.call(t).slice(8,-1)}function Lu(t){return y6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function E2(t,e){const n={...t};return Lu(t)&&Lu(e)&&Object.keys(e).forEach(r=>{Lu(e[r])&&Lu(t[r])?n[r]=E2(t[r],e[r]):n[r]=e[r]}),n}var S0=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{...Ct(We(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ct(We(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>E2(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}},Eo=class T2 extends S0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new T2(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.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(" ",i.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 v6(t){return typeof t=="number"}var b6=class{constructor(t){this.find=t.find,this.handler=t.handler}},w6=(t,e,n)=>{if(b0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const a=[i.text];return a.index=i.index,a.input=t,a.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(i.replaceWith)),a}):[]};function N6(t){const{editor:e,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Cf({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(y,w)=>{var N,b,k,C,E;if((b=(N=y.type)==null?void 0:N.spec)!=null&&b.code||!(y.isText||y.isTextblock||y.isInline))return;const T=(E=(C=(k=y.content)==null?void 0:k.size)!=null?C:y.nodeSize)!=null?E:0,I=Math.max(r,w),O=Math.min(i,w+T);if(I>=O)return;const D=y.isText?y.text||"":y.textBetween(I-w,O-w,void 0,"");w6(D,a.find,o).forEach(L=>{if(L.index===void 0)return;const _=I+L.index+1,J=_+L[0].length,ee={from:n.tr.mapping.map(_),to:n.tr.mapping.map(J)},Y=a.handler({state:n,range:ee,match:L,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(Y)})}),m.every(y=>y!==null)}var _u=null,j6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function k6(t){const{editor:e,rules:n}=t;let r=null,i=!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:w})=>{const N=f.tr,b=Sf({state:f,transaction:N});if(!(!N6({editor:e,state:b,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:w,dropEvent:c})||!N.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,N}};return n.map(f=>new Wt({view(m){const g=w=>{var N;r=(N=m.dom.parentElement)!=null&&N.contains(w.target)?m.dom.parentElement:null,r&&(_u=e)},y=()=>{_u&&(_u=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=_u;y!=null&&y.isEditable&&setTimeout(()=>{const w=y.state.selection;w&&y.commands.deleteRange({from:w.from,to:w.to})},10)}return!1},paste:(m,g)=>{var y;const w=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,i=!!(w!=null&&w.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const w=m[0],N=w.getMeta("uiEvent")==="paste"&&!i,b=w.getMeta("uiEvent")==="drop"&&!a,k=w.getMeta("applyPasteRules"),C=!!k;if(!N&&!b&&!C)return;if(C){let{text:I}=k;typeof I=="string"?I=I:I=j0(ge.from(I),y.schema);const{from:O}=k,D=O+I.length,P=j6(I);return u({rule:f,state:y,from:O,to:{b:D},pasteEvt:P})}const E=g.doc.content.findDiffStart(y.doc.content),T=g.doc.content.findDiffEnd(y.doc.content);if(!(!v6(E)||!T||E===T.b))return u({rule:f,state:y,from:E,to:T,pasteEvt:o})}}))}var If=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=v2(t),this.schema=D8(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:Sc(e.name,this.schema)},r=We(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Fc([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Sc(r.name,this.schema)},a=[],o=We(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&We(r,"exitable",i)&&(c.ArrowRight=()=>Eo.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,w])=>[y,()=>w({editor:t})]));c={...c,...g}}const u=zL(c);a.push(u);const h=We(r,"addInputRules",i);if(pw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=x6({editor:t,rules:g}),w=Array.isArray(y)?y:[y];a.push(...w)}}const f=We(r,"addPasteRules",i);if(pw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=k6({editor:t,rules:g});a.push(...y)}}const m=We(r,"addProseMirrorPlugins",i);if(m){const g=m();a.push(...g)}return a})}get attributes(){return y2(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Cl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:jn(n.name,this.schema)},a=We(n,"addNodeView",i);if(!a)return[];const o=a();if(!o)return[];const c=(u,h,f,m,g)=>{const y=id(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 Fc([...this.extensions].reverse()).reduceRight((r,i)=>{const a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Sc(i.name,this.schema)},o=We(i,"dispatchTransaction",a);return o?c=>{o.call(a,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Fc([...this.extensions]).reduce((r,i)=>{const a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Sc(i.name,this.schema)},o=We(i,"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}=Cl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:wi(n.name,this.schema)},a=We(n,"addMarkView",i);if(!a)return[];const o=(c,u,h)=>{const f=id(c,r);return a()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{$6(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:Sc(e.name,this.schema)};e.type==="mark"&&((n=Ct(We(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=We(e,"onBeforeCreate",r),a=We(e,"onCreate",r),o=We(e,"onUpdate",r),c=We(e,"onSelectionUpdate",r),u=We(e,"onTransaction",r),h=We(e,"onFocus",r),f=We(e,"onBlur",r),m=We(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),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)})}};If.resolve=v2;If.sort=Fc;If.flatten=N0;var S6={};v0(S6,{ClipboardTextSerializer:()=>A2,Commands:()=>I2,Delete:()=>R2,Drop:()=>P2,Editable:()=>O2,FocusEvents:()=>L2,Keymap:()=>_2,Paste:()=>z2,Tabindex:()=>$2,TextDirection:()=>F2,focusEventsPluginKey:()=>D2});var mn=class M2 extends S0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new M2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},A2=mn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Wt({key:new tn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:a}=i,o=Math.min(...a.map(f=>f.$from.pos)),c=Math.max(...a.map(f=>f.$to.pos)),u=w2(n);return b2(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),I2=mn.create({name:"commands",addCommands(){return{...l2}}}),R2=mn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;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=m2(t.before,[t,...e]);j2(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,(w,N)=>{const b=N+w.nodeSize-2,k=y.oldRange.from<=N&&b<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:w,from:N,to:b,newFrom:f.mapping.map(N),newTo:f.mapping.map(b),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,w)=>{var N,b;if(y instanceof xs){const k=g.slice(w).map(y.from,-1),C=g.slice(w).map(y.to),E=g.invert().map(k,-1),T=g.invert().map(C),I=(N=f.doc.nodeAt(k-1))==null?void 0:N.marks.some(D=>D.eq(y.mark)),O=(b=f.doc.nodeAt(C))==null?void 0:b.marks.some(D=>D.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:E,to:T},newRange:{from:k,to:C},partial:!!(O||I),editor:this.editor,transaction:t,combinedTransform:f})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(a,0):a()}}),P2=mn.create({name:"drop",addProseMirrorPlugins(){return[new Wt({key:new tn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),O2=mn.create({name:"editable",addProseMirrorPlugins(){return[new Wt({key:new tn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),D2=new tn("focusEvents"),L2=mn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Wt({key:D2,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}}}})]}}),_2=mn.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,w=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,N=w.parent.type.spec.isolating,b=m.pos-m.parentOffset,k=N&&w.parent.childCount===1?b===m.pos:et.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()},i={...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 Sh()||f2()?a:i},addProseMirrorPlugins(){return[new Wt({key:new tn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(N=>N.getMeta("composition")))return;const r=t.some(N=>N.docChanged)&&!e.doc.eq(n.doc),i=t.some(N=>N.getMeta("preventClearDocument"));if(!r||i)return;const{empty:a,from:o,to:c}=e.selection,u=et.atStart(e.doc).from,h=et.atEnd(e.doc).to;if(a||!(o===u&&c===h)||!Mf(n.doc))return;const g=n.tr,y=Sf({state:n,transaction:g}),{commands:w}=new Cf({editor:this.editor,state:y});if(w.clearNodes(),!!g.steps.length)return g}})]}}),z2=mn.create({name:"paste",addProseMirrorPlugins(){return[new Wt({key:new tn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),$2=mn.create({name:"tabindex",addProseMirrorPlugins(){return[new Wt({key:new tn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),F2=mn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Cl(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 Wt({key:new tn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),C6=class Ic{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}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 Ic(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 Ic(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 Ic(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=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(!i&&!o&&u.depth<=this.depth)return;const h=new Ic(u,this.editor,i,i||o?n:null);i&&(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,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const a=i.node.attrs,o=Object.keys(n);for(let c=0;c{r&&i.length>0||(o.node.type.name===e&&a.every(u=>n[u]===o.node.attrs[u])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},E6=`.ProseMirror { position: relative; } @@ -677,24 +677,24 @@ img.ProseMirror-separator { .ProseMirror-focused .ProseMirror-gapcursor { display: block; -}`;function T6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var M6=class extends m6{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:K8,createMappablePosition:q8},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:i,moved:a})=>this.options.onDrop(r,i,a)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=d2(e,this.options.autofocus);this.editorState=gl.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=T6(E6,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=g2(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(i=>{const a=typeof i=="string"?`${i}$`:i.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?[P2,M2.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),A2,D2,L2,z2,R2,_2,I2,$2.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new Af(r,this)}createCommandManager(){this.commandManager=new Sf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Qg(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=Qg(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),i=n?this.extensionManager.dispatchTransaction(r):r,a=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new a2(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:i,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),i=n.includes(t),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)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 w2(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return H8(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return N0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` +}`;function T6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var M6=class extends m6{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:K8,createMappablePosition:q8},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:i,moved:a})=>this.options.onDrop(r,i,a)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=u2(e,this.options.autofocus);this.editorState=pl.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=T6(E6,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=x2(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(i=>{const a=typeof i=="string"?`${i}$`:i.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?[O2,A2.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),I2,L2,_2,$2,P2,z2,R2,F2.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new If(r,this)}createCommandManager(){this.commandManager=new Cf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Xg(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=Xg(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),i=n?this.extensionManager.dispatchTransaction(r):r,a=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new o2(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:i,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),i=n.includes(t),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)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 N2(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return H8(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return j0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` -`,textSerializers:n={}}=t||{};return _8(this.state.doc,{blockSeparator:e,textSerializers:{...b2(this.schema),...n}})}get isEmpty(){return Tf(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 C6(e,this)}get $doc(){return this.$pos(0)}};function Ml(t){return new Mf({find:t.find,handler:({state:e,range:n,match:r})=>{const i=jt(t.getAttributes,void 0,r);if(i===!1||i===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(j0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(N=>N===t.type&&N!==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(i||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function F2(t){return new Mf({find:t.find,handler:({state:e,range:n,match:r})=>{const i=jt(t.getAttributes,void 0,r)||{},{tr:a}=e,o=n.from;let c=n.to;const u=t.type.create(i);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(i)).delete(a.mapping.map(o),a.mapping.map(c))}a.scrollIntoView()},undoable:t.undoable})}function Zg(t){return new Mf({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),a=jt(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.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 Al(t){return new Mf({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const a=jt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&e0(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,w=g||m.$to.parentOffset&&m.$from.marks();if(w){const N=w.filter(b=>y.includes(b.type.name));o.ensureMarks(N)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,a).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&Sa(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var A6=t=>"touches"in t,I6=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,i,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),(i=t.options)!=null&&i.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"),i=e.includes("left"),a=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(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,A6(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:i}=this.calculateNewDimensions(this.activeHandle,t,e),a=this.applyConstraints(r,i,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,i=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?i=this.startHeight+n:u&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(a?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i,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)),(i=this.maxSize)!=null&&i.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",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function R6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ke){const a=r.index();return r.parent.canReplaceWith(a,a+1,e)}let i=r.depth;for(;i>=0;){const a=r.index(i);if(r.node(i).contentMatchAt(a).matchType(e))return!0;i-=1}return!1}function P6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var O6={};y0(O6,{createAtomBlockMarkdownSpec:()=>D6,createBlockMarkdownSpec:()=>L6,createInlineMarkdownSpec:()=>B2,parseAttributes:()=>S0,parseIndentedBlocks:()=>ex,renderNestedMarkdownContent:()=>E0,serializeAttributes:()=>C0});function S0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const h=i.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 C0(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 D6(t){const{nodeName:e,name:n,parseAttributes:r=S0,serializeAttributes:i=C0,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|$)`),w=f.match(y);if(!w)return;const N=w[1]||"",b=r(N);if(!o.find(C=>!(C in b)))return{type:e,raw:w[0],attributes:b}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=i(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function L6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=S0,serializeAttributes:a=C0,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 N=r(m);y=typeof N=="string"?[{type:"text",text:N}]:N}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const w={...o,...m.attributes};return g.createNode(e,w,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),w=(g=m.match(y))==null?void 0:g.index;return w!==void 0?w:-1},tokenize(m,g,y){var w;const N=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=m.match(N);if(!b)return;const[k,C=""]=b,E=i(C);let T=1;const I=k.length;let O="";const D=/^:::([\w-]*)(\s.*)?/gm,P=m.slice(I);for(D.lastIndex=0;;){const L=D.exec(P);if(L===null)break;const _=L.index,J=L[1];if(!((w=L[2])!=null&&w.endsWith(":::"))){if(J)T+=1;else if(T-=1,T===0){const ee=P.slice(0,_);O=ee.trim();const Y=m.slice(0,I+_+L[0].length);let U=[];if(O)if(c==="block")for(U=y.blockTokens(ee),U.forEach(R=>{R.text&&(!R.tokens||R.tokens.length===0)&&(R.tokens=y.inlineTokens(R.text))});U.length>0;){const R=U[U.length-1];if(R.type==="paragraph"&&(!R.text||R.text.trim()===""))U.pop();else break}else U=y.inlineTokens(O);return{type:e,raw:Y,attributes:E,content:O,tokens:U}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),w=a(y),N=w?` {${w}}`:"",b=g.renderChildren(m.content||[],` +`,textSerializers:n={}}=t||{};return _8(this.state.doc,{blockSeparator:e,textSerializers:{...w2(this.schema),...n}})}get isEmpty(){return Mf(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 C6(e,this)}get $doc(){return this.$pos(0)}};function El(t){return new Af({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ct(t.getAttributes,void 0,r);if(i===!1||i===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(k0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(N=>N===t.type&&N!==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(i||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function B2(t){return new Af({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ct(t.getAttributes,void 0,r)||{},{tr:a}=e,o=n.from;let c=n.to;const u=t.type.create(i);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(i)).delete(a.mapping.map(o),a.mapping.map(c))}a.scrollIntoView()},undoable:t.undoable})}function ex(t){return new Af({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),a=Ct(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.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 Tl(t){return new Af({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const a=Ct(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&t0(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,w=g||m.$to.parentOffset&&m.$from.marks();if(w){const N=w.filter(b=>y.includes(b.type.name));o.ensureMarks(N)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,a).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&Ca(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var A6=t=>"touches"in t,I6=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,i,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),(i=t.options)!=null&&i.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"),i=e.includes("left"),a=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(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,A6(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:i}=this.calculateNewDimensions(this.activeHandle,t,e),a=this.applyConstraints(r,i,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,i=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?i=this.startHeight+n:u&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(a?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i,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)),(i=this.maxSize)!=null&&i.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",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function R6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof qe){const a=r.index();return r.parent.canReplaceWith(a,a+1,e)}let i=r.depth;for(;i>=0;){const a=r.index(i);if(r.node(i).contentMatchAt(a).matchType(e))return!0;i-=1}return!1}function P6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var O6={};v0(O6,{createAtomBlockMarkdownSpec:()=>D6,createBlockMarkdownSpec:()=>L6,createInlineMarkdownSpec:()=>V2,parseAttributes:()=>C0,parseIndentedBlocks:()=>tx,renderNestedMarkdownContent:()=>T0,serializeAttributes:()=>E0});function C0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const h=i.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 E0(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 D6(t){const{nodeName:e,name:n,parseAttributes:r=C0,serializeAttributes:i=E0,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|$)`),w=f.match(y);if(!w)return;const N=w[1]||"",b=r(N);if(!o.find(C=>!(C in b)))return{type:e,raw:w[0],attributes:b}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=i(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function L6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=C0,serializeAttributes:a=E0,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 N=r(m);y=typeof N=="string"?[{type:"text",text:N}]:N}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const w={...o,...m.attributes};return g.createNode(e,w,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),w=(g=m.match(y))==null?void 0:g.index;return w!==void 0?w:-1},tokenize(m,g,y){var w;const N=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=m.match(N);if(!b)return;const[k,C=""]=b,E=i(C);let T=1;const I=k.length;let O="";const D=/^:::([\w-]*)(\s.*)?/gm,P=m.slice(I);for(D.lastIndex=0;;){const L=D.exec(P);if(L===null)break;const _=L.index,J=L[1];if(!((w=L[2])!=null&&w.endsWith(":::"))){if(J)T+=1;else if(T-=1,T===0){const ee=P.slice(0,_);O=ee.trim();const Y=m.slice(0,I+_+L[0].length);let U=[];if(O)if(c==="block")for(U=y.blockTokens(ee),U.forEach(R=>{R.text&&(!R.tokens||R.tokens.length===0)&&(R.tokens=y.inlineTokens(R.text))});U.length>0;){const R=U[U.length-1];if(R.type==="paragraph"&&(!R.text||R.text.trim()===""))U.pop();else break}else U=y.inlineTokens(O);return{type:e,raw:Y,attributes:E,content:O,tokens:U}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),w=a(y),N=w?` {${w}}`:"",b=g.renderChildren(m.content||[],` `);return`:::${h}${N} ${b} -:::`}}}function _6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,a,o]=r;e[i]=a||o,r=n.exec(t)}return e}function z6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function B2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=_6,serializeAttributes:a=z6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(w=>{const N=typeof w=="string"?w:w.name,b=typeof w=="string"?void 0:w.skipIfDefault;if(N in g){const k=g[N];if(b!==void 0&&k===b)return;y[N]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const w={...o,...g.attributes};if(c)return y.createNode(e,w);const N=r?r(g):g.content||"";return N?y.createNode(e,w,[y.createTextNode(N)]):y.createNode(e,w,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),w=g.match(y),N=w==null?void 0:w.index;return N!==void 0?N:-1},tokenize(g,y,w){const N=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),b=g.match(N);if(!b)return;let k="",C="";if(c){const[,T]=b;C=T}else{const[,T,I]=b;C=T,k=I||""}const E=i(C.trim());return{type:e,raw:b[0],content:k.trim(),attributes:E}}},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 w=f(g.attrs||{}),N=a(w),b=N?` ${N}`:"";return c?`[${h}${b}]`:`[${h}${b}]${y}[/${h}]`}}}function ex(t,e,n){var r,i,a,o;const c=t.split(` +:::`}}}function _6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,a,o]=r;e[i]=a||o,r=n.exec(t)}return e}function z6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function V2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=_6,serializeAttributes:a=z6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(w=>{const N=typeof w=="string"?w:w.name,b=typeof w=="string"?void 0:w.skipIfDefault;if(N in g){const k=g[N];if(b!==void 0&&k===b)return;y[N]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const w={...o,...g.attributes};if(c)return y.createNode(e,w);const N=r?r(g):g.content||"";return N?y.createNode(e,w,[y.createTextNode(N)]):y.createNode(e,w,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),w=g.match(y),N=w==null?void 0:w.index;return N!==void 0?N:-1},tokenize(g,y,w){const N=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),b=g.match(N);if(!b)return;let k="",C="";if(c){const[,T]=b;C=T}else{const[,T,I]=b;C=T,k=I||""}const E=i(C.trim());return{type:e,raw:b[0],content:k.trim(),attributes:E}}},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 w=f(g.attrs||{}),N=a(w),b=N?` ${N}`:"";return c?`[${h}${b}]`:`[${h}${b}]${y}[/${h}]`}}}function tx(t,e,n){var r,i,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 w=e.extractItemData(y),{indentLevel:N,mainContent:b}=w;h=`${h}${g} `;const k=[b];for(f+=1;f_.trim()!=="");if(D===-1)break;if((((i=(r=c[f+1+D].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>N){k.push(I),h=`${h}${I} `,f+=1;continue}else break}if((((o=(a=I.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:o.length)||0)>N)k.push(I),h=`${h}${I} `,f+=1;else break}let C;const E=k.slice(1);if(E.length>0){const I=E.map(O=>O.slice(N+m)).join(` -`);I.trim()&&(e.customNestedParser?C=e.customNestedParser(I):C=n.blockTokens(I))}const T=e.createToken(w,C);u.push(T)}if(u.length!==0)return{items:u,raw:h}}function E0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[a,...o]=t.content,c=e.renderChildren([a]),u=[`${i}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` +`);I.trim()&&(e.customNestedParser?C=e.customNestedParser(I):C=n.blockTokens(I))}const T=e.createToken(w,C);u.push(T)}if(u.length!==0)return{items:u,raw:h}}function T0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[a,...o]=t.content,c=e.renderChildren([a]),u=[`${i}${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 $6(t,e,n={}){const{state:r}=e,{doc:i,tr:a}=r,o=t;i.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 Nn=class V2 extends k0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new V2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function vo(t){return new b6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const a=jt(t.getAttributes,void 0,r,i);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(j0(n.from,n.to,e.doc).filter(w=>w.mark.type.excluded.find(b=>b===t.type&&b!==w.mark.type)).filter(w=>w.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:F6,getOwnPropertySymbols:B6}=Object,{hasOwnProperty:V6}=Object.prototype;function Zm(t,e){return function(r,i,a){return t(r,i,a)&&e(r,i,a)}}function _u(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:a}=i,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,i);return a.delete(n),a.delete(r),u}}function H6(t){return t!=null?t[Symbol.toStringTag]:void 0}function gw(t){return F6(t).concat(B6(t))}const W6=Object.hasOwn||((t,e)=>V6.call(t,e));function Eo(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const U6="__v",K6="__o",q6="_owner",{getOwnPropertyDescriptor:xw,keys:yw}=Object;function G6(t,e){return t.byteLength===e.byteLength&&Sh(new Uint8Array(t),new Uint8Array(e))}function J6(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 Y6(t,e){return t.byteLength===e.byteLength&&Sh(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Q6(t,e){return Eo(t.getTime(),e.getTime())}function X6(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Z6(t,e){return t===e}function vw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=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(i[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=i[m]=!0;break}m++}if(!f)return!1;u++}return!0}const e_=Eo;function t_(t,e,n){const r=yw(t);let i=r.length;if(yw(e).length!==i)return!1;for(;i-- >0;)if(!H2(t,e,n,r[i]))return!1;return!0}function Sc(t,e,n){const r=gw(t);let i=r.length;if(gw(e).length!==i)return!1;let a,o,c;for(;i-- >0;)if(a=r[i],!H2(t,e,n,a)||(o=xw(t,a),c=xw(e,a),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function n_(t,e){return Eo(t.valueOf(),e.valueOf())}function r_(t,e){return t.source===e.source&&t.flags===e.flags}function bw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=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(!i[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=i[f]=!0;break}f++}if(!h)return!1}return!0}function Sh(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 s_(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 H2(t,e,n,r){return(r===q6||r===K6||r===U6)&&(t.$$typeof||e.$$typeof)?!0:W6(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const i_="[object ArrayBuffer]",a_="[object Arguments]",o_="[object Boolean]",l_="[object DataView]",c_="[object Date]",d_="[object Error]",u_="[object Map]",h_="[object Number]",f_="[object Object]",p_="[object RegExp]",m_="[object Set]",g_="[object String]",x_={"[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},y_="[object URL]",v_=Object.prototype.toString;function b_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:w}){return function(b,k,C){if(b===k)return!0;if(b==null||k==null)return!1;const E=typeof b;if(E!==typeof k)return!1;if(E!=="object")return E==="number"?c(b,k,C):E==="function"?a(b,k,C):!1;const T=b.constructor;if(T!==k.constructor)return!1;if(T===Object)return u(b,k,C);if(Array.isArray(b))return e(b,k,C);if(T===Date)return r(b,k,C);if(T===RegExp)return f(b,k,C);if(T===Map)return o(b,k,C);if(T===Set)return m(b,k,C);const I=v_.call(b);if(I===c_)return r(b,k,C);if(I===p_)return f(b,k,C);if(I===u_)return o(b,k,C);if(I===m_)return m(b,k,C);if(I===f_)return typeof b.then!="function"&&typeof k.then!="function"&&u(b,k,C);if(I===y_)return y(b,k,C);if(I===d_)return i(b,k,C);if(I===a_)return u(b,k,C);if(x_[I])return g(b,k,C);if(I===i_)return t(b,k,C);if(I===l_)return n(b,k,C);if(I===o_||I===h_||I===g_)return h(b,k,C);if(w){let O=w[I];if(!O){const D=H6(b);D&&(O=w[D])}if(O)return O(b,k,C)}return!1}}function w_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:G6,areArraysEqual:n?Sc:J6,areDataViewsEqual:Y6,areDatesEqual:Q6,areErrorsEqual:X6,areFunctionsEqual:Z6,areMapsEqual:n?Zm(vw,Sc):vw,areNumbersEqual:e_,areObjectsEqual:n?Sc:t_,arePrimitiveWrappersEqual:n_,areRegExpsEqual:r_,areSetsEqual:n?Zm(bw,Sc):bw,areTypedArraysEqual:n?Zm(Sh,Sc):Sh,areUrlsEqual:s_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=_u(r.areArraysEqual),a=_u(r.areMapsEqual),o=_u(r.areObjectsEqual),c=_u(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return r}function N_(t){return function(e,n,r,i,a,o,c){return t(e,n,c)}}function j_({circular:t,comparator:e,createState:n,equals:r,strict:i}){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:i})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const a={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,u){return e(c,u,a)}}const k_=Ea();Ea({strict:!0});Ea({circular:!0});Ea({circular:!0,strict:!0});Ea({createInternalComparator:()=>Eo});Ea({strict:!0,createInternalComparator:()=>Eo});Ea({circular:!0,createInternalComparator:()=>Eo});Ea({circular:!0,createInternalComparator:()=>Eo,strict:!0});function Ea(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,a=w_(t),o=b_(a),c=n?n(o):N_(o);return j_({circular:e,comparator:o,createState:r,equals:c,strict:i})}var eg={exports:{}},tg={};/** +`)}function $6(t,e,n={}){const{state:r}=e,{doc:i,tr:a}=r,o=t;i.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 kn=class H2 extends S0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new H2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function bo(t){return new b6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const a=Ct(t.getAttributes,void 0,r,i);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(k0(n.from,n.to,e.doc).filter(w=>w.mark.type.excluded.find(b=>b===t.type&&b!==w.mark.type)).filter(w=>w.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:F6,getOwnPropertySymbols:B6}=Object,{hasOwnProperty:V6}=Object.prototype;function eg(t,e){return function(r,i,a){return t(r,i,a)&&e(r,i,a)}}function zu(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:a}=i,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,i);return a.delete(n),a.delete(r),u}}function H6(t){return t!=null?t[Symbol.toStringTag]:void 0}function xw(t){return F6(t).concat(B6(t))}const W6=Object.hasOwn||((t,e)=>V6.call(t,e));function To(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const U6="__v",K6="__o",q6="_owner",{getOwnPropertyDescriptor:yw,keys:vw}=Object;function G6(t,e){return t.byteLength===e.byteLength&&Ch(new Uint8Array(t),new Uint8Array(e))}function J6(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 Y6(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 Q6(t,e){return To(t.getTime(),e.getTime())}function X6(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Z6(t,e){return t===e}function bw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=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(i[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=i[m]=!0;break}m++}if(!f)return!1;u++}return!0}const e_=To;function t_(t,e,n){const r=vw(t);let i=r.length;if(vw(e).length!==i)return!1;for(;i-- >0;)if(!W2(t,e,n,r[i]))return!1;return!0}function Cc(t,e,n){const r=xw(t);let i=r.length;if(xw(e).length!==i)return!1;let a,o,c;for(;i-- >0;)if(a=r[i],!W2(t,e,n,a)||(o=yw(t,a),c=yw(e,a),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function n_(t,e){return To(t.valueOf(),e.valueOf())}function r_(t,e){return t.source===e.source&&t.flags===e.flags}function ww(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=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(!i[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=i[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 s_(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 W2(t,e,n,r){return(r===q6||r===K6||r===U6)&&(t.$$typeof||e.$$typeof)?!0:W6(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const i_="[object ArrayBuffer]",a_="[object Arguments]",o_="[object Boolean]",l_="[object DataView]",c_="[object Date]",d_="[object Error]",u_="[object Map]",h_="[object Number]",f_="[object Object]",p_="[object RegExp]",m_="[object Set]",g_="[object String]",x_={"[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},y_="[object URL]",v_=Object.prototype.toString;function b_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:w}){return function(b,k,C){if(b===k)return!0;if(b==null||k==null)return!1;const E=typeof b;if(E!==typeof k)return!1;if(E!=="object")return E==="number"?c(b,k,C):E==="function"?a(b,k,C):!1;const T=b.constructor;if(T!==k.constructor)return!1;if(T===Object)return u(b,k,C);if(Array.isArray(b))return e(b,k,C);if(T===Date)return r(b,k,C);if(T===RegExp)return f(b,k,C);if(T===Map)return o(b,k,C);if(T===Set)return m(b,k,C);const I=v_.call(b);if(I===c_)return r(b,k,C);if(I===p_)return f(b,k,C);if(I===u_)return o(b,k,C);if(I===m_)return m(b,k,C);if(I===f_)return typeof b.then!="function"&&typeof k.then!="function"&&u(b,k,C);if(I===y_)return y(b,k,C);if(I===d_)return i(b,k,C);if(I===a_)return u(b,k,C);if(x_[I])return g(b,k,C);if(I===i_)return t(b,k,C);if(I===l_)return n(b,k,C);if(I===o_||I===h_||I===g_)return h(b,k,C);if(w){let O=w[I];if(!O){const D=H6(b);D&&(O=w[D])}if(O)return O(b,k,C)}return!1}}function w_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:G6,areArraysEqual:n?Cc:J6,areDataViewsEqual:Y6,areDatesEqual:Q6,areErrorsEqual:X6,areFunctionsEqual:Z6,areMapsEqual:n?eg(bw,Cc):bw,areNumbersEqual:e_,areObjectsEqual:n?Cc:t_,arePrimitiveWrappersEqual:n_,areRegExpsEqual:r_,areSetsEqual:n?eg(ww,Cc):ww,areTypedArraysEqual:n?eg(Ch,Cc):Ch,areUrlsEqual:s_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=zu(r.areArraysEqual),a=zu(r.areMapsEqual),o=zu(r.areObjectsEqual),c=zu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return r}function N_(t){return function(e,n,r,i,a,o,c){return t(e,n,c)}}function j_({circular:t,comparator:e,createState:n,equals:r,strict:i}){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:i})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const a={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,u){return e(c,u,a)}}const k_=Ta();Ta({strict:!0});Ta({circular:!0});Ta({circular:!0,strict:!0});Ta({createInternalComparator:()=>To});Ta({strict:!0,createInternalComparator:()=>To});Ta({circular:!0,createInternalComparator:()=>To});Ta({circular:!0,createInternalComparator:()=>To,strict:!0});function Ta(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,a=w_(t),o=b_(a),c=n?n(o):N_(o);return j_({circular:e,comparator:o,createState:r,equals:c,strict:i})}var tg={exports:{}},ng={};/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -702,51 +702,51 @@ ${b} * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ww;function S_(){if(ww)return tg;ww=1;var t=cd(),e=Rk();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,i=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return tg.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var w=a(null);if(w.current===null){var N={hasValue:!1,value:null};w.current=N}else N=w.current;w=c(function(){function k(O){if(!C){if(C=!0,E=O,O=g(O),y!==void 0&&N.hasValue){var D=N.value;if(y(D,O))return T=D}return T=O}if(D=T,r(E,O))return D;var P=g(O);return y!==void 0&&y(D,P)?(E=O,D):(E=O,T=P)}var C=!1,E,T,I=m===void 0?null:m;return[function(){return k(f())},I===null?void 0:function(){return k(I())}]},[f,m,g,y]);var b=i(h,w[0],w[1]);return o(function(){N.hasValue=!0,N.value=b},[b]),u(b),b},tg}var Nw;function C_(){return Nw||(Nw=1,eg.exports=S_()),eg.exports}var E_=C_(),T_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},M_=({contentComponent:t})=>{const e=Pk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function A_(){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]:MN.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var I_=class extends hr.Component{constructor(t){var e;super(t),this.editorContentRef=hr.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=A_(),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 s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:T_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(M_,{contentComponent:t.contentComponent})]})}},R_=v.forwardRef((t,e)=>{const n=hr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return hr.createElement(I_,{key:n,innerRef:e,...t})}),W2=hr.memo(R_),P_=typeof window<"u"?v.useLayoutEffect:v.useEffect,O_=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 D_(t){var e;const[n]=v.useState(()=>new O_(t.editor)),r=E_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:k_);return P_(()=>n.watch(t.editor),[t.editor,n]),v.useDebugValue(r),r}var L_=!1,tx=typeof window>"u",__=tx||!!(typeof window<"u"&&window.next),z_=class U2{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?tx||__?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onBeforeCreate)==null?void 0:a.call(i,...r)},onBlur:(...r)=>{var i,a;return(a=(i=this.options.current).onBlur)==null?void 0:a.call(i,...r)},onCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onCreate)==null?void 0:a.call(i,...r)},onDestroy:(...r)=>{var i,a;return(a=(i=this.options.current).onDestroy)==null?void 0:a.call(i,...r)},onFocus:(...r)=>{var i,a;return(a=(i=this.options.current).onFocus)==null?void 0:a.call(i,...r)},onSelectionUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onSelectionUpdate)==null?void 0:a.call(i,...r)},onTransaction:(...r)=>{var i,a;return(a=(i=this.options.current).onTransaction)==null?void 0:a.call(i,...r)},onUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onUpdate)==null?void 0:a.call(i,...r)},onContentError:(...r)=>{var i,a;return(a=(i=this.options.current).onContentError)==null?void 0:a.call(i,...r)},onDrop:(...r)=>{var i,a;return(a=(i=this.options.current).onDrop)==null?void 0:a.call(i,...r)},onPaste:(...r)=>{var i,a;return(a=(i=this.options.current).onPaste)==null?void 0:a.call(i,...r)},onDelete:(...r)=>{var i,a;return(a=(i=this.options.current).onDelete)==null?void 0:a.call(i,...r)}};return new M6(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((i,a)=>{var o;return i===((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?U2.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,i)=>r===e[i]))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 $_(t={},e=[]){const n=v.useRef(t);n.current=t;const[r]=v.useState(()=>new z_(n)),i=Pk.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return v.useDebugValue(i),v.useEffect(r.onRender(e)),D_({editor:i,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),i}var K2=v.createContext({editor:null});K2.Consumer;var F_=v.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),B_=()=>v.useContext(F_);hr.forwardRef((t,e)=>{const{onDragStart:n}=B_(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});hr.createContext({markViewContentRef:()=>{}});var T0=v.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});T0.displayName="TiptapContext";var V_=()=>v.useContext(T0);function q2({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 i=v.useMemo(()=>({editor:r}),[r]),a=v.useMemo(()=>({editor:r}),[r]);return s.jsx(K2.Provider,{value:a,children:s.jsx(T0.Provider,{value:i,children:n})})}q2.displayName="Tiptap";function G2({...t}){const{editor:e}=V_();return s.jsx(W2,{editor:e,...t})}G2.displayName="Tiptap.Content";Object.assign(q2,{Content:G2});var Ch=(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]},H_=/^\s*>\s$/,W_=Nn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Ch("blockquote",{...kt(this.options.HTMLAttributes,t),children:Ch("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(i=>{const c=e.renderChildren([i]).split(` + */var Nw;function S_(){if(Nw)return ng;Nw=1;var t=dd(),e=Pk();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,i=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return ng.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var w=a(null);if(w.current===null){var N={hasValue:!1,value:null};w.current=N}else N=w.current;w=c(function(){function k(O){if(!C){if(C=!0,E=O,O=g(O),y!==void 0&&N.hasValue){var D=N.value;if(y(D,O))return T=D}return T=O}if(D=T,r(E,O))return D;var P=g(O);return y!==void 0&&y(D,P)?(E=O,D):(E=O,T=P)}var C=!1,E,T,I=m===void 0?null:m;return[function(){return k(f())},I===null?void 0:function(){return k(I())}]},[f,m,g,y]);var b=i(h,w[0],w[1]);return o(function(){N.hasValue=!0,N.value=b},[b]),u(b),b},ng}var jw;function C_(){return jw||(jw=1,tg.exports=S_()),tg.exports}var E_=C_(),T_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},M_=({contentComponent:t})=>{const e=Ok.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function A_(){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]:AN.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var I_=class extends pr.Component{constructor(t){var e;super(t),this.editorContentRef=pr.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=A_(),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 s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:T_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(M_,{contentComponent:t.contentComponent})]})}},R_=v.forwardRef((t,e)=>{const n=pr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return pr.createElement(I_,{key:n,innerRef:e,...t})}),U2=pr.memo(R_),P_=typeof window<"u"?v.useLayoutEffect:v.useEffect,O_=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 D_(t){var e;const[n]=v.useState(()=>new O_(t.editor)),r=E_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:k_);return P_(()=>n.watch(t.editor),[t.editor,n]),v.useDebugValue(r),r}var L_=!1,nx=typeof window>"u",__=nx||!!(typeof window<"u"&&window.next),z_=class K2{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?nx||__?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onBeforeCreate)==null?void 0:a.call(i,...r)},onBlur:(...r)=>{var i,a;return(a=(i=this.options.current).onBlur)==null?void 0:a.call(i,...r)},onCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onCreate)==null?void 0:a.call(i,...r)},onDestroy:(...r)=>{var i,a;return(a=(i=this.options.current).onDestroy)==null?void 0:a.call(i,...r)},onFocus:(...r)=>{var i,a;return(a=(i=this.options.current).onFocus)==null?void 0:a.call(i,...r)},onSelectionUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onSelectionUpdate)==null?void 0:a.call(i,...r)},onTransaction:(...r)=>{var i,a;return(a=(i=this.options.current).onTransaction)==null?void 0:a.call(i,...r)},onUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onUpdate)==null?void 0:a.call(i,...r)},onContentError:(...r)=>{var i,a;return(a=(i=this.options.current).onContentError)==null?void 0:a.call(i,...r)},onDrop:(...r)=>{var i,a;return(a=(i=this.options.current).onDrop)==null?void 0:a.call(i,...r)},onPaste:(...r)=>{var i,a;return(a=(i=this.options.current).onPaste)==null?void 0:a.call(i,...r)},onDelete:(...r)=>{var i,a;return(a=(i=this.options.current).onDelete)==null?void 0:a.call(i,...r)}};return new M6(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((i,a)=>{var o;return i===((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?K2.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,i)=>r===e[i]))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 $_(t={},e=[]){const n=v.useRef(t);n.current=t;const[r]=v.useState(()=>new z_(n)),i=Ok.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return v.useDebugValue(i),v.useEffect(r.onRender(e)),D_({editor:i,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),i}var q2=v.createContext({editor:null});q2.Consumer;var F_=v.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),B_=()=>v.useContext(F_);pr.forwardRef((t,e)=>{const{onDragStart:n}=B_(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});pr.createContext({markViewContentRef:()=>{}});var M0=v.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});M0.displayName="TiptapContext";var V_=()=>v.useContext(M0);function G2({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 i=v.useMemo(()=>({editor:r}),[r]),a=v.useMemo(()=>({editor:r}),[r]);return s.jsx(q2.Provider,{value:a,children:s.jsx(M0.Provider,{value:i,children:n})})}G2.displayName="Tiptap";function J2({...t}){const{editor:e}=V_();return s.jsx(U2,{editor:e,...t})}J2.displayName="Tiptap.Content";Object.assign(G2,{Content:J2});var Eh=(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]},H_=/^\s*>\s$/,W_=kn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Eh("blockquote",{...Et(this.options.HTMLAttributes,t),children:Eh("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(i=>{const c=e.renderChildren([i]).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[Al({find:H_,type:this.type})]}}),U_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,K_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,q_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,G_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,J_=Co.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 Ch("strong",{...kt(this.options.HTMLAttributes,t),children:Ch("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[Ml({find:U_,type:this.type}),Ml({find:q_,type:this.type})]},addPasteRules(){return[vo({find:K_,type:this.type}),vo({find:G_,type:this.type})]}}),Y_=/(^|[^`])`([^`]+)`(?!`)$/,Q_=/(^|[^`])`([^`]+)`(?!`)/g,X_=Co.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",kt(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[Ml({find:Y_,type:this.type})]},addPasteRules(){return[vo({find:Q_,type:this.type})]}}),ng=4,Z_=/^```([a-z]+)?[\s\n]$/,e7=/^~~~([a-z]+)?[\s\n]$/,t7=Nn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:ng,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",kt(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 i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(` +`)},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[Tl({find:H_,type:this.type})]}}),U_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,K_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,q_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,G_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,J_=Eo.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 Eh("strong",{...Et(this.options.HTMLAttributes,t),children:Eh("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[El({find:U_,type:this.type}),El({find:q_,type:this.type})]},addPasteRules(){return[bo({find:K_,type:this.type}),bo({find:G_,type:this.type})]}}),Y_=/(^|[^`])`([^`]+)`(?!`)$/,Q_=/(^|[^`])`([^`]+)`(?!`)/g,X_=Eo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Et(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[El({find:Y_,type:this.type})]},addPasteRules(){return[bo({find:Q_,type:this.type})]}}),rg=4,Z_=/^```([a-z]+)?[\s\n]$/,e7=/^~~~([a-z]+)?[\s\n]$/,t7=kn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:rg,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",Et(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 i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(` `):r=`\`\`\`${i} -\`\`\``,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:ng,{state:r}=t,{selection:i}=r,{$from:a,empty:o}=i;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}=i,y=r.doc.textBetween(h,f,` +\`\`\``,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:rg,{state:r}=t,{selection:i}=r,{$from:a,empty:o}=i;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}=i,y=r.doc.textBetween(h,f,` `,` `).split(` `).map(w=>c+w).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:ng,{state:r}=t,{selection:i}=r,{$from:a,empty:o}=i;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,` +`);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:rg,{state:r}=t,{selection:i}=r,{$from:a,empty:o}=i;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 w=0,N=0;const b=h-f;for(let O=0;O=b){w=O;break}N+=y[O].length+1}const C=((u=y[w].match(/^ */))==null?void 0:u[0])||"",E=Math.min(C.length,n);if(E===0)return!0;let T=f;for(let O=0;O{const{from:u,to:h}=i,g=r.doc.textBetween(u,h,` +`);let w=0,N=0;const b=h-f;for(let O=0;O=b){w=O;break}N+=y[O].length+1}const C=((u=y[w].match(/^ */))==null?void 0:u[0])||"",E=Math.min(C.length,n);if(E===0)return!0;let T=f;for(let O=0;O{const{from:u,to:h}=i,g=r.doc.textBetween(u,h,` `,` `).split(` `).map(y=>{var w;const N=((w=y.match(/^ */))==null?void 0:w[0])||"",b=Math.min(N.length,n);return y.slice(b)}).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:i}=n;if(!i||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:i,empty:a}=n;if(!a||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(Ze.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Zg({find:Z_,type:this.type,getAttributes:t=>({language:t[1]})}),Zg({find:e7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Bt({key:new Qt("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"),i=r?JSON.parse(r):void 0,a=i==null?void 0:i.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(qe.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),n7=Nn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`);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:i,empty:a}=n;if(!a||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(et.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[ex({find:Z_,type:this.type,getAttributes:t=>({language:t[1]})}),ex({find:e7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Wt({key:new tn("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"),i=r?JSON.parse(r):void 0,a=i==null?void 0:i.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(Ge.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),n7=kn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):""}),r7=Nn.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",kt(this.options.HTMLAttributes,t)]},renderText(){return` +`):""}),r7=kn.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",Et(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:i,storedMarks:a}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=a||i.$to.parentOffset&&i.$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()}}}),s7=Nn.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]}`,kt(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,i="#".repeat(r);return t.content?`${i} ${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=>Zg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),i7=Nn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",kt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!R6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return j2(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.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(qe.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Ke.create(o.doc,u.pos)):o.setSelection(qe.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(qe.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[F2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),a7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,o7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,l7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,c7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,d7=Co.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",kt(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[Ml({find:a7,type:this.type}),Ml({find:l7,type:this.type})]},addPasteRules(){return[vo({find:o7,type:this.type}),vo({find:c7,type:this.type})]}});const u7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",h7="ελ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",nx="numeric",rx="ascii",sx="alpha",Fc="asciinumeric",Ic="alphanumeric",ix="domain",J2="emoji",f7="scheme",p7="slashscheme",rg="whitespace";function m7(t,e){return t in e||(e[t]=[]),e[t]}function ro(t,e,n){e[nx]&&(e[Fc]=!0,e[Ic]=!0),e[rx]&&(e[Fc]=!0,e[sx]=!0),e[Fc]&&(e[Ic]=!0),e[sx]&&(e[Ic]=!0),e[Ic]&&(e[ix]=!0),e[J2]&&(e[ix]=!0);for(const r in e){const i=m7(r,n);i.indexOf(t)<0&&i.push(t)}}function g7(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function jr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}jr.groups={};jr.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,i),cn=(t,e,n,r,i)=>t.tr(e,n,r,i),jw=(t,e,n,r,i)=>t.ts(e,n,r,i),Se=(t,e,n,r,i)=>t.tt(e,n,r,i),hi="WORD",ax="UWORD",Y2="ASCIINUMERICAL",Q2="ALPHANUMERICAL",id="LOCALHOST",ox="TLD",lx="UTLD",Zu="SCHEME",dl="SLASH_SCHEME",M0="NUM",cx="WS",A0="NL",Bc="OPENBRACE",Vc="CLOSEBRACE",Eh="OPENBRACKET",Th="CLOSEBRACKET",Mh="OPENPAREN",Ah="CLOSEPAREN",Ih="OPENANGLEBRACKET",Rh="CLOSEANGLEBRACKET",Ph="FULLWIDTHLEFTPAREN",Oh="FULLWIDTHRIGHTPAREN",Dh="LEFTCORNERBRACKET",Lh="RIGHTCORNERBRACKET",_h="LEFTWHITECORNERBRACKET",zh="RIGHTWHITECORNERBRACKET",$h="FULLWIDTHLESSTHAN",Fh="FULLWIDTHGREATERTHAN",Bh="AMPERSAND",Vh="APOSTROPHE",Hh="ASTERISK",Zi="AT",Wh="BACKSLASH",Uh="BACKTICK",Kh="CARET",na="COLON",I0="COMMA",qh="DOLLAR",Is="DOT",Gh="EQUALS",R0="EXCLAMATION",qr="HYPHEN",Hc="PERCENT",Jh="PIPE",Yh="PLUS",Qh="POUND",Wc="QUERY",P0="QUOTE",X2="FULLWIDTHMIDDLEDOT",O0="SEMI",Rs="SLASH",Uc="TILDE",Xh="UNDERSCORE",Z2="EMOJI",Zh="SYM";var eC=Object.freeze({__proto__:null,ALPHANUMERICAL:Q2,AMPERSAND:Bh,APOSTROPHE:Vh,ASCIINUMERICAL:Y2,ASTERISK:Hh,AT:Zi,BACKSLASH:Wh,BACKTICK:Uh,CARET:Kh,CLOSEANGLEBRACKET:Rh,CLOSEBRACE:Vc,CLOSEBRACKET:Th,CLOSEPAREN:Ah,COLON:na,COMMA:I0,DOLLAR:qh,DOT:Is,EMOJI:Z2,EQUALS:Gh,EXCLAMATION:R0,FULLWIDTHGREATERTHAN:Fh,FULLWIDTHLEFTPAREN:Ph,FULLWIDTHLESSTHAN:$h,FULLWIDTHMIDDLEDOT:X2,FULLWIDTHRIGHTPAREN:Oh,HYPHEN:qr,LEFTCORNERBRACKET:Dh,LEFTWHITECORNERBRACKET:_h,LOCALHOST:id,NL:A0,NUM:M0,OPENANGLEBRACKET:Ih,OPENBRACE:Bc,OPENBRACKET:Eh,OPENPAREN:Mh,PERCENT:Hc,PIPE:Jh,PLUS:Yh,POUND:Qh,QUERY:Wc,QUOTE:P0,RIGHTCORNERBRACKET:Lh,RIGHTWHITECORNERBRACKET:zh,SCHEME:Zu,SEMI:O0,SLASH:Rs,SLASH_SCHEME:dl,SYM:Zh,TILDE:Uc,TLD:ox,UNDERSCORE:Xh,UTLD:lx,UWORD:ax,WORD:hi,WS:cx});const di=/[a-z]/,Cc=new RegExp("\\p{L}","u"),sg=new RegExp("\\p{Emoji}","u"),ui=/\d/,ig=/\s/,kw="\r",ag=` -`,x7="️",y7="‍",og="";let zu=null,$u=null;function v7(t=[]){const e={};jr.groups=e;const n=new jr;zu==null&&(zu=Sw(u7)),$u==null&&($u=Sw(h7)),Se(n,"'",Vh),Se(n,"{",Bc),Se(n,"}",Vc),Se(n,"[",Eh),Se(n,"]",Th),Se(n,"(",Mh),Se(n,")",Ah),Se(n,"<",Ih),Se(n,">",Rh),Se(n,"(",Ph),Se(n,")",Oh),Se(n,"「",Dh),Se(n,"」",Lh),Se(n,"『",_h),Se(n,"』",zh),Se(n,"<",$h),Se(n,">",Fh),Se(n,"&",Bh),Se(n,"*",Hh),Se(n,"@",Zi),Se(n,"`",Uh),Se(n,"^",Kh),Se(n,":",na),Se(n,",",I0),Se(n,"$",qh),Se(n,".",Is),Se(n,"=",Gh),Se(n,"!",R0),Se(n,"-",qr),Se(n,"%",Hc),Se(n,"|",Jh),Se(n,"+",Yh),Se(n,"#",Qh),Se(n,"?",Wc),Se(n,'"',P0),Se(n,"/",Rs),Se(n,";",O0),Se(n,"~",Uc),Se(n,"_",Xh),Se(n,"\\",Wh),Se(n,"・",X2);const r=cn(n,ui,M0,{[nx]:!0});cn(r,ui,r);const i=cn(r,di,Y2,{[Fc]:!0}),a=cn(r,Cc,Q2,{[Ic]:!0}),o=cn(n,di,hi,{[rx]:!0});cn(o,ui,i),cn(o,di,o),cn(i,ui,i),cn(i,di,i);const c=cn(n,Cc,ax,{[sx]:!0});cn(c,di),cn(c,ui,a),cn(c,Cc,c),cn(a,ui,a),cn(a,di),cn(a,Cc,a);const u=Se(n,ag,A0,{[rg]:!0}),h=Se(n,kw,cx,{[rg]:!0}),f=cn(n,ig,cx,{[rg]:!0});Se(n,og,f),Se(h,ag,u),Se(h,og,f),cn(h,ig,f),Se(f,kw),Se(f,ag),cn(f,ig,f),Se(f,og,f);const m=cn(n,sg,Z2,{[J2]:!0});Se(m,"#"),cn(m,sg,m),Se(m,x7,m);const g=Se(m,y7);Se(g,"#"),cn(g,sg,m);const y=[[di,o],[ui,i]],w=[[di,null],[Cc,c],[ui,a]];for(let N=0;NN[0]>b[0]?1:-1);for(let N=0;N=0?C[ix]=!0:di.test(b)?ui.test(b)?C[Fc]=!0:C[rx]=!0:C[nx]=!0,jw(n,b,b,C)}return jw(n,"localhost",id,{ascii:!0}),n.jd=new jr(Zh),{start:n,tokens:Object.assign({groups:e},eC)}}function tC(t,e){const n=b7(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];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,i.push({t:f.t,v:e.slice(a-h,a),s:a-h,e:a})}return i}function b7(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 Gi(t,e,n,r,i){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 ad={defaultProtocol:"http",events:null,format:Cw,formatHref:Cw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function D0(t,e=null){let n=Object.assign({},ad);t&&(n=Object.assign(n,t instanceof D0?t.o:t));const r=n.ignoreTags,i=[];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=ad.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),i=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:i,attributes:o,content:a,eventListeners:m}}};function If(t,e){class n extends nC{constructor(i,a){super(i,a),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Ew=If("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Tw=If("text"),w7=If("nl"),Fu=If("url",{isLink:!0,toHref(t=ad.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==id&&t[1].t===na}}),Kr=t=>new jr(t);function N7({groups:t}){const e=t.domain.concat([Bh,Hh,Zi,Wh,Uh,Kh,qh,Gh,qr,M0,Hc,Jh,Yh,Qh,Rs,Zh,Uc,Xh]),n=[Vh,na,I0,Is,R0,Hc,Wc,P0,O0,Ih,Rh,Bc,Vc,Th,Eh,Mh,Ah,Ph,Oh,Dh,Lh,_h,zh,$h,Fh],r=[Bh,Vh,Hh,Wh,Uh,Kh,qh,Gh,qr,Bc,Vc,Hc,Jh,Yh,Qh,Wc,Rs,Zh,Uc,Xh],i=Kr(),a=Se(i,Uc);lt(a,r,a),lt(a,t.domain,a);const o=Kr(),c=Kr(),u=Kr();lt(i,t.domain,o),lt(i,t.scheme,c),lt(i,t.slashscheme,u),lt(o,r,a),lt(o,t.domain,o);const h=Se(o,Zi);Se(a,Zi,h),Se(c,Zi,h),Se(u,Zi,h);const f=Se(a,Is);lt(f,r,a),lt(f,t.domain,a);const m=Kr();lt(h,t.domain,m),lt(m,t.domain,m);const g=Se(m,Is);lt(g,t.domain,m);const y=Kr(Ew);lt(g,t.tld,y),lt(g,t.utld,y),Se(h,id,y);const w=Se(m,qr);Se(w,qr,w),lt(w,t.domain,m),lt(y,t.domain,m),Se(y,Is,g),Se(y,qr,w);const N=Se(y,na);lt(N,t.numeric,Ew);const b=Se(o,qr),k=Se(o,Is);Se(b,qr,b),lt(b,t.domain,o),lt(k,r,a),lt(k,t.domain,o);const C=Kr(Fu);lt(k,t.tld,C),lt(k,t.utld,C),lt(C,t.domain,o),lt(C,r,a),Se(C,Is,k),Se(C,qr,b),Se(C,Zi,h);const E=Se(C,na),T=Kr(Fu);lt(E,t.numeric,T);const I=Kr(Fu),O=Kr();lt(I,e,I),lt(I,n,O),lt(O,e,I),lt(O,n,O),Se(C,Rs,I),Se(T,Rs,I);const D=Se(c,na),P=Se(u,na),L=Se(P,Rs),_=Se(L,Rs);lt(c,t.domain,o),Se(c,Is,k),Se(c,qr,b),lt(u,t.domain,o),Se(u,Is,k),Se(u,qr,b),lt(D,t.domain,I),Se(D,Rs,I),Se(D,Wc,I),lt(_,t.domain,I),lt(_,e,I),Se(_,Rs,I);const J=[[Bc,Vc],[Eh,Th],[Mh,Ah],[Ih,Rh],[Ph,Oh],[Dh,Lh],[_h,zh],[$h,Fh]];for(let ee=0;ee=0&&g++,i++,f++;if(g<0)i-=f,i0&&(a.push(lg(Tw,e,o)),o=[]),i-=g,f-=g;const y=m.t,w=n.slice(i-f,i);a.push(lg(y,e,w))}}return o.length>0&&a.push(lg(Tw,e,o)),a}function lg(t,e,n){const r=n[0].s,i=n[n.length-1].e,a=e.slice(r,i);return new t(a,n)}const k7=typeof console<"u"&&console&&console.warn||(()=>{}),S7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ut={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function C7(){return jr.groups={},Ut.scanner=null,Ut.parser=null,Ut.tokenQueue=[],Ut.pluginQueue=[],Ut.customSchemes=[],Ut.initialized=!1,Ut}function Mw(t,e=!1){if(Ut.initialized&&k7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${S7}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:a}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=a||i.$to.parentOffset&&i.$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()}}}),s7=kn.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]}`,Et(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,i="#".repeat(r);return t.content?`${i} ${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=>ex({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),i7=kn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Et(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!R6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return k2(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.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(Ge.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(qe.create(o.doc,u.pos)):o.setSelection(Ge.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(Ge.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[B2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),a7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,o7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,l7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,c7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,d7=Eo.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",Et(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[El({find:a7,type:this.type}),El({find:l7,type:this.type})]},addPasteRules(){return[bo({find:o7,type:this.type}),bo({find:c7,type:this.type})]}});const u7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",h7="ελ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",rx="numeric",sx="ascii",ix="alpha",Bc="asciinumeric",Rc="alphanumeric",ax="domain",Y2="emoji",f7="scheme",p7="slashscheme",sg="whitespace";function m7(t,e){return t in e||(e[t]=[]),e[t]}function so(t,e,n){e[rx]&&(e[Bc]=!0,e[Rc]=!0),e[sx]&&(e[Bc]=!0,e[ix]=!0),e[Bc]&&(e[Rc]=!0),e[ix]&&(e[Rc]=!0),e[Rc]&&(e[ax]=!0),e[Y2]&&(e[ax]=!0);for(const r in e){const i=m7(r,n);i.indexOf(t)<0&&i.push(t)}}function g7(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function kr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}kr.groups={};kr.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,i),dn=(t,e,n,r,i)=>t.tr(e,n,r,i),kw=(t,e,n,r,i)=>t.ts(e,n,r,i),Se=(t,e,n,r,i)=>t.tt(e,n,r,i),di="WORD",ox="UWORD",Q2="ASCIINUMERICAL",X2="ALPHANUMERICAL",ad="LOCALHOST",lx="TLD",cx="UTLD",eh="SCHEME",ll="SLASH_SCHEME",A0="NUM",dx="WS",I0="NL",Vc="OPENBRACE",Hc="CLOSEBRACE",Th="OPENBRACKET",Mh="CLOSEBRACKET",Ah="OPENPAREN",Ih="CLOSEPAREN",Rh="OPENANGLEBRACKET",Ph="CLOSEANGLEBRACKET",Oh="FULLWIDTHLEFTPAREN",Dh="FULLWIDTHRIGHTPAREN",Lh="LEFTCORNERBRACKET",_h="RIGHTCORNERBRACKET",zh="LEFTWHITECORNERBRACKET",$h="RIGHTWHITECORNERBRACKET",Fh="FULLWIDTHLESSTHAN",Bh="FULLWIDTHGREATERTHAN",Vh="AMPERSAND",Hh="APOSTROPHE",Wh="ASTERISK",ea="AT",Uh="BACKSLASH",Kh="BACKTICK",qh="CARET",ra="COLON",R0="COMMA",Gh="DOLLAR",As="DOT",Jh="EQUALS",P0="EXCLAMATION",Jr="HYPHEN",Wc="PERCENT",Yh="PIPE",Qh="PLUS",Xh="POUND",Uc="QUERY",O0="QUOTE",Z2="FULLWIDTHMIDDLEDOT",D0="SEMI",Is="SLASH",Kc="TILDE",Zh="UNDERSCORE",eC="EMOJI",ef="SYM";var tC=Object.freeze({__proto__:null,ALPHANUMERICAL:X2,AMPERSAND:Vh,APOSTROPHE:Hh,ASCIINUMERICAL:Q2,ASTERISK:Wh,AT:ea,BACKSLASH:Uh,BACKTICK:Kh,CARET:qh,CLOSEANGLEBRACKET:Ph,CLOSEBRACE:Hc,CLOSEBRACKET:Mh,CLOSEPAREN:Ih,COLON:ra,COMMA:R0,DOLLAR:Gh,DOT:As,EMOJI:eC,EQUALS:Jh,EXCLAMATION:P0,FULLWIDTHGREATERTHAN:Bh,FULLWIDTHLEFTPAREN:Oh,FULLWIDTHLESSTHAN:Fh,FULLWIDTHMIDDLEDOT:Z2,FULLWIDTHRIGHTPAREN:Dh,HYPHEN:Jr,LEFTCORNERBRACKET:Lh,LEFTWHITECORNERBRACKET:zh,LOCALHOST:ad,NL:I0,NUM:A0,OPENANGLEBRACKET:Rh,OPENBRACE:Vc,OPENBRACKET:Th,OPENPAREN:Ah,PERCENT:Wc,PIPE:Yh,PLUS:Qh,POUND:Xh,QUERY:Uc,QUOTE:O0,RIGHTCORNERBRACKET:_h,RIGHTWHITECORNERBRACKET:$h,SCHEME:eh,SEMI:D0,SLASH:Is,SLASH_SCHEME:ll,SYM:ef,TILDE:Kc,TLD:lx,UNDERSCORE:Zh,UTLD:cx,UWORD:ox,WORD:di,WS:dx});const li=/[a-z]/,Ec=new RegExp("\\p{L}","u"),ig=new RegExp("\\p{Emoji}","u"),ci=/\d/,ag=/\s/,Sw="\r",og=` +`,x7="️",y7="‍",lg="";let $u=null,Fu=null;function v7(t=[]){const e={};kr.groups=e;const n=new kr;$u==null&&($u=Cw(u7)),Fu==null&&(Fu=Cw(h7)),Se(n,"'",Hh),Se(n,"{",Vc),Se(n,"}",Hc),Se(n,"[",Th),Se(n,"]",Mh),Se(n,"(",Ah),Se(n,")",Ih),Se(n,"<",Rh),Se(n,">",Ph),Se(n,"(",Oh),Se(n,")",Dh),Se(n,"「",Lh),Se(n,"」",_h),Se(n,"『",zh),Se(n,"』",$h),Se(n,"<",Fh),Se(n,">",Bh),Se(n,"&",Vh),Se(n,"*",Wh),Se(n,"@",ea),Se(n,"`",Kh),Se(n,"^",qh),Se(n,":",ra),Se(n,",",R0),Se(n,"$",Gh),Se(n,".",As),Se(n,"=",Jh),Se(n,"!",P0),Se(n,"-",Jr),Se(n,"%",Wc),Se(n,"|",Yh),Se(n,"+",Qh),Se(n,"#",Xh),Se(n,"?",Uc),Se(n,'"',O0),Se(n,"/",Is),Se(n,";",D0),Se(n,"~",Kc),Se(n,"_",Zh),Se(n,"\\",Uh),Se(n,"・",Z2);const r=dn(n,ci,A0,{[rx]:!0});dn(r,ci,r);const i=dn(r,li,Q2,{[Bc]:!0}),a=dn(r,Ec,X2,{[Rc]:!0}),o=dn(n,li,di,{[sx]:!0});dn(o,ci,i),dn(o,li,o),dn(i,ci,i),dn(i,li,i);const c=dn(n,Ec,ox,{[ix]:!0});dn(c,li),dn(c,ci,a),dn(c,Ec,c),dn(a,ci,a),dn(a,li),dn(a,Ec,a);const u=Se(n,og,I0,{[sg]:!0}),h=Se(n,Sw,dx,{[sg]:!0}),f=dn(n,ag,dx,{[sg]:!0});Se(n,lg,f),Se(h,og,u),Se(h,lg,f),dn(h,ag,f),Se(f,Sw),Se(f,og),dn(f,ag,f),Se(f,lg,f);const m=dn(n,ig,eC,{[Y2]:!0});Se(m,"#"),dn(m,ig,m),Se(m,x7,m);const g=Se(m,y7);Se(g,"#"),dn(g,ig,m);const y=[[li,o],[ci,i]],w=[[li,null],[Ec,c],[ci,a]];for(let N=0;N<$u.length;N++)Ji(n,$u[N],lx,di,y);for(let N=0;NN[0]>b[0]?1:-1);for(let N=0;N=0?C[ax]=!0:li.test(b)?ci.test(b)?C[Bc]=!0:C[sx]=!0:C[rx]=!0,kw(n,b,b,C)}return kw(n,"localhost",ad,{ascii:!0}),n.jd=new kr(ef),{start:n,tokens:Object.assign({groups:e},tC)}}function nC(t,e){const n=b7(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];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,i.push({t:f.t,v:e.slice(a-h,a),s:a-h,e:a})}return i}function b7(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 Ji(t,e,n,r,i){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 od={defaultProtocol:"http",events:null,format:Ew,formatHref:Ew,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function L0(t,e=null){let n=Object.assign({},od);t&&(n=Object.assign(n,t instanceof L0?t.o:t));const r=n.ignoreTags,i=[];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=od.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),i=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:i,attributes:o,content:a,eventListeners:m}}};function Rf(t,e){class n extends rC{constructor(i,a){super(i,a),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Tw=Rf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Mw=Rf("text"),w7=Rf("nl"),Bu=Rf("url",{isLink:!0,toHref(t=od.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ad&&t[1].t===ra}}),Gr=t=>new kr(t);function N7({groups:t}){const e=t.domain.concat([Vh,Wh,ea,Uh,Kh,qh,Gh,Jh,Jr,A0,Wc,Yh,Qh,Xh,Is,ef,Kc,Zh]),n=[Hh,ra,R0,As,P0,Wc,Uc,O0,D0,Rh,Ph,Vc,Hc,Mh,Th,Ah,Ih,Oh,Dh,Lh,_h,zh,$h,Fh,Bh],r=[Vh,Hh,Wh,Uh,Kh,qh,Gh,Jh,Jr,Vc,Hc,Wc,Yh,Qh,Xh,Uc,Is,ef,Kc,Zh],i=Gr(),a=Se(i,Kc);dt(a,r,a),dt(a,t.domain,a);const o=Gr(),c=Gr(),u=Gr();dt(i,t.domain,o),dt(i,t.scheme,c),dt(i,t.slashscheme,u),dt(o,r,a),dt(o,t.domain,o);const h=Se(o,ea);Se(a,ea,h),Se(c,ea,h),Se(u,ea,h);const f=Se(a,As);dt(f,r,a),dt(f,t.domain,a);const m=Gr();dt(h,t.domain,m),dt(m,t.domain,m);const g=Se(m,As);dt(g,t.domain,m);const y=Gr(Tw);dt(g,t.tld,y),dt(g,t.utld,y),Se(h,ad,y);const w=Se(m,Jr);Se(w,Jr,w),dt(w,t.domain,m),dt(y,t.domain,m),Se(y,As,g),Se(y,Jr,w);const N=Se(y,ra);dt(N,t.numeric,Tw);const b=Se(o,Jr),k=Se(o,As);Se(b,Jr,b),dt(b,t.domain,o),dt(k,r,a),dt(k,t.domain,o);const C=Gr(Bu);dt(k,t.tld,C),dt(k,t.utld,C),dt(C,t.domain,o),dt(C,r,a),Se(C,As,k),Se(C,Jr,b),Se(C,ea,h);const E=Se(C,ra),T=Gr(Bu);dt(E,t.numeric,T);const I=Gr(Bu),O=Gr();dt(I,e,I),dt(I,n,O),dt(O,e,I),dt(O,n,O),Se(C,Is,I),Se(T,Is,I);const D=Se(c,ra),P=Se(u,ra),L=Se(P,Is),_=Se(L,Is);dt(c,t.domain,o),Se(c,As,k),Se(c,Jr,b),dt(u,t.domain,o),Se(u,As,k),Se(u,Jr,b),dt(D,t.domain,I),Se(D,Is,I),Se(D,Uc,I),dt(_,t.domain,I),dt(_,e,I),Se(_,Is,I);const J=[[Vc,Hc],[Th,Mh],[Ah,Ih],[Rh,Ph],[Oh,Dh],[Lh,_h],[zh,$h],[Fh,Bh]];for(let ee=0;ee=0&&g++,i++,f++;if(g<0)i-=f,i0&&(a.push(cg(Mw,e,o)),o=[]),i-=g,f-=g;const y=m.t,w=n.slice(i-f,i);a.push(cg(y,e,w))}}return o.length>0&&a.push(cg(Mw,e,o)),a}function cg(t,e,n){const r=n[0].s,i=n[n.length-1].e,a=e.slice(r,i);return new t(a,n)}const k7=typeof console<"u"&&console&&console.warn||(()=>{}),S7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Jt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function C7(){return kr.groups={},Jt.scanner=null,Jt.parser=null,Jt.tokenQueue=[],Jt.pluginQueue=[],Jt.customSchemes=[],Jt.initialized=!1,Jt}function Aw(t,e=!1){if(Jt.initialized&&k7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${S7}`),!/^[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`);Ut.customSchemes.push([t,e])}function E7(){Ut.scanner=v7(Ut.customSchemes);for(let t=0;t{const i=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),a=e.some(h=>h.getMeta("preventAutolink"));if(!i||a)return;const{tr:o}=r,c=p2(n.doc,[...e]);if(N2(c).forEach(({newRange:h})=>{const f=I8(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(!M7.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(T7).filter(Boolean);if(y.length<=0)return!1;const w=y[y.length-1],N=m.pos+g.lastIndexOf(w);if(!w)return!1;const b=L0(w).map(k=>k.toObject(t.defaultProtocol));if(!I7(b))return!1;b.filter(k=>k.isLink).map(k=>({...k,from:N+k.start+1,to:N+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=>{j0(k.from,k.to,r.doc).some(C=>C.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function P7(t){return new Bt({key:new Qt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,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=w2(e.state,t.type.name),h=(i=o.href)!=null?i:u.href,f=(a=o.target)!=null?a:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function O7(t){return new Bt({key:new Qt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=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=rC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||i!==void 0&&!i(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function Ya(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(A7,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var D7=Co.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"){Mw(t);return}Mw(t.scheme,t.optionalSlashes)})},onDestroy(){C7()},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)=>!!Ya(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 i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},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=>!!Ya(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=>!!Ya(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",kt(this.options.HTMLAttributes,t),0]:["a",kt(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,i,a;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(a=(i=t.attrs)==null?void 0:i.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=>!!Ya(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=>!!Ya(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[vo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=rC(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!Ya(o,n),protocols:n,defaultProtocol:r}));i.length&&i.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(R7({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Ya(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(P7({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(O7({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),L7=Object.defineProperty,_7=(t,e)=>{for(var n in e)L7(t,n,{get:e[n],enumerable:!0})},z7="listItem",Aw="textStyle",Iw=/^\s*([-+*])\s$/,sC=Nn.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",kt(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(z7,this.editor.getAttributes(Aw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Al({find:Iw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Al({find:Iw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Aw),editor:this.editor})),[t]}}),iC=Nn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",kt(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(i=>i.type==="paragraph"))n=e.parseChildren(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(i.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)=>E0(t,e,r=>{var i,a;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((a=(i=r.meta)==null?void 0:i.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)}}}),$7={};_7($7,{findListItemPos:()=>xd,getNextListDepth:()=>z0,handleBackspace:()=>dx,handleDelete:()=>ux,hasListBefore:()=>aC,hasListItemAfter:()=>F7,hasListItemBefore:()=>oC,listItemHasSubList:()=>lC,nextListIsDeeper:()=>cC,nextListIsHigher:()=>dC});var xd=(t,e)=>{const{$from:n}=e.selection,r=wn(t,e.schema);let i=null,a=n.depth,o=n.pos,c=null;for(;a>0&&c===null;)i=n.node(a),i.type===r?c=a:(a-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},z0=(t,e)=>{const n=xd(t,e);if(!n)return!1;const[,r]=B8(e,t,n.$pos.pos+4);return r},aC=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),a=t.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},oC=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},lC=(t,e,n)=>{if(!n)return!1;const r=wn(t,e.schema);let i=!1;return n.descendants(a=>{a.type===r&&(i=!0)}),i},dx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ya(t.state,e)&&aC(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(!ya(t.state,e)||!U8(t.state))return!1;const r=xd(e,t.state);if(!r)return!1;const a=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=lC(e,t.state,a);return oC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},cC=(t,e)=>{const n=z0(t,e),r=xd(t,e);return!r||!n?!1:n>r.depth},dC=(t,e)=>{const n=z0(t,e),r=xd(t,e);return!r||!n?!1:n{if(!ya(t.state,e)||!W8(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:cC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():dC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},F7=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},uC=pn.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&&ux(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&&ux(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&&dx(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&&dx(t,n,r)&&(e=!0)}),e}}}}),Rw=/^(\s*)(\d+)\.\s+(.*)$/,B7=/^\s/;function V7(t){const e=[];let n=0,r=0;for(;n{const i=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),a=e.some(h=>h.getMeta("preventAutolink"));if(!i||a)return;const{tr:o}=r,c=m2(n.doc,[...e]);if(j2(c).forEach(({newRange:h})=>{const f=I8(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(!M7.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(T7).filter(Boolean);if(y.length<=0)return!1;const w=y[y.length-1],N=m.pos+g.lastIndexOf(w);if(!w)return!1;const b=_0(w).map(k=>k.toObject(t.defaultProtocol));if(!I7(b))return!1;b.filter(k=>k.isLink).map(k=>({...k,from:N+k.start+1,to:N+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=>{k0(k.from,k.to,r.doc).some(C=>C.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function P7(t){return new Wt({key:new tn("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,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=N2(e.state,t.type.name),h=(i=o.href)!=null?i:u.href,f=(a=o.target)!=null?a:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function O7(t){return new Wt({key:new tn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=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=sC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||i!==void 0&&!i(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function Qa(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(A7,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var D7=Eo.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"){Aw(t);return}Aw(t.scheme,t.optionalSlashes)})},onDestroy(){C7()},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)=>!!Qa(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 i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},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=>!!Qa(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=>!!Qa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Et(this.options.HTMLAttributes,t),0]:["a",Et(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,i,a;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(a=(i=t.attrs)==null?void 0:i.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=>!!Qa(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=>!!Qa(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[bo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=sC(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!Qa(o,n),protocols:n,defaultProtocol:r}));i.length&&i.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(R7({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Qa(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(P7({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(O7({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),L7=Object.defineProperty,_7=(t,e)=>{for(var n in e)L7(t,n,{get:e[n],enumerable:!0})},z7="listItem",Iw="textStyle",Rw=/^\s*([-+*])\s$/,iC=kn.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",Et(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(z7,this.editor.getAttributes(Iw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Tl({find:Rw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Tl({find:Rw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Iw),editor:this.editor})),[t]}}),aC=kn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Et(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(i=>i.type==="paragraph"))n=e.parseChildren(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(i.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)=>T0(t,e,r=>{var i,a;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((a=(i=r.meta)==null?void 0:i.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)}}}),$7={};_7($7,{findListItemPos:()=>yd,getNextListDepth:()=>$0,handleBackspace:()=>ux,handleDelete:()=>hx,hasListBefore:()=>oC,hasListItemAfter:()=>F7,hasListItemBefore:()=>lC,listItemHasSubList:()=>cC,nextListIsDeeper:()=>dC,nextListIsHigher:()=>uC});var yd=(t,e)=>{const{$from:n}=e.selection,r=jn(t,e.schema);let i=null,a=n.depth,o=n.pos,c=null;for(;a>0&&c===null;)i=n.node(a),i.type===r?c=a:(a-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},$0=(t,e)=>{const n=yd(t,e);if(!n)return!1;const[,r]=B8(e,t,n.$pos.pos+4);return r},oC=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),a=t.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},lC=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},cC=(t,e,n)=>{if(!n)return!1;const r=jn(t,e.schema);let i=!1;return n.descendants(a=>{a.type===r&&(i=!0)}),i},ux=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!va(t.state,e)&&oC(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(!va(t.state,e)||!U8(t.state))return!1;const r=yd(e,t.state);if(!r)return!1;const a=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=cC(e,t.state,a);return lC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},dC=(t,e)=>{const n=$0(t,e),r=yd(t,e);return!r||!n?!1:n>r.depth},uC=(t,e)=>{const n=$0(t,e),r=yd(t,e);return!r||!n?!1:n{if(!va(t.state,e)||!W8(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:dC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():uC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},F7=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},hC=mn.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&&hx(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&&hx(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&&ux(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&&ux(t,n,r)&&(e=!0)}),e}}}}),Pw=/^(\s*)(\d+)\.\s+(.*)$/,B7=/^\s/;function V7(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(N=>N.indent)),w=hC(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:w,raw:g.map(N=>N.raw).join(` -`)})}i.push({type:"list_item",raw:o.raw,tokens:h}),a=m}else a+=1}return i}function H7(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(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const a=e.parseChildren([i]);r.push({type:"paragraph",content:a})}else{const a=e.parseChildren([i]);a.length>0&&r.push(...a)}}),{type:"listItem",content:r}})}var W7="listItem",Pw="textStyle",Ow=/^(\d+)\.\s$/,fC=Nn.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",kt(this.options.HTMLAttributes,n),0]:["ol",kt(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?H7(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,` +`).trim();if(f){const y=n.blockTokens(f);h.push(...y)}let m=a+1;const g=[];for(;me;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(N=>N.indent)),w=fC(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:w,raw:g.map(N=>N.raw).join(` +`)})}i.push({type:"list_item",raw:o.raw,tokens:h}),a=m}else a+=1}return i}function H7(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(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const a=e.parseChildren([i]);r.push({type:"paragraph",content:a})}else{const a=e.parseChildren([i]);a.length>0&&r.push(...a)}}),{type:"listItem",content:r}})}var W7="listItem",Ow="textStyle",Dw=/^(\d+)\.\s$/,pC=kn.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",Et(this.options.HTMLAttributes,n),0]:["ol",Et(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?H7(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 i=t.split(` -`),[a,o]=V7(i);if(a.length===0)return;const c=hC(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:i.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(W7,this.editor.getAttributes(Pw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Al({find:Ow,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=Al({find:Ow,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Pw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),U7=/^\s*(\[([( |x])?\])\s$/,K7=Nn.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",kt(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 i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return E0(t,e,i)},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 i=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 w=n();if(typeof w!="number")return!1;const N=y.doc.nodeAt(w);return y.setNodeMarkup(w,void 0,{...N==null?void 0:N.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])=>{i.setAttribute(m,g)}),i.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,a.append(c,o),i.append(a,u),Object.entries(e).forEach(([m,g])=>{i.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:i,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;i.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=sd(m,g),w=new Set(Object.keys(y)),N=this.options.HTMLAttributes;return f.forEach(b=>{w.has(b)||(b in N?i.setAttribute(b,N[b]):i.removeAttribute(b))}),Object.entries(y).forEach(([b,k])=>{k==null?b in N?i.setAttribute(b,N[b]):i.removeAttribute(b):i.setAttribute(b,k)}),f=w,!0}}}},addInputRules(){return[Al({find:U7,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),q7=Nn.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",kt(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=ex(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)},i=ex(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(i)return{type:"taskList",raw:i.raw,items:i.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()}}});pn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(sC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(iC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(uC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(fC.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(K7.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(q7.configure(this.options.taskList)),t}});var Dw=" ",G7=" ",J7=Nn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",kt(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===Dw||r[0].text===G7)?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?Dw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Y7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Q7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,X7=Co.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",kt(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[Ml({find:Y7,type:this.type})]},addPasteRules(){return[vo({find:Q7,type:this.type})]}}),Z7=Nn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),ez=Co.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",kt(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 i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const a=i[2].trim();return{type:"underline",raw:i[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 tz(t={}){return new Bt({view(e){return new nz(e,t)}})}class nz{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(i=>{let a=o=>{this[i](o)};return e.dom.addEventListener(i,a),{name:i,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,i=this.editorView.dom,a=i.getBoundingClientRect(),o=a.width/i.offsetWidth,c=a.height/i.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 w=y.getBoundingClientRect(),N=m?w.bottom:w.top;m&&g&&(N=(N+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*c;r={left:w.left,right:w.right,top:N-b,bottom:N+b}}}}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),i=r&&r.type.spec.disableDropCursor,a=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!a){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=aS(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 un extends Ze{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return un.valid(r)?new un(r):Ze.near(r)}content(){return Ie.empty}eq(e){return e instanceof un&&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 un(e.resolve(n.pos))}getBookmark(){return new $0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!rz(e)||!sz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&un.valid(e))return e;let i=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;i+=n;let u=e.doc.resolve(i);if(un.valid(u))return u}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Ke.isSelectable(a)){e=e.doc.resolve(i+a.nodeSize*n),r=!1;continue e}break}a=o,i+=n;let c=e.doc.resolve(i);if(un.valid(c))return c}return null}}}un.prototype.visible=!1;un.findFrom=un.findGapCursorFrom;Ze.jsonID("gapcursor",un);class $0{constructor(e){this.pos=e}map(e){return new $0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return un.valid(n)?new un(n):Ze.near(n)}}function pC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function rz(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 i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||pC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function sz(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 i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||pC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function iz(){return new Bt({props:{decorations:cz,createSelectionBetween(t,e,n){return e.pos==n.pos&&un.valid(n)?new un(n):null},handleClick:oz,handleKeyDown:az,handleDOMEvents:{beforeinput:lz}}})}const az=x0({ArrowLeft:Bu("horiz",-1),ArrowRight:Bu("horiz",1),ArrowUp:Bu("vert",-1),ArrowDown:Bu("vert",1)});function Bu(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,a){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof qe){if(!a.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=un.findGapCursorFrom(c,e,u);return h?(i&&i(r.tr.setSelection(new un(h))),!0):!1}}function oz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!un.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Ke.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new un(r))),!0)}function lz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof un))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 i=ge.empty;for(let o=r.length-1;o>=0;o--)i=ge.from(r[o].createAndFill(null,i));let a=t.state.tr.replace(n.pos,n.pos,new Ie(i,0,0));return a.setSelection(qe.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function cz(t){if(!(t.selection instanceof un))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",It.create(t.doc,[En.widget(t.selection.head,e,{key:"gapcursor"})])}var ef=200,Dn=function(){};Dn.prototype.append=function(e){return e.length?(e=Dn.from(e),!this.length&&e||e.length=n?Dn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Dn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Dn.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)};Dn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(a,o){return i.push(e(a,o))},n,r),i};Dn.from=function(e){return e instanceof Dn?e:e&&e.length?new mC(e):Dn.empty};var mC=(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(i,a){return i==0&&a==this.length?this:new e(this.values.slice(i,a))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,a,o,c){for(var u=a;u=o;u--)if(i(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=ef)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=ef)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Dn);Dn.empty=new mC([]);var dz=(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(i-c,0),Math.min(this.length,a)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,a,o){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(a,c)-c,o+c)===!1||a=a?this.right.slice(r-a,i-a):this.left.slice(r,a).append(this.right.slice(0,i-a))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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})(Dn);const uz=500;class ps{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 i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),a=i.maps.length),a--,f.push(m);return}if(i){f.push(new Ji(m.map));let y=m.step.map(i.slice(a)),w;y&&o.maybeStep(y).doc&&(w=o.mapping.maps[o.mapping.maps.length-1],h.push(new Ji(w,void 0,void 0,h.length+f.length))),a--,w&&i.appendMap(w,a)}else o.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(a)):m.selection,u=new ps(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,i){let a=[],o=this.eventCount,c=this.items,u=!i&&c.length?c.get(c.length-1):null;for(let f=0;ffz&&(c=hz(c,h),o-=h),new ps(c.append(a),o)}remapping(e,n){let r=new Xc;return this.items.forEach((i,a)=>{let o=i.mirrorOffset!=null&&a-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new ps(this.items.append(e.map(n=>new Ji(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let u=n;this.items.forEach(g=>{let y=a.getMirror(--u);if(y==null)return;o=Math.min(o,y);let w=a.maps[y];if(g.step){let N=e.steps[y].invert(e.docs[y]),b=g.selection&&g.selection.map(a.slice(u+1,y));b&&c++,r.push(new Ji(w,N,b))}else r.push(new Ji(w))},i);let h=[];for(let g=n;guz&&(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,i=[],a=0;return this.items.forEach((o,c)=>{if(c>=e)i.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 Ji(h.invert(),u,f),g,y=i.length-1;(g=i.length&&i[y].merge(m))?i[y]=g:i.push(m)}}else o.map&&r--},this.items.length,0),new ps(Dn.from(i.reverse()),a)}}ps.empty=new ps(Dn.empty,0);function hz(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}let Ji=class gC{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new gC(n.getMap().invert(),n,this.selection)}}};class ea{constructor(e,n,r,i,a){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=a}}const fz=20;function pz(t,e,n,r){let i=n.getMeta(co),a;if(i)return i.historyState;n.getMeta(xz)&&(t=new ea(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(co))return o.getMeta(co).redo?new ea(t.done.addTransform(n,void 0,r,eh(e)),t.undone,Lw(n.mapping.maps),t.prevTime,t.prevComposition):new ea(t.done,t.undone.addTransform(n,void 0,r,eh(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||!mz(n,t.prevRanges)),h=o?cg(t.prevRanges,n.mapping):Lw(n.mapping.maps);return new ea(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,eh(e)),ps.empty,h,n.time,c??t.prevComposition)}else return(a=n.getMeta("rebased"))?new ea(t.done.rebased(n,a),t.undone.rebased(n,a),cg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ea(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),cg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function mz(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let a=0;a=e[a]&&(n=!0)}),n}function Lw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,a,o)=>e.push(a,o));return e}function cg(t,e){if(!t)return null;let n=[];for(let r=0;r{let i=co.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let a=gz(i,n,t);a&&r(e?a.scrollIntoView():a)}return!0}}const yC=xC(!1,!0),vC=xC(!0,!0);pn.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 Bt({key:new Qt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>i){const o=a-i,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} 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 i=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=r||i>r&&a>r&&a<=i)return!0;if(i>r&&a>r&&a>i||!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 vz=pn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[tz(this.options)]}});pn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Bt({key:new Qt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,a=[];if(!n||!r)return It.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(i>=h&&i<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(i>=h&&i<=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(En.node(h,h+u.nodeSize,{class:this.options.className}))}),It.create(t,a)}}})]}});var bz=pn.create({name:"gapCursor",addProseMirrorPlugins(){return[iz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=jt(We(t,"allowGapCursor",n)))!=null?e:null}}}),zw="placeholder";function wz(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Nz=pn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:zw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${wz(this.options.dataAttribute)}`:`data-${zw}`;return[new Bt({key:new Qt("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=i>=u&&i<=u+c.nodeSize,f=!c.isLeaf&&Tf(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=En.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}),It.create(e,a)}}})]}});pn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Bt({key:new Qt("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||j2(n.selection)||t.view.dragging?null:It.create(n.doc,[En.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function $w({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var jz=pn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Qt(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(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Bt({key:e,appendTransaction:(i,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:(i,a)=>{const o=a.tr.doc.lastChild;return!$w({node:o,types:r})},apply:(i,a)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return a;const o=i.doc.lastChild;return!$w({node:o,types:r})}}})]}}),kz=pn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>yC(t,e),redo:()=>({state:t,dispatch:e})=>vC(t,e)}},addProseMirrorPlugins(){return[yz(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()}}}),Sz=pn.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(J_.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(W_.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(sC.configure(this.options.bulletList)),this.options.code!==!1&&i.push(X_.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(t7.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(n7.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(vz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(bz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(r7.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(s7.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(kz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(i7.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(d7.configure(this.options.italic)),this.options.listItem!==!1&&i.push(iC.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(uC.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(D7.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(fC.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(J7.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(X7.configure(this.options.strike)),this.options.text!==!1&&i.push(Z7.configure(this.options.text)),this.options.underline!==!1&&i.push(ez.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(jz.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Cz=Sz,Ez=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Tz=Nn.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",kt(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,i,a,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(i=(r=t.attrs)==null?void 0:r.alt)!=null?i:"",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:i,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 I6({element:u,editor:c,node:i,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===i.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[F2({find:Ez,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),Mz=Tz;function Az(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:c}=t,u=r&&!i,h=P6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=i?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),w=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!w)return null;const N=c.pos-w.length,b=Array.from(w.matchAll(y)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const k=b.input.slice(Math.max(0,b.index-1),b.index),C=new RegExp(`^[${a==null?void 0:a.join("")}\0]?$`).test(k);if(a!==null&&!C)return null;const E=N+b.index;let T=E+b[0].length;return u&&f.test(w.slice(T-1,T+1))&&(b[0]+=" ",T+=1),E=c.pos?{range:{from:E,to:T},query:b[0].slice(n.length),text:b[0]}:null}var Iz=new Qt("suggestion");function Rz({pluginKey:t=Iz,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!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:w=()=>!0,findSuggestionMatch:N=Az,shouldShow:b}){let k;const C=y==null?void 0:y(),E=()=>{const D=e.state.selection.$anchor.pos,P=e.view.coordsAtPos(D),{top:L,right:_,bottom:J,left:ee}=P;try{return new DOMRect(ee,L,_-ee,J-L)}catch{return null}},T=(D,P)=>P?()=>{const L=t.getState(e.state),_=L==null?void 0:L.decorationId,J=D.dom.querySelector(`[data-decoration-id="${_}"]`);return(J==null?void 0:J.getBoundingClientRect())||null}:E;function I(D,P){var L;try{const J=t.getState(D.state),ee=J!=null&&J.decorationId?D.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`):null,Y={editor:e,range:(J==null?void 0:J.range)||{from:0,to:0},query:(J==null?void 0:J.query)||null,text:(J==null?void 0:J.text)||null,items:[],command:U=>m({editor:e,range:(J==null?void 0:J.range)||{from:0,to:0},props:U}),decorationNode:ee,clientRect:T(D,ee)};(L=C==null?void 0:C.onExit)==null||L.call(C,Y)}catch{}const _=D.state.tr.setMeta(P,{exit:!0});D.dispatch(_)}const O=new Bt({key:t,view(){return{update:async(D,P)=>{var L,_,J,ee,Y,U,R;const F=(L=this.key)==null?void 0:L.getState(P),re=(_=this.key)==null?void 0:_.getState(D.state),z=F.active&&re.active&&F.range.from!==re.range.from,ie=!F.active&&re.active,G=F.active&&!re.active,$=!ie&&!G&&F.query!==re.query,H=ie||z&&$,ce=$||z,W=G||z&&$;if(!H&&!ce&&!W)return;const fe=W&&!H?F:re,X=D.dom.querySelector(`[data-decoration-id="${fe.decorationId}"]`);k={editor:e,range:fe.range,query:fe.query,text:fe.text,items:[],command:de=>m({editor:e,range:fe.range,props:de}),decorationNode:X,clientRect:T(D,X)},H&&((J=C==null?void 0:C.onBeforeStart)==null||J.call(C,k)),ce&&((ee=C==null?void 0:C.onBeforeUpdate)==null||ee.call(C,k)),(ce||H)&&(k.items=await g({editor:e,query:fe.query})),W&&((Y=C==null?void 0:C.onExit)==null||Y.call(C,k)),ce&&((U=C==null?void 0:C.onUpdate)==null||U.call(C,k)),H&&((R=C==null?void 0:C.onStart)==null||R.call(C,k))},destroy:()=>{var D;k&&((D=C==null?void 0:C.onExit)==null||D.call(C,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(D,P,L,_){const{isEditable:J}=e,{composing:ee}=e.view,{selection:Y}=D,{empty:U,from:R}=Y,F={...P},re=D.getMeta(t);if(re&&re.exit)return F.active=!1,F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null,F;if(F.composing=ee,J&&(U||e.view.composing)){(RP.range.to)&&!ee&&!P.composing&&(F.active=!1);const z=N({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:Y.$from}),ie=`id_${Math.floor(Math.random()*4294967295)}`;z&&w({editor:e,state:_,range:z.range,isActive:P.active})&&(!b||b({editor:e,range:z.range,query:z.query,text:z.text,transaction:D}))?(F.active=!0,F.decorationId=P.decorationId?P.decorationId:ie,F.range=z.range,F.query=z.query,F.text=z.text):F.active=!1}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(D,P){var L,_,J,ee;const{active:Y,range:U}=O.getState(D.state);if(!Y)return!1;if(P.key==="Escape"||P.key==="Esc"){const F=O.getState(D.state),re=(L=k==null?void 0:k.decorationNode)!=null?L:null,z=re??(F!=null&&F.decorationId?D.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`):null);if(((_=C==null?void 0:C.onKeyDown)==null?void 0:_.call(C,{view:D,event:P,range:F.range}))||!1)return!0;const G={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:$=>m({editor:e,range:F.range,props:$}),decorationNode:z,clientRect:z?()=>z.getBoundingClientRect()||null:null};return(J=C==null?void 0:C.onExit)==null||J.call(C,G),I(D,t),!0}return((ee=C==null?void 0:C.onKeyDown)==null?void 0:ee.call(C,{view:D,event:P,range:U}))||!1},decorations(D){const{active:P,range:L,decorationId:_,query:J}=O.getState(D);if(!P)return null;const ee=!(J!=null&&J.length),Y=[u];return ee&&Y.push(f),It.create(D.doc,[En.inline(L.from,L.to,{nodeName:c,class:Y.join(" "),"data-decoration-id":_,"data-decoration-content":h})])}}});return O}function Pz({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const i=new Qt;return{editor:t,char:r,pluginKey:i,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 bC(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Pz({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Fw(t,e){const n=bC(t),r=n.find(i=>i.char===e);return r||(n.length?n[0]:null)}var Oz=Nn.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,i;return["span",kt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(i=e.attrs.label)!=null?i: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=Fw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",kt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=kt({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof i=="string"?["span",kt({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...B2({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[,i,a,o]=r,c=a??o;e[i==="char"?"mentionSuggestionChar":i]=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:Fw(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:i,anchor:a}=r;if(!i)return!1;let o=new xi,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 bC(this).map(Rz)}}),Dz=Oz,Lz=Nz;let hx,fx;if(typeof WeakMap<"u"){let t=new WeakMap;hx=e=>t.get(e),fx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;hx=r=>{for(let i=0;i(n==10&&(n=0),t[n++]=r,t[n++]=i)}var fn=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-E});break}const T=i+E*e;for(let I=0;Ir&&(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 $z(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Bz(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 ws(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 Rf(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=bo(e.$head)||Vz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Vz(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 px(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Hz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function F0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function wC(t,e,n){const r=t.node(-1),i=fn.get(r),a=t.start(-1),o=i.nextCell(t.pos-a,e,n);return o==null?null:t.node(0).resolve(a+o)}function wo(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(i=>i>0)||(r.colwidth=null)),r}function NC(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;if!=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 uS(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)),i=e.resolve(n.map(this.$headCell.pos));if(px(r)&&px(i)&&F0(r,i)){const a=this.$anchorCell.node(-1)!=r.node(-1);return a&&this.isRowSelection()?fi.rowSelection(r,i):a&&this.isColSelection()?fi.colSelection(r,i):new fi(r,i)}return qe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=fn.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),a={},o=[];for(let u=i.top;u0||b>0){let k=w.attrs;if(N>0&&(k=wo(k,0,N)),b>0&&(k=wo(k,k.colspan-b,b)),y.lefti.bottom){const k={...w.attrs,rowspan:Math.min(y.bottom,i.bottom)-Math.max(y.top,i.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=fn.get(r),a=e.start(-1),o=i.findCell(e.pos-a),c=i.findCell(n.pos-a),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(a+i.map[o.left])),c.bottom0&&(n=u.resolve(a+i.map[c.left])),o.bottom0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,c=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof fi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=fn.get(r),a=e.start(-1),o=i.findCell(e.pos-a),c=i.findCell(n.pos-a),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(a+i.map[o.top*i.width])),c.right0&&(n=u.resolve(a+i.map[c.top*i.width])),o.right{e.push(En.node(r,r+n.nodeSize,{class:"selectedCell"}))}),It.create(t.doc,e)}function qz({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(i+1)=0&&!(e.before(a+1)>e.start(a));a--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function Gz({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const a=t.node(i);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}for(let i=e.depth;i>0;i--){const a=e.node(i);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){r=a;break}}return n!==r&&e.parentOffset===0}function Jz(t,e,n){const r=(e||t).selection,i=(e||t).doc;let a,o;if(r instanceof Ke&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")a=Ft.create(i,r.from);else if(o=="row"){const c=i.resolve(r.from+1);a=Ft.rowSelection(c,c)}else if(!n){const c=fn.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];a=Ft.create(i,u+1,h)}}else r instanceof qe&&qz(r)?a=qe.create(i,r.from):r instanceof qe&&Gz(r)&&(a=qe.create(i,r.$from.start(),r.$from.end()));return a&&(e||(e=t.tr)).setSelection(a),e}const Yz=new Qt("fix-tables");function kC(t,e,n,r){const i=t.childCount,a=e.childCount;e:for(let o=0,c=0;o{i.type.spec.tableRole=="table"&&(n=Qz(t,i,a,n))};return e?e.doc!=t.doc&&kC(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Qz(t,e,n,r){const i=fn.get(e);if(!i.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 w=[];for(let b=0;b0?-1:0;Wz(e,r,i+a)&&(a=i==0||i==e.width?null:0);for(let o=0;o0&&i0&&e.map[c-1]==u||i0?-1:0;n$(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let h=0,f=e.width*i;h0&&i0&&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(i0&&n[a]==n[a-1]||r.right0&&n[i]==n[i-t]||r.bottom0){const f=u+1+h.content.size,m=Bw(h)?u+1:f;a.replaceWith(m+r.tableStart,f+r.tableStart,c)}a.setSelection(new Ft(a.doc.resolve(u+r.tableStart))),e(a)}return!0}function Hw(t,e){const n=sr(t.schema);return l$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function l$(t){return(e,n)=>{const r=e.selection;let i,a;if(r instanceof Ft){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{var o;if(i=Bz(r.$from),!i)return!1;a=(o=bo(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Bs(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&a.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(a)}return!0}}function d$(t){return function(e,n){if(!ws(e))return!1;if(n){const r=sr(e.schema),i=Bs(e),a=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),c=o.map(u=>i.table.nodeAt(u));for(let u=0;u{const y=g+a.tableStart,w=o.doc.nodeAt(y);w&&o.setNodeMarkup(y,m,w.attrs)}),r(o)}return!0}}od("row",{useDeprecatedLogic:!0});od("column",{useDeprecatedLogic:!0});const u$=od("cell",{useDeprecatedLogic:!0});function h$(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const a=t.node(-1).child(r),o=a.lastChild;if(o)return i-1-o.nodeSize;i-=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 Vu(t,e){const n=t.selection;if(!(n instanceof Ft))return!1;if(e){const r=t.tr,i=sr(t.schema).cell.createAndFill().content;n.forEachCell((a,o)=>{a.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+a.nodeSize-1),new Ie(i,0,0))}),r.docChanged&&e(r)}return!0}function p$(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 i=e.child(0),a=i.type.spec.tableRole,o=i.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=i;h=e.length&&e.push(ge.empty),n[i]r&&(g=g.type.createChecked(wo(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;yi&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),u.push(m)}a.push(ge.from(u))}n=a,e=i}return{width:t,height:e,rows:n}}function x$(t,e,n,r,i,a,o){const c=t.doc.type.schema,u=sr(c);let h,f;if(i>e.width)for(let m=0,g=0;me.height){const m=[];for(let w=0,N=(e.height-1)*e.width;w=e.width?!1:n.nodeAt(e.map[N+w]).type==u.header_cell;m.push(b?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,ge.from(m)),y=[];for(let w=e.height;w{if(!i)return!1;const a=n.selection;if(a instanceof Ft)return th(n,r,Ze.near(a.$headCell,e));if(t!="horiz"&&!a.empty)return!1;const o=TC(i,t,e);if(o==null)return!1;if(t=="horiz")return th(n,r,Ze.near(n.doc.resolve(a.head+e),e));{const c=n.doc.resolve(o),u=wC(c,t,e);let h;return u?h=Ze.near(u,1):e<0?h=Ze.near(n.doc.resolve(c.before(-1)),-1):h=Ze.near(n.doc.resolve(c.after(-1)),1),th(n,r,h)}}}function Wu(t,e){return(n,r,i)=>{if(!i)return!1;const a=n.selection;let o;if(a instanceof Ft)o=a;else{const u=TC(i,t,e);if(u==null)return!1;o=new Ft(n.doc.resolve(u))}const c=wC(o.$headCell,t,e);return c?th(n,r,new Ft(o.$anchorCell,c)):!1}}function v$(t,e){const n=t.state.doc,r=bo(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ft(r))),!0):!1}function b$(t,e,n){if(!ws(t.state))return!1;let r=p$(n);const i=t.state.selection;if(i instanceof Ft){r||(r={width:1,height:1,rows:[ge.from(mx(sr(t.state.schema).cell,n))]});const a=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),c=fn.get(a).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=g$(r,c.right-c.left,c.bottom-c.top),Gw(t.state,t.dispatch,o,c,r),!0}else if(r){const a=Rf(t.state),o=a.start(-1);return Gw(t.state,t.dispatch,o,fn.get(a.node(-1)).findCell(a.pos-o),r),!0}else return!1}function w$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Jw(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Ft)a(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=bo(t.state.selection.$anchor))!=null&&((n=ug(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)a(i,e),e.preventDefault();else if(!r)return;function a(u,h){let f=ug(t,h);const m=ra.getState(t.state)==null;if(!f||!F0(u,f))if(m)f=u;else return;const g=new Ft(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(ra,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),ra.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ra,-1))}function c(u){const h=u,f=ra.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Jw(t,h.target)!=r&&(m=ug(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 TC(t,e,n){if(!(t.state.selection instanceof qe))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){const o=r.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Jw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ug(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&bo(t.state.doc.resolve(r))||bo(t.state.doc.resolve(i))}var N$=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")),gx(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,gx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function gx(t,e,n,r,i,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 k$(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=Or.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{S$(o,c,t,i)},mouseleave:o=>{C$(o)},mousedown:(o,c)=>{E$(o,c,e,n)}},decorations:o=>{const c=Or.getState(o);if(c&&c.activeHandle>-1)return R$(o,c.activeHandle)},nodeViews:{}}});return a}var k$=class nh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Or);if(r&&r.setHandle!=null)return new nh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new nh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return px(e.doc.resolve(i))||(i=-1),new nh(i,n.dragging)}return n}};function S$(t,e,n,r){if(!t.editable)return;const i=Or.getState(t.state);if(i&&!i.dragging){const a=M$(e.target);let o=-1;if(a){const{left:c,right:u}=a.getBoundingClientRect();e.clientX-c<=n?o=Yw(t,e,"left",n):u-e.clientX<=n&&(o=Yw(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=fn.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}MC(t,o)}}}function C$(t){if(!t.editable)return;const e=Or.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&MC(t,-1)}function E$(t,e,n,r){var i;if(!t.editable)return!1;const a=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=Or.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=T$(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Or,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){a.removeEventListener("mouseup",h),a.removeEventListener("mousemove",f);const g=Or.getState(t.state);g!=null&&g.dragging&&(A$(t,g.activeHandle,Qw(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Or,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=Or.getState(t.state);if(g&&g.dragging){const y=Qw(g.dragging,m,n);Xw(t,g.activeHandle,y,r)}}return Xw(t,o.activeHandle,u,r),a.addEventListener("mouseup",h),a.addEventListener("mousemove",f),e.preventDefault(),!0}function T$(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;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"),i=r?r.split(",").map(a=>parseInt(a,10)):null;if(!i){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 i}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",kt(this.options.HTMLAttributes,t),0]}}),IC=Nn.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",kt(this.options.HTMLAttributes,t),0]}}),RC=Nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",kt(this.options.HTMLAttributes,t),0]}});function xx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Zw(t,e,n,r,i,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 _$(t,e,n,r,i){const a=L$(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!z$(e))return!1;let n=0;const r=m2(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},$$="";function F$(t){return(t||"").replace(/\s+/g," ").trim()}function B$(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:$$;if(!t||!t.content||t.content.length===0)return"";const a=[];t.content.forEach(w=>{const N=[];w.content&&w.content.forEach(b=>{let k="";b.content&&Array.isArray(b.content)&&b.content.length>1?k=b.content.map(I=>e.renderChildren(I)).join(i):k=b.content?e.renderChildren(b.content):"";const C=F$(k),E=b.type==="tableHeader";N.push({text:C,isHeader:E})}),a.push(N)});const o=a.reduce((w,N)=>Math.max(w,N.length),0);if(o===0)return"";const c=new Array(o).fill(0);a.forEach(w=>{var N;for(let b=0;bc[b]&&(c[b]=C),c[b]<3&&(c[b]=3)}});const u=(w,N)=>w+" ".repeat(Math.max(0,N-w.length)),h=a[0],f=h.some(w=>w.isHeader);let m=` +`),[a,o]=V7(i);if(a.length===0)return;const c=fC(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:i.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(W7,this.editor.getAttributes(Ow)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Tl({find:Dw,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=Tl({find:Dw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ow)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),U7=/^\s*(\[([( |x])?\])\s$/,K7=kn.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",Et(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 i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return T0(t,e,i)},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 i=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 w=n();if(typeof w!="number")return!1;const N=y.doc.nodeAt(w);return y.setNodeMarkup(w,void 0,{...N==null?void 0:N.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])=>{i.setAttribute(m,g)}),i.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,a.append(c,o),i.append(a,u),Object.entries(e).forEach(([m,g])=>{i.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:i,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;i.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=id(m,g),w=new Set(Object.keys(y)),N=this.options.HTMLAttributes;return f.forEach(b=>{w.has(b)||(b in N?i.setAttribute(b,N[b]):i.removeAttribute(b))}),Object.entries(y).forEach(([b,k])=>{k==null?b in N?i.setAttribute(b,N[b]):i.removeAttribute(b):i.setAttribute(b,k)}),f=w,!0}}}},addInputRules(){return[Tl({find:U7,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),q7=kn.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",Et(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=tx(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)},i=tx(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(i)return{type:"taskList",raw:i.raw,items:i.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()}}});mn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(iC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(aC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(hC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(pC.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(K7.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(q7.configure(this.options.taskList)),t}});var Lw=" ",G7=" ",J7=kn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Et(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===Lw||r[0].text===G7)?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?Lw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Y7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Q7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,X7=Eo.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",Et(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[El({find:Y7,type:this.type})]},addPasteRules(){return[bo({find:Q7,type:this.type})]}}),Z7=kn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),ez=Eo.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",Et(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 i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const a=i[2].trim();return{type:"underline",raw:i[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 tz(t={}){return new Wt({view(e){return new nz(e,t)}})}class nz{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(i=>{let a=o=>{this[i](o)};return e.dom.addEventListener(i,a),{name:i,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,i=this.editorView.dom,a=i.getBoundingClientRect(),o=a.width/i.offsetWidth,c=a.height/i.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 w=y.getBoundingClientRect(),N=m?w.bottom:w.top;m&&g&&(N=(N+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*c;r={left:w.left,right:w.right,top:N-b,bottom:N+b}}}}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),i=r&&r.type.spec.disableDropCursor,a=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!a){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=oS(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 hn extends et{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return hn.valid(r)?new hn(r):et.near(r)}content(){return Ie.empty}eq(e){return e instanceof hn&&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 hn(e.resolve(n.pos))}getBookmark(){return new F0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!rz(e)||!sz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&hn.valid(e))return e;let i=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;i+=n;let u=e.doc.resolve(i);if(hn.valid(u))return u}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!qe.isSelectable(a)){e=e.doc.resolve(i+a.nodeSize*n),r=!1;continue e}break}a=o,i+=n;let c=e.doc.resolve(i);if(hn.valid(c))return c}return null}}}hn.prototype.visible=!1;hn.findFrom=hn.findGapCursorFrom;et.jsonID("gapcursor",hn);class F0{constructor(e){this.pos=e}map(e){return new F0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return hn.valid(n)?new hn(n):et.near(n)}}function mC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function rz(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 i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||mC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function sz(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 i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||mC(i.type))return!0;if(i.inlineContent)return!1}}return!0}function iz(){return new Wt({props:{decorations:cz,createSelectionBetween(t,e,n){return e.pos==n.pos&&hn.valid(n)?new hn(n):null},handleClick:oz,handleKeyDown:az,handleDOMEvents:{beforeinput:lz}}})}const az=y0({ArrowLeft:Vu("horiz",-1),ArrowRight:Vu("horiz",1),ArrowUp:Vu("vert",-1),ArrowDown:Vu("vert",1)});function Vu(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,a){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof Ge){if(!a.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=hn.findGapCursorFrom(c,e,u);return h?(i&&i(r.tr.setSelection(new hn(h))),!0):!1}}function oz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!hn.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&qe.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new hn(r))),!0)}function lz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof hn))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 i=ge.empty;for(let o=r.length-1;o>=0;o--)i=ge.from(r[o].createAndFill(null,i));let a=t.state.tr.replace(n.pos,n.pos,new Ie(i,0,0));return a.setSelection(Ge.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function cz(t){if(!(t.selection instanceof hn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pt.create(t.doc,[Mn.widget(t.selection.head,e,{key:"gapcursor"})])}var tf=200,_n=function(){};_n.prototype.append=function(e){return e.length?(e=_n.from(e),!this.length&&e||e.length=n?_n.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};_n.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};_n.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)};_n.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(a,o){return i.push(e(a,o))},n,r),i};_n.from=function(e){return e instanceof _n?e:e&&e.length?new gC(e):_n.empty};var gC=(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(i,a){return i==0&&a==this.length?this:new e(this.values.slice(i,a))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,a,o,c){for(var u=a;u=o;u--)if(i(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=tf)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=tf)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(_n);_n.empty=new gC([]);var dz=(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(i-c,0),Math.min(this.length,a)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,a,o){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(a,c)-c,o+c)===!1||a=a?this.right.slice(r-a,i-a):this.left.slice(r,a).append(this.right.slice(0,i-a))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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})(_n);const uz=500;class gs{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 i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),a=i.maps.length),a--,f.push(m);return}if(i){f.push(new Yi(m.map));let y=m.step.map(i.slice(a)),w;y&&o.maybeStep(y).doc&&(w=o.mapping.maps[o.mapping.maps.length-1],h.push(new Yi(w,void 0,void 0,h.length+f.length))),a--,w&&i.appendMap(w,a)}else o.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(a)):m.selection,u=new gs(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,i){let a=[],o=this.eventCount,c=this.items,u=!i&&c.length?c.get(c.length-1):null;for(let f=0;ffz&&(c=hz(c,h),o-=h),new gs(c.append(a),o)}remapping(e,n){let r=new Zc;return this.items.forEach((i,a)=>{let o=i.mirrorOffset!=null&&a-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new gs(this.items.append(e.map(n=>new Yi(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let u=n;this.items.forEach(g=>{let y=a.getMirror(--u);if(y==null)return;o=Math.min(o,y);let w=a.maps[y];if(g.step){let N=e.steps[y].invert(e.docs[y]),b=g.selection&&g.selection.map(a.slice(u+1,y));b&&c++,r.push(new Yi(w,N,b))}else r.push(new Yi(w))},i);let h=[];for(let g=n;guz&&(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,i=[],a=0;return this.items.forEach((o,c)=>{if(c>=e)i.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 Yi(h.invert(),u,f),g,y=i.length-1;(g=i.length&&i[y].merge(m))?i[y]=g:i.push(m)}}else o.map&&r--},this.items.length,0),new gs(_n.from(i.reverse()),a)}}gs.empty=new gs(_n.empty,0);function hz(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}let Yi=class xC{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new xC(n.getMap().invert(),n,this.selection)}}};class ta{constructor(e,n,r,i,a){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=a}}const fz=20;function pz(t,e,n,r){let i=n.getMeta(uo),a;if(i)return i.historyState;n.getMeta(xz)&&(t=new ta(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(uo))return o.getMeta(uo).redo?new ta(t.done.addTransform(n,void 0,r,th(e)),t.undone,_w(n.mapping.maps),t.prevTime,t.prevComposition):new ta(t.done,t.undone.addTransform(n,void 0,r,th(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||!mz(n,t.prevRanges)),h=o?dg(t.prevRanges,n.mapping):_w(n.mapping.maps);return new ta(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,th(e)),gs.empty,h,n.time,c??t.prevComposition)}else return(a=n.getMeta("rebased"))?new ta(t.done.rebased(n,a),t.undone.rebased(n,a),dg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),dg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function mz(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let a=0;a=e[a]&&(n=!0)}),n}function _w(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,a,o)=>e.push(a,o));return e}function dg(t,e){if(!t)return null;let n=[];for(let r=0;r{let i=uo.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let a=gz(i,n,t);a&&r(e?a.scrollIntoView():a)}return!0}}const vC=yC(!1,!0),bC=yC(!0,!0);mn.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 Wt({key:new tn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>i){const o=a-i,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} 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 i=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=r||i>r&&a>r&&a<=i)return!0;if(i>r&&a>r&&a>i||!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 vz=mn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[tz(this.options)]}});mn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Wt({key:new tn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,a=[];if(!n||!r)return Pt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(i>=h&&i<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(i>=h&&i<=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(Mn.node(h,h+u.nodeSize,{class:this.options.className}))}),Pt.create(t,a)}}})]}});var bz=mn.create({name:"gapCursor",addProseMirrorPlugins(){return[iz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ct(We(t,"allowGapCursor",n)))!=null?e:null}}}),$w="placeholder";function wz(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Nz=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:$w,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${wz(this.options.dataAttribute)}`:`data-${$w}`;return[new Wt({key:new tn("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=i>=u&&i<=u+c.nodeSize,f=!c.isLeaf&&Mf(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=Mn.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}),Pt.create(e,a)}}})]}});mn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Wt({key:new tn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||k2(n.selection)||t.view.dragging?null:Pt.create(n.doc,[Mn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Fw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var jz=mn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new tn(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(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Wt({key:e,appendTransaction:(i,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:(i,a)=>{const o=a.tr.doc.lastChild;return!Fw({node:o,types:r})},apply:(i,a)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return a;const o=i.doc.lastChild;return!Fw({node:o,types:r})}}})]}}),kz=mn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>vC(t,e),redo:()=>({state:t,dispatch:e})=>bC(t,e)}},addProseMirrorPlugins(){return[yz(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()}}}),Sz=mn.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(J_.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(W_.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(iC.configure(this.options.bulletList)),this.options.code!==!1&&i.push(X_.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(t7.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(n7.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(vz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(bz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(r7.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(s7.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(kz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(i7.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(d7.configure(this.options.italic)),this.options.listItem!==!1&&i.push(aC.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(hC.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(D7.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(pC.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(J7.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(X7.configure(this.options.strike)),this.options.text!==!1&&i.push(Z7.configure(this.options.text)),this.options.underline!==!1&&i.push(ez.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(jz.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Cz=Sz,Ez=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Tz=kn.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",Et(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,i,a,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(i=(r=t.attrs)==null?void 0:r.alt)!=null?i:"",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:i,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 I6({element:u,editor:c,node:i,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===i.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[B2({find:Ez,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),Mz=Tz;function Az(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:c}=t,u=r&&!i,h=P6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=i?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),w=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!w)return null;const N=c.pos-w.length,b=Array.from(w.matchAll(y)).pop();if(!b||b.input===void 0||b.index===void 0)return null;const k=b.input.slice(Math.max(0,b.index-1),b.index),C=new RegExp(`^[${a==null?void 0:a.join("")}\0]?$`).test(k);if(a!==null&&!C)return null;const E=N+b.index;let T=E+b[0].length;return u&&f.test(w.slice(T-1,T+1))&&(b[0]+=" ",T+=1),E=c.pos?{range:{from:E,to:T},query:b[0].slice(n.length),text:b[0]}:null}var Iz=new tn("suggestion");function Rz({pluginKey:t=Iz,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!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:w=()=>!0,findSuggestionMatch:N=Az,shouldShow:b}){let k;const C=y==null?void 0:y(),E=()=>{const D=e.state.selection.$anchor.pos,P=e.view.coordsAtPos(D),{top:L,right:_,bottom:J,left:ee}=P;try{return new DOMRect(ee,L,_-ee,J-L)}catch{return null}},T=(D,P)=>P?()=>{const L=t.getState(e.state),_=L==null?void 0:L.decorationId,J=D.dom.querySelector(`[data-decoration-id="${_}"]`);return(J==null?void 0:J.getBoundingClientRect())||null}:E;function I(D,P){var L;try{const J=t.getState(D.state),ee=J!=null&&J.decorationId?D.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`):null,Y={editor:e,range:(J==null?void 0:J.range)||{from:0,to:0},query:(J==null?void 0:J.query)||null,text:(J==null?void 0:J.text)||null,items:[],command:U=>m({editor:e,range:(J==null?void 0:J.range)||{from:0,to:0},props:U}),decorationNode:ee,clientRect:T(D,ee)};(L=C==null?void 0:C.onExit)==null||L.call(C,Y)}catch{}const _=D.state.tr.setMeta(P,{exit:!0});D.dispatch(_)}const O=new Wt({key:t,view(){return{update:async(D,P)=>{var L,_,J,ee,Y,U,R;const F=(L=this.key)==null?void 0:L.getState(P),re=(_=this.key)==null?void 0:_.getState(D.state),z=F.active&&re.active&&F.range.from!==re.range.from,ie=!F.active&&re.active,G=F.active&&!re.active,$=!ie&&!G&&F.query!==re.query,V=ie||z&&$,ce=$||z,W=G||z&&$;if(!V&&!ce&&!W)return;const fe=W&&!V?F:re,X=D.dom.querySelector(`[data-decoration-id="${fe.decorationId}"]`);k={editor:e,range:fe.range,query:fe.query,text:fe.text,items:[],command:de=>m({editor:e,range:fe.range,props:de}),decorationNode:X,clientRect:T(D,X)},V&&((J=C==null?void 0:C.onBeforeStart)==null||J.call(C,k)),ce&&((ee=C==null?void 0:C.onBeforeUpdate)==null||ee.call(C,k)),(ce||V)&&(k.items=await g({editor:e,query:fe.query})),W&&((Y=C==null?void 0:C.onExit)==null||Y.call(C,k)),ce&&((U=C==null?void 0:C.onUpdate)==null||U.call(C,k)),V&&((R=C==null?void 0:C.onStart)==null||R.call(C,k))},destroy:()=>{var D;k&&((D=C==null?void 0:C.onExit)==null||D.call(C,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(D,P,L,_){const{isEditable:J}=e,{composing:ee}=e.view,{selection:Y}=D,{empty:U,from:R}=Y,F={...P},re=D.getMeta(t);if(re&&re.exit)return F.active=!1,F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null,F;if(F.composing=ee,J&&(U||e.view.composing)){(RP.range.to)&&!ee&&!P.composing&&(F.active=!1);const z=N({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:Y.$from}),ie=`id_${Math.floor(Math.random()*4294967295)}`;z&&w({editor:e,state:_,range:z.range,isActive:P.active})&&(!b||b({editor:e,range:z.range,query:z.query,text:z.text,transaction:D}))?(F.active=!0,F.decorationId=P.decorationId?P.decorationId:ie,F.range=z.range,F.query=z.query,F.text=z.text):F.active=!1}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(D,P){var L,_,J,ee;const{active:Y,range:U}=O.getState(D.state);if(!Y)return!1;if(P.key==="Escape"||P.key==="Esc"){const F=O.getState(D.state),re=(L=k==null?void 0:k.decorationNode)!=null?L:null,z=re??(F!=null&&F.decorationId?D.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`):null);if(((_=C==null?void 0:C.onKeyDown)==null?void 0:_.call(C,{view:D,event:P,range:F.range}))||!1)return!0;const G={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:$=>m({editor:e,range:F.range,props:$}),decorationNode:z,clientRect:z?()=>z.getBoundingClientRect()||null:null};return(J=C==null?void 0:C.onExit)==null||J.call(C,G),I(D,t),!0}return((ee=C==null?void 0:C.onKeyDown)==null?void 0:ee.call(C,{view:D,event:P,range:U}))||!1},decorations(D){const{active:P,range:L,decorationId:_,query:J}=O.getState(D);if(!P)return null;const ee=!(J!=null&&J.length),Y=[u];return ee&&Y.push(f),Pt.create(D.doc,[Mn.inline(L.from,L.to,{nodeName:c,class:Y.join(" "),"data-decoration-id":_,"data-decoration-content":h})])}}});return O}function Pz({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const i=new tn;return{editor:t,char:r,pluginKey:i,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 wC(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Pz({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Bw(t,e){const n=wC(t),r=n.find(i=>i.char===e);return r||(n.length?n[0]:null)}var Oz=kn.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,i;return["span",Et(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(i=e.attrs.label)!=null?i: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=Bw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Et({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Et({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof i=="string"?["span",Et({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...V2({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[,i,a,o]=r,c=a??o;e[i==="char"?"mentionSuggestionChar":i]=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:Bw(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:i,anchor:a}=r;if(!i)return!1;let o=new mi,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 wC(this).map(Rz)}}),Dz=Oz,Lz=Nz;let fx,px;if(typeof WeakMap<"u"){let t=new WeakMap;fx=e=>t.get(e),px=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;fx=r=>{for(let i=0;i(n==10&&(n=0),t[n++]=r,t[n++]=i)}var pn=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-E});break}const T=i+E*e;for(let I=0;Ir&&(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 $z(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Bz(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 js(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 Pf(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=wo(e.$head)||Vz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Vz(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 mx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Hz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function B0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function NC(t,e,n){const r=t.node(-1),i=pn.get(r),a=t.start(-1),o=i.nextCell(t.pos-a,e,n);return o==null?null:t.node(0).resolve(a+o)}function No(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(i=>i>0)||(r.colwidth=null)),r}function jC(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;if!=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 hS(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)),i=e.resolve(n.map(this.$headCell.pos));if(mx(r)&&mx(i)&&B0(r,i)){const a=this.$anchorCell.node(-1)!=r.node(-1);return a&&this.isRowSelection()?ui.rowSelection(r,i):a&&this.isColSelection()?ui.colSelection(r,i):new ui(r,i)}return Ge.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=pn.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),a={},o=[];for(let u=i.top;u0||b>0){let k=w.attrs;if(N>0&&(k=No(k,0,N)),b>0&&(k=No(k,k.colspan-b,b)),y.lefti.bottom){const k={...w.attrs,rowspan:Math.min(y.bottom,i.bottom)-Math.max(y.top,i.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=pn.get(r),a=e.start(-1),o=i.findCell(e.pos-a),c=i.findCell(n.pos-a),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(a+i.map[o.left])),c.bottom0&&(n=u.resolve(a+i.map[c.left])),o.bottom0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,c=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof ui&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=pn.get(r),a=e.start(-1),o=i.findCell(e.pos-a),c=i.findCell(n.pos-a),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(a+i.map[o.top*i.width])),c.right0&&(n=u.resolve(a+i.map[c.top*i.width])),o.right{e.push(Mn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Pt.create(t.doc,e)}function qz({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(i+1)=0&&!(e.before(a+1)>e.start(a));a--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function Gz({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const a=t.node(i);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}for(let i=e.depth;i>0;i--){const a=e.node(i);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){r=a;break}}return n!==r&&e.parentOffset===0}function Jz(t,e,n){const r=(e||t).selection,i=(e||t).doc;let a,o;if(r instanceof qe&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")a=Ht.create(i,r.from);else if(o=="row"){const c=i.resolve(r.from+1);a=Ht.rowSelection(c,c)}else if(!n){const c=pn.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];a=Ht.create(i,u+1,h)}}else r instanceof Ge&&qz(r)?a=Ge.create(i,r.from):r instanceof Ge&&Gz(r)&&(a=Ge.create(i,r.$from.start(),r.$from.end()));return a&&(e||(e=t.tr)).setSelection(a),e}const Yz=new tn("fix-tables");function SC(t,e,n,r){const i=t.childCount,a=e.childCount;e:for(let o=0,c=0;o{i.type.spec.tableRole=="table"&&(n=Qz(t,i,a,n))};return e?e.doc!=t.doc&&SC(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Qz(t,e,n,r){const i=pn.get(e);if(!i.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 w=[];for(let b=0;b0?-1:0;Wz(e,r,i+a)&&(a=i==0||i==e.width?null:0);for(let o=0;o0&&i0&&e.map[c-1]==u||i0?-1:0;n$(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let h=0,f=e.width*i;h0&&i0&&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(i0&&n[a]==n[a-1]||r.right0&&n[i]==n[i-t]||r.bottom0){const f=u+1+h.content.size,m=Vw(h)?u+1:f;a.replaceWith(m+r.tableStart,f+r.tableStart,c)}a.setSelection(new Ht(a.doc.resolve(u+r.tableStart))),e(a)}return!0}function Ww(t,e){const n=ar(t.schema);return l$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function l$(t){return(e,n)=>{const r=e.selection;let i,a;if(r instanceof Ht){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{var o;if(i=Bz(r.$from),!i)return!1;a=(o=wo(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Fs(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&a.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(a)}return!0}}function d$(t){return function(e,n){if(!js(e))return!1;if(n){const r=ar(e.schema),i=Fs(e),a=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),c=o.map(u=>i.table.nodeAt(u));for(let u=0;u{const y=g+a.tableStart,w=o.doc.nodeAt(y);w&&o.setNodeMarkup(y,m,w.attrs)}),r(o)}return!0}}ld("row",{useDeprecatedLogic:!0});ld("column",{useDeprecatedLogic:!0});const u$=ld("cell",{useDeprecatedLogic:!0});function h$(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const a=t.node(-1).child(r),o=a.lastChild;if(o)return i-1-o.nodeSize;i-=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 Hu(t,e){const n=t.selection;if(!(n instanceof Ht))return!1;if(e){const r=t.tr,i=ar(t.schema).cell.createAndFill().content;n.forEachCell((a,o)=>{a.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+a.nodeSize-1),new Ie(i,0,0))}),r.docChanged&&e(r)}return!0}function p$(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 i=e.child(0),a=i.type.spec.tableRole,o=i.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=i;h=e.length&&e.push(ge.empty),n[i]r&&(g=g.type.createChecked(No(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;yi&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),u.push(m)}a.push(ge.from(u))}n=a,e=i}return{width:t,height:e,rows:n}}function x$(t,e,n,r,i,a,o){const c=t.doc.type.schema,u=ar(c);let h,f;if(i>e.width)for(let m=0,g=0;me.height){const m=[];for(let w=0,N=(e.height-1)*e.width;w=e.width?!1:n.nodeAt(e.map[N+w]).type==u.header_cell;m.push(b?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,ge.from(m)),y=[];for(let w=e.height;w{if(!i)return!1;const a=n.selection;if(a instanceof Ht)return nh(n,r,et.near(a.$headCell,e));if(t!="horiz"&&!a.empty)return!1;const o=MC(i,t,e);if(o==null)return!1;if(t=="horiz")return nh(n,r,et.near(n.doc.resolve(a.head+e),e));{const c=n.doc.resolve(o),u=NC(c,t,e);let h;return u?h=et.near(u,1):e<0?h=et.near(n.doc.resolve(c.before(-1)),-1):h=et.near(n.doc.resolve(c.after(-1)),1),nh(n,r,h)}}}function Uu(t,e){return(n,r,i)=>{if(!i)return!1;const a=n.selection;let o;if(a instanceof Ht)o=a;else{const u=MC(i,t,e);if(u==null)return!1;o=new Ht(n.doc.resolve(u))}const c=NC(o.$headCell,t,e);return c?nh(n,r,new Ht(o.$anchorCell,c)):!1}}function v$(t,e){const n=t.state.doc,r=wo(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ht(r))),!0):!1}function b$(t,e,n){if(!js(t.state))return!1;let r=p$(n);const i=t.state.selection;if(i instanceof Ht){r||(r={width:1,height:1,rows:[ge.from(gx(ar(t.state.schema).cell,n))]});const a=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),c=pn.get(a).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=g$(r,c.right-c.left,c.bottom-c.top),Jw(t.state,t.dispatch,o,c,r),!0}else if(r){const a=Pf(t.state),o=a.start(-1);return Jw(t.state,t.dispatch,o,pn.get(a.node(-1)).findCell(a.pos-o),r),!0}else return!1}function w$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Yw(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Ht)a(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=wo(t.state.selection.$anchor))!=null&&((n=hg(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)a(i,e),e.preventDefault();else if(!r)return;function a(u,h){let f=hg(t,h);const m=sa.getState(t.state)==null;if(!f||!B0(u,f))if(m)f=u;else return;const g=new Ht(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(sa,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),sa.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(sa,-1))}function c(u){const h=u,f=sa.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Yw(t,h.target)!=r&&(m=hg(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 MC(t,e,n){if(!(t.state.selection instanceof Ge))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){const o=r.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Yw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function hg(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&wo(t.state.doc.resolve(r))||wo(t.state.doc.resolve(i))}var N$=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")),xx(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,xx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function xx(t,e,n,r,i,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 k$(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=Dr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{S$(o,c,t,i)},mouseleave:o=>{C$(o)},mousedown:(o,c)=>{E$(o,c,e,n)}},decorations:o=>{const c=Dr.getState(o);if(c&&c.activeHandle>-1)return R$(o,c.activeHandle)},nodeViews:{}}});return a}var k$=class rh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Dr);if(r&&r.setHandle!=null)return new rh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new rh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return mx(e.doc.resolve(i))||(i=-1),new rh(i,n.dragging)}return n}};function S$(t,e,n,r){if(!t.editable)return;const i=Dr.getState(t.state);if(i&&!i.dragging){const a=M$(e.target);let o=-1;if(a){const{left:c,right:u}=a.getBoundingClientRect();e.clientX-c<=n?o=Qw(t,e,"left",n):u-e.clientX<=n&&(o=Qw(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=pn.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}AC(t,o)}}}function C$(t){if(!t.editable)return;const e=Dr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&AC(t,-1)}function E$(t,e,n,r){var i;if(!t.editable)return!1;const a=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=Dr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=T$(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Dr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){a.removeEventListener("mouseup",h),a.removeEventListener("mousemove",f);const g=Dr.getState(t.state);g!=null&&g.dragging&&(A$(t,g.activeHandle,Xw(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Dr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=Dr.getState(t.state);if(g&&g.dragging){const y=Xw(g.dragging,m,n);Zw(t,g.activeHandle,y,r)}}return Zw(t,o.activeHandle,u,r),a.addEventListener("mouseup",h),a.addEventListener("mousemove",f),e.preventDefault(),!0}function T$(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;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"),i=r?r.split(",").map(a=>parseInt(a,10)):null;if(!i){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 i}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Et(this.options.HTMLAttributes,t),0]}}),RC=kn.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",Et(this.options.HTMLAttributes,t),0]}}),PC=kn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Et(this.options.HTMLAttributes,t),0]}});function yx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function eN(t,e,n,r,i,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 _$(t,e,n,r,i){const a=L$(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!z$(e))return!1;let n=0;const r=g2(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},$$="";function F$(t){return(t||"").replace(/\s+/g," ").trim()}function B$(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:$$;if(!t||!t.content||t.content.length===0)return"";const a=[];t.content.forEach(w=>{const N=[];w.content&&w.content.forEach(b=>{let k="";b.content&&Array.isArray(b.content)&&b.content.length>1?k=b.content.map(I=>e.renderChildren(I)).join(i):k=b.content?e.renderChildren(b.content):"";const C=F$(k),E=b.type==="tableHeader";N.push({text:C,isHeader:E})}),a.push(N)});const o=a.reduce((w,N)=>Math.max(w,N.length),0);if(o===0)return"";const c=new Array(o).fill(0);a.forEach(w=>{var N;for(let b=0;bc[b]&&(c[b]=C),c[b]<3&&(c[b]=3)}});const u=(w,N)=>w+" ".repeat(Math.max(0,N-w.length)),h=a[0],f=h.some(w=>w.isHeader);let m=` `;const g=new Array(o).fill(0).map((w,N)=>f&&h[N]&&h[N].text||"");return m+=`| ${g.map((w,N)=>u(w,c[N])).join(" | ")} | `,m+=`| ${c.map(w=>"-".repeat(Math.max(3,w))).join(" | ")} | `,(f?a.slice(1):a).forEach(w=>{m+=`| ${new Array(o).fill(0).map((N,b)=>u(w[b]&&w[b].text||"",c[b])).join(" | ")} | -`}),m}var V$=B$,PC=Nn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:O$,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:i}=D$(t,this.options.cellMinWidth),a=e.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}const c=["table",kt(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(i=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const i=[];r.forEach(a=>{i.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>V$(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{const o=_$(a.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(qe.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Xz(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Zz(t,e),deleteColumn:()=>({state:t,dispatch:e})=>t$(t,e),addRowBefore:()=>({state:t,dispatch:e})=>r$(t,e),addRowAfter:()=>({state:t,dispatch:e})=>s$(t,e),deleteRow:()=>({state:t,dispatch:e})=>a$(t,e),deleteTable:()=>({state:t,dispatch:e})=>f$(t,e),mergeCells:()=>({state:t,dispatch:e})=>Vw(t,e),splitCell:()=>({state:t,dispatch:e})=>Hw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>od("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>od("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>u$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Vw(t,e)?!0:Hw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>c$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Uw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Uw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&SC(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Ft.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:Uu,"Mod-Backspace":Uu,Delete:Uu,"Mod-Delete":Uu}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[j$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],P$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:jt(We(t,"tableRole",e))}}});pn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(PC.configure(this.options.table)),this.options.tableCell!==!1&&t.push(AC.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(IC.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(RC.configure(this.options.tableRow)),t}});function H$(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 +`}),m}var V$=B$,OC=kn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:O$,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:i}=D$(t,this.options.cellMinWidth),a=e.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}const c=["table",Et(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(i=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const i=[];r.forEach(a=>{i.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>V$(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{const o=_$(a.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Ge.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Xz(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Zz(t,e),deleteColumn:()=>({state:t,dispatch:e})=>t$(t,e),addRowBefore:()=>({state:t,dispatch:e})=>r$(t,e),addRowAfter:()=>({state:t,dispatch:e})=>s$(t,e),deleteRow:()=>({state:t,dispatch:e})=>a$(t,e),deleteTable:()=>({state:t,dispatch:e})=>f$(t,e),mergeCells:()=>({state:t,dispatch:e})=>Hw(t,e),splitCell:()=>({state:t,dispatch:e})=>Ww(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ld("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ld("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>u$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Hw(t,e)?!0:Ww(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>c$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Kw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Kw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&CC(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Ht.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:Ku,"Mod-Backspace":Ku,Delete:Ku,"Mod-Delete":Ku}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[j$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],P$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Ct(We(t,"tableRole",e))}}});mn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(OC.configure(this.options.table)),this.options.tableCell!==!1&&t.push(IC.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(RC.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(PC.configure(this.options.tableRow)),t}});function H$(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 `),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 @@ -763,17 +763,17 @@ ${y.slice(h+2)}`,m+=1;else break}e.push({indent:h,number:parseInt(c,10),content: `),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 tN(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 i of n){const a=i.trim();a&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(a)?r.push(a):r.push(`

    ${a}

    `))}return r.join("")}const W$=Nn.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")||""},appId:{default:"",parseHTML:t=>t.getAttribute("data-app-id")||""},mpKey:{default:"",parseHTML:t=>t.getAttribute("data-mp-key")||""}}},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")||"",appId:t.getAttribute("data-app-id")||"",mpKey:t.getAttribute("data-mp-key")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",kt(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,"data-app-id":t.attrs.appId||"","data-mp-key":t.attrs.mpKey||t.attrs.appId||"",class:"link-tag-node"}),`#${t.attrs.label}`]}}),U$=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=[],i=null;const a=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    +`),e.trim()}function nN(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 i of n){const a=i.trim();a&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(a)?r.push(a):r.push(`

    ${a}

    `))}return r.join("")}const W$=kn.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")||""},appId:{default:"",parseHTML:t=>t.getAttribute("data-app-id")||""},mpKey:{default:"",parseHTML:t=>t.getAttribute("data-mp-key")||""}}},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")||"",appId:t.getAttribute("data-app-id")||"",mpKey:t.getAttribute("data-mp-key")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",Et(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,"data-app-id":t.attrs.appId||"","data-mp-key":t.attrs.mpKey||t.attrs.appId||"",class:"link-tag-node"}),`#${t.attrs.label}`]}}),U$=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=[],i=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");i&&r[c]&&i({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,i=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,i=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"?(i&&r[n]&&i({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}}}});function K$(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let i=0;i{const u=v.useRef(null),h=v.useRef(null),[f,m]=v.useState(""),[g,y]=v.useState(!1),w=v.useRef(tN(t)),N=v.useCallback((T,I)=>{var L;const O=h.current;if(!O||!n)return!1;const D=K$(I);if(D.length>0)return I.preventDefault(),(async()=>{for(const _ of D)try{const J=await n(_);J&&O.chain().focus().setImage({src:J}).run()}catch(J){console.error("粘贴图片上传失败",J)}})(),!0;const P=(L=I.clipboardData)==null?void 0:L.getData("text/html");if(P&&/data:image\/[^;"']+;base64,/i.test(P)){I.preventDefault();const{from:_,to:J}=O.state.selection;return(async()=>{try{const ee=await J$(P,n);O.chain().focus().insertContentAt({from:_,to:J},ee).run()}catch(ee){console.error("粘贴 HTML 内 base64 转换失败",ee)}})(),!0}return!1},[n]),b=$_({extensions:[Cz.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),Mz.configure({inline:!0,allowBase64:!0}),Dz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:U$(r)}),W$,Lz.configure({placeholder:a}),PC.configure({resizable:!0}),RC,AC,IC],content:w.current,onUpdate:({editor:T})=>{e(T.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:N}});v.useEffect(()=>{h.current=b??null},[b]),v.useImperativeHandle(c,()=>({getHTML:()=>(b==null?void 0:b.getHTML())||"",getMarkdown:()=>H$((b==null?void 0:b.getHTML())||"")})),v.useEffect(()=>{if(b&&t!==b.getHTML()){const T=tN(t);T!==b.getHTML()&&b.commands.setContent(T)}},[t]);const k=v.useCallback(async T=>{var O;const I=(O=T.target.files)==null?void 0:O[0];if(!(!I||!b)){if(n){const D=await n(I);D&&b.chain().focus().setImage({src:D}).run()}else{const D=new FileReader;D.onload=()=>{typeof D.result=="string"&&b.chain().focus().setImage({src:D.result}).run()},D.readAsDataURL(I)}T.target.value=""}},[b,n]),C=v.useCallback(T=>{b&&b.chain().focus().insertContent({type:"linkTag",attrs:{label:T.label,url:T.url||"",tagType:T.type||"url",tagId:T.id||"",pagePath:T.pagePath||"",appId:T.appId||"",mpKey:T.type==="miniprogram"&&T.appId||""}}).run()},[b]),E=v.useCallback(()=>{!b||!f||(b.chain().focus().setLink({href:f}).run(),m(""),y(!1))},[b,f]);return b?s.jsxs("div",{className:`rich-editor-wrapper ${o||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>b.chain().focus().toggleBold().run(),className:b.isActive("bold")?"is-active":"",type:"button",children:s.jsx(DT,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleItalic().run(),className:b.isActive("italic")?"is-active":"",type:"button",children:s.jsx(OM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleStrike().run(),className:b.isActive("strike")?"is-active":"",type:"button",children:s.jsx(IA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleCode().run(),className:b.isActive("code")?"is-active":"",type:"button",children:s.jsx(eM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>b.chain().focus().toggleHeading({level:1}).run(),className:b.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(kM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleHeading({level:2}).run(),className:b.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(CM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleHeading({level:3}).run(),className:b.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(TM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>b.chain().focus().toggleBulletList().run(),className:b.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(WM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleOrderedList().run(),className:b.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(VM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleBlockquote().run(),className:b.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(gA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(tA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:k,className:"hidden"}),s.jsx("button",{onClick:()=>{var T;return(T=u.current)==null?void 0:T.click()},type:"button",children:s.jsx(qN,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>y(!g),className:b.isActive("link")?"is-active":"",type:"button",children:s.jsx(Sg,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:s.jsx(PA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>b.chain().focus().undo().run(),disabled:!b.can().undo(),type:"button",children:s.jsx(FA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().redo().run(),disabled:!b.can().redo(),type:"button",children:s.jsx(yA,{className:"w-4 h-4"})})]}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"toolbar-divider"}),s.jsx("div",{className:"toolbar-group",children:s.jsxs("select",{className:"link-tag-select",onChange:T=>{const I=i.find(O=>O.id===T.target.value);I&&C(I),T.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(T=>s.jsx("option",{value:T.id,children:T.label},T.id))]})})]})]}),g&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:f,onChange:T=>m(T.target.value),onKeyDown:T=>T.key==="Enter"&&E(),className:"link-input"}),s.jsx("button",{onClick:E,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{b.chain().focus().unsetLink().run(),y(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(W2,{editor:b})]}):null});yx.displayName="RichEditor";const Y$=["top","right","bottom","left"],va=Math.min,Rr=Math.max,tf=Math.round,Ku=Math.floor,Ls=t=>({x:t,y:t}),Q$={left:"right",right:"left",bottom:"top",top:"bottom"},X$={start:"end",end:"start"};function vx(t,e,n){return Rr(t,va(e,n))}function bi(t,e){return typeof t=="function"?t(e):t}function wi(t){return t.split("-")[0]}function Fl(t){return t.split("-")[1]}function B0(t){return t==="x"?"y":"x"}function V0(t){return t==="y"?"height":"width"}const Z$=new Set(["top","bottom"]);function Ds(t){return Z$.has(wi(t))?"y":"x"}function H0(t){return B0(Ds(t))}function eF(t,e,n){n===void 0&&(n=!1);const r=Fl(t),i=H0(t),a=V0(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=nf(o)),[o,nf(o)]}function tF(t){const e=nf(t);return[bx(t),e,bx(e)]}function bx(t){return t.replace(/start|end/g,e=>X$[e])}const nN=["left","right"],rN=["right","left"],nF=["top","bottom"],rF=["bottom","top"];function sF(t,e,n){switch(t){case"top":case"bottom":return n?e?rN:nN:e?nN:rN;case"left":case"right":return e?nF:rF;default:return[]}}function iF(t,e,n,r){const i=Fl(t);let a=sF(wi(t),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),e&&(a=a.concat(a.map(bx)))),a}function nf(t){return t.replace(/left|right|bottom|top/g,e=>Q$[e])}function aF(t){return{top:0,right:0,bottom:0,left:0,...t}}function OC(t){return typeof t!="number"?aF(t):{top:t,right:t,bottom:t,left:t}}function rf(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function sN(t,e,n){let{reference:r,floating:i}=t;const a=Ds(e),o=H0(e),c=V0(o),u=wi(e),h=a==="y",f=r.x+r.width/2-i.width/2,m=r.y+r.height/2-i.height/2,g=r[c]/2-i[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-i.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-i.width,y:m};break;default:y={x:r.x,y:r.y}}switch(Fl(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 oF(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:a,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=bi(e,t),w=OC(y),b=c[g?m==="floating"?"reference":"floating":m],k=rf(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),C=m==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),T=await(a.isElement==null?void 0:a.isElement(E))?await(a.getScale==null?void 0:a.getScale(E))||{x:1,y:1}:{x:1,y:1},I=rf(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:C,offsetParent:E,strategy:u}):C);return{top:(k.top-I.top+w.top)/T.y,bottom:(I.bottom-k.bottom+w.bottom)/T.y,left:(k.left-I.left+w.left)/T.x,right:(I.right-k.right+w.right)/T.x}}const lF=async(t,e,n)=>{const{placement:r="bottom",strategy:i="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:i}),{x:f,y:m}=sN(h,r,u),g=r,y={},w=0;for(let b=0;b({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:a,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=bi(t,e)||{};if(h==null)return{};const m=OC(f),g={x:n,y:r},y=H0(i),w=V0(y),N=await o.getDimensions(h),b=y==="y",k=b?"top":"left",C=b?"bottom":"right",E=b?"clientHeight":"clientWidth",T=a.reference[w]+a.reference[y]-g[y]-a.floating[w],I=g[y]-a.reference[y],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let D=O?O[E]:0;(!D||!await(o.isElement==null?void 0:o.isElement(O)))&&(D=c.floating[E]||a.floating[w]);const P=T/2-I/2,L=D/2-N[w]/2-1,_=va(m[k],L),J=va(m[C],L),ee=_,Y=D-N[w]-J,U=D/2-N[w]/2+P,R=vx(ee,U,Y),F=!u.arrow&&Fl(i)!=null&&U!==R&&a.reference[w]/2-(UU<=0)){var J,ee;const U=(((J=a.flip)==null?void 0:J.index)||0)+1,R=D[U];if(R&&(!(m==="alignment"?C!==Ds(R):!1)||_.every(z=>Ds(z.placement)===C?z.overflows[0]>0:!0)))return{data:{index:U,overflows:_},reset:{placement:R}};let F=(ee=_.filter(re=>re.overflows[0]<=0).sort((re,z)=>re.overflows[1]-z.overflows[1])[0])==null?void 0:ee.placement;if(!F)switch(y){case"bestFit":{var Y;const re=(Y=_.filter(z=>{if(O){const ie=Ds(z.placement);return ie===C||ie==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ie=>ie>0).reduce((ie,G)=>ie+G,0)]).sort((z,ie)=>z[1]-ie[1])[0])==null?void 0:Y[0];re&&(F=re);break}case"initialPlacement":F=c;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function iN(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function aN(t){return Y$.some(e=>t[e]>=0)}const uF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...a}=bi(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...a,elementContext:"reference"}),c=iN(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:aN(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...a,altBoundary:!0}),c=iN(o,n.floating);return{data:{escapedOffsets:c,escaped:aN(c)}}}default:return{}}}}},DC=new Set(["left","top"]);async function hF(t,e){const{placement:n,platform:r,elements:i}=t,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=wi(n),c=Fl(n),u=Ds(n)==="y",h=DC.has(o)?-1:1,f=a&&u?-1:1,m=bi(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:w}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof w=="number"&&(y=c==="end"?w*-1:w),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const fF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:a,placement:o,middlewareData:c}=e,u=await hF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:a+u.y,data:{...u,placement:o}}}}},pF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:a}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:C,y:E}=k;return{x:C,y:E}}},...h}=bi(t,e),f={x:n,y:r},m=await a.detectOverflow(e,h),g=Ds(wi(i)),y=B0(g);let w=f[y],N=f[g];if(o){const k=y==="y"?"top":"left",C=y==="y"?"bottom":"right",E=w+m[k],T=w-m[C];w=vx(E,w,T)}if(c){const k=g==="y"?"top":"left",C=g==="y"?"bottom":"right",E=N+m[k],T=N-m[C];N=vx(E,N,T)}const b=u.fn({...e,[y]:w,[g]:N});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:o,[g]:c}}}}}},mF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:a,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=bi(t,e),f={x:n,y:r},m=Ds(i),g=B0(m);let y=f[g],w=f[m];const N=bi(c,e),b=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(u){const E=g==="y"?"height":"width",T=a.reference[g]-a.floating[E]+b.mainAxis,I=a.reference[g]+a.reference[E]-b.mainAxis;yI&&(y=I)}if(h){var k,C;const E=g==="y"?"width":"height",T=DC.has(wi(i)),I=a.reference[m]-a.floating[E]+(T&&((k=o.offset)==null?void 0:k[m])||0)+(T?0:b.crossAxis),O=a.reference[m]+a.reference[E]+(T?0:((C=o.offset)==null?void 0:C[m])||0)-(T?b.crossAxis:0);wO&&(w=O)}return{[g]:y,[m]:w}}}},gF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:a,platform:o,elements:c}=e,{apply:u=()=>{},...h}=bi(t,e),f=await o.detectOverflow(e,h),m=wi(i),g=Fl(i),y=Ds(i)==="y",{width:w,height:N}=a.floating;let b,k;m==="top"||m==="bottom"?(b=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,b=g==="end"?"top":"bottom");const C=N-f.top-f.bottom,E=w-f.left-f.right,T=va(N-f[b],C),I=va(w-f[k],E),O=!e.middlewareData.shift;let D=T,P=I;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(D=C),O&&!g){const _=Rr(f.left,0),J=Rr(f.right,0),ee=Rr(f.top,0),Y=Rr(f.bottom,0);y?P=w-2*(_!==0||J!==0?_+J:Rr(f.left,f.right)):D=N-2*(ee!==0||Y!==0?ee+Y:Rr(f.top,f.bottom))}await u({...e,availableWidth:P,availableHeight:D});const L=await o.getDimensions(c.floating);return w!==L.width||N!==L.height?{reset:{rects:!0}}:{}}}};function Pf(){return typeof window<"u"}function Bl(t){return LC(t)?(t.nodeName||"").toLowerCase():"#document"}function Lr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Vs(t){var e;return(e=(LC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function LC(t){return Pf()?t instanceof Node||t instanceof Lr(t).Node:!1}function ys(t){return Pf()?t instanceof Element||t instanceof Lr(t).Element:!1}function Fs(t){return Pf()?t instanceof HTMLElement||t instanceof Lr(t).HTMLElement:!1}function oN(t){return!Pf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Lr(t).ShadowRoot}const xF=new Set(["inline","contents"]);function yd(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=vs(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!xF.has(i)}const yF=new Set(["table","td","th"]);function vF(t){return yF.has(Bl(t))}const bF=[":popover-open",":modal"];function Of(t){return bF.some(e=>{try{return t.matches(e)}catch{return!1}})}const wF=["transform","translate","scale","rotate","perspective"],NF=["transform","translate","scale","rotate","perspective","filter"],jF=["paint","layout","strict","content"];function W0(t){const e=U0(),n=ys(t)?vs(t):t;return wF.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)||NF.some(r=>(n.willChange||"").includes(r))||jF.some(r=>(n.contain||"").includes(r))}function kF(t){let e=ba(t);for(;Fs(e)&&!Il(e);){if(W0(e))return e;if(Of(e))return null;e=ba(e)}return null}function U0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const SF=new Set(["html","body","#document"]);function Il(t){return SF.has(Bl(t))}function vs(t){return Lr(t).getComputedStyle(t)}function Df(t){return ys(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ba(t){if(Bl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||oN(t)&&t.host||Vs(t);return oN(e)?e.host:e}function _C(t){const e=ba(t);return Il(e)?t.ownerDocument?t.ownerDocument.body:t.body:Fs(e)&&yd(e)?e:_C(e)}function ld(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=_C(t),a=i===((r=t.ownerDocument)==null?void 0:r.body),o=Lr(i);if(a){const c=wx(o);return e.concat(o,o.visualViewport||[],yd(i)?i:[],c&&n?ld(c):[])}return e.concat(i,ld(i,[],n))}function wx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function zC(t){const e=vs(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Fs(t),a=i?t.offsetWidth:n,o=i?t.offsetHeight:r,c=tf(n)!==a||tf(r)!==o;return c&&(n=a,r=o),{width:n,height:r,$:c}}function K0(t){return ys(t)?t:t.contextElement}function Nl(t){const e=K0(t);if(!Fs(e))return Ls(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:a}=zC(e);let o=(a?tf(n.width):n.width)/r,c=(a?tf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const CF=Ls(0);function $C(t){const e=Lr(t);return!U0()||!e.visualViewport?CF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function EF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Lr(t)?!1:e}function No(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),a=K0(t);let o=Ls(1);e&&(r?ys(r)&&(o=Nl(r)):o=Nl(t));const c=EF(a,n,r)?$C(a):Ls(0);let u=(i.left+c.x)/o.x,h=(i.top+c.y)/o.y,f=i.width/o.x,m=i.height/o.y;if(a){const g=Lr(a),y=r&&ys(r)?Lr(r):r;let w=g,N=wx(w);for(;N&&r&&y!==w;){const b=Nl(N),k=N.getBoundingClientRect(),C=vs(N),E=k.left+(N.clientLeft+parseFloat(C.paddingLeft))*b.x,T=k.top+(N.clientTop+parseFloat(C.paddingTop))*b.y;u*=b.x,h*=b.y,f*=b.x,m*=b.y,u+=E,h+=T,w=Lr(N),N=wx(w)}}return rf({width:f,height:m,x:u,y:h})}function Lf(t,e){const n=Df(t).scrollLeft;return e?e.left+n:No(Vs(t)).left+n}function FC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Lf(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function TF(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const a=i==="fixed",o=Vs(r),c=e?Of(e.floating):!1;if(r===o||c&&a)return n;let u={scrollLeft:0,scrollTop:0},h=Ls(1);const f=Ls(0),m=Fs(r);if((m||!m&&!a)&&((Bl(r)!=="body"||yd(o))&&(u=Df(r)),Fs(r))){const y=No(r);h=Nl(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!a?FC(o,u):Ls(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 MF(t){return Array.from(t.getClientRects())}function AF(t){const e=Vs(t),n=Df(t),r=t.ownerDocument.body,i=Rr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=Rr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Lf(t);const c=-n.scrollTop;return vs(r).direction==="rtl"&&(o+=Rr(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:c}}const lN=25;function IF(t,e){const n=Lr(t),r=Vs(t),i=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,c=0,u=0;if(i){a=i.width,o=i.height;const f=U0();(!f||f&&e==="fixed")&&(c=i.offsetLeft,u=i.offsetTop)}const h=Lf(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,w=Math.abs(r.clientWidth-m.clientWidth-y);w<=lN&&(a-=w)}else h<=lN&&(a+=h);return{width:a,height:o,x:c,y:u}}const RF=new Set(["absolute","fixed"]);function PF(t,e){const n=No(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,a=Fs(t)?Nl(t):Ls(1),o=t.clientWidth*a.x,c=t.clientHeight*a.y,u=i*a.x,h=r*a.y;return{width:o,height:c,x:u,y:h}}function cN(t,e,n){let r;if(e==="viewport")r=IF(t,n);else if(e==="document")r=AF(Vs(t));else if(ys(e))r=PF(e,n);else{const i=$C(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return rf(r)}function BC(t,e){const n=ba(t);return n===e||!ys(n)||Il(n)?!1:vs(n).position==="fixed"||BC(n,e)}function OF(t,e){const n=e.get(t);if(n)return n;let r=ld(t,[],!1).filter(c=>ys(c)&&Bl(c)!=="body"),i=null;const a=vs(t).position==="fixed";let o=a?ba(t):t;for(;ys(o)&&!Il(o);){const c=vs(o),u=W0(o);!u&&c.position==="fixed"&&(i=null),(a?!u&&!i:!u&&c.position==="static"&&!!i&&RF.has(i.position)||yd(o)&&!u&&BC(t,o))?r=r.filter(f=>f!==o):i=c,o=ba(o)}return e.set(t,r),r}function DF(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?Of(e)?[]:OF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=cN(e,f,i);return h.top=Rr(m.top,h.top),h.right=va(m.right,h.right),h.bottom=va(m.bottom,h.bottom),h.left=Rr(m.left,h.left),h},cN(e,c,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function LF(t){const{width:e,height:n}=zC(t);return{width:e,height:n}}function _F(t,e,n){const r=Fs(e),i=Vs(e),a=n==="fixed",o=No(t,!0,a,e);let c={scrollLeft:0,scrollTop:0};const u=Ls(0);function h(){u.x=Lf(i)}if(r||!r&&!a)if((Bl(e)!=="body"||yd(i))&&(c=Df(e)),r){const y=No(e,!0,a,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else i&&h();a&&!r&&i&&h();const f=i&&!r&&!a?FC(i,c):Ls(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 hg(t){return vs(t).position==="static"}function dN(t,e){if(!Fs(t)||vs(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Vs(t)===n&&(n=n.ownerDocument.body),n}function VC(t,e){const n=Lr(t);if(Of(t))return n;if(!Fs(t)){let i=ba(t);for(;i&&!Il(i);){if(ys(i)&&!hg(i))return i;i=ba(i)}return n}let r=dN(t,e);for(;r&&vF(r)&&hg(r);)r=dN(r,e);return r&&Il(r)&&hg(r)&&!W0(r)?n:r||kF(t)||n}const zF=async function(t){const e=this.getOffsetParent||VC,n=this.getDimensions,r=await n(t.floating);return{reference:_F(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $F(t){return vs(t).direction==="rtl"}const FF={convertOffsetParentRelativeRectToViewportRelativeRect:TF,getDocumentElement:Vs,getClippingRect:DF,getOffsetParent:VC,getElementRects:zF,getClientRects:MF,getDimensions:LF,getScale:Nl,isElement:ys,isRTL:$F};function HC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function BF(t,e){let n=null,r;const i=Vs(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 w=Ku(m),N=Ku(i.clientWidth-(f+g)),b=Ku(i.clientHeight-(m+y)),k=Ku(f),E={rootMargin:-w+"px "+-N+"px "+-b+"px "+-k+"px",threshold:Rr(0,va(1,u))||1};let T=!0;function I(O){const D=O[0].intersectionRatio;if(D!==u){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!HC(h,t.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(I,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(I,E)}n.observe(t)}return o(!0),a}function VF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=K0(t),f=i||a?[...h?ld(h):[],...ld(e)]:[];f.forEach(k=>{i&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const m=h&&c?BF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[C]=k;C&&C.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let w,N=u?No(t):null;u&&b();function b(){const k=No(t);N&&!HC(N,k)&&n(),N=k,w=requestAnimationFrame(b)}return n(),()=>{var k;f.forEach(C=>{i&&C.removeEventListener("scroll",n),a&&C.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(w)}}const HF=fF,WF=pF,UF=dF,KF=gF,qF=uF,uN=cF,GF=mF,JF=(t,e,n)=>{const r=new Map,i={platform:FF,...n},a={...i.platform,_c:r};return lF(t,e,{...i,platform:a})};var YF=typeof document<"u",QF=function(){},rh=YF?v.useLayoutEffect:QF;function sf(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,i;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(!sf(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!(a==="_owner"&&t.$$typeof)&&!sf(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function WC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function hN(t,e){const n=WC(t);return Math.round(e*n)/n}function fg(t){const e=v.useRef(t);return rh(()=>{e.current=t}),e}function XF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=v.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=v.useState(r);sf(g,r)||y(r);const[w,N]=v.useState(null),[b,k]=v.useState(null),C=v.useCallback(z=>{z!==O.current&&(O.current=z,N(z))},[]),E=v.useCallback(z=>{z!==D.current&&(D.current=z,k(z))},[]),T=a||w,I=o||b,O=v.useRef(null),D=v.useRef(null),P=v.useRef(f),L=u!=null,_=fg(u),J=fg(i),ee=fg(h),Y=v.useCallback(()=>{if(!O.current||!D.current)return;const z={placement:e,strategy:n,middleware:g};J.current&&(z.platform=J.current),JF(O.current,D.current,z).then(ie=>{const G={...ie,isPositioned:ee.current!==!1};U.current&&!sf(P.current,G)&&(P.current=G,dd.flushSync(()=>{m(G)}))})},[g,e,n,J,ee]);rh(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const U=v.useRef(!1);rh(()=>(U.current=!0,()=>{U.current=!1}),[]),rh(()=>{if(T&&(O.current=T),I&&(D.current=I),T&&I){if(_.current)return _.current(T,I,Y);Y()}},[T,I,Y,_,L]);const R=v.useMemo(()=>({reference:O,floating:D,setReference:C,setFloating:E}),[C,E]),F=v.useMemo(()=>({reference:T,floating:I}),[T,I]),re=v.useMemo(()=>{const z={position:n,left:0,top:0};if(!F.floating)return z;const ie=hN(F.floating,f.x),G=hN(F.floating,f.y);return c?{...z,transform:"translate("+ie+"px, "+G+"px)",...WC(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ie,top:G}},[n,c,F.floating,f.x,f.y]);return v.useMemo(()=>({...f,update:Y,refs:R,elements:F,floatingStyles:re}),[f,Y,R,F,re])}const ZF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?uN({element:r.current,padding:i}).fn(n):{}:r?uN({element:r,padding:i}).fn(n):{}}}},eB=(t,e)=>({...HF(t),options:[t,e]}),tB=(t,e)=>({...WF(t),options:[t,e]}),nB=(t,e)=>({...GF(t),options:[t,e]}),rB=(t,e)=>({...UF(t),options:[t,e]}),sB=(t,e)=>({...KF(t),options:[t,e]}),iB=(t,e)=>({...qF(t),options:[t,e]}),aB=(t,e)=>({...ZF(t),options:[t,e]});var oB="Arrow",UC=v.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...a}=t;return s.jsx(dt.svg,{...a,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});UC.displayName=oB;var lB=UC,q0="Popper",[KC,qC]=ka(q0),[cB,GC]=KC(q0),JC=t=>{const{__scopePopper:e,children:n}=t,[r,i]=v.useState(null);return s.jsx(cB,{scope:e,anchor:r,onAnchorChange:i,children:n})};JC.displayName=q0;var YC="PopperAnchor",QC=v.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,a=GC(YC,n),o=v.useRef(null),c=St(e,o),u=v.useRef(null);return v.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&a.onAnchorChange(u.current)}),r?null:s.jsx(dt.div,{...i,ref:c})});QC.displayName=YC;var G0="PopperContent",[dB,uB]=KC(G0),XC=v.forwardRef((t,e)=>{var de,he,we,Te,Ve,He;const{__scopePopper:n,side:r="bottom",sideOffset:i=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:w,...N}=t,b=GC(G0,n),[k,C]=v.useState(null),E=St(e,gt=>C(gt)),[T,I]=v.useState(null),O=Gx(T),D=(O==null?void 0:O.width)??0,P=(O==null?void 0:O.height)??0,L=r+(a!=="center"?"-"+a:""),_=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},J=Array.isArray(h)?h:[h],ee=J.length>0,Y={padding:_,boundary:J.filter(fB),altBoundary:ee},{refs:U,floatingStyles:R,placement:F,isPositioned:re,middlewareData:z}=XF({strategy:"fixed",placement:L,whileElementsMounted:(...gt)=>VF(...gt,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[eB({mainAxis:i+P,alignmentAxis:o}),u&&tB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?nB():void 0,...Y}),u&&rB({...Y}),sB({...Y,apply:({elements:gt,rects:Pt,availableWidth:yn,availableHeight:ht})=>{const{width:At,height:ne}=Pt.reference,Pe=gt.floating.style;Pe.setProperty("--radix-popper-available-width",`${yn}px`),Pe.setProperty("--radix-popper-available-height",`${ht}px`),Pe.setProperty("--radix-popper-anchor-width",`${At}px`),Pe.setProperty("--radix-popper-anchor-height",`${ne}px`)}}),T&&aB({element:T,padding:c}),pB({arrowWidth:D,arrowHeight:P}),g&&iB({strategy:"referenceHidden",...Y})]}),[ie,G]=t4(F),$=ga(w);Zn(()=>{re&&($==null||$())},[re,$]);const H=(de=z.arrow)==null?void 0:de.x,ce=(he=z.arrow)==null?void 0:he.y,W=((we=z.arrow)==null?void 0:we.centerOffset)!==0,[fe,X]=v.useState();return Zn(()=>{k&&X(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:re?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(Te=z.transformOrigin)==null?void 0:Te.x,(Ve=z.transformOrigin)==null?void 0:Ve.y].join(" "),...((He=z.hide)==null?void 0:He.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(dB,{scope:n,placedSide:ie,onArrowChange:I,arrowX:H,arrowY:ce,shouldHideArrow:W,children:s.jsx(dt.div,{"data-side":ie,"data-align":G,...N,ref:E,style:{...N.style,animation:re?void 0:"none"}})})})});XC.displayName=G0;var ZC="PopperArrow",hB={top:"bottom",right:"left",bottom:"top",left:"right"},e4=v.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,a=uB(ZC,r),o=hB[a.placedSide];return s.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:s.jsx(lB,{...i,ref:n,style:{...i.style,display:"block"}})})});e4.displayName=ZC;function fB(t){return t!==null}var pB=t=>({name:"transformOrigin",options:t,fn(e){var b,k,C;const{placement:n,rects:r,middlewareData:i}=e,o=((b=i.arrow)==null?void 0:b.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=t4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=i.arrow)==null?void 0:k.x)??0)+c/2,y=(((C=i.arrow)==null?void 0:C.y)??0)+u/2;let w="",N="";return h==="bottom"?(w=o?m:`${g}px`,N=`${-u}px`):h==="top"?(w=o?m:`${g}px`,N=`${r.floating.height+u}px`):h==="right"?(w=`${-u}px`,N=o?m:`${y}px`):h==="left"&&(w=`${r.floating.width+u}px`,N=o?m:`${y}px`),{data:{x:w,y:N}}}});function t4(t){const[e,n="center"]=t.split("-");return[e,n]}var mB=JC,gB=QC,xB=XC,yB=e4,n4=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"}),vB="VisuallyHidden",bB=v.forwardRef((t,e)=>s.jsx(dt.span,{...t,ref:e,style:{...n4,...t.style}}));bB.displayName=vB;var wB=[" ","Enter","ArrowUp","ArrowDown"],NB=[" ","Enter"],jo="Select",[_f,zf,jB]=Ux(jo),[Vl]=ka(jo,[jB,qC]),$f=qC(),[kB,Ta]=Vl(jo),[SB,CB]=Vl(jo),r4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:w}=t,N=$f(e),[b,k]=v.useState(null),[C,E]=v.useState(null),[T,I]=v.useState(!1),O=ff(h),[D,P]=fo({prop:r,defaultProp:i??!1,onChange:a,caller:jo}),[L,_]=fo({prop:o,defaultProp:c,onChange:u,caller:jo}),J=v.useRef(null),ee=b?w||!!b.closest("form"):!0,[Y,U]=v.useState(new Set),R=Array.from(Y).map(F=>F.props.value).join(";");return s.jsx(mB,{...N,children:s.jsxs(kB,{required:y,scope:e,trigger:b,onTriggerChange:k,valueNode:C,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:I,contentId:ua(),value:L,onValueChange:_,open:D,onOpenChange:P,dir:O,triggerPointerDownPosRef:J,disabled:g,children:[s.jsx(_f.Provider,{scope:e,children:s.jsx(SB,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback(F=>{U(re=>new Set(re).add(F))},[]),onNativeOptionRemove:v.useCallback(F=>{U(re=>{const z=new Set(re);return z.delete(F),z})},[]),children:n})}),ee?s.jsxs(S4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:L,onChange:F=>_(F.target.value),disabled:g,form:w,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(Y)]},R):null]})})};r4.displayName=jo;var s4="SelectTrigger",i4=v.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,a=$f(n),o=Ta(s4,n),c=o.disabled||r,u=St(e,o.onTriggerChange),h=zf(n),f=v.useRef("touch"),[m,g,y]=E4(N=>{const b=h().filter(E=>!E.disabled),k=b.find(E=>E.value===o.value),C=T4(b,N,k);C!==void 0&&o.onValueChange(C.value)}),w=N=>{c||(o.onOpenChange(!0),y()),N&&(o.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return s.jsx(gB,{asChild:!0,...a,children:s.jsx(dt.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":C4(o.value)?"":void 0,...i,ref:u,onClick:at(i.onClick,N=>{N.currentTarget.focus(),f.current!=="mouse"&&w(N)}),onPointerDown:at(i.onPointerDown,N=>{f.current=N.pointerType;const b=N.target;b.hasPointerCapture(N.pointerId)&&b.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(w(N),N.preventDefault())}),onKeyDown:at(i.onKeyDown,N=>{const b=m.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&g(N.key),!(b&&N.key===" ")&&wB.includes(N.key)&&(w(),N.preventDefault())})})})});i4.displayName=s4;var a4="SelectValue",o4=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...c}=t,u=Ta(a4,n),{onValueNodeHasChildrenChange:h}=u,f=a!==void 0,m=St(e,u.onValueNodeChange);return Zn(()=>{h(f)},[h,f]),s.jsx(dt.span,{...c,ref:m,style:{pointerEvents:"none"},children:C4(u.value)?s.jsx(s.Fragment,{children:o}):a})});o4.displayName=a4;var EB="SelectIcon",l4=v.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return s.jsx(dt.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});l4.displayName=EB;var TB="SelectPortal",c4=t=>s.jsx($x,{asChild:!0,...t});c4.displayName=TB;var ko="SelectContent",d4=v.forwardRef((t,e)=>{const n=Ta(ko,t.__scopeSelect),[r,i]=v.useState();if(Zn(()=>{i(new DocumentFragment)},[]),!n.open){const a=r;return a?dd.createPortal(s.jsx(u4,{scope:t.__scopeSelect,children:s.jsx(_f.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),a):null}return s.jsx(h4,{...t,ref:e})});d4.displayName=ko;var fs=10,[u4,Ma]=Vl(ko),MB="SelectContentImpl",AB=Jc("SelectContent.RemoveScroll"),h4=v.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:w,hideWhenDetached:N,avoidCollisions:b,...k}=t,C=Ta(ko,n),[E,T]=v.useState(null),[I,O]=v.useState(null),D=St(e,de=>T(de)),[P,L]=v.useState(null),[_,J]=v.useState(null),ee=zf(n),[Y,U]=v.useState(!1),R=v.useRef(!1);v.useEffect(()=>{if(E)return Ej(E)},[E]),yj();const F=v.useCallback(de=>{const[he,...we]=ee().map(He=>He.ref.current),[Te]=we.slice(-1),Ve=document.activeElement;for(const He of de)if(He===Ve||(He==null||He.scrollIntoView({block:"nearest"}),He===he&&I&&(I.scrollTop=0),He===Te&&I&&(I.scrollTop=I.scrollHeight),He==null||He.focus(),document.activeElement!==Ve))return},[ee,I]),re=v.useCallback(()=>F([P,E]),[F,P,E]);v.useEffect(()=>{Y&&re()},[Y,re]);const{onOpenChange:z,triggerPointerDownPosRef:ie}=C;v.useEffect(()=>{if(E){let de={x:0,y:0};const he=Te=>{var Ve,He;de={x:Math.abs(Math.round(Te.pageX)-(((Ve=ie.current)==null?void 0:Ve.x)??0)),y:Math.abs(Math.round(Te.pageY)-(((He=ie.current)==null?void 0:He.y)??0))}},we=Te=>{de.x<=10&&de.y<=10?Te.preventDefault():E.contains(Te.target)||z(!1),document.removeEventListener("pointermove",he),ie.current=null};return ie.current!==null&&(document.addEventListener("pointermove",he),document.addEventListener("pointerup",we,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",we,{capture:!0})}}},[E,z,ie]),v.useEffect(()=>{const de=()=>z(!1);return window.addEventListener("blur",de),window.addEventListener("resize",de),()=>{window.removeEventListener("blur",de),window.removeEventListener("resize",de)}},[z]);const[G,$]=E4(de=>{const he=ee().filter(Ve=>!Ve.disabled),we=he.find(Ve=>Ve.ref.current===document.activeElement),Te=T4(he,de,we);Te&&setTimeout(()=>Te.ref.current.focus())}),H=v.useCallback((de,he,we)=>{const Te=!R.current&&!we;(C.value!==void 0&&C.value===he||Te)&&(L(de),Te&&(R.current=!0))},[C.value]),ce=v.useCallback(()=>E==null?void 0:E.focus(),[E]),W=v.useCallback((de,he,we)=>{const Te=!R.current&&!we;(C.value!==void 0&&C.value===he||Te)&&J(de)},[C.value]),fe=r==="popper"?Nx:f4,X=fe===Nx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:w,hideWhenDetached:N,avoidCollisions:b}:{};return s.jsx(u4,{scope:n,content:E,viewport:I,onViewportChange:O,itemRefCallback:H,selectedItem:P,onItemLeave:ce,itemTextRefCallback:W,focusSelectedItem:re,selectedItemText:_,position:r,isPositioned:Y,searchRef:G,children:s.jsx(Fx,{as:AB,allowPinchZoom:!0,children:s.jsx(zx,{asChild:!0,trapped:C.open,onMountAutoFocus:de=>{de.preventDefault()},onUnmountAutoFocus:at(i,de=>{var he;(he=C.trigger)==null||he.focus({preventScroll:!0}),de.preventDefault()}),children:s.jsx(_x,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:de=>de.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:s.jsx(fe,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:de=>de.preventDefault(),...k,...X,onPlaced:()=>U(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:at(k.onKeyDown,de=>{const he=de.ctrlKey||de.altKey||de.metaKey;if(de.key==="Tab"&&de.preventDefault(),!he&&de.key.length===1&&$(de.key),["ArrowUp","ArrowDown","Home","End"].includes(de.key)){let Te=ee().filter(Ve=>!Ve.disabled).map(Ve=>Ve.ref.current);if(["ArrowUp","End"].includes(de.key)&&(Te=Te.slice().reverse()),["ArrowUp","ArrowDown"].includes(de.key)){const Ve=de.target,He=Te.indexOf(Ve);Te=Te.slice(He+1)}setTimeout(()=>F(Te)),de.preventDefault()}})})})})})})});h4.displayName=MB;var IB="SelectItemAlignedPosition",f4=v.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,a=Ta(ko,n),o=Ma(ko,n),[c,u]=v.useState(null),[h,f]=v.useState(null),m=St(e,D=>f(D)),g=zf(n),y=v.useRef(!1),w=v.useRef(!0),{viewport:N,selectedItem:b,selectedItemText:k,focusSelectedItem:C}=o,E=v.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&h&&N&&b&&k){const D=a.trigger.getBoundingClientRect(),P=h.getBoundingClientRect(),L=a.valueNode.getBoundingClientRect(),_=k.getBoundingClientRect();if(a.dir!=="rtl"){const Ve=_.left-P.left,He=L.left-Ve,gt=D.left-He,Pt=D.width+gt,yn=Math.max(Pt,P.width),ht=window.innerWidth-fs,At=uh(He,[fs,Math.max(fs,ht-yn)]);c.style.minWidth=Pt+"px",c.style.left=At+"px"}else{const Ve=P.right-_.right,He=window.innerWidth-L.right-Ve,gt=window.innerWidth-D.right-He,Pt=D.width+gt,yn=Math.max(Pt,P.width),ht=window.innerWidth-fs,At=uh(He,[fs,Math.max(fs,ht-yn)]);c.style.minWidth=Pt+"px",c.style.right=At+"px"}const J=g(),ee=window.innerHeight-fs*2,Y=N.scrollHeight,U=window.getComputedStyle(h),R=parseInt(U.borderTopWidth,10),F=parseInt(U.paddingTop,10),re=parseInt(U.borderBottomWidth,10),z=parseInt(U.paddingBottom,10),ie=R+F+Y+z+re,G=Math.min(b.offsetHeight*5,ie),$=window.getComputedStyle(N),H=parseInt($.paddingTop,10),ce=parseInt($.paddingBottom,10),W=D.top+D.height/2-fs,fe=ee-W,X=b.offsetHeight/2,de=b.offsetTop+X,he=R+F+de,we=ie-he;if(he<=W){const Ve=J.length>0&&b===J[J.length-1].ref.current;c.style.bottom="0px";const He=h.clientHeight-N.offsetTop-N.offsetHeight,gt=Math.max(fe,X+(Ve?ce:0)+He+re),Pt=he+gt;c.style.height=Pt+"px"}else{const Ve=J.length>0&&b===J[0].ref.current;c.style.top="0px";const gt=Math.max(W,R+N.offsetTop+(Ve?H:0)+X)+we;c.style.height=gt+"px",N.scrollTop=he-W+N.offsetTop}c.style.margin=`${fs}px 0`,c.style.minHeight=G+"px",c.style.maxHeight=ee+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,a.trigger,a.valueNode,c,h,N,b,k,a.dir,r]);Zn(()=>E(),[E]);const[T,I]=v.useState();Zn(()=>{h&&I(window.getComputedStyle(h).zIndex)},[h]);const O=v.useCallback(D=>{D&&w.current===!0&&(E(),C==null||C(),w.current=!1)},[E,C]);return s.jsx(PB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:O,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:s.jsx(dt.div,{...i,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});f4.displayName=IB;var RB="SelectPopperPosition",Nx=v.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=fs,...a}=t,o=$f(n);return s.jsx(xB,{...o,...a,ref:e,align:r,collisionPadding:i,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)"}})});Nx.displayName=RB;var[PB,J0]=Vl(ko,{}),jx="SelectViewport",p4=v.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,a=Ma(jx,n),o=J0(jx,n),c=St(e,a.onViewportChange),u=v.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(_f.Slot,{scope:n,children:s.jsx(dt.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:at(i.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 w=window.innerHeight-fs*2,N=parseFloat(m.style.minHeight),b=parseFloat(m.style.height),k=Math.max(N,b);if(k0?T:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});p4.displayName=jx;var m4="SelectGroup",[OB,DB]=Vl(m4),LB=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=ua();return s.jsx(OB,{scope:n,id:i,children:s.jsx(dt.div,{role:"group","aria-labelledby":i,...r,ref:e})})});LB.displayName=m4;var g4="SelectLabel",_B=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=DB(g4,n);return s.jsx(dt.div,{id:i.id,...r,ref:e})});_B.displayName=g4;var af="SelectItem",[zB,x4]=Vl(af),y4=v.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=t,c=Ta(af,n),u=Ma(af,n),h=c.value===r,[f,m]=v.useState(a??""),[g,y]=v.useState(!1),w=St(e,C=>{var E;return(E=u.itemRefCallback)==null?void 0:E.call(u,C,r,i)}),N=ua(),b=v.useRef("touch"),k=()=>{i||(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 s.jsx(zB,{scope:n,value:r,disabled:i,textId:N,isSelected:h,onItemTextChange:v.useCallback(C=>{m(E=>E||((C==null?void 0:C.textContent)??"").trim())},[]),children:s.jsx(_f.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:s.jsx(dt.div,{role:"option","aria-labelledby":N,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:w,onFocus:at(o.onFocus,()=>y(!0)),onBlur:at(o.onBlur,()=>y(!1)),onClick:at(o.onClick,()=>{b.current!=="mouse"&&k()}),onPointerUp:at(o.onPointerUp,()=>{b.current==="mouse"&&k()}),onPointerDown:at(o.onPointerDown,C=>{b.current=C.pointerType}),onPointerMove:at(o.onPointerMove,C=>{var E;b.current=C.pointerType,i?(E=u.onItemLeave)==null||E.call(u):b.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:at(o.onPointerLeave,C=>{var E;C.currentTarget===document.activeElement&&((E=u.onItemLeave)==null||E.call(u))}),onKeyDown:at(o.onKeyDown,C=>{var T;((T=u.searchRef)==null?void 0:T.current)!==""&&C.key===" "||(NB.includes(C.key)&&k(),C.key===" "&&C.preventDefault())})})})})});y4.displayName=af;var Rc="SelectItemText",v4=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...a}=t,o=Ta(Rc,n),c=Ma(Rc,n),u=x4(Rc,n),h=CB(Rc,n),[f,m]=v.useState(null),g=St(e,k=>m(k),u.onItemTextChange,k=>{var C;return(C=c.itemTextRefCallback)==null?void 0:C.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,w=v.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:N,onNativeOptionRemove:b}=h;return Zn(()=>(N(w),()=>b(w)),[N,b,w]),s.jsxs(s.Fragment,{children:[s.jsx(dt.span,{id:u.textId,...a,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?dd.createPortal(a.children,o.valueNode):null]})});v4.displayName=Rc;var b4="SelectItemIndicator",w4=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return x4(b4,n).isSelected?s.jsx(dt.span,{"aria-hidden":!0,...r,ref:e}):null});w4.displayName=b4;var kx="SelectScrollUpButton",N4=v.forwardRef((t,e)=>{const n=Ma(kx,t.__scopeSelect),r=J0(kx,t.__scopeSelect),[i,a]=v.useState(!1),o=St(e,r.onScrollButtonChange);return Zn(()=>{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]),i?s.jsx(k4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});N4.displayName=kx;var Sx="SelectScrollDownButton",j4=v.forwardRef((t,e)=>{const n=Ma(Sx,t.__scopeSelect),r=J0(Sx,t.__scopeSelect),[i,a]=v.useState(!1),o=St(e,r.onScrollButtonChange);return Zn(()=>{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]),i?s.jsx(k4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});j4.displayName=Sx;var k4=v.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,a=Ma("SelectScrollButton",n),o=v.useRef(null),c=zf(n),u=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>u(),[u]),Zn(()=>{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]),s.jsx(dt.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:at(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:at(i.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:at(i.onPointerLeave,()=>{u()})})}),$B="SelectSeparator",FB=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(dt.div,{"aria-hidden":!0,...r,ref:e})});FB.displayName=$B;var Cx="SelectArrow",BB=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=$f(n),a=Ta(Cx,n),o=Ma(Cx,n);return a.open&&o.position==="popper"?s.jsx(yB,{...i,...r,ref:e}):null});BB.displayName=Cx;var VB="SelectBubbleInput",S4=v.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=v.useRef(null),a=St(r,i),o=qx(e);return v.useEffect(()=>{const c=i.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]),s.jsx(dt.select,{...n,style:{...n4,...n.style},ref:a,defaultValue:e})});S4.displayName=VB;function C4(t){return t===""||t===void 0}function E4(t){const e=ga(t),n=v.useRef(""),r=v.useRef(0),i=v.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=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function T4(t,e,n){const i=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=HB(t,Math.max(a,0));i.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function HB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var WB=r4,M4=i4,UB=o4,KB=l4,qB=c4,A4=d4,GB=p4,I4=y4,JB=v4,YB=w4,QB=N4,XB=j4;const ul=WB,hl=UB,Xa=v.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(M4,{ref:r,className:Ct("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,s.jsx(KB,{asChild:!0,children:s.jsx(Gc,{className:"h-4 w-4 opacity-50"})})]}));Xa.displayName=M4.displayName;const Za=v.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>s.jsx(qB,{children:s.jsxs(A4,{ref:i,className:Ct("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:[s.jsx(QB,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(BN,{className:"h-4 w-4"})}),s.jsx(GB,{className:"p-1",children:e}),s.jsx(XB,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Gc,{className:"h-4 w-4"})})]})}));Za.displayName=A4.displayName;const Ir=v.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(I4,{ref:r,className:Ct("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:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(YB,{children:s.jsx(cf,{className:"h-4 w-4"})})}),s.jsx(JB,{children:e})]}));Ir.displayName=I4.displayName;function ZB(){const[t,e]=v.useState([]),[n,r]=v.useState(!0),[i,a]=v.useState(!1),[o,c]=v.useState(null),[u,h]=v.useState({name:"",appId:"",path:"",sort:0}),[f,m]=v.useState(!1);async function g(){r(!0);try{const k=await Le("/api/admin/linked-miniprograms");if(k!=null&&k.success&&Array.isArray(k.data)){const C=[...k.data].sort((E,T)=>(E.sort??0)-(T.sort??0));e(C)}}catch(k){console.error("Load linked miniprograms error:",k),ae.error("加载失败")}finally{r(!1)}}v.useEffect(()=>{g()},[]);function y(){c(null),h({name:"",appId:"",path:"",sort:t.length}),a(!0)}function w(k){c(k),h({name:k.name,appId:k.appId,path:k.path??"",sort:k.sort??0}),a(!0)}async function N(){const k=u.name.trim(),C=u.appId.trim();if(!k||!C){ae.error("请填写小程序名称和 AppID");return}m(!0);try{if(o){const E=await Mt("/api/admin/linked-miniprograms",{key:o.key,name:k,appId:C,path:u.path.trim(),sort:u.sort});E!=null&&E.success?(ae.success("已更新"),a(!1),g()):ae.error((E==null?void 0:E.error)??"更新失败")}else{const E=await wt("/api/admin/linked-miniprograms",{name:k,appId:C,path:u.path.trim(),sort:u.sort});E!=null&&E.success?(ae.success("已添加"),a(!1),g()):ae.error((E==null?void 0:E.error)??"添加失败")}}catch{ae.error("操作失败")}finally{m(!1)}}async function b(k){if(confirm(`确定要删除「${k.name}」吗?`))try{const C=await Ps(`/api/admin/linked-miniprograms/${k.key}`);C!=null&&C.success?(ae.success("已删除"),g()):ae.error((C==null?void 0:C.error)??"删除失败")}catch{ae.error("删除失败")}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(uo,{className:"w-5 h-5 text-[#38bdac]"}),"关联小程序管理"]}),s.jsx($t,{className:"text-gray-400",children:"添加后生成 32 位密钥,链接标签选择小程序时存密钥;小程序端点击 #标签 时用密钥查 appId 再跳转。需在 app.json 的 navigateToMiniProgramAppIdList 中配置目标 AppID。"})]}),s.jsxs(Ae,{children:[s.jsx("div",{className:"flex justify-end mb-4",children:s.jsxs(te,{onClick:y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"添加关联小程序"]})}),n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"名称"}),s.jsx(je,{className:"text-gray-400",children:"密钥"}),s.jsx(je,{className:"text-gray-400",children:"AppID"}),s.jsx(je,{className:"text-gray-400",children:"路径"}),s.jsx(je,{className:"text-gray-400 w-24",children:"排序"}),s.jsx(je,{className:"text-gray-400 w-32",children:"操作"})]})}),s.jsxs(nr,{children:[t.map(k=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-white",children:k.name}),s.jsx(xe,{className:"text-gray-300 font-mono text-xs",children:k.key}),s.jsx(xe,{className:"text-gray-300 font-mono text-sm",children:k.appId}),s.jsx(xe,{className:"text-gray-400 text-sm",children:k.path||"—"}),s.jsx(xe,{className:"text-gray-300",children:k.sort??0}),s.jsx(xe,{children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/20",onClick:()=>w(k),children:s.jsx(JN,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:bg-red-500/20",onClick:()=>b(k),children:s.jsx(Bn,{className:"w-4 h-4"})})]})})]},k.key)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无关联小程序,点击「添加关联小程序」开始配置"})})]})]})]})]}),s.jsx(Kt,{open:i,onOpenChange:a,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(qt,{className:"gap-1",children:[s.jsx(Gt,{className:"text-base",children:o?"编辑关联小程序":"添加关联小程序"}),s.jsx(Wx,{className:"text-gray-400 text-xs",children:"填写目标小程序的名称和 AppID,路径可选(为空则打开首页)"})]}),s.jsxs("div",{className:"space-y-3 py-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"小程序名称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"例如:Soul 创业派对",value:u.name,onChange:k=>h(C=>({...C,name:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"AppID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono h-8 text-sm",placeholder:"例如:wxb8bbb2b10dec74aa",value:u.appId,onChange:k=>h(C=>({...C,appId:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"路径(可选)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"例如:pages/index/index",value:u.path,onChange:k=>h(C=>({...C,path:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm w-20",value:u.sort,onChange:k=>h(C=>({...C,sort:parseInt(k.target.value,10)||0}))})]})]}),s.jsxs(hn,{className:"gap-2 pt-1",children:[s.jsx(te,{variant:"outline",onClick:()=>a(!1),className:"border-gray-600",children:"取消"}),s.jsx(te,{onClick:N,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:f?"保存中...":"保存"})]})]})})]})}const eV=["一","二","三","四","五","六","七","八","九","十"];function pg(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 tV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:i,onDeleteSection:a,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:w,pinnedSectionIds:N=[]}){const[b,k]=v.useState(null),[C,E]=v.useState(null),T=(_,J)=>(b==null?void 0:b.type)===_&&(b==null?void 0:b.id)===J,I=(_,J)=>(C==null?void 0:C.type)===_&&(C==null?void 0:C.id)===J,O=v.useCallback(()=>{const _=[];for(const J of t)for(const ee of J.chapters)for(const Y of ee.sections)_.push({id:Y.id,partId:J.id,partTitle:J.title,chapterId:ee.id,chapterTitle:ee.title});return _},[t]),D=v.useCallback(async(_,J,ee,Y)=>{var z;_.preventDefault(),_.stopPropagation();const U=_.dataTransfer.getData("text/plain"),R=pg(U);if(!R||R.type===J&&R.id===ee)return;const F=O(),re=new Map(F.map(ie=>[ie.id,ie]));if(R.type==="part"&&J==="part"){const ie=t.map(W=>W.id),G=ie.indexOf(R.id),$=ie.indexOf(ee);if(G===-1||$===-1)return;const H=[...ie];H.splice(G,1),H.splice(G<$?$-1:$,0,R.id);const ce=[];for(const W of H){const fe=t.find(X=>X.id===W);if(fe)for(const X of fe.chapters)for(const de of X.sections){const he=re.get(de.id);he&&ce.push(he)}}await r(ce);return}if(R.type==="chapter"&&(J==="chapter"||J==="section"||J==="part")){const ie=t.find(he=>he.chapters.some(we=>we.id===R.id)),G=ie==null?void 0:ie.chapters.find(he=>he.id===R.id);if(!ie||!G)return;let $,H,ce=null;if(J==="section"){const he=re.get(ee);if(!he)return;$=he.partId,H=he.partTitle,ce=ee}else if(J==="chapter"){const he=t.find(Ve=>Ve.chapters.some(He=>He.id===ee)),we=he==null?void 0:he.chapters.find(Ve=>Ve.id===ee);if(!he||!we)return;$=he.id,H=he.title;const Te=F.filter(Ve=>Ve.chapterId===ee).pop();ce=(Te==null?void 0:Te.id)??null}else{const he=t.find(Te=>Te.id===ee);if(!he||!he.chapters[0])return;$=he.id,H=he.title;const we=F.filter(Te=>Te.partId===he.id&&Te.chapterId===he.chapters[0].id);ce=((z=we[we.length-1])==null?void 0:z.id)??null}const W=G.sections.map(he=>he.id),fe=F.filter(he=>!W.includes(he.id));let X=fe.length;if(ce){const he=fe.findIndex(we=>we.id===ce);he>=0&&(X=he+1)}const de=W.map(he=>({...re.get(he),partId:$,partTitle:H,chapterId:G.id,chapterTitle:G.title}));await r([...fe.slice(0,X),...de,...fe.slice(X)]);return}if(R.type==="section"&&(J==="section"||J==="chapter"||J==="part")){if(!Y)return;const{partId:ie,partTitle:G,chapterId:$,chapterTitle:H}=Y;let ce;if(J==="section")ce=F.findIndex(we=>we.id===ee);else if(J==="chapter"){const we=F.filter(Te=>Te.chapterId===ee).pop();ce=we?F.findIndex(Te=>Te.id===we.id)+1:F.length}else{const we=t.find(He=>He.id===ee);if(!(we!=null&&we.chapters[0]))return;const Te=F.filter(He=>He.partId===we.id&&He.chapterId===we.chapters[0].id),Ve=Te[Te.length-1];ce=Ve?F.findIndex(He=>He.id===Ve.id)+1:0}const W=F.findIndex(we=>we.id===R.id);if(W===-1)return;const fe=F.filter(we=>we.id!==R.id),X=W({onDragEnter:Y=>{Y.preventDefault(),Y.stopPropagation(),Y.dataTransfer.dropEffect="move",E({type:_,id:J})},onDragOver:Y=>{Y.preventDefault(),Y.stopPropagation(),Y.dataTransfer.dropEffect="move",E({type:_,id:J})},onDragLeave:()=>E(null),onDrop:Y=>{E(null);const U=pg(Y.dataTransfer.getData("text/plain"));if(U&&!(_==="section"&&U.type==="section"&&U.id===J))if(_==="part")if(U.type==="part")D(Y,"part",J);else{const R=t.find(re=>re.id===J);(R==null?void 0:R.chapters[0])&&ee&&D(Y,"part",J,ee)}else _==="chapter"&&ee?(U.type==="section"||U.type==="chapter")&&D(Y,"chapter",J,ee):_==="section"&&ee&&D(Y,"section",J,ee)}}),L=_=>eV[_]??String(_+1);return s.jsx("div",{className:"space-y-3",children:t.map((_,J)=>{var G,$,H,ce;const ee=_.title==="序言"||_.title.includes("序言"),Y=_.title==="尾声"||_.title.includes("尾声"),U=_.title==="附录"||_.title.includes("附录"),R=I("part",_.id),F=e.includes(_.id),re=_.chapters.length,z=_.chapters.reduce((W,fe)=>W+fe.sections.length,0);if(ee&&_.chapters.length===1&&_.chapters[0].sections.length===1){const W=_.chapters[0].sections[0],fe=I("section",W.id),X={partId:_.id,partTitle:_.title,chapterId:_.chapters[0].id,chapterTitle:_.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+W.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:W.id})},onDragEnd:()=>{k(null),E(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",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",W.id,X),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(oi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(W.id),onChange:()=>y(W.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Yr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[_.chapters[0].title," | ",W.title]}),N.includes(W.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(ml,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[W.price===0||W.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",W.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",W.clickCount??0," · 付款 ",W.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(W.hotScore??0).toFixed(1)," · 第",W.hotRank&&W.hotRank>0?W.hotRank:"-","名"]}),w&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>w(W),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(W),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)}if(_.title==="2026每日派对干货"||_.title.includes("2026每日派对干货")){const W=I("part",_.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${W?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...P("part",_.id,{partId:_.id,partTitle:_.title,chapterId:((G=_.chapters[0])==null?void 0:G.id)??"",chapterTitle:(($=_.chapters[0])==null?void 0:$.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:fe=>{fe.stopPropagation(),fe.dataTransfer.setData("text/plain","part:"+_.id),fe.dataTransfer.effectAllowed="move",k({type:"part",id:_.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(_.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(oi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:_.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",z," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:fe=>fe.stopPropagation(),onClick:fe=>fe.stopPropagation(),children:[o&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(dn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),f&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(_),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[re,"章"]}),F?s.jsx(Gc,{className:"w-5 h-5 text-gray-500"}):s.jsx(fl,{className:"w-5 h-5 text-gray-500"})]})]}),F&&_.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:_.chapters.map(fe=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:fe.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:X=>X.stopPropagation(),children:[m&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>m(_,fe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),c&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>c(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(dn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>u(_,fe),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:fe.sections.map(X=>{const de=I("section",X.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+X.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:X.id})},onDragEnd:()=>{k(null),E(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 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",X.id,{partId:_.id,partTitle:_.title,chapterId:fe.id,chapterTitle:fe.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(X.id),onChange:()=>y(X.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[X.id," ",X.title]}),N.includes(X.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(ml,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),w&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(X),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]},X.id)})})]},fe.id))})]},_.id)}if(U)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:_.chapters.map((W,fe)=>W.sections.length>0?W.sections.map(X=>{const de=I("section",X.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+X.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:X.id})},onDragEnd:()=>{k(null),E(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 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",X.id,{partId:_.id,partTitle:_.title,chapterId:W.id,chapterTitle:W.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(X.id),onChange:()=>y(X.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",fe+1," | ",W.title," | ",X.title]}),N.includes(X.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(ml,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),w&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(X),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(fl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},X.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",fe+1," | ",W.title,"(空)"]}),s.jsx(fl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},W.id))})]},_.id);if(Y&&_.chapters.length===1&&_.chapters[0].sections.length===1){const W=_.chapters[0].sections[0],fe=I("section",W.id),X={partId:_.id,partTitle:_.title,chapterId:_.chapters[0].id,chapterTitle:_.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+W.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:W.id})},onDragEnd:()=>{k(null),E(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",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",W.id,X),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(oi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(W.id),onChange:()=>y(W.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Yr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[_.chapters[0].title," | ",W.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[W.price===0||W.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",W.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",W.clickCount??0," · 付款 ",W.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(W.hotScore??0).toFixed(1)," · 第",W.hotRank&&W.hotRank>0?W.hotRank:"-","名"]}),w&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>w(W),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(W),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)}return Y?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:_.chapters.map(W=>W.sections.map(fe=>{const X=I("section",fe.id);return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+fe.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:fe.id})},onDragEnd:()=>{k(null),E(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 ${X?"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:_.id,partTitle:_.title,chapterId:W.id,chapterTitle:W.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.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]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[W.title," | ",fe.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",fe.clickCount??0," · 付款 ",fe.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(fe.hotScore??0).toFixed(1)," · 第",fe.hotRank&&fe.hotRank>0?fe.hotRank:"-","名"]}),w&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>w(fe),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(fe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(fe),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]})]},fe.id)}))})]},_.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${R?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...P("part",_.id,{partId:_.id,partTitle:_.title,chapterId:((H=_.chapters[0])==null?void 0:H.id)??"",chapterTitle:((ce=_.chapters[0])==null?void 0:ce.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:W=>{W.stopPropagation(),W.dataTransfer.setData("text/plain","part:"+_.id),W.dataTransfer.effectAllowed="move",k({type:"part",id:_.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(_.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(oi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.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:L(J)}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:_.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",z," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:W=>W.stopPropagation(),onClick:W=>W.stopPropagation(),children:[o&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(dn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),f&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(_),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[re,"章"]}),F?s.jsx(Gc,{className:"w-5 h-5 text-gray-500"}):s.jsx(fl,{className:"w-5 h-5 text-gray-500"})]})]}),F&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:_.chapters.map(W=>{const fe=I("chapter",W.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:X=>{X.stopPropagation(),X.dataTransfer.setData("text/plain","chapter:"+W.id),X.dataTransfer.effectAllowed="move",k({type:"chapter",id:W.id})},onDragEnd:()=>{k(null),E(null)},onDragEnter:X=>{X.preventDefault(),X.stopPropagation(),X.dataTransfer.dropEffect="move",E({type:"chapter",id:W.id})},onDragOver:X=>{X.preventDefault(),X.stopPropagation(),X.dataTransfer.dropEffect="move",E({type:"chapter",id:W.id})},onDragLeave:()=>E(null),onDrop:X=>{E(null);const de=pg(X.dataTransfer.getData("text/plain"));if(!de)return;const he={partId:_.id,partTitle:_.title,chapterId:W.id,chapterTitle:W.title};(de.type==="section"||de.type==="chapter")&&D(X,"chapter",W.id,he)},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",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:W.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:X=>X.stopPropagation(),children:[m&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>m(_,W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),c&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>c(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(dn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>u(_,W),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:W.sections.map(X=>{const de=I("section",X.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+X.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:X.id})},onDragEnd:()=>{k(null),E(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 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...P("section",X.id,{partId:_.id,partTitle:_.title,chapterId:W.id,chapterTitle:W.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(X.id),onChange:()=>y(X.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${X.price===0||X.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[X.id," ",X.title]}),N.includes(X.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(ml,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:he=>he.stopPropagation(),onClick:he=>he.stopPropagation(),children:[X.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),X.price===0||X.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",X.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),w&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(X),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Bn,{className:"w-3.5 h-3.5"})})]})]})]},X.id)})})]},W.id)})})]},_.id)})})}function nV(t){var i;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(i=t==null?void 0:t.keyword)!=null&&i.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString(),r=n?`/api/admin/ckb/devices?${n}`:"/api/admin/ckb/devices";return Le(r)}function rV(t){return Le(`/api/db/person?personId=${encodeURIComponent(t)}`)}const R4=11,fN={personId:"",name:"",label:"",sceneId:R4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"09:00",endTime:"18:00",deviceGroups:""};function sV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){const i=!!n,[a,o]=v.useState(fN),[c,u]=v.useState(!1),[h,f]=v.useState(!1),[m,g]=v.useState([]),[y,w]=v.useState(!1),[N,b]=v.useState(""),[k,C]=v.useState({});v.useEffect(()=>{t&&(b(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",label:n.label??"",sceneId:R4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"09:00",endTime:n.endTime??"18:00",deviceGroups:n.deviceGroups??""}:{...fN}),C({}),m.length===0&&E(""))},[t,n]);const E=async I=>{w(!0);try{const O=await nV({page:1,limit:50,keyword:I});O!=null&&O.success&&Array.isArray(O.devices)?g(O.devices):O!=null&&O.error&&ae.error(O.error)}catch(O){ae.error(O instanceof Error?O.message:"加载设备列表失败")}finally{w(!1)}},T=async()=>{var P;const I={};(!a.name||!String(a.name).trim())&&(I.name="请填写名称");const O=a.addFriendInterval;if((typeof O!="number"||O<1)&&(I.addFriendInterval="添加间隔至少为 1 分钟"),(((P=a.deviceGroups)==null?void 0:P.split(",").map(L=>L.trim()).filter(Boolean))??[]).length===0&&(I.deviceGroups="请至少选择 1 台设备"),C(I),Object.keys(I).length>0){ae.error(I.name||I.addFriendInterval||I.deviceGroups||"请完善必填项");return}u(!0);try{await r(a),e(!1)}catch(L){ae.error(L instanceof Error?L.message:"保存失败")}finally{u(!1)}};return s.jsx(Kt,{open:t,onOpenChange:e,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(qt,{children:[s.jsx(Gt,{className:"text-[#38bdac]",children:i?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(Wx,{className:"text-gray-400 text-sm",children:i?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Z,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(oe,{className:`bg-[#0a1628] text-white ${k.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:a.name,onChange:I=>{o(O=>({...O,name:I.target.value})),k.name&&C(O=>({...O,name:void 0}))}}),k.name&&s.jsx("p",{className:"text-xs text-red-400",children:k.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:a.personId,onChange:I=>o(O=>({...O,personId:I.target.value})),disabled:i})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:a.label,onChange:I=>o(O=>({...O,label:I.target.value}))})]})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-4",children:"存客宝 API 获客配置"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"存客宝密钥(计划 apiKey)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创建计划成功后自动回填,不可手动修改",value:a.ckbApiKey,readOnly:!0}),s.jsx("p",{className:"text-xs text-gray-500",children:"由存客宝计划详情接口返回的 apiKey,用于小程序 @人物 时推送到对应获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Z,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${k.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(oe,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:a.deviceGroups?`已选择 ${a.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(te,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),k.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:k.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(ul,{value:a.remarkType,onValueChange:I=>o(O=>({...O,remarkType:I})),children:[s.jsx(Xa,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{placeholder:"选择备注类型"})}),s.jsxs(Za,{children:[s.jsx(Ir,{value:"phone",children:"手机号"}),s.jsx(Ir,{value:"nickname",children:"昵称"}),s.jsx(Ir,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"备注格式"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 手机号+SOUL链接人与事-{名称},留空用默认",value:a.remarkFormat,onChange:I=>o(O=>({...O,remarkFormat:I.target.value}))})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:a.greeting,onChange:I=>o(O=>({...O,greeting:I.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(oe,{type:"number",min:1,className:`bg-[#0a1628] text-white ${k.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:a.addFriendInterval,onChange:I=>{o(O=>({...O,addFriendInterval:Number(I.target.value)||1})),k.addFriendInterval&&C(O=>({...O,addFriendInterval:void 0}))}}),k.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:k.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(oe,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:a.startTime,onChange:I=>o(O=>({...O,startTime:I.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(oe,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:a.endTime,onChange:I=>o(O=>({...O,endTime:I.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(_l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:a.tips,onChange:I=>o(O=>({...O,tips:I.target.value}))})]})]})]})]})]}),s.jsxs(hn,{className:"gap-3 pt-2",children:[s.jsx(te,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(te,{onClick:T,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:c?"保存中...":i?"保存":"添加"})]}),h&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(oe,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:N,onChange:I=>b(I.target.value),onKeyDown:I=>{I.key==="Enter"&&E(N)}}),s.jsx(te,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>E(N),disabled:y,children:"刷新"}),s.jsx(te,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>f(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:y?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):m.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:m.map(I=>{const O=String(I.id??""),D=a.deviceGroups?a.deviceGroups.split(",").map(_=>_.trim()).filter(Boolean):[],P=D.includes(O),L=()=>{let _;P?_=D.filter(J=>J!==O):_=[...D,O],o(J=>({...J,deviceGroups:_.join(",")})),_.length>0&&C(J=>({...J,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:P,onChange:L}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:I.memo||I.wechatId||`设备 ${O}`}),I.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),I.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",O]}),I.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",I.wechatId]}),typeof I.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",I.totalFriend]})]})]})]},O)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",a.deviceGroups?a.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(te,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(te,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}function pN(t,e,n){if(!t||!t.includes("@")&&!t.includes("#")||typeof document>"u")return t;const r=document.createElement("div");r.innerHTML=t;const i=u=>e.find(h=>h.name===u),a=u=>n.find(h=>h.label===u),o=u=>{const h=u.textContent||"";if(!h||!h.includes("@")&&!h.includes("#"))return;const f=u.parentNode;if(!f)return;const m=document.createDocumentFragment(),g=/(@[^\s@#]+|#[^\s@#]+)/g;let y=0,w;for(;w=g.exec(h);){const[N]=w,b=w.index;if(b>y&&m.appendChild(document.createTextNode(h.slice(y,b))),N.startsWith("@")){const k=N.slice(1),C=i(k);if(C){const E=document.createElement("span");E.setAttribute("data-type","mention"),E.setAttribute("data-id",C.id),E.className="mention-tag",E.textContent=`@${C.name}`,m.appendChild(E)}else m.appendChild(document.createTextNode(N))}else if(N.startsWith("#")){const k=N.slice(1),C=a(k);if(C){const E=document.createElement("span");E.setAttribute("data-type","linkTag"),E.setAttribute("data-url",C.url||""),E.setAttribute("data-tag-type",C.type||"url"),E.setAttribute("data-tag-id",C.id||""),E.setAttribute("data-page-path",C.pagePath||""),E.setAttribute("data-app-id",C.appId||""),C.type==="miniprogram"&&C.appId&&E.setAttribute("data-mp-key",C.appId),E.className="link-tag-node",E.textContent=`#${C.label}`,m.appendChild(E)}else m.appendChild(document.createTextNode(N))}else m.appendChild(document.createTextNode(N));y=b+N.length}y{if(u.nodeType===Node.ELEMENT_NODE){const f=u.getAttribute("data-type");if(f==="mention"||f==="linkTag")return;u.childNodes.forEach(m=>c(m));return}u.nodeType===Node.TEXT_NODE&&o(u)};return r.childNodes.forEach(u=>c(u)),r.innerHTML}function iV(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,mid:c.mid,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 aV(){var Po,yt,Ul;const[t,e]=v.useState([]),[n,r]=v.useState(!0),[i,a]=v.useState([]),[o,c]=v.useState(null),[u,h]=v.useState(!1),[f,m]=v.useState(!1),[g,y]=v.useState(!1),[w,N]=v.useState(""),[b,k]=v.useState([]),[C,E]=v.useState(!1),[T,I]=v.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[O,D]=v.useState(null),[P,L]=v.useState(!1),[_,J]=v.useState(!1),[ee,Y]=v.useState(null),[U,R]=v.useState(!1),[F,re]=v.useState([]),[z,ie]=v.useState(!1),[G,$]=v.useState(""),[H,ce]=v.useState(""),[W,fe]=v.useState(!1),[X,de]=v.useState(""),[he,we]=v.useState(!1),[Te,Ve]=v.useState(null),[He,gt]=v.useState(!1),[Pt,yn]=v.useState(!1),[ht,At]=v.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[ne,Pe]=v.useState(!1),[Qe,xt]=v.useState(!1),[ft,pt]=v.useState(1),[Nt,Xt]=v.useState([]),[Ot,Tn]=v.useState(!1),[Dt,Kn]=v.useState([]),[Zr,ar]=v.useState(!1),[me,ve]=v.useState(20),[or,Hs]=v.useState(!1),[ki,Si]=v.useState(!1),[Sr,Aa]=v.useState([]),[_r,es]=v.useState([]),[lr,Ci]=v.useState(!1),[Ia,Ws]=v.useState(null),[ot,Ln]=v.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),[ts,Cr]=v.useState(null),ns=v.useRef(null),rn=iV(t),zr=t.length,Us=10,$r=Math.max(1,Math.ceil(Nt.length/Us)),Ks=Nt.slice((ft-1)*Us,ft*Us),jn=async()=>{r(!0);try{const M=await Le("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(M==null?void 0:M.sections)?M.sections:[])}catch(M){console.error(M),e([])}finally{r(!1)}},rs=async()=>{Tn(!0);try{const M=await Le("/api/db/book?action=ranking",{cache:"no-store"}),q=Array.isArray(M==null?void 0:M.sections)?M.sections:[];Xt(q);const pe=q.filter(ye=>ye.isPinned).map(ye=>ye.id);Kn(pe)}catch(M){console.error(M),Xt([])}finally{Tn(!1)}};v.useEffect(()=>{jn(),rs()},[]);const Hl=M=>{a(q=>q.includes(M)?q.filter(pe=>pe!==M):[...q,M])},Ei=v.useCallback(M=>{const q=t,pe=M.flatMap(ye=>{const nt=q.find(bt=>bt.id===ye.id);return nt?[{...nt,partId:ye.partId,partTitle:ye.partTitle,chapterId:ye.chapterId,chapterTitle:ye.chapterTitle}]:[]});return e(pe),Mt("/api/db/book",{action:"reorder",items:M}).then(ye=>{ye&&ye.success===!1&&(e(q),ae.error("排序失败: "+(ye&&typeof ye=="object"&&"error"in ye?ye.error:"未知错误")))}).catch(ye=>{e(q),console.error("排序失败:",ye),ae.error("排序失败: "+(ye instanceof Error?ye.message:"网络或服务异常"))}),Promise.resolve()},[t]),qs=async M=>{if(confirm(`确定要删除章节「${M.title}」吗?此操作不可恢复。`))try{const q=await Ps(`/api/db/book?id=${encodeURIComponent(M.id)}`);q&&q.success!==!1?(ae.success("已删除"),jn(),rs()):ae.error("删除失败: "+(q&&typeof q=="object"&&"error"in q?q.error:"未知错误"))}catch(q){console.error(q),ae.error("删除失败")}},mr=v.useCallback(async()=>{Pe(!0);try{const M=await Le("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),q=M&&M.data;q&&typeof q.readWeight=="number"&&typeof q.recencyWeight=="number"&&typeof q.payWeight=="number"&&At({readWeight:Math.max(0,Math.min(1,q.readWeight)),recencyWeight:Math.max(0,Math.min(1,q.recencyWeight)),payWeight:Math.max(0,Math.min(1,q.payWeight))})}catch{}finally{Pe(!1)}},[]);v.useEffect(()=>{Pt&&mr()},[Pt,mr]);const Ra=async()=>{const{readWeight:M,recencyWeight:q,payWeight:pe}=ht,ye=M+q+pe;if(Math.abs(ye-1)>.001){ae.error("三个权重之和必须等于 1");return}xt(!0);try{const nt=await wt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:M,recencyWeight:q,payWeight:pe},description:"文章排名算法权重"});nt&&nt.success!==!1?(ae.success("排名权重已保存"),yn(!1),jn(),rs()):ae.error("保存失败: "+(nt&&typeof nt=="object"&&"error"in nt?nt.error:""))}catch(nt){console.error(nt),ae.error("保存失败")}finally{xt(!1)}},Ti=v.useCallback(async()=>{ar(!0);try{const M=await Le("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),q=M&&M.data;Array.isArray(q)&&Kn(q)}catch{}finally{ar(!1)}},[]),Gs=v.useCallback(async()=>{try{const M=await Le("/api/db/persons");M!=null&&M.success&&M.persons&&Aa(M.persons.map(q=>{const pe=q.deviceGroups,ye=Array.isArray(pe)?pe.join(","):pe??"";return{id:q.token??q.personId??"",personId:q.personId,name:q.name,label:q.label??"",ckbApiKey:q.ckbApiKey??"",ckbPlanId:q.ckbPlanId,remarkType:q.remarkType,remarkFormat:q.remarkFormat,addFriendInterval:q.addFriendInterval,startTime:q.startTime,endTime:q.endTime,deviceGroups:ye}}))}catch{}},[]),Ns=v.useCallback(async()=>{try{const M=await Le("/api/db/link-tags");M!=null&&M.success&&M.linkTags&&es(M.linkTags.map(q=>({id:q.tagId,label:q.label,url:q.url,type:q.type||"url",appId:q.appId||"",pagePath:q.pagePath||""})))}catch{}},[]),[Mi,To]=v.useState([]),[js,Pa]=v.useState(""),[Mo,Tt]=v.useState(!1),Ao=v.useRef(null),Js=v.useCallback(async()=>{try{const M=await Le("/api/admin/linked-miniprograms");M!=null&&M.success&&Array.isArray(M.data)&&To(M.data.map(q=>({...q,key:q.key})))}catch{}},[]),Ai=Mi.filter(M=>!js.trim()||M.name.toLowerCase().includes(js.toLowerCase())||M.key&&M.key.toLowerCase().includes(js.toLowerCase())||M.appId.toLowerCase().includes(js.toLowerCase())),ks=async M=>{const q=Dt.includes(M)?Dt.filter(pe=>pe!==M):[...Dt,M];Kn(q);try{await wt("/api/db/config",{key:"pinned_section_ids",value:q,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),rs()}catch{Kn(Dt)}},Oa=v.useCallback(async()=>{Hs(!0);try{const M=await Le("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),q=M&&M.data;typeof q=="number"&&q>0&&q<=100&&ve(q)}catch{}finally{Hs(!1)}},[]),Da=async()=>{if(me<1||me>100){ae.error("预览比例需在 1~100 之间");return}Si(!0);try{const M=await wt("/api/db/config",{key:"unpaid_preview_percent",value:me,description:"小程序未付费内容默认预览比例(%)"});M&&M.success!==!1?ae.success("预览比例已保存"):ae.error("保存失败: "+(M.error||""))}catch{ae.error("保存失败")}finally{Si(!1)}};v.useEffect(()=>{Ti(),Oa(),Gs(),Ns(),Js()},[Ti,Oa,Gs,Ns,Js]);const V=async M=>{Ve({section:M,orders:[]}),gt(!0);try{const q=await Le(`/api/db/book?action=section-orders&id=${encodeURIComponent(M.id)}`),pe=q!=null&&q.success&&Array.isArray(q.orders)?q.orders:[];Ve(ye=>ye?{...ye,orders:pe}:null)}catch(q){console.error(q),Ve(pe=>pe?{...pe,orders:[]}:null)}finally{gt(!1)}},Re=async M=>{m(!0);try{const q=M.mid!=null&&M.mid>0?`/api/db/book?action=read&mid=${M.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(M.id)}`,pe=await Le(q);if(pe!=null&&pe.success&&pe.section){const ye=pe.section,nt=ye.editionPremium===!0;c({id:M.id,originalId:M.id,title:pe.section.title??M.title,price:pe.section.price??M.price,content:pe.section.content??"",filePath:M.filePath,isFree:M.isFree||M.price===0,isNew:ye.isNew??M.isNew,isPinned:Dt.includes(M.id),hotScore:M.hotScore??0,editionStandard:nt?!1:ye.editionStandard??!0,editionPremium:nt})}else c({id:M.id,originalId:M.id,title:M.title,price:M.price,content:"",filePath:M.filePath,isFree:M.isFree,isNew:M.isNew,isPinned:Dt.includes(M.id),hotScore:M.hotScore??0,editionStandard:!0,editionPremium:!1}),pe&&!pe.success&&ae.error("无法读取文件内容: "+(pe.error||"未知错误"))}catch(q){console.error(q),c({id:M.id,title:M.title,price:M.price,content:"",filePath:M.filePath,isFree:M.isFree})}finally{m(!1)}},Xe=async()=>{var M;if(o){y(!0);try{let q=o.content||"";q=pN(q,Sr,_r);const pe=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(M=o.title)==null?void 0:M.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const an of pe)q=q.replace(an,"");q=q.replace(/^\s*\n+/,"").trim();const ye=o.originalId||o.id,nt=o.id!==ye,bt=await Mt("/api/db/book",{id:ye,...nt?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:q,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},{timeout:zb}),sn=nt?o.id:ye;o.isPinned!==Dt.includes(sn)&&await ks(sn),bt&&bt.success!==!1?(ae.success(`已保存:${o.title}`),c(null),jn()):ae.error("保存失败: "+(bt&&typeof bt=="object"&&"error"in bt?bt.error:"未知错误"))}catch(q){console.error(q);const pe=q instanceof Error&&q.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";ae.error(pe)}finally{y(!1)}}},et=async()=>{if(!T.id||!T.title){ae.error("请填写章节ID和标题");return}y(!0);try{const M=rn.find(ye=>ye.id===T.partId),q=M==null?void 0:M.chapters.find(ye=>ye.id===T.chapterId),pe=await Mt("/api/db/book",{id:T.id,title:T.title,price:T.isFree?0:T.price,content:pN(T.content||"",Sr,_r),partId:T.partId,partTitle:(M==null?void 0:M.title)??"",chapterId:T.chapterId,chapterTitle:(q==null?void 0:q.title)??"",isFree:T.isFree,isNew:T.isNew,editionStandard:T.editionPremium?!1:T.editionStandard??!0,editionPremium:T.editionPremium??!1,hotScore:T.hotScore??0,saveToFile:!1},{timeout:zb});if(pe&&pe.success!==!1){if(T.isPinned){const ye=[...Dt,T.id];Kn(ye);try{await wt("/api/db/config",{key:"pinned_section_ids",value:ye,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}ae.success(`章节创建成功:${T.title}`),h(!1),I({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),jn()}else ae.error("创建失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(M){console.error(M),ae.error("创建失败")}finally{y(!1)}},Mn=M=>{I(q=>{var pe;return{...q,partId:M.id,chapterId:((pe=M.chapters[0])==null?void 0:pe.id)??"chapter-1"}}),h(!0)},cr=M=>{D({id:M.id,title:M.title})},Io=async()=>{var M;if((M=O==null?void 0:O.title)!=null&&M.trim()){L(!0);try{const q=t.map(ye=>({id:ye.id,partId:ye.partId||"part-1",partTitle:ye.partId===O.id?O.title.trim():ye.partTitle||"",chapterId:ye.chapterId||"chapter-1",chapterTitle:ye.chapterTitle||""})),pe=await Mt("/api/db/book",{action:"reorder",items:q});if(pe&&pe.success!==!1){const ye=O.title.trim();e(nt=>nt.map(bt=>bt.partId===O.id?{...bt,partTitle:ye}:bt)),D(null),jn()}else ae.error("更新篇名失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(q){console.error(q),ae.error("更新篇名失败")}finally{L(!1)}}},Jt=M=>{const q=M.chapters.length+1,pe=`chapter-${M.id}-${q}-${Date.now()}`;I({id:`${q}.1`,title:"新章节",price:1,partId:M.id,chapterId:pe,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},_n=(M,q)=>{Y({part:M,chapter:q,title:q.title})},ss=async()=>{var M;if((M=ee==null?void 0:ee.title)!=null&&M.trim()){R(!0);try{const q=t.map(ye=>({id:ye.id,partId:ye.partId||ee.part.id,partTitle:ye.partId===ee.part.id?ee.part.title:ye.partTitle||"",chapterId:ye.chapterId||ee.chapter.id,chapterTitle:ye.partId===ee.part.id&&ye.chapterId===ee.chapter.id?ee.title.trim():ye.chapterTitle||""})),pe=await Mt("/api/db/book",{action:"reorder",items:q});if(pe&&pe.success!==!1){const ye=ee.title.trim(),nt=ee.part.id,bt=ee.chapter.id;e(sn=>sn.map(an=>an.partId===nt&&an.chapterId===bt?{...an,chapterTitle:ye}:an)),Y(null),jn()}else ae.error("保存失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(q){console.error(q),ae.error("保存失败")}finally{R(!1)}}},Ss=async(M,q)=>{const pe=q.sections.map(ye=>ye.id);if(pe.length===0){ae.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${M.chapters.indexOf(q)+1}章 | ${q.title}」吗?将删除共 ${pe.length} 节,此操作不可恢复。`))try{for(const ye of pe)await Ps(`/api/db/book?id=${encodeURIComponent(ye)}`);jn()}catch(ye){console.error(ye),ae.error("删除失败")}},Ys=async()=>{if(!X.trim()){ae.error("请输入篇名");return}we(!0);try{const M=`part-new-${Date.now()}`,q="chapter-1",pe=`part-placeholder-${Date.now()}`,ye=await Mt("/api/db/book",{id:pe,title:"占位节(可编辑)",price:0,content:"",partId:M,partTitle:X.trim(),chapterId:q,chapterTitle:"第1章 | 待编辑",saveToFile:!1});ye&&ye.success!==!1?(ae.success(`篇「${X}」创建成功`),J(!1),de(""),jn()):ae.error("创建失败: "+(ye&&typeof ye=="object"&&"error"in ye?ye.error:"未知错误"))}catch(M){console.error(M),ae.error("创建失败")}finally{we(!1)}},Wl=async()=>{if(F.length===0){ae.error("请先勾选要移动的章节");return}const M=rn.find(pe=>pe.id===G),q=M==null?void 0:M.chapters.find(pe=>pe.id===H);if(!M||!q||!G||!H){ae.error("请选择目标篇和章");return}fe(!0);try{const pe=()=>{const sn=new Set(F),an=t.map(on=>({id:on.id,partId:on.partId||"",partTitle:on.partTitle||"",chapterId:on.chapterId||"",chapterTitle:on.chapterTitle||""})),Cs=an.filter(on=>sn.has(on.id)).map(on=>({...on,partId:G,partTitle:M.title||G,chapterId:H,chapterTitle:q.title||H})),gr=an.filter(on=>!sn.has(on.id));let Xs=gr.length;for(let on=gr.length-1;on>=0;on-=1){const is=gr[on];if(is.partId===G&&is.chapterId===H){Xs=on+1;break}}return[...gr.slice(0,Xs),...Cs,...gr.slice(Xs)]},ye=async()=>{const sn=pe(),an=await Mt("/api/db/book",{action:"reorder",items:sn});return an&&an.success!==!1?(ae.success(`已移动 ${F.length} 节到「${M.title}」-「${q.title}」`),ie(!1),re([]),await jn(),!0):!1},nt={action:"move-sections",sectionIds:F,targetPartId:G,targetChapterId:H,targetPartTitle:M.title||G,targetChapterTitle:q.title||H},bt=await Mt("/api/db/book",nt);if(bt&&bt.success!==!1)ae.success(`已移动 ${bt.count??F.length} 节到「${M.title}」-「${q.title}」`),ie(!1),re([]),await jn();else{const sn=bt&&typeof bt=="object"&&"error"in bt?bt.error||"":"未知错误";if((sn.includes("缺少 id")||sn.includes("无效的 action"))&&await ye())return;ae.error("移动失败: "+sn)}}catch(pe){console.error(pe),ae.error("移动失败: "+(pe instanceof Error?pe.message:"网络或服务异常"))}finally{fe(!1)}},La=M=>{re(q=>q.includes(M)?q.filter(pe=>pe!==M):[...q,M])},Ii=async M=>{const q=t.filter(pe=>pe.partId===M.id).map(pe=>pe.id);if(q.length===0){ae.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${M.title}」整篇吗?将删除共 ${q.length} 节内容,此操作不可恢复。`))try{for(const pe of q)await Ps(`/api/db/book?id=${encodeURIComponent(pe)}`);jn()}catch(pe){console.error(pe),ae.error("删除失败")}},Ro=async()=>{var M;if(w.trim()){E(!0);try{const q=await Le(`/api/search?q=${encodeURIComponent(w)}`);q!=null&&q.success&&((M=q.data)!=null&&M.results)?k(q.data.results):(k([]),q&&!q.success&&ae.error("搜索失败: "+q.error))}catch(q){console.error(q),k([]),ae.error("搜索失败")}finally{E(!1)}}},Qs=rn.find(M=>M.id===T.partId),vd=(Qs==null?void 0:Qs.chapters)??[];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",rn.length," 篇 · ",zr," 节内容"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(te,{onClick:()=>yn(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(wu,{className:"w-4 h-4 mr-2"}),"排名算法"]}),s.jsxs(te,{onClick:()=>{const M=typeof window<"u"?`${window.location.origin}/api-doc`:"";M&&window.open(M,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(gs,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),s.jsx(Kt,{open:u,onOpenChange:h,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(qt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(dn,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节ID *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:T.id,onChange:M=>I({...T,id:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:T.isFree?0:T.price,onChange:M=>I({...T,price:Number(M.target.value),isFree:Number(M.target.value)===0}),disabled:T.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isFree,onChange:M=>I({...T,isFree:M.target.checked,price:M.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isNew,onChange:M=>I({...T,isNew:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isPinned,onChange:M=>I({...T,isPinned:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium!==!0,onChange:()=>I({...T,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium===!0,onChange:()=>I({...T,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"热度分"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:T.hotScore??0,onChange:M=>I({...T,hotScore:Math.max(0,parseFloat(M.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:T.title,onChange:M=>I({...T,title:M.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"所属篇"}),s.jsxs(ul,{value:T.partId,onValueChange:M=>{var pe;const q=rn.find(ye=>ye.id===M);I({...T,partId:M,chapterId:((pe=q==null?void 0:q.chapters[0])==null?void 0:pe.id)??"chapter-1"})},children:[s.jsx(Xa,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{})}),s.jsxs(Za,{className:"bg-[#0f2137] border-gray-700",children:[rn.map(M=>s.jsx(Ir,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id)),rn.length===0&&s.jsx(Ir,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"所属章"}),s.jsxs(ul,{value:T.chapterId,onValueChange:M=>I({...T,chapterId:M}),children:[s.jsx(Xa,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{})}),s.jsxs(Za,{className:"bg-[#0f2137] border-gray-700",children:[vd.map(M=>s.jsx(Ir,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id)),vd.length===0&&s.jsx(Ir,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(yx,{content:T.content||"",onChange:M=>I({...T,content:M}),onImageUpload:async M=>{var nt;const q=new FormData;q.append("file",M),q.append("folder","book-images");const ye=await(await fetch(ho("/api/upload"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=ye==null?void 0:ye.data)==null?void 0:nt.url)||(ye==null?void 0:ye.url)||""},persons:Sr,linkTags:_r,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(hn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(te,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:et,disabled:g||!T.id||!T.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Kt,{open:!!O,onOpenChange:M=>!M&&D(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),O&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"篇名"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:O.title,onChange:M=>D({...O,title:M.target.value}),placeholder:"输入篇名"})]})}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",onClick:()=>D(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:Io,disabled:P||!((Po=O==null?void 0:O.title)!=null&&Po.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Kt,{open:!!ee,onOpenChange:M=>!M&&Y(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),ee&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:ee.title,onChange:M=>Y({...ee,title:M.target.value}),placeholder:"输入章节名称"})]})}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",onClick:()=>Y(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:ss,disabled:U||!((yt=ee==null?void 0:ee.title)!=null&&yt.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:U?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Kt,{open:z,onOpenChange:M=>{var q;if(ie(M),M&&rn.length>0){const pe=rn[0];$(pe.id),ce(((q=pe.chapters[0])==null?void 0:q.id)??"")}},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:F.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目标篇"}),s.jsxs(ul,{value:G,onValueChange:M=>{var pe;$(M);const q=rn.find(ye=>ye.id===M);ce(((pe=q==null?void 0:q.chapters[0])==null?void 0:pe.id)??"")},children:[s.jsx(Xa,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{placeholder:"选择篇"})}),s.jsx(Za,{className:"bg-[#0f2137] border-gray-700",children:rn.map(M=>s.jsx(Ir,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目标章"}),s.jsxs(ul,{value:H,onValueChange:ce,children:[s.jsx(Xa,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{placeholder:"选择章"})}),s.jsx(Za,{className:"bg-[#0f2137] border-gray-700",children:(((Ul=rn.find(M=>M.id===G))==null?void 0:Ul.chapters)??[]).map(M=>s.jsx(Ir,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id))})]})]})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",onClick:()=>ie(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:Wl,disabled:W||F.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:W?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Kt,{open:!!Te,onOpenChange:M=>!M&&Ve(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white",children:["付款记录 — ",(Te==null?void 0:Te.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:He?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Te&&Te.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Te?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"py-2 pr-2",children:"订单号"}),s.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),s.jsx("th",{className:"py-2 pr-2",children:"金额"}),s.jsx("th",{className:"py-2 pr-2",children:"状态"}),s.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),s.jsx("tbody",{children:Te.orders.map(M=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${M.orderSn}`,onClick:()=>window.open(`/orders?search=${M.orderSn??M.id??""}`,"_blank"),children:M.orderSn?M.orderSn.length>16?M.orderSn.slice(0,8)+"..."+M.orderSn.slice(-6):M.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${M.userId??M.openId??""}`,onClick:()=>window.open(`/users?search=${M.userId??M.openId??""}`,"_blank"),children:(()=>{const q=M.userId??M.openId??"-";return q.length>12?q.slice(0,6)+"..."+q.slice(-4):q})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",M.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:M.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:M.payTime??M.createdAt??"-"})]},M.id??M.orderSn??""))})]}):null})]})}),s.jsx(Kt,{open:Pt,onOpenChange:yn,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(wu,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),ne?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"阅读权重"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:ht.readWeight,onChange:M=>At(q=>({...q,readWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"新度权重"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:ht.recencyWeight,onChange:M=>At(q=>({...q,recencyWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"付款权重"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:ht.payWeight,onChange:M=>At(q=>({...q,payWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(ht.readWeight+ht.recencyWeight+ht.payWeight).toFixed(1)]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),s.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),s.jsx(te,{onClick:Ra,disabled:Qe||Math.abs(ht.readWeight+ht.recencyWeight+ht.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Qe?"保存中...":"保存权重"})]})]})]})}),s.jsx(Kt,{open:_,onOpenChange:J,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(dn,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:X,onChange:M=>de(M.target.value),placeholder:"输入篇名"})]})}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",onClick:()=>{J(!1),de("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:Ys,disabled:he||!X.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:he?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Kt,{open:!!o,onOpenChange:()=>c(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(qt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节ID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:M=>c({...o,id:M.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:M=>c({...o,price:Number(M.target.value),isFree:Number(M.target.value)===0}),disabled:o.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:M=>c({...o,isFree:M.target.checked,price:M.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:M=>c({...o,isNew:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:M=>c({...o,isPinned:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.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]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.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]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"热度分"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:M=>c({...o,hotScore:Math.max(0,parseFloat(M.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:M=>c({...o,title:M.target.value})})]}),o.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文件路径"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(yx,{ref:ns,content:o.content||"",onChange:M=>c({...o,content:M}),onImageUpload:async M=>{var nt;const q=new FormData;q.append("file",M),q.append("folder","book-images");const ye=await(await fetch(ho("/api/upload"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=ye==null?void 0:ye.data)==null?void 0:nt.url)||(ye==null?void 0:ye.url)||""},persons:Sr,linkTags:_r,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(hn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&s.jsxs(te,{variant:"outline",onClick:()=>V({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:[s.jsx(Yr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(te,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(te,{onClick:Xe,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(fd,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Ll,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Yr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(tn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(_b,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(tn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(da,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(tn,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(gs,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(tn,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Db,{className:"w-4 h-4 mr-2"}),"链接标签"]}),s.jsxs(tn,{value:"linkedmp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(uo,{className:"w-4 h-4 mr-2"}),"关联小程序"]})]}),s.jsxs(nn,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.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:s.jsx(Yr,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),s.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),s.jsxs("div",{className:"text-center shrink-0",children:[s.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:zr}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(te,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(te,{onClick:()=>J(!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:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(te,{variant:"outline",onClick:()=>ie(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",F.length," 节)"]})]}),n?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(tV,{parts:rn,expandedParts:i,onTogglePart:Hl,onReorder:Ei,onReadSection:Re,onDeleteSection:qs,onAddSectionInPart:Mn,onAddChapterInPart:Jt,onDeleteChapter:Ss,onEditPart:cr,onDeletePart:Ii,onEditChapter:_n,selectedSectionIds:F,onToggleSectionSelect:La,onShowSectionOrders:V,pinnedSectionIds:Dt})]}),s.jsx(nn,{value:"search",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"内容搜索"})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:w,onChange:M=>N(M.target.value),onKeyDown:M=>M.key==="Enter"&&Ro()}),s.jsx(te,{onClick:Ro,disabled:C||!w.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Ge,{className:"w-4 h-4 animate-spin"}):s.jsx(da,{className:"w-4 h-4"})})]}),b.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",b.length," 个结果"]}),b.map(M=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>Re({id:M.id,mid:M.mid,title:M.title,price:M.price??1,filePath:""}),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:M.id}),s.jsx("span",{className:"text-white",children:M.title}),Dt.includes(M.id)&&s.jsx(ml,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Ue,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:M.matchType==="title"?"标题匹配":"内容匹配"})]}),M.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:M.snippet}),(M.partTitle||M.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[M.partTitle," · ",M.chapterTitle]})]},M.id))]})]})]})}),s.jsxs(nn,{value:"ranking",className:"space-y-4",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{className:"pb-3",children:s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(wu,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Z,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(oe,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:me,onChange:M=>ve(Math.max(1,Math.min(100,Number(M.target.value)||20))),disabled:or}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(te,{size:"sm",onClick:Da,disabled:ki,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ki?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",me,"% 内容"]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(_b,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",Nt.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>rs(),disabled:Ot,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Ge,{className:`w-4 h-4 ${Ot?"animate-spin":""}`})}),s.jsx(te,{variant:"ghost",size:"sm",disabled:ft<=1||Ot,onClick:()=>pt(M=>Math.max(1,M-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(HT,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[ft," / ",$r]}),s.jsx(te,{variant:"ghost",size:"sm",disabled:ft>=$r||Ot,onClick:()=>pt(M=>Math.min($r,M+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(fl,{className:"w-4 h-4"})})]})]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"space-y-0",children:[s.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:[s.jsx("span",{children:"排名"}),s.jsx("span",{children:"置顶"}),s.jsx("span",{children:"标题"}),s.jsx("span",{className:"text-right",children:"点击量"}),s.jsx("span",{className:"text-right",children:"付款数"}),s.jsx("span",{className:"text-right",children:"热度"}),s.jsx("span",{className:"text-right",children:"编辑"})]}),Ks.map((M,q)=>{const pe=(ft-1)*Us+q+1,ye=M.isPinned??Dt.includes(M.id);return s.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 ${ye?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${pe<=3?"text-amber-400":"text-gray-500"}`,children:pe<=3?["🥇","🥈","🥉"][pe-1]:`#${pe}`}),s.jsx(te,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${ye?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>ks(M.id),disabled:Zr,title:ye?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:ye?s.jsx(ml,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(hA,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:M.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[M.partTitle," · ",M.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:M.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:M.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(M.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(te,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>Re({id:M.id,mid:M.mid,title:M.title,price:M.price,filePath:""}),title:"编辑文章",children:s.jsx(_t,{className:"w-3 h-3"})})})]},M.id)}),Ks.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(nn,{value:"link-person",className:"space-y-4",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"pb-3",children:[s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"添加时自动生成 32 位 token,文章 @ 时存 token;小程序点击 @ 时用 token 兑换真实密钥后加好友"})]}),s.jsxs(Ae,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"添加人物时同步创建存客宝场景获客计划,配置与存客宝 API 获客一致"}),s.jsxs(te,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Ws(null),Ci(!0)},children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[Sr.length>0&&s.jsxs("div",{className:"flex items-center gap-4 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{className:"w-[280px] shrink-0",children:"token"}),s.jsx("span",{className:"w-24 shrink-0",children:"@的人"}),s.jsx("span",{children:"获客计划活动名"})]}),Sr.map(M=>s.jsxs("div",{className:"bg-[#0a1628] rounded px-3 py-2 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-4 text-sm min-w-0",children:[s.jsx("span",{className:"text-gray-400 text-xs font-mono shrink-0 w-[280px]",title:"32位token",children:M.id}),s.jsx("span",{className:"text-amber-400 shrink-0 w-24 truncate",title:"@的人",children:M.name}),s.jsxs("span",{className:"text-white truncate",title:"获客计划活动名",children:["SOUL链接人与事-",M.name]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const q=await rV(M.personId||"");if(q!=null&&q.success&&q.person){const pe=q.person;Ws({id:pe.token??pe.personId,personId:pe.personId,name:pe.name,label:pe.label??"",ckbApiKey:pe.ckbApiKey??"",remarkType:pe.remarkType,remarkFormat:pe.remarkFormat,addFriendInterval:pe.addFriendInterval,startTime:pe.startTime,endTime:pe.endTime,deviceGroups:pe.deviceGroups})}else Ws(M),q!=null&&q.error&&ae.error(q.error)}catch(q){console.error(q),Ws(M),ae.error(q instanceof Error?q.message:"加载人物详情失败")}Ci(!0)},children:s.jsx(JN,{className:"w-3 h-3"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-amber-400 h-6 px-2",title:"编辑计划(跳转存客宝)",onClick:()=>{const q=M.ckbPlanId;q?window.open(`https://h5.ckb.quwanzhi.com/#/scenarios/edit/${q}`,"_blank"):ae.info("该人物尚未同步存客宝计划,请先保存后等待同步完成")},children:s.jsx(_s,{className:"w-3 h-3"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:"删除(同时删除存客宝对应获客计划)",onClick:async()=>{confirm(`确定删除「SOUL链接人与事-${M.name}」?将同时删除存客宝对应获客计划。`)&&(await Ps(`/api/db/persons?personId=${M.personId}`),Gs())},children:s.jsx(Xn,{className:"w-3 h-3"})})]})]},M.id)),Sr.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"pb-3",children:[s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(wu,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(Ae,{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往"," ",s.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]}),s.jsx(nn,{value:"link-tag",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"pb-3",children:[s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Db,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(Ae,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"标签ID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:ot.tagId,onChange:M=>Ln({...ot,tagId:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"显示文字"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:ot.label,onChange:M=>Ln({...ot,label:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"类型"}),s.jsxs(ul,{value:ot.type,onValueChange:M=>Ln({...ot,type:M}),children:[s.jsx(Xa,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:s.jsx(hl,{})}),s.jsxs(Za,{children:[s.jsx(Ir,{value:"url",children:"网页链接"}),s.jsx(Ir,{value:"miniprogram",children:"小程序"}),s.jsx(Ir,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:ot.type==="url"?"URL地址":ot.type==="ckb"?"存客宝计划URL":"小程序(选密钥)"}),ot.type==="miniprogram"&&Mi.length>0?s.jsxs("div",{ref:Ao,className:"relative w-44",children:[s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:"搜索名称或密钥",value:Mo?js:ot.appId,onChange:M=>{const q=M.target.value;Pa(q),Tt(!0),Mi.some(pe=>pe.key===q)||Ln({...ot,appId:q})},onFocus:()=>{Pa(ot.appId),Tt(!0)},onBlur:()=>setTimeout(()=>Tt(!1),150)}),Mo&&s.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 max-h-48 overflow-y-auto rounded-md border border-gray-700 bg-[#0a1628] shadow-lg z-50",children:Ai.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):Ai.map(M=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:q=>{q.preventDefault(),Ln({...ot,appId:M.key,pagePath:M.path||""}),Pa(""),Tt(!1)},children:[s.jsx("span",{children:M.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:M.key})]},M.key))})]}):s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:ot.type==="url"?"https://...":ot.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联小程序的32位密钥",value:ot.type==="url"||ot.type==="ckb"?ot.url:ot.appId,onChange:M=>{ot.type==="url"||ot.type==="ckb"?Ln({...ot,url:M.target.value}):Ln({...ot,appId:M.target.value})}})]}),ot.type==="miniprogram"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"页面路径"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:ot.pagePath,onChange:M=>Ln({...ot,pagePath:M.target.value})})]}),s.jsxs(te,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!ot.tagId||!ot.label){ae.error("标签ID和显示文字必填");return}const M={...ot};M.type==="miniprogram"&&(M.url=""),await wt("/api/db/link-tags",M),Ln({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Cr(null),Ns()},children:[s.jsx(dn,{className:"w-3 h-3 mr-1"}),ts?"保存":"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[_r.map(M=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[s.jsxs("button",{type:"button",className:"text-amber-400 font-bold text-base hover:underline",onClick:()=>{Ln({tagId:M.id,label:M.label,url:M.url,type:M.type,appId:M.appId??"",pagePath:M.pagePath??""}),Cr(M.id)},children:["#",M.label]}),s.jsx(Ue,{variant:"secondary",className:`text-[10px] ${M.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:M.type==="url"?"网页":M.type==="ckb"?"存客宝":"小程序"}),M.type==="miniprogram"?s.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[M.appId," ",M.pagePath?`· ${M.pagePath}`:""]}):M.url?s.jsxs("a",{href:M.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[M.url," ",s.jsx(_s,{className:"w-3 h-3 shrink-0"})]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-6 px-2",onClick:()=>{Ln({tagId:M.id,label:M.label,url:M.url,type:M.type,appId:M.appId??"",pagePath:M.pagePath??""}),Cr(M.id)},children:"编辑"}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Ps(`/api/db/link-tags?tagId=${M.id}`),ts===M.id&&(Cr(null),Ln({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""})),Ns()},children:s.jsx(Xn,{className:"w-3 h-3"})})]})]},M.id)),_r.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]})}),s.jsx(nn,{value:"linkedmp",className:"space-y-4",children:s.jsx(ZB,{})})]}),s.jsx(sV,{open:lr,onOpenChange:Ci,editingPerson:Ia,onSubmit:async M=>{var ye;const q={personId:M.personId||M.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:M.name,label:M.label,ckbApiKey:M.ckbApiKey||void 0,greeting:M.greeting||void 0,tips:M.tips||void 0,remarkType:M.remarkType||void 0,remarkFormat:M.remarkFormat||void 0,addFriendInterval:M.addFriendInterval,startTime:M.startTime||void 0,endTime:M.endTime||void 0,deviceGroups:(ye=M.deviceGroups)!=null&&ye.trim()?M.deviceGroups.split(",").map(nt=>parseInt(nt.trim(),10)).filter(nt=>!Number.isNaN(nt)):void 0},pe=await wt("/api/db/persons",q);if(pe&&pe.success===!1){const nt=pe;nt.ckbResponse&&console.log("存客宝返回",nt.ckbResponse);const bt=nt.error||"操作失败";throw new Error(bt)}if(Gs(),ae.success(Ia?"已保存":"已添加"),pe!=null&&pe.ckbCreateResult&&Object.keys(pe.ckbCreateResult).length>0){const nt=pe.ckbCreateResult;console.log("存客宝创建结果",nt);const bt=nt.planId??nt.id,sn=bt!=null?[`planId: ${bt}`]:[];nt.apiKey!=null&&sn.push("apiKey: ***"),ae.info(sn.length?`存客宝创建结果:${sn.join(",")}`:"存客宝创建结果见控制台")}}})]})}const mi={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 mN(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):mi.stats}function gN(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):mi.highlights}function oV(){const[t,e]=v.useState(mi),[n,r]=v.useState(!0),[i,a]=v.useState(!1),[o,c]=v.useState(!1),u=v.useRef(null);v.useEffect(()=>{Le("/api/admin/author-settings").then(k=>{const C=k==null?void 0:k.data;C&&typeof C=="object"&&e({name:String(C.name??mi.name),avatar:String(C.avatar??mi.avatar),avatarImg:String(C.avatarImg??""),title:String(C.title??mi.title),bio:String(C.bio??mi.bio),stats:mN(C.stats).length?mN(C.stats):mi.stats,highlights:gN(C.highlights).length?gN(C.highlights):mi.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)},C=await wt("/api/admin/author-settings",k);if(!C||C.success===!1){ae.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:""));return}a(!1);const E=document.createElement("div");E.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",E.textContent="作者设置已保存",document.body.appendChild(E),setTimeout(()=>E.remove(),2e3)}catch(k){console.error(k),ae.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},f=async k=>{var E;const C=(E=k.target.files)==null?void 0:E[0];if(C){c(!0);try{const T=new FormData;T.append("file",C),T.append("folder","avatars");const I=Ox(),O={};I&&(O.Authorization=`Bearer ${I}`);const P=await(await fetch(ho("/api/upload"),{method:"POST",body:T,credentials:"include",headers:O})).json();P!=null&&P.success&&(P!=null&&P.url)?e(L=>({...L,avatarImg:P.url})):ae.error("上传失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(T){console.error(T),ae.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(C=>({...C,stats:C.stats.filter((E,T)=>T!==k)})),y=(k,C,E)=>e(T=>({...T,stats:T.stats.map((I,O)=>O===k?{...I,[C]:E}:I)})),w=()=>e(k=>({...k,highlights:[...k.highlights,""]})),N=k=>e(C=>({...C,highlights:C.highlights.filter((E,T)=>T!==k)})),b=(k,C)=>e(E=>({...E,highlights:E.highlights.map((T,I)=>I===k?C:T)}));return n?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(yl,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(te,{onClick:h,disabled:i||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(yl,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx($t,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"姓名"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(C=>({...C,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(C=>({...C,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(qN,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(C=>({...C,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(te,{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:[s.jsx(oh,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:t.avatarImg.startsWith("http")?t.avatarImg:ho(t.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"头衔"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(C=>({...C,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"个人简介"}),s.jsx(_l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(C=>({...C,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsx(st,{className:"text-white",children:"统计数据"}),s.jsx($t,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(Ae,{className:"space-y-3",children:[t.stats.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:E=>y(C,"label",E.target.value),placeholder:"标签"}),s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:E=>y(C,"value",E.target.value),placeholder:"数值"}),s.jsx(te,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(C),children:s.jsx(Xn,{className:"w-4 h-4"})})]},C)),s.jsxs(te,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsx(st,{className:"text-white",children:"亮点标签"}),s.jsx($t,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(Ae,{className:"space-y-3",children:[t.highlights.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:E=>b(C,E.target.value),placeholder:"5年私域运营经验"}),s.jsx(te,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>N(C),children:s.jsx(Xn,{className:"w-4 h-4"})})]},C)),s.jsxs(te,{variant:"outline",size:"sm",onClick:w,className:"border-gray-600 text-gray-400",children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function lV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o]=v.useState(10),[c,u]=v.useState(0),[h,f]=v.useState(""),m=Yx(h,300),[g,y]=v.useState(!0),[w,N]=v.useState(null),[b,k]=v.useState(!1),[C,E]=v.useState(null),[T,I]=v.useState(""),[O,D]=v.useState(""),[P,L]=v.useState(""),[_,J]=v.useState("admin"),[ee,Y]=v.useState("active"),[U,R]=v.useState(!1);async function F(){var H;y(!0),N(null);try{const ce=new URLSearchParams({page:String(i),pageSize:String(o)});m.trim()&&ce.set("search",m.trim());const W=await Le(`/api/admin/users?${ce}`);W!=null&&W.success?(e(W.records||[]),r(W.total??0),u(W.totalPages??0)):N(W.error||"加载失败")}catch(ce){const W=ce;N(W.status===403?"无权限访问":((H=W==null?void 0:W.data)==null?void 0:H.error)||"加载失败"),e([])}finally{y(!1)}}v.useEffect(()=>{F()},[i,o,m]);const re=()=>{E(null),I(""),D(""),L(""),J("admin"),Y("active"),k(!0)},z=H=>{E(H),I(H.username),D(""),L(H.name||""),J(H.role==="super_admin"?"super_admin":"admin"),Y(H.status==="disabled"?"disabled":"active"),k(!0)},ie=async()=>{var H;if(!T.trim()){N("用户名不能为空");return}if(!C&&!O){N("新建时密码必填,至少 6 位");return}if(O&&O.length<6){N("密码至少 6 位");return}N(null),R(!0);try{if(C){const ce=await Mt("/api/admin/users",{id:C.id,password:O||void 0,name:P.trim(),role:_,status:ee});ce!=null&&ce.success?(k(!1),F()):N((ce==null?void 0:ce.error)||"保存失败")}else{const ce=await wt("/api/admin/users",{username:T.trim(),password:O,name:P.trim(),role:_});ce!=null&&ce.success?(k(!1),F()):N((ce==null?void 0:ce.error)||"保存失败")}}catch(ce){const W=ce;N(((H=W==null?void 0:W.data)==null?void 0:H.error)||"保存失败")}finally{R(!1)}},G=async H=>{var ce;if(confirm("确定删除该管理员?"))try{const W=await Ps(`/api/admin/users?id=${H}`);W!=null&&W.success?F():N((W==null?void 0:W.error)||"删除失败")}catch(W){const fe=W;N(((ce=fe==null?void 0:fe.data)==null?void 0:ce.error)||"删除失败")}},$=H=>{if(!H)return"-";try{const ce=new Date(H);return isNaN(ce.getTime())?H:ce.toLocaleString("zh-CN")}catch{return H}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Rx,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(oe,{placeholder:"搜索用户名/昵称",value:h,onChange:H=>f(H.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(te,{variant:"outline",size:"sm",onClick:F,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(Ge,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(te,{onClick:re,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),w&&s.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:[s.jsx("span",{children:w}),s.jsx("button",{type:"button",onClick:()=>N(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"用户名"}),s.jsx(je,{className:"text-gray-400",children:"昵称"}),s.jsx(je,{className:"text-gray-400",children:"角色"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"创建时间"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(nr,{children:[t.map(H=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:H.id}),s.jsx(xe,{className:"text-white font-medium",children:H.username}),s.jsx(xe,{className:"text-gray-400",children:H.name||"-"}),s.jsx(xe,{children:s.jsx(Ue,{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"?"超级管理员":"管理员"})}),s.jsx(xe,{children:s.jsx(Ue,{variant:"outline",className:H.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:H.status==="active"?"正常":"已禁用"})}),s.jsx(xe,{className:"text-gray-500 text-sm",children:$(H.createdAt)}),s.jsxs(xe,{className:"text-right",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>z(H),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(_t,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>G(H.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Bn,{className:"w-4 h-4"})})]})]},H.id)),t.length===0&&!g&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:w==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(xs,{page:i,pageSize:o,total:n,totalPages:c,onPageChange:a})})]})})}),s.jsx(Kt,{open:b,onOpenChange:k,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:C?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"用户名"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:T,onChange:H=>I(H.target.value),disabled:!!C}),C&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:C?"新密码(留空不改)":"密码"}),s.jsx(oe,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:C?"留空表示不修改":"至少 6 位",value:O,onChange:H=>D(H.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:P,onChange:H=>L(H.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:_,onChange:H=>J(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),C&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:ee,onChange:H=>Y(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:ie,disabled:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),U?"保存中...":"保存"]})]})]})})]})}const cV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},dV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},uV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...dV},ckbLeadApiKey:""},hV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},fV=["system","author","admin"];function pV(){const[t,e]=$N(),n=t.get("tab")??"system",r=fV.includes(n)?n:"system",[i,a]=v.useState(uV),[o,c]=v.useState(hV),[u,h]=v.useState(cV),[f,m]=v.useState(!1),[g,y]=v.useState(!0),[w,N]=v.useState(!1),[b,k]=v.useState(""),[C,E]=v.useState(""),[T,I]=v.useState(!1),[O,D]=v.useState(!1),P=(Y,U,R=!1)=>{k(Y),E(U),I(R),N(!0)};v.useEffect(()=>{(async()=>{try{const U=await Le("/api/admin/settings");if(!U||U.success===!1)return;if(U.featureConfig&&Object.keys(U.featureConfig).length&&c(R=>({...R,...U.featureConfig})),U.mpConfig&&typeof U.mpConfig=="object"&&h(R=>({...R,...U.mpConfig})),U.siteSettings&&typeof U.siteSettings=="object"){const R=U.siteSettings;a(F=>({...F,...typeof R.sectionPrice=="number"&&{sectionPrice:R.sectionPrice},...typeof R.baseBookPrice=="number"&&{baseBookPrice:R.baseBookPrice},...typeof R.distributorShare=="number"&&{distributorShare:R.distributorShare},...R.authorInfo&&typeof R.authorInfo=="object"&&{authorInfo:{...F.authorInfo,...R.authorInfo}},...typeof R.ckbLeadApiKey=="string"&&{ckbLeadApiKey:R.ckbLeadApiKey}}))}}catch(U){console.error("Load settings error:",U)}finally{y(!1)}})()},[]);const L=async(Y,U)=>{D(!0);try{const R=await wt("/api/admin/settings",{featureConfig:Y});if(!R||R.success===!1){U(),P("保存失败",(R==null?void 0:R.error)??"未知错误",!0);return}P("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(R){console.error("Save feature config error:",R),U(),P("保存失败",R instanceof Error?R.message:String(R),!0)}finally{D(!1)}},_=(Y,U)=>{const R=o,F={...R,[Y]:U};c(F),L(F,()=>c(R))},J=async()=>{m(!0);try{const Y=await wt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:i.sectionPrice,baseBookPrice:i.baseBookPrice,distributorShare:i.distributorShare,authorInfo:i.authorInfo,ckbLeadApiKey:i.ckbLeadApiKey||void 0},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)}},ee=Y=>{e(Y==="system"?{}:{tab:Y})};return g?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&s.jsxs(te,{onClick:J,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),s.jsxs(fd,{value:r,onValueChange:ee,className:"w-full",children:[s.jsxs(Ll,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(so,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(tn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Nm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(tn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Rx,{className:"w-4 h-4 mr-2"}),"管理员"]})]}),s.jsx(nn,{value:"system",className:"mt-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Nm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx($t,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Nm,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(oe,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:i.authorInfo.name??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,name:Y.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ih,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(oe,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:i.authorInfo.startDate??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,startDate:Y.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ih,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(oe,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:i.authorInfo.liveTime??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,liveTime:Y.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(GN,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(oe,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:i.authorInfo.platform??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,platform:Y.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Yr,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(oe,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:i.authorInfo.description??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,description:Y.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(_l,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:i.authorInfo.bio??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,bio:Y.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(gs,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(oe,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:i.ckbLeadApiKey??"",onChange:Y=>a(U=>({...U,ckbLeadApiKey:Y.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:(i.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:i.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:i.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",i.authorInfo.liveTime," · ",i.authorInfo.platform]})]})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ah,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx($t,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(Ae,{className:"space-y-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:i.sectionPrice,onChange:Y=>a(U=>({...U,sectionPrice:Number.parseFloat(Y.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:i.baseBookPrice,onChange:Y=>a(U=>({...U,baseBookPrice:Number.parseFloat(Y.target.value)||9.9}))})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(uo,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx($t,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsx(Ae,{className:"space-y-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:Y=>h(U=>({...U,appId:Y.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:Y=>h(U=>({...U,withdrawSubscribeTmplId:Y.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:Y=>h(U=>({...U,mchId:Y.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:Y=>h(U=>({...U,minWithdraw:Number.parseFloat(Y.target.value)||10}))})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(so,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx($t,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Un,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(Et,{id:"match-enabled",checked:o.matchEnabled,disabled:O,onCheckedChange:Y=>_("matchEnabled",Y)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(fM,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),s.jsx(Et,{id:"referral-enabled",checked:o.referralEnabled,disabled:O,onCheckedChange:Y=>_("referralEnabled",Y)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Yr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),s.jsx(Et,{id:"search-enabled",checked:o.searchEnabled,disabled:O,onCheckedChange:Y=>_("searchEnabled",Y)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(so,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(Et,{id:"about-enabled",checked:o.aboutEnabled,disabled:O,onCheckedChange:Y=>_("aboutEnabled",Y)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),s.jsx(nn,{value:"author",className:"mt-0",children:s.jsx(oV,{})}),s.jsx(nn,{value:"admin",className:"mt-0",children:s.jsx(lV,{})})]}),s.jsx(Kt,{open:w,onOpenChange:N,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(qt,{children:[s.jsx(Gt,{className:T?"text-red-400":"text-[#38bdac]",children:b}),s.jsx(Wx,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:C})]}),s.jsx(hn,{className:"mt-4",children:s.jsx(te,{onClick:()=>N(!1),className:T?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const xN={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 mV(){const[t,e]=v.useState(!1),[n,r]=v.useState(xN),[i,a]=v.useState(""),o=async()=>{e(!0);try{const k=await Le("/api/config");k!=null&&k.paymentMethods&&r({...xN,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};v.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await wt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),ae.success("配置已保存!")}catch(k){console.error("保存失败:",k),ae.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,C)=>{navigator.clipboard.writeText(k),a(C),setTimeout(()=>a(""),2e3)},h=(k,C)=>{r(E=>({...E,wechat:{...E.wechat,[k]:C}}))},f=(k,C)=>{r(E=>({...E,alipay:{...E.alipay,[k]:C}}))},m=(k,C)=>{r(E=>({...E,usdt:{...E.usdt,[k]:C}}))},g=(k,C)=>{r(E=>({...E,paypal:{...E.paypal,[k]:C}}))},y=n.wechat,w=n.alipay,N=n.usdt,b=n.paypal;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(te,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(te,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(HN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),s.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[s.jsx("li",{children:"打开微信,进入目标微信群"}),s.jsx("li",{children:'点击右上角"..." → "群二维码"'}),s.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),s.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),s.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),s.jsxs(fd,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Ll,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(tn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(uo,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(tn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(Ob,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(tn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(Rb,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(tn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(kg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(nn,{value:"wechat",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(st,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(uo,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx($t,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Et,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"网站AppID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"商户号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(_s,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(oe,{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)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),s.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[s.jsx(Z,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(oe,{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)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(nn,{value:"alipay",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(st,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(Ob,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx($t,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Et,{checked:!!w.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(w.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(te,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(w.partnerId??""),"pid"),children:i==="pid"?s.jsx(cf,{className:"w-4 h-4 text-green-500"}):s.jsx(UN,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(oe,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(w.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(_s,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(w.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(nn,{value:"usdt",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(st,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(Rb,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx($t,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Et,{checked:!!N.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(N.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"收款地址"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(N.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(nn,{value:"paypal",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(st,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(kg,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx($t,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Et,{checked:!!b.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(b.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(b.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const gV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},xV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},yV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function vV(){const[t,e]=v.useState({siteConfig:{...gV},menuConfig:{...xV},pageConfig:{...yV}}),[n,r]=v.useState(!1),[i,a]=v.useState(!1);v.useEffect(()=>{Le("/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 wt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await wt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await wt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),ae.success("配置已保存")}catch(f){console.error(f),ae.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{a(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(te,{onClick:o,disabled:i,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),i?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(kg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx($t,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(oe,{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}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(oe,{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}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(oe,{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}}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(oe,{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}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(oe,{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}}))})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(sA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx($t,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(Z,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(oe,{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}}))}),s.jsx(oe,{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}}))})]})]}),s.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(QM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx($t,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(Ae,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(Et,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(oe,{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}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(dM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx($t,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首页标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首页副标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目录页标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"我的页标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function bV(){const[t,e]=v.useState(""),[n,r]=v.useState(""),[i,a]=v.useState(""),[o,c]=v.useState({}),u=async()=>{var y,w,N,b;try{const k=await Le("/api/config"),C=(w=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:w.urls;Array.isArray(C)&&e(C.join(` +
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");i&&r[c]&&i({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,i=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,i=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"?(i&&r[n]&&i({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}}}});function K$(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let i=0;i{const u=v.useRef(null),h=v.useRef(null),[f,m]=v.useState(""),[g,y]=v.useState(!1),w=v.useRef(nN(t)),N=v.useCallback((T,I)=>{var L;const O=h.current;if(!O||!n)return!1;const D=K$(I);if(D.length>0)return I.preventDefault(),(async()=>{for(const _ of D)try{const J=await n(_);J&&O.chain().focus().setImage({src:J}).run()}catch(J){console.error("粘贴图片上传失败",J)}})(),!0;const P=(L=I.clipboardData)==null?void 0:L.getData("text/html");if(P&&/data:image\/[^;"']+;base64,/i.test(P)){I.preventDefault();const{from:_,to:J}=O.state.selection;return(async()=>{try{const ee=await J$(P,n);O.chain().focus().insertContentAt({from:_,to:J},ee).run()}catch(ee){console.error("粘贴 HTML 内 base64 转换失败",ee)}})(),!0}return!1},[n]),b=$_({extensions:[Cz.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),Mz.configure({inline:!0,allowBase64:!0}),Dz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:U$(r)}),W$,Lz.configure({placeholder:a}),OC.configure({resizable:!0}),PC,IC,RC],content:w.current,onUpdate:({editor:T})=>{e(T.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:N}});v.useEffect(()=>{h.current=b??null},[b]),v.useImperativeHandle(c,()=>({getHTML:()=>(b==null?void 0:b.getHTML())||"",getMarkdown:()=>H$((b==null?void 0:b.getHTML())||"")})),v.useEffect(()=>{if(b&&t!==b.getHTML()){const T=nN(t);T!==b.getHTML()&&b.commands.setContent(T)}},[t]);const k=v.useCallback(async T=>{var O;const I=(O=T.target.files)==null?void 0:O[0];if(!(!I||!b)){if(n){const D=await n(I);D&&b.chain().focus().setImage({src:D}).run()}else{const D=new FileReader;D.onload=()=>{typeof D.result=="string"&&b.chain().focus().setImage({src:D.result}).run()},D.readAsDataURL(I)}T.target.value=""}},[b,n]),C=v.useCallback(T=>{b&&b.chain().focus().insertContent({type:"linkTag",attrs:{label:T.label,url:T.url||"",tagType:T.type||"url",tagId:T.id||"",pagePath:T.pagePath||"",appId:T.appId||"",mpKey:T.type==="miniprogram"&&T.appId||""}}).run()},[b]),E=v.useCallback(()=>{!b||!f||(b.chain().focus().setLink({href:f}).run(),m(""),y(!1))},[b,f]);return b?s.jsxs("div",{className:`rich-editor-wrapper ${o||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>b.chain().focus().toggleBold().run(),className:b.isActive("bold")?"is-active":"",type:"button",children:s.jsx(DT,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleItalic().run(),className:b.isActive("italic")?"is-active":"",type:"button",children:s.jsx(OM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleStrike().run(),className:b.isActive("strike")?"is-active":"",type:"button",children:s.jsx(IA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleCode().run(),className:b.isActive("code")?"is-active":"",type:"button",children:s.jsx(eM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>b.chain().focus().toggleHeading({level:1}).run(),className:b.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(kM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleHeading({level:2}).run(),className:b.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(CM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleHeading({level:3}).run(),className:b.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(TM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>b.chain().focus().toggleBulletList().run(),className:b.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(WM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleOrderedList().run(),className:b.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(VM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().toggleBlockquote().run(),className:b.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(gA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(tA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:k,className:"hidden"}),s.jsx("button",{onClick:()=>{var T;return(T=u.current)==null?void 0:T.click()},type:"button",children:s.jsx(GN,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>y(!g),className:b.isActive("link")?"is-active":"",type:"button",children:s.jsx(Cg,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:s.jsx(PA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>b.chain().focus().undo().run(),disabled:!b.can().undo(),type:"button",children:s.jsx(FA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>b.chain().focus().redo().run(),disabled:!b.can().redo(),type:"button",children:s.jsx(yA,{className:"w-4 h-4"})})]}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"toolbar-divider"}),s.jsx("div",{className:"toolbar-group",children:s.jsxs("select",{className:"link-tag-select",onChange:T=>{const I=i.find(O=>O.id===T.target.value);I&&C(I),T.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(T=>s.jsx("option",{value:T.id,children:T.label},T.id))]})})]})]}),g&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:f,onChange:T=>m(T.target.value),onKeyDown:T=>T.key==="Enter"&&E(),className:"link-input"}),s.jsx("button",{onClick:E,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{b.chain().focus().unsetLink().run(),y(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(U2,{editor:b})]}):null});vx.displayName="RichEditor";const Y$=["top","right","bottom","left"],ba=Math.min,Pr=Math.max,nf=Math.round,qu=Math.floor,Ds=t=>({x:t,y:t}),Q$={left:"right",right:"left",bottom:"top",top:"bottom"},X$={start:"end",end:"start"};function bx(t,e,n){return Pr(t,ba(e,n))}function yi(t,e){return typeof t=="function"?t(e):t}function vi(t){return t.split("-")[0]}function zl(t){return t.split("-")[1]}function V0(t){return t==="x"?"y":"x"}function H0(t){return t==="y"?"height":"width"}const Z$=new Set(["top","bottom"]);function Os(t){return Z$.has(vi(t))?"y":"x"}function W0(t){return V0(Os(t))}function eF(t,e,n){n===void 0&&(n=!1);const r=zl(t),i=W0(t),a=H0(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=rf(o)),[o,rf(o)]}function tF(t){const e=rf(t);return[wx(t),e,wx(e)]}function wx(t){return t.replace(/start|end/g,e=>X$[e])}const rN=["left","right"],sN=["right","left"],nF=["top","bottom"],rF=["bottom","top"];function sF(t,e,n){switch(t){case"top":case"bottom":return n?e?sN:rN:e?rN:sN;case"left":case"right":return e?nF:rF;default:return[]}}function iF(t,e,n,r){const i=zl(t);let a=sF(vi(t),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),e&&(a=a.concat(a.map(wx)))),a}function rf(t){return t.replace(/left|right|bottom|top/g,e=>Q$[e])}function aF(t){return{top:0,right:0,bottom:0,left:0,...t}}function DC(t){return typeof t!="number"?aF(t):{top:t,right:t,bottom:t,left:t}}function sf(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function iN(t,e,n){let{reference:r,floating:i}=t;const a=Os(e),o=W0(e),c=H0(o),u=vi(e),h=a==="y",f=r.x+r.width/2-i.width/2,m=r.y+r.height/2-i.height/2,g=r[c]/2-i[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-i.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-i.width,y:m};break;default:y={x:r.x,y:r.y}}switch(zl(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 oF(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:a,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=yi(e,t),w=DC(y),b=c[g?m==="floating"?"reference":"floating":m],k=sf(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),C=m==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),T=await(a.isElement==null?void 0:a.isElement(E))?await(a.getScale==null?void 0:a.getScale(E))||{x:1,y:1}:{x:1,y:1},I=sf(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:C,offsetParent:E,strategy:u}):C);return{top:(k.top-I.top+w.top)/T.y,bottom:(I.bottom-k.bottom+w.bottom)/T.y,left:(k.left-I.left+w.left)/T.x,right:(I.right-k.right+w.right)/T.x}}const lF=async(t,e,n)=>{const{placement:r="bottom",strategy:i="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:i}),{x:f,y:m}=iN(h,r,u),g=r,y={},w=0;for(let b=0;b({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:a,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=yi(t,e)||{};if(h==null)return{};const m=DC(f),g={x:n,y:r},y=W0(i),w=H0(y),N=await o.getDimensions(h),b=y==="y",k=b?"top":"left",C=b?"bottom":"right",E=b?"clientHeight":"clientWidth",T=a.reference[w]+a.reference[y]-g[y]-a.floating[w],I=g[y]-a.reference[y],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let D=O?O[E]:0;(!D||!await(o.isElement==null?void 0:o.isElement(O)))&&(D=c.floating[E]||a.floating[w]);const P=T/2-I/2,L=D/2-N[w]/2-1,_=ba(m[k],L),J=ba(m[C],L),ee=_,Y=D-N[w]-J,U=D/2-N[w]/2+P,R=bx(ee,U,Y),F=!u.arrow&&zl(i)!=null&&U!==R&&a.reference[w]/2-(UU<=0)){var J,ee;const U=(((J=a.flip)==null?void 0:J.index)||0)+1,R=D[U];if(R&&(!(m==="alignment"?C!==Os(R):!1)||_.every(z=>Os(z.placement)===C?z.overflows[0]>0:!0)))return{data:{index:U,overflows:_},reset:{placement:R}};let F=(ee=_.filter(re=>re.overflows[0]<=0).sort((re,z)=>re.overflows[1]-z.overflows[1])[0])==null?void 0:ee.placement;if(!F)switch(y){case"bestFit":{var Y;const re=(Y=_.filter(z=>{if(O){const ie=Os(z.placement);return ie===C||ie==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ie=>ie>0).reduce((ie,G)=>ie+G,0)]).sort((z,ie)=>z[1]-ie[1])[0])==null?void 0:Y[0];re&&(F=re);break}case"initialPlacement":F=c;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function aN(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function oN(t){return Y$.some(e=>t[e]>=0)}const uF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...a}=yi(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...a,elementContext:"reference"}),c=aN(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:oN(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...a,altBoundary:!0}),c=aN(o,n.floating);return{data:{escapedOffsets:c,escaped:oN(c)}}}default:return{}}}}},LC=new Set(["left","top"]);async function hF(t,e){const{placement:n,platform:r,elements:i}=t,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=vi(n),c=zl(n),u=Os(n)==="y",h=LC.has(o)?-1:1,f=a&&u?-1:1,m=yi(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:w}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof w=="number"&&(y=c==="end"?w*-1:w),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const fF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:a,placement:o,middlewareData:c}=e,u=await hF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:a+u.y,data:{...u,placement:o}}}}},pF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:a}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:C,y:E}=k;return{x:C,y:E}}},...h}=yi(t,e),f={x:n,y:r},m=await a.detectOverflow(e,h),g=Os(vi(i)),y=V0(g);let w=f[y],N=f[g];if(o){const k=y==="y"?"top":"left",C=y==="y"?"bottom":"right",E=w+m[k],T=w-m[C];w=bx(E,w,T)}if(c){const k=g==="y"?"top":"left",C=g==="y"?"bottom":"right",E=N+m[k],T=N-m[C];N=bx(E,N,T)}const b=u.fn({...e,[y]:w,[g]:N});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:o,[g]:c}}}}}},mF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:a,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=yi(t,e),f={x:n,y:r},m=Os(i),g=V0(m);let y=f[g],w=f[m];const N=yi(c,e),b=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(u){const E=g==="y"?"height":"width",T=a.reference[g]-a.floating[E]+b.mainAxis,I=a.reference[g]+a.reference[E]-b.mainAxis;yI&&(y=I)}if(h){var k,C;const E=g==="y"?"width":"height",T=LC.has(vi(i)),I=a.reference[m]-a.floating[E]+(T&&((k=o.offset)==null?void 0:k[m])||0)+(T?0:b.crossAxis),O=a.reference[m]+a.reference[E]+(T?0:((C=o.offset)==null?void 0:C[m])||0)-(T?b.crossAxis:0);wO&&(w=O)}return{[g]:y,[m]:w}}}},gF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:a,platform:o,elements:c}=e,{apply:u=()=>{},...h}=yi(t,e),f=await o.detectOverflow(e,h),m=vi(i),g=zl(i),y=Os(i)==="y",{width:w,height:N}=a.floating;let b,k;m==="top"||m==="bottom"?(b=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,b=g==="end"?"top":"bottom");const C=N-f.top-f.bottom,E=w-f.left-f.right,T=ba(N-f[b],C),I=ba(w-f[k],E),O=!e.middlewareData.shift;let D=T,P=I;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(D=C),O&&!g){const _=Pr(f.left,0),J=Pr(f.right,0),ee=Pr(f.top,0),Y=Pr(f.bottom,0);y?P=w-2*(_!==0||J!==0?_+J:Pr(f.left,f.right)):D=N-2*(ee!==0||Y!==0?ee+Y:Pr(f.top,f.bottom))}await u({...e,availableWidth:P,availableHeight:D});const L=await o.getDimensions(c.floating);return w!==L.width||N!==L.height?{reset:{rects:!0}}:{}}}};function Of(){return typeof window<"u"}function $l(t){return _C(t)?(t.nodeName||"").toLowerCase():"#document"}function _r(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Bs(t){var e;return(e=(_C(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _C(t){return Of()?t instanceof Node||t instanceof _r(t).Node:!1}function bs(t){return Of()?t instanceof Element||t instanceof _r(t).Element:!1}function $s(t){return Of()?t instanceof HTMLElement||t instanceof _r(t).HTMLElement:!1}function lN(t){return!Of()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof _r(t).ShadowRoot}const xF=new Set(["inline","contents"]);function vd(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ws(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!xF.has(i)}const yF=new Set(["table","td","th"]);function vF(t){return yF.has($l(t))}const bF=[":popover-open",":modal"];function Df(t){return bF.some(e=>{try{return t.matches(e)}catch{return!1}})}const wF=["transform","translate","scale","rotate","perspective"],NF=["transform","translate","scale","rotate","perspective","filter"],jF=["paint","layout","strict","content"];function U0(t){const e=K0(),n=bs(t)?ws(t):t;return wF.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)||NF.some(r=>(n.willChange||"").includes(r))||jF.some(r=>(n.contain||"").includes(r))}function kF(t){let e=wa(t);for(;$s(e)&&!Ml(e);){if(U0(e))return e;if(Df(e))return null;e=wa(e)}return null}function K0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const SF=new Set(["html","body","#document"]);function Ml(t){return SF.has($l(t))}function ws(t){return _r(t).getComputedStyle(t)}function Lf(t){return bs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function wa(t){if($l(t)==="html")return t;const e=t.assignedSlot||t.parentNode||lN(t)&&t.host||Bs(t);return lN(e)?e.host:e}function zC(t){const e=wa(t);return Ml(e)?t.ownerDocument?t.ownerDocument.body:t.body:$s(e)&&vd(e)?e:zC(e)}function cd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=zC(t),a=i===((r=t.ownerDocument)==null?void 0:r.body),o=_r(i);if(a){const c=Nx(o);return e.concat(o,o.visualViewport||[],vd(i)?i:[],c&&n?cd(c):[])}return e.concat(i,cd(i,[],n))}function Nx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function $C(t){const e=ws(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=$s(t),a=i?t.offsetWidth:n,o=i?t.offsetHeight:r,c=nf(n)!==a||nf(r)!==o;return c&&(n=a,r=o),{width:n,height:r,$:c}}function q0(t){return bs(t)?t:t.contextElement}function bl(t){const e=q0(t);if(!$s(e))return Ds(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:a}=$C(e);let o=(a?nf(n.width):n.width)/r,c=(a?nf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const CF=Ds(0);function FC(t){const e=_r(t);return!K0()||!e.visualViewport?CF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function EF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==_r(t)?!1:e}function jo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),a=q0(t);let o=Ds(1);e&&(r?bs(r)&&(o=bl(r)):o=bl(t));const c=EF(a,n,r)?FC(a):Ds(0);let u=(i.left+c.x)/o.x,h=(i.top+c.y)/o.y,f=i.width/o.x,m=i.height/o.y;if(a){const g=_r(a),y=r&&bs(r)?_r(r):r;let w=g,N=Nx(w);for(;N&&r&&y!==w;){const b=bl(N),k=N.getBoundingClientRect(),C=ws(N),E=k.left+(N.clientLeft+parseFloat(C.paddingLeft))*b.x,T=k.top+(N.clientTop+parseFloat(C.paddingTop))*b.y;u*=b.x,h*=b.y,f*=b.x,m*=b.y,u+=E,h+=T,w=_r(N),N=Nx(w)}}return sf({width:f,height:m,x:u,y:h})}function _f(t,e){const n=Lf(t).scrollLeft;return e?e.left+n:jo(Bs(t)).left+n}function BC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-_f(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function TF(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const a=i==="fixed",o=Bs(r),c=e?Df(e.floating):!1;if(r===o||c&&a)return n;let u={scrollLeft:0,scrollTop:0},h=Ds(1);const f=Ds(0),m=$s(r);if((m||!m&&!a)&&(($l(r)!=="body"||vd(o))&&(u=Lf(r)),$s(r))){const y=jo(r);h=bl(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!a?BC(o,u):Ds(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 MF(t){return Array.from(t.getClientRects())}function AF(t){const e=Bs(t),n=Lf(t),r=t.ownerDocument.body,i=Pr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=Pr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+_f(t);const c=-n.scrollTop;return ws(r).direction==="rtl"&&(o+=Pr(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:c}}const cN=25;function IF(t,e){const n=_r(t),r=Bs(t),i=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,c=0,u=0;if(i){a=i.width,o=i.height;const f=K0();(!f||f&&e==="fixed")&&(c=i.offsetLeft,u=i.offsetTop)}const h=_f(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,w=Math.abs(r.clientWidth-m.clientWidth-y);w<=cN&&(a-=w)}else h<=cN&&(a+=h);return{width:a,height:o,x:c,y:u}}const RF=new Set(["absolute","fixed"]);function PF(t,e){const n=jo(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,a=$s(t)?bl(t):Ds(1),o=t.clientWidth*a.x,c=t.clientHeight*a.y,u=i*a.x,h=r*a.y;return{width:o,height:c,x:u,y:h}}function dN(t,e,n){let r;if(e==="viewport")r=IF(t,n);else if(e==="document")r=AF(Bs(t));else if(bs(e))r=PF(e,n);else{const i=FC(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return sf(r)}function VC(t,e){const n=wa(t);return n===e||!bs(n)||Ml(n)?!1:ws(n).position==="fixed"||VC(n,e)}function OF(t,e){const n=e.get(t);if(n)return n;let r=cd(t,[],!1).filter(c=>bs(c)&&$l(c)!=="body"),i=null;const a=ws(t).position==="fixed";let o=a?wa(t):t;for(;bs(o)&&!Ml(o);){const c=ws(o),u=U0(o);!u&&c.position==="fixed"&&(i=null),(a?!u&&!i:!u&&c.position==="static"&&!!i&&RF.has(i.position)||vd(o)&&!u&&VC(t,o))?r=r.filter(f=>f!==o):i=c,o=wa(o)}return e.set(t,r),r}function DF(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?Df(e)?[]:OF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=dN(e,f,i);return h.top=Pr(m.top,h.top),h.right=ba(m.right,h.right),h.bottom=ba(m.bottom,h.bottom),h.left=Pr(m.left,h.left),h},dN(e,c,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function LF(t){const{width:e,height:n}=$C(t);return{width:e,height:n}}function _F(t,e,n){const r=$s(e),i=Bs(e),a=n==="fixed",o=jo(t,!0,a,e);let c={scrollLeft:0,scrollTop:0};const u=Ds(0);function h(){u.x=_f(i)}if(r||!r&&!a)if(($l(e)!=="body"||vd(i))&&(c=Lf(e)),r){const y=jo(e,!0,a,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else i&&h();a&&!r&&i&&h();const f=i&&!r&&!a?BC(i,c):Ds(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 fg(t){return ws(t).position==="static"}function uN(t,e){if(!$s(t)||ws(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Bs(t)===n&&(n=n.ownerDocument.body),n}function HC(t,e){const n=_r(t);if(Df(t))return n;if(!$s(t)){let i=wa(t);for(;i&&!Ml(i);){if(bs(i)&&!fg(i))return i;i=wa(i)}return n}let r=uN(t,e);for(;r&&vF(r)&&fg(r);)r=uN(r,e);return r&&Ml(r)&&fg(r)&&!U0(r)?n:r||kF(t)||n}const zF=async function(t){const e=this.getOffsetParent||HC,n=this.getDimensions,r=await n(t.floating);return{reference:_F(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $F(t){return ws(t).direction==="rtl"}const FF={convertOffsetParentRelativeRectToViewportRelativeRect:TF,getDocumentElement:Bs,getClippingRect:DF,getOffsetParent:HC,getElementRects:zF,getClientRects:MF,getDimensions:LF,getScale:bl,isElement:bs,isRTL:$F};function WC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function BF(t,e){let n=null,r;const i=Bs(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 w=qu(m),N=qu(i.clientWidth-(f+g)),b=qu(i.clientHeight-(m+y)),k=qu(f),E={rootMargin:-w+"px "+-N+"px "+-b+"px "+-k+"px",threshold:Pr(0,ba(1,u))||1};let T=!0;function I(O){const D=O[0].intersectionRatio;if(D!==u){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!WC(h,t.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(I,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(I,E)}n.observe(t)}return o(!0),a}function VF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=q0(t),f=i||a?[...h?cd(h):[],...cd(e)]:[];f.forEach(k=>{i&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const m=h&&c?BF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[C]=k;C&&C.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let w,N=u?jo(t):null;u&&b();function b(){const k=jo(t);N&&!WC(N,k)&&n(),N=k,w=requestAnimationFrame(b)}return n(),()=>{var k;f.forEach(C=>{i&&C.removeEventListener("scroll",n),a&&C.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(w)}}const HF=fF,WF=pF,UF=dF,KF=gF,qF=uF,hN=cF,GF=mF,JF=(t,e,n)=>{const r=new Map,i={platform:FF,...n},a={...i.platform,_c:r};return lF(t,e,{...i,platform:a})};var YF=typeof document<"u",QF=function(){},sh=YF?v.useLayoutEffect:QF;function af(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,i;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(!af(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!(a==="_owner"&&t.$$typeof)&&!af(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function UC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function fN(t,e){const n=UC(t);return Math.round(e*n)/n}function pg(t){const e=v.useRef(t);return sh(()=>{e.current=t}),e}function XF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=v.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=v.useState(r);af(g,r)||y(r);const[w,N]=v.useState(null),[b,k]=v.useState(null),C=v.useCallback(z=>{z!==O.current&&(O.current=z,N(z))},[]),E=v.useCallback(z=>{z!==D.current&&(D.current=z,k(z))},[]),T=a||w,I=o||b,O=v.useRef(null),D=v.useRef(null),P=v.useRef(f),L=u!=null,_=pg(u),J=pg(i),ee=pg(h),Y=v.useCallback(()=>{if(!O.current||!D.current)return;const z={placement:e,strategy:n,middleware:g};J.current&&(z.platform=J.current),JF(O.current,D.current,z).then(ie=>{const G={...ie,isPositioned:ee.current!==!1};U.current&&!af(P.current,G)&&(P.current=G,ud.flushSync(()=>{m(G)}))})},[g,e,n,J,ee]);sh(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const U=v.useRef(!1);sh(()=>(U.current=!0,()=>{U.current=!1}),[]),sh(()=>{if(T&&(O.current=T),I&&(D.current=I),T&&I){if(_.current)return _.current(T,I,Y);Y()}},[T,I,Y,_,L]);const R=v.useMemo(()=>({reference:O,floating:D,setReference:C,setFloating:E}),[C,E]),F=v.useMemo(()=>({reference:T,floating:I}),[T,I]),re=v.useMemo(()=>{const z={position:n,left:0,top:0};if(!F.floating)return z;const ie=fN(F.floating,f.x),G=fN(F.floating,f.y);return c?{...z,transform:"translate("+ie+"px, "+G+"px)",...UC(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ie,top:G}},[n,c,F.floating,f.x,f.y]);return v.useMemo(()=>({...f,update:Y,refs:R,elements:F,floatingStyles:re}),[f,Y,R,F,re])}const ZF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?hN({element:r.current,padding:i}).fn(n):{}:r?hN({element:r,padding:i}).fn(n):{}}}},eB=(t,e)=>({...HF(t),options:[t,e]}),tB=(t,e)=>({...WF(t),options:[t,e]}),nB=(t,e)=>({...GF(t),options:[t,e]}),rB=(t,e)=>({...UF(t),options:[t,e]}),sB=(t,e)=>({...KF(t),options:[t,e]}),iB=(t,e)=>({...qF(t),options:[t,e]}),aB=(t,e)=>({...ZF(t),options:[t,e]});var oB="Arrow",KC=v.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...a}=t;return s.jsx(ht.svg,{...a,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});KC.displayName=oB;var lB=KC,G0="Popper",[qC,GC]=Sa(G0),[cB,JC]=qC(G0),YC=t=>{const{__scopePopper:e,children:n}=t,[r,i]=v.useState(null);return s.jsx(cB,{scope:e,anchor:r,onAnchorChange:i,children:n})};YC.displayName=G0;var QC="PopperAnchor",XC=v.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,a=JC(QC,n),o=v.useRef(null),c=Tt(e,o),u=v.useRef(null);return v.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&a.onAnchorChange(u.current)}),r?null:s.jsx(ht.div,{...i,ref:c})});XC.displayName=QC;var J0="PopperContent",[dB,uB]=qC(J0),ZC=v.forwardRef((t,e)=>{var de,he,be,Te,Ve,He;const{__scopePopper:n,side:r="bottom",sideOffset:i=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:w,...N}=t,b=JC(J0,n),[k,C]=v.useState(null),E=Tt(e,vt=>C(vt)),[T,I]=v.useState(null),O=Jx(T),D=(O==null?void 0:O.width)??0,P=(O==null?void 0:O.height)??0,L=r+(a!=="center"?"-"+a:""),_=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},J=Array.isArray(h)?h:[h],ee=J.length>0,Y={padding:_,boundary:J.filter(fB),altBoundary:ee},{refs:U,floatingStyles:R,placement:F,isPositioned:re,middlewareData:z}=XF({strategy:"fixed",placement:L,whileElementsMounted:(...vt)=>VF(...vt,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[eB({mainAxis:i+P,alignmentAxis:o}),u&&tB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?nB():void 0,...Y}),u&&rB({...Y}),sB({...Y,apply:({elements:vt,rects:Dt,availableWidth:vn,availableHeight:pt})=>{const{width:Rt,height:ne}=Dt.reference,Pe=vt.floating.style;Pe.setProperty("--radix-popper-available-width",`${vn}px`),Pe.setProperty("--radix-popper-available-height",`${pt}px`),Pe.setProperty("--radix-popper-anchor-width",`${Rt}px`),Pe.setProperty("--radix-popper-anchor-height",`${ne}px`)}}),T&&aB({element:T,padding:c}),pB({arrowWidth:D,arrowHeight:P}),g&&iB({strategy:"referenceHidden",...Y})]}),[ie,G]=n4(F),$=xa(w);tr(()=>{re&&($==null||$())},[re,$]);const V=(de=z.arrow)==null?void 0:de.x,ce=(he=z.arrow)==null?void 0:he.y,W=((be=z.arrow)==null?void 0:be.centerOffset)!==0,[fe,X]=v.useState();return tr(()=>{k&&X(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:re?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(Te=z.transformOrigin)==null?void 0:Te.x,(Ve=z.transformOrigin)==null?void 0:Ve.y].join(" "),...((He=z.hide)==null?void 0:He.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(dB,{scope:n,placedSide:ie,onArrowChange:I,arrowX:V,arrowY:ce,shouldHideArrow:W,children:s.jsx(ht.div,{"data-side":ie,"data-align":G,...N,ref:E,style:{...N.style,animation:re?void 0:"none"}})})})});ZC.displayName=J0;var e4="PopperArrow",hB={top:"bottom",right:"left",bottom:"top",left:"right"},t4=v.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,a=uB(e4,r),o=hB[a.placedSide];return s.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:s.jsx(lB,{...i,ref:n,style:{...i.style,display:"block"}})})});t4.displayName=e4;function fB(t){return t!==null}var pB=t=>({name:"transformOrigin",options:t,fn(e){var b,k,C;const{placement:n,rects:r,middlewareData:i}=e,o=((b=i.arrow)==null?void 0:b.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=n4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=i.arrow)==null?void 0:k.x)??0)+c/2,y=(((C=i.arrow)==null?void 0:C.y)??0)+u/2;let w="",N="";return h==="bottom"?(w=o?m:`${g}px`,N=`${-u}px`):h==="top"?(w=o?m:`${g}px`,N=`${r.floating.height+u}px`):h==="right"?(w=`${-u}px`,N=o?m:`${y}px`):h==="left"&&(w=`${r.floating.width+u}px`,N=o?m:`${y}px`),{data:{x:w,y:N}}}});function n4(t){const[e,n="center"]=t.split("-");return[e,n]}var mB=YC,gB=XC,xB=ZC,yB=t4,r4=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"}),vB="VisuallyHidden",bB=v.forwardRef((t,e)=>s.jsx(ht.span,{...t,ref:e,style:{...r4,...t.style}}));bB.displayName=vB;var wB=[" ","Enter","ArrowUp","ArrowDown"],NB=[" ","Enter"],ko="Select",[zf,$f,jB]=Kx(ko),[Fl]=Sa(ko,[jB,GC]),Ff=GC(),[kB,Ma]=Fl(ko),[SB,CB]=Fl(ko),s4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:w}=t,N=Ff(e),[b,k]=v.useState(null),[C,E]=v.useState(null),[T,I]=v.useState(!1),O=pf(h),[D,P]=po({prop:r,defaultProp:i??!1,onChange:a,caller:ko}),[L,_]=po({prop:o,defaultProp:c,onChange:u,caller:ko}),J=v.useRef(null),ee=b?w||!!b.closest("form"):!0,[Y,U]=v.useState(new Set),R=Array.from(Y).map(F=>F.props.value).join(";");return s.jsx(mB,{...N,children:s.jsxs(kB,{required:y,scope:e,trigger:b,onTriggerChange:k,valueNode:C,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:I,contentId:ha(),value:L,onValueChange:_,open:D,onOpenChange:P,dir:O,triggerPointerDownPosRef:J,disabled:g,children:[s.jsx(zf.Provider,{scope:e,children:s.jsx(SB,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback(F=>{U(re=>new Set(re).add(F))},[]),onNativeOptionRemove:v.useCallback(F=>{U(re=>{const z=new Set(re);return z.delete(F),z})},[]),children:n})}),ee?s.jsxs(C4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:L,onChange:F=>_(F.target.value),disabled:g,form:w,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(Y)]},R):null]})})};s4.displayName=ko;var i4="SelectTrigger",a4=v.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,a=Ff(n),o=Ma(i4,n),c=o.disabled||r,u=Tt(e,o.onTriggerChange),h=$f(n),f=v.useRef("touch"),[m,g,y]=T4(N=>{const b=h().filter(E=>!E.disabled),k=b.find(E=>E.value===o.value),C=M4(b,N,k);C!==void 0&&o.onValueChange(C.value)}),w=N=>{c||(o.onOpenChange(!0),y()),N&&(o.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return s.jsx(gB,{asChild:!0,...a,children:s.jsx(ht.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":E4(o.value)?"":void 0,...i,ref:u,onClick:ot(i.onClick,N=>{N.currentTarget.focus(),f.current!=="mouse"&&w(N)}),onPointerDown:ot(i.onPointerDown,N=>{f.current=N.pointerType;const b=N.target;b.hasPointerCapture(N.pointerId)&&b.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(w(N),N.preventDefault())}),onKeyDown:ot(i.onKeyDown,N=>{const b=m.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&g(N.key),!(b&&N.key===" ")&&wB.includes(N.key)&&(w(),N.preventDefault())})})})});a4.displayName=i4;var o4="SelectValue",l4=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...c}=t,u=Ma(o4,n),{onValueNodeHasChildrenChange:h}=u,f=a!==void 0,m=Tt(e,u.onValueNodeChange);return tr(()=>{h(f)},[h,f]),s.jsx(ht.span,{...c,ref:m,style:{pointerEvents:"none"},children:E4(u.value)?s.jsx(s.Fragment,{children:o}):a})});l4.displayName=o4;var EB="SelectIcon",c4=v.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return s.jsx(ht.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});c4.displayName=EB;var TB="SelectPortal",d4=t=>s.jsx(Fx,{asChild:!0,...t});d4.displayName=TB;var So="SelectContent",u4=v.forwardRef((t,e)=>{const n=Ma(So,t.__scopeSelect),[r,i]=v.useState();if(tr(()=>{i(new DocumentFragment)},[]),!n.open){const a=r;return a?ud.createPortal(s.jsx(h4,{scope:t.__scopeSelect,children:s.jsx(zf.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),a):null}return s.jsx(f4,{...t,ref:e})});u4.displayName=So;var ms=10,[h4,Aa]=Fl(So),MB="SelectContentImpl",AB=Yc("SelectContent.RemoveScroll"),f4=v.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:w,hideWhenDetached:N,avoidCollisions:b,...k}=t,C=Ma(So,n),[E,T]=v.useState(null),[I,O]=v.useState(null),D=Tt(e,de=>T(de)),[P,L]=v.useState(null),[_,J]=v.useState(null),ee=$f(n),[Y,U]=v.useState(!1),R=v.useRef(!1);v.useEffect(()=>{if(E)return Tj(E)},[E]),vj();const F=v.useCallback(de=>{const[he,...be]=ee().map(He=>He.ref.current),[Te]=be.slice(-1),Ve=document.activeElement;for(const He of de)if(He===Ve||(He==null||He.scrollIntoView({block:"nearest"}),He===he&&I&&(I.scrollTop=0),He===Te&&I&&(I.scrollTop=I.scrollHeight),He==null||He.focus(),document.activeElement!==Ve))return},[ee,I]),re=v.useCallback(()=>F([P,E]),[F,P,E]);v.useEffect(()=>{Y&&re()},[Y,re]);const{onOpenChange:z,triggerPointerDownPosRef:ie}=C;v.useEffect(()=>{if(E){let de={x:0,y:0};const he=Te=>{var Ve,He;de={x:Math.abs(Math.round(Te.pageX)-(((Ve=ie.current)==null?void 0:Ve.x)??0)),y:Math.abs(Math.round(Te.pageY)-(((He=ie.current)==null?void 0:He.y)??0))}},be=Te=>{de.x<=10&&de.y<=10?Te.preventDefault():E.contains(Te.target)||z(!1),document.removeEventListener("pointermove",he),ie.current=null};return ie.current!==null&&(document.addEventListener("pointermove",he),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",be,{capture:!0})}}},[E,z,ie]),v.useEffect(()=>{const de=()=>z(!1);return window.addEventListener("blur",de),window.addEventListener("resize",de),()=>{window.removeEventListener("blur",de),window.removeEventListener("resize",de)}},[z]);const[G,$]=T4(de=>{const he=ee().filter(Ve=>!Ve.disabled),be=he.find(Ve=>Ve.ref.current===document.activeElement),Te=M4(he,de,be);Te&&setTimeout(()=>Te.ref.current.focus())}),V=v.useCallback((de,he,be)=>{const Te=!R.current&&!be;(C.value!==void 0&&C.value===he||Te)&&(L(de),Te&&(R.current=!0))},[C.value]),ce=v.useCallback(()=>E==null?void 0:E.focus(),[E]),W=v.useCallback((de,he,be)=>{const Te=!R.current&&!be;(C.value!==void 0&&C.value===he||Te)&&J(de)},[C.value]),fe=r==="popper"?jx:p4,X=fe===jx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:w,hideWhenDetached:N,avoidCollisions:b}:{};return s.jsx(h4,{scope:n,content:E,viewport:I,onViewportChange:O,itemRefCallback:V,selectedItem:P,onItemLeave:ce,itemTextRefCallback:W,focusSelectedItem:re,selectedItemText:_,position:r,isPositioned:Y,searchRef:G,children:s.jsx(Bx,{as:AB,allowPinchZoom:!0,children:s.jsx($x,{asChild:!0,trapped:C.open,onMountAutoFocus:de=>{de.preventDefault()},onUnmountAutoFocus:ot(i,de=>{var he;(he=C.trigger)==null||he.focus({preventScroll:!0}),de.preventDefault()}),children:s.jsx(zx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:de=>de.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:s.jsx(fe,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:de=>de.preventDefault(),...k,...X,onPlaced:()=>U(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:ot(k.onKeyDown,de=>{const he=de.ctrlKey||de.altKey||de.metaKey;if(de.key==="Tab"&&de.preventDefault(),!he&&de.key.length===1&&$(de.key),["ArrowUp","ArrowDown","Home","End"].includes(de.key)){let Te=ee().filter(Ve=>!Ve.disabled).map(Ve=>Ve.ref.current);if(["ArrowUp","End"].includes(de.key)&&(Te=Te.slice().reverse()),["ArrowUp","ArrowDown"].includes(de.key)){const Ve=de.target,He=Te.indexOf(Ve);Te=Te.slice(He+1)}setTimeout(()=>F(Te)),de.preventDefault()}})})})})})})});f4.displayName=MB;var IB="SelectItemAlignedPosition",p4=v.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,a=Ma(So,n),o=Aa(So,n),[c,u]=v.useState(null),[h,f]=v.useState(null),m=Tt(e,D=>f(D)),g=$f(n),y=v.useRef(!1),w=v.useRef(!0),{viewport:N,selectedItem:b,selectedItemText:k,focusSelectedItem:C}=o,E=v.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&h&&N&&b&&k){const D=a.trigger.getBoundingClientRect(),P=h.getBoundingClientRect(),L=a.valueNode.getBoundingClientRect(),_=k.getBoundingClientRect();if(a.dir!=="rtl"){const Ve=_.left-P.left,He=L.left-Ve,vt=D.left-He,Dt=D.width+vt,vn=Math.max(Dt,P.width),pt=window.innerWidth-ms,Rt=hh(He,[ms,Math.max(ms,pt-vn)]);c.style.minWidth=Dt+"px",c.style.left=Rt+"px"}else{const Ve=P.right-_.right,He=window.innerWidth-L.right-Ve,vt=window.innerWidth-D.right-He,Dt=D.width+vt,vn=Math.max(Dt,P.width),pt=window.innerWidth-ms,Rt=hh(He,[ms,Math.max(ms,pt-vn)]);c.style.minWidth=Dt+"px",c.style.right=Rt+"px"}const J=g(),ee=window.innerHeight-ms*2,Y=N.scrollHeight,U=window.getComputedStyle(h),R=parseInt(U.borderTopWidth,10),F=parseInt(U.paddingTop,10),re=parseInt(U.borderBottomWidth,10),z=parseInt(U.paddingBottom,10),ie=R+F+Y+z+re,G=Math.min(b.offsetHeight*5,ie),$=window.getComputedStyle(N),V=parseInt($.paddingTop,10),ce=parseInt($.paddingBottom,10),W=D.top+D.height/2-ms,fe=ee-W,X=b.offsetHeight/2,de=b.offsetTop+X,he=R+F+de,be=ie-he;if(he<=W){const Ve=J.length>0&&b===J[J.length-1].ref.current;c.style.bottom="0px";const He=h.clientHeight-N.offsetTop-N.offsetHeight,vt=Math.max(fe,X+(Ve?ce:0)+He+re),Dt=he+vt;c.style.height=Dt+"px"}else{const Ve=J.length>0&&b===J[0].ref.current;c.style.top="0px";const vt=Math.max(W,R+N.offsetTop+(Ve?V:0)+X)+be;c.style.height=vt+"px",N.scrollTop=he-W+N.offsetTop}c.style.margin=`${ms}px 0`,c.style.minHeight=G+"px",c.style.maxHeight=ee+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,a.trigger,a.valueNode,c,h,N,b,k,a.dir,r]);tr(()=>E(),[E]);const[T,I]=v.useState();tr(()=>{h&&I(window.getComputedStyle(h).zIndex)},[h]);const O=v.useCallback(D=>{D&&w.current===!0&&(E(),C==null||C(),w.current=!1)},[E,C]);return s.jsx(PB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:O,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:s.jsx(ht.div,{...i,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});p4.displayName=IB;var RB="SelectPopperPosition",jx=v.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=ms,...a}=t,o=Ff(n);return s.jsx(xB,{...o,...a,ref:e,align:r,collisionPadding:i,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)"}})});jx.displayName=RB;var[PB,Y0]=Fl(So,{}),kx="SelectViewport",m4=v.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,a=Aa(kx,n),o=Y0(kx,n),c=Tt(e,a.onViewportChange),u=v.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(zf.Slot,{scope:n,children:s.jsx(ht.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ot(i.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 w=window.innerHeight-ms*2,N=parseFloat(m.style.minHeight),b=parseFloat(m.style.height),k=Math.max(N,b);if(k0?T:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});m4.displayName=kx;var g4="SelectGroup",[OB,DB]=Fl(g4),LB=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=ha();return s.jsx(OB,{scope:n,id:i,children:s.jsx(ht.div,{role:"group","aria-labelledby":i,...r,ref:e})})});LB.displayName=g4;var x4="SelectLabel",_B=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=DB(x4,n);return s.jsx(ht.div,{id:i.id,...r,ref:e})});_B.displayName=x4;var of="SelectItem",[zB,y4]=Fl(of),v4=v.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=t,c=Ma(of,n),u=Aa(of,n),h=c.value===r,[f,m]=v.useState(a??""),[g,y]=v.useState(!1),w=Tt(e,C=>{var E;return(E=u.itemRefCallback)==null?void 0:E.call(u,C,r,i)}),N=ha(),b=v.useRef("touch"),k=()=>{i||(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 s.jsx(zB,{scope:n,value:r,disabled:i,textId:N,isSelected:h,onItemTextChange:v.useCallback(C=>{m(E=>E||((C==null?void 0:C.textContent)??"").trim())},[]),children:s.jsx(zf.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:s.jsx(ht.div,{role:"option","aria-labelledby":N,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:w,onFocus:ot(o.onFocus,()=>y(!0)),onBlur:ot(o.onBlur,()=>y(!1)),onClick:ot(o.onClick,()=>{b.current!=="mouse"&&k()}),onPointerUp:ot(o.onPointerUp,()=>{b.current==="mouse"&&k()}),onPointerDown:ot(o.onPointerDown,C=>{b.current=C.pointerType}),onPointerMove:ot(o.onPointerMove,C=>{var E;b.current=C.pointerType,i?(E=u.onItemLeave)==null||E.call(u):b.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ot(o.onPointerLeave,C=>{var E;C.currentTarget===document.activeElement&&((E=u.onItemLeave)==null||E.call(u))}),onKeyDown:ot(o.onKeyDown,C=>{var T;((T=u.searchRef)==null?void 0:T.current)!==""&&C.key===" "||(NB.includes(C.key)&&k(),C.key===" "&&C.preventDefault())})})})})});v4.displayName=of;var Pc="SelectItemText",b4=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...a}=t,o=Ma(Pc,n),c=Aa(Pc,n),u=y4(Pc,n),h=CB(Pc,n),[f,m]=v.useState(null),g=Tt(e,k=>m(k),u.onItemTextChange,k=>{var C;return(C=c.itemTextRefCallback)==null?void 0:C.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,w=v.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:N,onNativeOptionRemove:b}=h;return tr(()=>(N(w),()=>b(w)),[N,b,w]),s.jsxs(s.Fragment,{children:[s.jsx(ht.span,{id:u.textId,...a,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ud.createPortal(a.children,o.valueNode):null]})});b4.displayName=Pc;var w4="SelectItemIndicator",N4=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return y4(w4,n).isSelected?s.jsx(ht.span,{"aria-hidden":!0,...r,ref:e}):null});N4.displayName=w4;var Sx="SelectScrollUpButton",j4=v.forwardRef((t,e)=>{const n=Aa(Sx,t.__scopeSelect),r=Y0(Sx,t.__scopeSelect),[i,a]=v.useState(!1),o=Tt(e,r.onScrollButtonChange);return tr(()=>{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]),i?s.jsx(S4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});j4.displayName=Sx;var Cx="SelectScrollDownButton",k4=v.forwardRef((t,e)=>{const n=Aa(Cx,t.__scopeSelect),r=Y0(Cx,t.__scopeSelect),[i,a]=v.useState(!1),o=Tt(e,r.onScrollButtonChange);return tr(()=>{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]),i?s.jsx(S4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});k4.displayName=Cx;var S4=v.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,a=Aa("SelectScrollButton",n),o=v.useRef(null),c=$f(n),u=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>u(),[u]),tr(()=>{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]),s.jsx(ht.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:ot(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ot(i.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ot(i.onPointerLeave,()=>{u()})})}),$B="SelectSeparator",FB=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(ht.div,{"aria-hidden":!0,...r,ref:e})});FB.displayName=$B;var Ex="SelectArrow",BB=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Ff(n),a=Ma(Ex,n),o=Aa(Ex,n);return a.open&&o.position==="popper"?s.jsx(yB,{...i,...r,ref:e}):null});BB.displayName=Ex;var VB="SelectBubbleInput",C4=v.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=v.useRef(null),a=Tt(r,i),o=Gx(e);return v.useEffect(()=>{const c=i.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]),s.jsx(ht.select,{...n,style:{...r4,...n.style},ref:a,defaultValue:e})});C4.displayName=VB;function E4(t){return t===""||t===void 0}function T4(t){const e=xa(t),n=v.useRef(""),r=v.useRef(0),i=v.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=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function M4(t,e,n){const i=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=HB(t,Math.max(a,0));i.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function HB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var WB=s4,A4=a4,UB=l4,KB=c4,qB=d4,I4=u4,GB=m4,R4=v4,JB=b4,YB=N4,QB=j4,XB=k4;const cl=WB,dl=UB,Za=v.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(A4,{ref:r,className:Mt("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,s.jsx(KB,{asChild:!0,children:s.jsx(Jc,{className:"h-4 w-4 opacity-50"})})]}));Za.displayName=A4.displayName;const eo=v.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>s.jsx(qB,{children:s.jsxs(I4,{ref:i,className:Mt("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:[s.jsx(QB,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(VN,{className:"h-4 w-4"})}),s.jsx(GB,{className:"p-1",children:e}),s.jsx(XB,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Jc,{className:"h-4 w-4"})})]})}));eo.displayName=I4.displayName;const Rr=v.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(R4,{ref:r,className:Mt("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:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(YB,{children:s.jsx(df,{className:"h-4 w-4"})})}),s.jsx(JB,{children:e})]}));Rr.displayName=R4.displayName;function ZB(){const[t,e]=v.useState([]),[n,r]=v.useState(!0),[i,a]=v.useState(!1),[o,c]=v.useState(null),[u,h]=v.useState({name:"",appId:"",path:"",sort:0}),[f,m]=v.useState(!1);async function g(){r(!0);try{const k=await Le("/api/admin/linked-miniprograms");if(k!=null&&k.success&&Array.isArray(k.data)){const C=[...k.data].sort((E,T)=>(E.sort??0)-(T.sort??0));e(C)}}catch(k){console.error("Load linked miniprograms error:",k),ae.error("加载失败")}finally{r(!1)}}v.useEffect(()=>{g()},[]);function y(){c(null),h({name:"",appId:"",path:"",sort:t.length}),a(!0)}function w(k){c(k),h({name:k.name,appId:k.appId,path:k.path??"",sort:k.sort??0}),a(!0)}async function N(){const k=u.name.trim(),C=u.appId.trim();if(!k||!C){ae.error("请填写小程序名称和 AppID");return}m(!0);try{if(o){const E=await It("/api/admin/linked-miniprograms",{key:o.key,name:k,appId:C,path:u.path.trim(),sort:u.sort});E!=null&&E.success?(ae.success("已更新"),a(!1),g()):ae.error((E==null?void 0:E.error)??"更新失败")}else{const E=await yt("/api/admin/linked-miniprograms",{name:k,appId:C,path:u.path.trim(),sort:u.sort});E!=null&&E.success?(ae.success("已添加"),a(!1),g()):ae.error((E==null?void 0:E.error)??"添加失败")}}catch{ae.error("操作失败")}finally{m(!1)}}async function b(k){if(confirm(`确定要删除「${k.name}」吗?`))try{const C=await Rs(`/api/admin/linked-miniprograms/${k.key}`);C!=null&&C.success?(ae.success("已删除"),g()):ae.error((C==null?void 0:C.error)??"删除失败")}catch{ae.error("删除失败")}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ho,{className:"w-5 h-5 text-[#38bdac]"}),"关联小程序管理"]}),s.jsx(Vt,{className:"text-gray-400",children:"添加后生成 32 位密钥,链接标签选择小程序时存密钥;小程序端点击 #标签 时用密钥查 appId 再跳转。需在 app.json 的 navigateToMiniProgramAppIdList 中配置目标 AppID。"})]}),s.jsxs(Ae,{children:[s.jsx("div",{className:"flex justify-end mb-4",children:s.jsxs(te,{onClick:y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"添加关联小程序"]})}),n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"名称"}),s.jsx(je,{className:"text-gray-400",children:"密钥"}),s.jsx(je,{className:"text-gray-400",children:"AppID"}),s.jsx(je,{className:"text-gray-400",children:"路径"}),s.jsx(je,{className:"text-gray-400 w-24",children:"排序"}),s.jsx(je,{className:"text-gray-400 w-32",children:"操作"})]})}),s.jsxs(sr,{children:[t.map(k=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-white",children:k.name}),s.jsx(xe,{className:"text-gray-300 font-mono text-xs",children:k.key}),s.jsx(xe,{className:"text-gray-300 font-mono text-sm",children:k.appId}),s.jsx(xe,{className:"text-gray-400 text-sm",children:k.path||"—"}),s.jsx(xe,{className:"text-gray-300",children:k.sort??0}),s.jsx(xe,{children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/20",onClick:()=>w(k),children:s.jsx(YN,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:bg-red-500/20",onClick:()=>b(k),children:s.jsx(Hn,{className:"w-4 h-4"})})]})})]},k.key)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无关联小程序,点击「添加关联小程序」开始配置"})})]})]})]})]}),s.jsx(Yt,{open:i,onOpenChange:a,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Qt,{className:"gap-1",children:[s.jsx(Xt,{className:"text-base",children:o?"编辑关联小程序":"添加关联小程序"}),s.jsx(Ux,{className:"text-gray-400 text-xs",children:"填写目标小程序的名称和 AppID,路径可选(为空则打开首页)"})]}),s.jsxs("div",{className:"space-y-3 py-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"小程序名称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"例如:Soul 创业派对",value:u.name,onChange:k=>h(C=>({...C,name:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"AppID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono h-8 text-sm",placeholder:"例如:wxb8bbb2b10dec74aa",value:u.appId,onChange:k=>h(C=>({...C,appId:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"路径(可选)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"例如:pages/index/index",value:u.path,onChange:k=>h(C=>({...C,path:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm w-20",value:u.sort,onChange:k=>h(C=>({...C,sort:parseInt(k.target.value,10)||0}))})]})]}),s.jsxs(fn,{className:"gap-2 pt-1",children:[s.jsx(te,{variant:"outline",onClick:()=>a(!1),className:"border-gray-600",children:"取消"}),s.jsx(te,{onClick:N,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:f?"保存中...":"保存"})]})]})})]})}const eV=["一","二","三","四","五","六","七","八","九","十"];function mg(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 tV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:i,onDeleteSection:a,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:w,pinnedSectionIds:N=[]}){const[b,k]=v.useState(null),[C,E]=v.useState(null),T=(_,J)=>(b==null?void 0:b.type)===_&&(b==null?void 0:b.id)===J,I=(_,J)=>(C==null?void 0:C.type)===_&&(C==null?void 0:C.id)===J,O=v.useCallback(()=>{const _=[];for(const J of t)for(const ee of J.chapters)for(const Y of ee.sections)_.push({id:Y.id,partId:J.id,partTitle:J.title,chapterId:ee.id,chapterTitle:ee.title});return _},[t]),D=v.useCallback(async(_,J,ee,Y)=>{var z;_.preventDefault(),_.stopPropagation();const U=_.dataTransfer.getData("text/plain"),R=mg(U);if(!R||R.type===J&&R.id===ee)return;const F=O(),re=new Map(F.map(ie=>[ie.id,ie]));if(R.type==="part"&&J==="part"){const ie=t.map(W=>W.id),G=ie.indexOf(R.id),$=ie.indexOf(ee);if(G===-1||$===-1)return;const V=[...ie];V.splice(G,1),V.splice(G<$?$-1:$,0,R.id);const ce=[];for(const W of V){const fe=t.find(X=>X.id===W);if(fe)for(const X of fe.chapters)for(const de of X.sections){const he=re.get(de.id);he&&ce.push(he)}}await r(ce);return}if(R.type==="chapter"&&(J==="chapter"||J==="section"||J==="part")){const ie=t.find(he=>he.chapters.some(be=>be.id===R.id)),G=ie==null?void 0:ie.chapters.find(he=>he.id===R.id);if(!ie||!G)return;let $,V,ce=null;if(J==="section"){const he=re.get(ee);if(!he)return;$=he.partId,V=he.partTitle,ce=ee}else if(J==="chapter"){const he=t.find(Ve=>Ve.chapters.some(He=>He.id===ee)),be=he==null?void 0:he.chapters.find(Ve=>Ve.id===ee);if(!he||!be)return;$=he.id,V=he.title;const Te=F.filter(Ve=>Ve.chapterId===ee).pop();ce=(Te==null?void 0:Te.id)??null}else{const he=t.find(Te=>Te.id===ee);if(!he||!he.chapters[0])return;$=he.id,V=he.title;const be=F.filter(Te=>Te.partId===he.id&&Te.chapterId===he.chapters[0].id);ce=((z=be[be.length-1])==null?void 0:z.id)??null}const W=G.sections.map(he=>he.id),fe=F.filter(he=>!W.includes(he.id));let X=fe.length;if(ce){const he=fe.findIndex(be=>be.id===ce);he>=0&&(X=he+1)}const de=W.map(he=>({...re.get(he),partId:$,partTitle:V,chapterId:G.id,chapterTitle:G.title}));await r([...fe.slice(0,X),...de,...fe.slice(X)]);return}if(R.type==="section"&&(J==="section"||J==="chapter"||J==="part")){if(!Y)return;const{partId:ie,partTitle:G,chapterId:$,chapterTitle:V}=Y;let ce;if(J==="section")ce=F.findIndex(be=>be.id===ee);else if(J==="chapter"){const be=F.filter(Te=>Te.chapterId===ee).pop();ce=be?F.findIndex(Te=>Te.id===be.id)+1:F.length}else{const be=t.find(He=>He.id===ee);if(!(be!=null&&be.chapters[0]))return;const Te=F.filter(He=>He.partId===be.id&&He.chapterId===be.chapters[0].id),Ve=Te[Te.length-1];ce=Ve?F.findIndex(He=>He.id===Ve.id)+1:0}const W=F.findIndex(be=>be.id===R.id);if(W===-1)return;const fe=F.filter(be=>be.id!==R.id),X=W({onDragEnter:Y=>{Y.preventDefault(),Y.stopPropagation(),Y.dataTransfer.dropEffect="move",E({type:_,id:J})},onDragOver:Y=>{Y.preventDefault(),Y.stopPropagation(),Y.dataTransfer.dropEffect="move",E({type:_,id:J})},onDragLeave:()=>E(null),onDrop:Y=>{E(null);const U=mg(Y.dataTransfer.getData("text/plain"));if(U&&!(_==="section"&&U.type==="section"&&U.id===J))if(_==="part")if(U.type==="part")D(Y,"part",J);else{const R=t.find(re=>re.id===J);(R==null?void 0:R.chapters[0])&&ee&&D(Y,"part",J,ee)}else _==="chapter"&&ee?(U.type==="section"||U.type==="chapter")&&D(Y,"chapter",J,ee):_==="section"&&ee&&D(Y,"section",J,ee)}}),L=_=>eV[_]??String(_+1);return s.jsx("div",{className:"space-y-3",children:t.map((_,J)=>{var G,$,V,ce;const ee=_.title==="序言"||_.title.includes("序言"),Y=_.title==="尾声"||_.title.includes("尾声"),U=_.title==="附录"||_.title.includes("附录"),R=I("part",_.id),F=e.includes(_.id),re=_.chapters.length,z=_.chapters.reduce((W,fe)=>W+fe.sections.length,0);if(ee&&_.chapters.length===1&&_.chapters[0].sections.length===1){const W=_.chapters[0].sections[0],fe=I("section",W.id),X={partId:_.id,partTitle:_.title,chapterId:_.chapters[0].id,chapterTitle:_.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+W.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:W.id})},onDragEnd:()=>{k(null),E(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",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",W.id,X),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ii,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(W.id),onChange:()=>y(W.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Xr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[_.chapters[0].title," | ",W.title]}),N.includes(W.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(fl,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[W.price===0||W.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",W.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",W.clickCount??0," · 付款 ",W.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(W.hotScore??0).toFixed(1)," · 第",W.hotRank&&W.hotRank>0?W.hotRank:"-","名"]}),w&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>w(W),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(W),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)}if(_.title==="2026每日派对干货"||_.title.includes("2026每日派对干货")){const W=I("part",_.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${W?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...P("part",_.id,{partId:_.id,partTitle:_.title,chapterId:((G=_.chapters[0])==null?void 0:G.id)??"",chapterTitle:(($=_.chapters[0])==null?void 0:$.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:fe=>{fe.stopPropagation(),fe.dataTransfer.setData("text/plain","part:"+_.id),fe.dataTransfer.effectAllowed="move",k({type:"part",id:_.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(_.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ii,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:_.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",z," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:fe=>fe.stopPropagation(),onClick:fe=>fe.stopPropagation(),children:[o&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(un,{className:"w-3.5 h-3.5"})}),h&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),f&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(_),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[re,"章"]}),F?s.jsx(Jc,{className:"w-5 h-5 text-gray-500"}):s.jsx(ul,{className:"w-5 h-5 text-gray-500"})]})]}),F&&_.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:_.chapters.map(fe=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:fe.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:X=>X.stopPropagation(),children:[m&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>m(_,fe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),c&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>c(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(un,{className:"w-3.5 h-3.5"})}),u&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>u(_,fe),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:fe.sections.map(X=>{const de=I("section",X.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+X.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:X.id})},onDragEnd:()=>{k(null),E(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 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",X.id,{partId:_.id,partTitle:_.title,chapterId:fe.id,chapterTitle:fe.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ii,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(X.id),onChange:()=>y(X.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[X.id," ",X.title]}),N.includes(X.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(fl,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),w&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(X),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})})]})]},X.id)})})]},fe.id))})]},_.id)}if(U)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:_.chapters.map((W,fe)=>W.sections.length>0?W.sections.map(X=>{const de=I("section",X.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+X.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:X.id})},onDragEnd:()=>{k(null),E(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 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",X.id,{partId:_.id,partTitle:_.title,chapterId:W.id,chapterTitle:W.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ii,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(X.id),onChange:()=>y(X.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",fe+1," | ",W.title," | ",X.title]}),N.includes(X.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(fl,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),w&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(X),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(ul,{className:"w-4 h-4 text-gray-500 shrink-0"})]},X.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",fe+1," | ",W.title,"(空)"]}),s.jsx(ul,{className:"w-4 h-4 text-gray-500 shrink-0"})]},W.id))})]},_.id);if(Y&&_.chapters.length===1&&_.chapters[0].sections.length===1){const W=_.chapters[0].sections[0],fe=I("section",W.id),X={partId:_.id,partTitle:_.title,chapterId:_.chapters[0].id,chapterTitle:_.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+W.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:W.id})},onDragEnd:()=>{k(null),E(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",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",W.id,X),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ii,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(W.id),onChange:()=>y(W.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Xr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[_.chapters[0].title," | ",W.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[W.price===0||W.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",W.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",W.clickCount??0," · 付款 ",W.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(W.hotScore??0).toFixed(1)," · 第",W.hotRank&&W.hotRank>0?W.hotRank:"-","名"]}),w&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>w(W),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(W),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)}return Y?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:_.chapters.map(W=>W.sections.map(fe=>{const X=I("section",fe.id);return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+fe.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:fe.id})},onDragEnd:()=>{k(null),E(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 ${X?"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:_.id,partTitle:_.title,chapterId:W.id,chapterTitle:W.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ii,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.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]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[W.title," | ",fe.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",fe.clickCount??0," · 付款 ",fe.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(fe.hotScore??0).toFixed(1)," · 第",fe.hotRank&&fe.hotRank>0?fe.hotRank:"-","名"]}),w&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>w(fe),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(fe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(fe),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})})]})]})]},fe.id)}))})]},_.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${R?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...P("part",_.id,{partId:_.id,partTitle:_.title,chapterId:((V=_.chapters[0])==null?void 0:V.id)??"",chapterTitle:((ce=_.chapters[0])==null?void 0:ce.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:W=>{W.stopPropagation(),W.dataTransfer.setData("text/plain","part:"+_.id),W.dataTransfer.effectAllowed="move",k({type:"part",id:_.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(_.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ii,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.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:L(J)}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:_.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",z," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:W=>W.stopPropagation(),onClick:W=>W.stopPropagation(),children:[o&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(un,{className:"w-3.5 h-3.5"})}),h&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),f&&s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(_),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[re,"章"]}),F?s.jsx(Jc,{className:"w-5 h-5 text-gray-500"}):s.jsx(ul,{className:"w-5 h-5 text-gray-500"})]})]}),F&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:_.chapters.map(W=>{const fe=I("chapter",W.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:X=>{X.stopPropagation(),X.dataTransfer.setData("text/plain","chapter:"+W.id),X.dataTransfer.effectAllowed="move",k({type:"chapter",id:W.id})},onDragEnd:()=>{k(null),E(null)},onDragEnter:X=>{X.preventDefault(),X.stopPropagation(),X.dataTransfer.dropEffect="move",E({type:"chapter",id:W.id})},onDragOver:X=>{X.preventDefault(),X.stopPropagation(),X.dataTransfer.dropEffect="move",E({type:"chapter",id:W.id})},onDragLeave:()=>E(null),onDrop:X=>{E(null);const de=mg(X.dataTransfer.getData("text/plain"));if(!de)return;const he={partId:_.id,partTitle:_.title,chapterId:W.id,chapterTitle:W.title};(de.type==="section"||de.type==="chapter")&&D(X,"chapter",W.id,he)},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",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(ii,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:W.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:X=>X.stopPropagation(),children:[m&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>m(_,W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),c&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>c(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(un,{className:"w-3.5 h-3.5"})}),u&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>u(_,W),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:W.sections.map(X=>{const de=I("section",X.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+X.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:X.id})},onDragEnd:()=>{k(null),E(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 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...P("section",X.id,{partId:_.id,partTitle:_.title,chapterId:W.id,chapterTitle:W.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(X.id),onChange:()=>y(X.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(ii,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${X.price===0||X.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[X.id," ",X.title]}),N.includes(X.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(fl,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:he=>he.stopPropagation(),onClick:he=>he.stopPropagation(),children:[X.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),X.price===0||X.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",X.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),w&&s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(X),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(te,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Hn,{className:"w-3.5 h-3.5"})})]})]})]},X.id)})})]},W.id)})})]},_.id)})})}function nV(t){var i;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(i=t==null?void 0:t.keyword)!=null&&i.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString(),r=n?`/api/admin/ckb/devices?${n}`:"/api/admin/ckb/devices";return Le(r)}function rV(t){return Le(`/api/db/person?personId=${encodeURIComponent(t)}`)}const P4=11,pN={personId:"",name:"",label:"",sceneId:P4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"09:00",endTime:"18:00",deviceGroups:""};function sV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){const i=!!n,[a,o]=v.useState(pN),[c,u]=v.useState(!1),[h,f]=v.useState(!1),[m,g]=v.useState([]),[y,w]=v.useState(!1),[N,b]=v.useState(""),[k,C]=v.useState({});v.useEffect(()=>{t&&(b(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",label:n.label??"",sceneId:P4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"09:00",endTime:n.endTime??"18:00",deviceGroups:n.deviceGroups??""}:{...pN}),C({}),m.length===0&&E(""))},[t,n]);const E=async I=>{w(!0);try{const O=await nV({page:1,limit:50,keyword:I});O!=null&&O.success&&Array.isArray(O.devices)?g(O.devices):O!=null&&O.error&&ae.error(O.error)}catch(O){ae.error(O instanceof Error?O.message:"加载设备列表失败")}finally{w(!1)}},T=async()=>{var P;const I={};(!a.name||!String(a.name).trim())&&(I.name="请填写名称");const O=a.addFriendInterval;if((typeof O!="number"||O<1)&&(I.addFriendInterval="添加间隔至少为 1 分钟"),(((P=a.deviceGroups)==null?void 0:P.split(",").map(L=>L.trim()).filter(Boolean))??[]).length===0&&(I.deviceGroups="请至少选择 1 台设备"),C(I),Object.keys(I).length>0){ae.error(I.name||I.addFriendInterval||I.deviceGroups||"请完善必填项");return}u(!0);try{await r(a),e(!1)}catch(L){ae.error(L instanceof Error?L.message:"保存失败")}finally{u(!1)}};return s.jsx(Yt,{open:t,onOpenChange:e,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Qt,{children:[s.jsx(Xt,{className:"text-[#38bdac]",children:i?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(Ux,{className:"text-gray-400 text-sm",children:i?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Z,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(oe,{className:`bg-[#0a1628] text-white ${k.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:a.name,onChange:I=>{o(O=>({...O,name:I.target.value})),k.name&&C(O=>({...O,name:void 0}))}}),k.name&&s.jsx("p",{className:"text-xs text-red-400",children:k.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:a.personId,onChange:I=>o(O=>({...O,personId:I.target.value})),disabled:i})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:a.label,onChange:I=>o(O=>({...O,label:I.target.value}))})]})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-4",children:"存客宝 API 获客配置"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"存客宝密钥(计划 apiKey)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创建计划成功后自动回填,不可手动修改",value:a.ckbApiKey,readOnly:!0}),s.jsx("p",{className:"text-xs text-gray-500",children:"由存客宝计划详情接口返回的 apiKey,用于小程序 @人物 时推送到对应获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Z,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${k.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(oe,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:a.deviceGroups?`已选择 ${a.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(te,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),k.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:k.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(cl,{value:a.remarkType,onValueChange:I=>o(O=>({...O,remarkType:I})),children:[s.jsx(Za,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(dl,{placeholder:"选择备注类型"})}),s.jsxs(eo,{children:[s.jsx(Rr,{value:"phone",children:"手机号"}),s.jsx(Rr,{value:"nickname",children:"昵称"}),s.jsx(Rr,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"备注格式"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 手机号+SOUL链接人与事-{名称},留空用默认",value:a.remarkFormat,onChange:I=>o(O=>({...O,remarkFormat:I.target.value}))})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:a.greeting,onChange:I=>o(O=>({...O,greeting:I.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(oe,{type:"number",min:1,className:`bg-[#0a1628] text-white ${k.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:a.addFriendInterval,onChange:I=>{o(O=>({...O,addFriendInterval:Number(I.target.value)||1})),k.addFriendInterval&&C(O=>({...O,addFriendInterval:void 0}))}}),k.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:k.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(oe,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:a.startTime,onChange:I=>o(O=>({...O,startTime:I.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(oe,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:a.endTime,onChange:I=>o(O=>({...O,endTime:I.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(Dl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:a.tips,onChange:I=>o(O=>({...O,tips:I.target.value}))})]})]})]})]})]}),s.jsxs(fn,{className:"gap-3 pt-2",children:[s.jsx(te,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(te,{onClick:T,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:c?"保存中...":i?"保存":"添加"})]}),h&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(oe,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:N,onChange:I=>b(I.target.value),onKeyDown:I=>{I.key==="Enter"&&E(N)}}),s.jsx(te,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>E(N),disabled:y,children:"刷新"}),s.jsx(te,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>f(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:y?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):m.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:m.map(I=>{const O=String(I.id??""),D=a.deviceGroups?a.deviceGroups.split(",").map(_=>_.trim()).filter(Boolean):[],P=D.includes(O),L=()=>{let _;P?_=D.filter(J=>J!==O):_=[...D,O],o(J=>({...J,deviceGroups:_.join(",")})),_.length>0&&C(J=>({...J,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:P,onChange:L}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:I.memo||I.wechatId||`设备 ${O}`}),I.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),I.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",O]}),I.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",I.wechatId]}),typeof I.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",I.totalFriend]})]})]})]},O)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",a.deviceGroups?a.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(te,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(te,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}function mN(t,e,n){if(!t||!t.includes("@")&&!t.includes("#")||typeof document>"u")return t;const r=document.createElement("div");r.innerHTML=t;const i=u=>e.find(h=>h.name===u),a=u=>n.find(h=>h.label===u),o=u=>{const h=u.textContent||"";if(!h||!h.includes("@")&&!h.includes("#"))return;const f=u.parentNode;if(!f)return;const m=document.createDocumentFragment(),g=/(@[^\s@#]+|#[^\s@#]+)/g;let y=0,w;for(;w=g.exec(h);){const[N]=w,b=w.index;if(b>y&&m.appendChild(document.createTextNode(h.slice(y,b))),N.startsWith("@")){const k=N.slice(1),C=i(k);if(C){const E=document.createElement("span");E.setAttribute("data-type","mention"),E.setAttribute("data-id",C.id),E.className="mention-tag",E.textContent=`@${C.name}`,m.appendChild(E)}else m.appendChild(document.createTextNode(N))}else if(N.startsWith("#")){const k=N.slice(1),C=a(k);if(C){const E=document.createElement("span");E.setAttribute("data-type","linkTag"),E.setAttribute("data-url",C.url||""),E.setAttribute("data-tag-type",C.type||"url"),E.setAttribute("data-tag-id",C.id||""),E.setAttribute("data-page-path",C.pagePath||""),E.setAttribute("data-app-id",C.appId||""),C.type==="miniprogram"&&C.appId&&E.setAttribute("data-mp-key",C.appId),E.className="link-tag-node",E.textContent=`#${C.label}`,m.appendChild(E)}else m.appendChild(document.createTextNode(N))}else m.appendChild(document.createTextNode(N));y=b+N.length}y{if(u.nodeType===Node.ELEMENT_NODE){const f=u.getAttribute("data-type");if(f==="mention"||f==="linkTag")return;u.childNodes.forEach(m=>c(m));return}u.nodeType===Node.TEXT_NODE&&o(u)};return r.childNodes.forEach(u=>c(u)),r.innerHTML}function iV(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,mid:c.mid,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 aV(){var wt,Ul,Kl;const[t,e]=v.useState([]),[n,r]=v.useState(!0),[i,a]=v.useState([]),[o,c]=v.useState(null),[u,h]=v.useState(!1),[f,m]=v.useState(!1),[g,y]=v.useState(!1),[w,N]=v.useState(""),[b,k]=v.useState([]),[C,E]=v.useState(!1),[T,I]=v.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[O,D]=v.useState(null),[P,L]=v.useState(!1),[_,J]=v.useState(!1),[ee,Y]=v.useState(null),[U,R]=v.useState(!1),[F,re]=v.useState([]),[z,ie]=v.useState(!1),[G,$]=v.useState(""),[V,ce]=v.useState(""),[W,fe]=v.useState(!1),[X,de]=v.useState(""),[he,be]=v.useState(!1),[Te,Ve]=v.useState(null),[He,vt]=v.useState(!1),[Dt,vn]=v.useState(!1),[pt,Rt]=v.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[ne,Pe]=v.useState(!1),[Ze,bt]=v.useState(!1),[mt,gt]=v.useState(1),[St,nn]=v.useState([]),[Lt,An]=v.useState(!1),[_t,Gn]=v.useState([]),[ts,lr]=v.useState(!1),[me,ye]=v.useState(20),[cr,Vs]=v.useState(!1),[Ni,ji]=v.useState(!1),[Cr,Ia]=v.useState([]),[zr,ns]=v.useState([]),[dr,ki]=v.useState(!1),[Ra,Hs]=v.useState(null),[lt,zn]=v.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),[rs,Er]=v.useState(null),ss=v.useRef(null),ln=iV(t),$r=t.length,Ws=10,Fr=Math.max(1,Math.ceil(St.length/Ws)),Us=St.slice((mt-1)*Ws,mt*Ws),Sn=async()=>{r(!0);try{const M=await Le("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(M==null?void 0:M.sections)?M.sections:[])}catch(M){console.error(M),e([])}finally{r(!1)}},is=async()=>{An(!0);try{const M=await Le("/api/db/book?action=ranking",{cache:"no-store"}),q=Array.isArray(M==null?void 0:M.sections)?M.sections:[];nn(q);const pe=q.filter(we=>we.isPinned).map(we=>we.id);Gn(pe)}catch(M){console.error(M),nn([])}finally{An(!1)}};v.useEffect(()=>{Sn(),is()},[]);const Bl=M=>{a(q=>q.includes(M)?q.filter(pe=>pe!==M):[...q,M])},Si=v.useCallback(M=>{const q=t,pe=M.flatMap(we=>{const Ke=q.find(at=>at.id===we.id);return Ke?[{...Ke,partId:we.partId,partTitle:we.partTitle,chapterId:we.chapterId,chapterTitle:we.chapterTitle}]:[]});return e(pe),It("/api/db/book",{action:"reorder",items:M}).then(we=>{we&&we.success===!1&&(e(q),ae.error("排序失败: "+(we&&typeof we=="object"&&"error"in we?we.error:"未知错误")))}).catch(we=>{e(q),console.error("排序失败:",we),ae.error("排序失败: "+(we instanceof Error?we.message:"网络或服务异常"))}),Promise.resolve()},[t]),Ks=async M=>{if(confirm(`确定要删除章节「${M.title}」吗?此操作不可恢复。`))try{const q=await Rs(`/api/db/book?id=${encodeURIComponent(M.id)}`);q&&q.success!==!1?(ae.success("已删除"),Sn(),is()):ae.error("删除失败: "+(q&&typeof q=="object"&&"error"in q?q.error:"未知错误"))}catch(q){console.error(q),ae.error("删除失败")}},xr=v.useCallback(async()=>{Pe(!0);try{const M=await Le("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),q=M&&M.data;q&&typeof q.readWeight=="number"&&typeof q.recencyWeight=="number"&&typeof q.payWeight=="number"&&Rt({readWeight:Math.max(0,Math.min(1,q.readWeight)),recencyWeight:Math.max(0,Math.min(1,q.recencyWeight)),payWeight:Math.max(0,Math.min(1,q.payWeight))})}catch{}finally{Pe(!1)}},[]);v.useEffect(()=>{Dt&&xr()},[Dt,xr]);const Pa=async()=>{const{readWeight:M,recencyWeight:q,payWeight:pe}=pt,we=M+q+pe;if(Math.abs(we-1)>.001){ae.error("三个权重之和必须等于 1");return}bt(!0);try{const Ke=await yt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:M,recencyWeight:q,payWeight:pe},description:"文章排名算法权重"});Ke&&Ke.success!==!1?(ae.success("排名权重已保存"),vn(!1),Sn(),is()):ae.error("保存失败: "+(Ke&&typeof Ke=="object"&&"error"in Ke?Ke.error:""))}catch(Ke){console.error(Ke),ae.error("保存失败")}finally{bt(!1)}},Ci=v.useCallback(async()=>{lr(!0);try{const M=await Le("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),q=M&&M.data;Array.isArray(q)&&Gn(q)}catch{}finally{lr(!1)}},[]),as=v.useCallback(async()=>{try{const M=await Le("/api/db/persons");M!=null&&M.success&&M.persons&&Ia(M.persons.map(q=>{const pe=q.deviceGroups,we=Array.isArray(pe)?pe.join(","):pe??"";return{id:q.token??q.personId??"",personId:q.personId,name:q.name,label:q.label??"",ckbApiKey:q.ckbApiKey??"",ckbPlanId:q.ckbPlanId,remarkType:q.remarkType,remarkFormat:q.remarkFormat,addFriendInterval:q.addFriendInterval,startTime:q.startTime,endTime:q.endTime,deviceGroups:we}}))}catch{}},[]),Br=v.useCallback(async()=>{try{const M=await Le("/api/db/link-tags");M!=null&&M.success&&M.linkTags&&ns(M.linkTags.map(q=>({id:q.tagId,label:q.label,url:q.url,type:q.type||"url",appId:q.appId||"",pagePath:q.pagePath||""})))}catch{}},[]),Oa=v.useCallback(async M=>{const q=/(@[^\s@#]+|#[^\s@#]+)/g,pe=new Set,we=new Set;let Ke;for(;(Ke=q.exec(M))!==null;){const ct=Ke[0];ct.startsWith("@")?pe.add(ct.slice(1).trim()):ct.startsWith("#")&&we.add(ct.slice(1).trim())}let at=[...Cr],kt=[...zr];for(const ct of pe)if(!(!ct||at.some(Nt=>Nt.name===ct)))try{const Nt=await yt("/api/db/persons",{name:ct});Nt!=null&&Nt.success&&Nt.person&&(at=[...at,{id:Nt.person.token,personId:Nt.person.personId,name:Nt.person.name,ckbPlanId:Nt.person.ckbPlanId}])}catch{}for(const ct of we)if(!(!ct||kt.some(Nt=>Nt.label===ct)))try{const Nt=await yt("/api/db/link-tags",{label:ct});if(Nt!=null&&Nt.success&&Nt.linkTag){const bn=Nt.linkTag;kt=[...kt,{id:bn.tagId,label:bn.label,url:bn.url||"",type:bn.type||"url",appId:bn.appId||"",pagePath:bn.pagePath||""}]}}catch{}return{persons:at,linkTags:kt}},[Cr,zr]),[Ei,Mo]=v.useState([]),[qs,Da]=v.useState(""),[zt,Gs]=v.useState(!1),Ti=v.useRef(null),Mi=v.useCallback(async()=>{try{const M=await Le("/api/admin/linked-miniprograms");M!=null&&M.success&&Array.isArray(M.data)&&Mo(M.data.map(q=>({...q,key:q.key})))}catch{}},[]),ks=Ei.filter(M=>!qs.trim()||M.name.toLowerCase().includes(qs.toLowerCase())||M.key&&M.key.toLowerCase().includes(qs.toLowerCase())||M.appId.toLowerCase().includes(qs.toLowerCase())),La=async M=>{const q=_t.includes(M)?_t.filter(pe=>pe!==M):[..._t,M];Gn(q);try{await yt("/api/db/config",{key:"pinned_section_ids",value:q,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),is()}catch{Gn(_t)}},Ai=v.useCallback(async()=>{Vs(!0);try{const M=await Le("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),q=M&&M.data;typeof q=="number"&&q>0&&q<=100&&ye(q)}catch{}finally{Vs(!1)}},[]),H=async()=>{if(me<1||me>100){ae.error("预览比例需在 1~100 之间");return}ji(!0);try{const M=await yt("/api/db/config",{key:"unpaid_preview_percent",value:me,description:"小程序未付费内容默认预览比例(%)"});M&&M.success!==!1?ae.success("预览比例已保存"):ae.error("保存失败: "+(M.error||""))}catch{ae.error("保存失败")}finally{ji(!1)}};v.useEffect(()=>{Ci(),Ai(),as(),Br(),Mi()},[Ci,Ai,as,Br,Mi]);const Re=async M=>{Ve({section:M,orders:[]}),vt(!0);try{const q=await Le(`/api/db/book?action=section-orders&id=${encodeURIComponent(M.id)}`),pe=q!=null&&q.success&&Array.isArray(q.orders)?q.orders:[];Ve(we=>we?{...we,orders:pe}:null)}catch(q){console.error(q),Ve(pe=>pe?{...pe,orders:[]}:null)}finally{vt(!1)}},Ye=async M=>{m(!0);try{const q=M.mid!=null&&M.mid>0?`/api/db/book?action=read&mid=${M.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(M.id)}`,pe=await Le(q);if(pe!=null&&pe.success&&pe.section){const we=pe.section,Ke=we.editionPremium===!0;c({id:M.id,originalId:M.id,title:pe.section.title??M.title,price:pe.section.price??M.price,content:pe.section.content??"",filePath:M.filePath,isFree:M.isFree||M.price===0,isNew:we.isNew??M.isNew,isPinned:_t.includes(M.id),hotScore:M.hotScore??0,editionStandard:Ke?!1:we.editionStandard??!0,editionPremium:Ke})}else c({id:M.id,originalId:M.id,title:M.title,price:M.price,content:"",filePath:M.filePath,isFree:M.isFree,isNew:M.isNew,isPinned:_t.includes(M.id),hotScore:M.hotScore??0,editionStandard:!0,editionPremium:!1}),pe&&!pe.success&&ae.error("无法读取文件内容: "+(pe.error||"未知错误"))}catch(q){console.error(q),c({id:M.id,title:M.title,price:M.price,content:"",filePath:M.filePath,isFree:M.isFree})}finally{m(!1)}},tt=async()=>{var M;if(o){y(!0);try{let q=o.content||"";const{persons:pe,linkTags:we}=await Oa(q);q=mN(q,pe,we);const Ke=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(M=o.title)==null?void 0:M.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const bn of Ke)q=q.replace(bn,"");q=q.replace(/^\s*\n+/,"").trim();const at=o.originalId||o.id,kt=o.id!==at,ct=await It("/api/db/book",{id:at,...kt?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:q,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},{timeout:$b}),Nt=kt?o.id:at;o.isPinned!==_t.includes(Nt)&&await La(Nt),ct&&ct.success!==!1?(ae.success(`已保存:${o.title}`),c(null),Sn(),as(),Br()):ae.error("保存失败: "+(ct&&typeof ct=="object"&&"error"in ct?ct.error:"未知错误"))}catch(q){console.error(q);const pe=q instanceof Error&&q.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";ae.error(pe)}finally{y(!1)}}},In=async()=>{if(!T.id||!T.title){ae.error("请填写章节ID和标题");return}y(!0);try{const M=ln.find(at=>at.id===T.partId),q=M==null?void 0:M.chapters.find(at=>at.id===T.chapterId),{persons:pe,linkTags:we}=await Oa(T.content||""),Ke=await It("/api/db/book",{id:T.id,title:T.title,price:T.isFree?0:T.price,content:mN(T.content||"",pe,we),partId:T.partId,partTitle:(M==null?void 0:M.title)??"",chapterId:T.chapterId,chapterTitle:(q==null?void 0:q.title)??"",isFree:T.isFree,isNew:T.isNew,editionStandard:T.editionPremium?!1:T.editionStandard??!0,editionPremium:T.editionPremium??!1,hotScore:T.hotScore??0,saveToFile:!1},{timeout:$b});if(Ke&&Ke.success!==!1){if(T.isPinned){const at=[..._t,T.id];Gn(at);try{await yt("/api/db/config",{key:"pinned_section_ids",value:at,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}ae.success(`章节创建成功:${T.title}`),h(!1),I({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),Sn(),as(),Br()}else ae.error("创建失败: "+(Ke&&typeof Ke=="object"&&"error"in Ke?Ke.error:"未知错误"))}catch(M){console.error(M),ae.error("创建失败")}finally{y(!1)}},ur=M=>{I(q=>{var pe;return{...q,partId:M.id,chapterId:((pe=M.chapters[0])==null?void 0:pe.id)??"chapter-1"}}),h(!0)},Ao=M=>{D({id:M.id,title:M.title})},Zt=async()=>{var M;if((M=O==null?void 0:O.title)!=null&&M.trim()){L(!0);try{const q=t.map(we=>({id:we.id,partId:we.partId||"part-1",partTitle:we.partId===O.id?O.title.trim():we.partTitle||"",chapterId:we.chapterId||"chapter-1",chapterTitle:we.chapterTitle||""})),pe=await It("/api/db/book",{action:"reorder",items:q});if(pe&&pe.success!==!1){const we=O.title.trim();e(Ke=>Ke.map(at=>at.partId===O.id?{...at,partTitle:we}:at)),D(null),Sn()}else ae.error("更新篇名失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(q){console.error(q),ae.error("更新篇名失败")}finally{L(!1)}}},$n=M=>{const q=M.chapters.length+1,pe=`chapter-${M.id}-${q}-${Date.now()}`;I({id:`${q}.1`,title:"新章节",price:1,partId:M.id,chapterId:pe,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},ls=(M,q)=>{Y({part:M,chapter:q,title:q.title})},Ss=async()=>{var M;if((M=ee==null?void 0:ee.title)!=null&&M.trim()){R(!0);try{const q=t.map(we=>({id:we.id,partId:we.partId||ee.part.id,partTitle:we.partId===ee.part.id?ee.part.title:we.partTitle||"",chapterId:we.chapterId||ee.chapter.id,chapterTitle:we.partId===ee.part.id&&we.chapterId===ee.chapter.id?ee.title.trim():we.chapterTitle||""})),pe=await It("/api/db/book",{action:"reorder",items:q});if(pe&&pe.success!==!1){const we=ee.title.trim(),Ke=ee.part.id,at=ee.chapter.id;e(kt=>kt.map(ct=>ct.partId===Ke&&ct.chapterId===at?{...ct,chapterTitle:we}:ct)),Y(null),Sn()}else ae.error("保存失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(q){console.error(q),ae.error("保存失败")}finally{R(!1)}}},Js=async(M,q)=>{const pe=q.sections.map(we=>we.id);if(pe.length===0){ae.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${M.chapters.indexOf(q)+1}章 | ${q.title}」吗?将删除共 ${pe.length} 节,此操作不可恢复。`))try{for(const we of pe)await Rs(`/api/db/book?id=${encodeURIComponent(we)}`);Sn()}catch(we){console.error(we),ae.error("删除失败")}},Vl=async()=>{if(!X.trim()){ae.error("请输入篇名");return}be(!0);try{const M=`part-new-${Date.now()}`,q="chapter-1",pe=`part-placeholder-${Date.now()}`,we=await It("/api/db/book",{id:pe,title:"占位节(可编辑)",price:0,content:"",partId:M,partTitle:X.trim(),chapterId:q,chapterTitle:"第1章 | 待编辑",saveToFile:!1});we&&we.success!==!1?(ae.success(`篇「${X}」创建成功`),J(!1),de(""),Sn()):ae.error("创建失败: "+(we&&typeof we=="object"&&"error"in we?we.error:"未知错误"))}catch(M){console.error(M),ae.error("创建失败")}finally{be(!1)}},_a=async()=>{if(F.length===0){ae.error("请先勾选要移动的章节");return}const M=ln.find(pe=>pe.id===G),q=M==null?void 0:M.chapters.find(pe=>pe.id===V);if(!M||!q||!G||!V){ae.error("请选择目标篇和章");return}fe(!0);try{const pe=()=>{const kt=new Set(F),ct=t.map(Ut=>({id:Ut.id,partId:Ut.partId||"",partTitle:Ut.partTitle||"",chapterId:Ut.chapterId||"",chapterTitle:Ut.chapterTitle||""})),Nt=ct.filter(Ut=>kt.has(Ut.id)).map(Ut=>({...Ut,partId:G,partTitle:M.title||G,chapterId:V,chapterTitle:q.title||V})),bn=ct.filter(Ut=>!kt.has(Ut.id));let Ys=bn.length;for(let Ut=bn.length-1;Ut>=0;Ut-=1){const bd=bn[Ut];if(bd.partId===G&&bd.chapterId===V){Ys=Ut+1;break}}return[...bn.slice(0,Ys),...Nt,...bn.slice(Ys)]},we=async()=>{const kt=pe(),ct=await It("/api/db/book",{action:"reorder",items:kt});return ct&&ct.success!==!1?(ae.success(`已移动 ${F.length} 节到「${M.title}」-「${q.title}」`),ie(!1),re([]),await Sn(),!0):!1},Ke={action:"move-sections",sectionIds:F,targetPartId:G,targetChapterId:V,targetPartTitle:M.title||G,targetChapterTitle:q.title||V},at=await It("/api/db/book",Ke);if(at&&at.success!==!1)ae.success(`已移动 ${at.count??F.length} 节到「${M.title}」-「${q.title}」`),ie(!1),re([]),await Sn();else{const kt=at&&typeof at=="object"&&"error"in at?at.error||"":"未知错误";if((kt.includes("缺少 id")||kt.includes("无效的 action"))&&await we())return;ae.error("移动失败: "+kt)}}catch(pe){console.error(pe),ae.error("移动失败: "+(pe instanceof Error?pe.message:"网络或服务异常"))}finally{fe(!1)}},Ii=M=>{re(q=>q.includes(M)?q.filter(pe=>pe!==M):[...q,M])},Hl=async M=>{const q=t.filter(pe=>pe.partId===M.id).map(pe=>pe.id);if(q.length===0){ae.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${M.title}」整篇吗?将删除共 ${q.length} 节内容,此操作不可恢复。`))try{for(const pe of q)await Rs(`/api/db/book?id=${encodeURIComponent(pe)}`);Sn()}catch(pe){console.error(pe),ae.error("删除失败")}},Ri=async()=>{var M;if(w.trim()){E(!0);try{const q=await Le(`/api/search?q=${encodeURIComponent(w)}`);q!=null&&q.success&&((M=q.data)!=null&&M.results)?k(q.data.results):(k([]),q&&!q.success&&ae.error("搜索失败: "+q.error))}catch(q){console.error(q),k([]),ae.error("搜索失败")}finally{E(!1)}}},Wl=ln.find(M=>M.id===T.partId),Io=(Wl==null?void 0:Wl.chapters)??[];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",ln.length," 篇 · ",$r," 节内容"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(te,{onClick:()=>vn(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Nu,{className:"w-4 h-4 mr-2"}),"排名算法"]}),s.jsxs(te,{onClick:()=>{const M=typeof window<"u"?`${window.location.origin}/api-doc`:"";M&&window.open(M,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ys,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),s.jsx(Yt,{open:u,onOpenChange:h,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Qt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(un,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节ID *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:T.id,onChange:M=>I({...T,id:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:T.isFree?0:T.price,onChange:M=>I({...T,price:Number(M.target.value),isFree:Number(M.target.value)===0}),disabled:T.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isFree,onChange:M=>I({...T,isFree:M.target.checked,price:M.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isNew,onChange:M=>I({...T,isNew:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isPinned,onChange:M=>I({...T,isPinned:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium!==!0,onChange:()=>I({...T,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium===!0,onChange:()=>I({...T,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"热度分"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:T.hotScore??0,onChange:M=>I({...T,hotScore:Math.max(0,parseFloat(M.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:T.title,onChange:M=>I({...T,title:M.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"所属篇"}),s.jsxs(cl,{value:T.partId,onValueChange:M=>{var pe;const q=ln.find(we=>we.id===M);I({...T,partId:M,chapterId:((pe=q==null?void 0:q.chapters[0])==null?void 0:pe.id)??"chapter-1"})},children:[s.jsx(Za,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(dl,{})}),s.jsxs(eo,{className:"bg-[#0f2137] border-gray-700",children:[ln.map(M=>s.jsx(Rr,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id)),ln.length===0&&s.jsx(Rr,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"所属章"}),s.jsxs(cl,{value:T.chapterId,onValueChange:M=>I({...T,chapterId:M}),children:[s.jsx(Za,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(dl,{})}),s.jsxs(eo,{className:"bg-[#0f2137] border-gray-700",children:[Io.map(M=>s.jsx(Rr,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id)),Io.length===0&&s.jsx(Rr,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(vx,{content:T.content||"",onChange:M=>I({...T,content:M}),onImageUpload:async M=>{var Ke;const q=new FormData;q.append("file",M),q.append("folder","book-images");const we=await(await fetch(fo("/api/upload"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((Ke=we==null?void 0:we.data)==null?void 0:Ke.url)||(we==null?void 0:we.url)||""},persons:Cr,linkTags:zr,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(fn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(te,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:In,disabled:g||!T.id||!T.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Yt,{open:!!O,onOpenChange:M=>!M&&D(null),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),O&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"篇名"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:O.title,onChange:M=>D({...O,title:M.target.value}),placeholder:"输入篇名"})]})}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",onClick:()=>D(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:Zt,disabled:P||!((wt=O==null?void 0:O.title)!=null&&wt.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Yt,{open:!!ee,onOpenChange:M=>!M&&Y(null),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),ee&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:ee.title,onChange:M=>Y({...ee,title:M.target.value}),placeholder:"输入章节名称"})]})}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",onClick:()=>Y(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:Ss,disabled:U||!((Ul=ee==null?void 0:ee.title)!=null&&Ul.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:U?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Yt,{open:z,onOpenChange:M=>{var q;if(ie(M),M&&ln.length>0){const pe=ln[0];$(pe.id),ce(((q=pe.chapters[0])==null?void 0:q.id)??"")}},children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:F.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目标篇"}),s.jsxs(cl,{value:G,onValueChange:M=>{var pe;$(M);const q=ln.find(we=>we.id===M);ce(((pe=q==null?void 0:q.chapters[0])==null?void 0:pe.id)??"")},children:[s.jsx(Za,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(dl,{placeholder:"选择篇"})}),s.jsx(eo,{className:"bg-[#0f2137] border-gray-700",children:ln.map(M=>s.jsx(Rr,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目标章"}),s.jsxs(cl,{value:V,onValueChange:ce,children:[s.jsx(Za,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(dl,{placeholder:"选择章"})}),s.jsx(eo,{className:"bg-[#0f2137] border-gray-700",children:(((Kl=ln.find(M=>M.id===G))==null?void 0:Kl.chapters)??[]).map(M=>s.jsx(Rr,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id))})]})]})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",onClick:()=>ie(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:_a,disabled:W||F.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:W?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Yt,{open:!!Te,onOpenChange:M=>!M&&Ve(null),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white",children:["付款记录 — ",(Te==null?void 0:Te.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:He?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Te&&Te.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Te?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"py-2 pr-2",children:"订单号"}),s.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),s.jsx("th",{className:"py-2 pr-2",children:"金额"}),s.jsx("th",{className:"py-2 pr-2",children:"状态"}),s.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),s.jsx("tbody",{children:Te.orders.map(M=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${M.orderSn}`,onClick:()=>window.open(`/orders?search=${M.orderSn??M.id??""}`,"_blank"),children:M.orderSn?M.orderSn.length>16?M.orderSn.slice(0,8)+"..."+M.orderSn.slice(-6):M.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${M.userId??M.openId??""}`,onClick:()=>window.open(`/users?search=${M.userId??M.openId??""}`,"_blank"),children:(()=>{const q=M.userId??M.openId??"-";return q.length>12?q.slice(0,6)+"..."+q.slice(-4):q})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",M.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:M.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:M.payTime??M.createdAt??"-"})]},M.id??M.orderSn??""))})]}):null})]})}),s.jsx(Yt,{open:Dt,onOpenChange:vn,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(Nu,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),ne?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"阅读权重"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:pt.readWeight,onChange:M=>Rt(q=>({...q,readWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"新度权重"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:pt.recencyWeight,onChange:M=>Rt(q=>({...q,recencyWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"付款权重"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:pt.payWeight,onChange:M=>Rt(q=>({...q,payWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(pt.readWeight+pt.recencyWeight+pt.payWeight).toFixed(1)]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),s.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),s.jsx(te,{onClick:Pa,disabled:Ze||Math.abs(pt.readWeight+pt.recencyWeight+pt.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Ze?"保存中...":"保存权重"})]})]})]})}),s.jsx(Yt,{open:_,onOpenChange:J,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(un,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:X,onChange:M=>de(M.target.value),placeholder:"输入篇名"})]})}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",onClick:()=>{J(!1),de("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(te,{onClick:Vl,disabled:he||!X.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:he?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Yt,{open:!!o,onOpenChange:()=>c(null),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Qt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节ID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:M=>c({...o,id:M.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:M=>c({...o,price:Number(M.target.value),isFree:Number(M.target.value)===0}),disabled:o.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:M=>c({...o,isFree:M.target.checked,price:M.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:M=>c({...o,isNew:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:M=>c({...o,isPinned:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.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]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.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]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"热度分"}),s.jsx(oe,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:M=>c({...o,hotScore:Math.max(0,parseFloat(M.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:M=>c({...o,title:M.target.value})})]}),o.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文件路径"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(vx,{ref:ss,content:o.content||"",onChange:M=>c({...o,content:M}),onImageUpload:async M=>{var Ke;const q=new FormData;q.append("file",M),q.append("folder","book-images");const we=await(await fetch(fo("/api/upload"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((Ke=we==null?void 0:we.data)==null?void 0:Ke.url)||(we==null?void 0:we.url)||""},persons:Cr,linkTags:zr,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(fn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&s.jsxs(te,{variant:"outline",onClick:()=>Re({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:[s.jsx(Xr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(te,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(te,{onClick:tt,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(pd,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Ol,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(an,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Xr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(an,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(zb,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(an,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(ua,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(an,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(ys,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(an,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Lb,{className:"w-4 h-4 mr-2"}),"链接标签"]}),s.jsxs(an,{value:"linkedmp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(ho,{className:"w-4 h-4 mr-2"}),"关联小程序"]})]}),s.jsxs(on,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.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:s.jsx(Xr,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),s.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),s.jsxs("div",{className:"text-center shrink-0",children:[s.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:$r}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(te,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(te,{onClick:()=>J(!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:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(te,{variant:"outline",onClick:()=>ie(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",F.length," 节)"]})]}),n?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(tV,{parts:ln,expandedParts:i,onTogglePart:Bl,onReorder:Si,onReadSection:Ye,onDeleteSection:Ks,onAddSectionInPart:ur,onAddChapterInPart:$n,onDeleteChapter:Js,onEditPart:Ao,onDeletePart:Hl,onEditChapter:ls,selectedSectionIds:F,onToggleSectionSelect:Ii,onShowSectionOrders:Re,pinnedSectionIds:_t})]}),s.jsx(on,{value:"search",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"内容搜索"})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:w,onChange:M=>N(M.target.value),onKeyDown:M=>M.key==="Enter"&&Ri()}),s.jsx(te,{onClick:Ri,disabled:C||!w.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Je,{className:"w-4 h-4 animate-spin"}):s.jsx(ua,{className:"w-4 h-4"})})]}),b.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",b.length," 个结果"]}),b.map(M=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>Ye({id:M.id,mid:M.mid,title:M.title,price:M.price??1,filePath:""}),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:M.id}),s.jsx("span",{className:"text-white",children:M.title}),_t.includes(M.id)&&s.jsx(fl,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Ue,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:M.matchType==="title"?"标题匹配":"内容匹配"})]}),M.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:M.snippet}),(M.partTitle||M.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[M.partTitle," · ",M.chapterTitle]})]},M.id))]})]})]})}),s.jsxs(on,{value:"ranking",className:"space-y-4",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{className:"pb-3",children:s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Nu,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Z,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(oe,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:me,onChange:M=>ye(Math.max(1,Math.min(100,Number(M.target.value)||20))),disabled:cr}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(te,{size:"sm",onClick:H,disabled:Ni,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Ni?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",me,"% 内容"]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(zb,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",St.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>is(),disabled:Lt,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Je,{className:`w-4 h-4 ${Lt?"animate-spin":""}`})}),s.jsx(te,{variant:"ghost",size:"sm",disabled:mt<=1||Lt,onClick:()=>gt(M=>Math.max(1,M-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(HT,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[mt," / ",Fr]}),s.jsx(te,{variant:"ghost",size:"sm",disabled:mt>=Fr||Lt,onClick:()=>gt(M=>Math.min(Fr,M+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(ul,{className:"w-4 h-4"})})]})]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"space-y-0",children:[s.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:[s.jsx("span",{children:"排名"}),s.jsx("span",{children:"置顶"}),s.jsx("span",{children:"标题"}),s.jsx("span",{className:"text-right",children:"点击量"}),s.jsx("span",{className:"text-right",children:"付款数"}),s.jsx("span",{className:"text-right",children:"热度"}),s.jsx("span",{className:"text-right",children:"编辑"})]}),Us.map((M,q)=>{const pe=(mt-1)*Ws+q+1,we=M.isPinned??_t.includes(M.id);return s.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 ${we?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${pe<=3?"text-amber-400":"text-gray-500"}`,children:pe<=3?["🥇","🥈","🥉"][pe-1]:`#${pe}`}),s.jsx(te,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${we?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>La(M.id),disabled:ts,title:we?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:we?s.jsx(fl,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(hA,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:M.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[M.partTitle," · ",M.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:M.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:M.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(M.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(te,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>Ye({id:M.id,mid:M.mid,title:M.title,price:M.price,filePath:""}),title:"编辑文章",children:s.jsx(Ft,{className:"w-3 h-3"})})})]},M.id)}),Us.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(on,{value:"link-person",className:"space-y-4",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"pb-3",children:[s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"添加时自动生成 32 位 token,文章 @ 时存 token;小程序点击 @ 时用 token 兑换真实密钥后加好友"})]}),s.jsxs(Ae,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"添加人物时同步创建存客宝场景获客计划,配置与存客宝 API 获客一致"}),s.jsxs(te,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Hs(null),ki(!0)},children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[Cr.length>0&&s.jsxs("div",{className:"flex items-center gap-4 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{className:"w-[280px] shrink-0",children:"token"}),s.jsx("span",{className:"w-24 shrink-0",children:"@的人"}),s.jsx("span",{children:"获客计划活动名"})]}),Cr.map(M=>s.jsxs("div",{className:"bg-[#0a1628] rounded px-3 py-2 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-4 text-sm min-w-0",children:[s.jsx("span",{className:"text-gray-400 text-xs font-mono shrink-0 w-[280px]",title:"32位token",children:M.id}),s.jsx("span",{className:"text-amber-400 shrink-0 w-24 truncate",title:"@的人",children:M.name}),s.jsxs("span",{className:"text-white truncate",title:"获客计划活动名",children:["SOUL链接人与事-",M.name]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const q=await rV(M.personId||"");if(q!=null&&q.success&&q.person){const pe=q.person;Hs({id:pe.token??pe.personId,personId:pe.personId,name:pe.name,label:pe.label??"",ckbApiKey:pe.ckbApiKey??"",remarkType:pe.remarkType,remarkFormat:pe.remarkFormat,addFriendInterval:pe.addFriendInterval,startTime:pe.startTime,endTime:pe.endTime,deviceGroups:pe.deviceGroups})}else Hs(M),q!=null&&q.error&&ae.error(q.error)}catch(q){console.error(q),Hs(M),ae.error(q instanceof Error?q.message:"加载人物详情失败")}ki(!0)},children:s.jsx(YN,{className:"w-3 h-3"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-amber-400 h-6 px-2",title:"编辑计划(跳转存客宝)",onClick:()=>{const q=M.ckbPlanId;q?window.open(`https://h5.ckb.quwanzhi.com/#/scenarios/edit/${q}`,"_blank"):ae.info("该人物尚未同步存客宝计划,请先保存后等待同步完成")},children:s.jsx(Ls,{className:"w-3 h-3"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:"删除(同时删除存客宝对应获客计划)",onClick:async()=>{confirm(`确定删除「SOUL链接人与事-${M.name}」?将同时删除存客宝对应获客计划。`)&&(await Rs(`/api/db/persons?personId=${M.personId}`),as())},children:s.jsx(er,{className:"w-3 h-3"})})]})]},M.id)),Cr.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"pb-3",children:[s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Nu,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(Ae,{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往"," ",s.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]}),s.jsx(on,{value:"link-tag",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"pb-3",children:[s.jsxs(st,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Lb,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(Ae,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"标签ID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:lt.tagId,onChange:M=>zn({...lt,tagId:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"显示文字"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:lt.label,onChange:M=>zn({...lt,label:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"类型"}),s.jsxs(cl,{value:lt.type,onValueChange:M=>zn({...lt,type:M}),children:[s.jsx(Za,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:s.jsx(dl,{})}),s.jsxs(eo,{children:[s.jsx(Rr,{value:"url",children:"网页链接"}),s.jsx(Rr,{value:"miniprogram",children:"小程序"}),s.jsx(Rr,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:lt.type==="url"?"URL地址":lt.type==="ckb"?"存客宝计划URL":"小程序(选密钥)"}),lt.type==="miniprogram"&&Ei.length>0?s.jsxs("div",{ref:Ti,className:"relative w-44",children:[s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:"搜索名称或密钥",value:zt?qs:lt.appId,onChange:M=>{const q=M.target.value;Da(q),Gs(!0),Ei.some(pe=>pe.key===q)||zn({...lt,appId:q})},onFocus:()=>{Da(lt.appId),Gs(!0)},onBlur:()=>setTimeout(()=>Gs(!1),150)}),zt&&s.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 max-h-48 overflow-y-auto rounded-md border border-gray-700 bg-[#0a1628] shadow-lg z-50",children:ks.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):ks.map(M=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:q=>{q.preventDefault(),zn({...lt,appId:M.key,pagePath:M.path||""}),Da(""),Gs(!1)},children:[s.jsx("span",{children:M.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:M.key})]},M.key))})]}):s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:lt.type==="url"?"https://...":lt.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联小程序的32位密钥",value:lt.type==="url"||lt.type==="ckb"?lt.url:lt.appId,onChange:M=>{lt.type==="url"||lt.type==="ckb"?zn({...lt,url:M.target.value}):zn({...lt,appId:M.target.value})}})]}),lt.type==="miniprogram"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"页面路径"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:lt.pagePath,onChange:M=>zn({...lt,pagePath:M.target.value})})]}),s.jsxs(te,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!lt.tagId||!lt.label){ae.error("标签ID和显示文字必填");return}const M={...lt};M.type==="miniprogram"&&(M.url=""),await yt("/api/db/link-tags",M),zn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Er(null),Br()},children:[s.jsx(un,{className:"w-3 h-3 mr-1"}),rs?"保存":"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[zr.map(M=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[s.jsxs("button",{type:"button",className:"text-amber-400 font-bold text-base hover:underline",onClick:()=>{zn({tagId:M.id,label:M.label,url:M.url,type:M.type,appId:M.appId??"",pagePath:M.pagePath??""}),Er(M.id)},children:["#",M.label]}),s.jsx(Ue,{variant:"secondary",className:`text-[10px] ${M.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:M.type==="url"?"网页":M.type==="ckb"?"存客宝":"小程序"}),M.type==="miniprogram"?s.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[M.appId," ",M.pagePath?`· ${M.pagePath}`:""]}):M.url?s.jsxs("a",{href:M.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[M.url," ",s.jsx(Ls,{className:"w-3 h-3 shrink-0"})]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-6 px-2",onClick:()=>{zn({tagId:M.id,label:M.label,url:M.url,type:M.type,appId:M.appId??"",pagePath:M.pagePath??""}),Er(M.id)},children:"编辑"}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Rs(`/api/db/link-tags?tagId=${M.id}`),rs===M.id&&(Er(null),zn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""})),Br()},children:s.jsx(er,{className:"w-3 h-3"})})]})]},M.id)),zr.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]})}),s.jsx(on,{value:"linkedmp",className:"space-y-4",children:s.jsx(ZB,{})})]}),s.jsx(sV,{open:dr,onOpenChange:ki,editingPerson:Ra,onSubmit:async M=>{var we;const q={personId:M.personId||M.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:M.name,label:M.label,ckbApiKey:M.ckbApiKey||void 0,greeting:M.greeting||void 0,tips:M.tips||void 0,remarkType:M.remarkType||void 0,remarkFormat:M.remarkFormat||void 0,addFriendInterval:M.addFriendInterval,startTime:M.startTime||void 0,endTime:M.endTime||void 0,deviceGroups:(we=M.deviceGroups)!=null&&we.trim()?M.deviceGroups.split(",").map(Ke=>parseInt(Ke.trim(),10)).filter(Ke=>!Number.isNaN(Ke)):void 0},pe=await yt("/api/db/persons",q);if(pe&&pe.success===!1){const Ke=pe;Ke.ckbResponse&&console.log("存客宝返回",Ke.ckbResponse);const at=Ke.error||"操作失败";throw new Error(at)}if(as(),ae.success(Ra?"已保存":"已添加"),pe!=null&&pe.ckbCreateResult&&Object.keys(pe.ckbCreateResult).length>0){const Ke=pe.ckbCreateResult;console.log("存客宝创建结果",Ke);const at=Ke.planId??Ke.id,kt=at!=null?[`planId: ${at}`]:[];Ke.apiKey!=null&&kt.push("apiKey: ***"),ae.info(kt.length?`存客宝创建结果:${kt.join(",")}`:"存客宝创建结果见控制台")}}})]})}const fi={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 gN(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):fi.stats}function xN(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):fi.highlights}function oV(){const[t,e]=v.useState(fi),[n,r]=v.useState(!0),[i,a]=v.useState(!1),[o,c]=v.useState(!1),u=v.useRef(null);v.useEffect(()=>{Le("/api/admin/author-settings").then(k=>{const C=k==null?void 0:k.data;C&&typeof C=="object"&&e({name:String(C.name??fi.name),avatar:String(C.avatar??fi.avatar),avatarImg:String(C.avatarImg??""),title:String(C.title??fi.title),bio:String(C.bio??fi.bio),stats:gN(C.stats).length?gN(C.stats):fi.stats,highlights:xN(C.highlights).length?xN(C.highlights):fi.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)},C=await yt("/api/admin/author-settings",k);if(!C||C.success===!1){ae.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:""));return}a(!1);const E=document.createElement("div");E.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",E.textContent="作者设置已保存",document.body.appendChild(E),setTimeout(()=>E.remove(),2e3)}catch(k){console.error(k),ae.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},f=async k=>{var E;const C=(E=k.target.files)==null?void 0:E[0];if(C){c(!0);try{const T=new FormData;T.append("file",C),T.append("folder","avatars");const I=Dx(),O={};I&&(O.Authorization=`Bearer ${I}`);const P=await(await fetch(fo("/api/upload"),{method:"POST",body:T,credentials:"include",headers:O})).json();P!=null&&P.success&&(P!=null&&P.url)?e(L=>({...L,avatarImg:P.url})):ae.error("上传失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(T){console.error(T),ae.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(C=>({...C,stats:C.stats.filter((E,T)=>T!==k)})),y=(k,C,E)=>e(T=>({...T,stats:T.stats.map((I,O)=>O===k?{...I,[C]:E}:I)})),w=()=>e(k=>({...k,highlights:[...k.highlights,""]})),N=k=>e(C=>({...C,highlights:C.highlights.filter((E,T)=>T!==k)})),b=(k,C)=>e(E=>({...E,highlights:E.highlights.map((T,I)=>I===k?C:T)}));return n?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(gl,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(te,{onClick:h,disabled:i||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(gl,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Vt,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"姓名"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(C=>({...C,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(C=>({...C,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(GN,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(C=>({...C,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(te,{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:[s.jsx(lh,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:t.avatarImg.startsWith("http")?t.avatarImg:fo(t.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"头衔"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(C=>({...C,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"个人简介"}),s.jsx(Dl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(C=>({...C,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsx(st,{className:"text-white",children:"统计数据"}),s.jsx(Vt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(Ae,{className:"space-y-3",children:[t.stats.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:E=>y(C,"label",E.target.value),placeholder:"标签"}),s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:E=>y(C,"value",E.target.value),placeholder:"数值"}),s.jsx(te,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(C),children:s.jsx(er,{className:"w-4 h-4"})})]},C)),s.jsxs(te,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsx(st,{className:"text-white",children:"亮点标签"}),s.jsx(Vt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(Ae,{className:"space-y-3",children:[t.highlights.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:E=>b(C,E.target.value),placeholder:"5年私域运营经验"}),s.jsx(te,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>N(C),children:s.jsx(er,{className:"w-4 h-4"})})]},C)),s.jsxs(te,{variant:"outline",size:"sm",onClick:w,className:"border-gray-600 text-gray-400",children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function lV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o]=v.useState(10),[c,u]=v.useState(0),[h,f]=v.useState(""),m=Qx(h,300),[g,y]=v.useState(!0),[w,N]=v.useState(null),[b,k]=v.useState(!1),[C,E]=v.useState(null),[T,I]=v.useState(""),[O,D]=v.useState(""),[P,L]=v.useState(""),[_,J]=v.useState("admin"),[ee,Y]=v.useState("active"),[U,R]=v.useState(!1);async function F(){var V;y(!0),N(null);try{const ce=new URLSearchParams({page:String(i),pageSize:String(o)});m.trim()&&ce.set("search",m.trim());const W=await Le(`/api/admin/users?${ce}`);W!=null&&W.success?(e(W.records||[]),r(W.total??0),u(W.totalPages??0)):N(W.error||"加载失败")}catch(ce){const W=ce;N(W.status===403?"无权限访问":((V=W==null?void 0:W.data)==null?void 0:V.error)||"加载失败"),e([])}finally{y(!1)}}v.useEffect(()=>{F()},[i,o,m]);const re=()=>{E(null),I(""),D(""),L(""),J("admin"),Y("active"),k(!0)},z=V=>{E(V),I(V.username),D(""),L(V.name||""),J(V.role==="super_admin"?"super_admin":"admin"),Y(V.status==="disabled"?"disabled":"active"),k(!0)},ie=async()=>{var V;if(!T.trim()){N("用户名不能为空");return}if(!C&&!O){N("新建时密码必填,至少 6 位");return}if(O&&O.length<6){N("密码至少 6 位");return}N(null),R(!0);try{if(C){const ce=await It("/api/admin/users",{id:C.id,password:O||void 0,name:P.trim(),role:_,status:ee});ce!=null&&ce.success?(k(!1),F()):N((ce==null?void 0:ce.error)||"保存失败")}else{const ce=await yt("/api/admin/users",{username:T.trim(),password:O,name:P.trim(),role:_});ce!=null&&ce.success?(k(!1),F()):N((ce==null?void 0:ce.error)||"保存失败")}}catch(ce){const W=ce;N(((V=W==null?void 0:W.data)==null?void 0:V.error)||"保存失败")}finally{R(!1)}},G=async V=>{var ce;if(confirm("确定删除该管理员?"))try{const W=await Rs(`/api/admin/users?id=${V}`);W!=null&&W.success?F():N((W==null?void 0:W.error)||"删除失败")}catch(W){const fe=W;N(((ce=fe==null?void 0:fe.data)==null?void 0:ce.error)||"删除失败")}},$=V=>{if(!V)return"-";try{const ce=new Date(V);return isNaN(ce.getTime())?V:ce.toLocaleString("zh-CN")}catch{return V}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Px,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(oe,{placeholder:"搜索用户名/昵称",value:h,onChange:V=>f(V.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(te,{variant:"outline",size:"sm",onClick:F,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(Je,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(te,{onClick:re,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),w&&s.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:[s.jsx("span",{children:w}),s.jsx("button",{type:"button",onClick:()=>N(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"用户名"}),s.jsx(je,{className:"text-gray-400",children:"昵称"}),s.jsx(je,{className:"text-gray-400",children:"角色"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"创建时间"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(sr,{children:[t.map(V=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:V.id}),s.jsx(xe,{className:"text-white font-medium",children:V.username}),s.jsx(xe,{className:"text-gray-400",children:V.name||"-"}),s.jsx(xe,{children:s.jsx(Ue,{variant:"outline",className:V.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:V.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(xe,{children:s.jsx(Ue,{variant:"outline",className:V.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:V.status==="active"?"正常":"已禁用"})}),s.jsx(xe,{className:"text-gray-500 text-sm",children:$(V.createdAt)}),s.jsxs(xe,{className:"text-right",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>z(V),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>G(V.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Hn,{className:"w-4 h-4"})})]})]},V.id)),t.length===0&&!g&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:w==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(vs,{page:i,pageSize:o,total:n,totalPages:c,onPageChange:a})})]})})}),s.jsx(Yt,{open:b,onOpenChange:k,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:C?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"用户名"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:T,onChange:V=>I(V.target.value),disabled:!!C}),C&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:C?"新密码(留空不改)":"密码"}),s.jsx(oe,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:C?"留空表示不修改":"至少 6 位",value:O,onChange:V=>D(V.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:P,onChange:V=>L(V.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:_,onChange:V=>J(V.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),C&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:ee,onChange:V=>Y(V.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:ie,disabled:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),U?"保存中...":"保存"]})]})]})})]})}const cV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},dV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},uV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...dV},ckbLeadApiKey:""},hV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},fV=["system","author","admin"];function pV(){const[t,e]=FN(),n=t.get("tab")??"system",r=fV.includes(n)?n:"system",[i,a]=v.useState(uV),[o,c]=v.useState(hV),[u,h]=v.useState(cV),[f,m]=v.useState(!1),[g,y]=v.useState(!0),[w,N]=v.useState(!1),[b,k]=v.useState(""),[C,E]=v.useState(""),[T,I]=v.useState(!1),[O,D]=v.useState(!1),P=(Y,U,R=!1)=>{k(Y),E(U),I(R),N(!0)};v.useEffect(()=>{(async()=>{try{const U=await Le("/api/admin/settings");if(!U||U.success===!1)return;if(U.featureConfig&&Object.keys(U.featureConfig).length&&c(R=>({...R,...U.featureConfig})),U.mpConfig&&typeof U.mpConfig=="object"&&h(R=>({...R,...U.mpConfig})),U.siteSettings&&typeof U.siteSettings=="object"){const R=U.siteSettings;a(F=>({...F,...typeof R.sectionPrice=="number"&&{sectionPrice:R.sectionPrice},...typeof R.baseBookPrice=="number"&&{baseBookPrice:R.baseBookPrice},...typeof R.distributorShare=="number"&&{distributorShare:R.distributorShare},...R.authorInfo&&typeof R.authorInfo=="object"&&{authorInfo:{...F.authorInfo,...R.authorInfo}},...typeof R.ckbLeadApiKey=="string"&&{ckbLeadApiKey:R.ckbLeadApiKey}}))}}catch(U){console.error("Load settings error:",U)}finally{y(!1)}})()},[]);const L=async(Y,U)=>{D(!0);try{const R=await yt("/api/admin/settings",{featureConfig:Y});if(!R||R.success===!1){U(),P("保存失败",(R==null?void 0:R.error)??"未知错误",!0);return}P("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(R){console.error("Save feature config error:",R),U(),P("保存失败",R instanceof Error?R.message:String(R),!0)}finally{D(!1)}},_=(Y,U)=>{const R=o,F={...R,[Y]:U};c(F),L(F,()=>c(R))},J=async()=>{m(!0);try{const Y=await yt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:i.sectionPrice,baseBookPrice:i.baseBookPrice,distributorShare:i.distributorShare,authorInfo:i.authorInfo,ckbLeadApiKey:i.ckbLeadApiKey||void 0},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)}},ee=Y=>{e(Y==="system"?{}:{tab:Y})};return g?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&s.jsxs(te,{onClick:J,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),s.jsxs(pd,{value:r,onValueChange:ee,className:"w-full",children:[s.jsxs(Ol,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(an,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(io,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(an,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(jm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(an,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Px,{className:"w-4 h-4 mr-2"}),"管理员"]})]}),s.jsx(on,{value:"system",className:"mt-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(jm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Vt,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(jm,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(oe,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:i.authorInfo.name??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,name:Y.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ah,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(oe,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:i.authorInfo.startDate??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,startDate:Y.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ah,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(oe,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:i.authorInfo.liveTime??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,liveTime:Y.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(JN,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(oe,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:i.authorInfo.platform??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,platform:Y.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Xr,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(oe,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:i.authorInfo.description??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,description:Y.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(Dl,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:i.authorInfo.bio??"",onChange:Y=>a(U=>({...U,authorInfo:{...U.authorInfo,bio:Y.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ys,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(oe,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:i.ckbLeadApiKey??"",onChange:Y=>a(U=>({...U,ckbLeadApiKey:Y.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:(i.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:i.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:i.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",i.authorInfo.liveTime," · ",i.authorInfo.platform]})]})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(oh,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(Ae,{className:"space-y-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:i.sectionPrice,onChange:Y=>a(U=>({...U,sectionPrice:Number.parseFloat(Y.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:i.baseBookPrice,onChange:Y=>a(U=>({...U,baseBookPrice:Number.parseFloat(Y.target.value)||9.9}))})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ho,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Vt,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsx(Ae,{className:"space-y-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:Y=>h(U=>({...U,appId:Y.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:Y=>h(U=>({...U,withdrawSubscribeTmplId:Y.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:Y=>h(U=>({...U,mchId:Y.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:Y=>h(U=>({...U,minWithdraw:Number.parseFloat(Y.target.value)||10}))})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(io,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Vt,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(At,{id:"match-enabled",checked:o.matchEnabled,disabled:O,onCheckedChange:Y=>_("matchEnabled",Y)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(fM,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),s.jsx(At,{id:"referral-enabled",checked:o.referralEnabled,disabled:O,onCheckedChange:Y=>_("referralEnabled",Y)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Xr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),s.jsx(At,{id:"search-enabled",checked:o.searchEnabled,disabled:O,onCheckedChange:Y=>_("searchEnabled",Y)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(io,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(At,{id:"about-enabled",checked:o.aboutEnabled,disabled:O,onCheckedChange:Y=>_("aboutEnabled",Y)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),s.jsx(on,{value:"author",className:"mt-0",children:s.jsx(oV,{})}),s.jsx(on,{value:"admin",className:"mt-0",children:s.jsx(lV,{})})]}),s.jsx(Yt,{open:w,onOpenChange:N,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Qt,{children:[s.jsx(Xt,{className:T?"text-red-400":"text-[#38bdac]",children:b}),s.jsx(Ux,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:C})]}),s.jsx(fn,{className:"mt-4",children:s.jsx(te,{onClick:()=>N(!1),className:T?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const yN={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 mV(){const[t,e]=v.useState(!1),[n,r]=v.useState(yN),[i,a]=v.useState(""),o=async()=>{e(!0);try{const k=await Le("/api/config");k!=null&&k.paymentMethods&&r({...yN,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};v.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await yt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),ae.success("配置已保存!")}catch(k){console.error("保存失败:",k),ae.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,C)=>{navigator.clipboard.writeText(k),a(C),setTimeout(()=>a(""),2e3)},h=(k,C)=>{r(E=>({...E,wechat:{...E.wechat,[k]:C}}))},f=(k,C)=>{r(E=>({...E,alipay:{...E.alipay,[k]:C}}))},m=(k,C)=>{r(E=>({...E,usdt:{...E.usdt,[k]:C}}))},g=(k,C)=>{r(E=>({...E,paypal:{...E.paypal,[k]:C}}))},y=n.wechat,w=n.alipay,N=n.usdt,b=n.paypal;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(te,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(te,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(WN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),s.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[s.jsx("li",{children:"打开微信,进入目标微信群"}),s.jsx("li",{children:'点击右上角"..." → "群二维码"'}),s.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),s.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),s.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),s.jsxs(pd,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Ol,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(an,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(ho,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(an,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(Db,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(an,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(Pb,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(an,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Sg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(on,{value:"wechat",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(st,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(ho,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(At,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"网站AppID"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"商户号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ls,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(oe,{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)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),s.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[s.jsx(Z,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(oe,{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)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(on,{value:"alipay",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(st,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(Db,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Vt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(At,{checked:!!w.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(w.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(te,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(w.partnerId??""),"pid"),children:i==="pid"?s.jsx(df,{className:"w-4 h-4 text-green-500"}):s.jsx(KN,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(oe,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(w.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ls,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(w.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(on,{value:"usdt",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(st,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(Pb,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(At,{checked:!!N.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(N.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"收款地址"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(N.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(on,{value:"paypal",className:"space-y-4",children:s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(st,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Sg,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(At,{checked:!!b.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(b.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(b.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const gV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},xV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},yV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function vV(){const[t,e]=v.useState({siteConfig:{...gV},menuConfig:{...xV},pageConfig:{...yV}}),[n,r]=v.useState(!1),[i,a]=v.useState(!1);v.useEffect(()=>{Le("/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 yt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await yt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await yt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),ae.success("配置已保存")}catch(f){console.error(f),ae.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{a(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(te,{onClick:o,disabled:i,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),i?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Sg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(oe,{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}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(oe,{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}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(oe,{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}}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(oe,{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}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(oe,{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}}))})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(sA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(Z,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(oe,{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}}))}),s.jsx(oe,{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}}))})]})]}),s.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(QM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Vt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(Ae,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(At,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(oe,{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}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(dM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首页标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首页副标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目录页标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"我的页标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function bV(){const[t,e]=v.useState(""),[n,r]=v.useState(""),[i,a]=v.useState(""),[o,c]=v.useState({}),u=async()=>{var y,w,N,b;try{const k=await Le("/api/config"),C=(w=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:w.urls;Array.isArray(C)&&e(C.join(` `));const E=(b=(N=k==null?void 0:k.paymentMethods)==null?void 0:N.wechat)==null?void 0:b.groupQrCode;E&&r(E),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};v.useEffect(()=>{u()},[]);const h=(y,w)=>{navigator.clipboard.writeText(y),a(w),setTimeout(()=>a(""),2e3)},f=async()=>{try{const y=t.split(` -`).map(N=>N.trim()).filter(Boolean),w=[...o.liveQRCodes||[]];w[0]?w[0].urls=y:w.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await wt("/api/db/config",{key:"live_qr_codes",value:w,description:"群活码配置"}),ae.success("群活码配置已保存!"),await u()}catch(y){console.error(y),ae.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await wt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),ae.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(w){console.error(w),ae.error("保存失败: "+(w instanceof Error?w.message:String(w)))}},g=()=>{n?window.open(n,"_blank"):ae.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(HN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Lb,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx($t,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Sg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{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)}),s.jsx(te,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:i==="group"?s.jsx(cf,{className:"w-4 h-4 text-green-500"}):s.jsx(UN,{className:"w-4 h-4 text-gray-400"})})]}),s.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[s.jsx(_s,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(te,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(oh,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(te,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(_s,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Lb,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx($t,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Sg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(_l,{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)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` -`).filter(Boolean).length," 个"]})]}),s.jsxs(te,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(oh,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),s.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[s.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),s.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),s.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const yN={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}},wV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function NV(){const[t,e]=v.useState(yN),[n,r]=v.useState(!0),[i,a]=v.useState(!1),[o,c]=v.useState(!1),[u,h]=v.useState(null),[f,m]=v.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const E=await Le("/api/db/config/full?key=match_config"),T=(E==null?void 0:E.data)??(E==null?void 0:E.config);T&&e({...yN,...T})}catch(E){console.error("加载匹配配置失败:",E)}finally{r(!1)}};v.useEffect(()=>{g()},[]);const y=async()=>{a(!0);try{const E=await wt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});E&&E.success!==!1?ae.success("配置保存成功!"):ae.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:"未知错误"))}catch(E){console.error("保存配置失败:",E),ae.error("保存失败")}finally{a(!1)}},w=E=>{h(E),m({id:E.id,label:E.label,matchLabel:E.matchLabel,icon:E.icon,matchFromDB:E.matchFromDB,showJoinAfterMatch:E.showJoinAfterMatch,price:E.price,enabled:E.enabled}),c(!0)},N=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},b=()=>{if(!f.id||!f.label){ae.error("请填写类型ID和名称");return}const E=[...t.matchTypes];if(u){const T=E.findIndex(I=>I.id===u.id);T!==-1&&(E[T]={...f})}else{if(E.some(T=>T.id===f.id)){ae.error("类型ID已存在");return}E.push({...f})}e({...t,matchTypes:E}),c(!1)},k=E=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(T=>T.id!==E)})},C=E=>{e({...t,matchTypes:t.matchTypes.map(T=>T.id===E?{...T,enabled:!T.enabled}:T)})};return s.jsxs("div",{className:"p-8 w-full space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(so,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(te,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(te,{onClick:y,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存配置"]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ia,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx($t,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:E=>e({...t,freeMatchLimit:parseInt(E.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(oe,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:E=>e({...t,matchPrice:parseFloat(E.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(oe,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:E=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(E.target.value,10)||10}})}),s.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:t.settings.enableFreeMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enableFreeMatches:E}})}),s.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:t.settings.enablePaidMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enablePaidMatches:E}})}),s.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx($t,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(te,{onClick:N,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(Ae,{children:s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"图标"}),s.jsx(je,{className:"text-gray-400",children:"类型ID"}),s.jsx(je,{className:"text-gray-400",children:"显示名称"}),s.jsx(je,{className:"text-gray-400",children:"匹配标签"}),s.jsx(je,{className:"text-gray-400",children:"价格"}),s.jsx(je,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(nr,{children:t.matchTypes.map(E=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsx("span",{className:"text-2xl",children:E.icon})}),s.jsx(xe,{className:"font-mono text-gray-300",children:E.id}),s.jsx(xe,{className:"text-white font-medium",children:E.label}),s.jsx(xe,{className:"text-gray-300",children:E.matchLabel}),s.jsx(xe,{children:s.jsxs(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",E.price]})}),s.jsx(xe,{children:E.matchFromDB?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(xe,{children:s.jsx(Et,{checked:E.enabled,onCheckedChange:()=>C(E.id)})}),s.jsx(xe,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(E),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(_t,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>k(E.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Bn,{className:"w-4 h-4"})})]})})]},E.id))})]})})]}),s.jsx(Kt,{open:o,onOpenChange:c,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[u?s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(dn,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:E=>m({...f,id:E.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:wV.map(E=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===E?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:E}),children:E},E))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"显示名称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:E=>m({...f,label:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配标签"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:E=>m({...f,matchLabel:E.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(oe,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:E=>m({...f,price:parseFloat(E.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.matchFromDB,onCheckedChange:E=>m({...f,matchFromDB:E})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.showJoinAfterMatch,onCheckedChange:E=>m({...f,showJoinAfterMatch:E})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.enabled,onCheckedChange:E=>m({...f,enabled:E})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(te,{onClick:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const vN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function jV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o,c]=v.useState(10),[u,h]=v.useState(""),[f,m]=v.useState(!0),[g,y]=v.useState(null);async function w(){m(!0),y(null);try{const b=new URLSearchParams({page:String(i),pageSize:String(o)});u&&b.set("matchType",u);const k=await Le(`/api/db/match-records?${b}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(b){console.error("加载匹配记录失败",b),y("加载失败,请检查网络后重试")}finally{m(!1)}}v.useEffect(()=>{w()},[i,u]);const N=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&s.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:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:b=>{h(b.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(vN).map(([b,k])=>s.jsx("option",{value:b,children:k},b))]}),s.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:[s.jsx(Ge,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"发起人"}),s.jsx(je,{className:"text-gray-400",children:"匹配到"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"联系方式"}),s.jsx(je,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(nr,{children:[t.map(b=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:[b.userAvatar?s.jsx("img",{src:b.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:b.userAvatar?"hidden":"",children:(b.userNickname||b.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:b.userNickname||b.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[b.userId.slice(0,16),"..."]})]})]})}),s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:[b.matchedUserAvatar?s.jsx("img",{src:b.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:b.matchedUserAvatar?"hidden":"",children:(b.matchedNickname||b.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:b.matchedNickname||b.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[b.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(xe,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:vN[b.matchType]||b.matchType})}),s.jsxs(xe,{className:"text-gray-400 text-sm",children:[b.phone&&s.jsxs("div",{children:["📱 ",b.phone]}),b.wechatId&&s.jsxs("div",{children:["💬 ",b.wechatId]}),!b.phone&&!b.wechatId&&"-"]}),s.jsx(xe,{className:"text-gray-400",children:b.createdAt?new Date(b.createdAt).toLocaleString():"-"})]},b.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(xs,{page:i,totalPages:N,total:n,pageSize:o,onPageChange:a,onPageSizeChange:b=>{c(b),a(1)}})]})})})]})}function kV(){const[t,e]=v.useState([]),[n,r]=v.useState(!0);async function i(){r(!0);try{const a=await Le("/api/db/vip-members?limit=100");if(a!=null&&a.success&&a.data){const o=[...a.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(a){console.error("Load VIP members error:",a),ae.error("加载 VIP 成员失败")}finally{r(!1)}}return v.useEffect(()=>{i()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("div",{className:"flex justify-between items-center mb-8",children:s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(xl,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(je,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(nr,{children:[t.map((a,o)=>{var c;return s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:o+1}),s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[a.avatar?s.jsx("img",{src:a.avatar,className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((c=a.name)==null?void 0:c[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:a.name})})]})}),s.jsx(xe,{className:"text-gray-300",children:a.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(xe,{className:"text-gray-300",children:a.vipSort??o+1})]},a.id)}),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function P4(t){const[e,n]=v.useState([]),[r,i]=v.useState(!0),[a,o]=v.useState(!1),[c,u]=v.useState(null),[h,f]=v.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=v.useState(!1),[y,w]=v.useState(!1),N=v.useRef(null),b=async P=>{var _;const L=(_=P.target.files)==null?void 0:_[0];if(L){w(!0);try{const J=new FormData;J.append("file",L),J.append("folder","mentors");const ee=Ox(),Y={};ee&&(Y.Authorization=`Bearer ${ee}`);const R=await(await fetch(ho("/api/upload"),{method:"POST",body:J,credentials:"include",headers:Y})).json();R!=null&&R.success&&(R!=null&&R.url)?f(F=>({...F,avatar:R.url})):ae.error("上传失败: "+((R==null?void 0:R.error)||"未知错误"))}catch(J){console.error(J),ae.error("上传失败")}finally{w(!1),N.current&&(N.current.value="")}}};async function k(){i(!0);try{const P=await Le("/api/db/mentors");P!=null&&P.success&&P.data&&n(P.data)}catch(P){console.error("Load mentors error:",P)}finally{i(!1)}}v.useEffect(()=>{k()},[]);const C=()=>{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})},E=()=>{u(null),C(),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)},I=async()=>{if(!h.name.trim()){ae.error("导师姓名不能为空");return}g(!0);try{const P=_=>_===""?void 0:parseFloat(_),L={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 _=await Mt("/api/db/mentors",{id:c.id,...L});_!=null&&_.success?(o(!1),k()):ae.error("更新失败: "+(_==null?void 0:_.error))}else{const _=await wt("/api/db/mentors",L);_!=null&&_.success?(o(!1),k()):ae.error("新增失败: "+(_==null?void 0:_.error))}}catch(P){console.error("Save error:",P),ae.error("保存失败")}finally{g(!1)}},O=async P=>{if(confirm("确定删除该导师?"))try{const L=await Ps(`/api/db/mentors?id=${P}`);L!=null&&L.success?k():ae.error("删除失败: "+(L==null?void 0:L.error))}catch(L){console.error("Delete error:",L),ae.error("删除失败")}},D=P=>P!=null?`¥${P}`:"-";return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(te,{onClick:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:r?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"姓名"}),s.jsx(je,{className:"text-gray-400",children:"简介"}),s.jsx(je,{className:"text-gray-400",children:"单次"}),s.jsx(je,{className:"text-gray-400",children:"半年"}),s.jsx(je,{className:"text-gray-400",children:"年度"}),s.jsx(je,{className:"text-gray-400",children:"排序"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(nr,{children:[e.map(P=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:P.id}),s.jsx(xe,{className:"text-white",children:P.name}),s.jsx(xe,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),s.jsx(xe,{className:"text-gray-400",children:D(P.priceSingle)}),s.jsx(xe,{className:"text-gray-400",children:D(P.priceHalfYear)}),s.jsx(xe,{className:"text-gray-400",children:D(P.priceYear)}),s.jsx(xe,{className:"text-gray-400",children:P.sort}),s.jsxs(xe,{className:"text-right",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>T(P),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(_t,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>O(P.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Bn,{className:"w-4 h-4"})})]})]},P.id)),e.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Kt,{open:a,onOpenChange:o,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:c?"编辑导师":"新增导师"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"姓名 *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:P=>f(L=>({...L,name:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"排序"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:P=>f(L=>({...L,sort:parseInt(P.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:P=>f(L=>({...L,avatar:P.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:N,type:"file",accept:"image/*",className:"hidden",onChange:b}),s.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var P;return(P=N.current)==null?void 0:P.click()},children:[s.jsx(oh,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:h.avatar.startsWith("http")?h.avatar:ho(h.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"简介"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:P=>f(L=>({...L,intro:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:P=>f(L=>({...L,tags:P.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(Z,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(oe,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:P=>f(L=>({...L,priceSingle:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(oe,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:P=>f(L=>({...L,priceHalfYear:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(oe,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:P=>f(L=>({...L,priceYear:P.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"引言"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:P=>f(L=>({...L,quote:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:P=>f(L=>({...L,whyFind:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:P=>f(L=>({...L,offering:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:P=>f(L=>({...L,judgmentStyle:P.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:P=>f(L=>({...L,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(Z,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:I,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function SV(){const[t,e]=v.useState([]),[n,r]=v.useState(!0),[i,a]=v.useState("");async function o(){r(!0);try{const h=i?`/api/db/mentor-consultations?status=${i}`:"/api/db/mentor-consultations",f=await Le(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}v.useEffect(()=>{o()},[i]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(ih,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:i,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:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>s.jsx("option",{value:h,children:f},h))]}),s.jsxs(te,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"用户ID"}),s.jsx(je,{className:"text-gray-400",children:"导师ID"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(nr,{children:[t.map(h=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:h.id}),s.jsx(xe,{className:"text-gray-400",children:h.userId}),s.jsx(xe,{className:"text-gray-400",children:h.mentorId}),s.jsx(xe,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(xe,{className:"text-white",children:["¥",h.amount]}),s.jsx(xe,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(xe,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Pc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},bN={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:Pc},CV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function EV(){const t=ja(),[e,n]=v.useState(bN),[r,i]=v.useState(!0),[a,o]=v.useState(!1),[c,u]=v.useState(!1),[h,f]=v.useState(null),[m,g]=v.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,w]=v.useState(null),[N,b]=v.useState(!1),k=async()=>{b(!0);try{const L=await Le("/api/db/match-pool-counts");L!=null&&L.success&&L.data&&w(L.data)}catch(L){console.error("加载池子人数失败:",L)}finally{b(!1)}},C=async()=>{i(!0);try{const L=await Le("/api/db/config/full?key=match_config"),_=(L==null?void 0:L.data)??(L==null?void 0:L.config);if(_){let J=_.poolSettings??Pc;J.poolSource&&!Array.isArray(J.poolSource)&&(J={...J,poolSource:[J.poolSource]}),n({...bN,..._,poolSettings:J})}}catch(L){console.error("加载匹配配置失败:",L)}finally{i(!1)}};v.useEffect(()=>{C(),k()},[]);const E=async()=>{o(!0);try{const L=await wt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});ae.error((L==null?void 0:L.success)!==!1?"配置保存成功!":"保存失败: "+((L==null?void 0:L.error)||"未知错误"))}catch(L){console.error(L),ae.error("保存失败")}finally{o(!1)}},T=L=>{f(L),g({...L}),u(!0)},I=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},O=()=>{if(!m.id||!m.label){ae.error("请填写类型ID和名称");return}const L=[...e.matchTypes];if(h){const _=L.findIndex(J=>J.id===h.id);_!==-1&&(L[_]={...m})}else{if(L.some(_=>_.id===m.id)){ae.error("类型ID已存在");return}L.push({...m})}n({...e,matchTypes:L}),u(!1)},D=L=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(_=>_.id!==L)})},P=L=>{n({...e,matchTypes:e.matchTypes.map(_=>_.id===L?{..._,enabled:!_.enabled}:_)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(te,{variant:"outline",onClick:C,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(te,{onClick:E,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"})," ",a?"保存中...":"保存配置"]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(KN,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx($t,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.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(L=>{const _=e.poolSettings??Pc,ee=(Array.isArray(_.poolSource)?_.poolSource:[_.poolSource]).includes(L.value),Y=y==null?void 0:y[L.countKey],U=()=>{const R=Array.isArray(_.poolSource)?[..._.poolSource]:[_.poolSource],F=ee?R.filter(re=>re!==L.value):[...R,L.value];F.length===0&&F.push(L.value),n({...e,poolSettings:{..._,poolSource:F}})};return s.jsxs("button",{type:"button",onClick:U,className:`p-4 rounded-lg border text-left transition-all ${ee?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${ee?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:ee&&"✓"}),s.jsx("span",{className:"text-xl",children:L.icon}),s.jsx("span",{className:`text-sm font-medium ${ee?"text-[#38bdac]":"text-gray-300"}`,children:L.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[N?"...":Y??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:L.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:R=>{R.stopPropagation(),t(`/users?pool=${L.value}`)},onKeyDown:R=>{R.key==="Enter"&&(R.stopPropagation(),t(`/users?pool=${L.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},L.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(Z,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.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(L=>{const J=(e.poolSettings??Pc)[L.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Et,{checked:J,onCheckedChange:ee=>n({...e,poolSettings:{...e.poolSettings??Pc,[L.key]:ee}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:L.icon}),s.jsx(Z,{className:"text-gray-300 text-sm",children:L.label})]})]},L.key)})})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ia,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx($t,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:L=>n({...e,freeMatchLimit:parseInt(L.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(oe,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:L=>n({...e,matchPrice:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(oe,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:L=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(L.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:e.settings.enableFreeMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enableFreeMatches:L}})}),s.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:e.settings.enablePaidMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enablePaidMatches:L}})}),s.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx($t,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(te,{onClick:I,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(Ae,{children:s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"图标"}),s.jsx(je,{className:"text-gray-400",children:"类型ID"}),s.jsx(je,{className:"text-gray-400",children:"显示名称"}),s.jsx(je,{className:"text-gray-400",children:"匹配标签"}),s.jsx(je,{className:"text-gray-400",children:"价格"}),s.jsx(je,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(nr,{children:e.matchTypes.map(L=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsx("span",{className:"text-2xl",children:L.icon})}),s.jsx(xe,{className:"font-mono text-gray-300",children:L.id}),s.jsx(xe,{className:"text-white font-medium",children:L.label}),s.jsx(xe,{className:"text-gray-300",children:L.matchLabel}),s.jsx(xe,{children:s.jsxs(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",L.price]})}),s.jsx(xe,{children:L.matchFromDB?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(xe,{children:s.jsx(Et,{checked:L.enabled,onCheckedChange:()=>P(L.id)})}),s.jsx(xe,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>T(L),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(_t,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>D(L.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Bn,{className:"w-4 h-4"})})]})})]},L.id))})]})})]}),s.jsx(Kt,{open:c,onOpenChange:u,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[h?s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(dn,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:L=>g({...m,id:L.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:CV.map(L=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===L?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:L}),children:L},L))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"显示名称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:L=>g({...m,label:L.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配标签"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:L=>g({...m,matchLabel:L.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(oe,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:L=>g({...m,price:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.matchFromDB,onCheckedChange:L=>g({...m,matchFromDB:L})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.showJoinAfterMatch,onCheckedChange:L=>g({...m,showJoinAfterMatch:L})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.enabled,onCheckedChange:L=>g({...m,enabled:L})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(te,{onClick:O,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const wN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function TV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o,c]=v.useState(10),[u,h]=v.useState(""),[f,m]=v.useState(!0),[g,y]=v.useState(null),[w,N]=v.useState(null);async function b(){m(!0),y(null);try{const E=new URLSearchParams({page:String(i),pageSize:String(o)});u&&E.set("matchType",u);const T=await Le(`/api/db/match-records?${E}`);T!=null&&T.success?(e(T.records||[]),r(T.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}v.useEffect(()=>{b()},[i,u]);const k=Math.ceil(n/o)||1,C=({userId:E,nickname:T,avatar:I})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>N(E),children:[s.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:[I?s.jsx("img",{src:I,alt:"",className:"w-full h-full object-cover",onError:O=>{O.currentTarget.style.display="none"}}):null,s.jsx("span",{className:I?"hidden":"",children:(T||E||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:T||E}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[E==null?void 0:E.slice(0,16),(E==null?void 0:E.length)>16?"...":""]})]})]});return s.jsxs("div",{children:[g&&s.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:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:E=>{h(E.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(wN).map(([E,T])=>s.jsx("option",{value:E,children:T},E))]}),s.jsxs("button",{type:"button",onClick:b,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:[s.jsx(Ge,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"发起人"}),s.jsx(je,{className:"text-gray-400",children:"匹配到"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"联系方式"}),s.jsx(je,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(nr,{children:[t.map(E=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsx(C,{userId:E.userId,nickname:E.userNickname,avatar:E.userAvatar})}),s.jsx(xe,{children:E.matchedUserId?s.jsx(C,{userId:E.matchedUserId,nickname:E.matchedNickname,avatar:E.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(xe,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:wN[E.matchType]||E.matchType})}),s.jsxs(xe,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"-"})]}),s.jsx(xe,{className:"text-gray-400",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"})]},E.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(xs,{page:i,totalPages:k,total:n,pageSize:o,onPageChange:a,onPageSizeChange:E=>{c(E),a(1)}})]})})}),s.jsx(Jx,{open:!!w,onClose:()=>N(null),userId:w,onUserUpdated:b})]})}function MV(){const[t,e]=v.useState("records");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.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:"匹配记录"}),s.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"&&s.jsx(TV,{}),t==="pool"&&s.jsx(EV,{})]})}const NN={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function AV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o,c]=v.useState(10),[u,h]=v.useState(!0),[f,m]=v.useState("investor"),[g,y]=v.useState(null);async function w(){h(!0);try{const C=new URLSearchParams({page:String(i),pageSize:String(o),matchType:f}),E=await Le(`/api/db/match-records?${C}`);E!=null&&E.success&&(e(E.records||[]),r(E.total??0))}catch(C){console.error(C)}finally{h(!1)}}v.useEffect(()=>{w()},[i,f]);const N=async C=>{if(!C.phone&&!C.wechatId){ae.info("该记录无联系方式,无法推送到存客宝");return}y(C.id);try{const E=await wt("/api/ckb/join",{type:C.matchType||"investor",phone:C.phone||"",wechat:C.wechatId||"",userId:C.userId,name:C.userNickname||""});ae.error((E==null?void 0:E.message)||(E!=null&&E.success?"推送成功":"推送失败"))}catch(E){ae.error("推送失败: "+(E instanceof Error?E.message:"网络错误"))}finally{y(null)}},b=Math.ceil(n/o)||1,k=C=>!!(C.phone||C.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:C=>{m(C.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(NN).map(([C,E])=>s.jsx("option",{value:C,children:E},C))}),s.jsxs(te,{onClick:w,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"发起人"}),s.jsx(je,{className:"text-gray-400",children:"匹配到"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"联系方式"}),s.jsx(je,{className:"text-gray-400",children:"时间"}),s.jsx(je,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(nr,{children:[t.map(C=>{var E,T;return s.jsxs(it,{className:`border-gray-700/50 ${k(C)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(xe,{className:"text-white",children:C.userNickname||((E=C.userId)==null?void 0:E.slice(0,12))}),s.jsx(xe,{className:"text-white",children:C.matchedNickname||((T=C.matchedUserId)==null?void 0:T.slice(0,12))}),s.jsx(xe,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:NN[C.matchType]||C.matchType})}),s.jsxs(xe,{className:"text-sm",children:[C.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(xe,{className:"text-gray-400 text-sm",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"}),s.jsx(xe,{className:"text-right",children:k(C)?s.jsxs(te,{size:"sm",onClick:()=>N(C),disabled:g===C.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(jA,{className:"w-3 h-3 mr-1"}),g===C.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},C.id)}),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(xs,{page:i,totalPages:b,total:n,pageSize:o,onPageChange:a,onPageSizeChange:C=>{c(C),a(1)}})]})})})]})}const jN={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},IV={single:"单次",half_year:"半年",year:"年度"};function RV(){const[t,e]=v.useState([]),[n,r]=v.useState(!0),[i,a]=v.useState("");async function o(){r(!0);try{const c=i?`/api/db/mentor-consultations?status=${i}`:"/api/db/mentor-consultations",u=await Le(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return v.useEffect(()=>{o()},[i]),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:i,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:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(jN).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(te,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"用户ID"}),s.jsx(je,{className:"text-gray-400",children:"导师ID"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(nr,{children:[t.map(c=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:c.id}),s.jsx(xe,{className:"text-gray-400",children:c.userId}),s.jsx(xe,{className:"text-gray-400",children:c.mentorId}),s.jsx(xe,{className:"text-gray-400",children:IV[c.consultationType]||c.consultationType}),s.jsxs(xe,{className:"text-white",children:["¥",c.amount]}),s.jsx(xe,{className:"text-gray-400",children:jN[c.status]||c.status}),s.jsx(xe,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function PV(){const[t,e]=v.useState("booking");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.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:"预约记录"}),s.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"&&s.jsx(RV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(P4,{embedded:!0})})]})}function OV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o,c]=v.useState(10),[u,h]=v.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(i),pageSize:String(o),matchType:"team"}),y=await Le(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}v.useEffect(()=>{f()},[i]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.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:[s.jsx(Ge,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"发起人"}),s.jsx(je,{className:"text-gray-400",children:"匹配到"}),s.jsx(je,{className:"text-gray-400",children:"联系方式"}),s.jsx(je,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(nr,{children:[t.map(g=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(xe,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(xe,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(xe,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(xs,{page:i,totalPages:m,total:n,pageSize:o,onPageChange:a,onPageSizeChange:g=>{c(g),a(1)}})]})})})]})}const kN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},SN={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function DV({onSwitchTab:t,onOpenCKB:e}={}){const n=ja(),[r,i]=v.useState(null),[a,o]=v.useState(null),[c,u]=v.useState(!0),h=v.useCallback(async()=>{var m,g;u(!0);try{const[y,w]=await Promise.allSettled([Le("/api/db/match-records?stats=true"),Le("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let N=y.value.data;if(N.totalMatches>0&&(!N.uniqueUsers||N.uniqueUsers===0))try{const b=await Le("/api/db/match-records?page=1&pageSize=200");if(b!=null&&b.success&&b.records){const k=new Set(b.records.map(C=>C.userId).filter(Boolean));N={...N,uniqueUsers:k.size}}}catch{}i(N)}w.status==="fulfilled"&&((g=w.value)!=null&&g.success)&&w.value.data&&o(w.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);v.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[s.jsx(Me,{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:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[s.jsx(_s,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),s.jsx(Me,{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:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),s.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(ia,{className:"w-3 h-3"})," 今日实时"]})]})}),s.jsx(Me,{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:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),s.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(_s,{className:"w-3 h-3"})," 查看用户管理"]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),s.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&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),s.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 s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("span",{className:"text-2xl",children:SN[m.matchType]||"📊"}),s.jsx("span",{className:"text-gray-300 font-medium",children:kN[m.matchType]||m.matchType})]}),s.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),s.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(gs,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[s.jsx(Me,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.ckbTotal)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.withContact)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),s.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(a==null?void 0:a.byType)&&a.byType.length>0&&s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:a.byType.map(m=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[s.jsx("span",{className:"text-xl",children:SN[m.matchType]||"📋"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-xs",children:kN[m.matchType]||m.matchType}),s.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const LV=["partner","investor","mentor","team"],mg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],CN=`# 场景获客接口摘要 +`).map(N=>N.trim()).filter(Boolean),w=[...o.liveQRCodes||[]];w[0]?w[0].urls=y:w.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await yt("/api/db/config",{key:"live_qr_codes",value:w,description:"群活码配置"}),ae.success("群活码配置已保存!"),await u()}catch(y){console.error(y),ae.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await yt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),ae.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(w){console.error(w),ae.error("保存失败: "+(w instanceof Error?w.message:String(w)))}},g=()=>{n?window.open(n,"_blank"):ae.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(WN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(_b,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Vt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Cg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{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)}),s.jsx(te,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:i==="group"?s.jsx(df,{className:"w-4 h-4 text-green-500"}):s.jsx(KN,{className:"w-4 h-4 text-gray-400"})})]}),s.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[s.jsx(Ls,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(te,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(lh,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(te,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(Ls,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(_b,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Cg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(Dl,{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)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` +`).filter(Boolean).length," 个"]})]}),s.jsxs(te,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(lh,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),s.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[s.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),s.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),s.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const vN={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}},wV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function NV(){const[t,e]=v.useState(vN),[n,r]=v.useState(!0),[i,a]=v.useState(!1),[o,c]=v.useState(!1),[u,h]=v.useState(null),[f,m]=v.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const E=await Le("/api/db/config/full?key=match_config"),T=(E==null?void 0:E.data)??(E==null?void 0:E.config);T&&e({...vN,...T})}catch(E){console.error("加载匹配配置失败:",E)}finally{r(!1)}};v.useEffect(()=>{g()},[]);const y=async()=>{a(!0);try{const E=await yt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});E&&E.success!==!1?ae.success("配置保存成功!"):ae.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:"未知错误"))}catch(E){console.error("保存配置失败:",E),ae.error("保存失败")}finally{a(!1)}},w=E=>{h(E),m({id:E.id,label:E.label,matchLabel:E.matchLabel,icon:E.icon,matchFromDB:E.matchFromDB,showJoinAfterMatch:E.showJoinAfterMatch,price:E.price,enabled:E.enabled}),c(!0)},N=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},b=()=>{if(!f.id||!f.label){ae.error("请填写类型ID和名称");return}const E=[...t.matchTypes];if(u){const T=E.findIndex(I=>I.id===u.id);T!==-1&&(E[T]={...f})}else{if(E.some(T=>T.id===f.id)){ae.error("类型ID已存在");return}E.push({...f})}e({...t,matchTypes:E}),c(!1)},k=E=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(T=>T.id!==E)})},C=E=>{e({...t,matchTypes:t.matchTypes.map(T=>T.id===E?{...T,enabled:!T.enabled}:T)})};return s.jsxs("div",{className:"p-8 w-full space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(io,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(te,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(te,{onClick:y,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存配置"]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(aa,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:E=>e({...t,freeMatchLimit:parseInt(E.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(oe,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:E=>e({...t,matchPrice:parseFloat(E.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(oe,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:E=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(E.target.value,10)||10}})}),s.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:t.settings.enableFreeMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enableFreeMatches:E}})}),s.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:t.settings.enablePaidMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enablePaidMatches:E}})}),s.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(te,{onClick:N,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(un,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(Ae,{children:s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"图标"}),s.jsx(je,{className:"text-gray-400",children:"类型ID"}),s.jsx(je,{className:"text-gray-400",children:"显示名称"}),s.jsx(je,{className:"text-gray-400",children:"匹配标签"}),s.jsx(je,{className:"text-gray-400",children:"价格"}),s.jsx(je,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(sr,{children:t.matchTypes.map(E=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsx("span",{className:"text-2xl",children:E.icon})}),s.jsx(xe,{className:"font-mono text-gray-300",children:E.id}),s.jsx(xe,{className:"text-white font-medium",children:E.label}),s.jsx(xe,{className:"text-gray-300",children:E.matchLabel}),s.jsx(xe,{children:s.jsxs(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",E.price]})}),s.jsx(xe,{children:E.matchFromDB?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(xe,{children:s.jsx(At,{checked:E.enabled,onCheckedChange:()=>C(E.id)})}),s.jsx(xe,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>w(E),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>k(E.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Hn,{className:"w-4 h-4"})})]})})]},E.id))})]})})]}),s.jsx(Yt,{open:o,onOpenChange:c,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[u?s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(un,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:E=>m({...f,id:E.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:wV.map(E=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===E?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:E}),children:E},E))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"显示名称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:E=>m({...f,label:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配标签"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:E=>m({...f,matchLabel:E.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(oe,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:E=>m({...f,price:parseFloat(E.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:f.matchFromDB,onCheckedChange:E=>m({...f,matchFromDB:E})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:f.showJoinAfterMatch,onCheckedChange:E=>m({...f,showJoinAfterMatch:E})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:f.enabled,onCheckedChange:E=>m({...f,enabled:E})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(te,{onClick:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const bN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function jV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o,c]=v.useState(10),[u,h]=v.useState(""),[f,m]=v.useState(!0),[g,y]=v.useState(null);async function w(){m(!0),y(null);try{const b=new URLSearchParams({page:String(i),pageSize:String(o)});u&&b.set("matchType",u);const k=await Le(`/api/db/match-records?${b}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(b){console.error("加载匹配记录失败",b),y("加载失败,请检查网络后重试")}finally{m(!1)}}v.useEffect(()=>{w()},[i,u]);const N=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&s.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:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:b=>{h(b.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(bN).map(([b,k])=>s.jsx("option",{value:b,children:k},b))]}),s.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:[s.jsx(Je,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"发起人"}),s.jsx(je,{className:"text-gray-400",children:"匹配到"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"联系方式"}),s.jsx(je,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(sr,{children:[t.map(b=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:[b.userAvatar?s.jsx("img",{src:b.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:b.userAvatar?"hidden":"",children:(b.userNickname||b.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:b.userNickname||b.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[b.userId.slice(0,16),"..."]})]})]})}),s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:[b.matchedUserAvatar?s.jsx("img",{src:b.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:b.matchedUserAvatar?"hidden":"",children:(b.matchedNickname||b.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:b.matchedNickname||b.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[b.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(xe,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:bN[b.matchType]||b.matchType})}),s.jsxs(xe,{className:"text-gray-400 text-sm",children:[b.phone&&s.jsxs("div",{children:["📱 ",b.phone]}),b.wechatId&&s.jsxs("div",{children:["💬 ",b.wechatId]}),!b.phone&&!b.wechatId&&"-"]}),s.jsx(xe,{className:"text-gray-400",children:b.createdAt?new Date(b.createdAt).toLocaleString():"-"})]},b.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(vs,{page:i,totalPages:N,total:n,pageSize:o,onPageChange:a,onPageSizeChange:b=>{c(b),a(1)}})]})})})]})}function kV(){const[t,e]=v.useState([]),[n,r]=v.useState(!0);async function i(){r(!0);try{const a=await Le("/api/db/vip-members?limit=100");if(a!=null&&a.success&&a.data){const o=[...a.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(a){console.error("Load VIP members error:",a),ae.error("加载 VIP 成员失败")}finally{r(!1)}}return v.useEffect(()=>{i()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("div",{className:"flex justify-between items-center mb-8",children:s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(ml,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(je,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(sr,{children:[t.map((a,o)=>{var c;return s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:o+1}),s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[a.avatar?s.jsx("img",{src:a.avatar,className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((c=a.name)==null?void 0:c[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:a.name})})]})}),s.jsx(xe,{className:"text-gray-300",children:a.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(xe,{className:"text-gray-300",children:a.vipSort??o+1})]},a.id)}),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function O4(t){const[e,n]=v.useState([]),[r,i]=v.useState(!0),[a,o]=v.useState(!1),[c,u]=v.useState(null),[h,f]=v.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=v.useState(!1),[y,w]=v.useState(!1),N=v.useRef(null),b=async P=>{var _;const L=(_=P.target.files)==null?void 0:_[0];if(L){w(!0);try{const J=new FormData;J.append("file",L),J.append("folder","mentors");const ee=Dx(),Y={};ee&&(Y.Authorization=`Bearer ${ee}`);const R=await(await fetch(fo("/api/upload"),{method:"POST",body:J,credentials:"include",headers:Y})).json();R!=null&&R.success&&(R!=null&&R.url)?f(F=>({...F,avatar:R.url})):ae.error("上传失败: "+((R==null?void 0:R.error)||"未知错误"))}catch(J){console.error(J),ae.error("上传失败")}finally{w(!1),N.current&&(N.current.value="")}}};async function k(){i(!0);try{const P=await Le("/api/db/mentors");P!=null&&P.success&&P.data&&n(P.data)}catch(P){console.error("Load mentors error:",P)}finally{i(!1)}}v.useEffect(()=>{k()},[]);const C=()=>{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})},E=()=>{u(null),C(),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)},I=async()=>{if(!h.name.trim()){ae.error("导师姓名不能为空");return}g(!0);try{const P=_=>_===""?void 0:parseFloat(_),L={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 _=await It("/api/db/mentors",{id:c.id,...L});_!=null&&_.success?(o(!1),k()):ae.error("更新失败: "+(_==null?void 0:_.error))}else{const _=await yt("/api/db/mentors",L);_!=null&&_.success?(o(!1),k()):ae.error("新增失败: "+(_==null?void 0:_.error))}}catch(P){console.error("Save error:",P),ae.error("保存失败")}finally{g(!1)}},O=async P=>{if(confirm("确定删除该导师?"))try{const L=await Rs(`/api/db/mentors?id=${P}`);L!=null&&L.success?k():ae.error("删除失败: "+(L==null?void 0:L.error))}catch(L){console.error("Delete error:",L),ae.error("删除失败")}},D=P=>P!=null?`¥${P}`:"-";return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(te,{onClick:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(un,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:r?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"姓名"}),s.jsx(je,{className:"text-gray-400",children:"简介"}),s.jsx(je,{className:"text-gray-400",children:"单次"}),s.jsx(je,{className:"text-gray-400",children:"半年"}),s.jsx(je,{className:"text-gray-400",children:"年度"}),s.jsx(je,{className:"text-gray-400",children:"排序"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(sr,{children:[e.map(P=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:P.id}),s.jsx(xe,{className:"text-white",children:P.name}),s.jsx(xe,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),s.jsx(xe,{className:"text-gray-400",children:D(P.priceSingle)}),s.jsx(xe,{className:"text-gray-400",children:D(P.priceHalfYear)}),s.jsx(xe,{className:"text-gray-400",children:D(P.priceYear)}),s.jsx(xe,{className:"text-gray-400",children:P.sort}),s.jsxs(xe,{className:"text-right",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>T(P),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>O(P.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Hn,{className:"w-4 h-4"})})]})]},P.id)),e.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Yt,{open:a,onOpenChange:o,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:c?"编辑导师":"新增导师"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"姓名 *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:P=>f(L=>({...L,name:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"排序"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:P=>f(L=>({...L,sort:parseInt(P.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(oe,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:P=>f(L=>({...L,avatar:P.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:N,type:"file",accept:"image/*",className:"hidden",onChange:b}),s.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var P;return(P=N.current)==null?void 0:P.click()},children:[s.jsx(lh,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:h.avatar.startsWith("http")?h.avatar:fo(h.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"简介"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:P=>f(L=>({...L,intro:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:P=>f(L=>({...L,tags:P.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(Z,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(oe,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:P=>f(L=>({...L,priceSingle:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(oe,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:P=>f(L=>({...L,priceHalfYear:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(oe,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:P=>f(L=>({...L,priceYear:P.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"引言"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:P=>f(L=>({...L,quote:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:P=>f(L=>({...L,whyFind:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:P=>f(L=>({...L,offering:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:P=>f(L=>({...L,judgmentStyle:P.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:P=>f(L=>({...L,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(Z,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:I,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function SV(){const[t,e]=v.useState([]),[n,r]=v.useState(!0),[i,a]=v.useState("");async function o(){r(!0);try{const h=i?`/api/db/mentor-consultations?status=${i}`:"/api/db/mentor-consultations",f=await Le(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}v.useEffect(()=>{o()},[i]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(ah,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:i,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:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>s.jsx("option",{value:h,children:f},h))]}),s.jsxs(te,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"用户ID"}),s.jsx(je,{className:"text-gray-400",children:"导师ID"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(sr,{children:[t.map(h=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:h.id}),s.jsx(xe,{className:"text-gray-400",children:h.userId}),s.jsx(xe,{className:"text-gray-400",children:h.mentorId}),s.jsx(xe,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(xe,{className:"text-white",children:["¥",h.amount]}),s.jsx(xe,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(xe,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Oc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},wN={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:Oc},CV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function EV(){const t=ka(),[e,n]=v.useState(wN),[r,i]=v.useState(!0),[a,o]=v.useState(!1),[c,u]=v.useState(!1),[h,f]=v.useState(null),[m,g]=v.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,w]=v.useState(null),[N,b]=v.useState(!1),k=async()=>{b(!0);try{const L=await Le("/api/db/match-pool-counts");L!=null&&L.success&&L.data&&w(L.data)}catch(L){console.error("加载池子人数失败:",L)}finally{b(!1)}},C=async()=>{i(!0);try{const L=await Le("/api/db/config/full?key=match_config"),_=(L==null?void 0:L.data)??(L==null?void 0:L.config);if(_){let J=_.poolSettings??Oc;J.poolSource&&!Array.isArray(J.poolSource)&&(J={...J,poolSource:[J.poolSource]}),n({...wN,..._,poolSettings:J})}}catch(L){console.error("加载匹配配置失败:",L)}finally{i(!1)}};v.useEffect(()=>{C(),k()},[]);const E=async()=>{o(!0);try{const L=await yt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});ae.error((L==null?void 0:L.success)!==!1?"配置保存成功!":"保存失败: "+((L==null?void 0:L.error)||"未知错误"))}catch(L){console.error(L),ae.error("保存失败")}finally{o(!1)}},T=L=>{f(L),g({...L}),u(!0)},I=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},O=()=>{if(!m.id||!m.label){ae.error("请填写类型ID和名称");return}const L=[...e.matchTypes];if(h){const _=L.findIndex(J=>J.id===h.id);_!==-1&&(L[_]={...m})}else{if(L.some(_=>_.id===m.id)){ae.error("类型ID已存在");return}L.push({...m})}n({...e,matchTypes:L}),u(!1)},D=L=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(_=>_.id!==L)})},P=L=>{n({...e,matchTypes:e.matchTypes.map(_=>_.id===L?{..._,enabled:!_.enabled}:_)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(te,{variant:"outline",onClick:C,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(te,{onClick:E,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"})," ",a?"保存中...":"保存配置"]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(qN,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Vt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.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(L=>{const _=e.poolSettings??Oc,ee=(Array.isArray(_.poolSource)?_.poolSource:[_.poolSource]).includes(L.value),Y=y==null?void 0:y[L.countKey],U=()=>{const R=Array.isArray(_.poolSource)?[..._.poolSource]:[_.poolSource],F=ee?R.filter(re=>re!==L.value):[...R,L.value];F.length===0&&F.push(L.value),n({...e,poolSettings:{..._,poolSource:F}})};return s.jsxs("button",{type:"button",onClick:U,className:`p-4 rounded-lg border text-left transition-all ${ee?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${ee?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:ee&&"✓"}),s.jsx("span",{className:"text-xl",children:L.icon}),s.jsx("span",{className:`text-sm font-medium ${ee?"text-[#38bdac]":"text-gray-300"}`,children:L.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[N?"...":Y??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:L.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:R=>{R.stopPropagation(),t(`/users?pool=${L.value}`)},onKeyDown:R=>{R.key==="Enter"&&(R.stopPropagation(),t(`/users?pool=${L.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},L.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(Z,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.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(L=>{const J=(e.poolSettings??Oc)[L.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(At,{checked:J,onCheckedChange:ee=>n({...e,poolSettings:{...e.poolSettings??Oc,[L.key]:ee}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:L.icon}),s.jsx(Z,{className:"text-gray-300 text-sm",children:L.label})]})]},L.key)})})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(aa,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:L=>n({...e,freeMatchLimit:parseInt(L.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(oe,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:L=>n({...e,matchPrice:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(oe,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:L=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(L.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:e.settings.enableFreeMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enableFreeMatches:L}})}),s.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:e.settings.enablePaidMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enablePaidMatches:L}})}),s.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Vt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(te,{onClick:I,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(un,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(Ae,{children:s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"图标"}),s.jsx(je,{className:"text-gray-400",children:"类型ID"}),s.jsx(je,{className:"text-gray-400",children:"显示名称"}),s.jsx(je,{className:"text-gray-400",children:"匹配标签"}),s.jsx(je,{className:"text-gray-400",children:"价格"}),s.jsx(je,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(sr,{children:e.matchTypes.map(L=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsx("span",{className:"text-2xl",children:L.icon})}),s.jsx(xe,{className:"font-mono text-gray-300",children:L.id}),s.jsx(xe,{className:"text-white font-medium",children:L.label}),s.jsx(xe,{className:"text-gray-300",children:L.matchLabel}),s.jsx(xe,{children:s.jsxs(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",L.price]})}),s.jsx(xe,{children:L.matchFromDB?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(xe,{children:s.jsx(At,{checked:L.enabled,onCheckedChange:()=>P(L.id)})}),s.jsx(xe,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>T(L),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>D(L.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Hn,{className:"w-4 h-4"})})]})})]},L.id))})]})})]}),s.jsx(Yt,{open:c,onOpenChange:u,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[h?s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(un,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:L=>g({...m,id:L.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:CV.map(L=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===L?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:L}),children:L},L))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"显示名称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:L=>g({...m,label:L.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配标签"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:L=>g({...m,matchLabel:L.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(oe,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:L=>g({...m,price:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:m.matchFromDB,onCheckedChange:L=>g({...m,matchFromDB:L})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:m.showJoinAfterMatch,onCheckedChange:L=>g({...m,showJoinAfterMatch:L})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:m.enabled,onCheckedChange:L=>g({...m,enabled:L})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(te,{onClick:O,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const NN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function TV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o,c]=v.useState(10),[u,h]=v.useState(""),[f,m]=v.useState(!0),[g,y]=v.useState(null),[w,N]=v.useState(null);async function b(){m(!0),y(null);try{const E=new URLSearchParams({page:String(i),pageSize:String(o)});u&&E.set("matchType",u);const T=await Le(`/api/db/match-records?${E}`);T!=null&&T.success?(e(T.records||[]),r(T.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}v.useEffect(()=>{b()},[i,u]);const k=Math.ceil(n/o)||1,C=({userId:E,nickname:T,avatar:I})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>N(E),children:[s.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:[I?s.jsx("img",{src:I,alt:"",className:"w-full h-full object-cover",onError:O=>{O.currentTarget.style.display="none"}}):null,s.jsx("span",{className:I?"hidden":"",children:(T||E||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:T||E}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[E==null?void 0:E.slice(0,16),(E==null?void 0:E.length)>16?"...":""]})]})]});return s.jsxs("div",{children:[g&&s.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:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:E=>{h(E.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(NN).map(([E,T])=>s.jsx("option",{value:E,children:T},E))]}),s.jsxs("button",{type:"button",onClick:b,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:[s.jsx(Je,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"发起人"}),s.jsx(je,{className:"text-gray-400",children:"匹配到"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"联系方式"}),s.jsx(je,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(sr,{children:[t.map(E=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsx(C,{userId:E.userId,nickname:E.userNickname,avatar:E.userAvatar})}),s.jsx(xe,{children:E.matchedUserId?s.jsx(C,{userId:E.matchedUserId,nickname:E.matchedNickname,avatar:E.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(xe,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:NN[E.matchType]||E.matchType})}),s.jsxs(xe,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"-"})]}),s.jsx(xe,{className:"text-gray-400",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"})]},E.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(vs,{page:i,totalPages:k,total:n,pageSize:o,onPageChange:a,onPageSizeChange:E=>{c(E),a(1)}})]})})}),s.jsx(Yx,{open:!!w,onClose:()=>N(null),userId:w,onUserUpdated:b})]})}function MV(){const[t,e]=v.useState("records");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.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:"匹配记录"}),s.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"&&s.jsx(TV,{}),t==="pool"&&s.jsx(EV,{})]})}const jN={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function AV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o,c]=v.useState(10),[u,h]=v.useState(!0),[f,m]=v.useState("investor"),[g,y]=v.useState(null);async function w(){h(!0);try{const C=new URLSearchParams({page:String(i),pageSize:String(o),matchType:f}),E=await Le(`/api/db/match-records?${C}`);E!=null&&E.success&&(e(E.records||[]),r(E.total??0))}catch(C){console.error(C)}finally{h(!1)}}v.useEffect(()=>{w()},[i,f]);const N=async C=>{if(!C.phone&&!C.wechatId){ae.info("该记录无联系方式,无法推送到存客宝");return}y(C.id);try{const E=await yt("/api/ckb/join",{type:C.matchType||"investor",phone:C.phone||"",wechat:C.wechatId||"",userId:C.userId,name:C.userNickname||""});ae.error((E==null?void 0:E.message)||(E!=null&&E.success?"推送成功":"推送失败"))}catch(E){ae.error("推送失败: "+(E instanceof Error?E.message:"网络错误"))}finally{y(null)}},b=Math.ceil(n/o)||1,k=C=>!!(C.phone||C.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:C=>{m(C.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(jN).map(([C,E])=>s.jsx("option",{value:C,children:E},C))}),s.jsxs(te,{onClick:w,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"发起人"}),s.jsx(je,{className:"text-gray-400",children:"匹配到"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"联系方式"}),s.jsx(je,{className:"text-gray-400",children:"时间"}),s.jsx(je,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(sr,{children:[t.map(C=>{var E,T;return s.jsxs(it,{className:`border-gray-700/50 ${k(C)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(xe,{className:"text-white",children:C.userNickname||((E=C.userId)==null?void 0:E.slice(0,12))}),s.jsx(xe,{className:"text-white",children:C.matchedNickname||((T=C.matchedUserId)==null?void 0:T.slice(0,12))}),s.jsx(xe,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:jN[C.matchType]||C.matchType})}),s.jsxs(xe,{className:"text-sm",children:[C.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(xe,{className:"text-gray-400 text-sm",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"}),s.jsx(xe,{className:"text-right",children:k(C)?s.jsxs(te,{size:"sm",onClick:()=>N(C),disabled:g===C.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(jA,{className:"w-3 h-3 mr-1"}),g===C.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},C.id)}),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(vs,{page:i,totalPages:b,total:n,pageSize:o,onPageChange:a,onPageSizeChange:C=>{c(C),a(1)}})]})})})]})}const kN={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},IV={single:"单次",half_year:"半年",year:"年度"};function RV(){const[t,e]=v.useState([]),[n,r]=v.useState(!0),[i,a]=v.useState("");async function o(){r(!0);try{const c=i?`/api/db/mentor-consultations?status=${i}`:"/api/db/mentor-consultations",u=await Le(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return v.useEffect(()=>{o()},[i]),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:i,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:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(kN).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(te,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"用户ID"}),s.jsx(je,{className:"text-gray-400",children:"导师ID"}),s.jsx(je,{className:"text-gray-400",children:"类型"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(sr,{children:[t.map(c=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(xe,{className:"text-gray-300",children:c.id}),s.jsx(xe,{className:"text-gray-400",children:c.userId}),s.jsx(xe,{className:"text-gray-400",children:c.mentorId}),s.jsx(xe,{className:"text-gray-400",children:IV[c.consultationType]||c.consultationType}),s.jsxs(xe,{className:"text-white",children:["¥",c.amount]}),s.jsx(xe,{className:"text-gray-400",children:kN[c.status]||c.status}),s.jsx(xe,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function PV(){const[t,e]=v.useState("booking");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.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:"预约记录"}),s.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"&&s.jsx(RV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(O4,{embedded:!0})})]})}function OV(){const[t,e]=v.useState([]),[n,r]=v.useState(0),[i,a]=v.useState(1),[o,c]=v.useState(10),[u,h]=v.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(i),pageSize:String(o),matchType:"team"}),y=await Le(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}v.useEffect(()=>{f()},[i]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.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:[s.jsx(Je,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"发起人"}),s.jsx(je,{className:"text-gray-400",children:"匹配到"}),s.jsx(je,{className:"text-gray-400",children:"联系方式"}),s.jsx(je,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(sr,{children:[t.map(g=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(xe,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(xe,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(xe,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(vs,{page:i,totalPages:m,total:n,pageSize:o,onPageChange:a,onPageSizeChange:g=>{c(g),a(1)}})]})})})]})}const SN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},CN={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function DV({onSwitchTab:t,onOpenCKB:e}={}){const n=ka(),[r,i]=v.useState(null),[a,o]=v.useState(null),[c,u]=v.useState(!0),h=v.useCallback(async()=>{var m,g;u(!0);try{const[y,w]=await Promise.allSettled([Le("/api/db/match-records?stats=true"),Le("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let N=y.value.data;if(N.totalMatches>0&&(!N.uniqueUsers||N.uniqueUsers===0))try{const b=await Le("/api/db/match-records?page=1&pageSize=200");if(b!=null&&b.success&&b.records){const k=new Set(b.records.map(C=>C.userId).filter(Boolean));N={...N,uniqueUsers:k.size}}}catch{}i(N)}w.status==="fulfilled"&&((g=w.value)!=null&&g.success)&&w.value.data&&o(w.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);v.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[s.jsx(Me,{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:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[s.jsx(Ls,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),s.jsx(Me,{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:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),s.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(aa,{className:"w-3 h-3"})," 今日实时"]})]})}),s.jsx(Me,{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:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),s.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(Ls,{className:"w-3 h-3"})," 查看用户管理"]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),s.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&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),s.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 s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("span",{className:"text-2xl",children:CN[m.matchType]||"📊"}),s.jsx("span",{className:"text-gray-300 font-medium",children:SN[m.matchType]||m.matchType})]}),s.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),s.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(ys,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[s.jsx(Me,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.ckbTotal)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.withContact)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),s.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(a==null?void 0:a.byType)&&a.byType.length>0&&s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:a.byType.map(m=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[s.jsx("span",{className:"text-xl",children:CN[m.matchType]||"📋"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-xs",children:SN[m.matchType]||m.matchType}),s.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const LV=["partner","investor","mentor","team"],gg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],EN=`# 场景获客接口摘要 - 地址:POST /v1/api/scenarios - 必填:apiKey、sign、timestamp - 主标识:phone 或 wechatId 至少一项 - 可选:name、source、remark、tags、siteTags、portrait - 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function _V({initialTab:t="overview"}){const[e,n]=v.useState(t),[r,i]=v.useState("13800000000"),[a,o]=v.useState(""),[c,u]=v.useState(""),[h,f]=v.useState(CN),[m,g]=v.useState(!1),[y,w]=v.useState(!1),[N,b]=v.useState([]),[k,C]=v.useState([]),[E,T]=v.useState({}),[I,O]=v.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"}]),D=v.useMemo(()=>{const R={};return mg.forEach(F=>{R[F.key]=E[F.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),R},[E]),P=R=>{const F=r.trim(),re=a.trim();return R<=3?{type:LV[R],phone:F||void 0,wechat:re||void 0,userId:"admin_test",name:"后台测试"}:R===4?{matchType:"partner",phone:F||void 0,wechat:re||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:R===5?{phone:F||void 0,wechatId:re||void 0,userId:"admin_test",name:"后台测试"}:{}};async function L(){w(!0);try{const[R,F,re]=await Promise.all([Le("/api/db/config/full?key=ckb_config"),Le("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Le("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),z=R==null?void 0:R.data;z!=null&&z.routes&&T(z.routes),z!=null&&z.docNotes&&u(z.docNotes),z!=null&&z.docContent&&f(z.docContent),F!=null&&F.success&&b(F.records||[]),re!=null&&re.success&&C(re.records||[])}finally{w(!1)}}v.useEffect(()=>{n(t)},[t]),v.useEffect(()=>{L()},[]);async function _(){g(!0);try{const R=await wt("/api/db/config",{key:"ckb_config",value:{routes:D,docNotes:c,docContent:h},description:"存客宝接口配置"});ae.error((R==null?void 0:R.success)!==!1?"存客宝配置已保存":`保存失败: ${(R==null?void 0:R.error)||"未知错误"}`)}catch(R){ae.error(`保存失败: ${R instanceof Error?R.message:"网络错误"}`)}finally{g(!1)}}const J=(R,F)=>{T(re=>({...re,[R]:{...D[R],...F}}))},ee=async R=>{const F=I[R];if(F.method==="POST"&&!r.trim()&&!a.trim()){ae.error("请填写测试手机号");return}const re=[...I];re[R]={...F,status:"testing",message:void 0,responseTime:void 0},O(re);const z=performance.now();try{const ie=F.method==="GET"?await Le(F.endpoint):await wt(F.endpoint,P(R)),G=Math.round(performance.now()-z),$=(ie==null?void 0:ie.message)||"",H=(ie==null?void 0:ie.success)===!0||$.includes("已存在")||$.includes("已加入")||$.includes("已提交"),ce=[...I];ce[R]={...F,status:H?"success":"error",message:$||(H?"正常":"异常"),responseTime:G},O(ce),await L()}catch(ie){const G=Math.round(performance.now()-z),$=[...I];$[R]={...F,status:"error",message:ie instanceof Error?ie.message:"失败",responseTime:G},O($)}},Y=async()=>{if(!r.trim()&&!a.trim()){ae.error("请填写测试手机号");return}for(let R=0;Rs.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:R.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:F})}):R.map(re=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:re.userNickname||re.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:re.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:re.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:re.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:re.createdAt?new Date(re.createdAt).toLocaleString():"—"})]},re.id))})]})});return s.jsx(Me,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(Ae,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(_s,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(te,{onClick:()=>L(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(te,{onClick:_,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([R,F])=>s.jsx("button",{type:"button",onClick:()=>n(R),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===R?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:F},R))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:N.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:mg.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&U(N,"暂无已提交线索"),e==="contact"&&U(k,"暂无有联系方式线索"),e==="config"&&s.jsx("div",{className:"space-y-4",children:mg.map(R=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white font-medium",children:R.label}),s.jsx(Ue,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:R.key})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].apiUrl,onChange:F=>J(R.key,{apiUrl:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].apiKey,onChange:F=>J(R.key,{apiKey:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].source,onChange:F=>J(R.key,{source:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].tags,onChange:F=>J(R.key,{tags:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].siteTags,onChange:F=>J(R.key,{siteTags:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].notes,onChange:F=>J(R.key,{notes:F.target.value})})]})]})]},R.key))}),e==="test"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx(uo,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:R=>i(R.target.value)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:a,onChange:R=>o(R.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(te,{onClick:Y,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(ia,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:I.map((R,F)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[R.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),R.status==="testing"&&s.jsx(Ge,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),R.status==="success"&&s.jsx(wg,{className:"w-3 h-3 text-green-400 shrink-0"}),R.status==="error"&&s.jsx(WN,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:R.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[R.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[R.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>ee(F),disabled:R.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${R.endpoint}-${F}`))})]}),e==="doc"&&s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),s.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:[s.jsx(_s,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||CN})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),s.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:R=>u(R.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const zV=[{id:"stats",label:"数据统计",icon:$T},{id:"partner",label:"找伙伴",icon:Un},{id:"resource",label:"资源对接",icon:wM},{id:"mentor",label:"导师预约",icon:yM},{id:"team",label:"团队招募",icon:Eg}];function $V(){const[t,e]=v.useState("stats"),[n,r]=v.useState(!1),[i,a]=v.useState("overview");return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),s.jsxs(te,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[s.jsx(gs,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&s.jsx(_V,{initialTab:i}),s.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:zV.map(o=>{const c=t===o.id;return s.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:[s.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&s.jsx(DV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{a(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(MV,{}),t==="resource"&&s.jsx(AV,{}),t==="mentor"&&s.jsx(PV,{}),t==="team"&&s.jsx(OV,{})]})}function FV(){return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[s.jsx(gs,{className:"w-8 h-8 text-[#38bdac]"}),s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),s.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"1. 接口总览"})}),s.jsxs(Ae,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),s.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[s.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),s.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),s.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),s.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),s.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),s.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),s.jsx("li",{children:"/api/config — 配置系统"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),s.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),s.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"2. 书籍内容"})}),s.jsxs(Ae,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),s.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),s.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"3. 支付"})}),s.jsxs(Ae,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),s.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),s.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"4. 分销与用户"})}),s.jsxs(Ae,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),s.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),s.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"5. 管理后台"})}),s.jsxs(Ae,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),s.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),s.jsx("p",{children:"GET /api/admin/orders — 订单列表"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function BV(){const t=Na();return s.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.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:s.jsx(VN,{className:"w-10 h-10"})}),s.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),s.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),s.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),s.jsx(te,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(bg,{to:"/",children:[s.jsx(AM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function VV(){return s.jsxs(mT,{children:[s.jsx(Wt,{path:"/login",element:s.jsx(XI,{})}),s.jsxs(Wt,{path:"/",element:s.jsx(tI,{}),children:[s.jsx(Wt,{index:!0,element:s.jsx(bm,{to:"/dashboard",replace:!0})}),s.jsx(Wt,{path:"dashboard",element:s.jsx(lP,{})}),s.jsx(Wt,{path:"orders",element:s.jsx(cP,{})}),s.jsx(Wt,{path:"users",element:s.jsx(dP,{})}),s.jsx(Wt,{path:"distribution",element:s.jsx(RP,{})}),s.jsx(Wt,{path:"withdrawals",element:s.jsx(PP,{})}),s.jsx(Wt,{path:"content",element:s.jsx(aV,{})}),s.jsx(Wt,{path:"referral-settings",element:s.jsx(Ik,{})}),s.jsx(Wt,{path:"author-settings",element:s.jsx(bm,{to:"/settings?tab=author",replace:!0})}),s.jsx(Wt,{path:"vip-roles",element:s.jsx(kV,{})}),s.jsx(Wt,{path:"mentors",element:s.jsx(P4,{})}),s.jsx(Wt,{path:"mentor-consultations",element:s.jsx(SV,{})}),s.jsx(Wt,{path:"admin-users",element:s.jsx(bm,{to:"/settings?tab=admin",replace:!0})}),s.jsx(Wt,{path:"settings",element:s.jsx(pV,{})}),s.jsx(Wt,{path:"payment",element:s.jsx(mV,{})}),s.jsx(Wt,{path:"site",element:s.jsx(vV,{})}),s.jsx(Wt,{path:"qrcodes",element:s.jsx(bV,{})}),s.jsx(Wt,{path:"find-partner",element:s.jsx($V,{})}),s.jsx(Wt,{path:"match",element:s.jsx(NV,{})}),s.jsx(Wt,{path:"match-records",element:s.jsx(jV,{})}),s.jsx(Wt,{path:"api-doc",element:s.jsx(FV,{})})]}),s.jsx(Wt,{path:"*",element:s.jsx(BV,{})})]})}b3.createRoot(document.getElementById("root")).render(s.jsx(v.StrictMode,{children:s.jsx(jT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(VV,{})})})); +- 成功:code=200,message=新增成功 或 已存在`;function _V({initialTab:t="overview"}){const[e,n]=v.useState(t),[r,i]=v.useState("13800000000"),[a,o]=v.useState(""),[c,u]=v.useState(""),[h,f]=v.useState(EN),[m,g]=v.useState(!1),[y,w]=v.useState(!1),[N,b]=v.useState([]),[k,C]=v.useState([]),[E,T]=v.useState({}),[I,O]=v.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"}]),D=v.useMemo(()=>{const R={};return gg.forEach(F=>{R[F.key]=E[F.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),R},[E]),P=R=>{const F=r.trim(),re=a.trim();return R<=3?{type:LV[R],phone:F||void 0,wechat:re||void 0,userId:"admin_test",name:"后台测试"}:R===4?{matchType:"partner",phone:F||void 0,wechat:re||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:R===5?{phone:F||void 0,wechatId:re||void 0,userId:"admin_test",name:"后台测试"}:{}};async function L(){w(!0);try{const[R,F,re]=await Promise.all([Le("/api/db/config/full?key=ckb_config"),Le("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Le("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),z=R==null?void 0:R.data;z!=null&&z.routes&&T(z.routes),z!=null&&z.docNotes&&u(z.docNotes),z!=null&&z.docContent&&f(z.docContent),F!=null&&F.success&&b(F.records||[]),re!=null&&re.success&&C(re.records||[])}finally{w(!1)}}v.useEffect(()=>{n(t)},[t]),v.useEffect(()=>{L()},[]);async function _(){g(!0);try{const R=await yt("/api/db/config",{key:"ckb_config",value:{routes:D,docNotes:c,docContent:h},description:"存客宝接口配置"});ae.error((R==null?void 0:R.success)!==!1?"存客宝配置已保存":`保存失败: ${(R==null?void 0:R.error)||"未知错误"}`)}catch(R){ae.error(`保存失败: ${R instanceof Error?R.message:"网络错误"}`)}finally{g(!1)}}const J=(R,F)=>{T(re=>({...re,[R]:{...D[R],...F}}))},ee=async R=>{const F=I[R];if(F.method==="POST"&&!r.trim()&&!a.trim()){ae.error("请填写测试手机号");return}const re=[...I];re[R]={...F,status:"testing",message:void 0,responseTime:void 0},O(re);const z=performance.now();try{const ie=F.method==="GET"?await Le(F.endpoint):await yt(F.endpoint,P(R)),G=Math.round(performance.now()-z),$=(ie==null?void 0:ie.message)||"",V=(ie==null?void 0:ie.success)===!0||$.includes("已存在")||$.includes("已加入")||$.includes("已提交"),ce=[...I];ce[R]={...F,status:V?"success":"error",message:$||(V?"正常":"异常"),responseTime:G},O(ce),await L()}catch(ie){const G=Math.round(performance.now()-z),$=[...I];$[R]={...F,status:"error",message:ie instanceof Error?ie.message:"失败",responseTime:G},O($)}},Y=async()=>{if(!r.trim()&&!a.trim()){ae.error("请填写测试手机号");return}for(let R=0;Rs.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:R.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:F})}):R.map(re=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:re.userNickname||re.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:re.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:re.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:re.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:re.createdAt?new Date(re.createdAt).toLocaleString():"—"})]},re.id))})]})});return s.jsx(Me,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(Ae,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(Ls,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(te,{onClick:()=>L(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(te,{onClick:_,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([R,F])=>s.jsx("button",{type:"button",onClick:()=>n(R),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===R?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:F},R))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:N.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:gg.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&U(N,"暂无已提交线索"),e==="contact"&&U(k,"暂无有联系方式线索"),e==="config"&&s.jsx("div",{className:"space-y-4",children:gg.map(R=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white font-medium",children:R.label}),s.jsx(Ue,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:R.key})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].apiUrl,onChange:F=>J(R.key,{apiUrl:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].apiKey,onChange:F=>J(R.key,{apiKey:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].source,onChange:F=>J(R.key,{source:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].tags,onChange:F=>J(R.key,{tags:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].siteTags,onChange:F=>J(R.key,{siteTags:F.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(oe,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[R.key].notes,onChange:F=>J(R.key,{notes:F.target.value})})]})]})]},R.key))}),e==="test"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx(ho,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:R=>i(R.target.value)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:a,onChange:R=>o(R.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(te,{onClick:Y,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(aa,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:I.map((R,F)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[R.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),R.status==="testing"&&s.jsx(Je,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),R.status==="success"&&s.jsx(Ng,{className:"w-3 h-3 text-green-400 shrink-0"}),R.status==="error"&&s.jsx(UN,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:R.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[R.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[R.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>ee(F),disabled:R.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${R.endpoint}-${F}`))})]}),e==="doc"&&s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),s.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:[s.jsx(Ls,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||EN})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),s.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:R=>u(R.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const zV=[{id:"stats",label:"数据统计",icon:$T},{id:"partner",label:"找伙伴",icon:qn},{id:"resource",label:"资源对接",icon:wM},{id:"mentor",label:"导师预约",icon:yM},{id:"team",label:"团队招募",icon:Tg}];function $V(){const[t,e]=v.useState("stats"),[n,r]=v.useState(!1),[i,a]=v.useState("overview");return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(qn,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),s.jsxs(te,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[s.jsx(ys,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&s.jsx(_V,{initialTab:i}),s.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:zV.map(o=>{const c=t===o.id;return s.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:[s.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&s.jsx(DV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{a(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(MV,{}),t==="resource"&&s.jsx(AV,{}),t==="mentor"&&s.jsx(PV,{}),t==="team"&&s.jsx(OV,{})]})}function FV(){return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[s.jsx(ys,{className:"w-8 h-8 text-[#38bdac]"}),s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),s.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"1. 接口总览"})}),s.jsxs(Ae,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),s.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[s.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),s.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),s.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),s.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),s.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),s.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),s.jsx("li",{children:"/api/config — 配置系统"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),s.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),s.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"2. 书籍内容"})}),s.jsxs(Ae,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),s.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),s.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"3. 支付"})}),s.jsxs(Ae,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),s.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),s.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"4. 分销与用户"})}),s.jsxs(Ae,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),s.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),s.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"5. 管理后台"})}),s.jsxs(Ae,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),s.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),s.jsx("p",{children:"GET /api/admin/orders — 订单列表"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function BV(){const t=ja();return s.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.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:s.jsx(HN,{className:"w-10 h-10"})}),s.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),s.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),s.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),s.jsx(te,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(wg,{to:"/",children:[s.jsx(AM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function VV(){return s.jsxs(mT,{children:[s.jsx(Gt,{path:"/login",element:s.jsx(XI,{})}),s.jsxs(Gt,{path:"/",element:s.jsx(tI,{}),children:[s.jsx(Gt,{index:!0,element:s.jsx(wm,{to:"/dashboard",replace:!0})}),s.jsx(Gt,{path:"dashboard",element:s.jsx(lP,{})}),s.jsx(Gt,{path:"orders",element:s.jsx(cP,{})}),s.jsx(Gt,{path:"users",element:s.jsx(dP,{})}),s.jsx(Gt,{path:"distribution",element:s.jsx(RP,{})}),s.jsx(Gt,{path:"withdrawals",element:s.jsx(PP,{})}),s.jsx(Gt,{path:"content",element:s.jsx(aV,{})}),s.jsx(Gt,{path:"referral-settings",element:s.jsx(Rk,{})}),s.jsx(Gt,{path:"author-settings",element:s.jsx(wm,{to:"/settings?tab=author",replace:!0})}),s.jsx(Gt,{path:"vip-roles",element:s.jsx(kV,{})}),s.jsx(Gt,{path:"mentors",element:s.jsx(O4,{})}),s.jsx(Gt,{path:"mentor-consultations",element:s.jsx(SV,{})}),s.jsx(Gt,{path:"admin-users",element:s.jsx(wm,{to:"/settings?tab=admin",replace:!0})}),s.jsx(Gt,{path:"settings",element:s.jsx(pV,{})}),s.jsx(Gt,{path:"payment",element:s.jsx(mV,{})}),s.jsx(Gt,{path:"site",element:s.jsx(vV,{})}),s.jsx(Gt,{path:"qrcodes",element:s.jsx(bV,{})}),s.jsx(Gt,{path:"find-partner",element:s.jsx($V,{})}),s.jsx(Gt,{path:"match",element:s.jsx(NV,{})}),s.jsx(Gt,{path:"match-records",element:s.jsx(jV,{})}),s.jsx(Gt,{path:"api-doc",element:s.jsx(FV,{})})]}),s.jsx(Gt,{path:"*",element:s.jsx(BV,{})})]})}b3.createRoot(document.getElementById("root")).render(s.jsx(v.StrictMode,{children:s.jsx(jT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(VV,{})})})); diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 8b7dc5db..c8ca83d1 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,7 +4,7 @@ 管理后台 - Soul创业派对 - + diff --git a/soul-api/wechat/info.log b/soul-api/wechat/info.log index 8159e37d..cf5e6e43 100644 --- a/soul-api/wechat/info.log +++ b/soul-api/wechat/info.log @@ -37040,3 +37040,310 @@ {"level":"debug","timestamp":"2026-03-14T16:34:46+08:00","caller":"kernel/accessToken.go:383","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 174\r\nConnection: keep-alive\r\nContent-Type: application/json; encoding=utf-8\r\nDate: Sat, 14 Mar 2026 08:34:46 GMT\r\n\r\n{\"access_token\":\"102_WxUUlZfmIN7oR-liKLSivbLSkPRACcD_WtbH1H4MB337NnHl8Mj9zG1vEA_XkAwJlcsfip7NgDR6jpIX5R0oCYUV8k88FcXdlxuW9pBlJsVXzIB0v72xQ8g4678DNUaADAGQX\",\"expires_in\":7200}"} {"level":"debug","timestamp":"2026-03-14T16:34:46+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.weixin.qq.com/sns/jscode2session?access_token=102_WxUUlZfmIN7oR-liKLSivbLSkPRACcD_WtbH1H4MB337NnHl8Mj9zG1vEA_XkAwJlcsfip7NgDR6jpIX5R0oCYUV8k88FcXdlxuW9pBlJsVXzIB0v72xQ8g4678DNUaADAGQX&appid=wxb8bbb2b10dec74aa&grant_type=authorization_code&js_code=0c11a8Ga1BBMmL0brvHa1gvcSI11a8Gg&secret=3c1fb1f63e6e052222bbcead9d07fe0c request header: { Accept:*/*} "} {"level":"debug","timestamp":"2026-03-14T16:34:46+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 82\r\nConnection: keep-alive\r\nContent-Type: text/plain\r\nDate: Sat, 14 Mar 2026 08:34:47 GMT\r\n\r\n{\"session_key\":\"xG1Dw0KNNQejitT7CEM7Lw==\",\"openid\":\"ogpTW5a9exdEmEwqZsYywvgSpSQg\"}"} +{"level":"debug","timestamp":"2026-03-16T11:41:39+08:00","caller":"kernel/accessToken.go:381","content":"GET https://api.weixin.qq.com/cgi-bin/token?appid=wxb8bbb2b10dec74aa&grant_type=client_credential&neededText=&secret=3c1fb1f63e6e052222bbcead9d07fe0c request header: { Accept:*/*} "} +{"level":"debug","timestamp":"2026-03-16T11:41:39+08:00","caller":"kernel/accessToken.go:383","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 174\r\nConnection: keep-alive\r\nContent-Type: application/json; encoding=utf-8\r\nDate: Mon, 16 Mar 2026 03:41:39 GMT\r\n\r\n{\"access_token\":\"102_Fu1Cug1umbg740cnMlHuwZULnjqTrYhi2ar3o4K-9A7er7t7TvzUx-LC13g6O0C1ThadnEAU2vi9ciQsecqbacTh64pv55kE5lDynMhyxKAVreMbG1om2Hr2eecCCJhAIAUUB\",\"expires_in\":7200}"} +{"level":"debug","timestamp":"2026-03-16T11:41:39+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.weixin.qq.com/sns/jscode2session?access_token=102_Fu1Cug1umbg740cnMlHuwZULnjqTrYhi2ar3o4K-9A7er7t7TvzUx-LC13g6O0C1ThadnEAU2vi9ciQsecqbacTh64pv55kE5lDynMhyxKAVreMbG1om2Hr2eecCCJhAIAUUB&appid=wxb8bbb2b10dec74aa&grant_type=authorization_code&js_code=0a183l000OjE1W1bKR100ll1sy383l0W&secret=3c1fb1f63e6e052222bbcead9d07fe0c request header: { Accept:*/*} "} +{"level":"debug","timestamp":"2026-03-16T11:41:39+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 82\r\nConnection: keep-alive\r\nContent-Type: text/plain\r\nDate: Mon, 16 Mar 2026 03:41:39 GMT\r\n\r\n{\"session_key\":\"/nlYzlLNHqNUbmd41FLVEQ==\",\"openid\":\"ogpTW5a9exdEmEwqZsYywvgSpSQg\"}"} +{"level":"debug","timestamp":"2026-03-16T11:49:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114504200528?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"aES8EwTLDJ5xgQDB1v3jyDsnDArwQ7xP\",timestamp=\"1773632959\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"OKY2Ge9CpuvexWstGR0LWRPbJK1pgI2OyfS0y/x6Uuww2rSe78Z4QTLDhrNfe1ClRBVk5U/+pR3yy1NYVl8rGkbZOvlGetINeORpt597L2oZtVDKQkL00Y1VPVdeTW0nGeW+xXNR+3pJQ/3LpRME30+tnvRurXyVVO4Zii5Taq4hbZILYK6pAaecTpH8BK2dSDjkl7bv4VC4UPHE7skKdnLwpsT0umX8ciO8cTHHPegQwYNu+xmokW78/gllRublbOPooehhjaofA1qE4356KU/aZ7RR9CbVmOJ393nrCNn26D9D7eWjsHbQGFeLu/0D5QIEYLevo5vSgu42fTwaRg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:49:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:49:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BFFBDDCD0610BE0718D0D88C5820F8EE0A289DB702-0\r\nServer: nginx\r\nWechatpay-Nonce: a8c4793ba20de38ae7606b496eba1f4e\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: q634458M2o6cHdSF//hmN8uFukBpJXqpueHcWm/GPmYg0S0V9eK5iiwzCoyaE30oecLRQitfCykbB2qKgTQ6JJ3D7ItQ6SpWo7FtsHRSuJz9H+fd5IMF33bfdR2TcKBBtbi6uONlMc9WsT5KJhnPDuFmiP7BRzxcl9EZDNEuoyu0dxd6L8TT+/A0e5ZoNLyie09nyxQT+idURhlqQjqP5rAPp9iIlvj9u/QaXSjdsUnDfbrETT3zMuZIqo7ysyXYQEQDzVOI1c9/47VV9O3Z3xJCyc0ZRwe4DJFD4XitLiZxTu1fKmn2MJlBi18m0A9GiPsNt5K95yqrx2jzZJ2Dfw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773632960\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114504200528\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:49:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542117722?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"itMF3klzaGVPI28DgQpwXW9RF3fWfXpj\",timestamp=\"1773632960\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"vuJ/I/hWLp6NiTb+1yMMvU/3NG7cCX65AaT8SDuj7q1lnH91YaseQOvtwRI9foahSKNCrNKLT7/iJINx18M2rh+TXMEAJCH3Uq4Oduh/Dfh+R3QoxP5aQiqDlq/bOlV+EWOG8+WIPkklTLOaNhgLHhDdmhnvJCiebSCpIPjBLXllA4z1sWCMrqcuhv9Pz7amy8HmFJcYhikPZhH9vU1dW6nkaxznRxBBZfPvij/pujgwVxZaSMLFNtLzUb4t6IaJg+/fWPt/WfTpHqUdQJUTudUwITiQVOK2uDz5/TGVCFLINJkLa5G62H0mFMAaV/3HB68ZRfXkPnkUtRdXJZDz3Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:49:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:49:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C0FBDDCD0610D40118AAC6C0552088F22528E28303-0\r\nServer: nginx\r\nWechatpay-Nonce: 188b66f729fbeebec9f6ca7ffafbe060\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: guohSNBuOTwYzCENIqrW+jZF4LckPAhEITmbEqgDzIFiyEZdzWS1nF8aaR2g6SYzB7glok8YoUcUW8w+hLqFHHwoZjA/pUlOrCoYDIRJMCbQaSOCXuyel7Sw6YSPpavh0lDp6kwF+uYrljIchStem3QL5N9Mk5D4WGg9hvLxkRkKBEp4Us/+qL5LKsLhLfuajmnMVh3vL7p9TSS2nSg0Pd2NHsEgegJkVUpoauGR+dwUw7R6jcXEIGusVtH3Z3RseHHyOoLpBtHgjqGy+xmh++kKi4Di+Cf3bcWXtKXo1KmenaLZAZhPlCBW398hLbLicdBiENJKNNb8dYfFgs6YMw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773632960\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542117722\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:49:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542217834?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ljOuAlX3GQVjngvt2ykRzMXi0hsMg77Q\",timestamp=\"1773632960\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"DyryEpJ+48Ny3DQcNxRbhZcBgs0zzVHvTxPDFJ2765N08SLEUtxSipbVouJ39pmZGE++9JDTCI81rho/mhFZ97nLcTSnnvbo1+Na/NwgBY4Wy6dRit8TirC4VLus1Xjv570gHdeD5y/W7zCxgNaW12HVGHbZCQ82+Zqqt4a6YdPtkJfsrdkd6BIHZ9CVGaZ0SWW8b5Ui/EPMUzrEDPrWfXuNwbSxmbHb0RPGKYGo4r7lZjwOHl+sWPPED1p/ILkAD+fm3gk6fhmhhz5xTV7G7jZqdLJzLajmRL5wBmRCuiMjo1DBaFHdh1/aRHXuFEIGzwtH3wqOVumbf+6zcj6lbQ==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:49:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:49:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C0FBDDCD0610CA0318B1B1F8AF0120CEC422288CFB04-0\r\nServer: nginx\r\nWechatpay-Nonce: 13eec3b7db028503d685785f5374d016\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: gn21NYJrrxz8ZBbavJhp1QORUO8y5vf/aD8ycpQ48IQQhJvrHSUrvtsn3pmv2d1aqfJkAGYA00ARlX6Szk7U6fXnut4h4eyvd4TLA4lpoReM8uOYwhKsInhNtwrQA+Ze8MDrkEGIFsb775e9uWQemi2gANBRymMQy9WBj8CLg3f9YQMyqPiMOSv0BxGB1e/7MVzqrJmUXXj5vMOusUwfs4I3EEgBhiTqS22aOlNtMcNc+kNlSnuQNaYhSD9oywbNcb7mZX48e44yqYLO+NbRdVXvK/nf+vsr5uksxxH/bv16y1QNgIXKOuKz//VFyrESw9bJrVzDLGH5xuXLRT8vRA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773632960\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542217834\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:49:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114752369404?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"AfyhaiKa5xC4JuMfGHrs84yAFInMIant\",timestamp=\"1773632960\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"GC4Z88jIkasRPRhUTwQDOLd064FU+TAzZdAqnDpGtpMVEHnQCTzgsO8Htbh4yC0RphIIOUq2qttUe7GSbwB0toBki/1SyVE049M2pZDkaelW0h67irDYR+nTWZOkSKy0zPaWyfAfTEKi+IUICe/Zft4AlRj4ukYPVXpdmcqvppQP/tT0GuVh32ed2hRGHzVPM8xR1UoBDdOlReBnWjVaa/Db78Rj8DnnQlNqgoXWluEOcmLE4wrCqmqscOOze3bYlZD1gnLOBgCD4mT7wDZzK0r3KVOmWgUdcJAaayMz5I2U9mp7asqNAtubABHV+V8Wsqt/s2xh4t9T1fFfpc03ow==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:49:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:49:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C0FBDDCD06109D0518B0C0C05520F0F126288106-0\r\nServer: nginx\r\nWechatpay-Nonce: 756d0f135ca9525ee23b9b5538d81295\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: IsYiUHzwCLAMg/xl9MhFDvzREpE9vzzsFa5sevnP4FqSUi33au2OJN0GhrLIpvoOqdrhWjUTUrWd0KL0J2J98nHF1fCfdWMVwvwEbfWxm6ZSCeCaP4MaBJzXuq3TNADbAbjr5NYovR0sJ96RNNgH7riC4ZuGfUUoDJcU0Lcsh7fKus5jSx4JRgMr2b6Fl10YMWmP1QPPQRPLnelW5c/shhNHeHZrdhQctV/QpdaBLfj7+QPqpa97Bvmvk3g/Qf1+8L53vsA0KfFLZeRTCjOavcsTUA9+Cbhe5AIUSKeTfaUG4NtSzCc0RTTDkIx0ixzir4cdFc4zEsGiA8ku612iTA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773632960\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114752369404\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:54:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114504200528?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"v0mRqXMh8eZLWr3A92lKBXv1vJgRr57L\",timestamp=\"1773633259\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"MyJZRvNO9oxrADZmKUdxRdJNxmtH0jH2jXZpLx7RyOaznN2xNMIJ+yNdmWrp12fAmuLdRKDCG94ou3QDCA/Fpd/X/poNPWIChR5Q+gSSoxl8Fdxho007aAGxmLtb/umC1U4UK2/z8eL3RJbZ/X0wNHo+wpj12jtew+7+M2M7rUUoOt8a7QDrWiGc0SCwu7X3vClMS4VHqUicoN13XzahJ0jUYBbmFFo28vBtVWmFKxGfGgKDd4N8cNabrh12jbIsPz5m8/m1NhREtyJm477OShMJPfht51CIelMdKBn3H2+vzhrpZjpSlS283A/pfcJgOHrLqoqrplmFkJunMh9sLA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:54:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:54:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08EBFDDDCD0610E70618E0B1F8AF0120FACD0828DBCC04-0\r\nServer: nginx\r\nWechatpay-Nonce: f1f0dc04e7fc3fc116e94450d162dbc4\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: g3IOBiTm0DUNrDpAqUDzvnjlbRS+zSbbXhNbE+y98+44cPfYM9T9jkBWl8kiQJOyYjZydpbc3GX4gUrn8KXXTyJZJPLvZX/usTtZV/9zlL01U2j8hFEa/4i2uaTr0fWMrLctelVsyIMKlsDT2JNZQbxVnm3l0yyGRH0oGx2kz7JHE7T9qzeuJp8zadXGCWSiWg05t/wOTbfOtr3bjzM8kCYANYUXOuslMFagBKp6jckTygc2OO4HfjVtxwYHziTBYeXpHxobVQwAIpqAqKXbwZC2EqN9s/6XFddV5iPsXmzsPZyMbVMpGK6rR7ur6nKZlhrzzaj0nh3pipAu3HGCsg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633259\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114504200528\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:54:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542117722?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"XQ9bK3QHSgrBOf9zZ7xIsD1bzmgnoDqs\",timestamp=\"1773633260\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"wtDJgkeZoUchpfsOQiDLy1Gm0MVbNCt+S0c9tiw+Pc/hn1PLmw+ZTdfTXokO9aSQqU16Ks9DHLtlxYvXZ4MV2B8rvU/dh9JvOIkHgg6qAsvfaTqsbPu37wA9hnM300wcquD7Nijq7X1+3mrHF/F7f8Hlo88GJty0GYI3/ijj6busNk5D9Xllnrn9Rmqw+Vo9mLqKpyRAxYqxuujNn6J5Ijtp5qLOFY1aYl6w3FAuvPkOcenugh83r8BrS0VPl6HtW0skNLoG3KCv+Tly4VTe69aw+EkhshceZl5s8EDiS4H3oMy4vmCE75kyzGsasbQ/33PEr5B+dEUGrPgDRudDCw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:54:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:54:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08ECFDDDCD06106218A699F5AF0120BEF81A28DC8603-0\r\nServer: nginx\r\nWechatpay-Nonce: d3fef1c0d40c7434638b9c7fa933bb3f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: m/ghtwXITag7QLcy1/4lXysrZMBFIgw6AWm/HZaHRrQb5kvIID6pApWT9SakHRiYDH9D1N4VlboYmkMu5+/LtR4U1Mm/TzaQoPM3JTNwPq45DLGniBnoSodobRqoGZU9//cRX7Fp8oXcXM8DHypXBj77E47PZ96pfrmS/oruAjGRfQCWXO2QI1OC1o0wBXiA7TxAg0GmsoiOVyBkxzmKbDdeXuPiPrWAk58fZZgGCopOMCCznSrY4RmXv9pA+h6z86Hp5eb+9SW6eiLwpV2jJYz8RsQm8elZd0Elr67QSYCdId0oDNv86OF4uNdauIdTmFSHf+yepbOluGBTh9Loew==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633260\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542117722\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:54:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542217834?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"K1B12dRNjs5cpKimjw8L5VjyPg9wYmTZ\",timestamp=\"1773633260\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"B4IWMwkWP03S9/Y8RB7Cwems07eUwnrpYPA99dO9hgmEgn0h+R9J6ckZN1f+q7PSVAU7hTjECSCXQDc7tD3cV43MuX//dsZi/SPhkHfn16Y2aljeJtBFgx+u30cd5j1aGOoOul0AHCn0vTP4qITVvKcoKC9L+QQxbXzm33k/Ab0pZTu54WcbwdlF6036zHjlT5PZVarshmosdw0KDwNRE93t7XbIVZAE0APMuUUbkY3Xq7nWlIxWtPUU4BvLeJIEcGKxOskNqdjbw2cUZ9u7saZTv5thw/lYTEn9IRosHYv3dQU2GnjFXQg1mCyTkyvDkZE/ZRM9KvXYzVkML/YuuQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:54:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:54:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08ECFDDDCD0610D90218F68584A90120FACD3128CB9B02-0\r\nServer: nginx\r\nWechatpay-Nonce: 25a11dd821a5e1a6e334b9638c6e0fc7\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Uc648c+FWsEVq/jV3S3RNaAd2FZLnTq6ylidXm6uoR+icslMF+Fndp5xjVU5mzWCKLAEtFAUFQeQ/T29/As75MbjJWVtkxSyXxXVkJ0HSorfGPY6Uqe8uVDffyjIERgtqmtbxv1vE9C5GW64IoOvfMf8nneY6/AUcW44PzfloQaoBHgHA9k2kmUiU3fdMGsKi8vr47QfzB5Qt9jPr0Il0swCSWxCKv5iyNE3DDZsds/ujUCDotOzElhr7Pz0hU4aJ2AVR8rUqOqAgWQhdcTk704z2sTZHne5nrTW34xemim9ozwOgXqjwpzsnvYYEUzvXPIB4wPqD83WipuFmWcOkg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633260\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542217834\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:54:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114752369404?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Tg5Wk2NLVm0i4BESxcVzcYDehaY48O0F\",timestamp=\"1773633260\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"qtSAPY7Wj2o+wE8H3r4QdBbEo6qliirofEvXuccs1fGapXaDu7rv1VnYrycxcocs1ZIoYn4WhiuSXiEfyd3BnS/UlJJTPZvkEg3DogJ84G29c2+46+4mz5CpF0Wb3i09mMbeE9N04+D3+bIEPMfIuYcZUwUxpS5NuuRxGvHP98MpjovOFCEgZbgak6KMc41HJ3cPXIx4u1J8MayANeoofIZcM25ISXJnmC/9tglIL+3LXzWk2WvfBG1pippvS8bfmvHMC0h/IcElySnaIA05MVFYzaRaovRSQNlcyTndQYjgTmETopZ6KDk+K0WVLz1fhQgr8MAVDO19FiGmqjW7bQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:54:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:54:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08ECFDDDCD0610B30418C3B3F8AF0120FEB8192897BA04-0\r\nServer: nginx\r\nWechatpay-Nonce: 88d2b63c5c9a8d7f2bda07ec636a69f0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: zXuZpP5xhC0mhf1stPdaPhxcwMixwZCvvrlkahzaTgbuGnVgSNatoAY7WADjL/IDA3GnlTXK2BD6zt0Lmpy5HMvOP5vYVl3JIkststxzrkD+dKqSd64yn4u4I0jfOvSoHJH4Iiq7RpXVYsESrVpVWcYM2sXF5CSxfX0wd8NaCgNKKnlzbCUEE2NhdVtNiOF++nnNkwdD478BNMTvaB/RUgHFA8aDCd+CTQEfQTanEdWYNn5Zv22JAjMsg5hWKB96BxmIIquwnLhdX4zKOvLDyS0huv26dgrxfuwLP9cywyXMFGNMzXUGtr8YCG2tHypYatDRwJB5VCBeuk3LVM8xhw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633260\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114752369404\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:59:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114504200528?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"R68ljMHbCXhweLlYS4mCP6kUk7AxfgoX\",timestamp=\"1773633559\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"eawJ2dQ2MeiId7c2yIb9wrkNqIzqNL9Zk+pGCDbBeKLExEcCRbsRIQtPIxQMDsJXNMnhiJrzALULrlG+06+VSTjzrzXzOr9dOUXDnKhsnLWXOLgZgm2STfFE4q7BUPYVlIMdYsg9tAvB7WSpMywYG61Kshn8pFWEVSJeHRANtDouuHAMjnsl6joJ5O0L5m0yEcCpTahGHbmwouRCv7QE5apG+X0pGvK+vFU2FDUK2eJPBdTxhFpFFLfpWzerYTOOZ4h/cz+Jh71PRu7XMqg28RIQWBNzmsR3joI3yBtMPa17gToOORoJQyw+pOGIYXQztyJ9FPj60PcnfV1eUfRPBg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:59:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:59:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089780DECD06109A0718C4A9C05520C2CA0D28A78F03-0\r\nServer: nginx\r\nWechatpay-Nonce: bf9ad14b5bed2130448378f5438fcf17\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: dxaJEQ77o9tqtK2Kaxzi9a5hzSb4x+cehzE/RbU89dTbMMCTlUGblfoikLeePcOIHRrIykFP7n4S67Usyj45fjjap4+sQNRN5X5gUxZ5YPw4tJxqIktg4MqVtw8RYqPMR19HKgprHSnRF2kghpYlzOMIJPGatLC7qXfsH68QI9frQbjB88n1ZXIl98tPH7+Q9AZ56x/Wf1qJambpTHHGgXr/kmXDeEkHsb91oRzx+pMKRgaFrFuaAK5MKVa68QkDcAAYkhhWpeiTWVuEDQH9yImuaD3ZPDXxJOfVvKnDvH0PyKscPzAJIJRbFpOOL0i8NnEXO3c1n3yaiXeLaHAffw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633559\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114504200528\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:59:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542117722?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"P6RLJaqvr4nBBakNLoWs1DoAiUFtK9c4\",timestamp=\"1773633560\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"w8KlziWaz+MNzV6/hGMOWwb++vByIeHg26AppZmANixIF/02En6iKIu8LAxn3ftlsqpmXNtumSqOCfrL47QRu2lyHxKKBa+9TIOwBKHGMbF2mCPgmTbVo9h9BcwHgXR3eptlxBQpCLlg8hn17Fli1RoW3tFJrwmIRdePbo4i/aCPn6VdkPkIvE/uCZjZ87YEEDnSwezJUbPDPXns8Jca8D5+5wYbeSN/L2j9hhjUOFVwZfusIY6B3TBEt64/cZI6c8MtVKusiwpVU5/PMfH28HrpboqbHmSKYJwb+XsWPfJojiJ8ttF9KbkFRzr/qza/5Pxm8gTxmAn/EaBiaq3RwA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:59:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:59:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089880DECD0610890118B2ADC055208A9B2C28B19903-0\r\nServer: nginx\r\nWechatpay-Nonce: 3bd15cd541431813faaa92b9e883ed9b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: KPhdFqr+HaymJ02niXxkKzsaeec+Xq35K3oNb2Sjuj8Nb37oxlUKT7IotI3DeS1p30fGunWLgGEolVK8cg6/fUP8tKuaShvm6IlPNBF/mpuhQecYJsM+KLFX6eTshlRvid8I7qVMCugVSfVkufdPhbAzBl9CzE8pZz6kXTlj3ypLnR9ZDJLCWb9eirmfMBf5U+BzVF9LcQAgRnQC65IqQVmj01rDpCzQjDkMhJNjoA58rdLpuB4UjO1lCriZkkp2CqxxYATBE64DmF6/LpolEsOZqyAAe5V9mDIXyCFi2pAxnrRInlvDfxZvgtzeRLsVvFsvc5GrBzHXFEsydnamLA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633560\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542117722\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:59:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542217834?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"1hZEnqGdZZRdzMfEjoVe9MKROs9MHQBY\",timestamp=\"1773633560\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"diq9mpnnbiuC+8TNGgMJMjO7AFkL0nNwOlztWV1OWcPMKYZdUcgNJASJXpBh4BccvJvmcc9nzCpbmafM4GBonnERc1UiBAUIskVdESUvqGrXj6guYfB5RfFwkHLLuYMAoiLKumVwcF6f8wXjmeykKEpFBFzP1vxKgTvu2AaFzotg3DqIr6MvfJA1kxcUs7bRBmrjgPsTxj2F1weVVPn9fQgYX2o5GECqfcAbZAYQs/ncixKbNgNRDsq3QsIBsBzgXNWPhAdIKX2WDPPLto1td6NECpMQesoZ3f6XymaVgWvfExmSSudhEBNNas7dJYN8tPTbK8L7yRmYYS3KtjzQ0g==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:59:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:59:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089880DECD0610CF0218A0E7F8AF01209EF32528CD9605-0\r\nServer: nginx\r\nWechatpay-Nonce: 2a245694eca7407b1f9bf62b3885171d\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: lL5Ata7cZBujrW9MitufLyHFKU/kp/qa2LRaPckL0NBegbwko4hs551Uvt0Cj7rThlcnEzu6KSpiU+o8eO06STRVtItyTS0v3xt10PBjCvzjV3s+S/QHgUzw77U6Lh5YC/W00OftQcVIaneR4PDzpXNXjyB9vVtT12ty51iWcyFE0lnG9FDrahlpI+MpbC50v+8pcfW712YM0wmsXVq94DSrVXrdg2rLvEW4aov3/ftvCNZhv0E4Ub/g2ursTlyCbQRjCcmCR1epJX4EHPryQPtN8+L+rM6azi8/NHV1+xWV88qB4UWMTa2OkHD7OLRF1vVI9+mQawTgnwUN37iWXw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633560\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542217834\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T11:59:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114752369404?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ggAlvEzbMpEXeCEfQvswyFMY8eZF88UU\",timestamp=\"1773633560\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"wNyWvOIhO2C3w9ArRERPIdUzcp40DeYQIpSE52zwbU9wl8Kq4P9jjS0Uore1MtnONMwvssg9O79NKFl1NwB+J1TXeTqb+cmaDVXFPgXjO5fqY2hMecv/CuHcLniMXuOiG6qELw2DOUccZzdyWUGmRyM83D0GUam8mDsQdBIVK19HDwgvChOEw4wT9QBtP7TNEWxTZstYBnMm1GtiRwdLdn0K2EZBM+VX7Jfo8fQvQru+wgXHEOMywTPoiPmIi9xFQIU6ZGouo/uxsvC7BBZ1tuXzkN7sf7BxrNg9gZPNO4VfTLbBVlIkYUnSps62ekTRwkptXqjXlr7Wo1rglkZZpQ==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T11:59:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 03:59:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089880DECD0610B50418ADABF8AF0120C4FC0128CCA403-0\r\nServer: nginx\r\nWechatpay-Nonce: 1947f3941dc8e880106ebffb2f0efe62\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: i3UAW1L3eFb7Raby52j2o0NhfRgiK4U+PzVeuinmPYJB3bp24xU8je7XnseDBJHbwhmmEl0M3LnUAxF+Ni32Vv6k/t4x2Dgp+RTxkZoLohX1HYlcTt0qgMLb1ITWr+i56MiZttO8levC4LetBFsfuF/ZeQ0Rn+BPvf72ojZRU1xWmSe2ic7SxmF/pPZweArE6e6jbZGiZRjRBbq6oARCO9ty1dm4Cfs5Vqb98+kWYVEG7UnWoY3AddcqbZUk8jR7XoaES8nMlRZHI52JjfnxehUkGdHebqXsfWJaw3w2ctpjErICmbTQR+nMixShoLEZ5EtqWnxeDTCsqeY2FOnpbQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633560\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114752369404\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114504200528?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"CfsH2sxRwFipj8MPtJPvM9tgmhgmo9qc\",timestamp=\"1773633859\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"nBxlPNi4k59k5AlsSQ6o1f8KJzGYZ/L+SXSpVyoY03ITAuLi2M+hahqoIFbyRB//djklLTxnBhGCPd5sqzmAO3AvvM+65QAZxxpwvPx60NpM4AOxLPNGqPDKfazgJTp7mxtgE2vQYKM5arp0iLRgOPfrNdqAlLzIJZteQEmy0iLL30vqOxcDSPpRP9TL+HiLaTUBRZ9jyk/V4i5CeUVHf2vwwsgxZ+wO7/ICRi+Qpep95BZM0pbHQCYbftXV+K/lXS1U5SAhGV+F9TMmiGo+yA7cbgRp3BRGI06NXTWo8EtEqG9uhu/coVxK8Nz29VIczcj6MBsaifHRb48Pis50/g==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C482DECD061007189F8DA85C2096A22428B5BC02-0\r\nServer: nginx\r\nWechatpay-Nonce: 121ae5873e0b5bd4265edfb55eeaed1d\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: LU/7ctL7XwQJPE7ODabjrOAmG7hYmX0I1kbElRczMmaeWJMN3stb0bMcpArT5wZ1pMwd4eyOSQjjmixT03Ltnon+IWYXz5XpoSWcb8KAS/pfb1v/JpJJOgPOFucCwCl7Dfp8TUsgvEdHCslOugT0KJB2QjeI5yyAglyYseiJHM1odDdcwzs4Krd2p+e2atYOZiesounD6HmHB9j07ngu0RWHrO9YZZgd7bBZ86oekb9CjQtcUjWb8QlVLAHD7tzlhZIC8jTxAa1Muna2CsUaRfezH6mhE9o//jUh+nUbcJjK9YqGuvx/jyXMZkSrLXzj0jZHXkv4ccaS7Y7SqmFLZw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633860\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114504200528\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542117722?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"SkJxOixPlSwqVDyHvYOKmCTfnf1VesiW\",timestamp=\"1773633860\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"QhOckoqqLSI2nkadg9tWNOfJax+4OROEfkym+Kx5+tGsW3Xs8/eZUhmyOY6vkeXQ3gpZrmaqiSDzJAOzObqz632ZMVtFAtzwAsBAjCU0Jhu1urPErX0g5M8zrWCxnVrZCIRdi/jBJOvY0DetfckJC4jCmlc15hDrnYm9j0wiBDpKwy9pkHuS59cyJ3ZyyB6/btNkJVtVOV5AgkZqRobQSJGSYjDZa0ieSTtjON1FccLJzQwJYLqQMoKYPjDR0XqF7BJnGOnhg5pd3EgXQnnr0mZIjk4UvfhQD1YSm/ZNu280JvRnjrvfowDTvOb23VY77pTSmfx0vpbkqqnvmMnRBA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C482DECD0610C50118E6B2F8AF0120D0BC0A28C09206-0\r\nServer: nginx\r\nWechatpay-Nonce: 37aa145a76225959cee06930b0f2c7a5\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: WT0YXvUkmStA9ocQt4z2oxVCDV+Rkb8Jn8kmdfVf1bYC30rzpBwgL2q/bhAs7dKdZ0YFwYBs6Td7jncL1QflGfq3pKNhQ8NNJR01LW69V7t75OEOpVtXimkYd8RbwTZ/or7msGw1MFkTUSLWul6j+2ysOShxQ5QknE5nSf5lWPCCsOrSkdf04uIYksg7FMALV0CieX34F3/qKwoTsXHyJkuOSzzGV0eRDL9mHg0hXymhWkbR57z5QN9znuqMnolugi+qRszAIzxI0QXRBKzxgqi8ii7wYK/9lr4UAgdODGLXQJNVs2ESvnP1H1+JzGYmawyhZcKJBnyxTqgbYwipdQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633860\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542117722\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542217834?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"tUUFGMTgP0WNH2wSVJ6iv7fLNHcQzqLH\",timestamp=\"1773633860\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"dinrFVFAxbGV1MuIZtcCACu0zQAAdO7kn8smcYcMiJzgArk2URcsag0PYgm/nn3JcKqOSEOaJtGmfhqq+Pwx00ZSu3zbesu1PxKXfAJVbfbUsCc73Yt38Fp2iS0hGaGevo2tyPwHOaYkMoZc0MlZBuW4AnGPOvdfblZAUDWj4slqUb5v/IXLchKzcUM3PJZK/CA/gVQLS3521iaosE1z1W0WWc+bhD3LMz7tjiN1b9k4LF17h7tXl59h0b/sYM0KpsRNgrzMyreruwc00QVz361UyQ9oZ/+Ct+VoiNeBgBfvVTyf6CHlTKXGhidLMuXnwbqHATX6moIk4ZkptRUaYg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C482DECD0610870318DFCCC05520BA843128AE9503-0\r\nServer: nginx\r\nWechatpay-Nonce: 1faa1a5d5bff72954f1da063bc7dcd6a\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: vLwPh6G94Wrj0Hfqn784zJQycyGixnsZCDWECZh7jU6hXLb7dSu8gXrajjASWFMCPtPkMCd3oIbxdk6kWIBiM470aJ6zPT+rfjC/qQ0K9Bt4VF+LZC364JAjbGXCOn346YnG5QzTUK6xBHbAsuqJY3yukQybCXtBLoAjQEMOVSaeMTLSJt6EyIt28lJ2qhM9TFvWf1uG3ux/sVyD6PvcNYFEtJMUwXCcHnfQ8qLSiB0QGgWDXtjKIBqyBHy3kGpzWKeX9dgwQ8bCDO5loV/YVIda2TU2E8vF0aBVU2jyQDaC1gLaEsDGyWm04W8kwXXIAOiBIWENioSflb9HT+J0wQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633860\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542217834\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114752369404?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Vyd2DuJQThc41XuWI8cB0xsjmkbicF7C\",timestamp=\"1773633860\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"W481acZjV1H7z4/Qqd0ga29AM6mZV+Bm5wkjQZDpBJoRn5v5BchfOw4nC2rkaT7e34AwfR8x58FZIz3RTf56Jbuu965+wiBeugo2dZOMEjUzZg6VNkrXyRpsGfzCyBB919FzvyXOLpsNI33pmxg2dY9JRuhrQ3QiQilNs8sv7NkvO3BHOWB94Nu3SoWqRmHc7UxXSwDqfMzKtT6Osd/aC5HnAiOR3pzd1Uljhova1PiFiSx5zE95Dvy36QTRHIKAUCwcHgvC/0AXfhIr4fO4fW0wjZUX+RzyinY8NSYyfzXtZJoO/oZrNwSgV5/KZ771nEc/0mZTfhwtAv5kpa5G9A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C482DECD0610B30418C697F5AF0120AED02B28C98203-0\r\nServer: nginx\r\nWechatpay-Nonce: 2a4db93a54fc9dc60949f7e478b2ba62\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: BFebKgts5LQ/66B0n2qYfPnhOagfJIMDboBK0Rmi62z/f1w0SnNJQEFJBXrkF2ZAV3HDMmZH+6j4nYq77bx34BHly/KMauG3YW4npOzMmUtyqvAuQQOQliF6CbcKrvj8zUI/zEBcCLuD9gYNQrjMBV5ITrylo1kE8ZaIyxadYnD8dSYRdtq0wBN7KBSkhANMRzWY2TW6BM7nUISGhWW69I12Ue0n6+HCIXt3B8jdNkVaBMWmR8h/PQHIOsM+h1uU/qEmvz/oMyEn8ss83gpKww4LuYenwDvDxPggPxv59TXUFBBfQH0BlDSe8So4qb0NNuSpon5Dhrl90hZoLoDXhw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633860\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114752369404\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115923493856?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"TZly5fsksjz3MtMRuehiDSksEhw6Fb2n\",timestamp=\"1773633860\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"DKtObMcG4SWVpHOpyXD7HZZKVZI/fvByXeFA5/U5FyDZQF/Oic2ORtnQaQzk9wF9IotsAjM7cVAX1EPXeKRiFqPDrreaBEnz4P3Z12U4dRhEnNSdIPWoqjblHIqWc0ssUCzJGJGetxpLQ9pKxqjAvpLEJBAdWFi/1dY355BQfLyBw5RxL6yJG6P+mlxKtRUUcwhtc6yBfuyfI099UWe6QiA9v1+/2t/4KLUAdSoEjK2iQpNB8yNLHQB2wdseEwYWiRhPqXjHsCJQDzlQ41b7z4E43o2sVb8J95HebPd8Npc1TpG4wJk5MF2J5db2h8H5/J0Pb0YM/fysO3mPSIF4jA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C482DECD0610D7051890C5C05520EECF2928A1A101-0\r\nServer: nginx\r\nWechatpay-Nonce: c1af10c2ed8891ed97d7d365887e8109\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: c5WqE1DFcPaCUfdeBbqo1Bvyk8lxJWSdVo6pqDA0BBmCwtq0C1wkzu50SRbgTzpVitXJXgQID14krvlVbdypnK7ER/hfVr8Ns1XmXo2gkrs35fRyyuuehC2eYe05l8F0nlS3CEk5rE/cPHNDeq62u6k69Y0UQ8u/n6iYmfAPuHdfs/ZOKtUDmnPpKPKEHpSs4aAmJQpV9TszFKLsMnmpjDwVWshGnX5oqkLASLXhXf0DpOqPt5rmJFx/NCLJDzCLFRa3ktyO1psNshl/CN/tjd42l9n0gLpLCtHauY5m8DBZDEG4XW6yDgb1SAN2X0T8FRfcChKygUMaQTsBmAzIzw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633860\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115923493856\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115924572115?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ePwykqfOri7J4BXYrJR9rXUKbh4r1Bp6\",timestamp=\"1773633860\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"GhyM+GmSt9Ugn6JnjFwH83fwD8UWCvB+c/wNZ5X8cWq6qTUrxtvlHWYSsk0Fd6eX+pP19Orq8HQipY2PjRR8IO6ljvIZ0yPs9ev0fiB4/ebgVueRvC8RQEOZL104ZqImD3VrGvttJ9tfOamExz/9ohfX3yjQGc7Uz8yETaLTS8Pa72dC6N2TE3pd5X3OHDFR3Nim1OkKjCFzPsC3EUniKGkPbqvHRzgL47enEsI452N8Iu9/gFTgsUBFgDB1w/iYTF2dn4mfCxGmoXx1vONPn/YDr1L7iHp2A02+48yl+t/XGYDsqKRIphaosIyPwOTdnKdwjd0rTfGPE3AzVo/qSw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C482DECD06108A0718F68584A90120E6CD062894C703-0\r\nServer: nginx\r\nWechatpay-Nonce: 7db18e9af64b2a8c7b068c86c704dcce\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Dm6Q2EFa0or5t3S53GHX3GE0Fli/Uv4MwIeQlKzT1q0OPaA2aa7Iqk6mYoV2j+68pZqbhCVqgW2ZZl6xc7V4OzScOOggckxX+V0P+iMqc3oYm3IONh24u6Mf6ZJqFQAoRffsNoq1rd7G20UhmtrVGYHjxsqk+uqw7FEinG8eGRZH/5YWBwaO5P7u/eCouxlnQiBsdKG/jVtVFPNpp91A+Rf+F3wFjkOl92DLtQ6aQMu0Zf5dR4H+YztowV1qSuT6P9ctFWOhuw41CQzpQwYuUtlC78KX155euwevR+p8HG5PH10gSRLvcGPI3kG42Z/v7Nb7u6yYX21hGcp0TvNtMw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633860\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115924572115\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115926060396?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"gV0xxGBSyrkOGWMdCfSnJ1n7sLtZAy1V\",timestamp=\"1773633860\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"PvwR+yYkV3o9S5KmCKI99RyCHEVIZwXCBVzrt8HjlhZHtKONCMdFFJY0rUwfXkJTolT4dISNMMprePwps9WQTM7ey91fOVGitntgEvhDKuh5vzlJAGxszdMkURVNZfQSm4m4vZIIct0cXUbS/RDuL9e2UGeGPXNHmSafdCrgiqzthRyo2nKPLrLZxXBdzZ0S+O6FNV6DLq3Ol78eSZ6DPXjt2zl/xVLXNaWXq5TglxFuyOVDRNnFxXgK8JbZfg9Yr76fbvJXU0htJ5+W6/US7Pi8sO2OL7/e5r+zzCPORpz+WKO8OZ34CSUzRquYN2AhPq2HnIaQVg52PVOSTlKWAA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C582DECD06106A18A7CCC05520B2C50628E7E501-0\r\nServer: nginx\r\nWechatpay-Nonce: 121bff0b308f7114c7d32a44b241723f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: HOQtayeuvIWpu9UnPHg1HFSxaD0UkErvq5a/60qQdcoUYf0Jx8rXFBOl2mc2DSAUEB1EY0HkE8loxfKi+sfttP/NHE2oWDyiKM7+vBRuCxsT6NuKDxviTwZvC0mr2oewZ75+EZ1wH/OYRASbOZAGzhUyOgKrYhZUZrnWjlAzgbp2eJP829YfVI9Em+a7duUmsqg4f3MJFdUmb5wR8HRIZEny9yc7MYz+WfcaKx7FpU0lDgHB5d+ji9JuJASQz6U50iazFR/jhaf4wVqSNNH0ROyD9l1MksGiMV7F5J0d4A/U7PNNs6xg0ICZvR+BSgvNeVveZ/kdctilytACoImjlg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633861\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115926060396\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115928025998?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"gytFY0FjAFhfb3vU8uTCwU6zvuBfMylV\",timestamp=\"1773633861\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"3C1LXGXj2EUGWDO7f08tSbmYdlrFbapgEhQuww/icA+zU6y3wquPZK2r/RmZetJYY96DA5r+K51oMbOWB0s48Qub8MaEuD+IWeuvR/aaYpn1BzaWs2XLrDFWGimD2lyB1p9A3TfiG6Xf77zrrZefPn1eHogrGr+Vw8HZ04R2hGnvwhZ5gVdeE/fKt6NYW4IUgvTvkyBlHmYxL3k/BxXqM54/w4GrjTZtTDIgqGuSC3icUPBME1iFiOd1E1yMkc9qG5wzneD964w2MJfsgDwxQ7rN4bsbturdUFxk7MrwE7oC80EsjPRllcbrGfOuKFF38ZYdtwvdWjIAlqHVPNQqew==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C582DECD0610890218E3FDCBF50120D2DA2728DBF305-0\r\nServer: nginx\r\nWechatpay-Nonce: 15c87aefc136fb24ce3a46aedfa3a78f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: vQg/2NXmuOfeRLWL28HbP0x/Y7iDzrKBJcuspWZypPpSK9eWe2Odvc+LmfXAIkQIu2jdEB0YF7gGrCSe0JAv4mdkK/Ql5Or7dw1PPovW/ZgdgD2IQ4wEgAoKOv6kZBP81rvd/k55m+b2C9scRIgDsgSmUFJT0+WGHJ/5NEmeLS2NGL7jjfWhufID1CmepN+7plFhJbhIx+Kz4/UQtsO0TNBnrbyS9dow6ruQFvufJqEu6zkdlBXMuGI0inIHPCtT6sKe4sX0I+JQeej1oX/SzSiFuaSuWzhdfzf5Z9EgwNLnIVfOIwvGNocblrpn+Nut6CqxNaXSVIPbJSIjc8ffWg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633861\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115928025998\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115929440151?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"WuKSpfD8ZkV4vHjYObmBlYkUV7zowBch\",timestamp=\"1773633861\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"i10fLR5XuUcAZRZ+7z2uhNuKe56fB2UYt0Jhy7JUprfTpQg54Kp27j4g0VdqTChb/WVeIKcIPg+AumbKVAc9CEM/NhYQS7Ajacyq9eGsuSvsUlayCJbnBj4OmAlpXr3BKVpeTDhPiesWiSbTqLaxZw4YLnqb9UXnjVWMuIiQ3bmWMqbmRS+mM0Ifr5/w29jRk/KJaizT6ShGj7JeFQjylCahQU2gFaUaSDY1v/MAx9UwkH4U8PhSE37rpyV6gHgaalZ54h0Si9ql0yoCduMetih26YaYiyy3WOcpQwVOu0jrvzZp4s4ESiUPSu3j2s53t2P0tJu+84KTwBThE4HflA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C582DECD0610C70318AAC6C05520EE800528AACE05-0\r\nServer: nginx\r\nWechatpay-Nonce: 80a68f5b68b7e7a818497bc6bc198e8a\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: xnjuryxh3TQG/wqfm6jGgiHNYJgCtqnhiKVxVchMfoAGkWQ6GbKurX0dbgPxdfCXY+hl3fZhRBAlsf5o2okomi1xb1prt8VrLXIPqSKL5VLgpWHwDq0N0okz5QQD3TY9tmVZioPopzqMzVhX67DIZFu4mPkmfAfiDhTUgG7sTbqvK9qxqFH0M2+MA7LD3jInJ8cZw1+CJv4GufKHnuq0pxbkYsaUeS3KRDDnxfgwv5Ru8TK2Zc+7YOOwFet0QfFXVsA+uC8sGjL0AAsd/E11hfrOqHJqzbp4hoFZc0EHM6omxJo7PfRboJ1sCJzrPW70HvezPRJXLazYcAx9EeHhaA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633861\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115929440151\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120017527855?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"8o0TF2zRxTMgDsb3K4VDweSvYaG8wsUi\",timestamp=\"1773633861\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"vlp/D6UU0SFnXkO4eRbpBB0jJ4dRbG/KU+Qt/wKdjlDel5iqikfjbuaPGvLYRJumAIMDS+Cu5mRfC69t34UaiE8laHlEV4Vjnc5ftLa0gfE70KG2v3w5dFmOnJ73pHgClP+9ZAYfJHImu/zH4/EN3eJeWnEUAcGQ8D8wsMiQQbEYBW9SNv42EmtnVVLMn2rHM9MPlvxgHwgqWy0JAf+q29TNG9knrccjw3TevoqxWpZHunEJz5Y5MeOwZnRN4ff/JQBbD4NcV+D9I4YY8THMbNXLlXqKdySsCv46kuLYz+2VdZZQHsigh+7zSiUqu4v4ZzAr/ujl2PUeM51XzY1S7A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C582DECD0610DA0418C6CAC05520889D0528D1C503-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 1151ff2ac0cdb2cb4d159951560cacdf\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: MS1bZtpV8p8NWZLGIbboQE4l6p7osVK+qMM491Li/pvwPF4PFg9BEYoPVqBArHBEq/q8W+/GEfABoC9XQ2Hli0BTZey4YeVP7DcuHwXW1IrgJUE6BTlcemO4Nqhki7oyRasymxIil2PP8247uFzZ3+BOrsh69BJXWfMRtMjG33FtYkg0vwRgsL1w12qqIO3Ls6vYxlOjfDqyu4sxX8DS20BBlD0EBPQhjmBhxm9Gwa994QRuu7kjwFdZlTwSwOGuRFFdYDrlmjfpg6XXxVGzSRWbUkuN8bmzR7DSN7vzFdzD8CWYqqVXbARqb1a+MRVGcP/zME3fxT08tAkJ0Mi0Ng==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633861\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120020233785?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"dRv2dZfJwq7uKUO3xKuyN3PnSrGASblP\",timestamp=\"1773633861\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"CpZkOhKDRmHhd3kXqJn8IxRjt9xSrzcEY/nfKSf46GY4Jf5Tf4gn5LhXkZe7DQunHvVBAPsl3i8bSDXwVZmIue4xh5F8p1mfXu34vpsE/9m7tr1gzpmxLV3+OrdYvrGhOKO9I9cvThdXyb8Dm6aBdU+ZkBPzrzDW1toEmQNw6+CpQd6F29JPbiLePewiW7y4bvwNoBK8z1xtA5L4FYJ2jATFR6rycqHDkWqv/PEcF+G53HBVrI0m7t5OWSnQfX+EzFCkzX2LSyDQIrpZuMPfQPyqpWGV33BgtVXbdeC3FYfanTiN7N3yj7fsA6d6EdTydWpFg3b36k7f7vjcEmA1wg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C582DECD0610970718FACDC05520C8980B28919401-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 5abeea7841760e61843a5e524f9ee315\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: FO2kGT3d4BtQlAToPIGWNNhbj8QD0fL9UUXGRN18y5d2aezunvNbMoN4RD1kUYEg27auNi7nJ9WZpgbGVt0NRtlD311BOMAuId3hdThwnTM/12aRE4LxJCuFGtUqYfg5bfExSiETWPb/8C1nAvk3wMOzlj5BHo9klt3De+oYePNSr8D5AxU4C33ZYPnH8Sthn0tPxA+ALe7YLs/CftXEOVlhxvofHjmmKcqLxUZ6OQwO4X8ZVH3rWpVbKsfJRYZ8c+Qxdhc6nwocu1+augyXfoD1wAVGzIz973Gd3So+xyenEgDHD5TA13GrqFe/bok0G8sdxrmkwpiKRJe/ZFG4Rw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633861\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120020301672?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"LS7ebfSv3tVRKj0n92yAl8Jx9IH6PngC\",timestamp=\"1773633862\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"gXdI/yzVKsMkeMOW8SdWXjm1WmYqfUX7R/0gc0Ta8W0aXxtGTLKVJCxT2SwcDHPoQ076vWLEe5W2n+f8HpEiBD/gFRLhWagWxnj6fvlN46yM9r9bN7h/x9gV1YGD68oxXVqKzPcxIMzMqQ8VHv2Cxfm2LTlBh8id+NaUbTnvORc6aDGFwWqbhqTiSqq3JqcmWYy7pypay5C/2xsogAR1x6HmbXy378fYvyshdjRBFV398cDACxvharoIVcdOPQagO/OpKRyT8c/PwhR4gTS9kcD84/BIXXXhewiYwkEGRQdH+bffSzomn/cnM6OeKPsUSU/v7s/wZImyidEAMCDbBw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C682DECD0610B50118EDDEDD5C20FCCB3028C68B03-268512771\r\nServer: nginx\r\nWechatpay-Nonce: fca04ba7e9aae4b55b10c99bb05ac8bd\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: bLCDIfCQ9BQWEwA2O1sYylgeoVRaLuvEfE0U77NYCFpmgPOVhavEpR/KnLdDE/1n2BU2X449K03x6J5YBZdGcsoROzIRjVlG9dZFAqE2H7eAcjI4pdECCrIIEmtBOhInm/G3/QeybIAeyGb40U7xexeI2r9XwobxQwDyDX/739cA3t8sWhXp7b0MibrAis+ExigelQPkU+L07Bh9y3NIYbcH+R13vTvcM/6zGC59MZIs/xmJrSEjPVa5yGYyEQwnMe5Fm93Le87FAMT9VVf187zUUdgvpQd+KwedhiuIH4VE3UAYHWfnMnXQPtLW++5dMy6eBgJiq6ORE2nrjYVo0w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633862\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120020537488?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"UU5A0H6HRBI7X1cjhBnKK8FSpXymwykU\",timestamp=\"1773633862\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ePkYu+2IjnzQzklW9sfzFXICAH4i7V5vSP2wN0l/SoNAMPSOP/XgXp6VshMotPHKSIA8dIUosjhz9uLWvErtt97vZX9O7smzl/Si2DXxvYG8QIQ1virwL9YBb5ZC5+zfzwmUu/Oik0id5QPXFz9FlDcoEy391tsN+3zawNBSiEas4WS4AlYVJBCY8jw/LdZ3iGCwQ94NwMv7eELv7+vUdtcaEFvBx/GpfSh39l5J7FsvhlQvDqxceG129nGhQ0c2sazhmLNbgbd4al3jTFp3nkoXz7l80JyJB4fLhkiyiT8ihFvSzCZ0uIrzn8WAB2ns2kBCXtJLH6ZeHQ0Cc1/m+A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C682DECD0610F3031892E7F8AF0120C0DC1528B4DB03-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 7c0ff7fef091e63d61b9674b31f1656c\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: pcJCiP0P/nvDCkl3qu1meNkFnyVyFdOa9/MQJWMduTqpJLOv49/dow3X+V4nwwP+cjbJgRjYIBOjAvaHGu3Y/e4534aCwscJWgO05Xx+tTrCr7/nd4DIz4km+MHxio+H2MCed3muUeR2RbP9/8962zAURTf87rwhYQ8yiW+Xtsa23bP3R0ilXfXWArQt5fX2ZumkXsGvFRRQ6lCFFYZZRm3NFzBvsXVGZL10v1S8c9cYgWkMu7gnWYdy3aVlfdeSkqfLnpb2BJvbaMp4NDt6csU8cQcS7Ig0gAGrhIMyoKojgfpoQi7+QoUUXmgLanYVrlrlRsBKqA1sZDzldOxosA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633862\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120021271732?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Ad80w7n7BEuqwRA7claHP2nr7MKkhOPI\",timestamp=\"1773633862\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"f3U2x4Ye4Rgd9l+K0xSHVqD7Rb510ibnkGpFVnsPvi0+fZVzpYZunjYLI0VST+3usgY0jn+/1w9WgoGCwFVM9+4p3yU7nNvY6eaXWhMTY2vOCfoNSO9qTIyqVKrKIL+ZVBJYMzYAYa27qM3142X++XTgyCzakxr7QNGaca07Ipg2SfmaEDRPU1B7n6Jgg03GWxQ4XoFpGQ2issxf9hZV8fAkgZ+gx7zhHMTO46+q8xdmXEQvaiYxjaiTWQha8rsewPUQErGjv0DRaPvwqVvIj6wQtf7flEZX/FmVTuHDu66fw2q5/RDYtTULAbQzR70a9PDCbgry74u/phmSCLOmag==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C682DECD0610ED0518DFD5DD5C209AD10228D95D-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 4c16c198600548894a52b11743b34290\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: MOx67DeQdVk9n7kMkqQyAWrellmERRxOAgeZhn7C/TnkM2YtVfai0xMoJ596HG9vLOrXxgWsnLrqqaih9sh+UWgNiTfZB3hZ0XSu6B8iZbGJRNxubdwACt5tD91HHKoLwiayj0Hlw6e48KgguJHmLsroY8QSANr8uPR3+Q57ABYtYpyH8jc9j5Eg2n7TC0QogAJ8fxu4apD/C9bDanEx1kNtcMsRO93Iecyh5JNFmyk1F//VK1OrD6BwinkRhaaHn0SiAHTnRGU86X24pQi9GFQDMWes6A9l4XqqIq5EEJdUIdKJfUIHrMsxaDZqhDyg1J1I1RfWm5XgeknxSxausQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633862\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:23+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120021421320?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"bwIG8afmNDxAoKFXDWHUZupsgPOIpKDH\",timestamp=\"1773633862\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"NSY9DLPkTzk0sYCeP9qVYJD37WAUXQRI7o3E91UT+UEyBASwG1ePlFqolM8T1vHaTKIo4ZtCLqlJshdjyFUicA2Me5i1zIFJeI2Oq4baU7eTKVFoQIg08Nk4iLk4puTRZubb/8nXFNVqIgJEM5eJzw2J+9Z1Iuv987MOqfyyqS90vYseQB4GUU2KBGUimNxzmpCbICkCBogUpIqFbV4iM6Xf4nzBNVkCCxAwSno6PE1jewkiL9DiMq8m0GEuWGgAn4cWoHLy0spjss2YVdcMKvTbj1bpSR8mDTPLlD1FziCmkNTVlfgArp3HUEeRCnej0E5t4IhqNvnfcAGo3N8ebA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:23+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:23 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C782DECD061025189A8985AB0120D89C1D28D9FD03-268512771\r\nServer: nginx\r\nWechatpay-Nonce: ecd30bdbdfb518f24df6045add03c01f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: A+NTb+zKHl/N/2ugindEXVLSUza3PmVnapeRWSCzC6V1bzQsiYVNRCc/9FKrx++0OnaWn5k8AFm+meAWJBQWOC2plF4XcfxK4LWoCb6QJ0WVzMMllJUVR2IWJe5WP2C09di+VWluyILSG3c2FrweIxI4W4JWFA2fBKE3q8dI5o7jdrNupsGijHcLT1imnJYh/GD/4ge3h61pmaa/1d5ph2HHKicVgDySAxd0SombuR1VnQGoSEO5NZtg8klcwvQnqxdK/+34cJkQfQkjWovI49Zj18qF6J6ExK3qr1NITruZYVKGyl9HPeVCltADi86PPDzwAhb3pPf4bjWVVyiueg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633863\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:23+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120024109352?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"KvFaBXLVazwKY1Trhx5ltjT67GjcJhaI\",timestamp=\"1773633863\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"4pTSapy/3JlIJVS/cJxtMiteEIVEXkvyWxqSUa/dMVPFExQOibbjE0M2Y5s/2cn7LvFEcV1WSEjk9MoUbrwt+kWgKzrbXl7xSTuwpRbUf4Y7GoRVNDKsMecSRrtD7AJtawrQTiqf4ITv9KavMVZGyAM5k1Kck3WsDcZISkzJKAYfW5Xg+O1d1P+RvRFFx8D1TQvYMQtu0iTcOITnTK+vOZDSCpSZJ+JARmSckBmdMxNtZ2wdA0rPc/Waw5DYZJYTTQM9b3UsUI+OmD2FExDiMGd9J+KlP8JijPGwvU3y8K9dgj/FsoAjkIqAqcCAExZX4D3cV/7Wy4bIdRJ4Kz0VjA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:23+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:23 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C782DECD0610A70218EF8CEEAB0120FEFC0228D657-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 6c66254fee50cc1e31f3652bff3deb8e\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: mcU7qo3pmusLqsyIjjFVjWfxRO+hy2spMDbtHplnUK0l80EGeaSxxerdD/s+jPIQ8KcN7tb1yruTcVZ/aX6ug+tWajZoNF7C80CmXCJ10Yd/0spxyXKA3KaMUECGIXiXHDToAghHvrFgOFFV9CmAIbFyiBffYTBbRIyDQGZ4ha33YNLzi/BCSWYMeCS983i7IJY4ttfryKKYUkFTCOT87EvVr2Y9TgkRZ0L3wi1CZULfxjAtsOapZ6dhoEv+KWATIKmL0FeWWQyYbFjM2Sx6cOHBT91rJJ82aZfxfy+ec88oN6wqLHNQfZ5t5lZZzdFZ4tokYta8Fr/2usE1IPD9jw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633863\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:23+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120024258847?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"XD0k6aGEv04ttk53FIK9cbrbWiWfKKgC\",timestamp=\"1773633863\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"6J1QACIYxoB/09j1bxP6U+bcrwY+rcoRpz2t7OSt3i8wy4dnQfvRLWpDtvn96GdygWS5nODC1yP4lTstNPKvHyYmyk+RzpAOagbGixobkcgSPxeMR/M6s/424pFOpPwAvf9la5VblZKV2iGocyzG2zwoGVRXMidR/Y6qR+h3pU/4wfbvRoCPKfOGEesf1YUGAUi4/AZH+FvGCUIwJC3LWnEscRkEoRyxPLsmNn/smcS6H3cCLzkHPSdZZC5XZ6UDUDaNYUQQIqvGg8e3hTyZIY4FUMLwbXCsSoV9WBUTek1Mt8baEfF6kxL8RqtAAAWnu10TW52bCspczUfJytSJzA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:23+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:23 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C782DECD0610D60418E7B7C055209C842328F466-268512771\r\nServer: nginx\r\nWechatpay-Nonce: f2cc3f534936ae3f3fb959be18bb1662\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: hwyDWlV4/a35vdXbO/jnxIhXu5ZR7JNPzSxZlW8qpxfz3zU72Uk60++1L9x7s5G5f/4b2KmVytfWGzxlI7b0l1RrNF2yJD36zu8X4+5qk9bSEtnKjwLX/xSPcB382q9EjgBAGDz0urCjYv6mT4jleLGFoloV1il1EX5UzBjMCOX7vBlsEXTyJAOYWWGvUgT6SOogcP58va035hG9XPvbDiMhG+k4W1QanESoF1ZjTmwUiM3zr30J2n3PImhON4NWTZkVKXdhh15tt8FKUYnzRJfbnLxHQFrF65PGKOZLQfzZzPw1ci35BmbSIU09OCTlIHNNWqVCGZpks0CfVLM6tg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633863\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:23+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120024436770?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"peywK575jRmwkn3JIo98fh0IJlQVLPAy\",timestamp=\"1773633863\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"IIpa1DPcKj3HfKLLMEMdOwJ5ZJnJRwMzZ5XRGFBoyyj9sOpvCEFLlxE6FYBWJG8bUqg/WcxouFW3Z35lQLDd/5bLGcPsDsQ3Y/xALy7oPRrrrzgOFwPWF1IEXbyAj8UZueOnKROIgUWzCd8a9csTTzG0VRG7rpuM6UdbW5U1i2E/Jc20uVwcSGVqQSzJOYxp7GgfrVIxjV9vTam1dwyjegijNp4gFnQ1I+h5PIJCROuSUvEkDycYV2BISZHymFZIi0pGLcPKEokAVAp+AxxhnAd8TXMCSlHbcQc0b0+wDUU9tDzOUJzKanrAWkM3IU6rv0rPz+PGRGc0+vExf5OTCQ==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:23+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:23 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C782DECD0610F60618DEC0C05520FCE81C28B0F901-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 59343ef43819f79c608acd9c311469c1\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: f4vI/GMxq3JJeieEcqfxdJK0bnyiFxbZbCddL42e/YREpX2CZgo5arnGKm9VLBR+d/HqK2p6rtAY6pWQChYM1YbiGsQy8df55PdmwuEeO/ogS2N7sNxEK9vTZKbOuTRutsRFlseCpsbOps4HOc/7hHLgYr3Db6s2EdUJAR4LFq3iR3yllNuDYXj3sjj6Wm3nQl6PQqgVWdhZZ82Ru+H52LEBOTPj8uEvQmPK9TwWVx2tj5XxbWKGV1XHKnonAv0Ax1vNb+RQ3nvcIltURi04lql9kZIKA5xX2TjkHTuE6IQrrQxzIw+ifqwE+G1XnDUC4EkbUGMcqqs1nB4Bhmvq3w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633863\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:24+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120024489012?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"PcTFlGNsHt3Bx3uKhu5vJAjKl9FtO6u1\",timestamp=\"1773633864\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"IhyVwr++2aWa0LMEJd2wtnXWJgHbqLVqW90vUkjRsxGZcf30vKDwUotSetQHUT1VdL9XC8c2RiYqON2oAqqzVAKVx+WZlBn3vR1IrwcoCfIFVzG7h3MiwEKAWIEnxhHYx31c6g9Du4cpfyrjWb+uuBxxbUKZ0fHXtPoz34gQo9eyqGuRqH9x/vZYN/omU2UMW9SXDwtFHhyooEhXXTJUYAgJbtimhSAtxY+XrvNV7xs0WiIjeTVpr5cicMQpYTFOT5H2Ic0GdlURC7ucAaEN2QzZdAmsU+4OY9ROEOUBFWyE39KpnLZJQuX7QYbIjeuHDDX9XVJkFFqfj/QurO2Hag==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:24+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:24 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C882DECD0610940118A8ACC0552096F11D28FD47-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 7606da13970fddcd3f1ec507b162671f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: x6iu9OY6m9nCkCTy6/nv/4gFNjk0XqRUOpyw15827S1zKoRfEJINj2wejQ+msdLUFjGlImhHjMdZfVA1pELezCjmTVrWfjr1rIj+TqVmhgBhKoDoOx2+BThq27sfo4XAIr94l8bI0vevM6MHTukMqR0htcjB3wGn5u1W5qrOr3XVA3/45Xtl1NQGqSXsDQ7oOAj2qNVsHwDhy5HE9VGnwZbkEAZF4kL4GMhmavrJAwV4OzuMStahFc4+AGsMln0BYOAO2GoGn9L2c20leMCcIDHabOcUncN/JHmMGsm1dtMVQf0XYi8MBlzr2XPQvuv2cIwb7OVIhY2lNrHU+1TU9A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633864\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:24+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120056745250?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"dPTH0N5SzCCNKu8rD6XxQpKZwpj8eC1y\",timestamp=\"1773633864\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"5R6XHc6q8d/CjCEKRTlpjZqXMBAr6OYDcm3VlQ3AhQyeYiSblnuVECwRmy6L5AT8w6FT3Eg5mE0sKEd2WA2xgmbNzZclJwl4gI1j2F5xHdPRGdI0uSiGBojRtJy8OPt7Tl6/eMw6E0R4SJ6ItYdHD0FLjUiMCkWUeVzcWmVZcVAYQhXHCx9rH+WdvV+NYNUJUUELwsakUbAEXmNpwHTQIgfFyvK8jVlGwONpYndRKKN0XAmEVZx+riBInHjSFktW74rCYgMGxaocBMFynyTKqZ8O9geKL9QMB6Yu/kW6ci5xCjmLCvKlDteY7Imjzv0zkkSjn3U2dpwab6kBMbqxjw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:24+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:24 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C882DECD06109E0318AAB6C05520E09C4628D39104-268512771\r\nServer: nginx\r\nWechatpay-Nonce: f294c0364098dd3e45a062ee640ef312\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: fin29hNhtHclk/4+wkbfnRq1c4hvix/SGTPaXV+jNs/OiGevtvAH2bZib3SDWxDMDPwZj7Hwtb9hdeiXtJHWw7PMP2HWX1NbwF755Bd52DA0W19DSCC0pfLMYNK2p1Xig5QSBvbDmz9JWo35fg6gcXPh0RSlTOoJGDTMcSGF0IJKZxgYqytAaEOP4LvKM4aPaAjj0nVpWU02OQ0ZfSxgXLrP2TYWHfcxNBcQ82AXjfpdPgFgZxNaRxbO2pTQApQf1cH2f6oT7a68bUODwbRJ0idz9Xa4rvlJOph5pValJf+PoSUy3PapNxme5z9sHBSASzXgUxutmZy0YLhW5lUuGA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633864\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:24+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120057246756?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"a1q1wvro0E99K0xDBkYDUFAnzGBlpN3c\",timestamp=\"1773633864\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"sPFw3D9F4IReGjaKHeka0FwSRa5BFGDAECWCV7/T9GmslyEkX6Rwhw+5brC6LwMPctc33QJJJpLBNwL2YrikMOJBarY4fvxM5VYAtDRK0f4Av4+KGCHr++Ru/AXj/Im2qW+3NuJ5LNcpqMCmd42Pp4YbnUywvxoOj4VaOgdWcoy6AZB3iobl5U4RqQ3KrVmopW1gGYbcUe4NdfpYs3w6T4F4rbu6AP++nQsQFgHsWPztmR3csvVG/zhKQig1LLRVXIOtIvHC6jZ6WcTg4vK3xjTdirJV4nfxCC4sfJkd3X4BkeHiiMBzMcX4RwTCO3CTyQlMQP03vAoesfyPVHCO0g==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:24+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:24 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C882DECD0610A60518E981ECAE0120AAB80228B4A703-268512771\r\nServer: nginx\r\nWechatpay-Nonce: f09dc69b2a57e095c60fc53211f7e6df\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: sRs+9ZLYaZw1SIardW/QPcB6J6+TbS45no8p17+mj0iKZ6RTqZ3KMM67LkQdkXbtGF0a56MpMMwkpolcW07hkxUMG1zQZO7F8emox731GrkwezeZCn7BoXiKCcWsUp/xHwr59cl7CdkwFnP0yw86mL1ElgPUXZ7ayYN2Wq1vr1VMX+o0YF98O119S4cgfSNFcFuiPGDQiEVe7M3hiW76HwER+Oz+vID6YIBCeemWOMXsm5He3UA0Ez0n1xVF/X3j/Gqu5xwD1YQ9+w4IYVyDCcxv1lGha+y00mXhJ6Nyi57i6lwClKFu1aIWyYWMwyZaAXCoZ9aTN5rVIufdjDogVw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633864\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:25+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120057247243?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"spoPzucA5GFcNa2BQ4Eo8e5aNAOmIeW9\",timestamp=\"1773633864\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"0XXKc478CHWrcTI0jGpYZzqRpAF4Qmn3LFgguMcqur0dB8RtFBXuO9TfwNSbssWqhvuRF5+UqExO2WAhT+yqWxYAGTo/L1arrZUCObUCuQrzy0a+2xHfju077cdhIRK3o1AlF7CKT0jGUpFvjUNgOuJhjTW3Ih++wcRecQrOWGwc7GG708Fb3tDOJ+qyhjLbI8A/zo58PvHwxDC7TwsxjuMXxDP3mjhheKCvDtK2CzxYrHUGYusaPGWzxWYUxVBRDxHc/LObIYWNT/vqK2JJQ10gCg3tj5tyET8c9829vDQaWnd0olyHZsn2iWoyKxyOgQliNXiebM+vFaRrnAQO5Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:25+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:25 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C882DECD0610A60718DD9985AB0120AEDC0628BDB001-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 73c70b58f505ff922f4b0479e46399b5\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: xPa+U4+PG7IJQAfnJJdwDRVmDvSdk/beqfc+DC668jAVJkmYY/JrP2Yrj3+9A9Yti0CUbDvtdhCFcTGCYT2mMxZ1lBdqa8XOKwp5371NseabZh2PNWBuGzAUcFITtKCAiJgABInvA1tnNjhGXu/3rW2sG1G5j77vbraIaO4kyd/sX8JDzdZmwED77wUeh3Hxx+I/Q0s5nZElyBRp6XMfobJYgaaZp7QqDQ1Qhtr61CiKAWsdXLXH8ftoREPYDRI+x/zbXoLBS6ypxkMaUlaGENQ16upVH3zBB8jmers0joBoUT7zyEqzk7Jps1tq7X70CB53P2MrTipM3TWN8ER/Xg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633864\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:25+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120057306012?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Moy9Nvy3mQGn0JZDiaUYQ8dFIblp5xHO\",timestamp=\"1773633865\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"VRb66ywCjjSFFoVU2mhzs53sCSKtZ3Uh0dIbgGsr6fEocrCuzU7yeuRAGG8O5Nq1Cb0IwvVkCwKs9zKPEnYiZE74kbILlIZsQxyVA65AnxDuXFfPTzM982BMxv0kZ7m8EIOKGA9uaH3stEkN3phom90I5MkSF9jetnx0BYNohOt+upCx6pV0Krm5nDF3PuiK/iOgUenvNsIDe2wy9lJMlQhdtWuW0Z3fJIr5cRTe/prq5VMd+ZDE767V9ZPL5gMs+4YMq+Jz/GTaRH/eOns5bJCDtI7zCyLo/KWHYgtGt4kcwLCTBdGQbuZb4rBH0ZRp4ipVDHGAoGRSAp1ckn6K5w==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:25+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:25 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C982DECD0610DE0118D7D68C582086DB2128CD53-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 46b98ab3a0ff0855eb62564d18ad1cb3\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: yyWfOTL33fqpZpZwdwIAZATp52he5X7eo4x43qFymGHUORRJs2RkU8FVaBZlhPfQzTNwACv89QNWSHI7TNZPGRkMu07gS3WgzmBubeCRl15mD0NDNKsEZTJmNrqQ4kdjPGHKo5QG5NXpX65eF+3X7oAi/eUehUyrZDFqJbRKROmWNNiEWi1cI/Sjtsyy5YjJ81PQelQznASE78cLYaPag0RjBOGUuJ+LX8hekVX0HagQ+P9Kuf69VXZfIN3gKpQdWlD/rqrZtA0g5230HY3nxxT89AzSCnMbgWY6OzrQhEY6hsYklQctDBqQRrvW3/G67YvhTR9dmNNrQdqeAzW4jA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633865\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:25+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120058087833?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Ug9B2tCGOa2jlfjLIF0lQSCYhCMNTVVe\",timestamp=\"1773633865\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"EkuIt055LAIMKJ93TwTI14aavyGuoQ2R994Im9POhZiMxmrMc3pRQOII3wRvJouVpjmq7HsZCJZ9dknMwjSV7tURCfb5+S1yLdJqDs4HkP6BMzRB+BNLnnTBtGpgO35DixvXqX8vGFXkTNggvw0Z+fUC7bHq0fGpNQ1DllehPuVL73lTxh1arzmlOvI3iwWKTx//zu1sUs+SQ1ohVRhmTo2AUtImMYJHvMFZXDJqyRK/zMCdg6F6MpbV4IL7oj3bQIyIxh188HHJ5oH5TiwEom9jmasi7iNXMSI5R5XDMpEmgXDsdWZEyblV78v9MB4ufGhwj/oZv1bkJofiY+4Z7g==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:25+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:25 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C982DECD0610850418F7CC8C5820BA9C0C28C8BA03-268512771\r\nServer: nginx\r\nWechatpay-Nonce: b2db62d8197c65ad75c7b2c6f374187b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Scot8i0tBuadLYmXNgfUCm7wdzrrXvzk0XJvm1mgRggZ6Lne8g5uCWtXvCVwbs5K15+GcneXPURdOUBrfpVmrddyb8MGLLDNRPJL7d9c18FBD7ZmXSIyeKg1g8iOVKGiP1uKofAEnNtDpWSSI36JDWRXfhu5B0nrSzd4qqc1cAgnQIpopzur1y0fxIQRXuM8drErmr9YcuW3gfSp6y+RxHO0l8ogUcCyHTWe4HZN2BwWMPYHC56EpOJse/WEBKInLybxtRarC+iSwXwBXCdJ0cAyXv5F6PhM1hosZUtnNwCpRQrcyYb+DC5Boi3t4566qzs7FRQ3zOmHH9rIIVBN9Q==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633865\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:25+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120058353308?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"cm5xBp1MtZl5zU6LvfFGgY7mHh3MFs2R\",timestamp=\"1773633865\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"SGK2VwtxVRLakdAjNt6nBABZ6qOxAq0eE0HSgoXF0jZDlFINt0cOWFj4ZRPlQTk/Y4EnxByO6ezD2OXcjZWTTdefzqYOHLva52mOGuxEzOBztG+ML9ttjMWWKXDRErezi+S2Flcw473G6FeSJujsfGOTXij4wTR2m8g/xNNiMJwEwCcCRfpE0cVkXpvs45egk0wV7Jg0QT81YVXucqkXJEoVioj19pmw2znBj2KY8wGgyd4S2iLxqMeWca2DpdDzbcxL82ankDGsc2xwwyfsNvr+Z5+d6vWLLjfMTsdzSLAyGscEU/8PGvf6j74b+kQ3i20y+5hvCdmdPDaB8gP7MQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:25+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:25 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C982DECD0610B30618B3BBC05520C6BD10288ACF05-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 9592cf71411469d7832e39fa0660205a\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ytIcq3aV9DRvcdDILH/9tfb+FhrCygrDpeRrqMvNhJbtGXXOTb3j5ehUA44rtvq8sze5NhoSPZKRcUmdtjEuqojt2WtwANrX9hYp+fHIy+sf+VQ+PicbFc1DQAEASEyxB2p1D84pPXIIUovLdnFxitFJ/bRA990+izDCH7TUjH4tPSsa80QpF5qWJtRnMksedTAhM5LVo1E7cXcDZ4PIdeVeQd56WPrK/TALLD8we1rxK+opXKaeQlW5v6uFO0I7iKmQCeK8mnakMYAF+zZbT4GRgCdyaUe2UF175X7smDrJW1hNCmx57OElviJQp+DQCJltOW7Y995HEgPNLR0guQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633865\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:26+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120059463924?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"5r6sUbO2MTlxo8Y8vxDdrwqfsljSvc7Q\",timestamp=\"1773633866\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"y8I4AnUg7My6h42FXR7zTDTaOs/9MCIR9pzxTGaDBAeqRVWtkw+dBpystN803e+gE6QRnL7MbPoyLzNfdGevWM4xYk95faaMuvuJDaYV0gY//wdyGuESjbN4qfOuY/1uNdEamvxzcMam0ArdgEm5D+BHVRdxvVBxL7ynhGosnO0e7xHrjqIMvoOJ+s1wIWGG0LYeIdxWvga3stlKANMHNBw1K7AAtva+X+VgcLwhgsZSwGbtMrRYhvVev5s65Mk19FAQ3DzQ8ESM33afwd9JsomB6t7x03cYwBulN4jSmjvKNUNwUeTn2ax/ezwNIY3wgPaBPISTcEc2efj/yXjCBA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:26+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:26 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CA82DECD06106A18B0C8C05520F2A02428E7A902-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 90e8842f6a59846d47930fd44be1eab2\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: WkNRs2FqbNc/8l+tzpaaJ9wJjV2BS/zlzpgVIQ5FtTlDDkBdEIgImi211fRBupdHZo8wOaTOA7k1AJbFAnGbdIgUDvrgh4aNn70uSl2eCyzkHoMkuetFDGYOJ4D8FJeUnhGabbgLle318elgW5U4JrM/0HddlwJQTTr3InS3KDR5a1ccLtcLxiMLOqiZiLcFrO0hkppXEe0CcjXLt8NkOblldZiZLBTajJNBKlOvwmD5DMbCdqfCr8KlQrQKNvEvrsE9d9NY6ns8P4/KcHfQZ0K2BKXtqashb4e/b2AS8DIuIR2jgyPFanZE+o5dqX86coqid2JzriCzWIRta8kICg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633866\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:26+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120059721384?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"8cCGm1o2WQFSkgglt63QkAx7yvARTxAO\",timestamp=\"1773633866\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"MC0y8p458ri3KWswVHgmOVmlurJiX+6QuMcx7wTwQLXcApWYhIdgwSpojnt0+681ScAGF7GRMILsgaw/Vn37j7gQzYlPJENkSPfqQnxGZVMsuGkxj9SUMC73RlXDyMbYPVMSS+MBxc3ljEyVdIwn6dxLdsCOTajE911XvqF/i143RT8VGwG9AtPbIMeNtaQp3/Y4Vaz/oQc14QHUAu3kOipC0Zxyq9p3xTH1DwID+UiA5nBqcmfWXrxP86ba7KwMjBrFukPjc5VPwnwQZmlQhqmN/oGBAV678BiJnhz8t3GkWDsjgYYcXHJys1yPXuUziGZNdP8ZPBUXSkc3R1S13Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:26+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:26 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CA82DECD06109B0318E59FECF50120E0AD172887F304-268512771\r\nServer: nginx\r\nWechatpay-Nonce: f67df62f783ed95780455724ea245b49\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: lCTNuIXAb10ALqg1j9XQTNZ9IVcwijPDWCNAkqOCEM6zUtni4YYmVu80QtsRX8T4cJOwY3z1e75bek/p+klej8UymHu3dfJzLXZJVaCLqR2xX7jgctaobloVwNi7EnC8N3pl/OYTFxFQcU42iNdO+LTOsxdCCpNpKedJke8fw+PaVkZS9uhTtpR5mhgE0RjiZV8DIDQb8zmstGJNvhTYVLHvR25+/6P+dJXlDhA9Xk209Gaoiu19F7jUsf6YSSw36vhoaMEHTm7xDJnZi2HHddQ9f2YTJfBrq5p1rPf+UGmlV24T5s4gw52l3mJkFvEIx1gRCi9T1K0iNzyjDf2FGQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633866\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:26+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120100276575?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"jYO3W4nWqlW9L0qC4VoQRQA7Rb05OGAp\",timestamp=\"1773633866\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"clnW8lF4a/6E4SR48cHQ2N8bVnYtfFYi7u+iuKGoD2guDXhbND7wTMNEr+KmVYnzgfidwHIapW59UbfUSo0J0CY6U1Cw02772cmRdBtEXXBeht6Qc0ehk29vtxv1SFGzbThKXgiFOsWRfSP5DrjCLFqqsowCsXma15dDh1s6P8v9jVfs3gxMfjriUB0Qq1W0EoasmXa2wBZFbSMyVHaJ040A84YMaYPWJZnscz+CvRCwoHMPZ/j+EFAa/3UBYzM6vFX/WI0chDvjhfsmpsuuT1urq4RzSsb5DYAFE/2LhBqLs0witskIT5ThvPaD8TijNRLP4RgUrB60Lszfv9b5JQ==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:26+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:26 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CA82DECD0610CA0518AAB6C05520FED23328DAA503-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 8b01860d118353f4a7b507e0e106f68b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: YcurJZHhLqhXoo0gaU9N+OIIxFNXgASXVtr0Eu5OD2fD8eOyaBIdIikaNe0FgUfJfhOINEF+K0W7HH7zVtt16hXfDu8Jzd2Py3cODuCkQl+Up44k6kb1PmLWJDWLyix3P23fJC7+Th2griSkgY3M9hOJ6jsgHbjvDqzIp8GswbKHFyU7NPWs8lbfjYT43fWNK+MJ/gQcr/7wJqKkCufLYtJLrt/lZ98xE+MRyV6/xBOGekkg3aHtS0Mp0QuAPdF1mRUqKN0CY39dSLgE8c5IqWEFP3ChKuxB+UPEoOEFMXMGIKAti3jD/x3C0clqj80Kd6Cwp7j2XqA/bZ5+GhU8ww==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633866\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:27+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120100336241?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"pndyQAEMBTsQbw6VrrecVV6q4KZnAXk6\",timestamp=\"1773633866\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"4gdewYRHjovzi4VnFO9LNxYk+5bEyCx2Zl7A5LLLD09weRmgTvV4ltoQCeZQT84CsVAhQZSaDcyTyMJzKiRQHZ7lM8L8/YU8NcI3OWZGpfRIknB03G31ba6evaZNX1o21RQeGQtQTJN8xbLY37IKckcPgHUI5OUmGzfwRrxd7ANCLtq2OG1uEf12cRgjK8zSHPpsJE2UpZm2zwq++7fTifJX+OByDGePn4gQXF3Cf8y/oTvSzQrk2Q3GbO3KQEGjexeLWZFhJU4Puqf8ZwKCb0X8TATNPTmpaxOUkVG+zeBaJ+vesaLKcA4+yR2RASccQQkp9hlN/Zcg27MOUtiDrA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:27+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:27 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CA82DECD0610E20718BABC8C5820A8AC0A28E8EE05-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 2a00fa6af00b07c5019d97bc0b96c4cc\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: IacZzloGTG14qREGFMsyRwlDz84kuJNSfXV5ZLIryC4Vkcbi9lUtExPeg0RGQRWu6xv/FoYVVqhz66gf0IrgwCb3j5rfPYsFR+W2mt28JVSVhNfkOevhtoRwehyCWBwXa2lLefZ/JlC24JiqmzUD0/eNJKgBUlxhc1XTAwWsZN1byg72LVhIEtYUr+EzZulPlJKr+trY6V10ZuEWVTbMzJ98FlSsDmqAzIVB40kCrVS5w3MY5cXQIySjWxW/FZxnuxVlGOrMQzaOq5GsP3UyRm99pQEkJlyQBmhw1L8Xd5hjwQWfSY3lHdHuwwUEWjV268Myf0xvQPy9vKrMnhunpA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633867\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:27+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120100742431?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"zqf0kz7RuNziE6EnPHG3xkmoa02o4EVb\",timestamp=\"1773633867\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ZzpSDDXUapf6Syn3G2BskV+TScsB6D6bFqSaYeUuJFDtIMwHS/zWuJ3xdNemyB5xMeeoWYd6g60NAh2vMzuKz8ectSjjotWZpHaVP+Qi6q6K6lzMHrvJLL07IDnRBumzmpxnuoSRY4r1zX6Z2kpD4pXwFBuS5xOlymXov2XQ91X55erNSsc05fniRhTNkS5BsfVa0GFSwxycldpvgY62jRajRJUO7J+J6x2sF8QYZ3u6A0um8w+i0oa8rjlaPbRr4FNOh4He0laJCN26kwdgO2epY1ijRg9H1veOqrSOG372Kmdb0f9rY+xd8qGG7ywoxtXJfESKU2fTDyB1TEubBA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:27+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:27 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CB82DECD0610A102189B83F8AF0120D49C1D28C39102-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 5ec6ba28a948e65b4cf0a34e98c1f6bd\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: TPgfQv3EjncX1LJDsu3h+l2ypl1Ra99IwkxO2ySIljcBfAEoJtmAWxuZM7P76puhzWBR7flH5y7vXgUhdzVImHiDwIbT2BB5ZRZ/teue4YUO4vSrAmMk4CSL1CC8Jvc/b5kA9hzDPpNvxAQLisqbkAzkm9peUGED9VVlUy+kcgGT6n9xwT1/k40TK+0N5lpKGVKIzdyUfSlQYezmqO0wK53i5sBUghH1sy2s0MYOYMhx5yz7BK5MJX/GHzQV6uT/k8ri+GraBHZkNfGHPIsDxm5IYeAOjydV2ET0oSiHww8uzwQT16+UafrPxxwUhMyFVuMqZ6P49ruAmHfCwEDXww==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633867\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:27+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101055978?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"NeT5xnGF5XLfyEgnN3KW9d87XK21ut8z\",timestamp=\"1773633867\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"etzc3bhZYgdFlzpMnrqhjGP3OoVFgfH21nQzKZih7I2SqNpppZYG7U/xWy3xSRjTuSdAkwDIZHiM4Dldogxwe9kbID33nhnu0KonAxFD0j3Ix2GfUB3PRtM/Y0hGB/P48liwBoHet8ffDPEmbTs3G9/BlqAA0Cs75C+ehXdfUg9PWq3BJXHJ3XHZYe5ivA/hYEQoxyO9nzbqTqZjO5xEi/D4/+gm2FJThx49f7m6KuqL7C4O8NowPuPFcIXAzvIze4OzZOZQviGYZovi24MNi4y7wk33gqJI7fxJVup1+fGUjNs6EYI454Lrk2xyni0GX+wxTozABtGdmJ/HGnTWTQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:27+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:27 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CB82DECD06109F0418A6B3F8AF01209C871328C69006-0\r\nServer: nginx\r\nWechatpay-Nonce: 2c218767aa19ce2b2fbef8237ee99fa6\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: yc6b8lWPZrTx3lxfA3UnuzUJ1w2/xFt4tpIdgwCWTAKtRo0PYQwGkxwS3fHHnjBZWYYmMPxdB8DDmsIpBdn9vif+Xf93/qqkTNF49s453IdZNisdpNUcrAw5PSnT29iqg8K0FJA7YVlqgdUCoC3eYcwpKZB9uUDMnmt7teDLjVPWeJYq851Q9hTVJg93AziuhubY6E9y29gc0bTNOMi9BblgUJLdEUoBD2EX/G3rvOJA2XQyGPQQW5bd08FBXRR0Ik+hZkEYT90jqIzHSdXEDDjPyt+IsFFj2BqjCtlzVLq0Z5m6qco/ZTa16j8JSXvbiJIO4C46D/bMrmYMxMvJHA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633867\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120101055978\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:27+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101752031?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"y4AdJ2dpg3QKHU7bx2UbfiZRazF5E7kk\",timestamp=\"1773633867\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"VcKhKgjxntGfXNqBgztkeZmwijlE8WulwD6M4+WVb/jE6j7LurZ02HjoTOlrOofQR+FNHa93Esn6C+kjYfL3ExdXvuYLBhJpehQ1d0onDtUq91T9g8LK3C++yyoAocg8PNiY/nOo+i8RNnI2yPC3snXGHLklYDjwlFHKd3RKj2FWDiAeDlFdMzdUCcleCSjK4ZuMMnl/U6FMDS8wmIpG0u6rUpLVT9dXagb0qXVW6tSweS8MHXIXO+ZcLA1xhpOds3YvsjPgbht1o4a8rBLQeb6Ebbj0+r0XWRqCTRuZvynlFSL9UNT3ef8SlVu6cokO7uE79Bby+gGrQdJ9J2LxmA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:27+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:27 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CB82DECD0610C3051884C48C5820B4D51D288773-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 293c3c8ff2c6f2e3feaa3ee4a4863232\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: LEq+UIQK/57URssuAgT2JQVqZRzUMKgLbjiLcQD7sIJQnAQHD2rYqQGgIw7cLuxRsdEXCoCaoHzRGX/5ID3ltaE0lQR8CZ1/2bLJb/VwcJ6mwcDTlpt0Q5m9/0gZToyk3DDEJCu+YdnZzlrRT/IaF8fTnBIIjc0z5bmmyBT/exOLIhPj56gzfA4AyPvKjuwvTTbdNgduN+yDD0UOdV/f9zuu+JCf1922L/78MsR+NPCvKOERpJSXiUp1li0OuVCgP62m3jGpdldJEuNvTRcZVLE074GU85CRfZJTMYaNGtNlpsWwK5thH5ikKk6mJ6NrH4eluL2Y8QRH9c30vylRVQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633867\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101811371?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"3frcTzvstFmwZqkQSN6XdtaGNvJq6mdy\",timestamp=\"1773633867\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"iexX7rZfghsbgaB0LoOmfMsBpR+DZs7tI4M3iyaHVJ31oEHHKjhbtgPcBdwXy0Jo8NcwAHiLMUa6AFhzSz4jnWxJqqTxbwzb33jy2bUj+wTlBfvtHkiePvQWdCcs0tJ71rnDlQ5FR53yl8trkKnBmxB7WjO4vjn2XoIANwRZ8QEMGuzUUDtQm1IKnNmEKAshSj2uJyxQzFqaeViyHEpe46wftRhkI7uUBRF81SOt+33wrfy4+WVhtssNbPLr0lm2ye+SfAtZGckz/8VNQPQH8iVb674dqbW95O0YrixcBB3ZPce1OMmM5BNhG5kYT3C4dWksGBS50+rjyG9Axml2rA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 404 Not Found\r\nContent-Length: 54\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:28 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CB82DECD0610C40718D4B1F8AF0120D4EC0F28A1BD03-268512771\r\nServer: nginx\r\nWechatpay-Nonce: 592da78ca9c6f20cddbf893ff6d1ffb0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: QyuJ1R7AeLA+vWnJRPC0dFceRin4SAroRYH89QnGkhIdfpS0Gl7cVnMoBu3qFzDWzCcntllBBppEmE5Bh5xGm24VY5s4VzMru/bHAJITBxVY00rqcrFLLn+Qd+OeXQohwXxYae79BQuRdqnL3DY2UnNWXD/etvCpXe5AK5OGI0ZrLzbgL2zYSpWL9bDJdwJaEC5exmWLdFAwzwVqzoMZuKFf7fpOQYCdjxD2RymhO5EoDrdkznCV/keluB5Crgsrn/uk5Vd0emOFP4uqOer8I+yUmeUsW608w88ayhTQzjvuJHL9jcC6zrAUCA28mJ9TEgq+PgseFJGVJjLd9Us8Ww==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633868\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"code\":\"ORDER_NOT_EXIST\",\"message\":\"订单不存在\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120103820331?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"aTwu66xaPToIw3YrrR8RzDn3pZZpLwPa\",timestamp=\"1773633868\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"lgMurKWLMlJGxVRxW1+8FMj8buzZP2AW8bfalH9W5WKhBCNxeeCpjclyCEockA7Sy8qBtpHGCjKVAJx6jO7uiC/5RmrmsRQ5zgHEnXUE5CPhwMpoKb/QFJiv7zAqPDIfswPs9seoPisgDlvGr9TPOC4ccrJp92HXPy30LUBdq9TxErsSe3KnDAMZ5CcdrvSjlUQ+sVg/njzTD3337OEmrJp+mRZoEW7eP2ER5/5yfL8J40xJl2ghWUFQAlgZpUUeWEAgcnIP5Gwije0X1ynEKQUcugHT7CHI92tbbPXsBmIZFTprvS15uSIBU31kpiwJ4wiX8Gga4Z+LBCtA/fZenQ==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:28 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CC82DECD0610E70118AD94F5AF0120D4E30728BE8E05-0\r\nServer: nginx\r\nWechatpay-Nonce: dbbaaab6fcb62234debe6af29ce23581\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: kuYCkAbe/9yoKTExOsLUxa31AvovMxDUjqKigm/ZSaJs3hOIPNsCOsc+7+tDL+R1kcBWL2LHTshfVDY/94La1NC2i38P67/X1glyWrJa6WCnHCU0bPjWjuN34wUvD2NECEmIU/iTXIY0NF/FQzo0pZHPX6mGUb3Cw2Pp+E+8zfIAw5H6kihwu3SiGpiJB61a5j3oMYW/N22GF0OUI3BbKrY8IF9pnSwi/vQ8IF0ZsNGoQD2XMyWuPEBWnWRir5Z+Nv3ebYCTco76KlaehZn90cv+08v98mPfBEPSdDnW/rVYbs1cv3lL2Vz5aF4c5u2gJQN5R94D8UfCRxNwUyS6vw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633868\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120103820331\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120104869949?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"VuZaJ6sswpjcZ0DqIiJi2Qzo0K04rC80\",timestamp=\"1773633868\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"vanZQq5CNjsY7c24AgqJnBDSISssvGEuwdVVxu1dsHel/M20+4wuhChXi7vIIslxi1gURQSoE4QZ9KTYBfHg/LMowwU/KW7MRJBYFHuwofe+ejuZ2VL9+PDVatgYLwoD7IiudmcvcTGZ2QzvVONsOcReU2gDMA6Y1SM1kLImeRLgSwJlaztVwuI0n4IBDwWXrGx/FoazoaaROpxAHtTnDK1xB4QJVfoouBu3tPX+zIjx2jb2ASW9ex0iC8W2VEkDOa/fhza6m9G8aWUF3IQYrT7GkM+zgzexbRdb0TRhUnzGACnkNEZNzh92pGEDAyDmGBSdv6unodW24XAPUDCWAg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:28 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CC82DECD0610910318DD9C85AB0120C0A22828F632-0\r\nServer: nginx\r\nWechatpay-Nonce: 5786459e1a63eb108c403f2b73172840\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: TxnJAhr09je8cOMZxo+pErq0b25nom5K7P8mkMRtAyLbORDy0JteKYZbrvON6RCyfOWCb342Qbh5pqIH4eggKvz6uIozza107RSRy4SxPF84PH2D9Q0Jjx1wCiwkUSMUkn6eNS7MaT30HQDR2jF85Z59Nk9DH5QmnfoIB4HP2mrxn66uhCar/82qoKJoTidofxr8Nq4CoGS+09kBrXanfmKtN4vYrGFSwiM5iWNTw03p90kahlRH5YHEPmh4R95sLZLProRdadh7AjGMRCfG9Z3CylADHmHN143S8GgN7ESZv+fVUmz6KfjoxkaLm5XU7ENmy2+gxCaup+zdSui53w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633868\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120104869949\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105044481?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"38VakYGlom0pNcXFnwfvPD6ZifqmU7E6\",timestamp=\"1773633868\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"jg7qU5XaJLiuTZJzjSkbcDa6Xxus12zNEB34NpeYU2I1K2P4a1/bdjATRcXQgmId0Hpdh1ekc3At+fEDXCd16MX61X2ZANtCxbBxnZ+R09MRrH8zHuStIhLrD3skHU9NomiWTeGwYiEMmVl0fsrpgrc4UTRY3cG26qupQsODEoOmlorJA+5p976VwBvGx6yltVNtrLPtUrmTE1SjSPnn91ZNN55gAk5QmCYoROuiHCAA+WvSuAaKsX1lmXsJGpXyRlyIYc5C+g6c8Niz4c+3TPQOhE2mf2IPt4w47zNOSo2AWtEsqBdr0M/0MIOz+77T8YqOV6m8w5OJpjEs2/wX5g==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:28 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CC82DECD0610C30418A181ECAE012086DD1428ACD204-0\r\nServer: nginx\r\nWechatpay-Nonce: 941a16c30c28f8637b2cb0a713c03b44\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: TxVNzdIppU4rGNUnpAQtTNit+7ztHD6wImd7xnyXn1coyFTWGIpoY001QE+d/Uw5SB9mG9hhNYWVdnp0OQEECujger4ly7mkMexfPIOzgcNXRX5IipPww9oFzm/aN0STXXrK0BMKcIDjtSIU/5KJHvNzuANlpG3D0cAOdcKbFU2/IddVuG1tpHViAi69aKtTrkVjsxNA3HRo/DnkZITZm3SEqDi6AAnzPuMqko30UUOb54AjAeGDidvFewjlPgsOk7ot02tfTvOmgVOuwDtsvC4wcw/NoJ1azxXra1sM3bO5bByxXtJ3IEM5qTCDSNUq40axEiSI+l98IZWdLRmRtg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633868\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105044481\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105873193?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"u1bQEVD1IqDHSoynrasTAJ6QB5J9XzQx\",timestamp=\"1773633868\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"T31kkFdc1NeXOMj08xMXp8iFZo9uOLaqBRjv6oehZ1go69g9sNsN/uVhJ+S9F/4Ei5y+ORFS8kKRwUAv0Dp3F7CGGvaEm/FuzgkRvT0ZtJyQAJhlhQ2ef1qjgMsdgjnIPJt/7xwjshZCGqQtricy/t6qrUYe/FZrOK75+q4NtBOkeMqreOTtOz/0FMb4NJ9M1ZreSPM8BExhxgKoNZoSSt636yDHQ964Q5L891iRnm0IZE45ZCZ9Jh1p5PJzy4gCQa6KnBWuQpMLjgR4mb7McZzdFrAutAhuj3JyAU2WGWV+62P5rK78n8UZHii3m+b3VoxdoRUTkC1Hba87oA3Dow==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:28 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CC82DECD0610E20518C381ECAE01209CCD3328A3BB01-0\r\nServer: nginx\r\nWechatpay-Nonce: b173424cc346019fca9fa15146634d51\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: TRsHRfttZ2fUx0VaT6k9ZkpOljPDRZ+OmZ0W2x4ARK9tmHy5/gT1d21W4hrJwh3h9m376Pd7+6/rQPLNLXUBnXLMLoIsf4nrTQcfEp2Ou492tLjGk54izwWx6BtZ/0SdBVIBQMcSvsVSDOTMgRZ2E20F5TIOZDjHluSniK5UvrJcJfq10wAIji9R5BdcrHNOEQYsLirFG+64POK4RH8jbmh1a8Tz8PZZw0ldupnB9T3kPuLztme3d50G7pVDrHwujU9sUILQQxjJ2/ZmPczDEOA3fZjuG4m1xPdQ05hoWPjAp3vEJ9ZDgVTIslfP8m9KLkORzhdUB5qfxq1IeH2I2A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633868\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105873193\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107498697?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"BRukQNlpwNrX6cfC4tjph1WnfkQPw65B\",timestamp=\"1773633868\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"yEFnuRUfFFqRmFKnSywtXxgqPqFyhuogxFM+KoKEuVJyEr2jGllTVNXHJ6gyNN/vLBNzsVNlX+WFbggE2Ocm0PP9UstLySm5ZBpL0nGukMpiN+5hLthaXjVuAsQKq+EI+P0m6r5p2w75kkf72xZoXtNKUmj7Cx6vdFBezFnoDeaAO0IR/+cgpgFSt2ylG4w7MIItWsyI8T3yoD5lRy2u2Fvflj9sx+yNjOfqIouoANKm2InMkKLvP1Xg1KcCgST9mitgOwaoTEZdhOuhMUBr3OtpJOEg2lyougSBzw173LNqRuUh+odzKtVe+LTdnBksw7Q+kJ25enhFhSbMFHkb4g==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:28+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:29 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CC82DECD0610920718D58EA85C2086C81228F8FE05-0\r\nServer: nginx\r\nWechatpay-Nonce: 547553c2c1910dd310283bdac6973338\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ET36r4PIlzjOOQzw5y2hGP1H1QJCsrt1LKF8GjhpdSuRLiN+MNah5XhfDWHZJYi99Uk8PsxKcjp6hS6k2oMcn4MpB+68V3OeZL3bOzPOdenYuvBJNpQ9H4S0hDd1shiZlvaLWu79GIg9ce4yh65H8YIxlon63/fm/9kj2jAJgPaP6GvOvcvnDVPYx9pXSC9Iz3UXUa9OKvS8SBF2/27U8q1P6NMhX5ghOwgNviYq1t7ER9A63JdEXppYVgXjtji+nMuhg1eZr93TYT5xCyLABfoK1nEhPPmVzjHYrssO0XNMyKQsRDFCpJexTlxgyGeOarWvsjyHQeonEujZmzS3og==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633868\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107498697\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:04:29+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107504965?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"zW84rwAambpzsCgVR0CnAaZjeFYVZIZ3\",timestamp=\"1773633868\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"urQ66cQ+FdVRx1aiW56VdEBWg92cnoMNgw0ndSIAFpW+BZO5hBNzj2yuIm01/PI7bKIz+s2W1WkGsuxey2VClaZJnbjF5CsKx0o/KYzklCYPga1K/WCAlJlryUP/0UYeh5jWVP1MGd20FonF9AcaKueSapmG2R+fH2oDK7dXwZrvo/wkNXcEQ8RiiJalOCdz4Z3tCfrhYxlqM6E8Pfc4YQfNSf1/ljLSfMeGatmtdpnruB/yuZni74kM1R45/9ZLVc2IIO7qzH7Ln19wi2uaPb6m/PKRO0653aoK2QKpbL+USjrPqY20bzDPIw0jeLM6xE9tUL1qGHu7hMgDDr/W6Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:04:29+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:04:29 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CD82DECD06105818FEC1C05520AC980928EF9705-0\r\nServer: nginx\r\nWechatpay-Nonce: c65247a33de548fa0cde137f9171a8bd\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: l2l09/IX7mXiWn9usrsAtYpCWyUqeEkLPPfH+qYtOmhe0qwkYAJNyIokHcocbwjjge8CEhyMTIe7cyZPe3VVl0fwOKFAmJU6c9fBO8MURAalRhp1fVBq/6B0c3pmh8j7t12CrFYxpPQ0kgDi+RKClOXfUAcoB9saQw3/2sx2Jnp7LcPVKboSLY8a2v9+YWRGybVd54SiDcpGFmoiHOcDQ1aOgdWqWcpSEkylzAaVZuSNDAA/syk5yoeVYxE2xj6lAN6mnhj9YqYjl5lpO9VgdvcI+vVuMzw+ky3lp+hZSJSAWcVOqytr/nnHKv/1dwrqMN+xNhEUazdgIys3gEkd2w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773633869\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107504965\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:19+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114504200528?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"JQKA0iTDZiX34ZOAwU9rLmxQ6p5ZvZ94\",timestamp=\"1773634159\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"emHAbIwJSnabPK9P6iPFaitja8ABy4zERI1PVZ5nHFvO54qGRhBt+5OHX9k8tAs5BQKPWs6a927unUrfELR8bliFsLC3ut85n86HZd4wrpR4HCnFyqJQP8UPi06mejKTdrK7TPCsvkLLwQdT5EeOXylP7H3btFYVHpHFE5iIP4HLPrPVVf1Al97w0JUC05A+XUKKMufOeAKjkExiujTr1KB3s583UDCMDg+TOmWZxCW/BuaYYUaLH/7SJVeLVVFUcIKq9yOHoxrIe7qHaLxXSr3Uz3EgsPqfzUvnDqiXIoTr9YP6xQN2hSsZOjSUrexuFOe85pFa1fkymHnnPgx7TQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:19+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:19 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08EF84DECD0610CD06189C83ECAE0120B48A1F28ABA502-0\r\nServer: nginx\r\nWechatpay-Nonce: c401c085a45998f59285f3e8366b77a7\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: wS3j2guaLOnXW+++ywW+/HeI+7kfNfqvmu/eMZTDEWnT6TAQdAX3NNeOvhaOFglJnike9QuCGtt2yaGKaUFqRpBi9g5Kq0e25O25iRougbizrwTYXpa6KOOxDnZ5Gsl9qbt2T/kZc4yYt5krLcVA59PupKihRYenVIMWg1YF7A66xktL/9EWfEhw+M+Gl1ructK2PoMSngqhedfjeHdz7h7LLpvgwC79aAW0Bi0Pv8uhhHlKIKLWYW8z/JlUFF+xKmKi9NJyLpJ9PH7+yK5T+Hk72QBlsm+6CYH9patqujufOts1mtJ/Zhl19dKFSv8AWEb25H2u89BGkGbWEWi1cg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634159\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114504200528\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542117722?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ezgYcNFW2g4IsMZFx6vGvVBfZoK7Wm7o\",timestamp=\"1773634159\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Sq7kquJKgEbSjfCfcAVCtnR6ralHTFAFJOn6vkX7VE24nnI7FK7b+wsHR9zpKNX8wltkdspd/ab3nEeypCGu5VTLyCHlav69LZGOb7XSKSG1j+h9HyUlCywWKr/uzJZK1nWDfO/5ODk9yZDVkX5KDCIGu8LFPfR1wVP2Qmw5Uyf3BoW+YhL2vZyqAV9Y0TbbxkoCI3FKe5wYg3AIHE0zJtVjhHnGuSE34MtF1wt8f+ml7AGxfAouaR7hmUvP7BRXLAQjgNAhzrLhpIZJlZd+pqKWZvowwdQtHjrDdcLromBn2wjzYT9fplDygSsZz8U5+2bZ6vcuzexPBJmAqo7W6w==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F084DECD06100918E8E4F8AF01208AA93228E374-0\r\nServer: nginx\r\nWechatpay-Nonce: 8135a1984c401dbbe4830fb37242cbc8\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: TprNNdMVcXdwbZFwleUckzkU4k/YWU7r+avRoetgkwVpgdpsJAReT3BZotMecUqe/dsRPM/qq6kkylU0dYRUM4ZQe+nWLyalo+04Xko3TcbGNwfr6aRsnKep2aedqgWxtgGW/60wsNsnn121MBedZHENiPN/6WAOZxJz/iGCrRcd7/xuV55MTeUmFhlhJG834dZVOixeGfo7sXTleBvqsIaTmLGPuecDxaIcNBAY4sUgSPi4rL9Hp5H4W0QYNDX2bp1Xn8MOOu/jxvA9BNAr5Vg5nQMLuTe4+v1tvz4vOtAX2W7xiGYkfBBvb9+ZAI4I15xdTXFsZCR4dNTr/3xZ0w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634160\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542117722\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542217834?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"6VGBFPyWTvZT6sqUUYFFsSbqKdo8kojK\",timestamp=\"1773634160\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"WJJQfp1plhES3RyisFHT0DMw9iNX5asENz0P4dLjlbHhT6tcyA8N2L0A6eRZMW4vnljlW3OwJpupmLfY/K4D58k7+rWzPAZzBNkScCZEc7A/dU3S3T67r2F+wU1qfYXg5i1I0qiVbgt5sdGnGTzKosU4zmgnws3Y1CLBAe3RtJwA4Co9GE3u4Gji/PFb+RjGnkUXuf6y8LaugjsMnTKe4QdrFd9py3Kv8BQW5AOzd9KdVwYhgH6JxCpt1QEshjGTZgM/C9BcgMDAhdz/uiOgPkEo/D3x8+b/EdCA7JFqEmKSzAE75omhHSbEo8g9AjfvhVCS8BQaiQQxOw5Lcws5XA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F084DECD0610BC0118E6B2F8AF0120A68D1128DF39-0\r\nServer: nginx\r\nWechatpay-Nonce: 1413429d9121883f82eaa9f5e8c70844\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: hXOd1ojNADMTVP1356jpjUEodUuI/TxrM2XXrlRHe8mJfPuzI+VSskLdYU46cnWDMFvOOouBnR3E09YrP5ucKkMKyhD4MzFNW6mtq+OYvvmtrLSDP0e8vaQHhalJvChjeOStb85HUSULKHUThCTu6oMuPl+IsSuWcUBLrrXpKjENUy0upgPErb/O3DkWDgoZKWEaONjWb8MvIpNNWeBqHNwRg9XU1cBGJVPku3P0TSyEefYI5gG3lzKzDQX2mm69loa5nzY6gKxzoWfyHVuecHAserDPdPEJUiJLmcWKN98h+hho2ewKxWWvndX/0thjrSFSLYWZxOKCR7cIgfA9PQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634160\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542217834\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114752369404?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"cbifVj4Xgs2a1Y5KQTc90V2SwfXmE3yK\",timestamp=\"1773634160\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"m/WxZZtmnWjPR9pA7rSiL++QenOt+SnngX3N+DHTXSC6pmvNTYz3karW25gplzhtq76GattfV9GqHu2UpnVPXsWcN+qJ7Xvs0mU4ZCCNusikIP723ATUQvNO/1QRtt1wkroeSvmd3YzSInPUfP8HviY9/Ad77VShqvOkM0z+yIVYeRb+jkASbeHTNjnmC9n54sL9Ew8HA1z3g8NxNeT1rOQHb6t9nEsB/7fHHTpDJTz2Yeai1iCdZMIaUIza6w0ATzVs+TnJgr3r/hjBLuC+BXsbmPako8NO8IsTvzMSHkoLxy5aWPBkOoKWNvzxDE4zB9Q0wPWW93HgkoY/4YTr4Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F084DECD0610E802188AB5F8AF0120FC9D3528A2D003-0\r\nServer: nginx\r\nWechatpay-Nonce: dd8dc71d6d69604904b80f9ac913bac0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: XsDTL7gWllGMVOsSIgcfunSvDoolUcASUxSY2AaWFuw6ZtWqgtGAcfu/Ic9StVmxCus28zxGcyFcoiPk3TbUpvtnS9RYTf+lCckG/tZaOHLZbJEdoA2hXb58xWE0AHfxDEcpe6Z8+jCiB53KrCisgm9KR735oV7SXT9NN+XPxqqkO1ZeU7yfX0e6F+NkEY+DB40JBFEs1zLxA9R1B3SyNQvysYq/vZmsuowZpRlDJwWlz4sFPmCPofhGqyXREcA8aZ8SKicwC6z51i4dB9qqRHqRPRPSexSAm9JwX0zOzRz70jIx9xwcvwwC/RAHSHOQzZyTxS4vrFtsEwSvNUJvyw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634160\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114752369404\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115923493856?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"yBATGjG8aqS9jjjTXXFQ8piYwfIEiuVf\",timestamp=\"1773634160\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"wL4t3IdiphgsLHjfVXmriGkOInNDwHDBZrNrL2REbuZS+hKh/OSFIa/InRLYNRZAyrKo14WjjmkF64HJVg5efK03GLK6sE1df4dxXlVjtuAyFSgl4WND3hCXk7KkkP+7elAWL0/iQYQvaC0Kh9wAk+cN87FonBLf5SgCnzq+W4A8kHvNOmli+PQ3oLmRQpibLRVqCGvdl03XKJ+wRxMCXq4Clh//aM6fxb37w12kn3iuH3kyYwk8yHumWunr4xoQgAYPCGkSwEdBzGwa1xnboMxPirrEci51/xxEsFN0OW0okRqikuAwNe3HWGllzYuR3yDy12jUp/JHbq1Vbsve0w==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F084DECD0610AB0418878584A90120A6D406288E8F06-0\r\nServer: nginx\r\nWechatpay-Nonce: 4c670ea063afaaed74d1a11490a4fcc8\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: l+Aq3rA3zrvwoKt8Suc3/OvIRyDX3/1R9h63wLkDZxiPhXjc20pwx7YHxpQqqBTLhxqH2v7JhRsnrcbQMzrjE8tZwIH/FJJMcXSun4BJUlw/1HWtNDLikpO51/XAZpjTEFbW6BD938bZlvUTYdBB2svP+SXugP8mX6tSmwhE8Wyq/puc8CFDXalP3UFzT0L8i6xt4PY4kGOw0MaGDPs88ccKD8tc+tSyZY31IYEcomUeNS2LkgsQ9DUdYCcYHGOerPz/kUF5jLZuaIhW6KdkE0u8BcXjU4ePP2Cez4y6ObOI4cEdH0we5IFvLkDAXbLL+MGLzsW73x+9UOc8kq0Zcg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634160\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115923493856\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115924572115?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"zIqqaksollgli88CBewEhvBZCxoo7I7M\",timestamp=\"1773634160\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"a7TycPB/J7UOLyDTB1oQqzNYUq76AKxpZN7hpEDbvrix1a2HLXfUihuY8RQPEnAow4n0CEvutksWIEFXb8RzU9pCdHskd47GK2G3UpMmTDVm03xRt+HjyojrqzjYtSwgyYTfJ4NMniJVjGKN5a0wTAr4L5tid/BQJmisEhi3UPhpCQiGVRwB1VNkJKZbtJHY/YPIfNLEf6yyYGyxrB8zIUh5WdzdYEGSj1IoX9gcz3HA1+No7ng7dNeQmR95nSp6p0JY4E8eWmgTuUdUiJHbDrbICZqSpWAt02TZodZgbSR8qoGQNv30IfgQD1eZe5ooePjd38njExV/DIoRrHJMfA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F084DECD0610D00518E6B2F8AF01209EA91928848405-0\r\nServer: nginx\r\nWechatpay-Nonce: 9782caa8f52625fcd36b4c38da785510\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Kxn8baHoOf36LGDUED7s0euWh2wXWRbh4lzLOQT4i0beBMxOfjZ9E/G8/C3cOpZOc4JG3AbKIzYn16cGgllh4FXiAQvRYCfXUNd8fc4m9GBE4O/hx6UAPzm7LiULlbkVPYDeLOpNhadP9VTilvMwS2paxOv+A1BT2CgBPx6LNqt7IH9x/uaYw4kx18EXNSTeMZN9SusASfWGqEgUg2CFKs85/D6TqEGxHO4x4fD7GIQyyNws8XaIuRdu0E6HNGFALrabj6doSti2y0lGR+5QYZ1pmZSGXwwGxwbOI5JJl8xMuQCGA5/QVBqo6kyUHm5GQb1aSCDOBiMFDa6+1/7uYQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634160\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115924572115\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115926060396?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"cj1FAceMxFudMHw0NuX2rol2peKoVYMN\",timestamp=\"1773634160\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"tvwRomeylakOzLc+Ct9S5pp+bloZA8EAsDOtq3QWgm9XUFI2GajxVH3dT2WQjgrTueqbLZT7PSgRuCaBUdRQnEcD6KCmeoHGQTzREUL7tRN1RoLR7Wl9VALCGlESWE3rtYsdj+JVNq+wNKCmoQWt43RhuYM29jPQmxMyjF/7vgrzVLO8DpPX96cLUDAMq/gjBDTVm4HzRTqTz2oR8or6HiNucZe42D9DmKwhd7zB3xLie0DxlX/SVzPPXL1PrOymxEl23su7pYOIugZ214o0jcTpvUodw+3kJIU4lFgs1GRXysnikRcfj0c4J3nsEHg82CIYKFTjeR2ES6EBjV1sVw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F084DECD0610F00618F3C78C5820AADD11289EAC04-0\r\nServer: nginx\r\nWechatpay-Nonce: 5aaa2f1ee263467ac3a3e4e598c9f335\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: hvQo21ivpLYxzcOotiI3ai84jkXVO8ZrNo0j2wtlUA/skdMC4C18t4AySxbnXnu1HA3mNTw/bc8XiBog5DA1cpPbcp07e6Gc43w+Yqb6dg+jjTXhnhmzoZhDXUdu8mIb9H5KbzwPLyGBy9DTEu5LOAAWvCgIPib5lKp+Ey8uKQptz2vp+RHJyuPRLeE+WHgs9aW8GZDxrXhWAOsoa/bOaihMM4L57zmGl/SnLJm4jamgoXLf2B9VMTAhjGzejMI1KCzH7tQ59d5VlcWJ6pTeamvCzHFvBXb1nTruSLHIFJc+gi0PflIyla3mwgsxqUyPeS91SYj8ncyMGYFDnc+Zrg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634160\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115926060396\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115928025998?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"IkyPIsnNDpMwNSZHnzBtcblrDJU9UoEI\",timestamp=\"1773634160\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"jBEhZ+Ix3H0yPdSlvOUjWzXQc7uGOpuUEPxBqyVRcDYzgWmuUUwc4+0Yl8yT2/QrrvDLSnVV1moymhIsawcDrVXAqGA4jcWNCIS8MOMw7J1CL2thxHApF6u+KPOgDeDppDk14aDC1VV3CJgJbiCt0uRV2nSPt6Ogy3UNJoHQsUom+UPoVlyWlyCPWecsOMqW6/Mpn/FZ+wpIxQ7HiET2qTjdRASP41R4rrBKVEgwRh5gQD7su+WvAN4n4Olco6s1w4WyrS0An6J6/xSdFsxzNr6PVAwoqQYF65F/iujM10/Nj7h3K7mxSMOVf1IImfK5k+skvK8NhAawyjD9hyx24A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F184DECD061035188FC4C05520AEBB2D28A9F403-0\r\nServer: nginx\r\nWechatpay-Nonce: b93158cfc6a26419f0f71b584e1af324\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: qOyIQRZkXEQgYXf7gik5jGHIlp4x/TwnmXETezaUrsqc0kx0WOCh/FSqGWiAvcsHkx6Wsn6uKJVN+EnrB89Oz1YcZDgdFVIxR2Jo0A8v0plvIBk9WcRvnWopvy1mVVU0M+v/KSOFPy0YtMuYX5SrESInSkMW+d+ADSDCmw6wM8INh7MBnksSS09u1uY2ITWCaI4GxcAhCcblPAOBvPARsetmD7Uqb+2Eh6GdTsPoCezfSuGx1/BfLI6CBIWiirM85HB7mciwt+ag+LCKIB+CwKZ2HXFLktbnKNenNTBXD2FY5/6ekSBv0rHeQdmpblCRJ605FIN3MHLW7ervtZYC2g==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634161\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115928025998\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115929440151?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"iyx0ADsYgT5r9sS0TImw9AOlXhBPKIy0\",timestamp=\"1773634161\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"GJ2cS5XnPtvVO40WXv/YSNjBtlbz0hTR9BxjTxHB3rZv1iKSyWaJlvGemaTcRjTLZ1uRdZibbvTxNvEKeVYTfdhVyqfOKm3avxaqfbiMrypy2MJ5MJ/TsV903Utxf9/oeEiMLayvy3tnz+rPSGKyc71HAlwSmgV3Yr3Sd3XNVC/4w8/KlnfbIB0lgNdtwNZlkfTXU+UMl7POgke9BVJ9UDFQDOV0Gm004O4X9y8nehtR0cOzQuyeVl2tC502h9pCjjM1nLybwblwq3N1FEnmp28+5FRLXC7cMNiibrkkOjXcEi8BRiadCV5ePZtHmogfwBwaE9cw8EQKotMWzNwjzQ==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F184DECD0610DA0118B1E5F8AF0120DC4528848B04-0\r\nServer: nginx\r\nWechatpay-Nonce: 4bf2bdeddee739c746ea56781fffedf2\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: YfKfXh1MqJVmjgUSgz9A41jo+Jz2D/BNppAIjDq0hH81b52HtyhFaQVLJU2F2h1nBEgOS4xA8olqZ5LOP0KCU0wBBZE1W3kSQLdngnwIAug4ztfkWOMdKD7qTyQ/3dUp0dliuFf5dHrGIKRUY6vkZGsVDaEtKE4wxfgzpeSMAX8efCOe7ALCUvej25ikGmhdI5nD+0WzclJTWGioihae0tfGkKxeev5rKzM0k6Oj41mn39wjuSaXbdrCwrPSez2avgbN7IsQzWOJq8sN40iUFuSGWTpNBgQaCrqh04sYqNEVg4yuvv652jBw73SqXegD+UbMleCqZ21o7bJHFj+gzQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634161\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115929440151\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101055978?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"StushRrbqrIHZaOTfnxOq36FHjPeD7Ny\",timestamp=\"1773634161\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"agkxzWDV+PkGTa42sd7k8cM0GGE3VIyVCXpq40KgeYtbxgepsyDrCyDZ1FEq0GbvaJZzRJzuMzTsi7RUXragCCK5ASetkRrsYelvcJlQsEp8GRRPx0s8413PGem3C/BHFCvIBbCXQ+Wq3IWpKjKStM6J4+M5q+/ioGb07OfRJ8p/uhGA8hMXZqiWu8+Jt4PjC/McfQK0ZQ61m+JII2WLHan/11DebChOT9uJgWEJE1BibuTTnlcZzMDO1bkWw7yfIxIgJUQOcCp0uxkARh+ApI9D/VybRxkEp//arN3QScyHywL8pkLWcFZNsfSxFigQT8fq5TOex8jVzohcHE8z6Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F184DECD0610AB0318C3B9F8AF0120DA950328BE3-0\r\nServer: nginx\r\nWechatpay-Nonce: ca24cd5cd4a28d886ef3c048f24d7937\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: NS3v+P5rre70QkAu4YI5yXA9hq93ZQQjhwXG7XyNFaDVHppYUNiG7+7qe8am3ByR5xn+6o9OhMNsZgVTEgd1lEj3H30LawQa/xyi2Vk3pMBtuPtOYXsT66l92q0s9CeiWu/s3XxWgDC19Xwfe5y4vlLtWZUG2ww72QCYYf9JVpbGNE0XtcvAD4RBiWFbpXH6BAr0ImBGpU+kxHxZLgpgHqLelVFc9XoQyW3MUD4smCDXOo3jMQ9RyZlTkc5FS/zpj/qqWIR5RrUvh8Uzbb39C4GB/Ta9tnf8EUULu//Y/GyxkBt3g3gI7F1CR77iO0yaSOFctPs0oJRuFeGs0ojlbA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634161\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120101055978\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120103820331?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"qS7FC4o61Ai7bLj3Y4GKizMyOhTQyhkK\",timestamp=\"1773634161\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"heKjaXmzABCaZyjpTBIXAf6ShWgiRfBg3U1dazesUamSyC4oaBKBe1HN19qFY4mXAgg/r/m/s4ODfOvwKriP06kObtEZC+XkTsCNeadjNX4L/MIbmI27qMcM5tILDH3lg8NHOLWR+pc/rBncsixbsI6BPbzfIbx2kh9LcGlSpjNajrUwCBcM8gc6OevF08cOCF36W0H/XnL2HjfemJb4beO6oPaBQblQ+kd7NTHINY6rVw8zSCx9/VJfL7ngBrnY6vaUY4mckTkR/cxDVRa73G+mBPTtvTP8hJ0QP2wUsV/haY1aFZBHKhmJ3F0ntUMyWr7mSXrplYSHXIYXCdotEw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F184DECD0610E00418C9E3F8AF0120FEF70928E1EC01-0\r\nServer: nginx\r\nWechatpay-Nonce: e2ebe97e2862412e34b38570b5d5d627\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: jm0xCLn73dOZKOAec+STLC0hqOFHzjg5Av8ARjlNl1xlpP6h6wp8wkYoL9/pxaSZSepS1CavdbzAxwxvsG1UO9p0jV0CU0YGq7YmhSTjnoCenYWeap9IjbHFNOgDTLbq2ZA4vknRZCw7NIRN1J2n/NQGUsHyq9z6PjUpfKzR/Vjyw0NO16BVzq9hIjkcsPJSX5VZfilmao+eIOqJ9vi+jrNRWGar/X65f/Ns0McAHqfwbp1uO173nKimp/PtB+2ReR9fSUHrfnVEAqeyy1DR7laklX1HyCgdy+T4+fwRwnJ4NqZ33WuRoQBVx6apNDXsWj/kVG75e+71183wBOMnFw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634161\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120103820331\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120104869949?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"rTIF7AJeijyJXW81HecIhsGXUyDlGvC5\",timestamp=\"1773634161\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"gI2w8NbLrWfIrdXRThxMDQeAfEQ5k7VrJOjgQBG5Lx878L3zFaR/rkKq7sTamYu0/8/k0kV76RPi5sMTeF7GFO5lybTR7ff9u5MrQ+QybMWFZXOiwgt20QvG1DX4mGE+u9tMxPyHScLcg2W9gdDVjxHOGvMYCQaEi0fx4sANZcoqgURdwuC6EoonZe/7/XlL7E9ztklXP9DvedXcnu7q1ODvKgeM5QrZ0krOYTfDQQRnTqNSf/KkUjJs/mC59VHctuZFC6ncw0HCSWkjTMhmBDmIsE8EMl7mcV6f5C334F4iL+lyz5A2RkMWmUMkz4/U5mTzbehIST6UEMqvKio/Bg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F184DECD0610940618DAC1EDF50120B098042894D302-0\r\nServer: nginx\r\nWechatpay-Nonce: 45f9d8fc56268a0ade962a08d6c59b8a\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: s5nDeW3w9hwC+ynbeKG8bdO920ybKHzSFVu3+TqOYge3NqW9pvCVxySrmj38Gk+T9sVj8L+QOSP9xB7gldDkqmX2LtMW7iLo9dtSZioSJUiTXo1eYpneJrah1/S0hbgtzpHJdCU2ornvkngb047Pkf143LHj3GRx4Cc5A50ksf5WWjEU/oy89w1kTPZWSgbUIoB4Vuc13DgIbPU5KtKbrxHdBI63me6xstZ/Gqig+Au+Sm5eSxXHUheD+1grdk1mcgkqFjeuVYGpk6L62htcasr9fwbQZy1siZmKkdFb9ahhMPilvZlM92a7s5rL8mK3HuUkwEbnD08H5r/jGDp4KA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634161\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120104869949\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105044481?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"oHBaU51jGpDIx1M8N3Vn58C5gfDV97En\",timestamp=\"1773634161\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"N5I/I2LMKDkVKlugLZ6B89Dc2g4c76pJx76Oz8Gr4SAUaMErrBT+Dtu6Ell3dY3aTiWFvd3xWIZ6mTuVOi5xDJoSGQ+P5ALmE98sIKYuIfM4JEEa6IYXQSVCVtjDqOqVbHZg/du17qzdzf6JKr0/q1ECwEX25HdImJAIe3zGiVf2nmqOtzPNJgKoajOxoH6x0pPxsoB7bliVBf2tuZKi8dPKykmF/zC9Wpf3lQZTeF3dkKBOzeQulIeySuXbmuIb+aCujT1ZFO48P87yjCBsjY66VV4pQ/3fPX7HkKrLGVJiSl+8C9H1bhwxZpuk4UuZKahOZSAGdbsnU1kT8C+hnQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F184DECD0610B70718D294F5AF0120C4FA0228CEC402-0\r\nServer: nginx\r\nWechatpay-Nonce: 1d69a65ba571a46cb6b48dac4387e32b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: FWQbocpmNx6isoCCeoVqDWujqTskuptXKJYKwlQOFvuwoQNoof82jpoDW32C7mL4UwdQOpYYqXw2h+n7OghMexvBXG9ou9nE7mejugew2w4HuCSHkRk5ubcrbUmn4qZb82sBeIJsWXBED90hgvDy1dwgb2iJwWkfUzrCJHMMy65eTr8rnIihvvodm9QNK99C8lzhI1jH0YSxxYnCQOVjFfhySXCNwqJa/lgwX5zDiSOJf/7FO8B0W7yqkFfPXXOg1UlVbcCXeWGzY4/RqhUM+af457hY6nadVxOXsg6y5Vidr4VzLDF9iLDme9DhZTgPBHqnS1eOEBZGrSv0dBYrJw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634161\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105044481\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105873193?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"kaBwlttRjRiMU1rNooNCH3Di88eiixML\",timestamp=\"1773634162\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"FYTYWkuYFVg9zAAVZw2cZGE705+3akkN5nOiA7KiBSvw9WNSdWEq7AEXpYPySsNF9yj4wXbkgylZtuUUU38IX4D5PlViv6zbpR/2h5qM8XzN2GJj0FksbUBx+7qwfn4INlck2mq6aQrNQSiAOl7Avx7++cpBV5QULX2h5GIoKAasjdlKmiX4J0E3xTqzeuqcnV7nFCDYf0iLkrneo4YdC04e4rSCcRulsoz7STxHSx0YDZDSo87GiSoRfr9ZrJeUqXnrGbOf4V6rFVVtHsW2bl3F1X74nBo4gK0qcT+5FkQEv7JXc09Mzh234AnmJEFr1dMUYKeA+VkhyjeILDEAow==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F284DECD06107E18B0C0C05520E08A2A28F1B502-0\r\nServer: nginx\r\nWechatpay-Nonce: 579408374a68603461171dce4028b40b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: LwekPy4h8WlWuzokn+lk3eskmDmp88geethe5LBXrXothV8PfYf45UendZw60JSraFuqoD57tKLD+0/v6ZolitvAtXMQtSfzrYZmROfL/TB0X7Szcd8De/Kmoe3A4DZ+SK+SJEHOW7EjERB1noz4efrVp7PvESX2AtFDr1HByr11Qqr99VLKygqnsLjO3XsfVORKxxdIkJEFHuhIkcjQGk3s+7iJZqGXmAESm8dMxOOIlNNGXb0AHk3iw2K7kMH/smI1Sqi1ou58bfhaErnb+WMsQVF+CltLqHN1xt1/0loYoGC52OxD5C7tuU5eNrk0nh35Ix8W2lS5IuxgMjG5sA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634162\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105873193\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107504965?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"sGtdm3jF1xLpkRBhBLYwQWZmsRmPbPN2\",timestamp=\"1773634162\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"oTpdpt/TOMwBTFug08GZs6pg9T/FtPYFtTKyONGh+fdL0gbeliNycFzxWo9Sfob0rywmqknRVzwpIbKyxhh+s3r2+sFKlrV42J2NPIfUBzUPn94xeFsJsQLdQwkoCfp8BNMGkn/I43rpNZR2oP7b+3L59j+HjJQ6huQLME37JGgbkWUz+8JJ9AV/0JASstJ2yUGo/9MqRo8GON45qsHCvdL/RFtd7dosHbnHD3N06xFWD0I+FKu8yjeGO5BD6SWu2fSYYyVFfgI/d9v5m4yGMW8mC9SYvNdBeqa1sghA8PO2D+1dTU8h7CHyYheKLl6EalC+5rJqxtC4WotkM6W3Eg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F284DECD0610A5021882E6F8AF0120FCE6312895B702-0\r\nServer: nginx\r\nWechatpay-Nonce: 2838e66421c4d15ec46d3af7128fe4ef\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: KY3G03idBkMlDCoZlNxiduOJyoHY42gC/yVWJ7sbMI6B/q/DVFyHI2YyX9iAyOETyNaEMJKC7kH5FMuhv1NI4+vYibD85yywmk6Ol3JElvphLZe0vBNwEns6aCubKsCZiOfFvVAuNbzbBzgKb25Pq+HujrWXuc3yRsG7DtZDaAGJwXVNMLzIpXdsXdV8GhpZM3/JZz3WdI1eC+0kiQFX+ods6Fs53z8Lg3JPuStU+vPcx2j6NbG4cGoQwlRxDimfDk5ZlM0cu8DmfCWAoBCjGMR5U5yVoQv35C9+iBR+Bdkk3POtq6miuRW9N5bcugE4AQ/uyQzhsMthcNcC3UOXvw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634162\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107504965\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:09:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107498697?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"piytWUbCZihz59XITZ8iCIkHnKYdDEja\",timestamp=\"1773634162\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"e6Qhi2GvJ6Qy67N+nbOOOIxHpvAezt5lUECYJX2aOTUVvw2IxtFwhRd6HR0wmF7B45bqDmt2/W2u1Cd0d4DQ1CuHI6Qz5DMdPVqq/CNA9/u1+s50W2j04k68EDprLznG369lIq+tgQ6OAQvqJ5tw/G8Yy7l38ZA/+VM1/xYidqiT9hfCQ9HVXvdrF+8IWUtgdEr+oxv6PZIYyxzHcfWja9KgS2XzAnzmOvKNInMqYgHlyPxMgcBg9nFTEV4veiU+2uiMxPuoovdgOtlG2ScmHc1Pl/M7YA1gCPcn7ED0+O+ODUTMaKvuMsGOssW/qxsww/pkK7oUcS755zKRwPSiCQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:09:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:09:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F284DECD0610BD0318B9B4F8AF0120D2A005289BF003-0\r\nServer: nginx\r\nWechatpay-Nonce: 8344c9b7f4205b4e1fbda5937d64924a\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Jr5h+IPPbNBfZ4bns/7LG3id6HuPMpZEx11huXK1dUA6dHP/Y9aWbigrUFxaQzpAK3dbWkcoLQJh5ZVzwhwvbSMI7W2UC2/cG16LmVkBw0LTMxXI3+hGCLY2TYwDFVuSRr6yEnCIEiDTPtvnWhbBRCiPNaQkdxptR+p3+2Y+obPSAiAsk7QcqdOyucfmwUgVCayauFJG6uR2xlzMubiKqNaO9sWFf12TEow1fExYXFedJFf5hTLYILYa/WF8eoXRRpqceAwof7v9daEHihbBTJmmwO9oAgkFWlMr2Gp1aMVpDrknPylHs49fufn0i6etjFNlS9BfOsxBM2tBUtSU5w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634162\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107498697\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:19+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114504200528?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"RqYsrsuEHfNgCup55XIwFPMhyHJFjonP\",timestamp=\"1773634459\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"2CUVSkYhaxb9PfriwBqYlJoc5O0LJ5TGfGABHz78K0joQcoJGf5yQv1oHhQDTEV5Ui4JB5c9aRZDJ/n8fWf++iXAaPOxkrQ5ZVyX04F8tw06OcUU4ljMr3Ao7RaGPMkRBRKLuQxJlgW4UKClFvpefOA3PULDb+RSGRKOQPXh9Y4tDI3cB1Qtg60hmb9Sp4ozMiHSetCrNUFhnZ3ll+R7O8bZeL2frVei70s5tJqE7yiaEsZK3oK9ptXoJsVFhgUg7TJc+/XPSTQYAhZVuQnmiCiWsNVb7mmXcZBZYlZ+uGZN8UQZfSrAcln5KREW/pstHP6AzAgoKK8NjK8y6f6cQw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:19+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:19 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089B87DECD0610B90618A3C8C05520FCBB2328B7A005-0\r\nServer: nginx\r\nWechatpay-Nonce: b49354b857a2b009502a8fc4a617ff3b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: YGG4Vwcp+jVKtmqqOSSYAuCyAuNdqQroJBShBlEeWnS3JePPU5dNhNA4+z1u96VMrJu0891zhnoOKP9upyolnB5+xD5KtWofNnj200Wwk2ihaH+BKWBYimk3n/Ybn6X0tDtjUCm1HRzEZkXeW+SxxLio0WuDdOcGTt+pwYt+OHKxA3kd+q/efWhEAyAYNuAcvA7a25FTIXAznlvtpX1kIosUwAXdRlsGFZRMd/y01JECFQ/uaK79i2neFBXhBLUUKa3hFGQNfTzxt7a89xzaGPa02CP9rv6xofKutuX4i+sdfNjhIgSl/jeKelJHorwJvNESdetzytV5/M3MH7gIbg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634459\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114504200528\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542117722?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"36VaIf19WDsgo1lVcrKUPkzY3G5WEJ6Q\",timestamp=\"1773634459\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"bL+Yrj4L6dOiCmHAFqcm7Sk/LDU1NubE1qs4h5Ij2DkfWhDOFJ8pBBtpm8dFOERvPp0DGlmVtswjMzGoelGJrtIl/2Bd8hszPf+rLB9K21583WG49tr+vzQpkLpTSfaiveM1rz7ryZkzCb7SG/q7hgKBHoFKWLApfdU8l2WtTAPn8gAxUN/qCpDHLf2WTxXAhSsX1QE6RsviwgIjJeJdzn+OgeA3VxtHGQe7VvCxYVbTFzEUZlypP7d4aWdRB3tuE+OI/23M/PfjSnNQyaU0pHIu1qQeTpOVpcB9+YwCgMIbjhkV5FXp6baLG7iAhrozeavxDOEC+T2hMgqFkGraPg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089B87DECD0610CF0718C697F5AF0120C0812C28C98203-0\r\nServer: nginx\r\nWechatpay-Nonce: 332af77a641a25ff1fe3443fad25606c\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: CP0cNOuGdn8hIesJbbALuAvjQjVJdxanhoxOqI/Ax1EwGGGgPvFEOlPi0ZS7ANrkk9n6alGYRSCt7bAwHDu2Xj3tI9iF47y0T2K5WcjhhEIr82mB9b5pJkivTdGIEldoSzVSqOMEjiooizpKpmLTR0lVsaCHzv7JWKg7gM3q+8OG4TVbDvyrAxMbAX+CeP0hSzACdSvEtnjqTRniNBhAmkEie2rnxG3qe/tJMTilnWs85MYYHBzy9Jwtn6zBwy9zlipL+yoRCh9Hlzq4JCX+ZZqhvHMTeXUBW+ZAEBiFc5us7Qy8zrNRvcO66aUmmdBvCiPJENbSFUJFU+iNWAinoQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634460\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542117722\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542217834?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"UajIEueHKUQ75wh0cgG8VmHG1keoIr22\",timestamp=\"1773634460\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ZGRuWa+HnQMbUfzRV8dcGVM5OiGcYShWKOaqtOYeWxPB/8E5VUpZCCZgZdGoENHs3uJHhhUa9xNJb7KMsrP+AUoGuFYOWL/nzWwkgmZW6CCO4DU1hSFKRxXrjPi9N/G3WLqbs1dM1Ri9K7MW9c/JkCOyJukxkUg7ZRt6nh4SBjKy+ir1AuCGBaB1EwiL/UkBZAHbFVWK/3Xs7AYz0KwHpT376d/4caOZt4PEGpW1qPNrYHgcq35fOkZnkTOy3cmdrgU+MaBQGb01TFaPnnzZlpxgC8sxE8mvNEjZLS/+RgqTMOm35ek7xNTfUxqoK70LHkNFRhU4L+tqfItkDqXYkA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089C87DECD06107018CDDB8C5820EEA61C28BCDC02-0\r\nServer: nginx\r\nWechatpay-Nonce: 03a61defb99aa94fa7a1e89dbe2aad68\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: XPbb1mzi/9nGQvDMe54x7LY5J2BAWQ8mp+viiv3jTDERR+yQNfdw8ppaPr9+sQ8raoL3OLqg/WTQRBMQ6HVPSsxmH0BjLivhNoTaDt819PD612x3p997wEvktjYnu2PMlW99EgUvU8nyeZpGLXowhWKvX61wsZLQ8XRa83jo0d6cspabPbglG+xCD9VGc/cE9VCT7pSJAK1PtUTwyT0+d1SqrvacFd6EfSu8YwMPHU3hVgS0HWfNTuUnRZRnKVXA+eO/UrfNiCWNOH94h5uv45egaqduGtLUvNv2KoE4nrZQGZgQihPPBHaVJPhI9tCeUINRZqhMfwTkwwIZJotUHw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634460\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542217834\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114752369404?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"IRCf98YGnzXn46TdPwtpY3CCZ1ukKY0v\",timestamp=\"1773634460\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"KrEQISYVYaVflnCgL7tBg6j7cVMx/eOvBcTQyCizC6LVesPlORdPmSAQBzH0qEVlOFlVZkMp8RTAD8NiLDqRzkTGB+29PMu3uEFn8i9+LaKG8hqU8mB0WfFlO6tWEGnJ8Q2UY6TvnCjz3zYhA6V5hLl0BGCW0oeZx98UG7VTmKXVoYtXcbQt8hkUmSFHIcur5lM4mAhLDecgQ3zv7ohBk5AfEUUrW6rL3ASH6H7B2rK/Mf2clRudJbOiKrcsrEK4+mz3RH9Hgjryu3lBsX66RxtmWLKWxu2gvCG3KSQhcGnagNWMVspivs70pMdoWImx9mYoO92wdVn0m2qf/Bg2cg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089C87DECD0610A00218C681ECAE0120CAA11E28FDBF04-0\r\nServer: nginx\r\nWechatpay-Nonce: 0bd0eadbc27d6b38034efe2e94a21048\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: dKCAsvXMHVmZU8CgNqPecN/URfxmvSYKmUn2ACtBR88FWAITH+273ju4zNSqT3SegBmhc2hRpPLYcBVC91y8QP81btyOiT7l96oJpf3WDK0r8LfkVXds1vwcg1dZqlIDEzEPSu1ye47dxaVWFxUem3x+XT3QOiIsEm9u0WRaXCYxE0ug3RJ7VfT0pAPkqwYCzOtfDsVPiVGYFxYLORFmBsd+1EGE3D4fqnK0fIvchW0rQvZO6ehoq+n29vX+Soe4E0bdX6KppLctG9vlmVAJ7J2VpQo69xzfmhqT5OZQT87zKrg5DvLbp+c2yNUvryOyQfo6kFC9RCcktc1UenjslQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634460\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114752369404\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115923493856?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"qlvMsBQ57CBP6cpg9JZANvOg4Y9TvCuM\",timestamp=\"1773634460\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"yPWHdvM0VvMmmToKVYmxJxcZpxvRDCVoBp79xAAl1gEKndE5KZkOzEZWKPXOd5Dy3LT7f8aibAS1CI1/Gqp3l/K1WUoD6PXrG6G+f7WTv2QUSRH/vcrqOqkYiw4FdaASAmOa1dM3Ts6ye2dN0dC6Selv4gDNuqIUe+PjmyLAfq6+vxjk3Ge6jkR4s4LAZdTiYvuna1BXoLW8Ca/BYuXdWeg/U5XS4wq2blksF/QZAu4m2QkdQgelk2+JwiVXbANOw4LBG7F8Hs+C5at1fuSzp47y7/QC7nl+P0qPgsMcdEXAKlbKZOjkoLbWwl2KcpyWTVKHVkt2wD5MZFPwZ5NOlQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089C87DECD0610C90318F2ADF8AF0120B8A53728F86A-0\r\nServer: nginx\r\nWechatpay-Nonce: acb5de3f9d67e25a0db6c14f7fe7276d\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: jSfXtGLggC8WO8mkLv2Q8IjyeNJgIT1l84og1JP8jwsnUwrVzIBs0QDcw47Xt1+eIXE1pAxFJ84gKGYBCLeXvG6ZxZQWoOjkortEq4Z33clGGtHecWS7Q35V0ABVI1CDH7pzpH8jRaY2zzoVfp6SWR0i1EOqH4i27rKcMRHfwe335GEFBpGjZo2E/4Dlng7zz60rdszpho+QudMThztbAknVB+bFUxz5ezrIjgAe7BY4t7jVXIVkAVj/+3M0nriIGo+60Zwd1b8Fs2zBtz6r0KkbqK5cIsJCi75eQKpMmseBgYftQjNybYLSBCc2Jwamx5bfTI/QiKcksI6xMbfwrQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634460\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115923493856\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115924572115?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"X52qPmrtuLAanwjxHnJud4CaYQwQH1Ki\",timestamp=\"1773634460\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"IFNzSiV/pBz7VZfir+6b130aFp3p09lusX9Cz219BnvxuCkuh4f0hB7by6gt5bUXKtM/DHQjocs400GuXTRL51FW/i8Qnzcrw2zxpv/QLb3z87kx2MLDRqUU0/70G2sV1kNdCl35KHFoHrN9z+erEdDv0Sk1KZQJb9wsoilqzQe6c9QwAcX3GwVFe1cNApNEZse2MXw154A2qLNic+NQo295dh1c2f4GY2fgM8n85W+FrKwmsC5SSJtzCyaXIcNw0+pVWJGHg7KRaBbQtsXa+k6qIZPo8YNZczyIIc01D/EmtzedSgCe3lUCO7ESipzyNGNR1HsvXpDxcr2a36o/7Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089C87DECD0610E70418BBC8C05520D69914289B19-0\r\nServer: nginx\r\nWechatpay-Nonce: 822437183e007c5b629a8ba199b6f470\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: xVx5mNrnCVa4btWSvq14fj6Z3xxLAzU4m8/Gqch6MjxK16KZ+2013JJyk38BjOjcJP6CFh9t59bJxTeaKqVN52tKZQtp/kpeuF7XePYkjs3MlUaPILab0GOIYlhWj2PQk4W89pkLLvu/t2ejpG+l9N1AaYTFefdN4JNqJBD6NeThYC6+MnFKCnxFHCVgA+wwz7uuFb57CDl/uFbIuGVeV0AC5D2vm0zaLmDxN20UgWGCGgokpafdd8IEVHJX82xbsB7utBJB6w+LQiv8b2wZLRs6uPo7uDXbAPxGAYDtTIQlj7yLCMQaRYN1b72a8YOe6k7UzmZtWokbVC1BP/nYQg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634460\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115924572115\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115926060396?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"9bncESheJ1uFHPzQeNrhDyBX36G6y49n\",timestamp=\"1773634460\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"feJaXJ01OsCB2dkB30gDI9nE44M/FGwkVNctiCG/w3noR7Kcth9n7xOa+wl8jZ3vV+pCZNze3YWcFAPEU04NNA78TLfsGoGjfDUZWP2yTYOLCqkvRCWis0OrCXIoiFO2B9o2wVmuY69RYWzakOs4A91eL3bDqVnKg6o0j83i3tBhb6YY4ywqrPl/LFcwSG9nBQbgFFhqWDGIvmNmenjVCqNFWJD9gm3W0RNfbHYMjZGLrP4KlK1VSMvP0DcdS9JcWRmnioKe7dz4M7G168ynk2EPgtoAHtkVlrowFIuLbhTUZjKvH79OpaEpitZDvLPkhBGtSjnVoaBeqp0qHb0wDw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:20+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:20 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089C87DECD0610940618AAC6C05520DEE41428C2AD03-0\r\nServer: nginx\r\nWechatpay-Nonce: d731cb42c18c753a690eec4096a3014b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: EyIIho04w6XG42mSx/oSwbPnz3w8r6f7I4eA6bsDiBbQ110+brzrrW+L/TiY3UyfD9JhD2gxUHFjC1uGVOZIYW0GPmIifRZqogtdt4Cz2q8amqt3g260uBvyYHnVSrp+kXYVpR+Hp7gplPQ6kq0dwwtwEdweYQ+eDkDY5xObdImS5pfLcaVJBKFQR5zbGp3+Iin+K9CU6jZw0ZbXLC/gB0UjZGQCzZcW5FN3ifvA1GP59mFDE0aMX+wsisK9rx5B/7BmgLST+JtrSxfGFk6KvNVoNRD63HlSU4o3ELUSgn8zmjLxFxqU59uI6BR2myXVEC2c5WuGzcKwvSYQUluFKA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634460\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115926060396\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115928025998?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"GblVTRWTFIBkdHEq0Mj6kGav7MrZ1tgz\",timestamp=\"1773634460\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"rni5tV28jtzZk1UD0SLwXrvcB4tPdQo/03GM+9gOL8GzvTj6HMuuqsPDkDnjbars3isvYYjEIMP9+keomIrSHMqw/xc/4XiKZaWlD338ct28m5zpQnnrL8jJ5g0PjbeHUEiCjH35zlq83BOwNfiIya+aMc2oGoaNp/CiESzqhvOOZXp3ePsa0QfzL2xQ0yO0pGbe413KCrDPTda+3ykoLgUTBRE5QzqTgRX9kYi/GjbcbxfNHDmgNTC95lIglywZwU1MB//SkwtZjR1ZdTXB3W1kGTN3vDyuN/iCG5vbZD5Q39hcyRZD5eG9bpbbzUMCe9hkskF5nLROmYcjsm8NKA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089C87DECD0610A80718C0C9C05520CCCF1128B3A102-0\r\nServer: nginx\r\nWechatpay-Nonce: 78eab8b1dfb6f3073d4a410d2d990522\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: rgoIE/Nd+LMD+2HKxsoWVGPBhCje8NmK8YNkwPP8Z8b2b8gcNNy79Y9wyGKsTe/x4oWg2wnYlhx2nac+zzhoKhQuaWkWMBM935B4OzkFiWEWsN059ZkhxZykJu8tASGtQ0EClHoFuVRJ6QMgsNoIa4kWeVpaF7QE21UBeha2GBl/WPUELg53DGEKfWUFzTkPBjFvgSZHkACxgELoKuLdUeEBO0Z68LszkqKEws6KOsQSc62ixfDU/66gj96haCi3f//RINh6xudpyyHnQW3BVb6TxOYd4Q0g6d9MBwTx6Mlo23u3FaXM+MCJgfxDAFpd1LnvWX5wLVevOKJ+q2himg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634461\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115928025998\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115929440151?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"lgdUVqrnbcpjUKhC2ur1U4pRStc3qnXK\",timestamp=\"1773634461\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Me0rpJmlwztEWvGjeWkVuaU1ta2MMK4dyTSOxNB1fYmmKMCcxWoQU1os4pN13STRfskjzdwJNgAEUqSwXFUsFbOHLPBAB0xE3MiUgDLTmmmRXWeTstUwvqNNR0Anq1dicLo52aevaCFkDje810l1ylk8PQFpaW8RXZluv1tb1K/I2/t7/ij2uEVUC0AoXUHnHe3OqsA2R5t4xnvvd3fDKZO2sEpbZEX0q3E245RD0IPezyVUvoIPHdeKGZvKMHNCg0sV1uSBAqPLJCcZVqnEdszHhdmxWkJ4VlYzoDvvmWqfx/vMoSpI+Ke7YnC+5a8fcQDJHOezBeNLXjcw6OADzw==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089D87DECD061061188BDA8C582082962D28C5A205-0\r\nServer: nginx\r\nWechatpay-Nonce: c750379b9af3fdadf465a9a92c99c3e0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: dLz5/lVgGOiXnn7pIKwmBAwaN5C6G1Vte9GNkubNh3VcwwXZUc8CLoNIMBwlw2FItQqENAObNiFffntpeFu/EK9l18IKBa6yKfM9sZkZpswOFR3uru1mRuxr8laLeB34RObwWNRXYT5QLfMkVjyJ33apK9t2Myc9GF3MIwg8dk72jsc8o014op7Uuo+M7tduMBp7ahnLeVyPs5RvMbqx7t5ji+OBGU85ECpMG1jVAnWEWufju14/Wlml0mbH12U1O9Y2zspuYsoJzkGvE1sENtUw39jjyjBwHAUBBF53vMDc0QNL0bj0GNWhYZ97L9Or+RCfnKUsAXpAUTnGY5pkXQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634461\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115929440151\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101055978?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Iy5832OdVr0ZBltKhCXKzYnPdf62NTbL\",timestamp=\"1773634461\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"TxVBXYLXoQ7/NjPV1DmJAo6vuN5JZv9wjrl64wkhEwFnPzB7nxieOHHJD2x/1Xhl+mnCMitpfDeOR3vBkoSi3Z4F7T6y9/EBJa8evM0XBGp0tHU12XTkK1BHAMEto8+5wYC/pjYg949/lR6b+5ZUGc43mojL9M/A66U1e+O+vkNDnSMBPoNXmdF/zS7qh8jMWIGM1jrcTZyDp2tbzq+02wzXzU9oa91p1AfH9s0EdQdNJuc3IvGHPXMokzD/oZ2HQpQb7NjRtAB0L7CSdBKzrGLtN5rfEedPv9omk2/kq9nWhoFD+k7yw1p72vj2jXaHg+U3oJZilPpHS0hTQSgHSg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089D87DECD0610FC0118FEDB8C5820F48A0D28AEFD02-0\r\nServer: nginx\r\nWechatpay-Nonce: c6e0774199024359d93ebae90cee0d58\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: eIckyPd5Z1YRrq4Bw4aMFmskod4BNj6sLm7jLjry/tmMzDg2u3j52hAETdm1SMnggIwUJJNVsLRbYkFA/ULxPyp+1+jE9fgJiaWZHYTXzQcrhywRx2OuVJ8h0LTVs6zxSdA/FAbE6Xz8WF8OjiIqtCGPVuKumiv4TwC/VPPwlb2q79Jzb2u2W9mrxwa2cM74gpP+q2HF7T5TH8Z3ARkii96+twsAPZOebK3aOdgd3cyRSjusVGBWCERy5muWb3CoSGUUeLVXzc4KU5w8sAezHesHsBXOxFUXrYlHYX6wc17xVyEZk8/auMFEACVWlElLvLEdz9YO5pxmjcwPNx1Ekw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634461\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120101055978\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120103820331?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ob7nU5EkpeZ7n72TUVojiMMmRO38Wsk2\",timestamp=\"1773634461\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"oQ6yNu6yY/BF0OWXvMoIz5/buPj9ll0gfZVTxvHqvVJmAONe7nTpwfBBPvBM5UDeFhWYl4NEvOZfBuBrE+iItO2fpK4D1Bfs3MOthBchVRcIaKHAavqp+YVV5mXhxjqKNEEftsOrRmRbs56plCoOimQ9h4nUBUFpEbkrTg2B5oMh05KNsCmcnjkfW5vGDohsq8mQCr+IzzN9aI5n9HqbMU9S2j1e2HPvL8eku+RpjOl7YwttOqc7VyRM5QkQmOJqOuvPeDSy+c90QPCM0GADZrL6ZyuQbPjs8wM2lCZw2VvCwiBZLm7vQSnRqkPbqpqLkOxzMW3NeMg43Ox9AZHv6Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089D87DECD06109C0318939085AB0120B2880928F5D903-0\r\nServer: nginx\r\nWechatpay-Nonce: 8c2714db1ebbb4e597a48eaeb8aac678\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: KGzV85SWvsft9ItZlmTTLHhrCMsvV9Q/C1AO0xIKKL9xDls4HANmdGoOuY2DcJBBu2932EFgUuKp1pxZIiXkkcPZK+60aeaW4l0Wt+B6zDoUzWJjMVXzqXeZE22TT5bDXAtOurbB8GQzvVDtGqkvZKYwSUIJE3bwf+wDjYdhhdwxDbnEWQPaorlS9Pr2YKYgPq6Pa8WazLHgPGmDCfHHnV5bZAqZ/pj5pKARhQF3DaEdp7EjVI6YNO1xjFZzQ4bt93NBbqWS2hHu2Iw48l5o9DwnvcPVIqHn5RzipQMruv/zvrFvGGcCZYE4fBrn45KA2Ya7ZquWHOuXkLCbPMN/4A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634461\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120103820331\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120104869949?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"AIVTI3as3pUDX26vcM6dA3E7FCnbV8Hl\",timestamp=\"1773634461\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"t4P320hDm0ereVoDRKMsVhLokXiUISRsgLUufcCdQpV7Qs4IH17ZZN65Awyp2DUMX45UBBgYwuI+EnambGo/v0u4/e8oMYNwURnY8Z8hYHxOPY23Gq3NRIkcBU1N8P/DorRYDv005A8UDcpss9WA0vaFlnnMsR9JqHY3toFgQ8+fzodvZCYq0EC+bvZjDVX7qZ4zfyzZtIx9HapivJP5QHcJDHw1I4X4SuRQM9LECbV3FOQQo4D88gxBQ2zoBdbb2SrRWePegS718R1SYf4hRuT8UkfqdR9JFSEXORSWYvTSJpWwFYCCik76u5and/ZanudunpLlRjPSbGtMmANbEA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089D87DECD0610C404188480F9AD0120B6F21728E49F04-0\r\nServer: nginx\r\nWechatpay-Nonce: 9f3be518737ac0a9d1073fb3fe07bf29\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: FoYOw7JaDQIZUKu1OHnqOAj2UUJ2L6tHm2FZyICJ55tRAPlQEKZH84f7nQua0XQYr9VXPS0BB657L+4tCBMzfns5tEVqvczhG/vj38SHRLLP/ewgwPfywXQo7V9nJl663FTIpDj4uKhXk5SVsjaT1gaOrsY30Fz0dduQrNn2t/Y7/jOT6d7ZuN9dmIVqRK4KAuVfqQwZbd99xq6MvFJJnAEeqwveABMTlApQ6wm8rh88ajLfa3FLBFnrITBMcwi3W5iaYZPjzVhMpECTO1PzrcGuKJMDPPS0IoSkjdAg1pYIf+CYRYommWlQ/au1yZCWpfKcwwNG5iOUtkCyo5tDhQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634461\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120104869949\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105044481?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"UyZmeIEGM1K5vk2eIi7Ll5647XYQHXpT\",timestamp=\"1773634461\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"h1woC2P6dWbSUHAJngaH8NJx/eapGH9fyORbesk3blZGjvhUizDYYw5z/6CEOCmyewfPos7qBFuzSwHqZ5MpcAtaBxXKVRZsIPxIbcBYnbdAkvK+ppCeVBZKf5+bq6QnyKXmAaUfv1S77uHGVmG0F5tgRwcLis2G9fXk2jzn8+lw/KyGh88JnQRW8mEl2P+h+gV9Uq99PxomZc9+p7H2svNPVumTt1tQjWQZc4V7AJ5Eka1PzeXp7mkMzWGk6fYriT6Lyrz1dfYaHEhE6S2ktHGLLXJQ7cwTtrALXhW6V+XbZ2i0HOf1sg5plzbuu0zNystS+S9fwxhGJ5tQgv0tTA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:21+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:21 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089D87DECD0610F50518DFAAC05520C4FD1F288C45-0\r\nServer: nginx\r\nWechatpay-Nonce: 53a5390d791e0554b391725e828891c6\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: NMRBO31gM3k7mE+bIqqc+6q34FeJYZebGYOM7js9E6SsIgKkbzo8QCMSyJMkCaeGOTCmxj1GqM7QcmbU/LNGKLYFVLunJMKTE4ARe1Sw6oQPhagkoc3HMkPauVSQmqB5asXXSOIufCU7jvYr7ju1egARGudY2WMH+ASH923AvmtgrklYlL66+tuH2FYQ4ebtHGnUYkI3ts7kG/reDSmr6AMgZVkCnXvJ46K7M0mREyWd7DcaXHcvEDTLppbBNqILwf2Lp2w9LacfnErN9tPPyWw97X9d+1/Vw/Ij0aRzO91CoANgE6JPYoC/PYTph1tduyWogJG2HeOOBI28Rv8UFg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634461\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105044481\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105873193?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"nXG0AOxuREPbA7VOIrd99BtwL3Zcej9x\",timestamp=\"1773634461\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"kkixhH91aZkvWXH5ptvBzoKHI7qrzQ4HS9LHrYTVk29XYqZreHOcR+h/itIZySTk5pTY1yNcH3UZu8762QhCnXDHIEZ10zi2BU2EyeiRgA5zrGEvxm08l1FBqKE6Haur/5JUPuCKtDE+B+s4WyfeDd4hYrJkTOoykp+BgnWpBlops6s0rq9liRyIc431KqWfy8D8vynBZufRXM3+/re3ZNltHOytODNGlyYadne7RC3VO2esM60F4JcEV2QLbAihODSCAo6zXiew3ezJS7UpcLZbBPlycxmoEOBTY2sDixlelHFo61Dpuo0FxB+qUhyPhHNPrK4S/IGnd/gawx5ygg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089D87DECD0610920718CF95F5AF0120F8C3012890E904-0\r\nServer: nginx\r\nWechatpay-Nonce: 326f056b6021bf1120b1ba2c2baacbbd\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: wNj/Ett+AWOyYa3Re8O0VH2KBO1jtWawPTDqihrgzFU0DuWLZ2ZAz7TnAayKGJLLlVfH8fpcphbIIllQYlF98u3UQr8CPcYOxpk5lpxCL1gpvjwkn90Z78zNSHYkWdAKQzViO3sSUtwMet8nk7zV5OsrBeIgQ2Bg3qfG5QsMdy45/Za99ufiimYEH/LCY2cTiVOLYfagh5esVHbnjoh76rB+2FSagVZgZNfxsTuQJgE54RKblr00DBWHanczpJcev0dR14BbUSua9MP7v5hEZytUVoal7NneAnFWMui2ghO6MCBBt1eHJJ2tQwuvTSK00r+/nSK45PyTVSCd6b+scw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634461\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105873193\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107504965?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"gZ8Q5du7ebRkdksfVVUwzHlGqTMC9749\",timestamp=\"1773634462\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"hKwZFX2nGKCw2GtwJ4VaDosUZ+1j5e27+xkdmiew1CI8iOa6FU95vy+tmasaJZFQaztqIc/pf2C/PrS7ElID7xjiJjArGKYInuNRuYHuf91xMr4EzR5WvyFhR1zaU2uvAstc0b0R6SOZdyHQQWMi0uVG3R/FUg2Kld3Evm+o/I4Z6Ennf+pydGEKiGL0KT/vgSVdzSofsMXPUUxeAFsAM2kPUdW/XK2yDGysoZU08qgMoMoiRD6NC8UAfKUj9yHo/8A2Oy7rRdKAvsQVShiYXtyRw+y4jycC+e1+gA5FINqGv688mco5P7nI0llE9mmGO9ZP2MI/INnWexGXumMGuA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089E87DECD06104318D2CD8C5820DCFF1E28E9A904-0\r\nServer: nginx\r\nWechatpay-Nonce: 45d5262986c7258b9966d7699e87a8b0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: WqoIV04fN+bUl4DQ27rNbtMcOg0tMloafShDSlpVQoUVcmXoRfiAUGLK2e7YMYCjop5TXp09qZPIRXFQ0GJHfm2I5Ysz2fmQUGzmndyfl/ypD/XDHO5gTIX0xC6k8QzZf61tT4eyv9v8r8FOwsbvU+E9OBymHx/Iz3zaeigtlXopwM54FtkC6yIqgy0ZO0/ULKlq5+T+3B/ev25shD2PP+WHdzAR+4E6tYbbP2KvtoacdrknPTvkg5QKh97QLviW94VrLOMaf/z9744vlBYXHy5nazTiZeqv3JT3IQ2b5HMzLL9srYV7pJPr8Eh9h/XYyw59zhrrUElHEc1/TKBMpA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634462\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107504965\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:14:22+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107498697?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"9vsXS1SizwXOE5RPMmRfsndv0FWRbnZy\",timestamp=\"1773634462\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"0zCfxSue17ejZ9XnL7xHgAmtGP26a4nazQYlEiK1ZPRdgzWbnoSioJ6g01fUtUiYk3Hkjc0UvMzDOlf2+iz7WzRx4vsFJhwSUgKpXX4ieMSNn3XdUxZfKaHpW7h5sLq5XVn4nCc1Ek7K/erbKjLNHrSywNdLFdFi3DzxunsAgK349eiClLnYf6wkBs8rB/vGh03f5VXDls3qZppn/64gtulmUHz8rY9tIYxMcHRT5C5U4pmUAmH6ognYB/PZBrSv3wJ2DVCniyVjgeQZjCvjb9Aq/jYyP3J2JN4tGyFv2662Y5j5HxPcr+q/S3Th4Msz+9JUgISYKFwHO+jTDhQk/Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:14:22+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:14:22 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089E87DECD0610C70118F2E4F8AF0120C6962528F5C404-0\r\nServer: nginx\r\nWechatpay-Nonce: 010225393f79c2fbeecb9f3a1c850d00\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: mhybcGh51XsaseIE9b8DwqQ2KP2GUySCUWvsScIcsdmdIgYw01K33TIOlDHqgee9mZZD9/ALOUm49d61w4ouCsR0acsV1coBa7Yvz+A0fq0OjkOI1NvyJMgFHAIJiyS+VyO0JsB84g0PXknc0EKJENmpaYbgUcExPigG6HkjDHc+6YU1PYQvtMMvP4H6Q1K5Oy6u7OaP2qtopb9PoPGWSuWRsPggcJdvtA1RTNdHO9xgCL+N+YsoZ8ity7VgxLMZWf9o+b6ONn0ZZWpyuOBEmPIZ/2IOf5wIzlQB7JmZ/qkJZqbdn2/wzrphBQWGrXfoaG7SSH1O9+//se5wRdhhPg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634462\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107498697\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114504200528?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"QozF1AyP1hCI4WkOAfPxpEUT5JwcIWQV\",timestamp=\"1773634735\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"o3nzNLlCfYB+f2HVKQX5BCxHbV6SpsaCVDH9SLraRna4t4AH8myvSPpbBS57VF5dR0dpHc9idwQeneIGh0F+1IqhZMoLfBlrx8tIqqp8/iOFj/UvSvHIcawfNLEH/dOVHtJd7RadxG5VedOYWv6Qi8UweFjQnDBsDBGw0eezMfXXhkCm0NnKqt7RNGRY/mL/TnW1+Ubit8hBKxHac22jOX5w8SODXOqgfImBl+/awwbDzYhkd46sRCo35WxnDgvp1M0nZptR3Pm7DIIFxmz3vhclklix0b/k+JqOKQUIS7+tWiwh30C5PqH+vKdzv92hHRDCYQOjct7ApEGG+LdQHA==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08AF89DECD0610CF0118D0D88C58209AF12E28DA08-0\r\nServer: nginx\r\nWechatpay-Nonce: add4020debef15d0e75b735c28c083e7\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: PcXMua4aEGO6L/L5JR/AhQ1IIhgMrqcYpj/UgmsC42T3MQ+en1dcItQ9w5tGYOHobScvXQks8GLQ+4QCZSpgu4mugbMgbRBEl0WRMdqA/rXbTMrVjEgDtXTi6AjI4MKt5eJydnEOU2MIcfZEdrsQXTi2x0sxEbalrU7QQFyH0U2q+G4kZHbUhKycFTTIZGN7Ktro5Et6NqH4s/mNy4kbQS4Mu3ipzsXCf8f3YseFYEHu2pPDM22Djgmyo9FNMx+fDHQRjFmo1tyaoWrWlGdi/A8qdzzDqaowTUuUZ/nh9fOnCw+2RQKV28OFDKqQOGwZYIU3NGqXz+WAaKDne1xucw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634735\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114504200528\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542117722?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"PPs8UOu83AwjDHiXmcBJB8WKLhaNUl66\",timestamp=\"1773634735\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"fub/pe8QkM7CQwa9paKd4u309Gbp8bTCDYurAMHx0fNYk4OVc4nYnwf6Vszca1Mn75ZY5jemWBFlv1X5MXzmNrYK/wt2IlybAMzZo3VwfrbztApe1qVE+dJt0N9bMCOZg9QSmQIAig30IliYIwBS1oQ2sjq8bWRvTqSN/cxf5zYc9HP4pbKATPZub3+DukKRs9wd+JnAZKTbBwh7OEiwHbDyjf+mi2VQM+eyX0S3D3zSlBdxaUm387zYDeIpEuRL07RYuH9108QxA2LHTUhn5Nb6KpAtlZUCuUW6G3wnzaipRHmxkOQZZbXwmGLxbm3IZtjTUVVH/XONup4mbAsz0g==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08AF89DECD0610CC0318BEB0C05520CAED0F2896DA04-0\r\nServer: nginx\r\nWechatpay-Nonce: 4a0fdffa2e81be03dfd2c8b1adf71af0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: CJxvn4Ttmu8I1kw0fYmcG5S5/pOH+TBrPN10Y53rVqvAcoEsQ/rXqs9tcxJlFhQJx46fH8OqOQ/E/1uo0X2LObXuD2s43EMLbbBH3kOzf1eb7RObBVvhCE3FqeOKUKDPB/VcuXr/ldQkkg5dxwC42mQwun2Z9CQMcOJYdNPFQGiX7tg+WqnX2op1Yxt7izGhOQzLiaPnEVVyP+SvUouJO1Itzj2Qvay3NzOJMizke751tQQbTxINULjQvFn00/QbOahovuKppUUoV1StoTyB7HRWM+6gbCqchkJCLf+OsZo1ze26rKFi3NQg+/A+oC5vtau+9MjOUfmgRtqpbC0bbg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634735\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542117722\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114542217834?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"MkWiGPqvIoCf5XkKVSUxU32WjGGZQIIJ\",timestamp=\"1773634735\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"2f66UpAtEcuce6o0Lz8Rjxabmg3OQMOyZgg9xpbdEqF/3IJUN8H/1ydgLID4gJ/sOdFbGD9nT1TWy81m4Mnq8HTAaLS9dlVuDwQuYorAjO8wj+GuK4bZ+RlaJ/Oy1vAJU6zQwKronVc/qpUL+VBbqe4AY0ByvAtTsaSORC5+bvlfxg3rnutMLZ0Qf9iiaO8PKTqnPW2mfsaPCOEA8lObrNNJiSOqBq+r1bw4yGfjqJDa1fcel9wzFZymw7rzu8wa/gcsCTfi15iD4U9+yj5ncdfw7LmsMmWw0DKvpABSxh6sYfD4etssqjd+eES88XxSVc+oRplUZ5c1O+xXOYWwZQ==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08AF89DECD0610B30518ECCBC6AF0120EE992E28E38102-0\r\nServer: nginx\r\nWechatpay-Nonce: 40e5bc70f3b4869885668bcbc3c18025\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: mYzZj6G42awnqQzZia9MZ6SVtxHHI9qV79Yr/zVm3tT0F9/m7s+b78io/58MTKNN6tuKnCNyCKjJP0UETEuwcHCi6VKHeielZny5wpYgJjfU6jni18h6Bg2/EDPwx/JrJuDhGLvu+tdtFD/vGEVJvHyaJMxxBjRdoSknN88Z7sSBMA/FjLRcLFDT/zJrQ/Mt9SNLZNY5J5h3042CF97JTut6J+k3bIFDgyhGBYoRL+zG0M2RqCd10RWYDcNOwbeoIccKIUKAMjs3e3kjBIbrfR7WDqhWOF8l87nQm/ZNQWMAg7PFbBB7HJrX7vHFYq+1Yzz19Vi0HLhyVZFk0ls6Hw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634735\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114542217834\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316114752369404?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"AKniXZXXq5htrZhQEWvDcNrqYquxM2yy\",timestamp=\"1773634735\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Nd+zo3c1PoqhW13PTc1dnRA9F0pQtkdp8bJRn2+hcZgiQi4bcxW9g5mzKmD9hkx5jkJUCdOUzQ+MDZcS0xOEqWOO4Z/T+Lly5OB5HsJZ0o7zQ1jvLKd5fLHkmt3Dnk/9olXeGShQaR7aNYS/wEeyd9jNkVxyJakU5kBZYaTNAPKdFps/f8q2XvnGZtl4Ft9fkUPWHkOJV7DRofXfqMkRgyRwyQj90glPybsH3TDGCxUF0qP41xXna0Wq5gCAMXHe7eWqxfrUaR3FzuVnCOR4saJ8ntKesKLdLMtyD8ANnP83tG45uA933XUWe1To4oE8jOLoEFA2Nu7w1dCfYDXbog==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08AF89DECD0610B00718B5A7F8AF0120FCB9202885F002-0\r\nServer: nginx\r\nWechatpay-Nonce: d4417d61289ce9853c9758e8c9530dc5\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: DEsYA/JMQ+EEHcc7Y0sDLwVeFTX/P81nCQvj1vRJ6qWayKW1LPF7OnSzZW0r2onXHHch9WGsVEL26cYJhlnLTc/dAIgWvRIBsgQ1fHu9J6qegM7fMb2mrjy2FzUnqCrxkL6YGk8CPMD1lxNUO1rj40xDfL3diUGqNc/k4EzZuNEvSVhpA87U8ti/lJsLKs0hHdntbRHBNFwpzK6Yl2og8mx15hlH9GGpMEDK8WIAOxVuAOJsW+CFlago5pajaYzzMU6Fb0y3KxEDLxhOa7eBeu/aGhHM9GU53TVPaS1H+DfHvQ/6ErDNsWmeM0cajXONLGClZg6ZChDQC9PPsdRM9Q==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634736\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316114752369404\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115923493856?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"bgicyTyQBpjiL9lqIMxBF7PipMTV1DI8\",timestamp=\"1773634736\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"1WsbaxvR9a0QUSXI0MpQJu0WDgflXue+o7NpKbcd796EBPHY9UN5NhnRwqUVRXixu7FrI/SVIfBaPIJBAuDQ1PegvxfwF+36svW9WKE+zeXodx4qOzjurhMQ+I7BndtmfEsM+RMc23brAtTaQS5IJtS3lYrVH+xWJ0T4ObcTRHGn1ROsXdyPb7s2MGkDkpNw0yk9khI8JWYmGwqyV/TNm1piPY0oS77RJd/jQXoRffod0NeYIGyQpVotreVF7VkEIEpMlq8kd0wJ6AdsL78HwUpt52qQcMzhwIczhtkGZFZFvix3BrXQ3sL0qfVxpP8HoW541MCZiwm2wU0Q7NP0LA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B089DECD0610EF01189B83F8AF0120A6E2222883D303-0\r\nServer: nginx\r\nWechatpay-Nonce: 1b4176233cd20aa419d91f36a54ba9e6\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: rFxqsqAU490B37vCWEf6rdaTzOWcgerZFcDsJLLa+AIbOoqDITYu6a5dS+Qe1klPQfOejs4TV+d0BFOLTvlLNw/p+uo/fhPFG6Wyh4tH/gtFD5C+DDP/4LTkjuaSteMPlA8d0NW8Aoa3HsJVtJJqKT/qP2Bor07yhuUZx1CLUEI5gJTMvRxYd3rl+tFKwmArjFlP7ntiixLWXmm0Ky5W8PxZk523VsbYfORVU1SIUm79pSO9xsh6UtylcdEpoBrc+rMrQGDDcmpKGiXSAs6nnUNViATEm06zukPMszimgfoHvGRQKAaZPVJYWIA2HdUb+RrfCHzU39E4sEsFvPGEzA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634736\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115923493856\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115924572115?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Hbq2OBL8kfMuSICbbM9hdQmGVzvsEh2M\",timestamp=\"1773634736\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"hCMX4A9ObAUVYYaha09mqrtL40Sh+2j55FuudHxp70Ino3u03c1R7aU2bSRLlZ3dSxL1VhC/L2MMnpa9twYZgZYew/o3Mm9WogAv+/GQSoA2NPSjjW5mKn/t3Wi08QGCMmPVjr/99ggpFYvF8UtOM+zdkeH+NFyhZCiIaA2Q942YYzniHomuSoY7leUFBKnortQdnKk8e/gbOdbGr1XfrVoTEyorfccMU275QGoMq/8+a0USFqsqtymUb3zHZPSNyqVftdkrlLTJqI66dQMyjqZGtF46WiT7KOJqOYjVKBQlrIXCkMBUMlZ69bQLkoW19n96bPfTr3ZtKzTpTVZp6w==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B089DECD0610EC0218C395F5AF0120C8DD1D2886DC01-0\r\nServer: nginx\r\nWechatpay-Nonce: bac77d1127899f2558d6f7a6994786bb\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: zDp/LO4xA+A1vdCBRabFqSBQxImq8UzDvZRyXyt5Fy26FSEPlLzcJ3IN3qH+9RBBa6KLCq39QF4x6gLPFyfivGCVE/d8X1zYz1PRbhU9uuQNGQsLs523RW1GzNSnTr9LPQHvsmBeSI/dxdlvMLsx4jvldTRuwHfzN+6ldJ0vtCzCFgmWcJEaXu3ZFMhlS93rTLwxglUmgdgPbuinqIjWoZU4ognrYqB42lYHG96FU/NvxiHUn3ZVz/NLHdb6nXaaCTjA3zbcWlV6Iik7P9cXmKVuLmGtVfzxpq3f9kRsMoncxcG3/FSEjbQVagBfRdjyAmwB79F1kYMHThDFQ5S3bA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634736\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115924572115\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115926060396?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"cnarALdpZYIu14ldrs5vMZ5aF7f96Gk4\",timestamp=\"1773634736\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"pYge4gIDIgLIDVynj7q3z7hHHyRQC60OkRgCbWnihahH2WvesD10fiPOtK+q9j5c4l0G5oP9r5HS5bak27RIcNDGv/p1+kq6MeSv3knOzBvS9tWdU21K23H5zoyW8TMx8Ihs1KGdRxUHtVY0WcUfocCmwcQ2c4ENv0zNI3aVXJ/6Csx24dDITV1lkV5hov27mDpTjEiQef7Z7yEguYZ8RFDMRCkINJfAohCAUHoS3TNJ1xGnc+ufDKhV1ZnjONQwsawotTpjVso6sP0TbmNb0PCtqV4yPV6/vB6FSvlYw55HI0ysyjIDTqG282KB5TXbQ9ThfPh3fvCbso8kuKjVYg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B089DECD0610FF031885C68C5820BCF32F28E2E205-0\r\nServer: nginx\r\nWechatpay-Nonce: d79eb11c116d9fb99c1e09b09e125ea1\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ICU3snZWuZrPhbGIHREH9J5T18v9IibCPUgy4zYNkLscHhT5GFwDb318JWynzt6tQvIuoSdIwx50w1L0WsnqiWPHctH+v6axm1H7JngnSEjTG7fxEi9Dz9vx+1tF+M8AUrldNQDkybFkp9LZymTzR1gA7Ea9huSWYI0cACQx+J6emjEiiDS8rJhbIxzHRh3UFQ2ivlaOkVord6sunhU06vmsru3q4Qv62eat3JEtBq5NgD0NG3tZNvUWumD4iMwvccnbw+uFb1OsGb+4+EqsQQyQn/LOlh8zI8gw3p4e4Ly0woAX/A1Ph6xgZXCuSp2Da7nvJyTnyHZeJEgvQLJLMA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634736\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115926060396\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115928025998?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Z2TieG0lJo5tkhAUVyb9NRqL7Sx01YtS\",timestamp=\"1773634736\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"gUXrb9rOBzKJMwtK+gnBpkl0cLlYA9xSVJUk/QAff5b7vDiUyYBS6WQ1vj9NeLTRscJYKw91NmH41NUR5JYySMLuUj4ZUI+VXyj9HeI5lvpw9xl3Rjn+M8iJwT6VaAQF+tAwtSbmjn43Z1Jx2964e+/RHmY4FtjFJj1TEhih67PQry/N2L4Zp8pOrKv9sgZzxAgQN4UNDecxD2xNA3gPjmG/K2oIKW/m9/ZwZtPBFhNdHT64XLxbU7iqmo2ZApIyjX2HM7WvrnONpHln63Z8iP2/Gh4GchU6pgczJKvjkpGbqRgh9FFvijoIccppxjIzIAWH6PGnk3hqfszpMmMnwQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B089DECD06108C05189B83F8AF012090C32128DFAE04-0\r\nServer: nginx\r\nWechatpay-Nonce: 3da77feadabe4498f6bf5297ed8adda6\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: vCRttxgQQUdprMl2pJ/7Vi5q55jaFvSR0C6VuRz6qEPvwXDNolAoEiizDsxaNoLVANRiIqgdTYvgVrL0LoCXj1DV0ubeMxfdzQ8df0O97tKansnm03XW7xTCeANYlpnxvvhINV7FLxLVURfSSfisInN5ZeWZ9Eywa7o78o3NpqRAwxeTGuAqQ+OmJqOgEb7pS5tNi2mrWQlvliXzaemDr5S7A3Nk0p0gvei74vNuL4l0j+Q/x4NqITbkrK9MwPRy/JO4HLLcc+u/ygFMWuYOmAbCAXsgj6Z5dbfc9m4mKu2aE8DQNSP6PgCGm+AXHGEhSNYd9t1/TJ72whOOxN4PgA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634736\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115928025998\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115929440151?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"1xeqaAqRS82vPgdwyQY8WOCRRycF6sr4\",timestamp=\"1773634736\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"KDR5k/NpLqf517JLHAzCu8Hl8IiNt3YcpFyeJ+4Z+Bo5+i/SC+RiksdgLG61dYLt2ov3JRuiot1TNDpl/gitFfwStTnaU608iJuFQsJPWHyFac5n1BDfFk2G2dgHak/8s2c8ffl8zmCLUuP3tb9vEuu7qUG9+2UUUJD72wEHoWg2zW2XyBojhmelI6Zhy2a+6UN7RCfckFRn6jxHqQvugC8rC5AIOZLk2KRJXqf3NPYtLa2/v8LUPzS9qjhHxT/aDeNXxqKkE3Qq4XNmLzmmcMPKCZmyqtBeL0pjHMu1YdVEH6ITOC1Z1V5+bfghQlgXj0ala2vHndjNKxAmTLELOQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B089DECD06109A0618F2E4F8AF0120C4DF1928CC3B-0\r\nServer: nginx\r\nWechatpay-Nonce: dc16e4cb01f368926a85d5d6d40e5344\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: JT3FSLOBzr4K9zJyfyJBUsb/dmt1aGHmAnMRtQEfpyeAImwbtMqipJZzG2L9QA17aXol0BL4iMjNS4FN5PHE2riCafzPv8HdEPt9IRyj6mk0dMemFfKlH+00iYAJe6x3Wtad1iuJ0T9ODzawCAGUIqMWO5gKNF8Yjlb983GYPRm7KLUK6LbxU9mlk8ngln61OVV6e3xmNXFUcfHQz8I+qaI8DOq7TOwJE/pyzGkSHLWWTkaCfH5yc1qFK4y/+ouGOQuDI6vxuDsCHVYzaJC/jNC/Kk0jBduloZgK5VTp4HuhT5UpaayexNDeyN+vB4+6fF1ddKFmDZSm9whyK7fxnA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634736\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115929440151\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101055978?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"yBxQoetvKjOi6UriLqiWh3JTLwNx70UR\",timestamp=\"1773634736\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"q7kxs+HRusqJ4879R5A9Pcw1KOj6GIxab40usp95RXGEWdjGu2kmkqp/DhGuPNiKgWPdGdTsYCq3Tk0LO9LWgQYcR4p4r+l1cSyr1zhl7RBHQ7RW40to8zqIt7up2eWblz3cKW9yPRc3XFG0CQgsLtaJ0aeNl7Xc8Qel822LOa8LXepdvAFalHAgPQEDaHbw4nt2maOgWA8LsTT0VtkU3pqQxMvNzWZ6hGLzo9UZcZVCpqCw+G9c+mFpWE2WFxAqe6Nj8Ap/2jb/Ma6CC/VUmP+/cQ1S0TUrtHxv1aWprGnINz3qx6hyD1Y5ye5ZfZhf4CuM/N3g02o0yObnVJtS/w==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B089DECD06108407188F82ECAE0120B4C40C28BCAA02-0\r\nServer: nginx\r\nWechatpay-Nonce: f656d30168711df0b608f373e627511e\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Jl67hBlpDCg8sEpdlI+nTFgma2k1NrU1uaGuBCjfYozP9QtA/m/GgG2TC8tm1oE9K/h5gAXurVrjy30Oj0CA1uAkoGHnvYXllo4y05xqwocqU7AxavJylaNrRlEtKkIeZlU0O5tW9gPozQ+kwgVTNHIzo163OHpMkbZK5RNzdAEWYh8Wr0xvYiDSFHloQEHx6maJ43GWVzceOTzZtIdtWr3SysLjmFYCgq4f5jJL57g4ZfOVyl9LDol1giV9MV9d0IZQAlImuNoZqn5+641UZ5qw1FFjn6feDEn2XGtrixKZjSM/X94MTyUAEAEDF3ck4sMuXvN4RPgoGuHEwIc8Zw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634736\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120101055978\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120103820331?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"2TUZN4zuXbvKiw3Y05VFpl9gICUsJy4N\",timestamp=\"1773634737\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"fK6qzO7UJWix2NprA1+QgaqNV//M9kYJEOsG1RfIGMceZwfatFzwpbaOMxWszk2KCYcSlorqOkFdP1KnjN6wFCD3Sh8u+Hi4UDd7AX5qJik/3ZSQoznBp4rUMHUGA7WbiXqc23LACqbVAGzpe6sYNwMx1p3tRjKnsZmn41zY499AjmBqT8lbNyMixQXBpIGR6iN0pUTo7Cc5f0Z+/uSCpGnlL7lSUpIli5Db462wlAdbqlhQM0jdChOU5ZZECZTImxDIVG04Gg3FAocqw38WfhEXaCzFrWul8oj8yf1ocvrehvyZThpo4Wqv4RRCwkneqDhSk4QXWPXQ/6LGvUMdgg==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B189DECD061052189694F5AF012098C23D28C18601-0\r\nServer: nginx\r\nWechatpay-Nonce: 24be59dfcf5f9365c18c5ec5b6d675e0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: UmdXIyFHSE3/aNKSUfMcjGbtGm+0pnJrhC/qmCPk9qsICqFmTm3YM5lidnWeUWiJnZD84V5AUSasC4grPfDcCFHibKMQcVRN037FUSFJppItBOHJg5qs3kcARH/tVMk7Qom7wq7mI2iEPvWpMTYoikRLcSer1bDZPk/zcuz3U8m+5NNA2s7nYjWtfqnySv66JPiXrYdm5Gv7le18Rcy7ZDDagTmZaLlNRSJooepeTueRf2qZpRRwNaPlhAUPk4D3p0vuM8UCpLjgPTzK+iDW4YW2uJ0a7F6XTccy6raW4HVTtW0gV8EdVKszETS9RotfRMVuNPtHptujKU1mnbMTBg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634737\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120103820331\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120104869949?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Td5RLZqHv0dS0ZfnorOiGorexZll1x4B\",timestamp=\"1773634737\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"5KxKNVopAK6dz+R08Jo220boeV0xAtkF4DwuqcySvz2tAZwJcj9TBvkGMXuxc7rir8hMahnAW9lgjw4sO6gVat2cf9rLeEptoFwvJWY6jgLJxo2sy+vBoprBqUy4fcJpKOdDz5oihWGl/+fQBRoaBoNwryazVVX62nusoV89A3pIwjq1Crvxw/PrRq3eLSyyl8+7XtcKP3+qX1puJscaV/6fm3Nu1T1JVtUFCszcsiWpxhvpGCye2PkKX07Fj7J33AkYhs8Ns+6h7VE0LkxCOP1NUvfv78/fy9du+59idf3ezdusJ5ygvSqlcgC3o1bQX7lKkSGTf0XOjiXDozzdIA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B189DECD0610EA0118D69DECF50120D2BF1128859B06-0\r\nServer: nginx\r\nWechatpay-Nonce: fa4c39239751b8e5e57c5489bc88c009\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: h7Qz72ldm2RtxhtCwdz/PskaWj2FWOVxdiW8bMukZEXr7JZ40BZZHnzchyCVKtD+QC5Zt2zlDl0V8z7u/PUbDYueTPLcVzg88Nm81MnuXPXVoLrfp+BTuCENbMIvEhQqz3F0pKP/XPqg1gWXpXnG7MsERvjoS3gnZ/YR2NhEaurF073wFX+DTbaTV0B9EXpt1LeI0/fTkgrN9XVLrUiJRg+IUyuMKdKzZfLfpj2dBWGeeYd3TTKNILKUawFaF066hvuDGg2LI6RYNOIKsm5bFoqeftdB4zgagMJahGleqFDJq834q+FazFXiS0gHJFsSr4OpSimSGrsY0e+WCHiWew==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634737\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120104869949\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105044481?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"xeQ5ghVGL0tpQ2MkH16PyfhFaixBc3TH\",timestamp=\"1773634737\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"4SxsAj2lfMiRO6byaxhVsClzqZkMB+IyB/aN81y+gJ8ZjJFDfC01KEOfKAqejvzUeDUBt7Yi9n4U/KBsb0F3suv0nXEZzN0nkjSQqpiL0gHQNAOAKxaOOYPiuQhTvfEQ0/TpzQwpk4wdXSRhgrHz6Zy/mU0Cu73w+4npVvNolCeaYYaKSXUPiSqpcW5lmSMuhr8Y9WfZMAucrzcc/MFRwtvTgC402Xgq2MSdOd02D9LBAROxmPrVhbbfBMuhRtQB1G8yJQ7yL2HDYINaBpisvk6Fr/BYuAf+llprmr9mFV1ceXIe+Mz4Byer8/VKuZ8x38kyLytmTDDMbd1HRsOH8w==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B189DECD0610F80218A6B3F8AF01209A98352899A405-0\r\nServer: nginx\r\nWechatpay-Nonce: 82c383357307ecbaaa238af91efb25bd\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: nsQAZKm10WJtRppbn12yzO8GS8zSKl/kZbBFlaasHtbfqbWZjG/+f5ec5kJYkhPgfYqhNd8A9xtipC3jSct9160n4vXHxVMWPcOJrkC0LC4vG0oktA25byJhW0IaBkcs66VvN2RqxPr49SPaHs1q9Qx5DS3Cx5oyYJyMSYoBPp2k+haZU/npVcgTJbgIpP4KsXQIgXBZDX44LxnUwkWWNrspDkioU0aGkK1jOb3pPK0L7RPyKJkkBKzSOD9yWpSTtRLE1gMD5K+Gz2o1PtEFUKB7zHOFRMo/nyXTBVJzcmOtQg3gEu57DMe5aZQmcfkrDdHeVXun0pv+t3Ct9sKivg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634737\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105044481\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105873193?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"nubID9f20uyM2eQ2vI7xbdXXAyf1hjDy\",timestamp=\"1773634737\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"DoK0IB9km43Teuxr3Kw6QKhFjiKcAxUiWPipXCZotR32S7ICBuEMHQ5yS/PEEvriQvecJnnp9NUC/rtNRBc0ro5UDckxQsDCOhbDAozhAgqdYoaqz3EGq+jrFPuXO0ZqpQAt6fstb8ryo7UE12qDl4qYJfZUPN0lulT9fIlFbQhKAlxS18IJFvwvZj8T3gbTEjaiieYGzZSkMeoAoxkf4lXyIMRorRasdLQ6/El0kpsJ74AYhp0T2nmLJ8CB/8sCOLRY1fWPR/O2um1572I8lKGi8Wt8jAhEbHezq+Qmslskhg4Xjv9lx1DH9Cp8/CfBWTksOvJtmTehtn8p3Mv3Xg==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B189DECD0610EE0318B0C8C05520A8C10828D7FE04-0\r\nServer: nginx\r\nWechatpay-Nonce: 3f75271cf749e3d395e5be2f03b2b36e\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Y4oyBkOR4b8q8WUQHM+hqdldpjdWkixI/5jV2kh5+3hjkZa5wqFdHebOhWIY12A7dQWFsG8zOhFM77WI9EV0eT5DtYYkm9Du4i+k7R2LdboewBnzcw6L0fWnu9Gey6xEerTjuQwowY2X4L3+0SWLMC8Phrz1ipHZC8VGc04Xr/LUlj8+CoIsm8e7E5vFiynnG4xyEyHBh4TYjjenhWN6XhuaLlGd9fff/xkX0RvPXJq4yf8/uYVf51z3UqyAOaJ8NPgRawIFmcQXxsra+RUOxNc771ka7UbMYkAz3X0tzqLGsadwwe1LPNlIh6/gxEAJnmTfMLd/W8fJqMxGq85LBA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634737\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105873193\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107504965?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"S9J70JnTXyVZ7iBohcNmIaX6y8derKXK\",timestamp=\"1773634737\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"cTOtsTqiCum6cz48maVnaPj+QAX6fj2HsUwt41iVchJEDikPzdBjemUazbUGP+U7/xARE8D/0ihw5gPVPzjtZwaNav6Vq6RY6ggQ08YWAwOeMGMhF9wqr63WVT8kZ5fkaG8ajdgaULMcAwgIOP81EKbUq4UIm1ZRlYkBV/5gxdBHmt3T7wP0xdnHZ9ykmSWlHCZMLW65PJrBRsR43x14fmnRqlGY0XZ6cZAdw2LRRrsbqNyirK0BZVQOOZKln/Yi8Nzp7/0dLINhMHoz1LknJY6S8EJI41Rcge1vIBA+yARgysMaKYFCJbjFUsLs/lY/vBV57kuRUOD1yFmUz5PJLg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B189DECD0610F70418BAE7F8AF0120FC79289DF904-0\r\nServer: nginx\r\nWechatpay-Nonce: 0b17f9492efdc92ba431b93a181c310e\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: j6OVNIUs0PChfsfaSOp4OZdkGDZCXLaT/RaMO0apKwmzkRO+p1XGxl6A29tELx8Kud4UXEMnYbE2KHUibp7tWlbL+KJyHvoN2WO3t9giJsxdq0ilN0Mwlz3RlkKWHw8n7BpxqLTsuh6HORhhJoAHyMSCIWNOAajDGyFT683FO1/CPzc9fkkZOeOQa/5GR8AuL73MWqmGDaPwrDoPUdwkr9pq1MglseldVME/OaqX9rMXjK0HQmYP46eYL2+4Qh5kxw3OijaZQTo86wbJeYVs+JUYKJs5dfDYFb7t6yKMI8jYmu2G/BzZh7l0OkLhgKiunFD1vOqb0RhWzb96tF2ceg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634737\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107504965\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107498697?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"wR5qb2K01WbbrFg6DIyRBg4DgW9zGO7G\",timestamp=\"1773634737\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"vuQGa5+J9XCa8AbtVSo0OZaCzTPhYy5bJi9L43MCQp4QDodnxMniPGz3UwjoGJvN5ojKLMFCvFp/XNiXsYapka8ezKBiEzC4Lxw98xe9Kt3J6lnEVJJ1TAu2WizIg6ThFGnnjpoS22omTteo4K/im9sMpBrhzwE5fAhuH62sjwXTS4QFN2opcQ/X95lPEE7OQK+UOTzijec9P2WYYaQniXsQDQ1tqheuVM8/fOBX5WnK36tKKhhbIYo5RV6liyMP1RBFd7ffv88Aq2KY7mXAQYTxlLjPB5oBajiuaczqKD0QDNRA6Hguc3r5kkyo9+uFph29LMMc0PYXzjZ0u5kNaA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:18:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:18:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B189DECD0610EE0518CBC0C05520F4FF1428AFD703-0\r\nServer: nginx\r\nWechatpay-Nonce: c83f691fef4eb0f74194168872217a06\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: K7z6oaZcPWJkBuZLK98sR6TtppcfVjfUEZykatxfg5Ja/qKf4ig1BzLVcaayEAstiLAsgBKa7PWN4ZqIO6A6mMk5w1Y43r33nnwSXaYQwIAgb+QEEN/Yzjfx5zuw1p/RZStLH8jhcqckY12hq9qnLdjoeUWPac8LA8yJr286tqRJBbh7MGa54S39zMHIfGj2vh/PqZofOi+OBZxekmEvFmYoY4onCbZXm7+j2cLP14BmcBMnRXG84S5A1zbczDDut+sdCqLJG1l2yO1T4Q5Zu5O0PzCArA6a0/nTcxBntImM8a+kjUPTDF/6dSsUHMUJ0BfY+NhHbBaCQ4U5vhAdAw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773634737\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107498697\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115923493856?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"coqCBefr5e0yk2oEto8nNW36HxQRToex\",timestamp=\"1773635035\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Wd0ewA2SNrSP3NYU2b/svItHCQKeo4NyBN3IWWoRBUkkqj3+i0RNvGwpDJujnRLCQRhoX5WEMRXFiz7t2kegQGJaFjj7a4kScOOhOr54vRJgZbahJ0dzuBN7u+9GXcS+QIUT4EQVJEjC7pYKB+a1X5JuFCI+sgohUDm6hpoqVsdXthU7LZzVl9Vz/1i5qXVR5qDYno+s1ZMA+Am0EGw/3qq4ThOfKaPf3iOs4NZ8OLURlCKuK2mLpO0l39TEyiOHlAxXx+5fr5xm1L6X+KKq4yiPsFL3BwZ5nigso6nMtMxOjC77zsza+hcdzCkBL4Kou+++6k44mm2+UkvV+jbU1A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DB8BDECD0610CA031894AA8C5820FCF80528E0CE04-0\r\nServer: nginx\r\nWechatpay-Nonce: e07b0cc779f9305b4fbf5b58347de164\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: N6Oe1JUY5HAj88JXGOk481G2+P7p7znuRN3Q9KnYjJZ5WBgchycoAfoqCvs9wOs6AqY+Hc1a4sPYbb7zZHGglnRe6WidN18fWLHYRKp10jIwdO/1Q4DAZt/Q9lz0zYFBgNmGoSP/iofHLsh2o/udYTt6PkbuP1DPmj+XXlccxBudaf1d6yKyVbhjNCYkG9hn4R7sUNdS+rsVRjjNsBQ9UulVnZbRr/5t+l2n/pYJwnI4wt32Xe54ajBN3gd8hmLbLCslGEFj8QTKYN3D06N1jUknttGV0gUu00ReqhMokpST/TaPZFqUrXOjsNuwzhoWDJmQmvHOXRqIZCd7cc0J6A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635035\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115923493856\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115924572115?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"zE47U1YARM2ZuDdGDXrO2qVxrKeGvOEE\",timestamp=\"1773635035\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"PkBkQYH7Q0AxVJWXn89vS7B0hlC3BMWgLtPhWoHVGqz0AxlsGRKk/RqtlgaamrJ+8Ug9C+Rtn2WcPUCT06iR6muULOj5EVVc4XVfPCFXkIlHlods5Z6ba7rbdrAO7/Sc38YHvRxdn+/7OJpHpf9YnsJvJvsIXjIo9aeA8D1Td+1gx7lj7dUhezmvXVS6efqchfYEvZcLDExflelGUB6cE4b/0cknnVnL9I5z2CF4U/xta/NzBBDwg3JiMA2G324EzkYjvW4mLG+IfvIOz+Gc71v3P1ak7I9AsA/t3QFo6Fx+e2mbFYfe7hgC3XZenfWz2fEo0jVinSbpTfmKmzWPQg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DB8BDECD0610D704188494F5AF0120829E3C28C739-0\r\nServer: nginx\r\nWechatpay-Nonce: 2b3e3a2793f0bbf9f6694f162e9e89dc\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: E05UpDpphdwwtfRvQqMs9VBuEO9KtEPRpHi39iz/V0qP5Y8PoIASwICc1B3j8pJ7T5M6J+M8jwk3hvnOGZHTzL1DpJAbGt7JqUmaRUYOLkwprNnIkMTqEy7lE8XG5sl/r7ky4rfXQbwQQtOlgNsGQZcRl9vvJNXc8cNuFAaXXLTcOrR/Sxe/KLun+79rMgkR2sPVnxU4Mt6vF3tQ2BH+nFmjCj7qqTA/XyywK3TQW3NexJ0Si4KDSB0dGRHHWT2LjQBE4yKLi9QkmkqBEVvahCCPcxzl2TmM3fTb8/E82qFO06uGpJB+CMrBJ+Cx3LcoshCOQGvtrvZb6I8VAXrQFA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635035\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115924572115\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115926060396?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"4RPfUUi3ZVJ3pLWAbvFPP8ieo6Eq9WVs\",timestamp=\"1773635035\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"cccWZMp1JbgJ7z1IPwmbCR1eCP28syVJAbLDOJW0Y00gqA1PnEzPT7ZgnfbuGJHbzHX2rzwbW1QaH1rY+DZ8RRhk0M7QkG+aULtixhW64/KzSK1eNcDlQlbh0pV+b9w+ja7c+JTfFx9gh04hcraSQBaGQlrLlQoN3MJLRneNjjE0Opkv1xugYz9z5sl41wr088JeOO1JNogn2lOUQ41VJYZHNErImzeHoVkEKGqq7PfKsQ91lAgZrnFalucYwXIK3hJOZuhdVrhq3JOwrA6u3WWSUTOeF6SYUxsee1rAxQmEnZBUpi7vESrGSg+hVgs1xuy2x+e2M9EL2CbhB0OswA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DB8BDECD0610860618F9CD8C582092BB0D28EAAF05-0\r\nServer: nginx\r\nWechatpay-Nonce: 6354e4aad679aeb22a4d0377ca6f6bec\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: tFrA7hqHUztplvDibT5bFVkuxojxPOqNzY/k4T8bAIIEhZU3XY3/9MbzYdsYWESB5Ngp7nGJdkpdRraeLKNEm2jBmAnE0y3Y08o2xDV5SLAwv42DsGGEUmClewynjmMfBHzxOSUZhahRzylgjsx3fArNWt5OkN1bmnShA0TabObt7PSQmXxjGxEJBpiRNeEpwUV18BoA1svDcMH1Tt3uk0Ny9ECuY4E2idoP3g326XBZdjoJ30e5u+f5jv4fyacb/cnmUn7cM7zOSyBEPHe8iVHgASJPwli0ZRWHxPDafBd4RvcwR+ZNv7m7jv8IKwN+KMSbiV0kblBSC1sIBazYeg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635035\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115926060396\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115928025998?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"mqqdEtUQdrjdSRlqIerwVCG7Ii5ujs1U\",timestamp=\"1773635035\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"rdDwEZ9aDx/uvPu/KJfQb5obkw/BmPxu4UnYQUpXwnzkLGqlkw1nb8RXFQxfGdPKynk+nHCwZHk4JrFL2kGujFvNBBZhZTsyL6J0Lnb1fYibY37SKypkqYWXhaCFIcByGiA7KeToxOGUNT1HUh/efprNPIf+QNPyWcnuVmUjVry0z/HGVjvtuP3qwNheqrgE02V5KQGDa9aQcjhJKBJqoM1dO/MEodfc2YnLGE1NXyOpu2AzrCT0AApBv4tp9Pa8B26OPjoHTg2NkGavvek8xQ8YXh4O9fZAujWXyStgGQsQmjSHNaVgoLgKwF4J7QPlfinX3XfWg3uU+IObeHt/sQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DB8BDECD06108D0718E38784A90120C0C90D28C98902-0\r\nServer: nginx\r\nWechatpay-Nonce: 17f7b1e435a43c1db4d844c583e826ce\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: OpkbnTOTfSevqyZbaZgsxj15zEb+fS9kypv7ykDpTZBP/yhLD7a4LKIMHmuJSp14OVypa4XckdG7IDO+4rrqNtP66UrZvGO94goRaPtiVG4WLaIf+bYbrFBO6h9a8o7Ve9/GQe/48W+vUgpvg6+BgWw+CGzt3Sb4r9X478CZgiSDBQppjOM5mztrqmAsY1OfyBnxXcbSJCVYc7uHf1NxyrZ5W7fHwR/rwoA7iBEKfUPQ3L9UmU/7rdeYsBN3L4xoJf2WTKnXg25O5Ddnq2+mhc/tPdBz9tn0YxP4jwfSG3mANi3DyUWKbP0N9C7bBI/l3NRTcF/DHB/h/raPp0aALg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635035\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115928025998\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115929440151?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Rob2A9ZbW6qjRqSLXYmkgQgmNfiu1oKn\",timestamp=\"1773635035\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"DWzOb/udC5DCVC/EbxSF2a2Wz2XX5JhhlFVhabuP6KTLwSDZr6CQpUYsP5p8HwwUYRDj9U4dNiZM9OSfygT/KhOaFGPIL4MOqUb1w42FOMWaF1JySooAOIhsWjf7g8b4MKreAezKtcaujgR/GQLdgC2EwINxOXgNSSnifd73FckbXl1kWM0MLUw5WeAq2OEPcAQiOtJfIxfdubGnOaSoVLLCj9zE/jmvQTe+5Wwq6PbnwiMVyDxDxTaRzTQJPaxbMd+UCf3zeuOrfQFqw4swUJRAB7F8VxY3RSnBBEXuXYZj/CA9/DQS3Teq2lLuHDOroWc7ZCTc8eJmZ07twFG/Vg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DC8BDECD06103318C6D3C6AF0120AC892228B89402-0\r\nServer: nginx\r\nWechatpay-Nonce: aa82ef229cd598eac2488e8d4de4b046\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: TP6Z+XR65eY6989yYBUBE5+ndKKPF2NNgyh44Y+wNC1ctoLXJgUup16vAiQX8JurRFfuRFGav2N3EGVmk4ZazJ/phAl5SFIXVGTMnS7NGgWdDjRdDqi+M6FVu54yyfqghhz7n868qp8LJC1oasfvxIsT9yIe95uNPLzr5sJTHJBxY202zD1u8S4wHMQSNMU7Ce9Oe205XW6KgWkufJnwweBvDFM287dUUtDpMGxgAKLLc0Un5Rd9dKVR5favp64jd4L5Ys6nxZLQBVa+cK5llQ/MQCzHHpkdyB/k8J+0UyNNbu2gx2OCVXescdAyhrcQUJw+DyMyVuv+eAMZv3/iUA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635036\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115929440151\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101055978?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"MQ1Mzi6A7SuIJ0PPxJw8kXYUzP63Jb22\",timestamp=\"1773635036\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"JX3qgNUrT/KoxJX6KmxfT+RZ3gec1elz9N0oSO6AwAgW0FHDWtOVzeiPFKPOKOO8o5kMVVFbrZffzDXvFR4VleRD3yXUrN0Kp1edTgVJtpbbc2VjF86uYFj/OocjPT91JO++/Kr//WDi2G6N9UD8h1TOzt3ukx86TEh45BkiiKDyYBKOkVYnhryvF/lGlWXnnWLpxGC2MlDpGzDFs5JvHYRDoTd8H40WqnIjkUVi55rNphdtbhh+LUxq+85caDUYKcD3bVBiWEvnKnN6xUQXEqXEPHK+wnzKwsqC/kf9OB+GWdOTu0qi0k+NPBFu5T9eNF3Jy0PA1h+9cViy3nu6CQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DC8BDECD0610CA01189F9085AB0120BED32728809305-0\r\nServer: nginx\r\nWechatpay-Nonce: 518c3ab10c6c7ebc20e0efe10f343975\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: FGf3sTLZl5Bxoab8Hb4f+TvRF/Hk2X2M0rvd6VDTTTqlhaIKyn8z9p59rYQmKuMTsXr21EZgdbke7sYwRLqmFWKdieJn9WOo3H90j+Dl2sVi+5NKIcGw470F/+4d8q1ux22HMI10PIYrN0dV60nLH/eRJJjxrsOb/rcFs1AmRyYH5R6e9nAuh3zMKlBKYqIrmk7biW6yP7Rvpw2fep+aAgVmiycFgtlocNgkRZcDM/5ceHvgH4TDjnFzUxDB/TYMhjYxJKEqWxHzEpLgbv5L2w+dfXI7WyZRebfN8mGHXHEHAaZIVUDwSbnO3VW9hUXxAvmc5PciAYqejkIfNVlSSQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635036\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120101055978\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120103820331?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"p1E4y6tURSF7c77j1tVF4WNbV8jBfZxY\",timestamp=\"1773635036\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"C6jT3WWn0b7TY2ZKNta8tbVtZDvr854tPHyC2WRa1yku/sHJHWAtfKfd+3/1AUr0UleQnjJRdYCUNqgWZxg0p+G7ggdHjwTYWcOyBkc6uLHGwAd/8toTp0PNpk1KO1c+67ulohKEJ+2zi8ufbDmguzExE0NkBZkw1xZFZkrBqAsovVvuJh83lEKhYUZjACzHtfm+1GU+8oBDrf4ary+wTdgKy42fOsh0wJ1PkzqiO5vT/mhidAtMNXqejAa7ZbbiJlJp0Rlxpi9bvthmvtNHp8DevdvvCWIkkn+KD1mquEGHhR8ML034V7/YLBmJzwiUmW5fhU4UPUuHAxwygOqFeg==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DC8BDECD0610D50218EF8CEEAB0120E4BB0128D2CD04-0\r\nServer: nginx\r\nWechatpay-Nonce: 2ac58bcd08c689102ce6e5f657e2956d\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: OZ9jMObsSy+R6JPKG74Ezuvrwj38Ue46wC3EU2JUWZIxpAkVaQH9MK6VpCVXxqWdo8tEx8NngVbBhDw5J1jvjq8pfSzC+esJGcv+tRtvRfbMqVn1/A8o/Lbs2z2zc2oM/xdvBiDBuS7K4ddbc7Q5UzD8yJQxc53m6aEWG7HclREKnQkqBakDlV6b06CVbZ14kUMdiak88k9Z+NSX1jVacRn9MFKMRdWUE9xzTGEJxj99VAi8wKKFHYRpJ3UEmAx83CrgGyd6AK/J/C/7aVhyo8UYiptoX8oCLqhzA5JvdihECKTILBpN5mYhzdQTP/xMIjuTr35GHcbgyCT9xidq2A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635036\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120103820331\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120104869949?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"XLlLAKcCS5X1FIMBBzP5qptt6aqELGrP\",timestamp=\"1773635036\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"bkL1PcAmuEFxWSB4u+nuK55WZoP6pCxMN/XgMh5oL2waLHaFUS35EjqkpT+F+hzw8djUCz8YDmhU/Xc78U7ToULV0Vj/zSwFpLGbLN1BJWu8dLxyKB18npETHs30sJ3NKm/cr+mQ0Xb7C+CdqRu4lB+rTkh1g44WbO0P6hkKtvTnsPbztqPuQXjQi694ewhJupnFVBaxIK/YbsulkH646jsayd9UWr/xl4n7FyjsOzQmlXxnXzl/pnEp8TUeQpIaJEzhaHAoQ3b8UygpR+kaKmkhleMF+Hw/WBl7p2w44RQFIOXg8e0G2cMCkg34eqQhtPc1i45baUhz6/s+4EtUYw==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DC8BDECD0610E00318F19FECF5012084B81E2889E401-0\r\nServer: nginx\r\nWechatpay-Nonce: 655cb6e3ed73a1bd69794bea8278abea\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: EtjR/JxHX9AgmBflX18gSj/iegIaBQrpuYDMutjD0roY8KtJxScJQ1zqgJ6RX0iWUdHEijwom6NQvO5rnrJuSZf6axeq6E1t0CPjJnOtbttGsSaX91Fp+OVQVAOq5xi1sK/cKkpPpJNpXyWqVmL7oVEwRWIDiDBtdmVB2gbOiYQ4x9ADN9hoIPX965NVv1bwxj7R+3orBvH+LE6viEJye0qNiK9I4TRiTbyD7OqN2QsCWdzBcRrRCIFfUyhbAcHSe1tt6q/hwTWwZL0pM2W0Y6gs6LkX9XC79sggc+0EbATJywvkHa1Tg/JOxCgT1opUez2r3Jh4YBZV9UZEXrSHog==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635036\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120104869949\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105044481?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"J1xgWZBijh2vlCAKFe9JentQDVR7ex9O\",timestamp=\"1773635036\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"csYmdHYKU3hxLM3ON+p2Hg1jKBEZAZzPp6L/t/gcI9DgRIM64SDlk3uxyMqEIV0HXSLTUUkp3rnZz9/gtQVt9N3uzmbeCAd4bbNr35GXd/qjwWFLYrZU4e2Fnarq+zj81fKQuukJQD5ZC49qfXfTCGf4GnCXBXjhuQJ0PJ2Bycy/epBedUjyOaZsOLKJacBQFThL+Hq6wEEmOToiQfUZY/HSJDJ9UFyuwxL9EEWk62+ebQBFob/RgfXbt79WgGWFkDX3R9ml5ps8YHrND9xXm+R8AiA/MDXdkalhcL1b9Ec8QA/pSME00kCy+5u9CqbLG5wNI5Rf6qq0AyKeM3IpsQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DC8BDECD0610DE0418B4C18C5820FA873328A7B103-0\r\nServer: nginx\r\nWechatpay-Nonce: dd3a4d3e76997fa80f8c2a99ed2bf765\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: wcjmqrfaHPBzkXHfXX/tuzvJ2O7HFGI5z1OVJPCuXT6royQHJqbLvL3aeb4br1Oo3Dj+CY28PcY1T8Ja22IxhwoQcpZKzAyobDCnz18s4jWu4TC1nTs712lOYiPL/9zm0EAp8lp5o8Su4psuYKLbXMFhpMvL/eDcNLTpvJ2kFiXfQvjvhLOUaXHsiCv0BAPYrSn0arlQqTdMJOsnSHUL17fWdntW/3PodZr3jP7sKY+jgWl39weWiO+8K6VdpnFZHJZJbxK13BfcvuDZB1XrJZQxHeIJMitK73Oq0XykIzJcNGgeOMzXvC/Cq6ed3Y4It5h/0cRGrpWNtdGpMWdGUA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635036\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105044481\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105873193?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Q6XjmWRP6PDC0vHVZtbMrSHCZkiqk44B\",timestamp=\"1773635036\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"AMjC9VFVAorH2coi49FcL2VGgT84Z+dARsKvR7bfcYHBSAvmfzh1/ljtsqTX4lbDopkTxdwQwIZey+XmYHw5SUdWi9RMj4WxNAcJ8dfgJXN6OnEMpIRDEpx30nxGQOrQwXjzhADNz6+Mrw8VZYafIMlvX0RIaELsBspH4Uxj32z0VvSLCx/WEAQ+bf1bizTMh2cpEJQ6yAT0noQs6PaLMu2jt4lEV8ghlJARVk+5Ra4Fdawm/TWoXbambxuG2WxPEFSXcWvlvSTYFMNYGk+lu62sQBslPmcXDhIAZX30RumsGvzHEpEhiT4R8BOo3ghwWeQXvKAZCP6LytwwwxoqWQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DC8BDECD0610D60518D3A8C05520EAFC3028A08306-0\r\nServer: nginx\r\nWechatpay-Nonce: 8862726203310bdd60c6a17f545a13f1\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Qs2093wbgVXxc6/Xw0ZWr7SS6rBRTSQDMFbZbSXHephCsERPIDLrND1KUQEvuGudgDtf8sjFiPXBJOlPK7ReUKD/dJmvaMAGEVlVuZAyVxWJSOLNbT8g+22vDeR+PdTzsJ6SEJqttqbuJPN6mta8DnRWtKCbDT+R9/dLiRNBwR6h3/SinKSpHiP5irM8H6PLfwFKUHjNnuAITn+IQ7ZgnZ4qbv+jSaqY3FDnvl52l2ZRG7OohS0IEo+1wlynf8Zhuf80odeDplrBIBTtpE9PysZ12TMLK0lCN4D5PCeGrk0ztZ+xuDmRc8jgL8k+ufADCPE9aL5+gKQwt0qbrVq5Cw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635036\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105873193\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107504965?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"yOt7LdZIVLlD9VmrBQgONScpyeez83SQ\",timestamp=\"1773635036\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"AdavT4FugPILQJoYTURyLVMjTm8fPFBTRPpiliicjrbtrbhBbD/6YJVBP8M4rmYksnA22+iBaWL4ZpT7Q2HCOkltmW2Ohvb6JCgDKPIUOJnKeiqo3Ziav79TIIJH7Dy0v+6BopYgTBTEgXm8LfqC7yYVaaoEeQSeN9mZleCkEU6gNt3LjOuUcVpahBFNBTwqO3deEac1f01DWsnDMFSGRbwUYUVSASz0prlLHvwOnBRYeXBGQ9CXIgmJWiWjbKpml/uYrCnQHidRGWaVvqeiCzJ7/66SZIbhTj1KCkE29t6r/aeTJ9Ugr+lezCfSG4DbcWy4f6CAzGCiR60gYCseZA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DC8BDECD0610900718C494F5AF012082A02328BEBB03-0\r\nServer: nginx\r\nWechatpay-Nonce: ad7ff145e6ea261abf169f01dc106def\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ehys0/Y9h74IlRE1wdei+FQrot1wtFq81xGRqARCWf1vhWnXHAj+3Vhyloh+mVcTtMwiMt2xiOheKiqI13wO4KyvaVdhClRDXDetcM8a7t5aMHNmAes/GDe+SXH7uegpLiwQH8FOocO7gb+F6itrXQ1A1KXH4CIdc2pkPBrfyhYXurS9Mf3YdcRdubXr/kMOSCap9eKEomiKqnU3fAvfiUkPCgejRDmY1nGMcSjIt57EXmjEHNTFnB1V38I/hWOqpZaEN1uHlVOyF2/J8GRfDMUVtku7GPF3sDEvxFHK2Zbodhal126WZ+kgidvONHBgSj3BpVPRRf4FlWsn98Sz0A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635036\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107504965\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:23:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107498697?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"zHb0qifVIv6LxC54w1cskOHK8FSovaO3\",timestamp=\"1773635036\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"29PewIRa8HWx2VqPQbh8+A4AgE9m1bkfYM1S9FpT5Y5ZmMvIiMyMJ731RCJtBkRkcvhToblArJI0TElIApbWcvtxThfe6AEzVWYuU1wPslXGAOnYjFhvyYmVGeBPyaHITUKs/ZYy9v2VH5Bmf5RQw+pDgFXi8MHYoVpot/AJWdVOgeCs5Nzsrk/jFGbaY56JIxTrYpwshGbF/6iAom5EUApjRqdhwClAGJViqtzBVJlIE5tlKV8FaxytBpvKzCyA7Xxi/9KopxEP8bZ6BeqCTu3dhljOjoVtb67l4ewWJcidtyD7PrjsfaSPx2ZgLzoOUtETXGzis5QfBkFfT/ZYaA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:23:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:23:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08DD8BDECD06102F18E38784A901209ECA1D28A1DC03-0\r\nServer: nginx\r\nWechatpay-Nonce: 29f0a97c2c434da7df3fa702a43d82d8\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ckF+ItY7qFsXsISpyEoYMHaQKHS+5v8/Pmqb3vyT32eogLUWVvc5mk7nLSQ1gyWkuRDOnFCXSTLhxgooZqxstUjP/z4QP8UuyAkKzzu8g+Ze1fg61SNuImC6uS1/nsLabid4aKMZSzcTDU2s3kU7d9yCjha6BABHgMf1YfeftjNigqIOh+EJ+AuY0wUeQfhpXDolMM0A4ymsV4nQMADG6oQPA7dhcORNZ2E/08nHxLF2FVgMXISZrhmExq0VblV3Sn5EJ12BKyf+TjC9d6gKaUUMNPkDScdYT3b8YDUxUvHg+W2xiaxtsQ/2Y5SJiYRgMkp83yEslw3CND5SI76rZg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635037\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107498697\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115923493856?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"9SU0wUxn2eGx2XjkxOECzI1Vjb1FPM7j\",timestamp=\"1773635335\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"NXPnjkqhQGY23LF8+baclHlf0ZaOlGJcF8KHmUyOnsa/p7Iog/iiGtI10ZhwoTCxexTWCTG5tf0Om8pur9qcouoYc9DRM8CL6KG1BDf+nX0bu91hBN1SksLj7JmU0RUOaSNkxc+WcDEYjxNq+2HnEdUW3FV5cetKTchqEhB8gLaDhzXe4wXLklJJsj6DDbTO+V5Dtvrt1wPTtHE6t8A519FO1hD7zcSojjRGhmpIEAzLYVgupGkk6T9sEkq9YziBia3OxkLhNFiogjMqagiya9ZSb00XLAryiursB26k+QJBkn3ZbHyqAlRAoRpC1TW5OQJ0Pve8F6iDNDq3slUVmw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08878EDECD0610B1021899DBDD5C20FAFF0E28A127-0\r\nServer: nginx\r\nWechatpay-Nonce: ebfa8d9aa2b554bc24385e6c61ede5f0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: iIiduCHBqJCcG8fpoinqwhMLDrsy3ad9gRpL59j2PhToITFUtLAj3Yp5RlnRWplxzaBb11Yf/EYjug00lfj0mXHiCjEcIOXLWVhEgAG2PgsEzIsSjHR+IAmvQgDTO73uX4BApYrJ9rl9F0yQ6o05RupIC/o7932u4qm1+VgxPsPil3IYTphzDF3gB9WDJddr0TPFYpn/+PVdah7O3AzafQUSIVujo/XXqJQvQd3DaHh+aydMG3qmnGk5yqvQM2+ASYj0A4rVLf5EkTVyjFAKtZLTefqvN8LU5x0YCc/rCcqOBPtr5LYahwPs0s2d1X94XUYK8HDkuImfmdt5EiTp1Q==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635335\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115923493856\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115924572115?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"F5hbQEi4CA8jaZy5oNRrsKJHz2Iq8MdF\",timestamp=\"1773635335\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ca3LqpJ3ZDvyQI2+Xv4kw37pgO4Yrs5JDrJND2W/7xrQsu5ZdJKXukJx23yqg5kLpgdjp3aiGJT8qPc38lC4VaRJZTMHKJjPDzg2lk+naTnZYUHuugcB92WYuOOHTPiXR+oDogS1gmmhTPpmiymOCEQkfCe3BQJ6rUd45bu0tBB8gbIGrOvOzkOR5sbii15eXM9xxfPiZjZjTLzRoPkScTZBvdbs7R5xvLomDRJfJzljV6a1+c8Zr/9LQsnAdT99y4wJQ326ejZrRcbYoqiLlGUXC6UyvjvNes+8bV9jNmQkI/4e4Y3ZkfFYcVV62HxaXZndQ9wd4+Ss9lFGn3mabA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08878EDECD0610B30418F7ACB1A80120ACDE0328B9C303-0\r\nServer: nginx\r\nWechatpay-Nonce: b89f16d8d889d9d27ed5aeddd7b8cae7\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: C/gVREMHXH8vQYW6Ifmlp/SlK+wIHjsKORKpiqU6rZ2y6sCkvxIOnL9BoF4/CoKSy3waRO0cuM57ajto9zD8fdA20sTmtaFlq04muCNsSfdgiqp/PFAgeauOJEV+HzrNmbgfRlE7wzvtAXxiBNGlrhLdoaFOlqrC8YoUufVRnU7WwukouWVQEjO7d3UJTAALdtkcahjUUUntNhu4oY2u8EXEPJV24alh0nsRtLqF0k3ZKzFqg6+ZUkYjt7FZLXxLAOPAn1bABF+pEib7rXW2feKOXI0pMTl1sXxxQUJHfey6wacAQwG0Pc5HnUrw10J1BO3sK3szHCtfeKyUXVe9wg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635335\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115924572115\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115926060396?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"dpnLYTAGaAfJ7W7oDg8jClMH2YdmgfWg\",timestamp=\"1773635335\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"3+Ki386yrH39VmtNlm3YDo+ClcA6rlMNowceFubCdo1CWK2pYjPxUpQpsrDPcDHp/+APru57fSdd1CfvQFHCjMaJfhQYGZyDEx97Su8Bc6AWUjAzG4t0Ctb2FUfTG7SOXLFIt89Di3hQYzY+E48V9zTtA96DlIBEOkUoQ8iUSD4kgPzai3XwzIK11crPt9Zqulczk6rBuMBAg/KiziV7LsDf94VKokoV4rmPkJw3rESxLytpPhPVObcIvMf7UODZLKoo5bIVAx4Jd0t4lxsgquPPCKY0LYLEnDuD3V6e1lF1SUcY5nHK3u5v+EbLf2B2k7Hdnec58mMN5jWkM8sPHQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08878EDECD0610920618C0BB8C582088EC2E28C5B405-0\r\nServer: nginx\r\nWechatpay-Nonce: a9ff93b2a06f58a4d897e41d9c6785aa\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: qAXKv5aUwn+lYVra+wCzGIsFM83HLxCQiXw0GLwuufUNoM8WFWHySQw99GGCo1QcFLULvOw9+Lk4xRvVaVbkvWQJ8kZgsiH/xkDZIa4OvCb+0vua8qWxdBSSCiDkRWDht4WelVe0XGkm/gpnl463Nsh6ZYpeM/Mwc701zyPe828NHpUnKh/4Jc3QB9wiYFJYLYeBR2cGzIkxv5tWm65PY118zlZ02eNUtWfU5viZISgwjwbMps9ZG6XH6KArrWOPOW2Qku9LQtCtyPQj4Sr4992/UYijtUKwhCGT4qgwtAtzDYjCunzLqS1Qny3XA08w3IgEaiSTFya3g+Q+Igs7rQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635335\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115926060396\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115928025998?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"VV0aWGRLRIu0wQXvIbuiSgoq5IVqQJeD\",timestamp=\"1773635335\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"DHhOuEqhPmdbyNgb1XeyPj8YBiJbAPMI53jTNqJZHNWoIvROriLj6GiERAFHQnOudtAq1Rh8havWqLDeN7KkMuvZMI74XDC4XDzNBLbgBMkL2UjiqeLMjijfikknqzOKs+SnrGMDYhjKFat9k+47rgDTRs0SizdFZH2rEwvSneRszmcQmzJXa2fAD7xOnOhwuN9AlHd/GZbmp0qdb17cmKYgpeT0wX2BPyLDotHPjzMqMlzsVpM0DWgb//yEMaxDzciATbOCdivjbfk5ZZmUYWOgM72TCcYXud892VD6gG1dVED8GSjSZbWB85yABBVWPsSFZyYuybVJxnwLW3e6Ig==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08888EDECD061007188ED18C5820A6E20D28CDD805-0\r\nServer: nginx\r\nWechatpay-Nonce: b7c5c05606dc9d96669c8363a7b7a170\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ClWA7GPt0CMlJHIVfX4rX/I9KPkmaZZ5Nj8PpZr7iZJHazjNHteIGVJiPwe6OEP5mJL9EJYyIDLvNME5PtR/W/Xhm1X5p6eOqDFWHipX6Z0TIOio/nqbnzTcevk2qNMPVRAlNWfhEwIX5WiqzVCfuiWaUW7tEUDnR3Lh9eeed4c/j/dt8Amsz0xLDo0OZoN0tW3opM15z7GYCZHgAvv6ebQhvKaIZbDK4DA6P7Q4abVqftN/hEr1ROwuMHsbtI0CR9zKG+TnKI0IRrp7NSbozyyiyuniu/UplIdN2SS6ctbqC5BRW7vSNnhOE5TVzxT27wSKFDGgSYrNPFLXJXwbxQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635336\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115928025998\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115929440151?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"DLUhnczBxq1WaiC6KXWorFyZcXPQYLne\",timestamp=\"1773635336\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"eBQrjrohm7dBD2F1JkYBmfYSZULyIyV+MVcBh8veBMHBfDX6RMP/n/AH6Frbb2mwqgbn9nrPe1+XHnW3Y4exq/3imcAhTkMo7Gb59HqvEp/wav4iS65pEBM4+ARMc4C+mELa5Om0ByD1bSGFXTXP7+XX7ad0cWb3SJqA/aqs80bZL2+pnHjAf+kE2yFcfV5SYN08jedIuPUvSnMxKAg599lsqmA7+Hvgg8ECK/MZdrM2+/fD5TBkUT/cVhZq8aZiiSKZ6JudtypZqchquzxuLUPfNcKMvFpNLRh77BxREkOFD9XDlIJrdtZTPnGhcq7SWYXqsAS7VEHbQDb+rS2DSA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08888EDECD0610E20118C6D68C582094961928FCBF02-0\r\nServer: nginx\r\nWechatpay-Nonce: 9c384f70a9d193d770124db01152c6fb\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: au4fTXURzpS8U7cFzllTXEumenHqx7VxUYQYaNZ9sL9nmnJzJr4JPU78EPVSBfUnW6Euig56a+CXUtRCiYZhZy/Nqm3cyHebtzo3IeB6FBIP6qxyNeGMkZNP6aZXbyKtYkL5PJPEH0flQyIgWq38+ZDZTNca8bSQwCMUtncHHs4hBBnFlgkZx7x8jRj0qz27zCp9hsXOM2eBLcjugBwhwb84uTx+OaOfGgcVChjQgoiM9zKv+q2AqlDOsUG+JViBMMwsCmG7GwOWXWwWRHS4oI+fyO++JRAj/2+p5dQq8ckKQGjYL0bcVDOHE9yLeqR8+eNA/10iOArYFMS5IuXGgw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635336\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115929440151\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101055978?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"p4TgHgbqb0WbL1hzRr6uDTb507AemfdR\",timestamp=\"1773635336\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"zgEnzhPWVC9xz0paoeEsTtbMuuUQe4takh5pCgjdHmmUcujkC3mxGkbagXmMsXUxTGtVw/VY4lZ50UWtxlM0XsW+wbHW/0w6gpS7H5QsrLr2xYYd7NrPMEe1qIIpUrqV1A5m3Fv+0u9X2aJHj5uJ21JgUhPdO69NEYnXCmmh+A/StYAou4f1E25Yvf22bk1Bm5niYCc2xCyk9Zt6o+JvZ4DvCgR+mBc9Jnsm1IFmPV7fOueW+9OtmaVjhAqqeMVBEiWrluHOA9JXlDzPdQ5+VWjE+qhQkkPRXKH/RRXS5Cc2Gjsclb6oz/JEyyMTin695xZywa9Uh2PRpGwE9gsC8A==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08888EDECD0610D60318D4B1F8AF012084E21028A1BD03-0\r\nServer: nginx\r\nWechatpay-Nonce: 12846d4ea7e2674c2fb6ac9724d5d6d0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: GRKfBxBqRUI59xJak6A6qyXRF1TBNUABoKArdnUuzWySm9Tx2BB6KbEigQEM7RJ/PMNQcjV7LSiks2EEBtKyh1AkGfFZilECDhPwyE+Q5yhCa4yHZ9+a529Uk1i9/Yrh9JwlJd9BFWZP3xegswuswrlw7/mpSGqLaxgV/bcLxUyTwp8YPeDdX2E5Y3WkMkWoHiCpDfRzD9nVR/OIBInupX94qMXOeXyz+wIpxASe7Ob3KOMreZ9KKxXGoPI9j+6oFKyavb+ZTVZCmS/p7Bj9QpZpuMGYEEfwP1fITml3h/2u5PLT57QS/ibOyLo5T6jVdlln5Q8teuMAdX+cLaDOMg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635336\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120101055978\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120103820331?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"X08uHPLRcupVxf8ocxKsjk7W8n35sol4\",timestamp=\"1773635336\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"EYaz6+qiGxz2O1/11CScs5git67YHPPYadat9hSvAgtWoW/tOCNQNBhaZ/xGNGJfC4/RiILdCXCOVFAs+aHPW+EO4J0nI8HnLSTy5QJV9kh1o27p2dPo5lKPEOkd12oepSfkfWYMkyZxvFgRFs5lB1DLCyXWJ2qbYetZgmtBABFhgqUTZ92/d9Jc6sER+iaM7BtwqPedQGAsy5shfVKT7WiBVNRSTagYyidJ2T+ZXbilNVCgrdEMVt0vX803WObJ1tcOiCma6T5Lr2UDgk/3wucMRQ3j68avmd2nW4ivtG/rUJXHYH7kBCwZj/O2h3I3cLM6/ypW5FaPdkqC6Bs23A==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08888EDECD0610CA05188ADB8C5820B41F28FFFC02-0\r\nServer: nginx\r\nWechatpay-Nonce: 7ea42ad1fabc6979fc3c8e8f98270f09\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: AWquPzz7NAafnDB7OEClSlsk4/8AqWB+rNpiULY5xXpX2WLL11RzckY7sYGTZwHn8FJpzAUS0OJN1pQ92XZq14vKPRrWFAUmrg+M3ARCHzyYQalqBGBBOLRF/YOl/DomtOMdoU/n/Y9Xq/jKlexIqJoqsZQpiv3PEfHhVizINy9dVBtsjYsMQ/9MPTnI0BGH323Bev6w4+DOGQUF/l794yc0KZEg1gofGximuUV9nfDUY6fxgpLc3PNjvNp7I4OYq49GeRTjsk0SnjdynoMDcEW7UeqEp1BH17ICsteBk0XZLHWP6/ZTktvDIKhDpO29CHGlpq3M4oGietMs6zLogw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635336\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120103820331\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120104869949?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"CgwKehPnNByCZvUjDKr59IgHHxKImW6U\",timestamp=\"1773635336\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"O13wey587rQZtnLTClhiFMtjg0MW7rUNB8SAOtvZXq8W6810itaIBoIjcc6NC1L50H5zcqx4gX3GnqCmNitu1P9q0ZgV2FlWYRZaq68x7sJApYvHdxiFDXVSOFsOK6teLEEXInZKKpwqyGYjbOQmXrA9BOjPeAZR73HzNgBu0qZQBxpPjbnf2MFwAFeZ8MfFknwm1A/3eiThSnyb520cKmEslFbzyJdKApfSJSOqOxAC2PMRb4NZuDQFVadfaUB9HyCiqsvYQeObZN0vyOM9UdvfApWzP+/ONsnwNE5if1Cfh4O1WZmMe2LG4SKqPN+E9NITNQHErDgqMR9HjTxaVw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08888EDECD0610AB0718A1AA8C5820ECFB24289CC003-0\r\nServer: nginx\r\nWechatpay-Nonce: 9e8d11b8a544c230c7e150592d94651b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: QV6rXkMJU1HDq1d1n6c9rDX8bX3dr03CZK78QNbZQ14kmyBp4YT2/GYBqKzrJYlKWn7LO6PXxdtzyw3iTXXJELpS6CXJDgyssiIwUYOmAL+CT1IkUWfOt7mAG1w5blkHlTieCt1sbMEZ1Sm9H6BM2m59qiAnGHEmQYoRx2DN0/2A9yCmF2aQruRJLAbYBlt0FTJ501L3K18qByaU19qF5pGTeVBparXz4zDoFMLm3PaXLcsyJhkZ6FJK3j4ITFQvPOq80Sy1goncKOXNVkLu3W0u2S5CWXngiVJfJwLw1K7qzfFkw2XuxGU05dbwoq4D/zj+4aZgxG0Jyx/LZLAAtw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635336\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120104869949\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105044481?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"mHifXcR6gY6R72VYdw3mDCTScpiMhwO5\",timestamp=\"1773635337\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"xdNhNbRlbBeVJ4CVaalNbIuFTmrif5YjUhb/BChGQrS547COgRCCScTIeriCwtDQv+a04Yy5JiibRz3R9hKrai73cu4Pts4CDWCcRR5dcKHcGa6FR3LKWueMgOd/dhbY2eB1CTz229r7Kp5L3a0BRLdYk93mfxQsU3UhgrRU6EccSq5BSB0sjnUWLLYFppt4tQkjUo3W0tMDuddkaWPQeplpkhTUDVRVaeGTwrHSsYIK0cs+WgicblfT9Kmp2Kk8UZ8eeeJ4g77bDcoYRe27N6hWAZGIWbkOGC+AnFVpqNeapUIb1mL/bu7Qkxq32vwsBPMaIwVGoFunVVwRybVV6w==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08898EDECD0610860118D0D88C58208AF71128C79601-0\r\nServer: nginx\r\nWechatpay-Nonce: 818ae374cd33de69ebfb0e6025f3e419\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: BZUb84NKz60DEauo/3b+S//QAhxBJ77RpSvVc2iG4z0sUUdRM0/Uq/nuTU7Ja1SfiWh7MJcGpirVEaos1ajNU/dDdIyLA18bfcXWYScVFUJjIxYuALWafUmiNSuUhapVSCa0yrufL8FxWpIpFb00xUAIq2yK+RtpEsaM35jcCAecxiG4gj5wrnw8JSeb6xaz4WHy/q0m0UHzvp3JVbkE6IjldzxoJnPaWFrextZJvELWbp5UnLDcj2JctzT0Sm5qgkWuUad3mO9yARTBA1jCLcAzGkq1NC/vbtHE/0wCipW6Yfk3M2TflznebQ1vYy1eDQAhD8rCxYnvN9VGiT5pDQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635337\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105044481\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105873193?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"fKQYeMTfAGC12IVrNbZw4SGcVDZE8EgT\",timestamp=\"1773635337\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"432cyZFgWziLEItd0aJMF7VYLb1WSWHZEY9Sd3d4Bl1lRaVMRvpVpzOtz2QFx+ykf6CnsjqIVYRzusDLa6Wz4B+D4RfRQohBL6uIlPhRiVP6IyFKH8wWGFSYQuNtfK7X5aszLh1IUC3OpoOmj3cjYzp3F6KgRGT03+6Ynxw27hEtKqdukGTalqG1hi0JGEJDY5wWOt4oSAr8qqoxgbDq0/VkJQWIYL+IXVt5NnIFsSdUbQA5VQqxyAdHMbA6AobI5gjD8ivLWdyfwcAEKkCybs/P3ydc9KBVtPZrWxExPMYk0koQiniwkXaItPIQoGK08mD4TxqdpIPLKzxNZyXhbg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08898EDECD0610D90218DACEC6AF0120B4E41028EEAA03-0\r\nServer: nginx\r\nWechatpay-Nonce: aec194ab702fc03042365416cb84a6e7\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Dc6spiiphgKG/b1L54NxmlXXGeM0IEYzO31kVszBClW1IlwfLNUfubHNWKUvSWYx63XwAoet4IJThJmN5ErUR5tn9JDbgKdr79JIU4kJYtT6XfNlYx3TFvb5GussezcjhE48grU81l+XRElioIdc+38rcL9AXF6aY4np5BRSt3xzPkbxu1hgijoGkWw5QOXMbTXrLOgiivLvuK5gZz9vvoOuXPZwsrDrWCNVO73IkaXCgwsofV5KOeJGBS4/aRBFpTNcknwGad+gKRqMnZ+AaU7zorPUMEjRaKw9gAOSq3FVxHYnvvx5G4NsBMrWwdEnFH4S/+pw2sGy2frcqWpw0g==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635337\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105873193\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107504965?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"u64FO6Gx7We12Bewsm7QCH13RVX8pSVn\",timestamp=\"1773635337\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"cdQa2K9Vu9RlaToIeFfqRImFl8RG4Hz6uRDKd5bDylZ0VTWP0XC3rrYSK3Dyodq3VXv0T788tefcA9obeoBcCw+6tt0CYeNlS6XLVPrN8wc9Ot0bbSVJLKhJ4nB8oSnggeYg/FkKxRXxXfXUqFSXvn7+deuZYxVY0AdkpJ9tgiBxcpzMLPlSfFlu4DhY12ZQOJwoRDTKQRROWeh6XXMKzSfPvcCzKKXoowQZHkE/l+1KjwUDP3m1IKhpXklHGq2atF97yROxuxw5FhS0AJjOGl7v5SsIliq1BWkFE17JG04OHhL6vFDZ9+NMjHMCrBz64hD0/zcN6XXC5c+80aiBXQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08898EDECD06109C0418A6B7C05520A8B830289612-0\r\nServer: nginx\r\nWechatpay-Nonce: ef89717ce5eca10e7e0063cd8fc8133c\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: fkgjKbYEEyQpUri+G4Ad+SI9YjBNqF9rT3JBcamkpoXzYlSPkmq5Amdc92yVaLjCZOENM9+IJopRTenamHkGH7uE/WP3u19rYpULdqnXdNIL6zXqxs44fBRlNT3v96b/HudMQZmqsFwh+bVFWtDj9YO140gVJiynmVKyNXRJ2cuWLOVG/UHGKJawPOJ24wrXG2LeZew2WJG2hy2pldvKqN+8hlKDn7ug8o7uKtENRo+coD5lwYBuFfsLGYtmG4C2doHgBf864hPpUZ+N0O+2jcHTWm8YAFYD1UjVtsqrfeYSuNQV3JoacZNWY812NAnCIdPWez6uf4HiAQJJrUmoFQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635337\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107504965\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:28:58+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107498697?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"MWNf8oslofpSGgxSECcQ5axwfji2OuRT\",timestamp=\"1773635337\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"QjwtxOV/pNo4PSe43MAHsqLn4RMms/Ei9Qo4hB3Bsl9aB6rSOQUkRvvPFnfJMiMNBwJ6COKfPRKDSqTTTvvIQ++tJ7hjSI+GuF5cz1PvwBi7DSK4X8BCXU1oXDtGQg7HVFHashaWhaVRzimQHvH1QLbEl4iL81wDwCCLPlLI7u1ug7NvkFW379TTTbTujb3U9zyFNkEVJTtqQHcmqZ2zWOgro+mu4Aq39mFB1C9nySXjE4+CcGA8emdwGz1v413cedzFOwfN1Fn/SAKo/GLA6tTmq0TNZTT0Ffg5L1Rz5YP2xmqSyJaipKjYefqyKy7WMRJaZ7q/4Coe9EWgZwyKsw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:28:58+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:28:58 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 088A8EDECD0610980218F1C1EDF50120D6FA3C28E013-0\r\nServer: nginx\r\nWechatpay-Nonce: 510bec34dd981d18c612f89730ec1752\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: qXYQoW+7O1oI+tD/qWSQxmFpE/CFinLecQViluYSeqDa46jCDRql/FtMtgXfIWnnZpSutFCo91T/1u1Dv3ZkT0cfuX7r556EV/IjtSfDE2/NC+1T4BgBmh8BCV+sEjrsxhgJfrzd0nhzmv8WUxIquuuByuQoZbBTMS1ISg9mXmS3+KZ3aNB6s+jY3VHHJ1qnXFfOBUnoCfdAatQaBNZ7RyeMAtiAikJbRJHPormDEpNmGI2JYH9/1gBzVrTD5raw8rp+ojZJsZEzg6BvdsRUg27DiyqOxR8yLV8dSkTLq9tnHiNWo11s1IY8bUeK7FHCGluK4xBmNoVPd+YxoKyDNg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635338\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107498697\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115923493856?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"iqxaRRpRPawo4ZCJUnfzkfimAGNhxlKa\",timestamp=\"1773635635\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"igyAm6zUi8sYpDrHEiwf16ze7znOKPS1fVfPdSq6d4X5ofHjMKd9k6rcM02AWcxU9BiN6DjusP4ReWeamuyNKpRWmIuRq93HGYVSnrlwxMOb9zfmvPrmdWpBG202YuOWfqosrCOYMteDVnQLH01Wf38p6M37DlVTi/RPAxrhQs7pWFhkJvMoN2I/mP/6mUkuWi4uvj2+I4HfraybrTKwr07Izxr1tkCnqxg6/vuy4dm/SX+Ksz1ZReR9qlaHbf9IlwocTBoMcUC66nnw7XuxkWleXFmoSNkwI1JoHDW/FYYvnjE82DZb6qsxbNqNyXjHKxf2g/CidFW11kqYZLbvAA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B390DECD0610820218D2CBC05520F2A91C289C8003-0\r\nServer: nginx\r\nWechatpay-Nonce: 52332a422dd7de111ccf3e810dfe56bf\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: jNXSAeQTKqg7XQXYkXsAPWeaZ6Y5rDTNSQ7oj7iIZpmNgRfKqPx0ESpWJphurGUXFaDYU59W611xMNipUiYhDWiT7AeIZlFHC55Znm5rL8xJ3CLcxXji/0jwH8zbxCkayVNjjfr0MLreyz7Ky3d4l0FdStJU5xv+iM0sqTWd+oKpcDSq5GI7E2Gd0Qw1qaZI50oHBMWHCQbBro9y9yY3FqfepulKSVAQ2yy9x9JpxjBRY4lIRIWqNSPJBtj/9KiO6JIAbAeBcGmm7hLv49U5pG9A4oD+ipSdVxvJ/btSwexQTkcwn6qrwoEG6R0UP//Ea5doKWyyO5Snm5/t3mBm/Q==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635635\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115923493856\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115924572115?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"74LQKH4MoJauDWVhmu7ZflGYtBCRCGbG\",timestamp=\"1773635635\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"MgU5H9FU2rG1SfMo/OHyS35cqw8ox0YmIsvBa50eysqYvHC96af/CzSsSAeRc/PKlPR+8ZK7rM0DBCezyCcDD0CM7VwTKblHPw6JCiiLCBwypvRzYO7NHBheD5OMmbgBCrjcyV9ZM1RLC+Nh+73BaoLyjjJYqTHX67TYIPUzxFoa657hIUc0BR9WN3hwHVHF8RO2LfebOR+yQXSHHcUOqdkx2CMkmeUbtxC4ahn1UtiDVxqstOMt6nEEaRPQMDYmVmqC/fYs1gRJ6oIlZjYU51Wvy03G/bFR6QcRJzPE3n6FBvTHxkbxY33gIyvuUVc/4tQYOxTXyCyR3x0NJ2SoQQ==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B390DECD06108604188FAAC05520E67628EF9504-0\r\nServer: nginx\r\nWechatpay-Nonce: 134fb97e519e4d6fc8fbd0093981971b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ywm13QPgOSQx+pjh+do6OU4lWZfaTYavUDmSvpeMw8/9RdViGtinDvcjuBy15qrQJmbqAqynPvuB6O/ajg6PTi+8gQ5Te6hlYzeDR+5XhDHBSHoVgQWUrbNUCBj/K8jTYdFW7b793iHhYh7afysQeFwqYcEYNY0fhvvff0wTT4a4DQo5ehKRBCX+fUANSjKskswZaPKqwuVIX8dN88pK2ZLO2R77uLslHnkYCJkWW7NqMr+3hWQpXx9YJszFSBQQVPl5IY4OqBRtkPWbsxNV82r/t6WpLaZigZ75I9RZRJYrEuETtWDew1rPrWTSW5sxt3A+c550oANfCh7hNnDXfg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635635\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115924572115\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:55+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115926060396?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Pn2ELlKmsfUuIeZHUXnxh9lgrkclwOBl\",timestamp=\"1773635635\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"a3tfaxBbp9bhroC5i8sWuyhZBO5FsTc/mNg2qLn9oKE6vVRJL3Le9/ObEWTM0SH6btXbSPf4yO0yJwQj2DsuNdOr3VnJJLm0cHUHCqSGDTWv7rKkceeUEhyo3870f33K0Rel0zBv4XgYxZUT2iDkZ+mipqN5W6oOdlOn8O8DCfa9AAfuI2bFtru59Q+0Q9OrtkynatW2/I4kQOvcWKb3gDPG+vcUGK7YRekEgtW8vYDutSGs1m3850s0Trv9WCRxkq5uGXSo5hu7jWgzb5BG9ytkq5qYH7u1QySDTpOV5w47pfkD65pCKxmM/JPuxR/uhyCP9kBUi2vdDL0v6AbtYQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:55+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:55 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B390DECD0610BB0618AEDA8C5820CAA23628A1E703-0\r\nServer: nginx\r\nWechatpay-Nonce: 634c52b420b72f193218f0155809dc85\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: YFMWKmuzMCpK0FaM6CIqi78tI3WwRQiQqdOZ662knZrdewS3SjhMqrs71dVv3mkbrodiaYSWAeFni/ZRuLs7kKsXQ06a6SDZT8/P2rpgs+loj8pHC/b9/D8KtrlJ/tmbUB1jSQHoKSy/3NnWHE/ra8FvV8vCiSU7QbBLcafgwui0313CX3/8MKyRbTUZX2alzDGXGrvuX9b38RJ6D51uHKuFB20ypzs6UoB3pVxy4SLNaACg4y5MJjwOJY1kY6JbtH5DDgq70Ob8kQIpHLa82PrIE3LHdgOcr8xcq5+7/PEnrrjZW+Uo7gfjxj9BGtN+5slhMo095IKj9K30vp5OXw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635635\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115926060396\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115928025998?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"pT5hH58Aao3Jr5wwWKpBG4NJ6GdgKv6U\",timestamp=\"1773635636\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"0OzzIOvP87dQMjlm/55BLzcgUfscknICia79ZOkTwXweVcRjLgqlb1YxaDEB4lDcmxJxPj3Xv1jZCthZ54Jr8SG9wcVKmTmTYFgdDTLN6TasoSeqhGE7mKksBWM8HrL/qvA5zSWST9IgUXGdHKAw29NqZV5Lt/oej32YJPLPCvdLBaw/tXbrlBKmMohP8Wid+i6lwlxAOmgOOno9sh/XwOEs7ZL5Yk+YWLz9s4Zu2GwSl5D7cLCGA9cRS9clJo5bGiLJAwlv1H3FPSBNdEjbNez4ao24g+cUTRVD8iQxYXXxc+1cmEFs4mtjEU65+rnFw1ET5gdMA2SYmB7mpdSoPQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B490DECD0610C80118BAE7F8AF0120A6E00528F49803-0\r\nServer: nginx\r\nWechatpay-Nonce: b4da7eb3d40cf72bc7cb88a8f77cdf63\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ezuy/79ySEDVOcrCBCBk5aUQlgu5T8IJS2KrTjd6a1RoRsv+mrl3dS+dRaLHBKLlfPa7sH8mRyFcZAGkxHKgF5sJAaNeYAH/j17G3bvcNJxel50Nj3+BzBknj7DrmoLzA5ENc9NNLeuW5g20GvTpXebyNpyIFGK3zgR+ZtTdFA1aTtXr4eSUTGoKFrbu01TgPJey6nLGRqVk+P07IXFWNooq0t9qsGiyDMi4aaaMZPdwujnPDi3jIxKaWNWkmrAYR3f4ItJhaMJU9cE2WLLpODitXy/o5J4MEgkD8J1YtOrSc+dhKzy9zGBryo7QxsU58Hcp8j2DWOX+YvRJxhqGWg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635636\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115928025998\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316115929440151?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"QqjyH6NPb9GGbmNV0EqGZuK7TdVlramM\",timestamp=\"1773635636\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"t/JG3TVlseCYmeK5x9ix3YSdTyTggmwaJbHgK8cSRprCuQSvwIpSkINFl/uFA4nO1O9h0ipGpr+/s1Yj8aymXt1xkww2lKdPf97cZovP+lT3YluZ5eISLvP2KOCU6r05OVGawJrVNJ89GgNWeSfRj07ZffBTDG5ML91Qa6axJvTst6UGKLoFanCiIUfMQsVWYMAuNftsFS7iToZ/YFhqJAE3cngDtac2w1d6+Vv7ZMA2b8g992p43/+UH2JVpaOaZEZw5KeyIH63J+L/R+6kUMGza8WJbo75j7S2dDmV6A9WGp04CTndQvaQBFqsZut6QBxCXqlAOfFcKIKH/z7Utw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B490DECD0610A10418DFD5DD5C20EEDC0328D95D-0\r\nServer: nginx\r\nWechatpay-Nonce: 7cf2db9543cda58fd616883a5151466f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Plg3iPejmmkh+C10KIMbn3rjAwv/haty1qWU2PYGdhghmmJtZ/zqyIGY2dKoKQ9caxFAX1ZYIRUIqfM/VEpjxCG5a4aeL5A8G55ODPoAY1KPrl3Y7Qyn1PV06bnJmu+lExJ9uj+Zd3OWcqFn69PPAA59qdj6CoqAHiNe/JQAjqCaW15Qa5K/3qvvcs4JjAwitv0xEm6pi/kpbRKsV5HSYadYnboPR6+qNyMWiRUpUTkKqvdS++wJEHM1dBF/SCjWv6wCodpoCnQSUUPIiPpuFRIQdb17ejPeh9QejNN0URhgXkxtM9MNWzTSMKM0GK5+I2POvnPNV9iThvmgmfLBaQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635636\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316115929440151\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120101055978?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"0YaPFMCmH4q7woTrFrycwglyt4AjiNU6\",timestamp=\"1773635636\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"lyTdBG/gx+AnCCTdipSwYJcJEMZ8ixafkzC92s8d0lI05nn1QfWlpAkPQDTf4yAiU4eylB77+FOKzrmOiVlOyARbOl5RzzXn/emHx+l9lHLOEQbNHeqNd4ht0dxozQPHlNkH05ub8Wa96H05yY6m66vsO5gzmMAddj54nhLb11Hzt+XF7gL+KPoZ1FbvE1/2xH4YOczQkkSthoJObFPtCn85y5stnhsbCNdbDm6VL4jp8+xlpTzQeRCa4Xot8nFefq9zTw+jTXUO9t/hMi2G1NRsq3bGonaD0uvVglXRohWH6CiyHP1btyp5WyQDLVcYFCCPAiZDfSC1Jl+R+K64tA==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B490DECD0610E60618D3CD81F50120F89E2228EC9203-0\r\nServer: nginx\r\nWechatpay-Nonce: 96e53bd78d6cfaea106054f6704e1013\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Fdah78iXIIZ5oFTL6DyzsL6TMQuYftH2dNlxpmNb7O0O8YXYs7kKvWumbAx5z5qC3GkJSA4cg1cLB4cSXMu/BBf/MZ1eAoD8I8+Ws/W1gON/jjtg93bQbrj08MMPyJJaU9Nx0SJ/LQLkUVVjA28k6QVvYMPP41XD8Gxkw/drDn1oIbGgk+c6pua0S5qaq0y4GLGdku53OMewYK2bRYzX/pZkBbY+6i2eU7djiWU+kfPrLh6OKPscfcUDeQIe0w6pdd1Tm+YuoA9b6m50gLvXz27OZ3EwGQAtz+44abZUTNQC624nEvXgxBsU9rFPajkesBPwmq//JrjqXo76Pr9GPw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635636\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120101055978\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120103820331?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"OgpfksX3WThqoYV5H2Ut8UCg4lbHYmfz\",timestamp=\"1773635637\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"QK+CLGsSYAqBP/GwxuOUUgDawb8rvSGif/WQkMion2CYVEDIIhWIiH/sU8hKOfKs8TlJOcvNZeiY4LkkRPAOanJhNrcVBJuxaSCAQjW508hJ8p8Y0/JdBzrefG7Ei8CUOA4XFN7mkZQyKr48yGOM79gJkxKNBJ9iTI7MX5tdOnjpVWsrJJFGd5qjPvaCuWp5uavREFgEwaepLwoMsJWdfedfMY272fjumiZ6JrMrq6o+o3AuaGdfMnz/KAky5wmcaeiE7XpFnvk4ZkJLNC5A1uReVL/9EUPpTPxw9g79NXFCLTODirkUXfy+npfPp3U3qtqh1ftPO2YwxAGgHp/D7A==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B590DECD06108401189FCBC05520A4E42728DDD103-0\r\nServer: nginx\r\nWechatpay-Nonce: 7845f5353e12331b6b76907ded22a1c6\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: zRlswx0KW2nNTi770HhFhTeA3DPXEAb2uY9sZQWd8yiUEV4fXHk5SJlgvbWusbxFsNfDwkuZEaF+uI4frJbmo7QHIC4zyfwHkhvbjQOSCjfLKpPatldWRIStL2SIA/zSMQADUhlQ4qc/ebHNRmPc321O3bl/mqnWzwgecWW3yJ8JstH4qM75saBYDCHWsRFSACGyNJYjB5aaC4n3ofEYHnj/VVw/91hqed6SiqD//+XDbtj6sMPEupGdvZ2BfhHbNNeUYL/t/lWxv74G6XWi24D+vv5p6CI+q+eaMXNeqQcOxq+CgVEJDgySraHBXeuvZJmCZWDjcifnj0qG56KQNQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635637\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120103820331\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120104869949?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"F941GZfJDjqYbWPMosRmG3Ey4pJpQwVA\",timestamp=\"1773635637\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ggKsKVp0t2UcBvVfNMNuTwe3npAlKjjQj9ForiA4naTTsTIgc+mb8HZ7/f2187mQtV6CiHGnGTEmBtpT284r3t+rxSZEnJ9mOhSejjtBQtqZ0eaoxWjqEBzys3BwO8muQbtag0XInppuxjvytmWx0otaxBOZj4jvbz3p6wt22pxjejQeWrgyLBipfutT51gXHBrvc+sFfGKGC2O6fmvVXetpGitzjMvnbFB59uk4cSE3C5ryITsAVPCHH05/5sH+xw5AI+1uF1sRVUHmgWIXpm5YFpi+JzzvhIbyy+qeEQ4qqlHenuRfBpYpO2ZuUpmE6+KepztQB+eNJpv9BPgTyw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B590DECD0610A90318C6CEC05520B4EE01288EF802-0\r\nServer: nginx\r\nWechatpay-Nonce: a41369fc0aec232c18a97f56ae32d603\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Adu58jXoFuJoHj6SgTC35Fe6m+RloKAvRtzVVWtK6rHTydzKJ50gBQ8kznHcis8mK9+925AiNHViLKGsg8AbRFYQMsppudIojlw+pdh8LT10oXOipt/waEEabSD6xyPasgFp/stI1HG8gWx8IjXJui0ksRi8iF+vezLIkMKS+EnlcNzd1zwXz43+OtE66gYtQafCpMllHVqBx5XilzvIRCFQTITmlmyIyJ25WNOGyE0jbRShdY1ipUCaR4dCyPYKDpg3friRMMGwlFEThPy4d6TZb4HQv6+guTMMM9/83tE4mACpQMFeip8mb8rftc+uoFQKajOIS39RNcmH7bPN0Q==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635637\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120104869949\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105044481?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"9V672VHJg36XFsoMZ9sg74WR1ahw5WPb\",timestamp=\"1773635637\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"0QdoFre2rbCalPO3kDrOtMZD0N1ZiLphoFD/HEw1fREQKs/wAnzmpC89Lyb9he976rG/88LH4+rp7yOhsy7U+iKycJfqFJEBuRp7PKh14eWiBblif0ZKx61SNUlWdaybA45ob77992t4TKevBpXVGQ/wOdg9uhr3GNV2QtYAMhvLsCV8eiNab1aAj4kQlDp++5VWtQaPiZb8pZQhUA9eW/bi4nvrDeqIszBgHspvchEm1/5WB0pkumAmsMgnwvP4tpRTb2yN7A0a7fRiue/Q4L3eOF6adOdAAkCNh3wIPcpNg65RCVCJjS5iIEw2lWm7sw/fU1DsOJDIhgk3pB6QqA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B590DECD0610A705189DA0F8AF01209EE0122886A701-0\r\nServer: nginx\r\nWechatpay-Nonce: 9bc4a45997992656fe3c73fadc53c1d8\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: xMemWv9CNMzWXoI3Gi8yuoRut9sW1b2OgwZQov2TPrX20HrGRFtnMLGKqbSIWUCbYoau109xJ3kyDq97NbssA78QFVUwY0TewtwG75pxFTP4rt5/S9j8ej+2go3/A1Nrvd52DcYMyQ1Z/QH4OJWTB96GuHF36vZsJCs8MBsoVSdc47q95XgHaMoymewMYFjzWGRXor4S4zWeQflKdEmkB11P2ZIChVK0WKlNgEl4MJe0Y8hXwAs1TJZAG2RCS3dtMnWp6TuC9rRC5e1cKg9IVWUD9KidoDAV5BMcfFQsbjweNj00HhDFGFDLotwRsE4Ul0SPsaC6Pi+331GRZ1cyQQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635637\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105044481\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:58+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120105873193?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ARLxLMQO5Gt14rwPfEDBVrtc9RPdbUrA\",timestamp=\"1773635638\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"yriimCKDC/894QGrVtlLD8Vt1p/CpXM33IzCKWlLZhJQbMRmtRwZEckqFqdgoSx0LzL/5ssAnxo1Si2X8a1WIeYhTULwANQrBHd/GCLGAKVcb3/xBJR9G16LzA1aynmQrILjn/0UVAVmqvnGZjxE5cXCG8XmN0WTrC9UcmJkYsBnKTRbR9CoYrCX2o8/IN+mUi9iYTXoVjf1JZIul6ojkp8whfZ5+V+dO1X1ysjkAOo453fzxZ1lffE64c4NRB3wKiVqFzI5SpIfrvFNOw0ebu92sLYRFUN6gFxTpSbf2Wkz1EN0oL5gWij0u3DLZnDOBG6v7aXXTTI49hvvpGgzOg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:58+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:58 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B690DECD0610B40118BCC8C05520F6E91828A8C204-0\r\nServer: nginx\r\nWechatpay-Nonce: b8797d834abddcbb2575d85cca0c2a78\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: rKryVfLLbH8awo4vZvNOPZ0JYqxJtx4Fy3/MrE5r9dwwxcw13m/DJWMesvei22rkrEnWwz9BpgrJdotmIUuk0MPzIQxm0ubBt59QTlmdgr6HncVoL5KBNFnRqf6CdZSTn79n/nkkcs7IKSyLa9B6AX+jsrubL5wR6SzYpYV5PgjUl2mczX49SmcqvyTPnRGjEW7gmOz/JybxzUyijmOVqvpArvoKwa+B+uB5MSwD5I/ha1AlGNB2bisLqChk1oN+qo+P5l37h+1eXNPCeT/K4V00qtlVwG7bjbABz6aplgzmUiTC74QnMne2/CyC2Gkr6PbB6LXTYu4DIX70X7qS0A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635638\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120105873193\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:58+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107504965?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"F9bpTkcxCedlc5cSb2TV3rcPogBFptPb\",timestamp=\"1773635638\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"HL6XEfqvsAQ1XWpBiYjk1HgVUnbVWsMHg9F3xtuMA42JKNUriN5ANJMkwoNlACfZamd2ioq3245AsSCRjkIqrsHBo3/fvBmt/JDXmdRy02tRjHgSRqZctmL6834+R2HHEVUBbj786jK+vf5gWNO0P1hAawCFbxDjnHPTO33sZ7BGWEyi5G4DtMX6+DHp5GXGqIC6V3yZ9LiCIdTOcgb0YlFRgHDPJ4IDXl6d+8EKGgBSGXE3kfOVF/8ReB+UvRUo+xK/IzCyV9OJFGOIY5HDebLEVFKPrIMLHJNXBpT2yH5dsiweUsLZkmKDrCM2SUN+nxuE3O4LhLor56nBPMih8A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:58+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:58 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B690DECD0610FB0318C0C0C05520E8A1102887AB03-0\r\nServer: nginx\r\nWechatpay-Nonce: ef8fe53c24762d2c876884889f2ba4c1\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: lZmmXtr0OpoHNkqlIn0rljN10KrFRZPQ0iOdrtrgFsO0EV6OJTmj64ZBGKIA57KtCH7l41/Qvx+Id/LLiaMNlIuBCWExtHP3TW6aanslCHKpgDa8wxnu2LgfLpWDNuTUDrOQtIeu1kjP5h2Oie8hs9aAUXhKzzYDvReZ1fQcNqtxC7VMTjyqMP47oGhXiHTzIfsBdwOtsJ8p2AQMJ/nA7wxG09UO5m84Mt1/bB3sdjOhYYWSpr3FdZF7n9RUlhoxVwtmAe+5rgO18y99mwZ4lsNHbIzxwGJ+OcfMhlSz4xmng/44WjzpttcV9KFYo99WqjvTcKhRI0mwXjVMlb4HzQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635638\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107504965\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:33:58+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316120107498697?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"hdiVzFZFVMpapNywOPF9VBLBxo3qGR3a\",timestamp=\"1773635638\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"J9cQY2l9MZNL5cXJT+njUL1IQUNBlh9mHV8nn+1uDS14D11bwDUeH8P1B07hsUjRjl+TygBVlWo7MJ9MSvoS8QP/tr+mvUB9Zyf/csyu0m91D+DjiBApcP1FRZSjXZbcm+EyVn4SRgqvOx1U0PDHQeD35HGvI9TN08bUk+UTYSpBPLqqZn0G/QF3hmAHQsBr/R8wZGyO5D27+dXKmAlBMtGQFD1y42cFDLpmK9svzixhzT2GpbvL6SueWiY6lZUVMREDMAqEgv9PEMqyQNwIEwpBnydXbmU3tQhJ1qYZWBF8iN0WWecUxgE64XFyOTZjXrqonbEImg5RmWx3MlMXMA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:33:58+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:33:58 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B690DECD0610800618C082ECAE0120AE9E1F28DAD704-0\r\nServer: nginx\r\nWechatpay-Nonce: c666ab6a98178262c502f93cc9cb184a\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ilmf+hoaxdCJsW3xgtylMN4jWMklrt+FA2VCePlkcmeOeJg/BKAp1qbpGTjeoGfgQA03gkCkpzKq8we3rQZr9YN6R7fmCfqPDwzYewa+5Hv5uZsSd2S9s9mRqm5paPo773NUBI1jviiLHAzQ4TQW+RRPEhuDFOu6KvQOdOIq/jLvxtNFLoSiDP+riqyHgXBYg8qy3NYi2Lby3S3Ki5R9QFNiB1b2RGgCs0aQ4g2333kkC03R6sin9tvQHSfI0krdafhn+BzyHEPSm0Ekc15Kya4H0Fjamwsm5jnb4lYXaO1lKanvitYHx1bL3BNW3X5Rd0DD0MnUKeBDGOqaMyZM3A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773635638\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316120107498697\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T12:58:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125828308899?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"XED5xSDUwOZgNPZlspG7zwhV3eY8YQls\",timestamp=\"1773637135\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"frCMMzOeKWyQSdHed/VBU+7dbFs6Qgv44BATnV6mC3Mg+JjvsaQAnxANj4vwEIjXUYaNu0rm0y6bcgvQ+jvxxRcsSbyFA9jAgnJiwtT/5EIRnsL9PHx+5YUqkLlbBiSsLzfTdyiAGVhVsKHgZeaDfNdpLgxn5ZVy85cUmq7BwzF5CFIUC50FgB8e7SkwE1QdyYfTE7Q29iVEYg2BdH1qjzk0nBTU/Di0iwg3TeXgq+pg2BQLCpew5bmEl39p0sp2vSsQC1cd60l4FQHPPgF7KgpvM3xa8X4BBfd4Rould928ZR3+ezgcVoKf3jDwSXGME+WYL0MMzBTdJ1XwhSNJMw==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T12:58:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 04:58:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 088F9CDECD0610A90718ECB2F8AF01208CFA0D28983-0\r\nServer: nginx\r\nWechatpay-Nonce: b459de133a9fbd2203acf0eb4cd76f09\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: s+UXy2VBgx6/3uN4j/7tLNgUyZmZ9YhAGSMonUb5GuvqTgPLG2KVNx7I32KD2MFAsxde1YKo1yyTy0Q4ZCqSu8J9fR9ppsc0igFRzpnYlfqU31jUsxZ1QzruhmgB54qyj9BMTvcJV5jxegx7MYQqu4kuMsqEdu/FuAT4i1CxH7zTfEea8wgTSJHIJWp/44IBvd1asLjKmS5ZPWGu4nHmSBD5j/Y/gA9iKclhPh9eS9D3WOIkXnaz3b6/39j7YdqaJcfM+j1UIQMu8EaDDS93QanhJHmvIWM7sc72R68TR+zDZ1Y96GQa5+S+iaExVQR0m14grOVeW/6hb3RtVFyUvg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773637136\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125828308899\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:03:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125828308899?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Gv6qQVCEDF3pVTTB7VLxGdePVH9HZD4p\",timestamp=\"1773637435\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"TaNy100xPCKaIeeJcs2sNN24cNCQSnWN6pctCKPMuyQ3Gv/84K9wLOSdxMc+EN/YHM/alBv+cXW3Qjz0XjBYRo2o2Z+4QG9UIqm6XRxbwIh45PkL5I3FZrb2YSe+V3Z9PPOC5mYr759jkhWMUsXrs+vQWYP+NBGCnSAt3WnZKlWDk7hQ94hXMNBuKwNhERpPZ4Y3luAuUZTOHJDLQVtWkwkajKKY4SYAXX0WjwQWiFoZ6S1/CfQObrmWzhaP1Ch+sYYuH0AnuI4Gc5LZHtQjsO9bbqzi9SETuPbka1qdPbjq9ycF7w2x3AUWistAckHRIl5cOAG2hOBp02rqtpAfBw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:03:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:03:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BC9EDECD0610BF0518C9D68C5820C0811528B5EC02-0\r\nServer: nginx\r\nWechatpay-Nonce: afae51626317bdf4edbaec8d08e7a4e3\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ECdJQtV/Y1KASfHdk65PUYRSY8J/wi16TG88ljFMY5CgR4hk1bEjn52CmodqI1npRaNKRZHwVpdRGmzSZEhX7IgEE/AiXtZ4JuiL7V/FRhpoxxwuMDNz+mmkLpFzipveqgg4TeIWLcfzgmAUHzXeaO97WF2nLzmTmtTaIHtgSbDZ+ULHFmoGXn58E3dO7Rf8xpZhvtAfZ3qH2XmETCSrGTQznYo9MkOJQqNl6taiAOd+mI//B6rEL6qu1iA51Xnvx3FVtkOfc81b77Q+DVQSX53Y0S6Er0gG2xunLogY5jHMwUgNHo/cFCP1jmkV2xgpMcQW3mMSUfy+I4lGEwvyEQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773637436\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125828308899\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:03:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125907232069?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"6XYjuukHGhCwCEuqnrcxjgz7AAAXAwnD\",timestamp=\"1773637436\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ky3sSS9NLiPovDRr/KfsLXWcGkrXBQxfb3ecAiwhPR0mAWhKtqQAeenD6DGpwAlq/raMl6fksrMA4FhF0TUPS2X39Ir8NNJQZVK0xEvRNo8VXkQ2IkNw6mMqnPIcT9yXsN3Fpf6FVIPoeesdaMX+CYKcT7eC5cnE7tyFzY1BHzxJXlf/F747nIrgm03GQDhdgEFPoBYhDvZv8beoloRWGzglwUXYJxJIEXgn8fGMVM1UjR6AyjVoquaG9iAHq4gCN6XQdMtA6gKymHTkwHEb0BvuHirvqyHRQqPW0N0/sOo8q+w9dzBBhu6YBwvb1XfaEGvrE8vbprqg93sPL4LESQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:03:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:03:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BD9EDECD06103618B0BB8C5820FE9805288E8904-0\r\nServer: nginx\r\nWechatpay-Nonce: f84291834ff980a9d4cf8c42b562ed5c\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Ja9zAn9Ick658tPQw+f2dlDbjcy77DGXVbvF2fh5A9Vb+MfTG+w9vkSKd7gO2gh7KKg6nB4BWOYsxVW+l0Wc2Aed2n3DQuRgKsK8IeSgGzQGblSIzzmSvf2KefmbQkDe3ENy32Ez35VnfqCxVwMw6jAkV2ipRfXf9yGNikGCw9E4Fa36XCTX5R6Hund4PkdDuLrGxHOPHMygalJXLXN9KkwzRvfSMygU+oXszIcGSZpZbdXHYw4kWmD4GuchXIMAT63tOCvzsCLIrcgO2+ZRKWqj0/vOu/Ww0NT2VqmmE/OijJGggSMYI1RvXrMgzlCzhft6FoI9u1S2+ImcoV1T2g==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773637437\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125907232069\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:03:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125908227824?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"WfoEtx7KikLVNAZenVnyXW8ivkZn5syR\",timestamp=\"1773637437\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"TvFSqqYfVyMxIfIATuUQSkpHMaaOd0667olmR+Wlh51OHFtzhaVF4SyRMCUrKwVugDpojeb4hvPv2kv7HKu/A0DlFaukYCs/g2VUkDdAo7rlj/qoy98sG3hudiR9fLqR4ZIundITwNTzytpIKM1sfs9iDzuxlLhfWOEuZDz5JT5soamqPjyisRHRK9hB12vwaIxNxrN7n9hgRiYdBVdgbw1IZKf4Iwif5f7/IJFP1QlMkBB/CDBV1Ki7S1V36b43Iw31gaw9VZMNdXbWzVGKA9HG13SEVptWldmgGo0PzSMI3+ptAPypRiWIx2dCS/Np8OtLWCEC0wOIPFCsy+lqTw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:03:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:03:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BD9EDECD0610CF031884C48C582080D20228C8EB01-0\r\nServer: nginx\r\nWechatpay-Nonce: 854119fab1386606a9b7ae0e3b43bf37\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: RO3t3p5RIk480iWu67dUaXHnHMn9fqMovIQLiNQDd9iohQ0ayckcXsAhGZXPOw1jzcO5l17URJImdbmyskgKKUOPfZASR5Q8n4xJcMAVPoMu5c2qEuuPbbO6BQi4oZ5Vu8YAXvFKfUO/SrIk+lDHhd3C0/CkFC/IBu1G+PVQtnDI9Gy5NVG9mxNHGUWp5XoBGiLWUDUHSDA+47uUe0cnX9nDuKqTRr3DVWSn9hxIHDpnikHwhxYtomBtgv1FK4a+xJqDC/YaJRzj7qmiyZ/cRLFzxNk5p50ZzyvOefRY3NtrOmr+F2R7OQqlTK3uy16ROlTU6nMewo7uCh3UqYEWYA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773637437\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125908227824\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:08:59+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125828308899?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"PIS3BzNJ4JBsb9Br0nlZsJZzLi2CZiMy\",timestamp=\"1773637735\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"a0zYeOco3VVqcWwr+KRLZutl3/WYvlnjxSNpsUByNcLZlK+FqIxcIxOBsHQZN1aPV7Fneu+AO58l3MimQ5gnefLsLTfZIWA1PhqG39KyMBPC48LoXgnAgrL/IiiVH2hD0ORSZ1SUvg1mFXgeoAYVa01JzCPtfwLr+v/HoXZkBgWpg35dWTyyiltEcAonzUwSar8Fs1fXBhVL5zl07h3qnyFDOiY8BORQjrZPmU5XqHbkCujjRZzZ6gOK/EL1aHvO89KwkmmOmuEbqE5UzNqK6KrJEIgZkXRzyQid9NN9+qZN0cRrbVY9NmzqGzj/98Eo/JJx+b7w+lL84HzI8+fmYQ==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:08:59+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:08:59 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08EBA0DECD06109D0118C395F5AF0120ECCC2028F3A203-0\r\nServer: nginx\r\nWechatpay-Nonce: 988efa8ada884bde993e90dc1f9de80f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ob3jlRdZ4XQlCzrFt7f6eSr8/yhrxzzRRGZGn9knufoma953dEjUOC147vsCkLfD7K4+WpJbtX6/mqbUUL/QI8pVSHgwZVUPwE91tci9jAPEtnnmONhE71mnY3EZvUl20pxbowFK7Forh8No+SuR0kUWqjDnv021Xj+NOjwz1pcWXIEo6RGEf5WXGPcow/pQXSWrZwFnRpmGps0lOdjIOJLWAITmsJcIXO7TLjaqlgqWI4V5ulFLrOCrepI59Y/9iGskM+hxZLa2c004mcZE0mqSuNCM85f9KdAeSjeVPfMtXhNGhBrzgrU7z4N72npmDchAfpmf36GN6cqJ1EXh9w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773637739\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125828308899\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:08:59+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125907232069?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"lxzmjpX6b9L42Tv2S08SBcA62AgaYkH8\",timestamp=\"1773637739\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"BaNjYVUkgT+sOdd9NRej0pRvDetjrfDI9zC1L10y/toIuTvaHbBLlXkxpFmFdTM/0DRzkgi5KLhUc68ZSnCWnuDPBrAXlhqBJ+64R78TCgvzxRUCbceKoUkDQpBhBsreX4Os23kl8ayhbjYBH7/6LCOyDMTZ+Jp16qxpql5FqF1kcNCwGJKHQk2OC2wzaUQSxtuS4vk7KO7AnO+H0a7XnjKD6vHs5f2lMs2zhYD5mzN/fLBguflVa1BKAIbLYrVL+lO24FdNpSrHOk6yC7vJKz05Xy7zpcNsTsFG4nhG1EWGjQEWF4ln/QOFPoCYu7/cDq+VGenqpB3L+xqHUjVZfA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:08:59+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:08:59 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08EBA0DECD0610F10318BAE7F8AF0120B8A53028E08206-0\r\nServer: nginx\r\nWechatpay-Nonce: f96788e583b518aefa9935f03b873936\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: PyXPuaHVjhuniPGxer3KdQMxnump847OigfYz5FXFcChasu2MyHzBOifv9f09mJPcwaWvCdhD7fskWLzNH850pt9FrKzNcDMjnX37ndeGY8yeY6+Rpy48Ilp0m9PUWjwxsjczY7chUD0wS8437vx9pVY1BZCS3TMPZglFUAQjOBfHcQ6s8jQSOyp+s22y/uowlWxhC96++qICySIPgu+htxmNvTXc8s+Z5jwEa+r21h24KuRa3CZYBRPza5a5qawUvTimygOv600fSGAFl2nlUUKXAxm9bf2z1SbxkxCCnZxg9YjDOzQI8kDSa/9k6uLL9UiPNcGnWYQCdr4gdVTjw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773637739\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125907232069\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:09:00+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125908227824?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"DOoYU8l4q0SGGZ2Li6FowbhH8PzO3bKS\",timestamp=\"1773637739\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"t6KYs+zsPEotdctKLpFMlLbxtvytupk9T0epVUgNZueRE9BLn95f4G6iF0wEY1OvNXhcZofQQAlAigTboQpNe3aNltQ2Eh6kDluXLuIubICggEsBOIaTMxJGhfsFXtr0xultCQR0eTgDHt/72TAmcbNjXxs2CixbtBRzO/nnr3eZ9Ogx5q0O6K0GtkV2jsmPrChLjhpO/m2alMoBo338/vRVuU3GfjX1/JVuyYul8+1fbNKmgj1etFsVjxFsAOFBguUaLQRzdurkCYj2jkfhX1BMb0zatUOU2IZwii2mPVx9QhcXCJDCQViUt1ZaUrXh6Bek6+UIgWozyrvJZVA37g==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:09:00+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:09:00 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08EBA0DECD0610CB061882E6F8AF0120CEC52A28A08D03-0\r\nServer: nginx\r\nWechatpay-Nonce: 64e753bf2970f40888698d3ff51cf0ff\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: jijK6q70HRGRoNxoVefI7D3NWQFtz15huDhPWUMc+aT+yfhgbxmTVoGQZlSlL8NEyEdGnM/buLcNfNwRk52pq18x34SuwSKpxcjALHiLSL/kdTNHRFRRc876pvikZAXhV/c6MvqnUAmIfFA/L1XDkK+VYHEbSCpMcNB7ksxnFGGoxXEzkM6nu5j+B6nXWfhJJWkII2vFvNC/garD08kD71pKwPTIaLP7nS4Qqb4F/3NthyB99/R2SkWzVno/krXzoDjT9b9/Kxmmz6fV3hMyR8thbvs/9wf91lxSwVG6pk7NYauydC34U7eePpfRkhylLTtM7jpfY/mrZGOWd2tDKQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773637739\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125908227824\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:14:05+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125828308899?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"FdosE5xSmQDzV9E69XyjN3kaKmtAgiWY\",timestamp=\"1773638035\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"XVLs1csu3/Cv+uaSYv7wr7ZCdjiP1bPok1U6kY5GUn84FW++CaUt8emYqTGowi1orBcgE/Xydbdu6fgxCL1rQuHuYJzIyZ9D64B9VN45irktu5eKxhZEk0vVbexo7UiBu5JyUmjcz21RzGJJ9pMsOmacKGbxuhXJu+mqgUa7agLaHI+CAoOcexWNoE2k0LhQqj1cAYUsJWOQo93dDtjC/e8y0Of0VOYWUc1IkHSj080W85meBj//XgNzqcL3Gnyh9I5GcLxzkSdBiDKa3t519MDv1dTfNi9DLbQsE89X1ngTL0pcSfmbtblixDYHi3Q+WcgUpGV75kVMvVZPydDc9A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:14:06+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125907232069?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"SAceqhIrCKBfuZfdKuyJNqQmoSLcHx9u\",timestamp=\"1773638045\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"5hT2V8YYuNnQmG3IIJtvGw2TTSEddQd743SCraIH4ec1rCpkJYZ5G3NvLie4Cgd1MbNP3Iow/1IB5wC1kzAOwfQvF2mSPo8XRvJu45aijVNSh4oatngWYPNm0+D1dzsqSAt/nmbpfTcUOR4CPlkv2Oah2zakPTWpiEe2Dt/Nc+UTxhmRg9ET6UDZlcv4Udl8EQiErVKO60YQN8nnXpA/T+9Hadv51am1zaFvheXZrC0SinMEVpZwc5oCCWS30qnRbLqqvIeXdtkaOwnYayAEuKLiKfmme1muBYO80IrrFpGFh+60+Hz+KyiyTPKB8SQv8OFJDc6BOXyrdAu7pvxKVA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:14:06+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:14:06 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089EA3DECD0610B40618929D85AB0120A4851A28CFCB01-0\r\nServer: nginx\r\nWechatpay-Nonce: 1130346a10d3e540a55d943df1305655\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: TBctafbvcJPSBzhSPf6eVJABlfgg3ySjTy9Ehy1F4kmDhBUn522vH57GLp4OfwrZeWrRAYt/H3lkjo7m3jSXbwT6vWlxS5cQyKQSTQXEIaUITA62fqoOq06H9AdL03ZR4quAlq3kM/S0xpuc7BzcsM1+Qhv8ql/43NOMGnh0Lp3Bk7ZdIT70YN2maB+JNhv3eD+aJWL06rV5ClqcxAmcjA38ExH92JcVCNXwfux8cwL0CXLSF1SRo0nRHdTPIiRl3lFID2Ezr0UQAE56cHXVpmg/Ep/iAPz7/HzpclNRsIszNUpZ9LjbrJcALVuEVREkvKLxgPc4X7woxzarE+VBCA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638046\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125907232069\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:14:07+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125908227824?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Z1NiuLKwxE9V2e4gFo5laVHQuos2XFW4\",timestamp=\"1773638046\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"d2dAHsQA+o7o2bjt89Wmx3oE8wba1nI1ftOUbIWj3iVcIJp+goF6cIfD0XKkaLzTxgkQIvZSYHEJfOxBrFWCR58zCHv0CAombt/onBfwtLlfCD5rEw3KSgu4cks1V9b7MPB3A2RVyD29Z7uLcuwVFfI4Y6rmbJYVcPC5fCDTHCwE7wP9myw1BtCPkwKbGUV9JgmYJuAApPNN+F6654RW4oZIZCPmivDbNeTm4q7SuvNP5y0MccB5MD+dT32Z2iIgsOgCd1+710HTVaby3I3R+156dvuwf29m1l1Ga3X9eovOLkBnKl68k269SJ8lMC51mqbFGCx4HzYCVVP0u2S0kQ==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:14:07+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:14:07 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089FA3DECD0610A30118E4E8F8AF0120D6A01B28CAE104-0\r\nServer: nginx\r\nWechatpay-Nonce: e0fcb123c71b93cb553dc98f1639dc21\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: MD6xfsWGN0pbAZGVdEFr+e1JnFUUJq+zpLYiX2oq48PgCw/jU0BwRWvoc3soCML3bZJUjXiz1D0ggmlV4jYMZyVTWnRIim5ch38RyTTWx67Iu+rhFi6U2yvaoeRxHr4m7MWUFTQtX6eAhWZRxW9DU0hKBu6e6gqnk/95LOfp6Pup4Ps93EjcDyMzo9mRuhP7/H7bxWeFEOs9yGXg65V/fZ0Cmi8/bGnDDd0FHcw4c5/Z1IDtNjuOxc8sAbdqS4v7plWrD6ZE3MoQ6SD7vxze+RpA993lGALP8poQZutSNd0D14wMjYYqufybsLUZ5FM/3usK4XsXt/sFKS60RDWjWw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638047\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125908227824\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125828308899?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ZO08EL5U7VlpALcs8CCzulUbyMdrFrrJ\",timestamp=\"1773638335\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"i/xq7u3BtXpivB/K0I3AyfalH2AEeNGM3iSGErLS1iNkuc6c3KFZZzG8vmFvMDJ3fWb/8obq/f9/ouN7WHnJ3o+7ueE6MkN73qoBCuA2imaRXna16x2oH/euGkyQ+zjP+DV5bdb1klRlHIxLEdF8O/20aqQkwejHHoJ9GsvfNOelVij5Z4ZVDbc2SFNLx9JZp9QfbbHRTwdrFkwtY7P/sOWeG3afqCKFed3gl6N7IrCSnUhiXbw0p45kUakO2KxZJjAlmQJ13JgBwggeg9bbVMQJ9PTVKQbP9NxTwHV4Tj49YaURseVHcaybXmwIz31GNV6Iv22T+DDbMNRPxd71qw==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:18:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:18:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C0A5DECD0610FF0318FC9A85AB0120BCA40528B2E303-0\r\nServer: nginx\r\nWechatpay-Nonce: 978ed3dd33705bfed7bf6d6b05019f85\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Ytt54PQm+oih7ZyPsAI0GY89iUq6W4e32zEcBkC9G2HcBdbR0MsDFGJce/I0ICc4s6CFvbSSWFNVnczudp/m9LttWVXGSf5lp2wPtIwk60hgOsrrY5jA2iqDef3Z7W+59/Ojlz9LNOMKIqNWbiHDUnb1i3KE3gv5Ayv6qnBjqUeM/VS30JtdiSucwQPxke148DeIdATHZsFo7qF+AgUflpMKwDpO9p928w8WlFCGfyNvtwNoTtLD0/vcXcfKC0A0457cUy1QYWUIzK4boslPbBRYG3b0rQAmZ/8NXBaSMugeumlmp1ywjVd/603OJaFQKxbZqI9IUbaJsA1b0HzYww==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638336\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125828308899\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:18:56+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125907232069?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"SY0nXI1gvBqJnvgCQeCq7D4VD8Na48Th\",timestamp=\"1773638336\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"QlMUc/Aj90t3XBa/AcFswchXHCo6JIKMTrRd52BnZlT/uInDmXUFPcYVbrDDxSpsfK4uyRiIT77TisNLHd6ttsK9bjzvS0ekdd84T0X6Uks02ur2IBI7c2LjWz7Uap9vnJDp9TuyOZ6eHOWXFxSLNFsTH8iTK+kHDhJ4osem/mMdiZk0HvxuE8eaLqAwrmpujcZjlOFkT/4DqwyruszRTvL+hdzkMNVWTbOxOG/bYnS1lSvGaZeppSEdqsN0c8iI5Oq4S0WvtKWWKoFf9YubMdGSNU4Nt8E6JLWwSQF1epUPZfTJn/jGmmNVdv8mDLmGb83El43iLb5lKyzRJw4IWQ==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:18:56+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:18:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C0A5DECD0610B90618F2E4F8AF0120F02F28F1A203-0\r\nServer: nginx\r\nWechatpay-Nonce: 5ca992bfb78a291df577c63163b7ac77\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: WWu71bHoWPPDFch7eMuV1TLMZZt8s47H8KtPHu7cl+dmOvf1Ks6MjsPStEPtCL6VK/qPPygjxmXzazTi1nsw9j3GLPTvBbmaupkzro01p99WfcKUSO2kGrmS+tvjXwhe5cEWLma6AftVH4AkoXQaS9oblDLbT/XHSmcWxoQ1RrG4Cu33VOclmHjarZ6ORNZbIvJY2pUpOI5v2Rs8yGDx+oredZi8xA4uRFhh5F9uxxIG+GjIfp2l4HNwnbidLdHiYbO81xWs9y9qFDdJQKTV44xmJzZN7tZAkeHrWBDzjujXy+4pgt9NT3QLfLE62atnyQd0W0NCcWSBaWR2jOUPJA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638336\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125907232069\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:18:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125908227824?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"l1WgEHLsutrXPYR2gHVhBQH4EvwEoFG3\",timestamp=\"1773638336\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"EASc/GDP37hxYpVaK2kdcU3QMZyCuz5tMiqMWp8bx5/TZLCgbKuSYUxnp+jFhFcfuhCqXFIEkj0ipnonFvv9nficvK+FxPKbY2qFrTCXL0jRZy4kOjeoEiuou55VY220pdMP3/wlSHR7h7tLcfOJCVZVpkyeNOcvZf4abM56FcZJTwl90F+mU7vNIYMWI6sGxaxV+C2lepbJEP67RyDdKyp6EzuqR5qdIlFB/kuv+CpCaYhZf9+bOePRZjp5L1L4ysvpqfX/pctKU7H8Jj9em9C3MX3tz/8bFfIqknLZvVhXb3p98VjTZ/A2p3T81UaZIsiHwX0ZXW4uCG1P7h7XJg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:18:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:18:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C1A5DECD06106718D0A6A85C20D88A0328C4D704-0\r\nServer: nginx\r\nWechatpay-Nonce: a301d743451d00131504a1cfaa7b08eb\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: HwSt9cgYK9I6dxjwOrpcO74pdShXqUVqSTpLuWGhhU/Lbogsf7/OTpi5mdCxtstyEOPED719YP6NxwbAShJDGcX2+jeUr8lkTQelijgcjui+3PiQRhK0pS8AiQan7QkDkfuCP+bcTps/cYUq5DDzypS8RSAd762kZMVENFoFRZ3ghAJlv9/ZU1fgxAxPo5adFNgcUbxXgaY8Q8emLqtNLqyon32YwGpDHyn3pqDj7wor+AVi4GSbvhQ/1hRX+1euS3cQPGQzuHYPin5sTzvkx25Dj8nyKdVlYdjTovOyLs9heVnbDJGQlKEGsBMXy5jPyWPiew6gicBjUFA8q4wGmw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638337\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125908227824\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:23:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125828308899?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"iin6TBwngi4P82ttR586XwE1XBwktinu\",timestamp=\"1773638635\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"2SJxnUCcYvNbIiUP3q7qDI133GnI0nsC7PYR+YFZYx5VeFNOEECwEXgtr0rdhSX83nSDo4n2HHSzyj7PNDE61YkcsumkHWfDvxlYmT9i/sa6iZPIrqyO5rHJRpthWAbT0BnoKgSZBGCUvUcwvvb9syuGO18UHta9FDTv21Kpv2DQ0XjItm83NW4T9+aCwh3ZdVrfqaMfjtJLYfvN6khu61JU1CghVW7QrXBpHEUSmdDJefo4QPu6Y/KUiPkZIa4Gho5l3m8KvwBFWSVRYcq7F/52c54btp8vYtIG+0EKr0r9V9d0AhBUAf/SxBn9vND/SEa+U71E0Ptk6kzNW3AeKQ==\"} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:23:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:23:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08ECA7DECD0610AA0718F7CC8C5820BCFF0E28C8BA03-0\r\nServer: nginx\r\nWechatpay-Nonce: 2a65065bcb3697a0c2310c2c77c8e30f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: I2EaxLkGSNKJWXAjZ2BGTfUSNiSEkBndb5EXQnch+T3EDQZ1k8h37+3SB7GBNtxPHlvtFRlOToHWmVKA3JNzvdYyhMU8lCMBNZmWsd3bhTCvCz/CoLXfA+lAlJiAFcwoUUsqzDkZYcYmPe/tV/Dba1T0sbtpk0opSuTXTVQ94qcX/7//uIrxXjey3DVLxBdDkn9p1qTTCy6yTGGy2Xhg9tOLVR3BFYVfKSQh4ADo4Pp3/2SzwklCQ4mxVERKaruYaeKghjq+HlwTSFjR9vbNfSmZnqoIpmwhP+JpSajaXddCGH0rXah7YrqL01LpyfFglvZ3iIVXnsQrS3u1HWTB6A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638637\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125828308899\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:23:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125907232069?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"HU1YxS9Z2d2Lb7ciHK6upL6b2h2CFlrA\",timestamp=\"1773638637\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Y4gaevOsINWHhVaSk8SZ3IUOj86KVTbctP7cMWdQCO4amVJ3AbhdDr2jISsUGQnKjpD/N9G58tOhnSgr2w/34cim3GGkRg0YsbsE4i4qEgdwC7JCra4io3LqnbJc8wmYyndQfpJwJu/Ioa9RsciIgmzQV0Ir/427Go18TQ0Nip+K5sioVP8qf0GDsFmFtKwZmv4Qqj/JJcAsdENNmCWUmFbd2WEkaO4o+1hEA/3OkcZclCVK/P+0KnHLxlOyOf8BC7xWLISnyx8OVzXrF7qbE8WFWzizqTVrtqd5JV2Omnx4WvNRGwdzVH53yoGhzWtfNpi+UDxHQj6rHBT1PVpzEg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:23:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:23:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08EDA7DECD0610A00218B9BB8C5820C4DD1228B2EE03-0\r\nServer: nginx\r\nWechatpay-Nonce: 9c86e26d6c518c51d4c7c6f4a9f479da\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: SlbEmSY/ZsPqEuz1Z/2qSXuUGbWgw/EhCM8J72mWc6/Al+//vL2QoHTuM4F6pIJLqa4A/fks57t0Ovw01c4oSugTW+BA9s/xLx8P/9uRa4b8in2OcH/Erqmp11ksyr2ytu9dtJiu5RfWejzALBVvrmQCiCHYp4p7f0U01z/PDX+dw9sCtt28Ybf8ggbjcTKIstExUI+ntvCBqJdSyRXi+vQCeXiWtveeYtn+HWSg3KJwaxTb4gPC/nUJMNCbNYLBGvvpYvkmrtFgLFdTPoBqYjXrRUpD2Z3ZcIwkxg1oyz9M/ijfyHIQzXsIGe4MM4Ls/6lKKmYHGB7a7ZWLNdZCjQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638637\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125907232069\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:23:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125908227824?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"VStfSqmr3GcomYzjEbgG4F9MHNjKQGdy\",timestamp=\"1773638637\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"NseFFw+sSMDsrm8Dvvf7G09Qt4B9RZ6g2ASncsjHw7i/nT9YAgNFjbcVdB/VmcVD8tzjbvpvpERGIf/UhUVuPwFTbtDh8KBGBJlhQnq0+3Z+oYr+8TV1Fae7mw8XlYURfvcYmR0D2FcLzj/wQbRh1dxjaxgqPNmSGNBJMLfxEbq1vCn+R/jqfK69ZIlbfR6+3ec6LCpRRPHDJJPFzNA8slX6rk1sDeU87akt1eMak1xER8gPD/5eQ5pB2jm4EVq2nn5sN0z7XW3LwPmM3F/zt1VUjPq8MbRppZeYdht1T1xrXUOSqZidyxvD4ax818Fg5zuhXx+72SIHTc1wpwnxEA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:23:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:23:57 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08EDA7DECD06108D0518B5A7F8AF01209CAA1928928803-0\r\nServer: nginx\r\nWechatpay-Nonce: 63e979626521d72e254d854c7431a4d0\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: KkndcY9VuJCP/rr9681Fb0GyJDhxGXemoCkAOOML601CMDiGQZVF06WCVk0XUO9fV8XMa2I0AN0/j5/awdnvNMBXpPyi97vHcxrA4FAC1yXRuwQhzDO/Ao+lj+uYH5LjwQEVOcouJSFfVzMUXUl6dhtrZID0714eCn95wnapwME+ya8Kkumyeq3N7nOnhPoR/ANEJg/7vH3ppdoyPUEELEGaT5Spie2BmPUFyS5pVScw3gfZK3dCNgShvzeHUcHc2vXAef+ZmmyNsV75XXlX8N+yLT1+fbs5HpAgzek4nLIFBoEtZqhefwjS/VN8xtMYCUubkX3O9jffNhiby6dEyQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638637\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125908227824\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-16T13:28:57+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260316125828308899?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"GWWnWmnQjcGicWTQ9u7BCVsVB3WIY1ov\",timestamp=\"1773638935\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"UfYmh+x6wpiqm3gxbeVFLZBOdZL0j73VdHiSxhRPdmzujiY1LkPSzS7YuBLEmqQ4n4eqxrHsSWVUVYkIfLp83SBQO4h1klwtWxdg4zQXaLk5gfaYyNGzpyxoig9J2x3ol8/l2FXy2erQbUKZmYt/cdyiDQP/kkFZwRDLU7wFbF/ztJC8/uj/ZbkQpdNYOJbsrnQC6hHNNF55hZCf9622WGFLQLdvfJ/z8Gpey1N8Br9FjON/wOZkzbBEA3Vj8zIo7QZHfy6cyCPX6TYZHFk6OIJy4sp4OxmQ6KzMlSYgOU51WM8MGOHs3kVpFCRzcxSM7cNDy40ZLFqR6/RnjNqXfQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-16T13:28:57+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 16 Mar 2026 05:28:56 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0898AADECD0610A10618AFCBC0552098F80E28B8D002-0\r\nServer: nginx\r\nWechatpay-Nonce: 63d34c8b9ccf52556a584a3c250c0e35\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: CeLda4PYoufL5D9P6nS6iMDmU5j8GpWMEC3QkH/yHvgEWaBchb9q4jly7Qg7Y5flKQ5KKFn94aXwQlMNU9vvz6XaRtLhJ+ofTWcM+x6etKJYUxLVN/tznTFsfZMzcc/zIYW0u7uqnH9XRjn5OSDtZf1ZFjaOnRTcIq3ec+UpXF741wNAFI4gnyVniRomH24BRqiWwt9aSLXNCBy+zaH/OwFD8gQL28lRyyyKNHSqb0XuyghVrgrxSQznU43j1vZTh2KdcWnDiWQljHqV+VVoxgRa7fC4s8o+B6WRJ2TQo7Mlbvw8GpA5EqTvEhV2A9R73e20YSARdvwn6MrhzB3wHQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773638936\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260316125828308899\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} diff --git a/开发文档/1、需求/链接人与事-存客宝同步-需求规划.md b/开发文档/1、需求/链接人与事-存客宝同步-需求规划.md index fb8ce0a9..64ceaff0 100644 --- a/开发文档/1、需求/链接人与事-存客宝同步-需求规划.md +++ b/开发文档/1、需求/链接人与事-存客宝同步-需求规划.md @@ -1,7 +1,8 @@ # 链接人与事 — 存客宝同步 需求规划 > 参与角色:产品经理、管理端开发工程师、后端开发 -> 创建日期:2026-03-13 +> 创建日期:2026-03-13 +> **同步需求汇总**:见 `链接人与事-所有同步需求.md` --- diff --git a/开发文档/1、需求/链接人与事-所有同步需求.md b/开发文档/1、需求/链接人与事-所有同步需求.md new file mode 100644 index 00000000..5728dcb2 --- /dev/null +++ b/开发文档/1、需求/链接人与事-所有同步需求.md @@ -0,0 +1,64 @@ +# 链接人与事 — 所有同步需求汇总 + +> 整合自:链接人与事-存客宝同步-需求规划、实现方案、2026-03-16 文章编辑自动创建 + +--- + +## 一、同步场景总览 + +| 场景 | 触发 | 同步动作 | 状态 | +|------|------|----------|------| +| **创建 Person** | 管理端添加 / 文章 @某人 不存在时自动创建 | 调存客宝创建获客计划 → 落库 ckb_plan_id、ckb_api_key | ✅ 已实现 | +| **编辑 Person** | 管理端编辑弹窗保存 | 调存客宝更新计划 | 待实现 | +| **删除 Person** | 管理端删除 | 调存客宝删除计划 → 再删本地 | ✅ 已实现 | +| **文章 @某人 不存在** | 编辑文章输入 @新人物 并保存 | ensureMentionsAndTags → POST persons → 自动创建 + 同步存客宝 | ✅ 已实现 | + +--- + +## 二、已实现同步 + +### 2.1 创建 Person 时同步存客宝 + +- **触发**:POST /api/db/persons(仅传 name 或完整表单) +- **流程**:生成 token → 调 ckbOpenCreatePlan(deviceGroups 未传时默认选名为 soul 的设备)→ 落库 person_id、token、name、ckb_api_key、ckb_plan_id +- **实现**:`soul-api/internal/handler/db_person.go`、`ckb_open.go` + +### 2.2 删除 Person 时同步删存客宝 + +- **触发**:DELETE /api/db/persons?personId=xxx +- **流程**:若有 ckb_plan_id → 调 ckbOpenDeletePlan → 再删本地 +- **实现**:`db_person.go` DBPersonDelete + +### 2.3 文章 @某人 自动创建并同步 + +- **触发**:管理端保存文章,content 含 @新人物(persons 中不存在) +- **流程**:ensureMentionsAndTags 提取 @name → POST /api/db/persons {name} → 创建 Person + 存客宝计划 +- **实现**:`soul-admin` ContentPage ensureMentionsAndTags;`db_person.go` 按 name 查找/创建 + +--- + +## 三、待实现同步 + +### 3.1 编辑 Person 时同步存客宝 + +- **触发**:管理端编辑 Person 后保存(PUT 逻辑,personId 已存在) +- **流程**:更新本地 persons → 若有 ckb_plan_id,调存客宝 PUT /v1/plan/update 同步 name、greeting、tips 等 +- **参考**:`链接人与事-存客宝同步-需求规划.md` 4.2、7.1 + +--- + +## 四、配置与前置 + +| 配置 | 说明 | +|------|------| +| CKB_OPEN_API_KEY | 存客宝开放 API 密钥 | +| CKB_OPEN_ACCOUNT | 存客宝账号(鉴权) | +| 设备 | 创建计划时 deviceGroups 必填;未传时默认选 memo/nickname 含 "soul" 的设备 | + +--- + +## 五、相关文档 + +- `链接人与事-存客宝同步-需求规划.md` — 原始需求与 API 约定 +- `链接人与事-实现方案.md` — 实现清单 +- `临时需求池/2026-03-16-文章编辑自动创建@和#.md` — 自动创建需求 diff --git a/开发文档/1、需求/需求汇总.md b/开发文档/1、需求/需求汇总.md index 44627e1a..db887cac 100644 --- a/开发文档/1、需求/需求汇总.md +++ b/开发文档/1、需求/需求汇总.md @@ -50,3 +50,4 @@ IP 设定、风格、输出规范(见原卡若角色设定)。 | 2026-03-10 | 小程序「我的」页阅读统计改为后端接口(真实数据) | 已完成 | my.js loadDashboardStats;soul-api GET /api/miniprogram/user/dashboard-stats | | 2026-03-10 | 富文本渲染升级(TipTap HTML → rich-text 组件,保留 @mention 交互) | 待实施 | 确认 DB 内容格式后实施;当前 contentParser.js 为纯文本剥除 | | 2026-03-16 | 文章编辑时 @某人/#标签 自动创建:不存在则自动新增到链接人与事/链接标签并同步存客宝 | 已完成 | 临时需求池/2026-03-16-文章编辑自动创建@和#.md | +| - | 链接人与事所有同步需求汇总 | - | 链接人与事-所有同步需求.md |