feat: improve login renewal and risk verification

This commit is contained in:
Christ committed 2026-07-08 04:07:03 +08:00
1 parent 3d37ff7917
commit aaf798428b
21 files changed
+2067 -125

No files matched your search

+114
View File
@@ -0,0 +1,114 @@
# 登录续期与风控能力补齐计划
## 目标
参考 `zhinianboke/xianyu-auto-reply` 的实现,把当前项目缺少的登录态续期、MTOP 风控识别、扫码人脸验证能力补齐。改造重点是提升账号长期在线能力和风控状态的可恢复性,同时保持 `xianyu-go` 现有单进程架构清晰、可测试、可回滚。
## 非目标
- 不实现绕过人脸识别。人脸验证必须由用户在手机端完成。
- 不把浏览器截图作为主验证方式。截图仅保留为兜底调试手段。
- 不在第一版引入跨服务架构;续期和验证能力仍在当前 Go 进程内闭环。
- 不默认把已禁用账号自动启用,避免用户明确停用的账号被后台恢复上线。
## 阶段 1:扫码人脸验证 API 链路
修改 `internal/xianyu/qrlogin`:
- 在扫码 `query.do` 返回 `iframeRedirect=true` 时保留响应 Cookie。
- 跟随 `iframeRedirectUrl` 到 `normal_validate.htm`。
- 从 HTML 提取 `htoken` 和 `verify_modes.htm` 下一跳链接。
- 请求 `verify_modes.htm` 并落到 `identity_verify.htm`。
- 从 `identity_verify.htm` 中提取 `new Qrcode({ text: "..." })` 的二维码内容。
- 后端渲染二维码为 `face_qr_url`,返回给前端展示。
- 轮询 `photoVerify/check.do?htoken=...`。
- 当返回 `code=3` 时访问返回的 `ivCheckLogin.htm`,收集最终 Cookie 和 `unb`。
前端修改:
- `verification_required` 状态优先展示 `face_qr_url`。
- 文案改为提示用户用手机闲鱼扫描二维码完成人脸验证。
- `verification_screenshot` 仅作为旧兜底,不再作为主体验。
测试:
- 提取 `htoken`、`verify_modes`、人脸二维码内容的纯函数测试。
- `photoVerify/check.do` 成功后 session 转为 `success` 的 HTTP mock 测试。
## 阶段 2:Cookie 接口续期服务
新增 `internal/xianyu/renew`:
- 实现 `hasLogin.do`、`silentHasLogin.do`、`setLoginSettings.do` 三段续期。
- 每一步合并 `Set-Cookie`,后续请求使用合并后的 Cookie。
- 只有 `setLoginSettings.do` 返回有效 `Set-Cookie` 时,判定长登录续期成功。
- 返回续期方式、更新字段、最终 Cookie、步骤详情。
- 所有响应读取必须有大小上限。
测试:
- 多个 `Set-Cookie` 合并顺序。
- 接口续期成功、失败、部分 Cookie 更新。
- `setLoginSettings.do` 未返回 Cookie 时不误判成功。
## 阶段 3:登录态检查与 MTOP 风控分类
新增或扩展 `internal/xianyu/mtop`:
- 实现 `mtop.taobao.idlemessage.pc.loginuser.get` 登录态检查。
- 识别 `TOKEN_EXOIRED`、`TOKEN_EXPIRED`、`TOKEN_EMPTY`、`SESSION_EXPIRED`。
- 识别 `FAIL_SYS_USER_VALIDATE`、`RGV587`、`punish`、`captcha`、`x5secdata`。
- 对风控错误返回带验证 URL 的结构化错误,避免上层只能靠字符串判断。
测试:
- 各类 ret 的分类。
- 风控 URL 提取。
- 登录态接口返回 Cookie 时正确合并。
## 阶段 4:运行时恢复顺序接入
修改 `internal/engine/account.go`:
当前流程:
`RefreshToken -> WS -> 连续失败 -> PasswordLogin -> 慢重试`
目标流程:
`RefreshToken -> API Renew -> Browser Renew -> PasswordLogin -> 慢重试/人工验证`
规则:
- token 刷新遇到 token/session 问题时先尝试接口续期。
- 接口续期成功后保存 Cookie、清 token 缓存、重新获取 token。
- 接口续期失败但 Cookie 有更新时也保存,避免丢服务端新字段。
- 浏览器续期作为第二层恢复。
- 密码登录作为最后自动恢复手段。
- 风控类错误进入 `verification_required`,降频重试并发通知。
## 阶段 5:重连退避和多账号保护
- 网络错误和认证错误使用不同退避。
- 增加 0-30% 随机抖动,降低多账号同时重连冲击。
- 短连接继续清 token 缓存。
- 频繁短连接时进入明确状态,避免无意义快速重连。
## 验证命令
每阶段至少运行对应包测试。完整收尾运行:
```bash
go test ./...
go vet ./...
make lint
cd frontend && npm test -- --run && npm run build
```
## 实施记录
- 已完成扫码人脸验证 API 链路:后端提取 `htoken`、`verify_modes`、人脸二维码内容并轮询 `photoVerify/check.do`,前端优先展示 `face_qr_url`;截图只保留为兜底。
- 已完成 Cookie 接口续期服务:`hasLogin.do -> silentHasLogin.do -> setLoginSettings.do` 串行合并 `Set-Cookie`,所有响应读取有大小上限。
- 已完成 MTOP 风控分类:token 过期、session 失效、`FAIL_SYS_USER_VALIDATE`、`RGV587`、`punish/captcha/x5secdata` 等状态被结构化识别。
- 已完成运行时恢复顺序:`RefreshToken -> API Renew -> Browser Renew -> PasswordLogin -> 慢重试/人工验证`,Cookie 更新后会清理旧 token 缓存。
- 已完成多账号保护:重连退避加入 0-30% 抖动,降低多账号同时重连造成的风控压力。
+12 -3
View File
@@ -41,6 +41,7 @@ const AccountList: React.FC = () => {
const [qrStatus, setQrStatus] = useState<string>('pending');
const [verificationUrl, setVerificationUrl] = useState<string>('');
const [verificationScreenshot, setVerificationScreenshot] = useState<string>('');
const [faceQrUrl, setFaceQrUrl] = useState<string>('');
const [qrSessionId, setQrSessionId] = useState<string>('');
const [qrReauthTarget, setQrReauthTarget] = useState<AccountDetail | null>(null);
const [activeModal, setActiveModal] = useState<ModalType>(null);
@@ -326,6 +327,7 @@ const AccountList: React.FC = () => {
setQrSessionId('');
setVerificationUrl('');
setVerificationScreenshot('');
setFaceQrUrl('');
try {
const res = await generateQRLogin();
if (res.success && res.qr_code_url && res.session_id) {
@@ -358,6 +360,9 @@ const AccountList: React.FC = () => {
} else if (statusRes.status === 'verification_required') {
setQrStatus('verification');
setVerificationUrl(statusRes.verification_url || '');
if (statusRes.face_qr_url) {
setFaceQrUrl(statusRes.face_qr_url);
}
if (statusRes.verification_screenshot) {
setVerificationScreenshot(statusRes.verification_screenshot);
}
@@ -610,16 +615,20 @@ const AccountList: React.FC = () => {
<div className="flex flex-col items-center px-4">
<span className="font-bold text-gray-900 mb-2">需要安全验证</span>
<span className="text-xs text-gray-500 mb-3 text-center">
程序已在后台打开验证页面,请用手机完成验证,验证通过后将自动登录。
{faceQrUrl
? '请用手机闲鱼扫描下方二维码完成人脸验证,验证通过后将自动登录。'
: '正在准备验证二维码,请保持页面打开。'}
</span>
{verificationScreenshot ? (
{faceQrUrl ? (
<img src={faceQrUrl} alt="人脸验证二维码" className="w-full max-w-[210px] rounded-xl border bg-white p-2 mb-2" />
) : verificationScreenshot ? (
<img src={verificationScreenshot} alt="验证页面" className="w-full rounded-xl border mb-2" style={{maxHeight: 200, objectFit: 'contain'}} />
) : (
<div className="w-full h-32 bg-gray-100 rounded-xl flex items-center justify-center mb-2">
<Loader2 className="w-6 h-6 animate-spin text-gray-400" />
</div>
)}
<span className="text-xs text-gray-400">等待手机验证完成,无需手动操作...</span>
<span className="text-xs text-gray-400">等待手机验证完成,无需点击确认。</span>
</div>
)}
</div>
+39 -12
View File
@@ -23,6 +23,7 @@ import (
// 测试可注入桩实现,避免依赖 Chromium。
type browserManager interface {
FetchOrderDetail(ctx context.Context, orderID, cookieID, cookieValue string, requireSpec ...bool) (*browser.OrderDetail, error)
CookieRenew(ctx context.Context, cookieID, cookieStr string, headless bool) (map[string]string, error)
PasswordLogin(ctx context.Context, account, password, cookieID, userDataDir string, headless bool) (map[string]string, error)
}
@@ -154,8 +155,11 @@ func (a *Adapter) localOrderDetail(ctx context.Context, orderID string) (*automa
}, true
}
// OnPasswordLoginRefresh 连续失败时调用浏览器密码登录刷新 cookie。
// 同一账号冷却 engine.PasswordLoginMinGap,避免短时间反复尝试。
// OnPasswordLoginRefresh 连续失败时恢复 Cookie。
//
// 恢复顺序是“浏览器快速续期 -> 密码登录”。快速续期复用旧 Cookie 打开闲鱼,
// 尝试点“快速进入”刷新浏览器登录态;这比账号密码登录更轻,风控压力也更小。
// 同一账号冷却 engine.PasswordLoginMinGap,避免短时间反复触发浏览器恢复。
func (a *Adapter) OnPasswordLoginRefresh(ctx context.Context, cookieID string) bool {
if a.browser == nil {
a.logger.Warn("密码登录刷新失败:浏览器自动化已禁用")
@@ -179,33 +183,56 @@ func (a *Adapter) OnPasswordLoginRefresh(ctx context.Context, cookieID string) b
a.logger.Warn("密码登录刷新失败:读取账号详情失败", "account", cookieID, "err", err)
return false
}
a.mu.Lock()
a.lastLoginByCID[cookieID] = time.Now()
a.mu.Unlock()
// 先走 Cookie 快速续期。只要旧 Cookie 还能触发快速进入,就不暴露账号密码登录,
// 也减少滑块/人脸/设备校验等更重风控的概率。
if a.saveRecoveredBrowserCookies(ctx, cookieID, d.UserID, func() (map[string]string, error) {
return a.browser.CookieRenew(ctx, cookieID, d.Value, !d.ShowBrowser)
}, "浏览器快速续期") {
return true
}
if strings.TrimSpace(d.Username) == "" || strings.TrimSpace(d.Password) == "" {
a.logger.Warn("密码登录刷新失败:账号未配置登录用户名或密码", "account", cookieID)
return false
}
a.mu.Lock()
a.lastLoginByCID[cookieID] = time.Now()
a.mu.Unlock()
cookies, err := a.browser.PasswordLogin(ctx, d.Username, d.Password, cookieID, "", !d.ShowBrowser)
return a.saveRecoveredBrowserCookies(ctx, cookieID, d.UserID, func() (map[string]string, error) {
return a.browser.PasswordLogin(ctx, d.Username, d.Password, cookieID, "", !d.ShowBrowser)
}, "密码登录刷新")
}
// saveRecoveredBrowserCookies 执行浏览器恢复动作,统一校验、保存 Cookie 并清理 token 缓存。
// Cookie 更新后,旧 accessToken 与旧 session 绑定,继续复用会造成“新 Cookie + 旧 token”
// 的逻辑冲突,所以这里必须清除缓存,让 engine 下一轮重新派生 token。
func (a *Adapter) saveRecoveredBrowserCookies(ctx context.Context, cookieID string, userID int64, recover func() (map[string]string, error), action string) bool {
cookies, err := recover()
if err != nil {
a.logger.Warn("密码登录刷新失败", "account", cookieID, "err", err)
a.logger.Warn(action+"失败", "account", cookieID, "err", err)
return false
}
cookieStr := browser.MarshalCookies(cookies)
if strings.TrimSpace(cookieStr) == "" {
a.logger.Warn("密码登录刷新失败:浏览器未返回 cookie", "account", cookieID)
a.logger.Warn(action+"失败:浏览器未返回 cookie", "account", cookieID)
return false
}
if err := a.store.Cookies.Save(ctx, cookieID, cookieStr, d.UserID); err != nil {
a.logger.Warn("密码登录刷新失败:保存 cookie 失败", "account", cookieID, "err", err)
if err := a.store.Cookies.Save(ctx, cookieID, cookieStr, userID); err != nil {
a.logger.Warn(action+"失败:保存 cookie 失败", "account", cookieID, "err", err)
return false
}
a.logger.Info("密码登录刷新 cookie 成功", "account", cookieID)
if a.store.Tokens != nil {
if err := a.store.Tokens.Clear(ctx, cookieID); err != nil {
a.logger.Warn(action+"后清除 token 缓存失败", "account", cookieID, "err", err)
}
}
a.logger.Info(action+" cookie 成功", "account", cookieID)
return true
}
// 编译期保证 *Adapter 同时实现 engine.Handler 与 automation.OrderDetailFetcher。
var (
_ engine.Handler = (*Adapter)(nil)
_ engine.Handler = (*Adapter)(nil)
_ automation.OrderDetailFetcher = (*Adapter)(nil)
)
+41 -4
View File
@@ -24,6 +24,9 @@ func (f *fakeNotifier) NotifyAccountAlert(cookieID, level, title, body string) {
type fakeBrowser struct {
fetchErr error
fetchDetail *browser.OrderDetail
renewErr error
renewCookies map[string]string
renewCalls int
loginErr error
loginCookies map[string]string
loginCalls int
@@ -32,6 +35,10 @@ type fakeBrowser struct {
func (f *fakeBrowser) FetchOrderDetail(_ context.Context, _, _, _ string, _ ...bool) (*browser.OrderDetail, error) {
return f.fetchDetail, f.fetchErr
}
func (f *fakeBrowser) CookieRenew(_ context.Context, _, _ string, _ bool) (map[string]string, error) {
f.renewCalls++
return f.renewCookies, f.renewErr
}
func (f *fakeBrowser) PasswordLogin(_ context.Context, _, _, _, _ string, _ bool) (map[string]string, error) {
f.loginCalls++
return f.loginCookies, f.loginErr
@@ -148,12 +155,42 @@ func TestOnPasswordLoginRefresh_NoCredentialsReturnsFalse(t *testing.T) {
store, cleanup := newAdapterTestStore(t)
defer cleanup()
a := New(store, nil, nil)
a.SetBrowser(&fakeBrowser{})
a.SetBrowser(&fakeBrowser{renewErr: errors.New("quick enter unavailable")})
if a.OnPasswordLoginRefresh(context.Background(), "cid") {
t.Fatal("账号未配用户名/密码应返回 false")
}
}
// TestOnPasswordLoginRefresh_BrowserRenewSuccess 无账密时旧 Cookie 仍可快速续期,应保存新 Cookie 并跳过密码登录。
func TestOnPasswordLoginRefresh_BrowserRenewSuccess(t *testing.T) {
store, cleanup := newAdapterTestStore(t)
defer cleanup()
ctx := context.Background()
if err := store.Tokens.Save(ctx, "cid", "did-old", "tok-old", 9999999999); err != nil {
t.Fatalf("保存旧 token: %v", err)
}
fb := &fakeBrowser{renewCookies: map[string]string{"unb": "1", "_m_h5_tk": "renewed"}}
a := New(store, nil, nil)
a.SetBrowser(fb)
if !a.OnPasswordLoginRefresh(ctx, "cid") {
t.Fatal("快速续期成功应返回 true")
}
if fb.renewCalls != 1 {
t.Fatalf("CookieRenew 应调用一次,got %d", fb.renewCalls)
}
if fb.loginCalls != 0 {
t.Fatalf("快速续期成功后不应密码登录,got %d", fb.loginCalls)
}
saved, _ := store.Cookies.GetValue(ctx, "cid")
if saved == "" || saved == "unb=1; _m_h5_tk=tk;" {
t.Fatalf("快速续期 cookie 未保存: %q", saved)
}
if _, err := store.Tokens.Get(ctx, "cid"); err != db.ErrNotFound {
t.Fatalf("Cookie 更新后应清除旧 token,got %v", err)
}
}
// TestOnPasswordLoginRefresh_Success 配好凭据后浏览器登录成功,cookie 被保存。
func TestOnPasswordLoginRefresh_Success(t *testing.T) {
store, cleanup := newAdapterTestStore(t)
@@ -162,7 +199,7 @@ func TestOnPasswordLoginRefresh_Success(t *testing.T) {
// 配置账号用户名/密码。
store.DB.ExecContext(ctx, `UPDATE cookies SET username='u', password='p' WHERE id='cid'`)
fb := &fakeBrowser{loginCookies: map[string]string{"unb": "1", "_m_h5_tk": "fresh"}}
fb := &fakeBrowser{renewErr: errors.New("quick enter unavailable"), loginCookies: map[string]string{"unb": "1", "_m_h5_tk": "fresh"}}
a := New(store, nil, nil)
a.SetBrowser(fb)
if !a.OnPasswordLoginRefresh(ctx, "cid") {
@@ -184,7 +221,7 @@ func TestOnPasswordLoginRefresh_LoginError(t *testing.T) {
ctx := context.Background()
store.DB.ExecContext(ctx, `UPDATE cookies SET username='u', password='p' WHERE id='cid'`)
fb := &fakeBrowser{loginErr: errors.New("captcha required")}
fb := &fakeBrowser{renewErr: errors.New("quick enter unavailable"), loginErr: errors.New("captcha required")}
a := New(store, nil, nil)
a.SetBrowser(fb)
if a.OnPasswordLoginRefresh(ctx, "cid") {
@@ -199,7 +236,7 @@ func TestOnPasswordLoginRefresh_Cooldown(t *testing.T) {
ctx := context.Background()
store.DB.ExecContext(ctx, `UPDATE cookies SET username='u', password='p' WHERE id='cid'`)
fb := &fakeBrowser{loginCookies: map[string]string{"unb": "1"}}
fb := &fakeBrowser{renewErr: errors.New("quick enter unavailable"), loginCookies: map[string]string{"unb": "1"}}
a := New(store, nil, nil)
a.SetBrowser(fb)
if !a.OnPasswordLoginRefresh(ctx, "cid") {
+59
View File
@@ -0,0 +1,59 @@
package browser
import (
"context"
"fmt"
"time"
"github.com/playwright-community/playwright-go"
)
// CookieRenew 用现有 Cookie 打开闲鱼页面,尝试通过“快速进入”刷新浏览器登录态。
//
// 这个方法位于密码登录之前:如果 Cookie 仍保留可续期的浏览器会话,页面通常会给出
// 免输密码的快速进入入口。成功点击后提取完整 Cookie,可避免更重的账号密码登录。
func (m *Manager) CookieRenew(ctx context.Context, cookieID, cookieStr string, headless bool) (map[string]string, error) {
if cookieStr == "" {
return nil, fmt.Errorf("Cookie为空,无法浏览器续期")
}
page, release, err := m.newPage(ctx, cookieID, cookieStr, headless)
if err != nil {
return nil, err
}
defer release()
if _, err := page.Goto(goofishIMURL, playwright.PageGotoOptions{
WaitUntil: playwright.WaitUntilStateDomcontentloaded,
Timeout: playwright.Float(30000),
}); err != nil {
m.logger.Warn("浏览器续期访问 IM 页面异常", "cookieID", cookieID, "err", err)
}
if checkLoginSuccess(page) {
m.logger.Info("浏览器续期:已有有效登录态", "cookieID", cookieID)
return extractPageCookies(page)
}
if !clickQuickEnter(page) {
return nil, fmt.Errorf("未找到快速进入入口,需要密码登录")
}
time.Sleep(5 * time.Second)
if !checkLoginSuccess(page) {
return nil, fmt.Errorf("快速进入后仍未检测到登录态")
}
m.logger.Info("浏览器续期:快速进入成功", "cookieID", cookieID)
return extractPageCookies(page)
}
func clickQuickEnter(page playwright.Page) bool {
frames := append([]playwright.Frame{page.MainFrame()}, page.Frames()...)
for _, f := range frames {
for _, sel := range loginBtnSelectors {
el, err := f.QuerySelector(sel)
if err == nil && el != nil {
_ = el.Click()
return true
}
}
}
return false
}
+116 -24
View File
@@ -7,8 +7,10 @@ package engine
import (
"context"
"crypto/rand"
"fmt"
"log/slog"
"math/big"
"strings"
"sync"
"time"
@@ -17,6 +19,7 @@ import (
"xianyu-go/internal/db"
"xianyu-go/internal/xianyu/mtop"
"xianyu-go/internal/xianyu/protocol"
"xianyu-go/internal/xianyu/renew"
"xianyu-go/internal/xianyu/ws"
)
@@ -31,10 +34,10 @@ const (
// token 心跳间隔。主动刷新 token 让服务端持续续期 cookie(_m_h5_tk /
// sgcookie 等),避免 cookie 自然滑向过期。15 分钟一次,平衡保活与风控。
// 不宜过短,否则易触发阿里系滑块风控。
TokenRefreshInterval = 15 * time.Minute
TokenRefreshMinGap = time.Minute
MessageCooldown = 5 * time.Minute // 收到消息后 5 分钟内不刷 cookie
PasswordLoginMinGap = 30 * time.Minute
TokenRefreshInterval = 15 * time.Minute
TokenRefreshMinGap = time.Minute
MessageCooldown = 5 * time.Minute // 收到消息后 5 分钟内不刷 cookie
PasswordLoginMinGap = 30 * time.Minute
// TokenCacheTTL 缓存的 accessToken 视为有效的时长。tokenRefreshLoop 每 15min
// 刷新一次会续期该缓存;短重启 / 瞬时 mtop 失败时回退到此缓存不掉线。
@@ -110,26 +113,27 @@ type Account struct {
store *db.Store
mtop mtop.Client
renewer cookieRenewer
wsDialer wsDialer
handler Handler
logger *slog.Logger
// 运行时状态(受 mu 保护)
mu sync.Mutex
currentToken string
deviceID string
connFailures int
lastMsgReceived time.Time
lastTokenRefresh time.Time
lastPasswordLogin time.Time
runtimeState string
runtimeMessage string
runtimeUpdatedAt time.Time
stopFn context.CancelFunc
stopped bool
conn WSConn
connStartedAt time.Time // 本次 WS 连接建立时间,用于短连接检测
authExpiredAlerted bool // 已发过 auth_expired 告警,连接恢复后复位(避免刷屏)
mu sync.Mutex
currentToken string
deviceID string
connFailures int
lastMsgReceived time.Time
lastTokenRefresh time.Time
lastPasswordLogin time.Time
runtimeState string
runtimeMessage string
runtimeUpdatedAt time.Time
stopFn context.CancelFunc
stopped bool
conn WSConn
connStartedAt time.Time // 本次 WS 连接建立时间,用于短连接检测
authExpiredAlerted bool // 已发过 auth_expired 告警,连接恢复后复位(避免刷屏)
// 去重
dedupMu sync.Mutex
@@ -173,6 +177,10 @@ func (defaultDialer) Dial(ctx context.Context, cfg ws.Config, logger *slog.Logge
return ws.Dial(ctx, cfg, logger)
}
type cookieRenewer interface {
RenewAPIFirst(ctx context.Context, cookiesStr string) (*renew.Result, error)
}
// Config 构造 Account 所需依赖。
type Config struct {
CookieID string
@@ -182,6 +190,8 @@ type Config struct {
Logger *slog.Logger
// MTop 可选:注入 mtop 客户端以便测试 mock。 nil 时使用默认 HTTP 实现。
MTop mtop.Client
// Renewer 可选:注入 Cookie 接口续期服务以便测试 mock。nil 时使用默认实现。
Renewer cookieRenewer
}
// New 构造单账号运行时(未启动)。
@@ -190,10 +200,15 @@ func New(cfg Config) *Account {
if logger == nil {
logger = slog.Default()
}
mtopWasNil := cfg.MTop == nil
mtopClient := cfg.MTop
if mtopClient == nil {
mtopClient = mtop.NewClient()
}
renewer := cfg.Renewer
if renewer == nil && mtopWasNil {
renewer = renew.Service{}
}
cookies := protocol.TransCookies(cfg.CookieStr)
myid := cookies["unb"]
a := &Account{
@@ -202,6 +217,7 @@ func New(cfg Config) *Account {
UserID: myid,
store: cfg.Store,
mtop: mtopClient,
renewer: renewer,
wsDialer: defaultDialer{},
handler: cfg.Handler,
logger: logger.With("account", cfg.CookieID),
@@ -254,11 +270,28 @@ func (a *Account) Run(parent context.Context) error {
failures := a.connFailures
a.mu.Unlock()
a.setRuntimeError(ctx, err)
if mtop.IsSessionExpiredErr(err) {
a.logger.Warn("session 已失效,清除 token 缓存并进入慢重试", "err", err)
if mtop.IsRiskVerificationErr(err) {
a.logger.Warn("闲鱼要求安全验证,停止快速重试", "err", err)
a.clearTokenCache(ctx)
a.alert(ctx, AlertLevelWarn, "闲鱼要求安全验证",
"账号触发闲鱼风控验证(滑块/人脸等)。系统已停止快速重试,请在后台重新扫码或完成验证。")
if sleepCtx(ctx, AuthExpiredRetryInterval) != nil {
return ctx.Err()
}
continue
}
if mtop.IsSessionExpiredErr(err) {
a.logger.Warn("session 已失效,先尝试接口续期", "err", err)
a.clearTokenCache(ctx)
if a.tryAPIRenew(ctx) {
a.resetFailures()
if sleepCtx(ctx, 2*time.Second) != nil {
return ctx.Err()
}
continue
}
a.alert(ctx, AlertLevelWarn, "账号 session 已失效",
"登录凭证已被闲鱼服务端判定为失效,系统正在尝试通过浏览器密码登录自动恢复。若长时间未恢复,请人工处理。")
"登录凭证已被闲鱼服务端判定为失效,接口续期未恢复,系统将继续尝试浏览器密码登录自动恢复。")
if err := a.handleMaxFailures(ctx); err != nil {
return err
}
@@ -478,7 +511,50 @@ func (a *Account) resetFailures() {
a.connFailures = 0
}
// retryDelay 移植自 _calculate_retry_delay。
// tryAPIRenew 是密码登录前的轻量恢复层。
// 闲鱼很多“登录态滑向过期”的场景会先允许 hasLogin/silentHasLogin/
// setLoginSettings 刷新一批 Cookie;直接上密码登录更重,也更容易触发风控。
// 因此这里先尝试接口续期:只要 Cookie 有变化就保存并清 token 缓存,让下一轮
// acquireToken 用新 Cookie 重新派生 accessToken。
func (a *Account) tryAPIRenew(ctx context.Context) bool {
if a.renewer == nil {
return false
}
a.mu.Lock()
cookieStr := a.CookieStr
a.mu.Unlock()
res, err := a.renewer.RenewAPIFirst(ctx, cookieStr)
if err != nil {
a.logger.Warn("接口续期失败", "err", err)
return false
}
if res == nil || res.NewCookies == "" || res.NewCookies == cookieStr {
if res != nil {
a.logger.Info("接口续期未产生 Cookie 更新", "success", res.Success, "message", res.Message)
}
return false
}
a.replaceCookieStr(res.NewCookies)
if a.store != nil && a.store.Cookies != nil {
if d, e := a.store.Cookies.GetDetails(ctx, a.CookieID); e == nil && d != nil {
if err := a.store.Cookies.Save(ctx, a.CookieID, res.NewCookies, d.UserID); err != nil {
a.logger.Error("接口续期后保存 cookie 失败", "cookie_id", a.CookieID, "err", err)
}
}
}
a.clearTokenCache(ctx)
if res.Success {
a.setRuntimeState(RuntimeConnecting, "登录凭证已接口续期,正在重新连接")
a.logger.Info("接口续期成功", "method", res.RenewMethod, "updated", strings.Join(res.UpdatedCookieNames, ","))
return true
}
a.setRuntimeState(RuntimeConnecting, "登录凭证已有新 Cookie,正在重新验证")
a.logger.Info("接口续期返回部分 Cookie 更新,下一轮重新验证", "updated", strings.Join(res.UpdatedCookieNames, ","))
return true
}
// retryDelay 按错误类型计算退避,并加入 0-30% 抖动。
// 多账号同时断线时,纯固定退避会让所有账号在同一秒重连,容易形成重连风暴。
func (a *Account) retryDelay(errMsg string) time.Duration {
a.mu.Lock()
f := a.connFailures
@@ -495,7 +571,23 @@ func (a *Account) retryDelay(errMsg string) time.Duration {
default:
secs = min(5*f, 30)
}
return time.Duration(secs) * time.Second
return withRetryJitter(time.Duration(secs) * time.Second)
}
func withRetryJitter(base time.Duration) time.Duration {
if base <= 0 {
return 0
}
maxJitter := base / 3
if maxJitter <= 0 {
return base
}
n, err := rand.Int(rand.Reader, big.NewInt(int64(maxJitter)))
if err != nil {
// 熵源异常时使用时间纳秒兜底;这里只影响退避抖动,不用于安全令牌。
return base + time.Duration(time.Now().UnixNano()%int64(maxJitter))
}
return base + time.Duration(n.Int64())
}
// refreshToken 调 mtop token API,返回 (accessToken, 更新后的 cookie)。
+5 -15
View File
@@ -187,17 +187,11 @@ func TestRetryDelay_FailureClampsAtOne(t *testing.T) {
defer cleanup()
acc.connFailures = 0
// close-frame:min(3*1,15)=3s。
if d := acc.retryDelay("no close frame received or sent"); d != 3*time.Second {
t.Errorf("failures=0 clamp to 1: got %v want 3s", d)
}
expectDelayRange(t, acc.retryDelay("no close frame received or sent"), 3*time.Second)
// timeout:min(10*1,60)=10s。
if d := acc.retryDelay("timeout reading"); d != 10*time.Second {
t.Errorf("timeout failures=0: got %v want 10s", d)
}
expectDelayRange(t, acc.retryDelay("timeout reading"), 10*time.Second)
// default:min(5*1,30)=5s。
if d := acc.retryDelay("random error"); d != 5*time.Second {
t.Errorf("default failures=0: got %v want 5s", d)
}
expectDelayRange(t, acc.retryDelay("random error"), 5*time.Second)
}
// TestRetryDelay_TimeoutVariant "timeout" 关键词分支。
@@ -206,13 +200,9 @@ func TestRetryDelay_TimeoutVariant(t *testing.T) {
defer cleanup()
acc.connFailures = 3
// min(10*3,60)=30s。
if d := acc.retryDelay("dial timeout"); d != 30*time.Second {
t.Errorf("timeout failures=3: got %v want 30s", d)
}
expectDelayRange(t, acc.retryDelay("dial timeout"), 30*time.Second)
acc.connFailures = 10
if d := acc.retryDelay("timeout"); d != 60*time.Second {
t.Errorf("timeout failures=10 cap: got %v want 60s", d)
}
expectDelayRange(t, acc.retryDelay("timeout"), 60*time.Second)
}
// TestHandleMaxFailures_RecentMessageSkipPasswordLogin 最近仍收到消息时跳过密码登录刷新,
+12 -14
View File
@@ -281,24 +281,22 @@ func TestRetryDelay(t *testing.T) {
defer acc.Stop()
acc.connFailures = 1
if d := acc.retryDelay("no close frame received or sent"); d != 3*time.Second {
t.Errorf("close-frame failures=1: %v want 3s", d)
}
expectDelayRange(t, acc.retryDelay("no close frame received or sent"), 3*time.Second)
acc.connFailures = 10
if d := acc.retryDelay("no close frame received or sent"); d != 15*time.Second {
t.Errorf("close-frame failures=10: %v want 15s (capped)", d)
}
expectDelayRange(t, acc.retryDelay("no close frame received or sent"), 15*time.Second)
acc.connFailures = 2
if d := acc.retryDelay("connection refused"); d != 20*time.Second {
t.Errorf("refused failures=2: %v want 20s", d)
}
expectDelayRange(t, acc.retryDelay("connection refused"), 20*time.Second)
acc.connFailures = 10
if d := acc.retryDelay("connection refused"); d != 60*time.Second {
t.Errorf("refused failures=10: %v want 60s (capped)", d)
}
expectDelayRange(t, acc.retryDelay("connection refused"), 60*time.Second)
acc.connFailures = 1
if d := acc.retryDelay("some other error"); d != 5*time.Second {
t.Errorf("other failures=1: %v want 5s", d)
expectDelayRange(t, acc.retryDelay("some other error"), 5*time.Second)
}
func expectDelayRange(t *testing.T, got, base time.Duration) {
t.Helper()
max := base + base/3
if got < base || got > max {
t.Fatalf("retryDelay=%v want in [%v,%v]", got, base, max)
}
}
@@ -0,0 +1,502 @@
var bT=Object.defineProperty;var wT=(e,t,n)=>t in e?bT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var sd=(e,t,n)=>wT(e,typeof t!="symbol"?t+"":t,n);function jT(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const l in r)if(l!=="default"&&!(l in e)){const s=Object.getOwnPropertyDescriptor(r,l);s&&Object.defineProperty(e,l,s.get?s:{enumerable:!0,get:()=>r[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const d of s.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function n(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(l){if(l.ep)return;l.ep=!0;const s=n(l);fetch(l.href,s)}})();function Ky(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yp={exports:{}},Bo={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Jw;function _T(){if(Jw)return Bo;Jw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,l,s){var d=null;if(s!==void 0&&(d=""+s),l.key!==void 0&&(d=""+l.key),"key"in l){s={};for(var f in l)f!=="key"&&(s[f]=l[f])}else s=l;return l=s.ref,{$$typeof:e,type:r,key:d,ref:l!==void 0?l:null,props:s}}return Bo.Fragment=t,Bo.jsx=n,Bo.jsxs=n,Bo}var ej;function NT(){return ej||(ej=1,Yp.exports=_T()),Yp.exports}var c=NT(),Gp={exports:{}},ze={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var tj;function ST(){if(tj)return ze;tj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function w(P){return P===null||typeof P!="object"?null:(P=b&&P[b]||P["@@iterator"],typeof P=="function"?P:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,S={};function A(P,Q,ne){this.props=P,this.context=Q,this.refs=S,this.updater=ne||j}A.prototype.isReactComponent={},A.prototype.setState=function(P,Q){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,Q,"setState")},A.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function C(){}C.prototype=A.prototype;function M(P,Q,ne){this.props=P,this.context=Q,this.refs=S,this.updater=ne||j}var k=M.prototype=new C;k.constructor=M,_(k,A.prototype),k.isPureReactComponent=!0;var D=Array.isArray;function E(){}var $={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function K(P,Q,ne){var I=ne.ref;return{$$typeof:e,type:P,key:Q,ref:I!==void 0?I:null,props:ne}}function T(P,Q){return K(P.type,Q,P.props)}function re(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function Z(P){var Q={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(ne){return Q[ne]})}var pe=/\/+/g;function fe(P,Q){return typeof P=="object"&&P!==null&&P.key!=null?Z(""+P.key):Q.toString(36)}function ce(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(E,E):(P.status="pending",P.then(function(Q){P.status==="pending"&&(P.status="fulfilled",P.value=Q)},function(Q){P.status==="pending"&&(P.status="rejected",P.reason=Q)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function R(P,Q,ne,I,he){var be=typeof P;(be==="undefined"||be==="boolean")&&(P=null);var _e=!1;if(P===null)_e=!0;else switch(be){case"bigint":case"string":case"number":_e=!0;break;case"object":switch(P.$$typeof){case e:case t:_e=!0;break;case v:return _e=P._init,R(_e(P._payload),Q,ne,I,he)}}if(_e)return he=he(P),_e=I===""?"."+fe(P,0):I,D(he)?(ne="",_e!=null&&(ne=_e.replace(pe,"$&/")+"/"),R(he,Q,ne,"",function(ye){return ye})):he!=null&&(re(he)&&(he=T(he,ne+(he.key==null||P&&P.key===he.key?"":(""+he.key).replace(pe,"$&/")+"/")+_e)),Q.push(he)),1;_e=0;var W=I===""?".":I+":";if(D(P))for(var V=0;V<P.length;V++)I=P[V],be=W+fe(I,V),_e+=R(I,Q,ne,be,he);else if(V=w(P),typeof V=="function")for(P=V.call(P),V=0;!(I=P.next()).done;)I=I.value,be=W+fe(I,V++),_e+=R(I,Q,ne,be,he);else if(be==="object"){if(typeof P.then=="function")return R(ce(P),Q,ne,I,he);throw Q=String(P),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return _e}function z(P,Q,ne){if(P==null)return P;var I=[],he=0;return R(P,I,"","",function(be){return Q.call(ne,be,he++)}),I}function G(P){if(P._status===-1){var Q=P._result;Q=Q(),Q.then(function(ne){(P._status===0||P._status===-1)&&(P._status=1,P._result=ne)},function(ne){(P._status===0||P._status===-1)&&(P._status=2,P._result=ne)}),P._status===-1&&(P._status=0,P._result=Q)}if(P._status===1)return P._result.default;throw P._result}var se=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},ue={map:z,forEach:function(P,Q,ne){z(P,function(){Q.apply(this,arguments)},ne)},count:function(P){var Q=0;return z(P,function(){Q++}),Q},toArray:function(P){return z(P,function(Q){return Q})||[]},only:function(P){if(!re(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return ze.Activity=y,ze.Children=ue,ze.Component=A,ze.Fragment=n,ze.Profiler=l,ze.PureComponent=M,ze.StrictMode=r,ze.Suspense=m,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,ze.__COMPILER_RUNTIME={__proto__:null,c:function(P){return $.H.useMemoCache(P)}},ze.cache=function(P){return function(){return P.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(P,Q,ne){if(P==null)thLine truncated
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var rj;function OT(){return rj||(rj=1,(function(e){function t(R,z){var G=R.length;R.push(z);e:for(;0<G;){var se=G-1>>>1,ue=R[se];if(0<l(ue,z))R[se]=z,R[G]=ue,G=se;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var z=R[0],G=R.pop();if(G!==z){R[0]=G;e:for(var se=0,ue=R.length,P=ue>>>1;se<P;){var Q=2*(se+1)-1,ne=R[Q],I=Q+1,he=R[I];if(0>l(ne,G))I<ue&&0>l(he,ne)?(R[se]=he,R[I]=G,se=I):(R[se]=ne,R[Q]=G,se=Q);else if(I<ue&&0>l(he,G))R[se]=he,R[I]=G,se=I;else break e}}return z}function l(R,z){var G=R.sortIndex-z.sortIndex;return G!==0?G:R.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],v=1,y=null,b=3,w=!1,j=!1,_=!1,S=!1,A=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function k(R){for(var z=n(h);z!==null;){if(z.callback===null)r(h);else if(z.startTime<=R)r(h),z.sortIndex=z.expirationTime,t(m,z);else break;z=n(h)}}function D(R){if(_=!1,k(R),!j)if(n(m)!==null)j=!0,E||(E=!0,Z());else{var z=n(h);z!==null&&ce(D,z.startTime-R)}}var E=!1,$=-1,U=5,K=-1;function T(){return S?!0:!(e.unstable_now()-K<U)}function re(){if(S=!1,E){var R=e.unstable_now();K=R;var z=!0;try{e:{j=!1,_&&(_=!1,C($),$=-1),w=!0;var G=b;try{t:{for(k(R),y=n(m);y!==null&&!(y.expirationTime>R&&T());){var se=y.callback;if(typeof se=="function"){y.callback=null,b=y.priorityLevel;var ue=se(y.expirationTime<=R);if(R=e.unstable_now(),typeof ue=="function"){y.callback=ue,k(R),z=!0;break t}y===n(m)&&r(m),k(R)}else r(m);y=n(m)}if(y!==null)z=!0;else{var P=n(h);P!==null&&ce(D,P.startTime-R),z=!1}}break e}finally{y=null,b=G,w=!1}z=void 0}}finally{z?Z():E=!1}}}var Z;if(typeof M=="function")Z=function(){M(re)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,fe=pe.port2;pe.port1.onmessage=re,Z=function(){fe.postMessage(null)}}else Z=function(){A(re,0)};function ce(R,z){$=A(function(){R(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(R){switch(b){case 1:case 2:case 3:var z=3;break;default:z=b}var G=b;b=z;try{return R()}finally{b=G}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(R,z){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var G=b;b=R;try{return z()}finally{b=G}},e.unstable_scheduleCallback=function(R,z,G){var se=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?se+G:se):G=se,R){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=G+ue,R={id:v++,callback:z,priorityLevel:R,startTime:G,expirationTime:ue,sortIndex:-1},G>se?(R.sortIndex=G,t(h,R),n(m)===null&&R===n(h)&&(_?(C($),$=-1):_=!0,ce(D,G-se))):(R.sortIndex=ue,t(m,R),j||w||(j=!0,E||(E=!0,Z()))),R},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(R){var z=b;return function(){var G=b;b=z;try{return R.apply(this,arguments)}finally{b=G}}}})(Xp)),Xp}var aj;function ET(){return aj||(aj=1,Fp.exports=OT()),Fp.exports}var Wp={exports:{}},vn={};/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ij;function kT(){if(ij)return vn;ij=1;var e=zs();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},l=Symbol.for("react.portal");function s(m,h,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:y==null?null:""+y,children:m,containerInfo:h,implementation:v}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return vn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,vn.createPortal=function(m,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return s(m,h,null,v)},vn.flushSync=function(m){var h=d.T,v=r.p;try{if(d.T=null,r.p=2,m)return m()}finally{d.T=h,r.p=v,r.d.f()}},vn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(m,h))},vn.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},vn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var v=h.as,y=f(v,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?r.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:w}):v==="script"&&r.d.X(m,{crossOrigin:y,integrity:b,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},vn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=f(h.as,h.crossOrigin);r.d.M(m,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(m)},vn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,y=f(v,h.crossOrigin);r.d.L(m,v,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},vn.preloadModule=function(m,h){if(typeof m=="string")if(h){var v=f(h.as,h.crossOrigin);r.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(m)},vn.requestFormReset=function(m){r.d.r(m)},vn.unstable_batchedUpdates=function(m,h){return m(h)},vn.useFormState=function(m,h,v){return d.H.useFormState(m,h,v)},vn.useFormStatus=function(){return d.H.useHostTransitionStatus()},vn.version="19.2.7",vn}var lj;function iA(){if(lj)return Wp.exports;lj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Wp.exports=kT(),Wp.exports}/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var sj;function CT(){if(sj)return Uo;sj=1;var e=ET(),t=zs(),n=iA();function r(a){var i="https://react.dev/errors/"+a;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)i+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+a+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function s(a){var i=a,o=a;if(a.alternate)for(;i.return;)i=i.return;else{a=i;do i=a,(i.flags&4098)!==0&&(o=i.return),a=i.return;while(a)}return i.tag===3?o:null}function d(a){if(a.tag===13){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function f(a){if(a.tag===31){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function m(a){if(s(a)!==a)throw Error(r(188))}function h(a){var i=a.alternate;if(!i){if(i=s(a),i===null)throw Error(r(188));return i!==a?null:a}for(var o=a,u=i;;){var p=o.return;if(p===null)break;var g=p.alternate;if(g===null){if(u=p.return,u!==null){o=u;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===o)return m(p),a;if(g===u)return m(p),i;g=g.sibling}throw Error(r(188))}if(o.return!==u.return)o=p,u=g;else{for(var N=!1,O=p.child;O;){if(O===o){N=!0,o=p,u=g;break}if(O===u){N=!0,u=p,o=g;break}O=O.sibling}if(!N){for(O=g.child;O;){if(O===o){N=!0,o=g,u=p;break}if(O===u){N=!0,u=g,o=p;break}O=O.sibling}if(!N)throw Error(r(189))}}if(o.alternate!==u)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?a:i}function v(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a;for(a=a.child;a!==null;){if(i=v(a),i!==null)return i;a=a.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),M=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),re=Symbol.iterator;function Z(a){return a===null||typeof a!="object"?null:(a=re&&a[re]||a["@@iterator"],typeof a=="function"?a:null)}var pe=Symbol.for("react.client.reference");function fe(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===pe?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case _:return"Fragment";case A:return"Profiler";case S:return"StrictMode";case D:return"Suspense";case E:return"SuspenseList";case K:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case j:return"Portal";case M:return a.displayName||"Context";case C:return(a._context.displayName||"Context")+".Consumer";case k:var i=a.render;return a=a.displayName,a||(a=i.displayName||i.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case $:return i=a.displayName||null,i!==null?i:fe(a.type)||"Memo";case U:i=a._payload,a=a._init;try{return fe(a(i))}catch{}}return null}var ce=Array.isArray,R=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},se=[],ue=-1;function P(a){return{current:a}}function Q(a){0>ue||(a.current=se[ue],se[ue]=null,ue--)}function ne(a,i){ue++,se[ue]=a.current,a.current=i}var I=P(null),he=P(null),be=P(null),_e=P(null);function W(a,i){switch(ne(be,i),ne(he,a),ne(I,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?jw(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=jw(i),a=_w(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}Q(I),ne(I,a)}function V(){Q(I),Q(he),Q(be)}function ye(a){a.memoizedState!==null&&ne(_e,a);var i=I.current,o=_w(i,a.type);i!==o&&(ne(he,a),ne(I,o))}function xe(a){he.current===a&&(Q(I),Q(he)),_e.current===a&&(Q(_e),Io._currentValue=G)}var ae,Le;function Ce(a){if(ae===void 0)try{throw Error()}catch(o){var i=o.stack.trim().match(/\n( *(at )?)/);ae=i&&i[1]||"",Le=-1<o.stack.indexOf(`
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ae+a+Le}var Y=!1;function ge(a,i){if(!a||Y)return"";Y=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(i){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(le){var te=le}Reflect.construct(a,[],me)}else{try{me.call()}catch(le){te=le}a.call(me.prototype)}}else{try{throw Error()}catch(le){te=le}(me=a())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(le){if(le&&te&&typeof le.stack=="string")return[le.stack,te.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=u.DetermineComponentFrameRoot(),N=g[0],O=g[1];if(N&&O){var L=N.split(`
`),ee=O.split(`
`);for(p=u=0;u<L.length&&!L[u].includes("DetermineComponentFrameRoot");)u++;for(;p<ee.length&&!ee[p].includes("DetermineComponentFrameRoot");)p++;if(u===L.length||p===ee.length)for(u=L.length-1,p=ee.length-1;1<=u&&0<=p&&L[u]!==ee[p];)p--;for(;1<=u&&0<=p;u--,p--)if(L[u]!==ee[p]){if(u!==1||p!==1)do if(u--,p--,0>p||L[u]!==ee[p]){var oe=`
`+L[u].replace(" at new "," at ");return a.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",a.displayName)),oe}while(1<=u&&0<=p);break}}}finally{Y=!1,Error.prepareStackTrace=o}return(o=a?a.displayName||a.name:"")?Ce(o):""}function Pe(a,i){switch(a.tag){case 26:case 27:case 5:return Ce(a.type);case 16:return Ce("Lazy");case 13:return a.child!==i&&i!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return ge(a.type,!1);case 11:return ge(a.type.render,!1);case 1:return ge(a.type,!0);case 31:return Ce("Activity");default:return""}}function Be(a){try{var i="",o=null;do i+=Pe(a,o),o=a,a=a.return;while(a);return i}catch(u){return`
Error generating stack: `+u.message+`
`+u.stack}}var Ve=Object.prototype.hasOwnProperty,Dt=e.unstable_scheduleCallback,ie=e.unstable_cancelCallback,De=e.unstable_shouldYield,Ue=e.unstable_requestPaint,B=e.unstable_now,Te=e.unstable_getCurrentPriorityLevel,lt=e.unstable_ImmediatePriority,Zr=e.unstable_UserBlockingPriority,Qn=e.unstable_NormalPriority,$n=e.unstable_LowPriority,wi=e.unstable_IdlePriority,xl=e.log,q=e.unstable_setDisableYieldValue,ve=null,we=null;function $e(a){if(typeof xl=="function"&&q(a),we&&typeof we.setStrictMode=="function")try{we.setStrictMode(ve,a)}catch{}}var We=Math.clz32?Math.clz32:Cr,Jt=Math.log,jt=Math.LN2;function Cr(a){return a>>>=0,a===0?32:31-(Jt(a)/jt|0)|0}var _t=256,bl=262144,Vc=4194304;function ji(a){var i=a&42;if(i!==0)return i;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function Fc(a,i,o){var u=a.pendingLanes;if(u===0)return 0;var p=0,g=a.suspendedLanes,N=a.pingedLanes;a=a.warmLanes;var O=u&134217727;return O!==0?(u=O&~g,u!==0?p=ji(u):(N&=O,N!==0?p=ji(N):o||(o=O&~a,o!==0&&(p=ji(o))))):(O=u&~g,O!==0?p=ji(O):N!==0?p=ji(N):o||(o=u&~a,o!==0&&(p=ji(o)))),p===0?0:i!==0&&i!==p&&(i&g)===0&&(g=p&-p,o=i&-i,g>=o||g===32&&(o&4194048)!==0)?i:p}function Fs(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function s5(a,i){switch(a){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rx(){var a=Vc;return Vc<<=1,(Vc&62914560)===0&&(Vc=4194304),a}function Dm(a){for(var i=[],o=0;31>o;o++)i.push(a);return i}function Xs(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function o5(a,i,o,u,p,g){var N=a.pendingLanes;a.pendingLanes=o,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=o,a.entangledLanes&=o,a.errorRecoveryDisabledLanes&=o,a.shellSuspendCounter=0;var O=a.entanglements,L=a.expirationTimes,ee=a.hiddenUpdates;for(o=N&~o;0<o;){var oe=31-We(o),me=1<<oe;O[oe]=0,L[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var le=te[oe];le!==null&&(le.lane&=-536870913)}o&=~me}u!==0&&ax(a,u,0),g!==0&&p===0&&a.tag!==0&&(a.suspendedLanes|=g&~(N&~i))}function ax(a,i,o){a.pendingLanes|=i,a.suspendedLanes&=~i;var u=31-We(i);a.entangledLanes|=i,a.entanglements[u]=a.entanglements[u]|1073741824|o&261930}function ix(a,i){var o=a.entangledLanes|=i;for(a=a.entanglements;o;){var u=31-We(o),p=1<<u;p&i|a[u]&i&&(a[u]|=i),o&=~p}}function lx(a,i){var o=i&-i;return o=(o&42)!==0?1:Pm(o),(o&(a.suspendedLanes|i))!==0?0:o}function Pm(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function zm(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function sx(){var a=z.p;return a!==0?a:(a=window.event,a===void 0?32:Gw(a.type))}function ox(a,i){var o=z.p;try{return z.p=a,i()}finally{z.p=o}}var Ia=Math.random().toString(36).slice(2),on="__reactFiber$"+Ia,An="__reactProps$"+Ia,wl="__reactContainer$"+Ia,Im="__reactEvents$"+Ia,c5="__reactListeners$"+Ia,u5="__reactHandles$"+Ia,cx="__reactResources$"+Ia,Ws="__reactMarker$"+Ia;function $m(a){delete a[on],delete a[An],delete a[Im],delete a[c5],delete a[u5]}function jl(a){var i=a[on];if(i)return i;for(var o=a.parentNode;o;){if(i=o[wl]||o[on]){if(o=i.alternate,i.child!==null||o!==null&&o.child!==null)for(a=Cw(a);a!==null;){if(o=a[on])return o;a=Cw(a)}return i}a=o,o=a.parentNode}return null}function _l(a){if(a=a[on]||a[wl]){var i=a.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return a}return null}function Zs(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a.stateNode;throw Error(r(33))}function Nl(a){var i=a[cx];return i||(i=a[cx]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function en(a){a[Ws]=!0}var ux=new Set,dx={};function _i(a,i){Sl(a,i),Sl(a+"Capture",i)}function Sl(a,i){for(dx[a]=i,a=0;a<i.length;a++)ux.add(i[a])}var d5=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\ Line truncated
`).replace(H3,"")}function bw(a,i){return i=xw(i),xw(a)===i}function ot(a,i,o,u,p,g){switch(o){case"children":typeof u=="string"?i==="body"||i==="textarea"&&u===""||Ol(a,u):(typeof u=="number"||typeof u=="bigint")&&i!=="body"&&Ol(a,""+u);break;case"className":Wc(a,"class",u);break;case"tabIndex":Wc(a,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Wc(a,o,u);break;case"style":bx(a,u,g);break;case"data":if(i!=="object"){Wc(a,"data",u);break}case"src":case"href":if(u===""&&(i!=="a"||o!=="href")){a.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){a.removeAttribute(o);break}u=Qc(""+u),a.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){a.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(o==="formAction"?(i!=="input"&&ot(a,i,"name",p.name,p,null),ot(a,i,"formEncType",p.formEncType,p,null),ot(a,i,"formMethod",p.formMethod,p,null),ot(a,i,"formTarget",p.formTarget,p,null)):(ot(a,i,"encType",p.encType,p,null),ot(a,i,"method",p.method,p,null),ot(a,i,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){a.removeAttribute(o);break}u=Qc(""+u),a.setAttribute(o,u);break;case"onClick":u!=null&&(a.onclick=Jr);break;case"onScroll":u!=null&&Ke("scroll",a);break;case"onScrollEnd":u!=null&&Ke("scrollend",a);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));a.innerHTML=o}}break;case"multiple":a.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":a.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){a.removeAttribute("xlink:href");break}o=Qc(""+u),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?a.setAttribute(o,""+u):a.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?a.setAttribute(o,""):a.removeAttribute(o);break;case"capture":case"download":u===!0?a.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?a.setAttribute(o,u):a.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?a.setAttribute(o,u):a.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?a.removeAttribute(o):a.setAttribute(o,u);break;case"popover":Ke("beforetoggle",a),Ke("toggle",a),Xc(a,"popover",u);break;case"xlinkActuate":Qr(a,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Qr(a,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Qr(a,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Qr(a,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Qr(a,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Qr(a,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Qr(a,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Qr(a,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Qr(a,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Xc(a,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=v5.get(o)||o,Xc(a,o,u))}}function Op(a,i,o,u,p,g){switch(o){case"style":bx(a,u,g);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));a.innerHTML=o}}break;case"children":typeof u=="string"?Ol(a,u):(typeof u=="number"||typeof u=="bigint")&&Ol(a,""+u);break;case"onScroll":u!=null&&Ke("scroll",a);break;case"onScrollEnd":u!=null&&Ke("scrollend",a);break;case"onClick":u!=null&&(a.onclick=Jr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
* @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=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zT=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),cj=e=>{const t=zT(e);return t.charAt(0).toUpperCase()+t.slice(1)},lA=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),IT=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var $T={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const RT=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:l="",children:s,iconNode:d,...f},m)=>x.createElement("svg",{ref:m,...$T,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:lA("lucide",l),...!s&&!IT(f)&&{"aria-hidden":"true"},...f},[...d.map(([h,v])=>x.createElement(h,v)),...Array.isArray(s)?s:[s]]));/**
* @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 Oe=(e,t)=>{const n=x.forwardRef(({className:r,...l},s)=>x.createElement(RT,{ref:s,iconNode:t,className:lA(`lucide-${PT(cj(e))}`,`lucide-${e}`,r),...l}));return n.displayName=cj(e),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 LT=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],uj=Oe("activity",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 BT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Rv=Oe("arrow-right",BT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const UT=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],gs=Oe("bell",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 HT=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ps=Oe("bot",HT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qT=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],sA=Oe("box",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 KT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ci=Oe("check",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 YT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],GT=Oe("chevron-down",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 VT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],FT=Oe("chevron-left",VT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const XT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],WT=Oe("chevron-right",XT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZT=[["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"}]],$d=Oe("circle-alert",ZT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const QT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],oA=Oe("circle-check",QT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const JT=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],eM=Oe("circle-dashed",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 tM=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],cA=Oe("clock-3",tM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nM=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],dj=Oe("clock",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:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],od=Oe("cloud-upload",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 aM=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],fj=Oe("code",aM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const iM=[["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"}]],lM=Oe("copy",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 sM=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Lv=Oe("credit-card",sM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const oM=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],cM=Oe("database",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 uM=[["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"}]],dM=Oe("dollar-sign",uM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fM=[["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"}]],uA=Oe("external-link",fM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mM=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ic=Oe("eye-off",mM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hM=[["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"}]],xs=Oe("eye",hM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],vM=Oe("file-down",pM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],mj=Oe("file-text",yM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gM=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],xM=Oe("gift",gM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bM=[["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"}]],hj=Oe("image",bM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],jM=Oe("key",wM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _M=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],NM=Oe("layers",_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 SM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],AM=Oe("layout-dashboard",SM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const OM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],EM=Oe("link-2",OM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kM=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],CM=Oe("list-plus",kM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const TM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Yn=Oe("loader-circle",TM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const MM=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],pj=Oe("lock-keyhole",MM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const DM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],PM=Oe("lock",DM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],IM=Oe("log-out",zM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $M=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],dA=Oe("mail",$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 RM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],Cd=Oe("message-circle",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 LM=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],uc=Oe("package-check",LM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const BM=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],Zp=Oe("package-plus",BM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const UM=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],fA=Oe("package",UM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const HM=[["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"}]],mA=Oe("pen",HM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ja=Oe("plus",qM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const KM=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],YM=Oe("power",KM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const GM=[["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"}]],Qp=Oe("qr-code",GM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const VM=[["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"}]],pr=Oe("refresh-cw",VM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const FM=[["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"}]],Sa=Oe("save",FM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const XM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],WM=Oe("search",XM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Yy=Oe("send",ZM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const QM=[["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"}]],Gy=Oe("settings",QM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const JM=[["path",{d:"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"}]],hA=Oe("shield-check",JM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eD=[["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"}]],pA=Oe("shopping-bag",eD);/**
* @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 tD=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],vj=Oe("shopping-cart",tD);/**
* @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 nD=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],vA=Oe("sparkles",nD);/**
* @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 rD=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],bs=Oe("square-pen",rD);/**
* @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 aD=[["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"}]],xa=Oe("trash-2",aD);/**
* @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 iD=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],lD=Oe("trending-up",iD);/**
* @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 sD=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],yj=Oe("truck",sD);/**
* @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 oD=[["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"}]],tc=Oe("upload",oD);/**
* @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 cD=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],uD=Oe("user-round",cD);/**
* @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 dD=[["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"}]],Bv=Oe("user",dD);/**
* @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 fD=[["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"}]],yA=Oe("users",fD);/**
* @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 mD=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],hD=Oe("webhook",mD);/**
* @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 pD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xt=Oe("x",pD);/**
* @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 vD=[["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"}]],Uv=Oe("zap",vD),yD=({activeTab:e,onNavigate:t,onLogout:n})=>{const r=[{id:"dashboard",icon:AM,label:"仪表盘"},{id:"accounts",icon:yA,label:"账号管理"},{id:"orders",icon:pA,label:"订单管理"},{id:"cards",icon:Lv,label:"卡密库存"},{id:"items",icon:sA,label:"商品列表"},{id:"rules",icon:Uv,label:"自动化规则"},{id:"notifications",icon:gs,label:"通知设置"},{id:"settings",icon:Gy,label:"系统与AI"}];return c.jsxs("div",{className:"w-64 h-screen fixed left-0 top-0 bg-white border-r border-gray-100 flex flex-col justify-between z-20 shadow-[4px_0_24px_rgba(0,0,0,0.02)]",children:[c.jsxs("div",{className:"p-6",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-12 px-2",children:[c.jsx("div",{className:"w-10 h-10 bg-[#0094f7] squircle flex items-center justify-center shrink-0 p-1.5",style:{filter:"drop-shadow(0 4px 12px rgba(0,148,247,0.25))"},children:c.jsx("img",{src:"/static/ydisks-logo.svg",alt:"Ydisks",className:"w-full h-full"})}),c.jsxs("h1",{className:"text-xl font-extrabold tracking-tight text-gray-900",children:["Ydisks闲鱼助手 ",c.jsx("span",{className:"text-xs bg-[#0094f7] text-white px-1.5 py-0.5 rounded ml-1",children:"PRO"})]})]}),c.jsx("nav",{className:"space-y-2",children:r.map(l=>{const s=l.icon,d=e===l.id;return c.jsxs("button",{onClick:()=>t(l.id),className:`w-full flex items-center gap-3 px-4 py-3.5 rounded-2xl transition-all duration-300 group relative overflow-hidden ${d?"bg-[#0094f7] text-white font-bold shadow-lg shadow-blue-100 transform scale-[1.02]":"text-gray-500 hover:bg-gray-50 hover:text-gray-900"}`,children:[c.jsx(s,{className:`w-5 h-5 transition-colors ${d?"text-white":"text-gray-400 group-hover:text-gray-600"}`}),c.jsx("span",{className:"text-sm tracking-wide",children:l.label}),d&&c.jsx(vA,{className:"w-4 h-4 absolute right-3 text-white/30 animate-pulse"})]},l.id)})})]}),c.jsx("div",{className:"p-6 border-t border-gray-50",children:c.jsxs("button",{onClick:n,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-2xl transition-all duration-200 font-medium",children:[c.jsx(IM,{className:"w-5 h-5"}),c.jsx("span",{className:"text-sm",children:"退出登录"})]})})]})},gD=e=>{if(!e)return"";const t=new URLSearchParams;for(const[r,l]of Object.entries(e))l!=null&&t.set(r,String(l));const n=t.toString();return n?`?${n}`:""},Rf=async(e,t,n={})=>{const r=gD(n.params),l=`${t}${r}`,s=await fetch(l,{method:e,credentials:"include",headers:{...n.body===void 0?{}:{"Content-Type":"application/json"}},body:n.body===void 0?void 0:JSON.stringify(n.body)}),f=(s.headers.get("content-type")||"").includes("application/json");if(!s.ok){const m=f?await s.json().catch(()=>{}):await s.text().catch(()=>{}),h=typeof m=="string"?m:(m==null?void 0:m.detail)||(m==null?void 0:m.message)||(m==null?void 0:m.msg);throw new Error(h||`请求失败: ${s.status}`)}return f?await s.json():await s.text()},Tt=async(e,t)=>Rf("GET",e,{params:t}),$t=async(e,t)=>Rf("POST",e,{body:t}),Sn=async(e,t)=>Rf("PUT",e,{body:t}),ml=async(e,t)=>Rf("DELETE",e,{params:t}),Vy=async(e,t)=>{const n=await fetch(e,{method:"POST",credentials:"include",body:t}),s=(n.headers.get("content-type")||"").includes("application/json")?await n.json().catch(()=>{}):await n.text().catch(()=>{});if(!n.ok){const d=typeof s=="string"?s:(s==null?void 0:s.detail)||(s==null?void 0:s.message)||(s==null?void 0:s.msg),f=new Error(d||"请求失败: "+n.status);throw f.payload=s,f}return s},xD=async e=>$t("/login",e),gA=async()=>Tt("/verify"),bD=async e=>Sn("/account/credentials",e),wD=async(e,t)=>$t("/cookies",{id:e,value:t}),jD=(e,t)=>{const n=e.avatar_url||"";if(!n)return"";try{const r=new URL(n,window.location.origin);return r.hostname.endsWith("alicdn.com")&&r.searchParams.set("_v",t),r.toString()}catch{return n}},Fy=async()=>{const e=await Tt("/cookies/details"),t=Date.now().toString();return e.map(n=>({id:n.id,value:"",cookie:"",enabled:n.enabled,auto_confirm:n.auto_confirm,remark:n.remark,note:n.remark,pause_duration:n.pause_duration,username:n.username||"",login_password:"",show_browser:n.show_browser,nickname:n.nickname||n.remark||`账号 ${n.id.substring(0,6)}`,avatar_url:jD(n,t),profile_error:n.profile_error||"",ai_enabled:!1}))},_D=async()=>Tt("/cookies/runtime-status"),ND=async()=>$t("/qr-login/generate"),SD=async e=>Tt(`/qr-login/check/${e}`),AD=async(e,t)=>Sn(`/cookies/${e}/status`,{enabled:t}),OD=async e=>ml(`/cookies/${e}`),ED=async(e,t)=>Sn(`/cookies/${e}/remark`,{remark:t}),kD=async(e,t)=>Sn(`/cookies/${e}/auto-confirm`,{auto_confirm:t}),CD=async(e,t)=>Sn(`/cookies/${e}/pause-duration`,{pause_duration:t}),gj=async(e,t)=>Sn(`/cookies/${e}`,{id:e,value:t}),TD=async e=>$t(`/cookies/${e}/refresh-profile`,{}),MD=async(e,t)=>Sn(`/cookies/${e}/login-info`,t),DD=asynLine truncated
A`).concat(s,",").concat(s,",0,1,1,").concat(2*d,",").concat(l,`
H`).concat(fr,"M").concat(2*d,",").concat(l,`
A`).concat(s,",").concat(s,",0,1,1,").concat(d,",").concat(l),className:"recharts-legend-icon"});if(m==="rect")return x.createElement("path",{stroke:"none",fill:f,d:"M0,".concat(fr/8,"h").concat(fr,"v").concat(fr*3/4,"h").concat(-fr,"z"),className:"recharts-legend-icon"});if(x.isValidElement(t.legendIcon)){var h=WA({},t);return delete h.legendIcon,x.cloneElement(t.legendIcon,h)}return x.createElement(FA,{fill:f,cx:l,cy:l,size:fr,sizeType:"diameter",type:m})}function D6(e){var t=e.payload,n=e.iconSize,r=e.layout,l=e.formatter,s=e.inactiveColor,d=e.iconType,f=e.labelStyle,m={x:0,y:0,width:fr,height:fr},h={display:r==="horizontal"?"inline-block":"block",marginRight:10},v={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((y,b)=>{var w=y.formatter||l,j=nt({"recharts-legend-item":!0,["legend-item-".concat(b)]:!0,inactive:y.inactive});if(y.type==="none")return null;var _=typeof f=="object"?WA({},f):{};_.color=y.inactive?s:_.color||y.color;var S=w?w(y.value,y,b):y.value;return x.createElement("li",Kd({className:j,style:h,key:"legend-item-".concat(b)},Oc(e,y,b)),x.createElement(Wy,{width:n,height:n,viewBox:m,style:v,"aria-label":"".concat(y.value," legend icon")},x.createElement(M6,{data:y,iconType:d,inactiveColor:s})),x.createElement("span",{className:"recharts-legend-item-text",style:_},S))})}var P6=e=>{var t=an(e,C6),n=t.payload,r=t.layout,l=t.align;if(!n||!n.length)return null;var s={padding:0,margin:0,textAlign:r==="horizontal"?l:"left"};return x.createElement("ul",{className:"recharts-default-legend",style:s},x.createElement(D6,Kd({},t,{payload:n})))};function z6(e,t){const n=new Map;for(let r=0;r<e.length;r++){const l=e[r],s=t(l,r,e);n.has(s)||n.set(s,l)}return Array.from(n.values())}function I6(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function ZA(e){return e}function $6(e){return function(t){return Hr(t,e)}}function Wv(e){return e==null||typeof e!="object"&&typeof e!="function"}function R6(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function L6(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function r0(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const B6="[object RegExp]",QA="[object String]",JA="[object Number]",eO="[object Boolean]",tO="[object Arguments]",U6="[object Symbol]",H6="[object Date]",q6="[object Map]",K6="[object Set]",Y6="[object Array]",G6="[object ArrayBuffer]",V6="[object Object]",F6="[object DataView]",X6="[object Uint8Array]",W6="[object Uint8ClampedArray]",Z6="[object Uint16Array]",Q6="[object Uint32Array]",J6="[object Int8Array]",ez="[object Int16Array]",tz="[object Int32Array]",nz="[object Float32Array]",rz="[object Float64Array]",Dj=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function az(e){return typeof Dj.Buffer<"u"&&Dj.Buffer.isBuffer(e)}function iz(e,t){return Fi(e,void 0,e,new Map,t)}function Fi(e,t,n,r=new Map,l=void 0){const s=l==null?void 0:l(e,t,n,r);if(s!==void 0)return s;if(Wv(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const d=new Array(e.length);r.set(e,d);for(let f=0;f<e.length;f++)d[f]=Fi(e[f],f,n,r,l);return Object.hasOwn(e,"index")&&(d.index=e.index),Object.hasOwn(e,"input")&&(d.input=e.input),d}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const d=new RegExp(e.source,e.flags);return d.lastIndex=e.lastIndex,d}if(e instanceof Map){const d=new Map;r.set(e,d);for(const[f,m]of e)d.set(f,Fi(m,f,n,r,l));return d}if(e instanceof Set){const d=new Set;r.set(e,d);for(const f of e)d.add(Fi(f,void 0,n,r,l));return d}if(az(e))return e.subarray();if(R6(e)){const d=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,d);for(let f=0;f<e.length;f++)d[f]=Fi(e[f],f,n,r,l);return d}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const d=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,d),jr(d,e,n,r,l),d}if(typeof File<"u"&&e instanceof File){const d=new File([e],e.name,{type:e.type});return r.set(e,d),jr(d,e,n,r,l),d}if(typeof Blob<"u"&&e instanceof Blob){const d=new Blob([e],{type:e.type});return r.set(e,d),jr(d,e,n,r,l),d}if(e instanceof Error){const d=structuredClone(e);return r.set(e,d),d.message=e.message,d.name=e.name,d.stack=e.stack,d.cause=e.cause,d.constructor=e.constructor,jr(d,e,n,r,l),d}if(e instanceof Boolean){const d=new Boolean(e.valueOf());return r.set(e,d),jr(d,e,n,r,l),d}if(e instanceof Number){const d=new Number(e.valueOf());return r.set(e,d),jr(d,e,n,r,l),d}if(e instanceof String){const d=new String(e.valueOf());return r.set(e,d),jr(d,e,n,r,l),d}if(typeof e=="object"&&lz(e)){const d=Object.create(Object.getPrototypeOf(e));return r.set(e,d),jr(d,e,n,r,l),d}return e}function jr(e,t,n=e,r,l){const s=[...Object.keys Line truncated
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var zj;function jz(){if(zj)return iv;zj=1;var e=zs();function t(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,l=e.useEffect,s=e.useLayoutEffect,d=e.useDebugValue;function f(y,b){var w=b(),j=r({inst:{value:w,getSnapshot:b}}),_=j[0].inst,S=j[1];return s(function(){_.value=w,_.getSnapshot=b,m(_)&&S({inst:_})},[y,w,b]),l(function(){return m(_)&&S({inst:_}),y(function(){m(_)&&S({inst:_})})},[y]),d(w),w}function m(y){var b=y.getSnapshot;y=y.value;try{var w=b();return!n(y,w)}catch{return!0}}function h(y,b){return b()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return iv.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,iv}var Ij;function _z(){return Ij||(Ij=1,av.exports=jz()),av.exports}/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var $j;function Nz(){if($j)return rv;$j=1;var e=zs(),t=_z();function n(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var r=typeof Object.is=="function"?Object.is:n,l=t.useSyncExternalStore,s=e.useRef,d=e.useEffect,f=e.useMemo,m=e.useDebugValue;return rv.useSyncExternalStoreWithSelector=function(h,v,y,b,w){var j=s(null);if(j.current===null){var _={hasValue:!1,value:null};j.current=_}else _=j.current;j=f(function(){function A(E){if(!C){if(C=!0,M=E,E=b(E),w!==void 0&&_.hasValue){var $=_.value;if(w($,E))return k=$}return k=E}if($=k,r(M,E))return $;var U=b(E);return w!==void 0&&w($,U)?(M=E,$):(M=E,k=U)}var C=!1,M,k,D=y===void 0?null:y;return[function(){return A(v())},D===null?void 0:function(){return A(D())}]},[v,y,b,w]);var S=l(h,j[0],j[1]);return d(function(){_.hasValue=!0,_.value=S},[S]),m(S),S},rv}var Rj;function Sz(){return Rj||(Rj=1,nv.exports=Nz()),nv.exports}var Az=Sz(),a0=x.createContext(null),Oz=e=>e,dt=()=>{var e=x.useContext(a0);return e?e.store.dispatch:Oz},Md=()=>{},Ez=()=>Md,kz=(e,t)=>e===t;function Ne(e){var t=x.useContext(a0),n=x.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Md,[t,e]);return Az.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Ez,t?t.store.getState:Md,t?t.store.getState:Md,n,kz)}function Cz(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Tz(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Lj=e=>Array.isArray(e)?e:[e];function Mz(e){const t=Array.isArray(e[0])?e[0]:e;return Tz(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Dz(e,t){const n=[],{length:r}=e;for(let l=0;l<r;l++)n.push(e[l].apply(null,t));return n}var Pz=class{constructor(e){this.value=e}deref(){return this.value}},zz=()=>typeof WeakRef>"u"?Pz:WeakRef,cO=zz(),Iz=0,Bj=1;function dd(){return{s:Iz,v:void 0,o:null,p:null}}function $z(e){return e instanceof cO?e.deref():e}function uO(e,t={}){let n=dd();const{resultEqualityCheck:r}=t;let l,s=0;function d(){let f=n;const{length:m}=arguments;for(let y=0,b=m;y<b;y++){const w=arguments[y];if(typeof w=="function"||typeof w=="object"&&w!==null){let j=f.o;j===null&&(f.o=j=new WeakMap);const _=j.get(w);_===void 0?(f=dd(),j.set(w,f)):f=_}else{let j=f.p;j===null&&(f.p=j=new Map);const _=j.get(w);_===void 0?(f=dd(),j.set(w,f)):f=_}}const h=f;let v;if(f.s===Bj)v=f.v;else if(v=e.apply(null,arguments),s++,r){const y=$z(l);y!=null&&r(y,v)&&(v=y,s!==0&&s--),l=typeof v=="object"&&v!==null||typeof v=="function"?new cO(v):v}return h.s=Bj,h.v=v,v}return d.clearCache=()=>{n=dd(),d.resetResultsCount()},d.resultsCount=()=>s,d.resetResultsCount=()=>{s=0},d}function Rz(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...l)=>{let s=0,d=0,f,m={},h=l.pop();typeof h=="object"&&(m=h,h=l.pop()),Cz(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const v={...n,...m},{memoize:y,memoizeOptions:b=[],argsMemoize:w=uO,argsMemoizeOptions:j=[]}=v,_=Lj(b),S=Lj(j),A=Mz(l),C=y(function(){return s++,h.apply(null,arguments)},..._),M=w(function(){d++;const D=Dz(A,arguments);return f=C.apply(null,D),f},...S);return Object.assign(M,{resultFunc:h,memoizedResultFunc:C,dependencies:A,dependencyRecomputations:()=>d,resetDependencyRecomputations:()=>{d=0},lastResult:()=>f,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:y,argsMemoize:w})};return Object.assign(r,{withTypes:()=>r}),r}var X=Rz(uO);function Lz(e,t=1){const n=[],r=Math.floor(t),l=(s,d)=>{for(let f=0;f<s.length;f++){const m=s[f];Array.isArray(m)&&d<r?l(m,d+1):n.push(m)}};return l(e,0),n}function Qv(e,t,n){return nO(n)&&(typeof t=="number"&&sO(n)&&lO(t)&&t<n.length||typeof t=="string"&&t in n)?Td(n[t],e):!1}function Uj(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const Bz=(e,t,n)=>{if(e!==t){const r=Uj(e),l=Uj(t);if(r===l&&r===0){if(e<t)return n==="desc"?1:-1;if(e>t)return n==="desc"?-1:1}return n==="desc"?l-r:r-l}return 0};function dO(e){return typeof e=="symbol"||e instanceof Symbol}const Uz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hz=/^\w*$/;function qz(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||dO(e)?!0:typeof e=="string"&&(Hz.test(e)||!Uz.test(e))||t!=null}function Kz(e,t,n,r){if(e==null)return[];n=n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(f=>String(f));const l=(f,m)=>{let h=f;for(let v=0;v<m.length&&h!=null;++v)h=h[m[v]];return h},s=(f,m)=>m==null||f==null?m:typeof f=="object"&&"key"in f?Object.hasOwn(m,f.key)?m[f.key]:l(m,f.path):typeof f=="function"?f(m):Array.isArray(f)?l(m,f):typeof m=="object"?m[f]:m,d=t.map(f=>(Array.isArray(f)&&f.length===1&&(f=f[0]),f==nullLine truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zz(e,t){if(e){if(typeof e=="string")return Hj(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hj(e,t):void 0}}function Hj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Qz(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function Jz(e){if(Array.isArray(e))return e}var fd=1;function qj(e,t){return Math.abs(e.height-t.height)>fd||Math.abs(e.left-t.left)>fd||Math.abs(e.top-t.top)>fd||Math.abs(e.width-t.width)>fd}function Kj(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function mO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=x.useState({height:0,left:0,top:0,width:0}),n=Xz(t,2),r=n[0],l=n[1],s=x.useRef(null),d=x.useRef(r);d.current=r;var f=x.useCallback(m=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),m!=null){var h=Kj(m);if(qj(h,d.current)&&l(h),typeof ResizeObserver<"u"){var v=new ResizeObserver(()=>{var y=Kj(m);qj(y,d.current)&&l(y)});v.observe(m),s.current=v}}},[...e]);return x.useEffect(()=>()=>{var m;(m=s.current)===null||m===void 0||m.disconnect()},[]),[r,f]}function mn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var e8=typeof Symbol=="function"&&Symbol.observable||"@@observable",Yj=e8,lv=()=>Math.random().toString(36).substring(7).split("").join("."),t8={INIT:`@@redux/INIT${lv()}`,REPLACE:`@@redux/REPLACE${lv()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${lv()}`},Yd=t8;function i0(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function hO(e,t,n){if(typeof e!="function")throw new Error(mn(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(mn(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(mn(1));return n(hO)(e,t)}let r=e,l=t,s=new Map,d=s,f=0,m=!1;function h(){d===s&&(d=new Map,s.forEach((S,A)=>{d.set(A,S)}))}function v(){if(m)throw new Error(mn(3));return l}function y(S){if(typeof S!="function")throw new Error(mn(4));if(m)throw new Error(mn(5));let A=!0;h();const C=f++;return d.set(C,S),function(){if(A){if(m)throw new Error(mn(6));A=!1,h(),d.delete(C),s=null}}}function b(S){if(!i0(S))throw new Error(mn(7));if(typeof S.type>"u")throw new Error(mn(8));if(typeof S.type!="string")throw new Error(mn(17));if(m)throw new Error(mn(9));try{m=!0,l=r(l,S)}finally{m=!1}return(s=d).forEach(C=>{C()}),S}function w(S){if(typeof S!="function")throw new Error(mn(10));r=S,b({type:Yd.REPLACE})}function j(){const S=y;return{subscribe(A){if(typeof A!="object"||A===null)throw new Error(mn(11));function C(){const k=A;k.next&&k.next(v())}return C(),{unsubscribe:S(C)}},[Yj](){return this}}}return b({type:Yd.INIT}),{dispatch:b,subscribe:y,getState:v,replaceReducer:w,[Yj]:j}}function n8(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Yd.INIT})>"u")throw new Error(mn(12));if(typeof n(void 0,{type:Yd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(mn(13))})}function pO(e){const t=Object.keys(e),n={};for(let s=0;s<t.length;s++){const d=t[s];typeof e[d]=="function"&&(n[d]=e[d])}const r=Object.keys(n);let l;try{n8(n)}catch(s){l=s}return function(d={},f){if(l)throw l;let m=!1;const h={};for(let v=0;v<r.length;v++){const y=r[v],b=n[y],w=d[y],j=b(w,f);if(typeof j>"u")throw f&&f.type,new Error(mn(14));h[y]=j,m=m||j!==w}return m=m||r.length!==Object.keys(d).length,m?h:d}}function Gd(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function r8(...e){return t=>(n,r)=>{const l=t(n,r);let s=()=>{throw new Error(mn(15))};const d={getState:l.getState,dispatch:(m,...h)=>s(m,...h)},f=e.map(m=>m(d));return s=Gd(...f)(l.dispatch),{...l,dispatch:s}}}function vO(e){return i0(e)&&"type"in e&&typeof e.type=="string"}var yO=Symbol.for("immer-nothing"),Gj=Symbol.for("immer-draftable"),Nn=Symbol.for("immer-state");function _r(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Vn=Object,Ss=Vn.getPrototypeOf,Vd="constructor",qf="prototype",Jv="configurable",Fd="enumerable",Dd="writable",fc="value",Aa=e=>!!e&&!!e[Nn];function Or(e){var t;return e?gO(e)||Yf(e)||!!e[Gj]||!!((t=e[Vd])!=null&&t Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HI(e,t){if(e){if(typeof e=="string")return p_(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p_(e,t):void 0}}function p_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function qI(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function KI(e){if(Array.isArray(e))return e}function YI(e,t){if(e==null)return{};var n,r,l=GI(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}function GI(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ZO=x.createContext(Rr.initialDimension);function VI(e){return Kr(e.width)&&Kr(e.height)}function QO(e){var t=e.children,n=e.width,r=e.height,l=x.useMemo(()=>({width:n,height:r}),[n,r]);return VI(l)?x.createElement(ZO.Provider,{value:l},t):null}var f0=()=>x.useContext(ZO),FI=x.forwardRef((e,t)=>{var n=e.aspect,r=e.initialDimension,l=r===void 0?Rr.initialDimension:r,s=e.width,d=e.height,f=e.minWidth,m=f===void 0?Rr.minWidth:f,h=e.minHeight,v=e.maxHeight,y=e.children,b=e.debounce,w=b===void 0?Rr.debounce:b,j=e.id,_=e.className,S=e.onResize,A=e.style,C=A===void 0?{}:A,M=YI(e,II),k=x.useRef(null),D=x.useRef();D.current=S,x.useImperativeHandle(t,()=>k.current);var E=x.useState({containerWidth:l.width,containerHeight:l.height}),$=BI(E,2),U=$[0],K=$[1],T=x.useCallback((R,z)=>{K(G=>{var se=Math.round(R),ue=Math.round(z);return G.containerWidth===se&&G.containerHeight===ue?G:{containerWidth:se,containerHeight:ue}})},[]);x.useEffect(()=>{if(k.current==null||typeof ResizeObserver>"u")return hl;var R=P=>{var Q,ne=P[0];if(ne!=null){var I=ne.contentRect,he=I.width,be=I.height;T(he,be),(Q=D.current)===null||Q===void 0||Q.call(D,he,be)}};w>0&&(R=kI(R,w,{trailing:!0,leading:!1}));var z=new ResizeObserver(R),G=k.current.getBoundingClientRect(),se=G.width,ue=G.height;return T(se,ue),z.observe(k.current),()=>{z.disconnect()}},[T,w]);var re=U.containerWidth,Z=U.containerHeight;tf(!n||n>0,"The aspect(%s) must be greater than zero.",n);var pe=WO(re,Z,{width:s,height:d,aspect:n,maxHeight:v}),fe=pe.calculatedWidth,ce=pe.calculatedHeight;return tf(re<0||Z<0||fe!=null&&fe>0||ce!=null&&ce>0,`The width(%s) and height(%s) of chart should be greater than 0,
please check the style of container, or the props width(%s) and height(%s),
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
height and width.`,fe,ce,s,d,m,h,n),x.createElement("div",nf({id:j?"".concat(j):void 0,className:nt("recharts-responsive-container",_),style:h_(h_({},C),{},{width:s,height:d,minWidth:m,minHeight:h,maxHeight:v}),ref:k},M),x.createElement("div",{style:PI({width:s,height:d})},x.createElement(QO,{width:fe,height:ce},y)))}),yd=x.forwardRef((e,t)=>{var n=f0();if(Kr(n.width)&&Kr(n.height))return e.children;var r=zI({width:e.width,height:e.height,aspect:e.aspect}),l=r.width,s=r.height,d=WO(void 0,void 0,{width:l,height:s,aspect:e.aspect,maxHeight:e.maxHeight}),f=d.calculatedWidth,m=d.calculatedHeight;return je(f)&&je(m)?x.createElement(QO,{width:f,height:m},e.children):x.createElement(FI,nf({},e,{width:l,height:s,ref:t}))});function m0(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var rm=()=>{var e,t=wn(),n=Ne(SI),r=Ne(nm),l=(e=Ne(tm))===null||e===void 0?void 0:e.padding;return!t||!r||!l?n:{width:r.width-l.left-l.right,height:r.height-l.top-l.bottom,x:l.left,y:l.top}},XI={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},JO=()=>{var e;return(e=Ne(Wt))!==null&&e!==void 0?e:XI},h0=()=>Ne(Ca),p0=()=>Ne(Ta),WI=()=>Ne(e=>e.layout.margin),Ze=e=>e.layout.layoutType,pl=()=>Ne(Ze),v0=()=>{var e=pl();if(e==="horizontal"||e==="vertical")return e},y0=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},ZI=()=>Ne(y0),QI=()=>{var e=pl();return e!==void 0},Tc=e=>{var t=dt(),n=wn(),r=e.width,l=e.height,s=f0(),d=r,f=l;return s&&(d=s.width>0?s.width:r,f=s.height>0?s.height:l),x.useEffect(()=>{!n&&Kr(d)&&Kr(f)&&t(Q8({width:d,height:f}))},[t,n,d,f]),null},eE=Symbol.for("immer-nothing"),v_=Symbol.for("immer-draftable"),Zn=Symbol.for("immer-state");function Nr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pc=Object.getPrototypeOf;function Os(e){return!!e&&!!e[Zn]}function sl(e){var t;return e?tE(e)||Array.isArray(e)||!!e[v_]||!!((t=e.constructor)!=null&&t[v_])||Mc(e)||im(e):!1}var JI=Object.prototype.constructor.toString(),y_=new WeakMap;function tE(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=y_.get(n);return r===void 0&&(r=Function.toString.call(n),y_.set(n,r)),r===JI}function rf(e,t,n=!0){am(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(l=>{t(l,e[l],e)}):e.forEach((r,l)=>t(l,r,e))}function am(e){const t=e[Zn];return t?t.type_:Array.isArray(e)?1:Mc(e)?2:im(e)?3:0}function cy(e,t){return am(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function nE(e,t,n){const r=am(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function e$(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Mc(e){return e instanceof Map}function im(e){return e instanceof Set}function Yi(e){return e.copy_||e.base_}function uy(e,t){if(Mc(e))return new Map(e);if(im(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=tE(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Zn];let l=Reflect.ownKeys(r);for(let s=0;s<l.length;s++){const d=l[s],f=r[d];f.writable===!1&&(f.writable=!0,f.configurable=!0),(f.get||f.set)&&(r[d]={configurable:!0,writable:!0,enumerable:f.enumerable,value:e[d]})}return Object.create(pc(e),r)}else{const r=pc(e);if(r!==null&&n)return{...e};const l=Object.create(r);return Object.assign(l,e)}}function g0(e,t=!1){return lm(e)||Os(e)||!sl(e)||(am(e)>1&&Object.defineProperties(e,{set:gd,add:gd,clear:gd,delete:gd}),Object.freeze(e),t&&Object.values(e).forEach(n=>g0(n,!0))),e}function t$(){Nr(2)}var gd={value:t$};function lm(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var n$={};function ol(e){const t=n$[e];return t||Nr(0,e),t}var vc;function rE(){return vc}function r$(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function g_(e,t){t&&(ol("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function dy(e){fy(e),e.drafts_.forEach(a$),e.drafts_=null}function fy(e){e===vc&&(vc=e.parent_)}function x_(e){return vc=r$(vc,e)}function a$(e){const t=e[Zn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function b_(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Zn].modified_&&(dy(t),Nr(4)),sl(e)&&(e=af(t,e),t.parent_||lf(t,e)),t.patches_&&ol("Patches").generateReplacementPatches_(n[Zn].base_,e,t.patches_,t.inversePatches_)):e=af(t,n,[]),dy(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==eE?e:void 0}function af(e,t,n){if(lm(t))return t;const r=e.immer_.shouldUseStrictIteration(),l=t[Zn];if(!l)return rf(t,(s,d)=>w_(e,l,t,s,d,n),r),t;if(l.scope_!==e)return t;if(!l.modified_)return lf(e,l.base_,!0),l.base_;if(!l.finalized_){l.finalized_=!0,l.scope_.unfinalizedDraft Line truncated
* @license React
* use-sync-external-store-with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var __;function m$(){if(__)return fv;__=1;var e=zs();function t(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,l=e.useRef,s=e.useEffect,d=e.useMemo,f=e.useDebugValue;return fv.useSyncExternalStoreWithSelector=function(m,h,v,y,b){var w=l(null);if(w.current===null){var j={hasValue:!1,value:null};w.current=j}else j=w.current;w=d(function(){function S(D){if(!A){if(A=!0,C=D,D=y(D),b!==void 0&&j.hasValue){var E=j.value;if(b(E,D))return M=E}return M=D}if(E=M,n(C,D))return E;var $=y(D);return b!==void 0&&b(E,$)?(C=D,E):(C=D,M=$)}var A=!1,C,M,k=v===void 0?null:v;return[function(){return S(h())},k===null?void 0:function(){return S(k())}]},[h,v,y,b]);var _=r(m,w[0],w[1]);return s(function(){j.hasValue=!0,j.value=_},[_]),f(_),_},fv}var N_;function h$(){return N_||(N_=1,dv.exports=m$()),dv.exports}h$();function p$(e){e()}function v$(){let e=null,t=null;return{clear(){e=null,t=null},notify(){p$(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const l=t={callback:n,next:null,prev:t};return l.prev?l.prev.next=l:e=l,function(){!r||e===null||(r=!1,l.next?l.next.prev=l.prev:t=l.prev,l.prev?l.prev.next=l.next:e=l.next)}}}}var S_={notify(){},get:()=>[]};function y$(e,t){let n,r=S_,l=0,s=!1;function d(_){v();const S=r.subscribe(_);let A=!1;return()=>{A||(A=!0,S(),y())}}function f(){r.notify()}function m(){j.onStateChange&&j.onStateChange()}function h(){return s}function v(){l++,n||(n=e.subscribe(m),r=v$())}function y(){l--,n&&l===0&&(n(),n=void 0,r.clear(),r=S_)}function b(){s||(s=!0,v())}function w(){s&&(s=!1,y())}const j={addNestedSub:d,notifyNestedSubs:f,handleChangeWrapper:m,isSubscribed:h,trySubscribe:b,tryUnsubscribe:w,getListeners:()=>r};return j}var g$=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",x$=g$(),b$=()=>typeof navigator<"u"&&navigator.product==="ReactNative",w$=b$(),j$=()=>x$||w$?x.useLayoutEffect:x.useEffect,_$=j$();function A_(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function N$(e,t){if(A_(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let l=0;l<n.length;l++)if(!Object.prototype.hasOwnProperty.call(t,n[l])||!A_(e[n[l]],t[n[l]]))return!1;return!0}var mv=Symbol.for("react-redux-context"),hv=typeof globalThis<"u"?globalThis:{};function S$(){if(!x.createContext)return{};const e=hv[mv]??(hv[mv]=new Map);let t=e.get(x.createContext);return t||(t=x.createContext(null),e.set(x.createContext,t)),t}var A$=S$();function O$(e){const{children:t,context:n,serverState:r,store:l}=e,s=x.useMemo(()=>{const m=y$(l);return{store:l,subscription:m,getServerState:r?()=>r:void 0}},[l,r]),d=x.useMemo(()=>l.getState(),[l]);_$(()=>{const{subscription:m}=s;return m.onStateChange=m.notifyNestedSubs,m.trySubscribe(),d!==l.getState()&&m.notifyNestedSubs(),()=>{m.tryUnsubscribe(),m.onStateChange=void 0}},[s,d]);const f=n||A$;return x.createElement(f.Provider,{value:s},t)}var E$=O$,k$=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function C$(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function $s(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(k$.has(r)){if(e[r]==null&&t[r]==null)continue;if(!N$(e[r],t[r]))return!1}else if(!C$(e[r],t[r]))return!1;return!0}var T$=["contextPayload"];function py(){return py=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},py.apply(null,arguments)}function M$(e,t){return I$(e)||z$(e,t)||P$(e,t)||D$()}function D$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P$(e,t){if(e){if(typeof e=="string")return O_(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O_(e,t):void 0}}function O_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function z$(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function I$(e){if(Array.isArray(e))return e}function E_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Es(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E_(Object(n),!0).forEach(function(r){$$(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $$(e,t,n){return(t=R$(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R$(e){var t=L$(e,"string");return typeof t=="symbol"?t:t+""}function L$(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function B$(e,t){if(e==null)return{};var n,r,l=U$(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}function U$(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function H$(e){return e.value}function q$(e){var t=e.contextPayload,n=B$(e,T$),r=oO(t,e.payloadUniqBy,H$),l=Es(Es({},n),{},{payload:r});return x.isValidElement(e.content)?x.cloneElement(e.content,l):typeof e.content=="function"?x.createElement(e.content,l):x.createElement(P6,l)}function K$(e,t,n,r,l,s){var d=t.layout,f=t.align,m=t.verticalAlign,h,v;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(f==="center"&&d==="vertical"?h={left:((r||0)-s.width)/2}:h=f==="right"?{right:n&&n.right||0}:{left:n&&n.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(m==="middle"?v={top:((l||0)-s.height)/2}:v=m==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),Es(Es({},h),v)}function Y$(e){var t=e.align,n=e.layout,r=e.verticalAlign,l=e.itemSorter,s=dt();return x.useLayoutEffect(()=>{s(d$({align:t,layout:n,verticalAlign:r,itemSorter:l}))},[s,t,n,r,l]),null}function G$(e){var t=e.width,n=e.height,r=dt();return x.useLayoutEffect(()=>{r(j_({width:t,height:n}))},[r,t,n]),x.useLayoutEffect(()=>()=>{r(j_({width:0,height:0}))},[r]),null}function V$(e,t,n,r){return e==="vertical"&&t!=null?{height:t}:e==="horizontal"?{width:n||r}:null}var F$={align:"center",iconSize:14,inactiveColor:"#ccc",itemSorter:"value",labelStyle:{},layout:"horizontal",verticalAlign:"bottom"};function X$(e){var t=an(e,F$),n=Fz(),r=kP(),l=WI(),s=t.width,d=t.height,f=t.wrapperStyle,m=t.portal,h=mO([n]),v=M$(h,2),y=v[0],b=v[1],w=h0(),j=p0();if(w==null||j==null)return null;var _=w-((l==null?void 0:l.left)||0)-((l==null?void 0:l.right)||0),S=V$(t.layout,d,s,_),A=m?f:Es(Es({position:"absolute",width:(S==null?void 0:S.width)||s||"auto",height:(S==null?void 0:S.height)||d||"auto"},K$(f,t,l,w,j,y)),f),C=m??r;if(C==null||n==null)return null;var M=x.createElement("div",{className:"recharts-legend-wrapper",style:A,ref:b},x.createElement(Y$,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!m&&x.createElement(G$,{width:y.width,height:y.height}),x.createElement(q$,py({},t,S,{margin:l,chartWidth:w,chartHeight:j,contextPayload:n})));return It.createPortal(M,C)}var uE=x.memo(X$,$s);uE.displayName="Legend";function vy(){return vy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vy.apply(null,arguments)}function k_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Ho(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?k_(Object(n),!0).forEach(func Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tR(e,t){if(e){if(typeof e=="string")return C_(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C_(e,t):void 0}}function C_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nR(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function rR(e){if(Array.isArray(e))return e}function aR(e){return Array.isArray(e)&&qr(e[0])&&qr(e[1])?e.join(" ~ "):e}var is={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1};function iR(e,t){return t==null?e:Hf(e,t)}var lR=e=>{var t=e.separator,n=t===void 0?is.separator:t,r=e.contentStyle,l=e.itemStyle,s=e.labelStyle,d=s===void 0?is.labelStyle:s,f=e.payload,m=e.formatter,h=e.itemSorter,v=e.wrapperClassName,y=e.labelClassName,b=e.label,w=e.labelFormatter,j=e.accessibilityLayer,_=j===void 0?is.accessibilityLayer:j,S=()=>{if(f&&f.length){var U={padding:0,margin:0},K=iR(f,h),T=K.map((re,Z)=>{if(!re||re.type==="none")return null;var pe=re.formatter||m||aR,fe=re.value,ce=re.name,R=fe,z=ce;if(pe){var G=pe(fe,ce,re,Z,f);if(Array.isArray(G)){var se=J$(G,2);R=se[0],z=se[1]}else if(G!=null)R=G;else return null}var ue=Ho(Ho({},is.itemStyle),{},{color:re.color||is.itemStyle.color},l);return x.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(Z),style:ue},qr(z)?x.createElement("span",{className:"recharts-tooltip-item-name"},z):null,qr(z)?x.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,x.createElement("span",{className:"recharts-tooltip-item-value"},R),x.createElement("span",{className:"recharts-tooltip-item-unit"},re.unit||""))});return x.createElement("ul",{className:"recharts-tooltip-item-list",style:U},T)}return null},A=Ho(Ho({},is.contentStyle),r),C=Ho({margin:0},d),M=!Nt(b),k=M?b:"",D=nt("recharts-default-tooltip",v),E=nt("recharts-tooltip-label",y);M&&w&&f!==void 0&&f!==null&&(k=w(b,f));var $=_?{role:"status","aria-live":"assertive"}:{};return x.createElement("div",vy({className:D,style:A},$),x.createElement("p",{className:E,style:C},x.isValidElement(k)?k:"".concat(k)),S())},qo="recharts-tooltip-wrapper",sR={visibility:"hidden"};function oR(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return nt(qo,{["".concat(qo,"-right")]:je(n)&&t&&je(t.x)&&n>=t.x,["".concat(qo,"-left")]:je(n)&&t&&je(t.x)&&n<t.x,["".concat(qo,"-bottom")]:je(r)&&t&&je(t.y)&&r>=t.y,["".concat(qo,"-top")]:je(r)&&t&&je(t.y)&&r<t.y})}function T_(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.key,l=e.offset,s=e.position,d=e.reverseDirection,f=e.tooltipDimension,m=e.viewBox,h=e.viewBoxDimension;if(s&&je(s[r]))return s[r];var v=n[r]-f-(l>0?l:0),y=n[r]+l;if(t[r])return d[r]?v:y;var b=m[r];if(b==null)return 0;if(d[r]){var w=v,j=b;return w<j?Math.max(y,b):Math.max(v,b)}if(h==null)return 0;var _=y+f,S=b+h;return _>S?Math.max(v,b):Math.max(y,b)}function cR(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function uR(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,l=e.offsetLeft,s=e.position,d=e.reverseDirection,f=e.tooltipBox,m=e.useTranslate3d,h=e.viewBox,v,y,b;return f.height>0&&f.width>0&&n?(y=T_({allowEscapeViewBox:t,coordinate:n,key:"x",offset:l,position:s,reverseDirection:d,tooltipDimension:f.width,viewBox:h,viewBoxDimension:h.width}),b=T_({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:s,reverseDirection:d,tooltipDimension:f.height,viewBox:h,viewBoxDimension:h.height}),v=cR({translateX:y,translateY:b,useTranslate3d:m})):v=sR,{cssProperties:v,cssClasses:oR({translateX:y,translateY:b,coordinate:n})}}var dR=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Pc={isSsr:dR()};function fR(e,t){return vR(e)||pR(e,t)||hR(e,t)||mR()}function mR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hR(e,t){if(e){if(typeof e=="string")return M_(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M_(e,t):void 0}}function M_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pR(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function vR(e){if(Array.isArray(e))return e}function dE(){var e=x.useState(()=>Pc.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),t=fR(e,2),n=t[0],r=t[1];return x.useEffect(()=>{if(window.matchMedia){var l=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(l.matches)};return l.addEventListener("change",s),()=>{l.removeEventListener("change",s)}}},[]),n}function D_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function ls(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?D_(Object(n),!0).forEach(function(r){yR(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yR(e,t,n){return(t=gR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gR(e){var t=xR(e,"string");return typeof t=="symbol"?t:t+""}function xR(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bR(e,t){return NR(e)||_R(e,t)||jR(e,t)||wR()}function wR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jR(e,t){if(e){if(typeof e=="string")return P_(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P_(e,t):void 0}}function P_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _R(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function NR(e){if(Array.isArray(e))return e}function SR(e){if(!(e.prefersReducedMotion&&e.isAnimationActive==="auto")&&e.isAnimationActive&&e.active){var t=typeof e.animationEasing=="string"?e.animationEasing:"ease";return"transform ".concat(e.animationDuration,"ms ").concat(t)}}function AR(e){var t,n,r,l,s,d,f=dE(),m=x.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),h=bR(m,2),v=h[0],y=h[1];x.useEffect(()=>{var A=C=>{if(C.key==="Escape"){var M,k,D,E;y({dismissed:!0,dismissedAtCoordinate:{x:(M=(k=e.coordinate)===null||k===void 0?void 0:k.x)!==null&&M!==void 0?M:0,y:(D=(E=e.coordinate)===null||E===void 0?void 0:E.y)!==null&&D!==void 0?D:0}})}};return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(n=e.coordinate)===null||n===void 0?void 0:n.y]),v.dismissed&&(((r=(l=e.coordinate)===null||l===void 0?void 0:l.x)!==null&&r!==void 0?r:0)!==v.dismissedAtCoordinate.x||((s=(d=e.coordinate)===null||d===void 0?void 0:d.y)!==null&&s!==void 0?s:0)!==v.dismissedAtCoordinate.y)&&y(ls(ls({},v),{},{dismissed:!1}));var b=uR({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),w=b.cssClasses,j=b.cssProperties,_=e.hasPortalFromProps?{}:ls(ls({transition:SR({prefersReducedMotion:f,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},j),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),S=ls(ls({},_),{},{visibility:!v.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return x.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:w,style:S,ref:e.innerRef},e.children)}var OR=x.memo(AR),fE=()=>{var e;return(e=Ne(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function yy(){return yy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yy.apply(null,arguments)}function z_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function I_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?z_(Object(n),!0).forEach(function(r){ER(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ER(e,t,n){return(t=kR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kR(e){var t=CR(e,"string");return typeof t=="symbol"?t:t+""}function CR(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $_={curveBasisClosed:FP,curveBasisOpen:XP,curveBasis:VP,curveBumpX:DP,curveBumpY:PP,curveLinearClosed:WP,curveLinear:Bf,curveMonotoneX:ZP,curveMonotoneY:QP,curveNatural:JP,curveStep:e6,curveStepAfter:n6,curveStepBefore:t6},sf=e=>He(e.x)&&He(e.y),R_=e=>e.base!=null&&sf(e.base)&&sf(e),Ko=e=>e.x,Yo=e=>e.y,TR=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Ac(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=$_["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return $_[n]||Bf},L_={connectNulls:!1,type:"linear"},MR=e=>{var t=e.type,n=t===void 0?L_.type:t,r=e.points,l=r===void 0?[]:r,s=e.baseLine,d=e.layout,f=e.connectNulls,m=f===void 0?L_.connectNulls:f,h=TR(n,d),v=m?l.filter(sf):l;if(Array.isArray(s)){var y,b=l.map((A,C)=>I_(I_({},A),{},{base:s[C]}));d==="vertical"?y=ud().y(Yo).x1(Ko).x Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l7(e,t){if(e){if(typeof e=="string")return G_(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?G_(e,t):void 0}}function G_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s7(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function o7(e){if(Array.isArray(e))return e}var c7={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},V_=0,vv=1;function vE(e){var t=an(e,c7),n=t.animationId,r=t.isActive,l=t.canBegin,s=t.duration,d=t.easing,f=t.begin,m=t.onAnimationEnd,h=t.onAnimationStart,v=t.children,y=dE(),b=r==="auto"?!Pc.isSsr&&!y:r,w=WR(t.animationController),j=x.useState(b?V_:vv),_=a7(j,2),S=_[0],A=_[1];return x.useEffect(()=>{b||A(vv)},[b]),x.useEffect(()=>{var C=FR(d);if(!b||!l||C==null)return hl;var M=new r7,k=new n7({animationId:n,easing:C,animationDuration:s,animationBegin:f,onAnimationStart:h,onAnimationEnd:m,from:V_,to:vv});return w(M,k,A)},[w,n,b,l,s,d,f,h,m]),v(Number(S))}function yE(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=x.useRef(dc(t)),r=x.useRef(e);return r.current!==e&&(n.current=dc(t),r.current=e),n.current}var u7=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),d7=(e,t,n)=>e.map(r=>"".concat(u7(r)," ").concat(t,"ms ").concat(n)).join(","),f7=["radius"],m7=["radius"],F_,X_,W_,Z_,Q_,J_,e2,t2,n2,r2;function a2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function i2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?a2(Object(n),!0).forEach(function(r){h7(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function h7(e,t,n){return(t=p7(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p7(e){var t=v7(e,"string");return typeof t=="symbol"?t:t+""}function v7(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cf(){return cf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cf.apply(null,arguments)}function l2(e,t){if(e==null)return{};var n,r,l=y7(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}function y7(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function g7(e,t){return j7(e)||w7(e,t)||b7(e,t)||x7()}function x7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b7(e,t){if(e){if(typeof e=="string")return s2(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s2(e,t):void 0}}function s2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w7(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function j7(e){if(Array.isArray(e))return e}function zr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var o2=(e,t,n,r,l)=>{var s=di(n),d=di(r),f=Math.min(Math.abs(s)/2,Math.abs(d)/2),m=d>=0?1:-1,h=s>=0?1:-1,v=d>=0&&s>=0||d<0&&s<0?1:0,y;if(f>0&&Array.isArray(l)){for(var b=[0,0,0,0],w=0,j=4;w<j;w++){var _,S=(_=l[w])!==null&&_!==void 0?_:0;b[w]=S>f?f:S}y=hn(F_||(F_=zr(["M",",",""])),e,t+m*b[0]),b[0]>0&&(y+=hn(X_||(X_=zr(["A ",",",",0,0,",",",",",""])),b[0],b[0],v,e+h*b[0],t)),y+=hn(W_||(W_=zr(["L ",",",""])),e+n-h*b[1],t),b[1]>0&&(y+=hn(Z_||(Z_=zr(["A ",",",",0,0,",`,
`,",",""])),b[1],b[1],v,e+n,t+m*b[1])),y+=hn(Q_||(Q_=zr(["L ",",",""])),e+n,t+r-m*b[2]),b[2]>0&&(y+=hn(J_||(J_=zr(["A ",",",",0,0,",`,
`,",",""])),b[2],b[2],v,e+n-h*b[2],t+r)),y+=hn(e2||(e2=zr(["L ",",",""])),e+h*b[3],t+r),b[3]>0&&(y+=hn(t2||(t2=zr(["A ",",",",0,0,",`,
`,",",""])),b[3],b[3],v,e,t+r-m*b[3])),y+="Z"}else if(f>0&&l===+l&&l>0){var A=Math.min(f,l);y=hn(n2||(n2=zr(["M ",",",`
A `,",",",0,0,",",",",",`
L `,",",`
A `,",",",0,0,",",",",",`
L `,",",`
A `,",",",0,0,",",",",",`
L `,",",`
A `,",",",0,0,",",",","," Z"])),e,t+m*A,A,A,v,e+h*A,t,e+n-h*A,t,A,A,v,e+n,t+m*A,e+n,t+r-m*A,A,A,v,e+n-h*A,t+r,e+h*A,t+r,A,A,v,e,t+r-m*A)}else y=hn(r2||(r2=zr(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return y},c2={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},gE=e=>{var t=an(e,c2),n=x.useRef(null),r=x.useState(-1),l=g7(r,2),s=l[0],d=l[1];x.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var G=n.current.getTotalLength();G&&d(G)}catch{}},[]);var f=t.x,m=t.y,h=t.width,v=t.height,y=t.radius,b=t.className,w=t.animationEasing,j=t.animationDuration,_=t.animationBegin,S=t.isAnimationActive,A=t.isUpdateAnimationActive,C=x.useRef(h),M=x.useRef(v),k=x.useRef(f),D=x.useRef(m),E=x.useMemo(()=>({x:f,y:m,width:h,height:v,radius:y}),[f,m,h,v,y]),$=yE(E,"rectangle-");if(f!==+f||m!==+m||h!==+h||v!==+v||h===0||v===0)return null;var U=nt("recharts-rectangle",b);if(!A){var K=Xn(t);K.radius;var T=l2(K,f7);return x.createElement("path",cf({},T,{x:di(f),y:di(m),width:di(h),height:di(v),radius:typeof y=="number"?y:void 0,className:U,d:o2(f,m,h,v,y)}))}var re=C.current,Z=M.current,pe=k.current,fe=D.current,ce="0px ".concat(s===-1?1:s,"px"),R="".concat(s,"px ").concat(s,"px"),z=d7(["strokeDasharray"],j,typeof w=="string"?w:c2.animationEasing);return x.createElement(vE,{animationId:$,key:$,canBegin:s>0,duration:j,easing:w,isActive:A,begin:_},G=>{var se=Et(re,h,G),ue=Et(Z,v,G),P=Et(pe,f,G),Q=Et(fe,m,G);n.current&&(C.current=se,M.current=ue,k.current=P,D.current=Q);var ne;S?G>0?ne={transition:z,strokeDasharray:R}:ne={strokeDasharray:ce}:ne={strokeDasharray:R};var I=Xn(t);I.radius;var he=l2(I,m7);return x.createElement("path",cf({},he,{radius:typeof y=="number"?y:void 0,className:U,d:o2(P,Q,se,ue,y),ref:n,style:i2(i2({},ne),t.style)}))})};function u2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function d2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?u2(Object(n),!0).forEach(function(r){_7(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _7(e,t,n){return(t=N7(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N7(e){var t=S7(e,"string");return typeof t=="symbol"?t:t+""}function S7(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uf=Math.PI/180,A7=e=>e*180/Math.PI,Ht=(e,t,n,r)=>({x:e+Math.cos(-uf*r)*n,y:t+Math.sin(-uf*r)*n}),xE=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},O7=(e,t)=>{var n=e.x,r=e.y,l=t.x,s=t.y;return Math.sqrt((n-l)**2+(r-s)**2)},E7=(e,t)=>{var n=e.x,r=e.y,l=t.cx,s=t.cy,d=O7({x:n,y:r},{x:l,y:s});if(d<=0)return{radius:d,angle:0};var f=(n-l)/d,m=Math.acos(f);return r>s&&(m=2*Math.PI-m),{radius:d,angle:A7(m),angleInRadian:m}},k7=e=>{var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),l=Math.floor(n/360),s=Math.min(r,l);return{startAngle:t-s*360,endAngle:n-s*360}},C7=(e,t)=>{var n=t.startAngle,r=t.endAngle,l=Math.floor(n/360),s=Math.floor(r/360),d=Math.min(l,s);return e+d*360},T7=(e,t)=>{var n=e.relativeX,r=e.relativeY,l=E7({x:n,y:r},t),s=l.radius,d=l.angle,f=t.innerRadius,m=t.outerRadius;if(s<f||s>m||s===0)return null;var h=k7(t),v=h.startAngle,y=h.endAngle,b=d,w;if(v<=y){for(;b>y;)b-=360;for(;b<v;)b+=360;w=b>=v&&b<=y}else{for(;b>v;)b-=360;for(;b<y;)b+=360;w=b>=y&&b<=v}return w?d2(d2({},t),{},{radius:s,angle:C7(b,t)}):null};function bE(e){var t=e.cx,n=e.cy,r=e.radius,l=e.startAngle,s=e.endAngle,d=Ht(t,n,r,l),f=Ht(t,n,r,s);return{points:[d,f],cx:t,cy:n,radius:r,startAngle:l,endAngle:s}}var f2,m2,h2,p2,v2,y2,g2;function xy(){return xy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xy.apply(null,arguments)}function Xi(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var M7=(e,t)=>{var n=rn(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},xd=e=>{var t=e.cx,n=e.cy,r=e.radius,l=e.angle,s=e.sign,d=e.isExternal,f=e.cornerRadius,m=e.cornerIsExternal,h=f*(d?1:-1)+r,v=Math.asin(f/h)/uf,y=m?l:l+s*v,b=Ht(t,n,h,y),w=Ht(t,n,r,y),j=m?l-s*v:l,_=Ht(t,n,h*Math.cos(v*uf),j);return{center:b,circleTangency:w,lineTangency:_,theta:v}},wE=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,l=e. Line truncated
A `,",",`,0,
`,",",`,
`,",",`
`])),h.x,h.y,l,l,+(Math.abs(f)>180),+(s>m),v.x,v.y);if(r>0){var b=Ht(t,n,r,s),w=Ht(t,n,r,m);y+=hn(m2||(m2=Xi(["L ",",",`
A `,",",`,0,
`,",",`,
`,","," Z"])),w.x,w.y,r,r,+(Math.abs(f)>180),+(s<=m),b.x,b.y)}else y+=hn(h2||(h2=Xi(["L ",","," Z"])),t,n);return y},D7=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,l=e.outerRadius,s=e.cornerRadius,d=e.forceCornerRadius,f=e.cornerIsExternal,m=e.startAngle,h=e.endAngle,v=rn(h-m),y=xd({cx:t,cy:n,radius:l,angle:m,sign:v,cornerRadius:s,cornerIsExternal:f}),b=y.circleTangency,w=y.lineTangency,j=y.theta,_=xd({cx:t,cy:n,radius:l,angle:h,sign:-v,cornerRadius:s,cornerIsExternal:f}),S=_.circleTangency,A=_.lineTangency,C=_.theta,M=f?Math.abs(m-h):Math.abs(m-h)-j-C;if(M<0)return d?hn(p2||(p2=Xi(["M ",",",`
a`,",",",0,0,1,",`,0
a`,",",",0,0,1,",`,0
`])),w.x,w.y,s,s,s*2,s,s,-s*2):wE({cx:t,cy:n,innerRadius:r,outerRadius:l,startAngle:m,endAngle:h});var k=hn(v2||(v2=Xi(["M ",",",`
A`,",",",0,0,",",",",",`
A`,",",",0,",",",",",",",`
A`,",",",0,0,",",",",",`
`])),w.x,w.y,s,s,+(v<0),b.x,b.y,l,l,+(M>180),+(v<0),S.x,S.y,s,s,+(v<0),A.x,A.y);if(r>0){var D=xd({cx:t,cy:n,radius:r,angle:m,sign:v,isExternal:!0,cornerRadius:s,cornerIsExternal:f}),E=D.circleTangency,$=D.lineTangency,U=D.theta,K=xd({cx:t,cy:n,radius:r,angle:h,sign:-v,isExternal:!0,cornerRadius:s,cornerIsExternal:f}),T=K.circleTangency,re=K.lineTangency,Z=K.theta,pe=f?Math.abs(m-h):Math.abs(m-h)-U-Z;if(pe<0&&s===0)return"".concat(k,"L").concat(t,",").concat(n,"Z");k+=hn(y2||(y2=Xi(["L",",",`
A`,",",",0,0,",",",",",`
A`,",",",0,",",",",",",",`
A`,",",",0,0,",",",",","Z"])),re.x,re.y,s,s,+(v<0),T.x,T.y,r,r,+(pe>180),+(v>0),E.x,E.y,s,s,+(v<0),$.x,$.y)}else k+=hn(g2||(g2=Xi(["L",",","Z"])),t,n);return k},P7={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},jE=e=>{var t=an(e,P7),n=t.cx,r=t.cy,l=t.innerRadius,s=t.outerRadius,d=t.cornerRadius,f=t.forceCornerRadius,m=t.cornerIsExternal,h=t.startAngle,v=t.endAngle,y=t.className;if(s<l||h===v)return null;var b=nt("recharts-sector",y),w=s-l,j=xn(d,w,0,!0),_;return j>0&&Math.abs(h-v)<360?_=D7({cx:n,cy:r,innerRadius:l,outerRadius:s,cornerRadius:Math.min(j,w/2),forceCornerRadius:f,cornerIsExternal:m,startAngle:h,endAngle:v}):_=wE({cx:n,cy:r,innerRadius:l,outerRadius:s,startAngle:h,endAngle:v}),x.createElement("path",xy({},Xn(t),{className:b,d:_}))};function z7(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(XA(t)){if(e==="centric"){var r=t.cx,l=t.cy,s=t.innerRadius,d=t.outerRadius,f=t.angle,m=Ht(r,l,s,f),h=Ht(r,l,d,f);return[{x:m.x,y:m.y},{x:h.x,y:h.y}]}return bE(t)}}function I7(e){return dO(e)?NaN:Number(e)}function yv(e){return e?(e=I7(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function _E(e,t,n){n&&typeof n!="number"&&Qv(e,t,n)&&(t=n=void 0),e=yv(e),t===void 0?(t=e,e=0):t=yv(t),n=n===void 0?e<t?1:-1:yv(n);const r=Math.max(Math.ceil((t-e)/(n||1)),0),l=new Array(r);for(let s=0;s<r;s++)l[s]=e,e+=n;return l}var kr=e=>e.chartData,zc=X([kr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),sm=(e,t,n,r)=>r?zc(e):kr(e),NE=(e,t,n)=>n?zc(e):kr(e),$7=X([sm],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t!=null?t.slice(n,r+1):[]}),R7=X([zc],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t!=null?t.slice(n,r+1):[]}),L7=X([kr],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t!=null?t.slice(n,r+1):[]});function b0(e,t){return q7(e)||H7(e,t)||U7(e,t)||B7()}function B7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U7(e,t){if(e){if(typeof e=="string")return x2(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x2(e,t):void 0}}function x2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function H7(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function q7(e){if(Array.isArray(e))return e}function Br(e){if(Array.isArray(e)&&e.length===2){var t=b0(e,2),n=t[0],r=t[1];if(He(n)&&He(r))return!0}return!1}function b2(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function SE(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var n=b0(e,2),r=n[0],l=n[1],s,d;if(He(r))s=r;else if(typeof r=="function")return;if(He(l))d=l;else if(typeof l=="function")return;var f=[s,d];if(Br(f))return f}}function K7(e,t,n){if(!(!n&&t==null)){if(typeof e=="function"&&t!=null)try{var r=e(t,n);if(Br(r))return b2(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var l=b0(e,2),s=l[0],d=l[1],f,m;if(s==="auto")t!=null&&(f=Math.min(...t));else if(je(s))f=s;else if(typeof s=="function")try{t!=null&&(f=s(t==null?void 0:t[0]))}catch{}else if(typeof s=="string"&&c_.test(s)){var h=c_.exec(s);if(h==null||h[1]==null||t==null)f=void 0;else{var v=+h[1];f=t[0]-v}}else f=t==null?void 0:t[0];if(d==="auto")t!=null&&(m=Math.max(...t));else if(je(d))m=d;else if(typeof d=="function")try{t!=null&&(m=d(t==null?void 0:t[1]))}catch{}else if(typeof d=="string"&&u_.test(d)){var y=u_.exec(d);if(y==null||y[1]==null||t==null)m=void 0;else{var b=+y[1];m=t[1]+b}}else m=t==null?void 0:t[1];var w=[f,m];if(Br(w))return t==null?w:b2(w,t,n)}}}var Rs=1e9,Y7={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},j0,wt=!0,vr="[DecimalError] ",el=vr+"Invalid argument: ",w0=vr+"Exponent out of range: ",Ls=Math.floor,Gi=Math.pow,G7=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Gn,nn=1e7,gt=7,AE=9007199254740991,df=Ls(AE/gt),Se={};Se.absoluteValue=Se.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Se.comparedTo=Se.cmp=function(e){var t,n,r,l,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(r=s.d.length,l=e.d.length,t=0,n=r<l?r:l;t<n;++t)if(s.d[t]!==e.d[t])return s.d[t]>e.d[t]^s.s<0?1:-1;return r===l?0:r>l^s.s<0?1:-1};Se.decimalPlaces=Se.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*gt;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Se.dividedBy=Se.div=function(e){return _a(this,new this.constructor(e))};Se.dividedToIntegerBy=Se.idiv=function(e){var t=this,n=t.constructor;return mt(_a(t,new n(e),0,1),n.precision)};Se.equals=Se.eq=function(e){return!this.cmp(e)};Se.exponent=function(){return Kt(this)};Se.greaterThan=Se.gt=function(e){return this.cmp(e)>0};Se.greaterThanOrEqualTo=Se.gte=function(e){return this.cmp(e)>=0};Se.isInteger=Se.isint=function(){return this.e>this.d.length-2};Se.isNegative=Se.isneg=function(){return this.s<0};Se.isPositive=Se.ispos=function(){return this.s>0};Se.isZero=function(){return this.s===0};Se.lessThan=Se.lt=function(e){return this.cmp(e)<0};Se.lessThanOrEqualTo=Se.lte=function(e){return this.cmp(e)<1};Se.logarithm=Se.log=function(e){var t,n=this,r=n.constructor,l=r.precision,s=l+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Gn))throw Error(vr+"NaN");if(n.s<1)throw Error(vr+(n.s?"NaN":"-Infinity"));return n.eq(Gn)?new r(0):(wt=!1,t=_a(gc(n,s),gc(e,s),s),wt=!0,mt(t,l))};Se.minus=Se.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?kE(t,e):OE(t,(e.s=-e.s,e))};Se.modulo=Se.mod=function(e){var t,n=this,r=n.constructor,l=r.precision;if(e=new r(e),!e.s)throw Error(vr+"NaN");return n.s?(wt=!1,t=_a(n,e,0,1).times(e),wt=!0,n.minus(t)):mt(new r(n),l)};Se.naturalExponential=Se.exp=function(){return EE(this)};Se.naturalLogarithm=Se.ln=function(){return gc(this)};Se.negated=Se.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Se.plus=Se.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?OE(t,e):kE(t,(e.s=-e.s,e))};Se.precision=Se.sd=function(e){var t,n,r,l=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(el+e);if(t=Kt(l)+1,r=l.d.length-1,n=r*gt+1,r=l.d[r],r){for(;r%10==0;r/=10)n--;for(r=l.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Se.squareRoot=Se.sqrt=function(){var e,t,n,r,l,s,d,f=this,m=f.constructor;if(f.s<1){if(!f.s)return new m(0);throw Error(vr+"NaN")}for(e=Kt(f),wt=!1,l=Math.sqrt(+f),l==0||l==1/0?(t=Lr(f.d),(t.len Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X7(e,t){if(e){if(typeof e=="string")return _2(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_2(e,t):void 0}}function _2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function W7(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function Z7(e){if(Array.isArray(e))return e}var DE=e=>{var t=xc(e,2),n=t[0],r=t[1],l=n,s=r;return n>r&&(l=r,s=n),[l,s]},_0=(e,t,n)=>{if(e.lte(0))return new Xe(0);var r=TE(e.toNumber()),l=new Xe(10).pow(r),s=e.div(l),d=r!==1?.05:.1,f=new Xe(Math.ceil(s.div(d).toNumber())).add(n).mul(d),m=f.mul(l);return t?new Xe(m.toNumber()):new Xe(Math.ceil(m.toNumber()))},PE=(e,t,n)=>{var r;if(e.lte(0))return new Xe(0);var l=[1,2,2.5,5],s=e.toNumber(),d=Math.floor(new Xe(s).abs().log(10).toNumber()),f=new Xe(10).pow(d),m=e.div(f).toNumber(),h=l.findIndex(w=>w>=m-1e-10);if(h===-1&&(f=f.mul(10),h=0),h+=n,h>=l.length){var v=Math.floor(h/l.length);h%=l.length,f=f.mul(new Xe(10).pow(v))}var y=(r=l[h])!==null&&r!==void 0?r:1,b=new Xe(y).mul(f);return t?b:new Xe(Math.ceil(b.toNumber()))},Q7=(e,t,n)=>{var r=new Xe(1),l=new Xe(e);if(!l.isint()&&n){var s=Math.abs(e);s<1?(r=new Xe(10).pow(TE(e)-1),l=new Xe(Math.floor(l.div(r).toNumber())).mul(r)):s>1&&(l=new Xe(Math.floor(e)))}else e===0?l=new Xe(Math.floor((t-1)/2)):n||(l=new Xe(Math.floor(e)));for(var d=Math.floor((t-1)/2),f=[],m=0;m<t;m++)f.push(l.add(new Xe(m-d).mul(r)).toNumber());return f},zE=function(t,n,r,l){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,d=arguments.length>5&&arguments[5]!==void 0?arguments[5]:_0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Xe(0),tickMin:new Xe(0),tickMax:new Xe(0)};var f=d(new Xe(n).sub(t).div(r-1),l,s),m;t<=0&&n>=0?m=new Xe(0):(m=new Xe(t).add(n).div(2),m=m.sub(new Xe(m).mod(f)));var h=Math.ceil(m.sub(t).div(f).toNumber()),v=Math.ceil(new Xe(n).sub(m).div(f).toNumber()),y=h+v+1;return y>r?zE(t,n,r,l,s+1,d):(y<r&&(v=n>0?v+(r-y):v,h=n>0?h:h+(r-y)),{step:f,tickMin:m.sub(new Xe(h).mul(f)),tickMax:m.add(new Xe(v).mul(f))})},N2=function(t){var n=xc(t,2),r=n[0],l=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",m=Math.max(s,2),h=DE([r,l]),v=xc(h,2),y=v[0],b=v[1];if(y===-1/0||b===1/0){var w=b===1/0?[y,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),b];return r>l?w.reverse():w}if(y===b)return Q7(y,s,d);var j=f==="snap125"?PE:_0,_=zE(y,b,m,d,0,j),S=_.step,A=_.tickMin,C=_.tickMax,M=ME(A,C.add(new Xe(.1).mul(S)),S);return r>l?M.reverse():M},S2=function(t,n){var r=xc(t,2),l=r[0],s=r[1],d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",m=DE([l,s]),h=xc(m,2),v=h[0],y=h[1];if(v===-1/0||y===1/0)return[l,s];if(v===y)return[v];var b=f==="snap125"?PE:_0,w=Math.max(n,2),j=b(new Xe(y).sub(v).div(w-1),d,0),_=[...ME(new Xe(v),new Xe(y),j),y];return d===!1&&(_=_.map(S=>Math.round(S))),l>s?_.reverse():_},IE=e=>e.rootProps.maxBarSize,J7=e=>e.rootProps.barGap,$E=e=>e.rootProps.barCategoryGap,e9=e=>e.rootProps.barSize,Ic=e=>e.rootProps.stackOffset,RE=e=>e.rootProps.reverseStackOrder,N0=e=>e.options.chartName,S0=e=>e.rootProps.syncId,LE=e=>e.rootProps.syncMethod,A0=e=>e.options.eventEmitter,t9=e=>e.rootProps.baseValue,qt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Bi={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Ir={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},om=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function cm(e,t,n){if(n!=="auto")return n;if(e!=null)return Vr(e,t)?"category":"number"}function A2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function ff(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?A2(Object(n),!0).forEach(function(r){n9(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}retu Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GB(e,t){if(e){if(typeof e=="string")return hN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hN(e,t):void 0}}function hN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function VB(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function FB(e){if(Array.isArray(e))return e}var Oy=[0,"auto"],Gt={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},Ck=(e,t)=>e.cartesianAxis.xAxis[t],Da=(e,t)=>{var n=Ck(e,t);return n??Gt},Vt={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Oy,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:Cc},Tk=(e,t)=>e.cartesianAxis.yAxis[t],Pa=(e,t)=>{var n=Tk(e,t);return n??Vt},XB={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},tg=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??XB},Mt=(e,t,n)=>{switch(t){case"xAxis":return Da(e,n);case"yAxis":return Pa(e,n);case"zAxis":return tg(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return E0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},WB=(e,t,n)=>{switch(t){case"xAxis":return Da(e,n);case"yAxis":return Pa(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Hs=(e,t,n)=>{switch(t){case"xAxis":return Da(e,n);case"yAxis":return Pa(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return E0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Mk=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function ng(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var wm=e=>e.graphicalItems.cartesianItems,ZB=X([St,$c],ng),rg=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),qs=X([wm,Mt,ZB],rg,{memoizeOptions:{resultEqualityCheck:hm}}),Dk=X([qs],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(fm)),Pk=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),QB=X([qs],Pk),ag=e=>e.map(t=>t.data).filter(Boolean).flat(1),JB=X([qs],e=>e.some(t=>!t.data)),zk=X([qs],ag,{memoizeOptions:{resultEqualityCheck:hm}}),ig=(e,t)=>{var n=t.chartData,r=n===void 0?[]:n,l=t.dataStartIndex,s=t.dataEndIndex;return e.length>0?e:r.slice(l,s+1)},lg=X([zk,sm],ig),Ik=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:rt(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(l=>({value:rt(l,r)}))):e.map(r=>({value:r})),$k=(e,t,n,r,l,s)=>{var d=r.chartData,f=d===void 0?[]:d,m=r.dataStartIndex,h=r.dataEndIndex,v=Ik(e,t,n);if(l&&(t==null?void 0:t.dataKey)!=null&&s.length>0){var y=f.slice(m,h+1),b=y.map(w=>({value:rt(w,t.dataKey)})).filter(w=>w.value!=null);return[...b,...v]}return v},Hc=X([lg,Mt,qs,sm,JB,zk],$k);function _s(e){if(qr(e)||e instanceof Date){var t=Number(e);if(He(t))return t}}function pN(e){if(Array.isArray(e)){var t=[_s(e[0]),_s(e[1])];return Br(t)?t:void 0}var n=_s(e);if(n!=null)return[n,n]}function Gr(e){return e.map(_s).filter(Dn)}function eU(e,t){var n=_s(e),r=_s(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var tU=X([Hc],e=>e==null?void 0:e.map(t=>t.value).sort(eU));function Rk(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function nU(e,t,n){if(!n)return[];if(!n.length)return[];var r;if(typeof t=="number"&&!Ar(t))r=t;else if(Array.isArray(t)){var l=Gr(t);l.length>0&&(r=Math.max(...l))}return r==null?[]:Gr(n.flatMap(s=>{var d=rt(e,s.dataKey),f,m;if(Array.isArray(d)){var h=kk(d,2);f=h[0],m=h[1]}else f=m=d;if(!(!He(f)||!He(m)))return[r-f,r+m]}))}var Qt=e=>{var t=ln(e),n=Bs(e);return Hs(e,t,n)},Ms=X([Qt],e=>e==nu Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aK(e,t){if(e){if(typeof e=="string")return PN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?PN(e,t):void 0}}function PN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iK(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function lK(e){if(Array.isArray(e))return e}function sK(e){return e.dataKey}function oK(e,t){return x.isValidElement(e)?x.cloneElement(e,t):typeof e=="function"?x.createElement(e,t):x.createElement(lR,t)}var zN=[],cK={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function Ev(e){var t,n,r=an(e,cK),l=r.active,s=r.allowEscapeViewBox,d=r.animationDuration,f=r.animationEasing,m=r.content,h=r.filterNull,v=r.isAnimationActive,y=r.offset,b=r.payloadUniqBy,w=r.position,j=r.reverseDirection,_=r.useTranslate3d,S=r.wrapperStyle,A=r.cursor,C=r.shared,M=r.trigger,k=r.defaultIndex,D=r.portal,E=r.axisId,$=dt(),U=typeof k=="number"?String(k):k;x.useEffect(()=>{$(ZU({shared:C,trigger:M,axisId:E,active:l,defaultIndex:U}))},[$,C,M,E,l,U]);var K=rm(),T=fE(),re=YU(C),Z=(t=Ne(xe=>cq(xe,re,M,U)))!==null&&t!==void 0?t:{},pe=Z.activeIndex,fe=Z.isActive,ce=Ne(xe=>oq(xe,re,M,U)),R=Ne(xe=>TC(xe,re,M,U)),z=Ne(xe=>sq(xe,re,M,U)),G=ce,se=Mq(),ue=(n=l??fe)!==null&&n!==void 0?n:!1,P=mO([G,ue]),Q=nK(P,2),ne=Q[0],I=Q[1],he=re==="axis"?R:void 0;Qq(re,M,z,he,pe,ue);var be=D??se;if(be==null||K==null||re==null)return null;var _e=G??zN;ue||(_e=zN),h&&_e.length&&(_e=oO(_e.filter(xe=>xe.value!=null&&(xe.hide!==!0||r.includeHidden)),b,sK));var W=_e.length>0,V=DN(DN({},r),{},{payload:_e,label:he,active:ue,activeIndex:pe,coordinate:z,accessibilityLayer:T}),ye=x.createElement(OR,{allowEscapeViewBox:s,animationDuration:d,animationEasing:f,isAnimationActive:v,active:ue,coordinate:z,hasPayload:W,offset:y,position:w,reverseDirection:j,useTranslate3d:_,viewBox:K,wrapperStyle:S,lastBoundingBox:ne,innerRef:I,hasPortalFromProps:!!D},oK(m,V));return x.createElement(x.Fragment,null,It.createPortal(ye,be),ue&&x.createElement(Tq,{cursor:A,tooltipEventType:re,coordinate:z,payload:_e,index:pe}))}var nl=e=>null;nl.displayName="Cell";function uK(e,t,n){return(t=dK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dK(e){var t=fK(e,"string");return typeof t=="symbol"?t:t+""}function fK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class mK{constructor(t){uK(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function IN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function hK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?IN(Object(n),!0).forEach(function(r){pK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pK(e,t,n){return(t=vK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vK(e){var t=yK(e,"string");return typeof t=="symbol"?t:t+""}function yK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var gK={cacheSize:2e3,enableCache:!0},IC=hK({},gK),$N=new mK(IC.cacheSize),xK={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},RN="recharts_measurement_span";function bK(e,t){var n=t.fontSize||"",r=t.fo Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jK(e,t){if(e){if(typeof e=="string")return BN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?BN(e,t):void 0}}function BN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _K(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;m=!1}else for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function NK(e){if(Array.isArray(e))return e}function SK(e,t,n){return(t=AK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AK(e){var t=OK(e,"string");return typeof t=="symbol"?t:t+""}function OK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var UN=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,HN=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,EK=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,kK=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,CK={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},TK=["cm","mm","pt","pc","in","Q","px"];function MK(e){return TK.includes(e)}var ys="NaN";function DK(e,t){return e*CK[t]}class pn{static parse(t){var n,r=(n=kK.exec(t))!==null&&n!==void 0?n:[],l=Ef(r,3),s=l[1],d=l[2];return s==null?pn.NaN:new pn(parseFloat(s),d??"")}constructor(t,n){this.num=t,this.unit=n,this.num=t,this.unit=n,Ar(t)&&(this.unit=""),n!==""&&!EK.test(n)&&(this.num=NaN,this.unit=""),MK(n)&&(this.num=DK(t,n),this.unit="px")}add(t){return this.unit!==t.unit?new pn(NaN,""):new pn(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new pn(NaN,""):new pn(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new pn(NaN,""):new pn(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new pn(NaN,""):new pn(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Ar(this.num)}}$C=pn;SK(pn,"NaN",new $C(NaN,""));function RC(e){if(e==null||e.includes(ys))return ys;for(var t=e;t.includes("*")||t.includes("/");){var n,r=(n=UN.exec(t))!==null&&n!==void 0?n:[],l=Ef(r,4),s=l[1],d=l[2],f=l[3],m=pn.parse(s??""),h=pn.parse(f??""),v=d==="*"?m.multiply(h):m.divide(h);if(v.isNaN())return ys;t=t.replace(UN,v.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var y,b=(y=HN.exec(t))!==null&&y!==void 0?y:[],w=Ef(b,4),j=w[1],_=w[2],S=w[3],A=pn.parse(j??""),C=pn.parse(S??""),M=_==="+"?A.add(C):A.subtract(C);if(M.isNaN())return ys;t=t.replace(HN,M.toString())}return t}var qN=/\(([^()]*)\)/;function PK(e){for(var t=e,n;(n=qN.exec(t))!=null;){var r=n,l=Ef(r,2),s=l[1];t=t.replace(qN,RC(s))}return t}function zK(e){var t=e.replace(/\s+/g,"");return t=PK(t),t=RC(t),t}function IK(e){try{return zK(e)}catch{return ys}}function kv(e){var t=IK(e.slice(5,-1));return t===ys?"":t}var $K=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],RK=["dx","dy","angle","className","breakAll"];function Cy(){return Cy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Cy.apply(null,arguments)}function KN(e,t){if(e==null)return{};var n,r,l=LK(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}function LK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function YN(e,t){return qK(e)||HK(e,t)||UK(e,t)||BK()}function BK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UK(e,t){if(e){if(typeof e=="string")return GN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GN(e,t):void 0}}function GN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function HK(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;m=!1}else for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function qK(e){if(Array.isArray(e))return e}var LC=/[ \f\n\r\t\v\u2028\u2029]+/,BC=e=>{var t=e.children,n=e.breakAll,r=e.style;try{var l=[];Nt(t)||(n?l=t.toString().split(""):l=t.toString().split(LC));var s=l.map(f=>({word:f,width:oc(f,r).width})),d=n?0:oc(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:d}}catch{return null}};function UC(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function KK(e){return Nt(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var HC=(e,t,n,r)=>e.reduce((l,s)=>{var d=s.word,f=s.width,m=l[l.length-1];if(m&&f!=null&&(t==null||r||m.width+f+n<Number(t)))m.words.push(d),m.width+=f+n;else{var h={words:[d],width:f};l.push(h)}return l},[]),qC=e=>e.reduce((t,n)=>t.width>n.width?t:n),YK="…",VN=(e,t,n,r,l,s,d,f)=>{var m=e.slice(0,t),h=BC({breakAll:n,style:r,children:m+YK});if(!h)return[!1,[]];var v=HC(h.wordsWithComputedWidth,s,d,f),y=v.length>l||qC(v).width>Number(s);return[y,v]},GK=(e,t,n,r,l)=>{var s=e.maxLines,d=e.children,f=e.style,m=e.breakAll,h=je(s),v=String(d),y=HC(t,r,n,l);if(!h||l)return y;var b=y.length>s||qC(y).width>Number(r);if(!b)return y;for(var w=0,j=v.length-1,_=0,S;w<=j&&_<=v.length-1;){var A=Math.floor((w+j)/2),C=A-1,M=VN(v,C,m,f,s,r,n,l),k=YN(M,2),D=k[0],E=k[1],$=VN(v,A,m,f,s,r,n,l),U=YN($,1),K=U[0];if(!D&&!K&&(w=A+1),D&&K&&(j=A-1),!D&&K){S=E;break}_++}return S||y},FN=e=>{var t=Nt(e)?[]:e.toString().split(LC);return[{words:t,width:void 0}]},VK=e=>{var t=e.width,n=e.scaleToFit,r=e.children,l=e.style,s=e.breakAll,d=e.maxLines;if((t||n)&&!Pc.isSsr){var f,m,h=BC({breakAll:s,children:r,style:l});if(h){var v=h.wordsWithComputedWidth,y=h.spaceWidth;f=v,m=y}else return FN(r);return GK({breakAll:s,children:r,maxLines:d,style:l},f,m,t,!!n)}return FN(r)},KC="#808080",FK={angle:0,breakAll:!1,capHeight:"0.71em",fill:KC,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Om=x.forwardRef((e,t)=>{var n=an(e,FK),r=n.x,l=n.y,s=n.lineHeight,d=n.capHeight,f=n.fill,m=n.scaleToFit,h=n.textAnchor,v=n.verticalAnchor,y=KN(n,$K),b=x.useMemo(()=>VK({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:m,style:y.style,width:y.width}),[y.breakAll,y.children,y.maxLines,m,y.style,y.width]),w=y.dx,j=y.dy,_=y.angle,S=y.className,A=y.breakAll,C=KN(y,RK);if(!qr(r)||!qr(l)||b.length===0)return null;var M=Number(r)+(je(w)?w:0),k=Number(l)+(je(j)?j:0);if(!He(M)||!He(k))return null;var D;switch(v){case"start":D=kv("calc(".concat(d,")"));break;case"middle":D=kv("calc(".concat((b.length-1)/2," * -").concat(s," + (").concat(d," / 2))"));break;default:D=kv("calc(".concat(b.length-1," * -").concat(s,")"));break}var E=[],$=b[0];if(m&&$!=null){var U=$.width,K=y.width;E.push("scale(".concat(je(K)&&je(U)?K/U:1,")"))}return _&&E.push("rotate(".concat(_,", ").concat(M,", ").concat(k,")")),E.length&&(C.transform=E.join(" ")),x.createElement("text",Cy({},Xn(C),{ref:t,x:M,y:k,className:nt("recharts-text",S),textAnchor:h,fill:f.includes("url")?KC:f}),b.map((T,re)=>{var Z=T.words.join(A?"":" ");return x.createElement("tspan",{x:M,dy:re===0?D:s,key:"".concat(Z,"-").concat(re)},Z)}))});Om.displayName="Text";function XN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function $r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XN(Object(n),!0).forEach(function(r){XK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function XK(e,t,n){return(t=WK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WK(e){var t=ZK(e,"string");return typeof t=="symbol"?t:t+""}function ZK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Numb Line truncated
A`).concat(j,",").concat(j,",0,1,").concat(C?0:1,`,
`).concat(k.x,",").concat(k.y),E=Nt(e.id)?dc("recharts-radial-line-"):e.id;return x.createElement("text",ga({},r,{dominantBaseline:"central",className:nt("recharts-radial-bar-label",d)}),x.createElement("defs",null,x.createElement("path",{id:E,d:D})),x.createElement("textPath",{xlinkHref:"#".concat(E)},n))},dY=(e,t,n)=>{var r=e.cx,l=e.cy,s=e.innerRadius,d=e.outerRadius,f=e.startAngle,m=e.endAngle,h=(f+m)/2;if(n==="outside"){var v=Ht(r,l,d+t,h),y=v.x,b=v.y;return{x:y,y:b,textAnchor:y>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:l,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:l,textAnchor:"middle",verticalAnchor:"end"};var w=(s+d)/2,j=Ht(r,l,w,h),_=j.x,S=j.y;return{x:_,y:S,textAnchor:"middle",verticalAnchor:"middle"}},zd=e=>e!=null&&"cx"in e&&je(e.cx),fY={angle:0,offset:5,zIndex:qt.label,position:"middle",textBreakAll:!1};function mY(e){if(!zd(e))return e;var t=e.cx,n=e.cy,r=e.outerRadius,l=r*2;return{x:t-r,y:n-r,width:l,upperWidth:l,lowerWidth:l,height:l}}function oi(e){var t=an(e,fY),n=t.viewBox,r=t.parentViewBox,l=t.position,s=t.value,d=t.children,f=t.content,m=t.className,h=m===void 0?"":m,v=t.textBreakAll,y=t.labelRef,b=sY(),w=GC(),j=l==="center"?w:b??w,_,S,A;n==null?_=j:zd(n)?_=n:_=m0(n);var C=mY(_);if(!_||Nt(s)&&Nt(d)&&!x.isValidElement(f)&&typeof f!="function")return null;var M=ac(ac({},t),{},{viewBox:_});if(x.isValidElement(f)){M.labelRef;var k=WN(M,JK);return x.cloneElement(f,k)}if(typeof f=="function"){M.content;var D=WN(M,eY);if(S=x.createElement(f,D),x.isValidElement(S))return S}else S=oY(t);var E=Xn(t);if(zd(_)){if(l==="insideStart"||l==="insideEnd"||l==="end")return uY(t,l,S,E,_);A=dY(_,t.offset,t.position)}else{if(!C)return null;var $=QK({viewBox:C,position:l,offset:t.offset,parentViewBox:zd(r)?void 0:r});A=ac(ac({x:$.x,y:$.y,textAnchor:$.horizontalAnchor,verticalAnchor:$.verticalAnchor},$.width!==void 0?{width:$.width}:{}),$.height!==void 0?{height:$.height}:{})}return x.createElement(In,{zIndex:t.zIndex},x.createElement(Om,ga({ref:y,className:nt("recharts-label",h)},E,A,{textAnchor:UC(E.textAnchor)?E.textAnchor:A.textAnchor,breakAll:v}),S))}oi.displayName="Label";var hY=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?x.createElement(oi,ga({key:"label-implicit"},r)):qr(e)?x.createElement(oi,ga({key:"label-implicit",value:e},r)):x.isValidElement(e)?e.type===oi?x.cloneElement(e,ac({key:"label-implicit"},r)):x.createElement(oi,ga({key:"label-implicit",content:e},r)):Tg(e)?x.createElement(oi,ga({key:"label-implicit",content:e},r)):e&&typeof e=="object"?x.createElement(oi,ga({},e,{key:"label-implicit"},r)):null};function pY(e){var t=e.label,n=e.labelRef,r=GC();return hY(t,r,n)||null}var vY=["valueAccessor"],yY=["dataKey","clockWise","id","textBreakAll","zIndex"];function kf(){return kf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kf.apply(null,arguments)}function QN(e,t){if(e==null)return{};var n,r,l=gY(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}function gY(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var xY=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(KK(t))return t},VC=x.createContext(void 0),FC=VC.Provider,XC=x.createContext(void 0),bY=XC.Provider;function wY(){return x.useContext(VC)}function jY(){return x.useContext(XC)}function Id(e){var t=e.valueAccessor,n=t===void 0?xY:t,r=QN(e,vY),l=r.dataKey;r.clockWise;var s=r.id,d=r.textBreakAll,f=r.zIndex,m=QN(r,yY),h=wY(),v=jY(),y=h||v;return!y||!y.length?null:x.createElement(In,{zIndex:f??qt.label},x.createElement(Ct,{className:"recharts-label-list"},y.map((b,w)=>{var j,_=Nt(l)?n(b,w):rt(b.payload,l),S=Nt(s)?{}:{id:"".concat(s,"-").concat(w)};return x.createElement(oi,kf({key:"label-".concat(w)},Xn(b),m,S,{fill:(j=r.fill)!==null&&j!==void 0?j:b.fill,parentViewBox:b.parentViewBox,value:_,textBreakAll:d,viewBox:b.viewBox,index:w,zIndex:0}))})))}Id.displayName="LabelList";function Mg(e){var t=e.label;return t?t===!0?x.createElement(Id,{key:"labelList-implicit"}):x.isValidElement(t)||Tg(t)?x.createElement(Id,{key:"labelList-implicit",content:t}):typeof t=="object"?x.createElement(Id,kf({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Ty(){return Ty=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ty.apply(null,arguments)}var WC=e=>{var t=e.cx,n=e.cy,r=e.r,l=e.className,s=nt("recharts-dot",l);return je(t)&&je(n)&&je(r)?x.createElement("circle",Ty({},zn(e),n0(e),{className:s,cx:t,cy:n, Line truncated
* @license React
* react-is.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var nS;function LY(){if(nS)return ut;nS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.view_transition"),w=Symbol.for("react.client.reference");function j(_){if(typeof _=="object"&&_!==null){var S=_.$$typeof;switch(S){case e:switch(_=_.type,_){case n:case l:case r:case m:case h:case b:return _;default:switch(_=_&&_.$$typeof,_){case d:case f:case y:case v:return _;case s:return _;default:return S}}case t:return S}}}return ut.ContextConsumer=s,ut.ContextProvider=d,ut.Element=e,ut.ForwardRef=f,ut.Fragment=n,ut.Lazy=y,ut.Memo=v,ut.Portal=t,ut.Profiler=l,ut.StrictMode=r,ut.Suspense=m,ut.SuspenseList=h,ut.isContextConsumer=function(_){return j(_)===s},ut.isContextProvider=function(_){return j(_)===d},ut.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===e},ut.isForwardRef=function(_){return j(_)===f},ut.isFragment=function(_){return j(_)===n},ut.isLazy=function(_){return j(_)===y},ut.isMemo=function(_){return j(_)===v},ut.isPortal=function(_){return j(_)===t},ut.isProfiler=function(_){return j(_)===l},ut.isStrictMode=function(_){return j(_)===r},ut.isSuspense=function(_){return j(_)===m},ut.isSuspenseList=function(_){return j(_)===h},ut.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===n||_===l||_===r||_===m||_===h||typeof _=="object"&&_!==null&&(_.$$typeof===y||_.$$typeof===v||_.$$typeof===d||_.$$typeof===s||_.$$typeof===f||_.$$typeof===w||_.getModuleId!==void 0)},ut.typeOf=j,ut}var rS;function BY(){return rS||(rS=1,Cv.exports=LY()),Cv.exports}var UY=BY(),aS=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",iS=null,Tv=null,n4=e=>{if(e===iS&&Array.isArray(Tv))return Tv;var t=[];return x.Children.forEach(e,n=>{Nt(n)||(UY.isFragment(n)?t=t.concat(n4(n.props.children)):t.push(n))}),Tv=t,iS=e,t};function zg(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(l=>aS(l)):r=[aS(t)],n4(e).forEach(l=>{var s=Hr(l,"type.displayName")||Hr(l,"type.name");s&&r.indexOf(s)!==-1&&n.push(l)}),n}var r4=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0;function lS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function sS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lS(Object(n),!0).forEach(function(r){HY(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function HY(e,t,n){return(t=qY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qY(e){var t=KY(e,"string");return typeof t=="symbol"?t:t+""}function KY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function a4(e,t){return sS(sS({},t),e)}function YY(e){return x.isValidElement(e)?e.props:e}function GY(e,t){return x.cloneElement(e,a4(YY(e),t))}function VY(e){if("index"in e){var t=e.index;return typeof t=="number"||typeof t=="string"?t:void 0}}function FY(e){return"isActive"in e&&e.isActive===!0}function Ig(e){var t=e.option,n=e.DefaultShape,r=e.shapeProps,l=e.activeClassName,s=l===void 0?"recharts-active-shape":l,d=e.inActiveClassName,f=d===void 0?"recharts-shape":d,m=VY(r),h;return x.isValidElement(t)?h=GY(t,r):t===n?h=x.createElement(n,r):typeof t=="function"?h=t(r,m):typeof t=="object"?h=x.createElement(n,a4(t,r)):h=x.createElement(n,r),FY(r)?x.createElement(Ct,{className:s},h):x.createElement(Ct,{className:f},h)}var $g=(e,t,n)=>{var r=dt();return(l,s)=>d=>{e==null||e(l,s,d),r(cC({activeIndex:String(s),activeDataKey:t,activeCoordinate:l.tooltipPosition,activeGraphicalItemId:n}))}},Rg=e=>{var t=dt();return(n,r)=>l=>{e==null||e(n,r,l),t(QU())}},Lg=(e,t,n)=>{var r=dt();return(l,s)=>d=>{e==null||e(l,s,d),r(JU({activeIndex:String(s),activeDataKey:t,activeCoordinate:l.tooltipPosition,activeGraphicalItemId:n}))}};function Bg(e){var t=e.tooltipEntrySettings,n=dt(),r=wn(),l=x.useRef(null);return x.useLayoutEffect(()=>{r||(l.current===null?n(FU(t)):l.current!==t&&n(XU({prev:l.current,next:t})),l.current=t)},[t,n,r]),x.useLayoutEffect(()=>()=>{l.current&&(n(WU(l.current)),l.current=null)},[n]),null}function i4(e){var t=e.legendPayload,n=dt(),r=wn(),l=x.useRef(null);return x.useLayoutEffect(()=>{r||(l.current===null?n(sE(t)):l.current!==t&&n(oE({prev:l.currentLine truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QY(e,t){if(e){if(typeof e=="string")return oS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oS(e,t):void 0}}function oS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function JY(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function eG(e){if(Array.isArray(e))return e}var Ug="index",Hg="append";function qg(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var l of n)r.push({status:"removed",prev:l});for(var s=0;s<t.length;s++){var d=e[s],f=t[s];d!=null?r.push({status:"matched",prev:d,next:f}):r.push({status:"added",next:f})}return r}function tG(e,t){var n=e.length/t.length,r=t.map((l,s)=>e[Math.floor(s*n)]);return qg(r,t)}function nG(e,t){var n=t.map((r,l)=>e[l]);return qg(n,t)}function rG(e,t){for(var n=new Map,r=0;r<e.length;r++){var l=e[r];if(l!=null){var s=t(l,r);s!=null&&!n.has(s)&&n.set(s,l)}}return n}function aG(e,t,n){var r=rG(e,n),l=new Set,s=t.map((y,b)=>{var w=n(y,b);if(w!=null){var j=r.get(w);if(j!==void 0)return l.add(w),j}}),d=[];for(var f of r){var m=WY(f,2),h=m[0],v=m[1];l.has(h)||d.push(v)}return qg(s,t,d)}function My(e,t,n){return t==null?null:e==null?t.map(r=>({status:"added",next:r})):n===Ug?tG(e,t):n===Hg?nG(e,t):aG(e,t,n)}function l4(e,t){var n=x.useRef(e),r=x.useRef(t.current),l=x.useRef(!0);n.current!==e&&(n.current=e,r.current=t.current,l.current=!1);var s=x.useCallback(function(d,f){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(f===0){l.current=!0;return}f===1&&(r.current=d),f>0&&l.current&&m&&(t.current=d)},[t]);return{startValue:r.current,syncStepValue:s}}function iG(e,t){return cG(e)||oG(e,t)||sG(e,t)||lG()}function lG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sG(e,t){if(e){if(typeof e=="string")return cS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cS(e,t):void 0}}function cS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function oG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function cG(e){if(Array.isArray(e))return e}function Kg(e,t){var n=x.useState(!1),r=iG(n,2),l=r[0],s=r[1],d=x.useCallback(()=>{typeof e=="function"&&e(),s(!0)},[e]),f=x.useCallback(()=>{typeof t=="function"&&t(),s(!1)},[t]);return{isAnimating:l,handleAnimationStart:d,handleAnimationEnd:f}}function Yg(e){var t,n=e.animationInput,r=e.animationIdPrefix,l=e.items,s=e.previousItemsRef,d=e.isAnimationActive,f=e.animationBegin,m=e.animationDuration,h=e.animationEasing,v=e.onAnimationStart,y=e.onAnimationEnd,b=e.animationInterpolateFn,w=e.animationMatchBy,j=e.shouldUpdatePreviousRef,_=e.children,S=e.layout,A=yE(n,r),C=l4(A,s),M=(t=C.startValue)!==null&&t!==void 0?t:null,k=My(M,l,w??Ug);return x.createElement(vE,{animationId:A,begin:f,duration:m,isActive:d,easing:h,onAnimationEnd:y,onAnimationStart:v,key:A},D=>{var E=M==null,$=l==null?l:b(k,D,S),U=j?j(D):D>0;return C.syncStepValue($,D,U),$==null?null:_($,D,E)})}var Mv;function uG(e,t){return hG(e)||mG(e,t)||fG(e,t)||dG()}function dG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fG(e,t){if(e){if(typeof e=="string")return uS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uS(e,t):void 0}}function uS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mG(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function hG(e){if(Array.isArray(e))return e}var pG=()=>{var e=x.useState(()=>dc("uid-")),t=uG(e,1),n=t[0];return n},s4=(Mv=AT.useId)!==null&&Mv!==void 0?Mv:pG;function vG(e,t){var n=s4();return t||(e?"".concat(e,"-").concat(n):n)}var yG=x.createContext(void 0),Gg=e=>{var t=e.id,n=e.type,r=e.children,l=vG("recharts-".concat(n),t);return x.createElement(yG.Provider,{value:l},r(l))},gG={cartesianItems:[],polarItems:[]},o4=bn({name:"graphicalItems",initialState:gG,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:yt()},replaceCartesianGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,l=n.next,s=mr(e).cartesianItems.indexOf(r);s>-1&&(e.cartesianItems[s]=l)},prepare:yt()},removeCartesianGraphicalItem:{reducer(e,t){var n=mr(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:yt()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:yt()},removePolarGraphicalItem:{reducer(e,t){var n=mr(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:yt()},replacePolarGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,l=n.next,s=mr(e).polarItems.indexOf(r);s>-1&&(e.polarItems[s]=l)},prepare:yt()}}}),Gs=o4.actions,xG=Gs.addCartesianGraphicalItem,bG=Gs.replaceCartesianGraphicalItem,wG=Gs.removeCartesianGraphicalItem,jG=Gs.addPolarGraphicalItem,_G=Gs.removePolarGraphicalItem,NG=Gs.replacePolarGraphicalItem,SG=o4.reducer,AG=e=>{var t=dt(),n=x.useRef(null);return x.useLayoutEffect(()=>{n.current===null?t(xG(e)):n.current!==e&&t(bG({prev:n.current,next:e})),n.current=e},[t,e]),x.useLayoutEffect(()=>()=>{n.current&&(t(wG(n.current)),n.current=null)},[t]),null},c4=x.memo(AG),OG=e=>{var t=dt(),n=x.useRef(null);return x.useLayoutEffect(()=>{n.current===null?t(jG(e)):n.current!==e&&t(NG({prev:n.current,next:e})),n.current=e},[t,e]),x.useLayoutEffect(()=>()=>{n.current&&(t(_G(n.current)),n.current=null)},[t]),null},EG=x.memo(OG),kG=["key"],CG=["onMouseEnter","onClick","onMouseLeave"],TG=["id"],MG=["id"];function dl(){return dl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dl.apply(null,arguments)}function Tm(e,t){if(e==null)return{};var n,r,l=DG(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}function DG(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function dS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function bt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dS(Object(n),!0).forEach(function(r){PG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function PG(e,t,n){return(t=zG(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zG(e){var t=IG(e,"string");return typeof t=="symbol"?t:t+""}function IG(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var u4=jE;function $G(e){var t=x.useMemo(()=>zg(e.children,nl),[e.children]),n=Ne(r=>$Y(r,e.id,t));return n==null?null:x.createElement(XY,{legendPayload:n})}function RG(e){if(!(e==null||typeof e=="boolean"||typeof e=="function")){if(x.isValidElement(e)){var t,n=(t=e.props)===null||t===void 0?void 0:t.fill;return typeof n=="string"?n:void 0}var r=e.fill;return typeof r=="string"?r:void 0}}var LG=x.memo(e=>{var t=e.dataKey,n=e.nameKey,r=e.sectors,l=e.stroke,s=e.strokeWidth,d=e.fill,f=e.name,m=e.hide,h=e.tooltipType,v=e.id,y=e.activeShape,b=RG(y Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MV(e,t){if(e){if(typeof e=="string")return yS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yS(e,t):void 0}}function yS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function DV(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function PV(e){if(Array.isArray(e))return e}var gS=(e,t,n)=>{var r=n??e;if(!Nt(r))return xn(r,t,0)},zV=(e,t,n)=>{var r={},l=e.filter(fm),s=e.filter(h=>h.stackId==null),d=l.reduce((h,v)=>{var y=h[v.stackId];return y==null&&(y=[]),y.push(v),h[v.stackId]=y,h},r),f=Object.entries(d).map(h=>{var v,y=CV(h,2),b=y[0],w=y[1],j=w.map(S=>S.dataKey),_=gS(t,n,(v=w[0])===null||v===void 0?void 0:v.barSize);return{stackId:b,dataKeys:j,barSize:_}}),m=s.map(h=>{var v=[h.dataKey].filter(b=>b!=null),y=gS(t,n,h.barSize);return{stackId:void 0,dataKeys:v,barSize:y}});return[...f,...m]};function xS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Sd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xS(Object(n),!0).forEach(function(r){IV(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function IV(e,t,n){return(t=$V(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $V(e){var t=RV(e,"string");return typeof t=="symbol"?t:t+""}function RV(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function LV(e,t,n,r,l){var s,d=r.length;if(!(d<1)){var f=xn(e,n,0,!0),m,h=[];if(He((s=r[0])===null||s===void 0?void 0:s.barSize)){var v=!1,y=n/d,b=r.reduce((C,M)=>C+(M.barSize||0),0);b+=(d-1)*f,b>=n&&(b-=(d-1)*f,f=0),b>=n&&y>0&&(v=!0,y*=.9,b=d*y);var w=Math.round((n-b)/2),j={offset:w-f,size:0};m=r.reduce((C,M)=>{var k,D={stackId:M.stackId,dataKeys:M.dataKeys,position:{offset:j.offset+j.size+f,size:v?y:(k=M.barSize)!==null&&k!==void 0?k:0}},E=[...C,D];return j=D.position,E},h)}else{var _=xn(t,n,0,!0);n-2*_-(d-1)*f<=0&&(f=0);var S=(n-2*_-(d-1)*f)/d;S>1&&(S=Math.round(S));var A=He(l)?Math.min(S,l):S;m=r.reduce((C,M,k)=>[...C,{stackId:M.stackId,dataKeys:M.dataKeys,position:{offset:_+(S+f)*k+(S-A)/2,size:A}}],h)}return m}}var BV=(e,t,n,r,l,s,d)=>{var f=Nt(d)?t:d,m=LV(n,r,l!==s?l:s,e,f);return l!==s&&m!=null&&(m=m.map(h=>Sd(Sd({},h),{},{position:Sd(Sd({},h.position),{},{offset:h.position.offset-l/2})}))),m},UV=(e,t)=>{var n=dm(t);if(!(!e||n==null||t==null)){var r=t.stackId;if(r!=null){var l=e[r];if(l){var s=l.stackedData;if(s)return s.find(d=>d.key===n)}}}},HV=(e,t)=>{if(!(e==null||t==null)){var n=e.find(r=>r.stackId===t.stackId&&t.dataKey!=null&&r.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function qV(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&He(e.zIndex)?e.zIndex:t}var m4=e=>{var t=e.chartData,n=dt(),r=wn();return x.useEffect(()=>r?()=>{}:(n(CN(t)),()=>{n(CN(void 0))}),[t,n,r]),null},bS={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},h4=bn({name:"brush",initialState:bS,reducers:{setBrushSettings(e,t){return t.payload==null?bS:t.payload}}});h4.actions.setBrushSettings;var KV=h4.reducer;function YV(e){return(e%180+180)%180}var GV=function(t){var n=t.width,r=t.height,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=YV(l),d=s*Math.PI/180,f=Math.atan(r/n),m=d>f&&d<Math.PI-f?r/Math.sin(d):n/Math.cos(d);return Math.abs(m)},VV={dots:[],areas:[],lines:[]},p4=bn({name:"referenceElements",initialState:VV,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=mr(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=mr(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=mr(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),Vs=p4.actions;Vs.addDot;Vs.removeDot;Vs.addArea;Vs.removeArea;Vs.addLine;Vs.removeLine;var FV=p4.reducer;function XV(e,t){return JV(e)||QV(e,t)||ZV(e,t)||WV()}function WV(){ Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZV(e,t){if(e){if(typeof e=="string")return wS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wS(e,t):void 0}}function wS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function QV(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function JV(e){if(Array.isArray(e))return e}var eF=x.createContext(void 0),tF=e=>{var t=e.children,n=x.useState("".concat(dc("recharts"),"-clip")),r=XV(n,1),l=r[0],s=Vg();if(s==null)return null;var d=s.x,f=s.y,m=s.width,h=s.height;return x.createElement(eF.Provider,{value:l},x.createElement("defs",null,x.createElement("clipPath",{id:l},x.createElement("rect",{x:d,y:f,height:h,width:m}))),t)};function v4(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;r<e.length;r+=t){var l=e[r];l!==void 0&&n.push(l)}return n}function nF(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return GV(r,n)}function rF(e,t,n){var r=n==="width",l=e.x,s=e.y,d=e.width,f=e.height;return t===1?{start:r?l:s,end:r?l+d:s+f}:{start:r?l+d:s+f,end:r?l:s}}function Sc(e,t,n,r,l){if(e*t<e*r||e*t>e*l)return!1;var s=n();return e*(t-e*s/2-r)>=0&&e*(t+e*s/2-l)<=0}function aF(e,t){return v4(e,t+1)}function iF(e,t,n,r,l){for(var s=(r||[]).slice(),d=t.start,f=t.end,m=0,h=1,v=d,y=function(){var j=r==null?void 0:r[m];if(j===void 0)return{v:v4(r,h)};var _=m,S,A=()=>(S===void 0&&(S=n(j,_)),S),C=j.coordinate,M=m===0||Sc(e,C,A,v,f);M||(m=0,v=d,h+=1),M&&(v=C+e*(A()/2+l),m+=h)},b;h<=s.length;)if(b=y(),b)return b.v;return[]}function lF(e,t,n,r,l){var s=(r||[]).slice(),d=s.length;if(d===0)return[];for(var f=t.start,m=t.end,h=1;h<=d;h++){for(var v=(d-1)%h,y=f,b=!0,w=function(){var k=r[_];if(k==null)return 0;var D=_,E,$=()=>(E===void 0&&(E=n(k,D)),E),U=k.coordinate,K=_===v||Sc(e,U,$,y,m);if(!K)return b=!1,1;K&&(y=U+e*($()/2+l))},j,_=v;_<d&&(j=w(),!(j!==0&&j===1));_+=h);if(b){for(var S=[],A=v;A<d;A+=h){var C=r[A];C!=null&&S.push(C)}return S}}return[]}function jS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function yn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jS(Object(n),!0).forEach(function(r){sF(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sF(e,t,n){return(t=oF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oF(e){var t=cF(e,"string");return typeof t=="symbol"?t:t+""}function cF(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function uF(e,t,n,r,l){for(var s=(r||[]).slice(),d=s.length,f=t.start,m=t.end,h=function(b){var w=s[b];if(w==null)return 1;var j=w,_,S=()=>(_===void 0&&(_=n(w,b)),_);if(b===d-1){var A=e*(j.coordinate+e*S()/2-m);s[b]=j=yn(yn({},j),{},{tickCoord:A>0?j.coordinate-A*e:j.coordinate})}else s[b]=j=yn(yn({},j),{},{tickCoord:j.coordinate});if(j.tickCoord!=null){var C=Sc(e,j.tickCoord,S,f,m);C&&(m=j.tickCoord-e*(S()/2+l),s[b]=yn(yn({},j),{},{isShow:!0}))}},v=d-1;v>=0;v--)h(v);return s}function dF(e,t,n,r,l,s){var d=(r||[]).slice(),f=d.length,m=t.start,h=t.end;if(s){var v=r[f-1];if(v!=null){var y=n(v,f-1),b=e*(v.coordinate+e*y/2-h);if(d[f-1]=v=yn(yn({},v),{},{tickCoord:b>0?v.coordinate-b*e:v.coordinate}),v.tickCoord!=null){var w=Sc(e,v.tickCoord,()=>y,m,h);w&&(h=v.tickCoord-e*(y/2+l),d[f-1]=yn(yn({},v),{},{isShow:!0}))}}}for(var j=s?f-1:f,_=function(C){var M=d[C];if(M==null)return 1;var k=M,D,E=()=>(D===void 0&&(D=n(M,C)),D);if(C===0){var $=e*(k.coordinate-e*E()/2-m);d[C]=k=yn(yn({},k),{},{tickCoord:$<0?k.coordinate-$*e:k.coordinate})}else d[C]=k=yn(yn({},k),{},{tickCoord:k.coordinate});if(k.tickCoord!=null){var U=Sc(e,k.tickCoord,E,m,h);U&&(m=k.tickCoord+e*(E()/2+l),d[C]=yn(yn({},k),{},{isShow:!0}))}},S=0;S<j;S++)_(S);return d}function Fg(e,t,n){var r=e.tick,l=e.ticks,s=e.viewBox,d=e.minTickGap,f=e.orientation,m=e.interval,h=e.tickFormatter,v=e.unit,y=e.angle;if(!l||!l.length||!r)return[];if(je(m)||Pc.isSsr){var b;return(b=aF(l,je(m)?m:0))!==null&&b!==void 0?b:[]}var w=[],j=f==="top"||f==="bottom"?"width": Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xF(e,t){if(e){if(typeof e=="string")return NS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?NS(e,t):void 0}}function NS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bF(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function wF(e){if(Array.isArray(e))return e}function jF(e,t){if(e==null)return{};var n,r,l=_F(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}function _F(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function fl(){return fl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fl.apply(null,arguments)}function SS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function kt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?SS(Object(n),!0).forEach(function(r){NF(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function NF(e,t,n){return(t=SF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SF(e){var t=AF(e,"string");return typeof t=="symbol"?t:t+""}function AF(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Na={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:qt.axis};function OF(e){var t=e.x,n=e.y,r=e.width,l=e.height,s=e.orientation,d=e.mirror,f=e.axisLine,m=e.otherSvgProps;if(!f)return null;var h=kt(kt(kt({},m),zn(f)),{},{fill:"none"});if(s==="top"||s==="bottom"){var v=+(s==="top"&&!d||s==="bottom"&&d);h=kt(kt({},h),{},{x1:t,y1:n+v*l,x2:t+r,y2:n+v*l})}else{var y=+(s==="left"&&!d||s==="right"&&d);h=kt(kt({},h),{},{x1:t+y*r,y1:n,x2:t+y*r,y2:n+l})}return x.createElement("line",fl({},h,{className:nt("recharts-cartesian-axis-line",Hr(f,"className"))}))}function EF(e,t,n,r,l,s,d,f,m){var h,v,y,b,w,j,_=f?-1:1,S=e.tickSize||d,A=je(e.tickCoord)?e.tickCoord:e.coordinate;switch(s){case"top":h=v=e.coordinate,b=n+ +!f*l,y=b-_*S,j=y-_*m,w=A;break;case"left":y=b=e.coordinate,v=t+ +!f*r,h=v-_*S,w=h-_*m,j=A;break;case"right":y=b=e.coordinate,v=t+ +f*r,h=v+_*S,w=h+_*m,j=A;break;default:h=v=e.coordinate,b=n+ +f*l,y=b+_*S,j=y+_*m,w=A;break}return{line:{x1:h,y1:y,x2:v,y2:b},tick:{x:w,y:j}}}function kF(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function CF(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function TF(e){var t=e.option,n=e.tickProps,r=e.value,l,s=nt(n.className,"recharts-cartesian-axis-tick-value");if(x.isValidElement(t))l=x.cloneElement(t,kt(kt({},n),{},{className:s}));else if(typeof t=="function")l=t(kt(kt({},n),{},{className:s}));else{var d="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(d=nt(d,e4(t))),l=x.createElement(Om,fl({},n,{className:d}),r)}return l}function MF(e){var t=e.ticks,n=e.axisType,r=e.axisId,l=dt();return x.useEffect(()=>{if(r==null||n==null)return hl;var s=t.map(d=>({value:d.value,coordinate:d.coordinate,offset:d.offset,index:d.index}));return l(hF({ticks:s,axisId:r,axisType:n})),()=>{l(pF({axisId:r,axisType:n}))}},[l,t,r,n]),null}var DF=x.forwardRef((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,l=e.tick,s=e.tickLine,d=e.stroke,f=e.tickFormatter,m=e.unit,h=e.padding,v=e.tickTextProps,y=e.orientation,b=e.mirror,w=e.x,j=e.y,_=e.width,S=e.height,A=e.tickSize,C=e.tickMargin,M=e.fontSize,k=e.letterSpacing,D=e.getTicksConfig,E=e.events,$=e.axisType,U=e.axisId,K=Fg(kt(kt({},D),{},{ticks:r}),M,k),T=zn(D),re=rl(l),Z=UC(T.textAnchor)?T.textAnchor:kF(y,b),pe=CF(y,b),fe={};type Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xW(e,t){if(e){if(typeof e=="string")return CS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?CS(e,t):void 0}}function CS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bW(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function wW(e){if(Array.isArray(e))return e}function yi(){return yi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yi.apply(null,arguments)}function TS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?TS(Object(n),!0).forEach(function(r){jW(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jW(e,t,n){return(t=_W(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _W(e){var t=NW(e,"string");return typeof t=="symbol"?t:t+""}function NW(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pf(e,t){if(e==null)return{};var n,r,l=SW(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}function SW(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var AW=e=>{var t=e.dataKey,n=e.name,r=e.fill,l=e.legendType,s=e.hide;return[{inactive:s,dataKey:t,type:l,color:r,value:Is(n,t),payload:e}]},OW=x.memo(e=>{var t=e.dataKey,n=e.stroke,r=e.strokeWidth,l=e.fill,s=e.name,d=e.hide,f=e.unit,m=e.tooltipType,h=e.id,v={dataDefinedOnItem:void 0,getPosition:hl,settings:{stroke:n,strokeWidth:r,fill:l,dataKey:t,nameKey:void 0,name:Is(s,t),hide:d,type:m,color:l,unit:f,graphicalItemId:h}};return x.createElement(Bg,{tooltipEntrySettings:v})});function EW(e){var t=Ne(vi),n=e.data,r=e.dataKey,l=e.background,s=e.allOtherBarProps,d=s.onMouseEnter,f=s.onMouseLeave,m=s.onClick,h=Pf(s,hW),v=$g(d,r,s.id),y=Rg(f),b=Lg(m,r,s.id);if(!l||n==null)return null;var w=rl(l);return x.createElement(In,{zIndex:qV(l,qt.barBackground)},n.map((j,_)=>{j.value;var S=j.background;j.tooltipPosition;var A=Pf(j,pW);if(!S)return null;var C=v(j,j.originalDataIndex),M=y(j,j.originalDataIndex),k=b(j,j.originalDataIndex),D=Ft(Ft(Ft(Ft(Ft({option:l,isActive:String(j.originalDataIndex)===t},A),{},{fill:"#eee"},S),w),Oc(h,j,_)),{},{onMouseEnter:C,onMouseLeave:M,onClick:k,dataKey:r,index:_,className:"recharts-bar-background-rectangle"});return x.createElement(Jg,yi({key:"background-bar-".concat(_)},D))}))}function kW(e){var t=e.showLabels,n=e.children,r=e.rects,l=r==null?void 0:r.map(s=>{var d={x:s.x,y:s.y,width:s.width,lowerWidth:s.width,upperWidth:s.width,height:s.height};return Ft(Ft({},d),{},{value:s.value,payload:s.payload,parentViewBox:s.parentViewBox,viewBox:d,fill:s.fill})});return x.createElement(FC,{value:t?l:void 0},n)}function CW(e){var t=e.shape,n=e.activeBar,r=e.baseProps,l=e.entry,s=e.index,d=e.dataKey,f=Ne(vi),m=Ne(Ng),h=n&&String(l.originalDataIndex)===f&&(m==null||d===m),v=x.useState(!1),y=kS(v,2),b=y[0],w=y[1],j=x.useState(!1),_=kS(j,2),S=_[0],A=_[1];x.useEffect(()=>{var $;return h?(w(!0),$=requestAnimationFrame(()=>{A(!0)})):A(!1),()=>{cancelAnimationFrame($)}},[h]);var C=x.useCallback(()=>{h||w(!1)},[h]),M=h&&S,k=h||b,D;h?n===!0?D=t:D=n:D=t;var E=x.createElement(Jg,yi({},r,{name:String(r.name)},l,{isActive:M,option:D,index:s,dataKey:d,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance,onTransitionEnd:C}));return k?x.createElement(In,{zIndex:qt.activeBar},x.createElement(P4,{index:l.originalDataIndex},E)):E}function TW(e){var t=e.shape,n=e.baseProps,r=e.entry,l=e.index,s=e.dataKey;return x.createElement(Jg,yi({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:l,dataKey:s,animationElapsedTime:e.animationElapsedTime,isAn Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RZ(e,t){if(e){if(typeof e=="string")return qS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qS(e,t):void 0}}function qS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function LZ(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function BZ(e){if(Array.isArray(e))return e}function UZ(){var e=dt(),t=x.useState(null),n=IZ(t,2),r=n[0],l=n[1],s=Ne(vI);return x.useEffect(()=>{if(r!=null){var d=r.getBoundingClientRect(),f=d.width/r.offsetWidth;He(f)&&f!==s&&e(J8(f))}},[r,e,s]),l}function KS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function HZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KS(Object(n),!0).forEach(function(r){qZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qZ(e,t,n){return(t=KZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KZ(e){var t=YZ(e,"string");return typeof t=="symbol"?t:t+""}function YZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mi(){return mi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mi.apply(null,arguments)}function If(e,t){return XZ(e)||FZ(e,t)||VZ(e,t)||GZ()}function GZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VZ(e,t){if(e){if(typeof e=="string")return YS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?YS(e,t):void 0}}function YS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function FZ(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,l,s,d,f=[],m=!0,h=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(m=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);m=!0);}catch(v){h=!0,l=v}finally{try{if(!m&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(h)throw l}}return f}}function XZ(e){if(Array.isArray(e))return e}var WZ=()=>(Zq(),null);function $f(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var ZZ=x.forwardRef((e,t)=>{var n,r,l=x.useRef(null),s=x.useState({containerWidth:$f((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:$f((r=e.style)===null||r===void 0?void 0:r.height)}),d=If(s,2),f=d[0],m=d[1],h=x.useCallback((y,b)=>{m(w=>{var j=Math.round(y),_=Math.round(b);return w.containerWidth===j&&w.containerHeight===_?w:{containerWidth:j,containerHeight:_}})},[]),v=x.useCallback(y=>{if(typeof t=="function"&&t(y),l.current!=null&&(l.current.disconnect(),l.current=null),y!=null&&typeof ResizeObserver<"u"){var b=y.getBoundingClientRect(),w=b.width,j=b.height;h(w,j);var _=A=>{var C=A[0];if(C!=null){var M=C.contentRect,k=M.width,D=M.height;h(k,D)}},S=new ResizeObserver(_);S.observe(y),l.current=S}},[t,h]);return x.useEffect(()=>()=>{var y=l.current;y!=null&&y.disconnect()},[h]),x.createElement(x.Fragment,null,x.createElement(Tc,{width:f.containerWidth,height:f.containerHeight}),x.createElement("div",mi({ref:v},e)))}),QZ=x.forwardRef((e,t)=>{var n=e.width,r=e.height,l=x.useState({containerWidth:$f(n),containerHeight:$f(r)}),s=If(l,2),d=s[0],f=s[1],m=x.useCallback((v,y)=>{f(b=>{var w=Math.round(v),j=Math.round(y);return b.containerWidth===w&&b.containerHeight===j?b:{containerWidth:w,containerHeight:j}})},[]),h=x.useCallback(v=>{if(typeof t=="function"&&t(v),v!=null){var y=v.getBoundingClientRect(),b=y.width,w=y.height;m(b,w)}},[t,m]);return x.createElement(x.Fragment,null,x.createElement(Tc,{width:d.containerWidth,height:d.containerHeight}),x.createElement("div",mi({ref:h},e)))}),JZ=x.forwardRef((e,t)=>{var n=e.width,r=e.height;return x.createElement(x.Fragment,null,x.createElement(Tc,{width:n,height:r}),x.createElement("div",mi({ref:t},e)))}),eQ=x.forwardRef((e,t)=>{var n=e.width,r=e.height;return typeof n=="string"||typeof r=="string"?x.createElement(QZ,mi({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?x.createElement(JZ,mi({},e,{width:n,height:r,ref:t})):x.createElement(x.Fragment,null,x.createElement(Tc,{width:n,height:r}),x.createElement("div",mi({ref:t},e)))});function tQ(e){return e?ZZ:eQ}var nQ=x.forwardRef((e,t)=>{var n=e.children,r=e.className,l=e.height,s=e.onClick,d=e.onContextMenu,f=e.onDoubleClick,m=e.onMouseDown,h=e.onMouseEnter,v=e.onMouseLeave,y=e.onMouseMove,b=e.onMouseUp,w=e.onTouchEnd,j=e.onTouchMove,_=e.onTouchStart,S=e.style,A=e.width,C=e.responsive,M=e.dispatchTouchEvents,k=M===void 0?!0:M,D=x.useRef(null),E=dt(),$=x.useState(null),U=If($,2),K=U[0],T=U[1],re=x.useState(null),Z=If(re,2),pe=Z[0],fe=Z[1],ce=UZ(),R=f0(),z=(R==null?void 0:R.width)>0?R.width:A,G=(R==null?void 0:R.height)>0?R.height:l,se=x.useCallback(Y=>{ce(Y),typeof t=="function"&&t(Y),T(Y),fe(Y),Y!=null&&(D.current=Y)},[ce,t,T,fe]),ue=x.useCallback(Y=>{E(R4(Y)),E(dr({handler:s,reactEvent:Y}))},[E,s]),P=x.useCallback(Y=>{E(Uy(Y)),E(dr({handler:h,reactEvent:Y}))},[E,h]),Q=x.useCallback(Y=>{E(uC()),E(dr({handler:v,reactEvent:Y}))},[E,v]),ne=x.useCallback(Y=>{E(Uy(Y)),E(dr({handler:y,reactEvent:Y}))},[E,y]),I=x.useCallback(()=>{E(K4())},[E]),he=x.useCallback(()=>{E(Y4())},[E]),be=x.useCallback(Y=>{E(q4(Y.key))},[E]),_e=x.useCallback(Y=>{E(dr({handler:d,reactEvent:Y}))},[E,d]),W=x.useCallback(Y=>{E(dr({handler:f,reactEvent:Y}))},[E,f]),V=x.useCallback(Y=>{E(dr({handler:m,reactEvent:Y}))},[E,m]),ye=x.useCallback(Y=>{E(dr({handler:b,reactEvent:Y}))},[E,b]),xe=x.useCallback(Y=>{E(dr({handler:_,reactEvent:Y}))},[E,_]),ae=x.useCallback(Y=>{k&&E(F4(Y)),E(dr({handler:j,reactEvent:Y}))},[E,k,j]),Le=x.useCallback(Y=>{E(dr({handler:w,reactEvent:Y}))},[E,w]),Ce=tQ(C);return x.createElement(DC.Provider,{value:K},x.createElement(AA.Provider,{value:pe},x.createElement(Ce,{width:z??(S==null?void 0:S.width),height:G??(S==null?void 0:S.height),className:nt("recharts-wrapper",r),style:HZ({position:"relative",cursor:"default",width:z,height:G},S),onClick:ue,onContextMenu:_e,onDoubleClick:W,onFocus:I,onBlur:he,onKeyDown:be,onMouseDown:V,onMouseEnter:P,onMouseLeave:Q,onMouseMove:ne,onMouseUp:ye,onTouchEnd:Le,onTouchMove:ae,onTouchSta Line truncated
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),c.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[c.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[c.jsx(Gy,{className:"w-4 h-4"}),"AI如何工作"]}),c.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[c.jsx("li",{children:"• 自动识别买家的砍价请求"}),c.jsx("li",{children:"• 根据设定的策略智能回复"}),c.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),c.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>K(null),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:ue,children:"取消"}),c.jsxs("button",{onClick:xe,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:ue,children:[ue?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(Sa,{className:"w-4 h-4"}),ue?"保存中...":"保存"]})]})})]})}),document.body)]})},QS=({status:e})=>{const t={processing:"bg-blue-100 text-blue-800",pending_ship:"bg-[#0094f7] text-white",shipped:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700",cancelled:"bg-gray-100 text-gray-500",refunding:"bg-red-100 text-red-600"},n={processing:"处理中",pending_ship:"待发货",shipped:"已发货",completed:"已完成",cancelled:"已取消",refunding:"退款中"};return c.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${t[e]||t.cancelled}`,children:n[e]||e})},DQ=()=>{const[e,t]=x.useState([]),[n,r]=x.useState([]),[l,s]=x.useState([]),[d,f]=x.useState({}),[m,h]=x.useState("all"),[v,y]=x.useState(""),[b,w]=x.useState(1),[j,_]=x.useState(1),[S,A]=x.useState(!1),[C,M]=x.useState(!1),[k,D]=x.useState(!1),[E,$]=x.useState(!1),[U,K]=x.useState(null),[T,re]=x.useState(null),[Z,pe]=x.useState({}),[fe,ce]=x.useState(!1),[R,z]=x.useState(""),[G,se]=x.useState(!1),[ue,P]=x.useState(null),[Q,ne]=x.useState(null),[I,he]=x.useState(null),[be,_e]=x.useState(null),W=ie=>{if(!v.trim())return ie;const De=v.toLowerCase().trim();return ie.filter(Ue=>{var B,Te,lt,Zr,Qn,$n;return((B=Ue.order_id)==null?void 0:B.toLowerCase().includes(De))||((Te=Ue.item_id)==null?void 0:Te.toLowerCase().includes(De))||((lt=Ue.buyer_id)==null?void 0:lt.toLowerCase().includes(De))||((Zr=Ue.item_title)==null?void 0:Zr.toLowerCase().includes(De))||((Qn=Ue.receiver_name)==null?void 0:Qn.toLowerCase().includes(De))||(($n=Ue.receiver_phone)==null?void 0:$n.toLowerCase().includes(De))})},V=async()=>{A(!0);try{if(v.trim()){let ie=[],De=1,Ue=!0;for(;Ue;){const B=await xj(void 0,m,De,100);ie=[...ie,...B.data],Ue=De<B.total_pages,De++}r(ie),t(W(ie)),_(1)}else{const ie=await xj(void 0,m,b,20);r(ie.data),t(W(ie.data)),_(ie.total_pages)}}catch(ie){console.error("加载订单失败:",ie)}finally{A(!1)}};x.useEffect(()=>{t(W(n))},[n,v]);const ye=(ie,De)=>{if(De&&De.trim())return De;if(d[ie])return d[ie];const Ue=l.find(B=>{if(De&&B.item_title){const Te=De.toLowerCase(),lt=B.item_title.toLowerCase();return lt.includes(Te)||Te.includes(lt)}return!1});return Ue!=null&&Ue.item_title?Ue.item_title:"未知商品"},xe=ie=>{const De={};ie.forEach(Ue=>{Ue.item_id&&(De[Ue.item_id]=Ue.item_title||Ue.item_id)}),f(De)};x.useEffect(()=>{V(),Ns().then(ie=>{s(ie),xe(ie)}).catch(ie=>{console.error("加载商品列表失败:",ie)})},[m,b,v]);const ae=async()=>{A(!0);try{const ie=await ID();await V(),ie!=null&&ie.message&&alert(ie.message)}catch(ie){console.error("同步订单失败:",ie),alert((ie==null?void 0:ie.message)||"同步失败,请重试")}finally{A(!1)}},Le=ie=>{z(ie),P(null),ce(!0)},Ce=async ie=>{var De;se(!0),P(null);try{const Ue=await RD([R],ie),B=(De=Ue==null?void 0:Ue.results)==null?void 0:De[0];B!=null&&B.success?(P({success:!0,message:B.message}),V()):P({success:!1,message:(B==null?void 0:B.message)||"发货失败"})}catch(Ue){P({success:!1,message:(Ue==null?void 0:Ue.message)||"请求失败"})}finally{se(!1)}},Y=ie=>{K(ie),M(!0)},ge=ie=>{re({...ie}),D(!0)},Pe=async()=>{if(!(!T||!T.order_id))try{const ie={};T.status!==void 0&&(ie.order_status=T.status),T.buyer_id!==void 0&&(ie.buyer_id=T.buyer_id),T.amount!==void 0&&(ie.amount=T.amount),T.receiver_name!==void 0&&(ie.receiver_name=T.receiver_name),T.receiver_phone!==void 0&&(ie.receiver_phone=T.receiver_phone),T.receiver_address!==void 0&&(ie.receiver_address=T.receiver_address),T.item_id!==void 0&&(ie.item_id=T.item_id),T.quantity!==void 0&&(ie.quantity=T.quantity),await PD(T.order_id,ie),D(!1),re(null),V()}catch(ie){console.error("更新订单失败:",ie),alert("更新失败,请重试")}},Be=async()=>{if(Q)try{const ie=new FormData;ie.append("file",Q),await LD(ie),$(!1),ne(null),V(),alert("订 Line truncated
VIP-MONTH-002
VIP-MONTH-003`,"按行消费的卡密队列","是","0","否","",""],["感谢文案","text","感谢购买,如有问题联系客服~","固定文本","是","0","否","",""],["教程图","image","https://cdn.example.com/tutorial.jpg","图片URL","是","0","否","",""]]].map(ye=>ye.map(xe=>`"${String(xe).replace(/"/g,'""')}"`).join(",")).join(`
`),_e=new Blob(["\uFEFF"+be],{type:"text/csv;charset=utf-8"}),W=URL.createObjectURL(_e),V=document.createElement("a");V.href=W,V.download="卡密组批量导入模板.csv",document.body.appendChild(V),V.click(),V.remove(),URL.revokeObjectURL(W)},P=async()=>{if(S){D(!0),M(null);try{const I=await YD(S);if(M(I),I.created>0){const he=await va();t(he)}}catch(I){M({error:(I==null?void 0:I.message)||"上传失败"})}finally{D(!1)}}},Q=async()=>{if(!(!E||!U.trim())){D(!0),re(null);try{const I=await GD(E,U);re({added:I.added}),K("");const he=await va();t(he)}catch(I){alert("追加失败:"+((I==null?void 0:I.message)||"未知错误"))}finally{D(!1)}}},ne=()=>{var I;_("create"),A(null),M(null),$((I=se[0])!=null&&I.id?String(se[0].id):""),K(""),re(null),w(!0)};return c.jsxs("div",{className:"space-y-6 animate-fade-in",children:[c.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"卡密库存"}),c.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"管理自动发货的卡密、链接或图片资源。"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("button",{onClick:ne,className:"px-4 py-3 bg-gray-100 hover:bg-gray-200 rounded-2xl font-bold text-gray-700 flex items-center gap-2 transition-colors",children:[c.jsx(tc,{className:"w-5 h-5"}),"批量导入"]}),c.jsxs("button",{onClick:()=>s(!0),className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 transition-transform hover:scale-105 active:scale-95",children:[c.jsx(ja,{className:"w-5 h-5"}),"添加新卡密"]})]})]}),c.jsxs("div",{className:"ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white",children:[c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-left border-collapse",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"bg-white text-gray-400 text-xs font-bold uppercase tracking-wider border-b border-gray-50",children:[c.jsx("th",{className:"px-8 py-5 w-[18%]",children:"卡密名称"}),c.jsx("th",{className:"px-6 py-5 w-[12%]",children:"卡密组ID"}),c.jsx("th",{className:"px-6 py-5 w-[10%]",children:"类型"}),c.jsx("th",{className:"px-6 py-5 w-[22%]",children:"内容/库存"}),c.jsx("th",{className:"px-6 py-5 w-[18%]",children:"描述"}),c.jsx("th",{className:"px-6 py-5 w-[10%]",children:"状态"}),c.jsx("th",{className:"px-6 py-5 w-[10%] text-right",children:"操作"})]})}),c.jsx("tbody",{className:"divide-y divide-gray-50",children:e.map(I=>{let he="";return I.type==="data"&&I.data_content?he=`库存: ${I.data_content.split(`
`).filter(_e=>_e.trim()).length} 条`:I.type==="text"&&I.text_content?he=I.text_content.substring(0,20)+(I.text_content.length>20?"...":""):I.type==="api"&&I.api_config?he=I.api_config.url:I.type==="image"&&I.image_url&&(he="图片链接"),c.jsxs("tr",{className:"hover:bg-[#FFFDE7]/50 transition-colors group",children:[c.jsx("td",{className:"px-8 py-5",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"p-2 bg-gray-50 rounded-xl group-hover:bg-white transition-colors",children:c.jsx(Z,{type:I.type})}),c.jsx("span",{className:"font-bold text-gray-900",children:I.name})]})}),c.jsx("td",{className:"px-6 py-5",children:c.jsxs("button",{onClick:()=>G(I.id),className:"inline-flex items-center gap-2 rounded-xl bg-gray-100 px-3 py-2 font-mono text-xs font-extrabold text-gray-700 hover:bg-gray-200 transition-colors",title:"复制卡密组ID,用于批量铺货表格",children:[I.id,c.jsx(lM,{className:"w-3.5 h-3.5"})]})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${I.type==="text"?"bg-blue-50 text-blue-600":I.type==="data"?"bg-purple-50 text-purple-600":I.type==="api"?"bg-blue-50 text-blue-600":"bg-pink-50 text-pink-600"}`,children:I.type==="text"?"文本":I.type==="data"?"批量":I.type==="api"?"API":"图片"})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx("span",{className:"text-sm text-gray-600 font-mono block truncate",title:he,children:he})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx("span",{className:"text-sm text-gray-500 block max-w-[200px] truncate",title:I.description||"-",children:I.description||"-"})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx("button",{onClick:()=>z(I),className:`w-12 h-8 rounded-full relative transition-colors ${I.enabled?"bg-green-500":"bg-gray-300"}`,children:c.jsx("div",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-sm transition-transform ${I.enabled?"left-5":"left-1"}`})})}),c.jsx("td",{className:"px-6 py-5",children:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsx("button",{onClick:()=>pe(I),className:"p-2 text-gray-400 hover:text-black hover:bg-gray-100 rounded-xl transition-colors",title:"编辑",children:c.jsx(bs,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>ce(I.id),className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",children:c.jsx(xa,{className:"w-5 h-5"})})]})})]},I.id)})})]})}),e.length===0&&c.jsxs("div",{className:"py-20 text-center text-gray-400",children:[c.jsx(fA,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),c.jsx("p",{children:"暂无卡密配置,请点击右上角添加。"})]})]}),n&&d&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",children:[c.jsxs("div",{className:"modal-header",children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑卡密"}),c.jsx("button",{onClick:()=>r(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsx("div",{className:"modal-body",children:c.jsxs("div",{className:"space-y-5",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["卡密名称 ",c.jsx("span",{className:"text-red-500",children:"*"})]}),c.jsx("input",{type:"text",value:m.name||"",onChange:I=>h({...m,name:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如:游戏点卡、会员卡等"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡券类型"}),c.jsxs("select",{value:m.type||"text",onChange:I=>h({...m,type:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"",children:"请选择类型"}),c.jsx("option",{value:"text",children:"固定文字"}),c.jsx("option",{value:"data",children:"批量数据"}),c.jsx("option",{value:"api",children:"API接口"}),c.jsx("option",{value:"image",children:"图片"})]})]})]}),m.type==="api"&&c.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 space-y-4 bg-gray-50",children:[c.jsx("h3",{className:"font-bold text-gray-900",children:"API 配置"}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"API 地址"}),c.jsx("input",{type:"url",value:m.api_url||"",onChange:I=>h({...m,api_url:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://api.example.com/get-card"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"请求方法"}),c.jsxs("select",{value:m.api_method||"GET",onChange:I=>h({...m,api_method:I.target.value}),className:"w-full ios-input pLine truncated
卡号1:密码1
卡号2:密码2
或者
兑换码1
兑换码2`}),c.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持格式:卡号:密码 或 单独的兑换码"}),c.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",c.jsx("span",{className:"font-bold text-blue-600",children:m.data_content?m.data_content.split(`
`).filter(I=>I.trim()).length:0})," 条"]})]})]}),m.type==="image"&&c.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[c.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"图片配置"}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),c.jsx("input",{type:"url",value:m.image_url||"",onChange:I=>h({...m,image_url:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://example.com/image.png"}),c.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"输入图片卡密的 URL 地址"})]}),m.image_url&&c.jsxs("div",{className:"mt-3",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片预览"}),c.jsx("img",{src:m.image_url,alt:"预览",className:"max-w-full max-h-48 rounded-xl border border-gray-200",onError:I=>{I.currentTarget.src="https://via.placeholder.com/400x200?text=图片加载失败"}})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"延时发货时间(秒)"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"number",value:m.delay_seconds||0,onChange:I=>h({...m,delay_seconds:parseInt(I.target.value)||0}),className:"flex-1 ios-input px-4 py-3 rounded-xl",min:"0",max:"3600",placeholder:"0"}),c.jsx("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:"秒"})]}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"0表示立即发货,最大3600秒(1小时)"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注信息"}),c.jsx("textarea",{value:m.description||"",onChange:I=>h({...m,description:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none",placeholder:"可选的备注信息"})]}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[c.jsx("span",{className:"font-bold text-gray-900",children:"启用状态"}),c.jsx("button",{type:"button",onClick:()=>h({...m,enabled:!m.enabled}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${m.enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${m.enabled?"translate-x-7":"translate-x-1"}`})})]})]})}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>r(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),c.jsxs("button",{onClick:fe,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(Sa,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body),l&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"780px"},children:[c.jsxs("div",{className:"modal-header flex items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"添加新卡密"}),c.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"选择交付方式并录入自动发货内容"})]}),c.jsx("button",{onClick:()=>s(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",title:"关闭",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsx("div",{className:"modal-body",children:c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡密名称"}),c.jsx("input",{type:"text",value:v.name,onChange:I=>y({...v,name:I.target.value}),placeholder:"例如:VIP会员卡密",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"类型"}),c.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>y({...v,type:"data",content:""}),className:`p-3 rounded-xl font-bold transition-all ${v.type==="data"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[c.jsx(Lv,{className:"w-5 h-5 mx-auto mb-1"}),"批量库存"]}),c.jsxs("button",{type:"button",onClick:()=>y({...v,type:"text",content:""}),className:`p-3 rounded-xl font-bold transition-all ${v.type==="text"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600"}`,children:[c.jsx(mj,{className:"w-5 h-5 mx-auto mb-1"}),"文本"]}),c.jsxs("button",{type:"button",onClick:()=>y({...v,type:"image",content:""}),className:`p-3 rounded-xl font-bold transition-all ${v.type==="image"?"bg-[#0094f7] text-white":"bg-gray-100 text-grayLine truncated
CODE-789012
...`:"请输入每次发货时发送的固定文字"}),v.type==="data"&&c.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",c.jsx("span",{className:"font-bold text-[#0094f7]",children:v.content.split(`
`).filter(I=>I.trim()).length})," 条"]})]}),v.type==="api"&&c.jsxs("div",{className:"border-t border-gray-100 pt-5 space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求方法"}),c.jsxs("select",{value:v.api_method,onChange:I=>y({...v,api_method:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"GET",children:"GET"}),c.jsx("option",{value:"POST",children:"POST"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"超时时间(秒)"}),c.jsx("input",{type:"number",min:"1",max:"60",value:v.api_timeout,onChange:I=>y({...v,api_timeout:parseInt(I.target.value)||10}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求头(JSON)"}),c.jsx("textarea",{value:v.api_headers,onChange:I=>y({...v,api_headers:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"Authorization":"Bearer token"}'})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求参数(JSON)"}),c.jsx("textarea",{value:v.api_params,onChange:I=>y({...v,api_params:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"order_id":"{order_id}"}'})]})]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_180px] gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"描述"}),c.jsx("input",{value:v.description,onChange:I=>y({...v,description:I.target.value}),placeholder:"卡密用途描述(可选)",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"延时发货(秒)"}),c.jsx("input",{type:"number",value:v.delay_seconds,onChange:I=>y({...v,delay_seconds:parseInt(I.target.value)||0}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"3600"})]})]})]})}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>s(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),c.jsxs("button",{onClick:R,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(ja,{className:"w-4 h-4"}),"添加卡密"]})]})})]})}),document.body),b&&It.createPortal(c.jsx("div",{className:"modal-overlay",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[c.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[c.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),c.jsx("button",{onClick:()=>w(!1),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]}),c.jsxs("div",{className:"px-6 py-5 space-y-5",children:[c.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[c.jsxs("button",{onClick:()=>_("create"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${j==="create"?"bg-[#0094f7] text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[c.jsx(CM,{className:"w-4 h-4"}),"批量创建卡密组"]}),c.jsxs("button",{onClick:()=>_("append"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${j==="append"?"bg-[#0094f7] text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[c.jsx(tc,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),j==="create"?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",c.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),'。 类型填 text/data/image/api;data 类型的"内容"按行存卡密(CSV 单元格内换行需用引号包裹)。']}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("button",{onClick:ue,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text Line truncated
VIP-002
VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),c.jsx("p",{className:"text-xs text-gray-500",children:"一行一个卡密号,空行自动忽略。会追加到该组现有库存末尾。"})]}),T&&c.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",T.added," 个卡密"]})]})})]}),c.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[c.jsx("button",{onClick:()=>w(!1),className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),j==="create"?c.jsxs("button",{onClick:P,disabled:!S||k,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[k?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(tc,{className:"w-4 h-4"}),k?"处理中...":"上传创建"]}):c.jsxs("button",{onClick:Q,disabled:!E||!U.trim()||k||se.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[k?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(ja,{className:"w-4 h-4"}),k?"处理中...":"追加卡密"]})]})]})}),document.body)]})},zQ=e=>{const t=String(e||"").trim();return t?/^[¥¥]/.test(t)?t:`¥${t}`:"-"},IQ=({onConfigureDelivery:e})=>{const[t,n]=x.useState([]),[r,l]=x.useState([]),[s,d]=x.useState([]),[f,m]=x.useState(""),[h,v]=x.useState(!1),[y,b]=x.useState(!1),[w,j]=x.useState(!1),[_,S]=x.useState(!1),[A,C]=x.useState(!1),[M,k]=x.useState(!1),[D,E]=x.useState(!1),[$,U]=x.useState("upload"),[K,T]=x.useState(null),[re,Z]=x.useState(null),[pe,fe]=x.useState(null),[ce,R]=x.useState(null),[z,G]=x.useState(null),[se,ue]=x.useState({}),[P,Q]=x.useState({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""}),[ne,I]=x.useState({cookie_id:"",title:"",description:"",price:"",original_price:"",quantity:"1",postage_mode:"free",postage:"",images:[]}),he=async()=>{const B=await Ns();n(B)},be=async()=>{l(await Rd())};x.useEffect(()=>{Promise.all([Fy(),Ns(),Rd()]).then(([B,Te,lt])=>{d(B),n(Te),l(lt)}).catch(B=>console.error("加载商品配置失败:",B))},[]),x.useEffect(()=>{if(!D||!(ce!=null&&ce.id)||ce.status!=="running")return;const B=window.setInterval(async()=>{try{const Te=await cd(ce.id);R(Te),Te.status!=="running"&&(U("done"),await he(),await be())}catch(Te){console.error("刷新批量铺货进度失败:",Te)}},3e3);return()=>window.clearInterval(B)},[D,ce==null?void 0:ce.id,ce==null?void 0:ce.status]);const _e=async()=>{if(!f)return alert("请先选择账号");v(!0);try{const B=await VD(f);await he(),alert((B==null?void 0:B.message)||"商品同步完成")}catch(B){console.error("同步商品失败:",B),alert((B==null?void 0:B.message)||"同步失败,请重试")}finally{v(!1)}},W=B=>{G(B),ue({...B}),S(!0)},V=async()=>{if(z)try{await tP(z.cookie_id,z.item_id,{item_title:se.item_title||"",item_description:se.item_description||"",item_category:se.item_category||"",item_price:se.item_price||"",item_detail:se.item_detail||z.item_detail||""}),await he(),await be(),S(!1),G(null)}catch(B){console.error("更新商品失败:",B),alert("更新失败,请重试")}},ye=async B=>{if(confirm(`确认删除商品"${B.item_title}"吗?`))try{await FD(B.cookie_id,B.item_id),n(Te=>Te.filter(lt=>!(lt.cookie_id===B.cookie_id&&lt.item_id===B.item_id)))}catch(Te){console.error("删除商品失败:",Te),alert("删除失败,请重试")}},xe=async()=>{try{if(!P.cookie_id||!P.item_id){alert("请选择账号并填写商品ID");return}await XD(P.cookie_id,{item_id:P.item_id,item_title:P.item_title,item_price:P.item_price,item_detail:P.item_image?JSON.stringify({item_image:P.item_image}):""}),await he(),C(!1),Q({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""})}catch(B){console.error("添加商品失败:",B),alert("添加失败,请重试")}},ae=async()=>{if(!ne.cookie_id)return alert("请选择发布账号");if(!ne.title.trim())return alert("请填写商品标题");if(!ne.price.trim())return alert("请填写商品价格");if(!ne.quantity||Number(ne.quantity)<=0)return alert("库存数量必须大于 0");if(ne.images.length===0)return alert("至少上传 1 张商品图片");if(ne.postage_mode==="fixed"&&!ne.postage.trim())return alert("请填写一口价邮费");b(!0);try{const B=await WD(ne);if(await he(),k(!1),I({cookie_id:f||"",title:"",description:"",price:"",original_price:"",quantity:"1",postage_mode:"free",postage:"",images:[]}),B!=null&&B.item_id){const Te={id:B.item_id,cookie_id:ne.cookie_id,item_id:B.item_id,item_title:B.item_title||ne.title,item_price:B.item_price||ne.price,item_image:B.item_image};e(Te),alert("商品发布成功,ID: "+B.item_id+",已为你打开发货规则配置")}else alert("商品发布成功")}catch(B){console.error("发布商品失败:",B);const Te=B==null?void 0:B.payload;if((Te==null?void 0:Te.code)==="stock_permission_missing" Line truncated
`),Zr=new Blob(["\uFEFF"+lt],{type:"text/csv;charset=utf-8"}),Qn=URL.createObjectURL(Zr),$n=document.createElement("a");$n.href=Qn,$n.download="批量铺货模板.csv",document.body.appendChild($n),$n.click(),$n.remove(),URL.revokeObjectURL(Qn)},Ve=()=>{Q(B=>({...B,cookie_id:f||B.cookie_id})),C(!0)},Dt=()=>{I(B=>({...B,cookie_id:f||B.cookie_id})),k(!0)},ie=B=>r.filter(Te=>Te.cookie_id===B.cookie_id&&Te.item_id===B.item_id),De=B=>{switch(B){case"preview":return"待确认";case"pending":return"等待中";case"running":return"发布中";case"success":return"成功";case"failed":return"失败";case"completed":return"已完成";case"canceled":return"已取消";default:return B||"-"}},Ue=B=>{switch(B){case"success":case"completed":return"bg-emerald-50 text-emerald-700 border-emerald-100";case"failed":return"bg-red-50 text-red-700 border-red-100";case"running":return"bg-blue-50 text-blue-700 border-blue-100";case"canceled":return"bg-gray-100 text-gray-600 border-gray-200";default:return"bg-amber-50 text-amber-700 border-amber-100"}};return c.jsxs("div",{className:"space-y-6 animate-fade-in",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"商品管理"}),c.jsx("p",{className:"text-gray-500 mt-2 text-sm",children:"监控并管理所有账号下的闲鱼商品。"})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsxs("select",{className:"ios-input px-4 py-3 rounded-xl text-sm",value:f,onChange:B=>m(B.target.value),children:[c.jsx("option",{value:"",children:"选择账号以同步"}),s.map(B=>c.jsx("option",{value:B.id,children:B.nickname},B.id))]}),c.jsxs("button",{onClick:_e,disabled:h||!f,className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 disabled:opacity-50",children:[c.jsx(pr,{className:`w-4 h-4 ${h?"animate-spin":""}`}),"同步商品"]}),c.jsxs("button",{onClick:Ve,className:"px-5 py-3 rounded-2xl font-bold bg-gray-900 text-white hover:bg-gray-800 transition-colors flex items-center gap-2 shadow-lg",children:[c.jsx(ja,{className:"w-4 h-4"}),"添加商品"]}),c.jsxs("button",{onClick:Dt,className:"px-5 py-3 rounded-2xl font-bold bg-emerald-600 text-white hover:bg-emerald-700 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100",children:[c.jsx(Zp,{className:"w-4 h-4"}),"发布商品"]}),c.jsxs("button",{onClick:Le,className:"px-5 py-3 rounded-2xl font-bold bg-blue-600 text-white hover:bg-blue-700 transition-colors flex items-center gap-2 shadow-lg shadow-blue-100",children:[c.jsx(od,{className:"w-4 h-4"}),"批量铺货"]})]})]}),c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4",children:[t.map(B=>{const Te=ie(B),lt=Te.length>0;return c.jsxs("div",{className:"ios-card p-3 rounded-2xl hover:shadow-lg transition-all group relative flex flex-col",children:[c.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:[c.jsx("button",{onClick:()=>W(B),className:"p-1.5 bg-white/90 backdrop-blur rounded-lg shadow-md text-gray-600 hover:bg-[#0094f7] hover:text-white transition-colors",title:"编辑",children:c.jsx(bs,{className:"w-3.5 h-3.5"})}),c.jsx("button",{onClick:()=>ye(B),className:"p-1.5 bg-white/90 backdrop-blur rounded-lg shadow-md hover:bg-red-100 text-red-500 transition-colors",title:"删除",children:c.jsx(xa,{className:"w-3.5 h-3.5"})})]}),c.jsxs("div",{className:"aspect-square bg-gray-100 rounded-xl mb-2.5 overflow-hidden relative",children:[B.item_image?c.jsx("img",{src:B.item_image,alt:"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-300",children:c.jsx(sA,{className:"w-8 h-8"})}),c.jsx("div",{className:"absolute top-1.5 left-1.5 bg-black/50 backdrop-blur-md text-white text-[10px] font-bold px-1.5 py-0.5 rounded-md",children:zQ(B.item_price)})]}),c.jsx("h3",{className:"font-bold text-gray-900 line-clamp-2 text-xs mb-1.5 h-8 leading-4",children:B.item_title}),c.jsxs("div",{className:"flex justify-between items-center text-[10px] text-gray-500 mb-2",children:[c.jsxs("span",{className:"bg-gray-100 px-1.5 py-0.5 rounded truncate max-w-[80px]",children:["ID: ",B.item_id]}),c.jsxs("span",{className:`inline-flex items-center gap-1 font-bold ${lt?"text-emerald-600":"text-amber-600"}`,children:[lt?c.jsx(oA,{className:"w-3 h-3"}):c.jsx(eM,{className:"w-3 h-3"}),lt?`${Te.length} 规则`:"未配置"]})]}),c.jsx("div",{className:"space-y-2 mt-auto",children:c.jsxs("button",{onClick:()=>e(B),className:`w-full flex items-center justify-between gap-1 px-2.5 py-2 rounded-lg text-[11px] font-extrabold transition-all ${lt?"bg-gray-900 text-white hover:bg-black":"bg-[#0094f7] text-white hover:bg-[#0071e3] shadow-md shadow-blue-100"}`,children:[c.jsxs("span",{className:"flex items-center Line truncated
@@ -0,0 +1 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.-bottom-1{bottom:-.25rem}.-right-1{rigLine truncated
+2 -2
View File
@@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ydisks闲鱼助手 - 自动发货与管家系统</title>
<meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" />
<script type="module" crossorigin src="/static/assets/index-ukRBmZzU.js"></script>
<link rel="stylesheet" crossorigin href="/static/assets/index-D_KvwSmE.css">
<script type="module" crossorigin src="/static/assets/index-Bzj0nqFG.js"></script>
<link rel="stylesheet" crossorigin href="/static/assets/index-CjhArDrm.css">
</head>
<body>
<div id="root"></div>
+52 -3
View File
@@ -5,6 +5,7 @@ package mtop
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
@@ -57,6 +58,7 @@ type ClientImpl struct {
TokenURL string
ConsignURL string
OrderDetailURL string
LoginUserURL string
}
// NewClient 构造默认 HTTP 实现的非零 ClientImpl(调用方多为持有 Client 接口字段)。
@@ -117,10 +119,9 @@ func hasMTopSuccess(ret []string) bool {
func isTokenExpiredRet(ret []string) bool {
for _, r := range ret {
lower := strings.ToLower(r)
if strings.Contains(lower, "token") ||
strings.Contains(r, "FAIL_SYS_TOKEN_EXOIRED") ||
if strings.Contains(r, "FAIL_SYS_TOKEN_EXOIRED") ||
strings.Contains(r, "FAIL_SYS_TOKEN_EXPIRED") ||
strings.Contains(r, "FAIL_SYS_TOKEN_EMPTY") ||
strings.Contains(r, "FAIL_SYS_SESSION_EXPIRED") {
return true
}
@@ -128,6 +129,54 @@ func isTokenExpiredRet(ret []string) bool {
return false
}
// RiskVerificationError 表示闲鱼服务端要求用户验证(滑块/人脸/风控页)。
// 这类错误不能按普通 token 过期快速重试,否则会持续打接口并放大风控。
type RiskVerificationError struct {
Ret []string
VerificationURL string
}
func (e *RiskVerificationError) Error() string {
if e == nil {
return ""
}
if e.VerificationURL != "" {
return fmt.Sprintf("闲鱼要求安全验证: ret=%v url=%s", e.Ret, e.VerificationURL)
}
return fmt.Sprintf("闲鱼要求安全验证: ret=%v", e.Ret)
}
// IsRiskVerificationErr 判断错误是否是闲鱼风控验证要求。
func IsRiskVerificationErr(err error) bool {
var riskErr *RiskVerificationError
if errors.As(err, &riskErr) {
return true
}
if err == nil {
return false
}
msg := strings.ToLower(err.Error())
return strings.Contains(msg, "fail_sys_user_validate") ||
strings.Contains(msg, "rgv587") ||
strings.Contains(msg, "punish") ||
strings.Contains(msg, "captcha") ||
strings.Contains(msg, "x5secdata")
}
func isRiskVerificationRet(ret []string) bool {
for _, r := range ret {
lower := strings.ToLower(r)
if strings.Contains(lower, "fail_sys_user_validate") ||
strings.Contains(lower, "rgv587") ||
strings.Contains(lower, "punish") ||
strings.Contains(lower, "captcha") ||
strings.Contains(lower, "x5secdata") {
return true
}
}
return false
}
// IsSessionExpiredErr 判断错误是否表示 cookie/session 已彻底失效(需密码登录刷新)。
func IsSessionExpiredErr(err error) bool {
if err == nil {
+1 -1
View File
@@ -165,7 +165,7 @@ func TestIsTokenExpiredRet(t *testing.T) {
{[]string{"FAIL_SYS_TOKEN_EXOIRED::令牌过期"}, true},
{[]string{"FAIL_SYS_TOKEN_EXPIRED::令牌过期"}, true},
{[]string{"FAIL_SYS_SESSION_EXPIRED::会话过期"}, true},
{[]string{"FAIL_SYS_USER_VALIDATE::非法请求TOKEN"}, true}, // lower contains "token"
{[]string{"FAIL_SYS_USER_VALIDATE::非法请求TOKEN"}, false},
{[]string{"SUCCESS::调用成功"}, false},
{[]string{"FAIL_BIZ_ORDER_STATUS_ERROR::订单状态错误"}, false},
{nil, false},
+136
View File
@@ -0,0 +1,136 @@
package mtop
import (
"context"
"encoding/json"
"fmt"
"net/http"
"strconv"
"strings"
"time"
"xianyu-go/internal/xianyu/protocol"
)
const LoginUserAPI = "https://h5api.m.goofish.com/h5/mtop.taobao.idlemessage.pc.loginuser.get/1.0/"
const (
LoginStatusSuccess = "success"
LoginStatusTokenRefreshed = "token_refreshed"
LoginStatusSessionExpired = "session_expired"
LoginStatusTokenEmpty = "token_empty"
LoginStatusRiskRequired = "risk_required"
LoginStatusFailed = "failed"
)
// LoginStatusResult 是 loginuser.get 的登录态检查结果。
type LoginStatusResult struct {
Status string
Ret []string
UpdatedCookies string
VerificationURL string
Message string
}
// CheckLoginStatusContext 调用 loginuser.get 做低成本登录态检查。
// 它不会做浏览器动作;只负责分类响应和合并 Set-Cookie。
func (c *ClientImpl) CheckLoginStatusContext(ctx context.Context, cookiesStr string) (*LoginStatusResult, error) {
hc := c.HTTPClient
if hc == nil {
hc = &http.Client{Timeout: 20 * time.Second}
}
t := strconv.FormatInt(time.Now().UnixMilli(), 10)
dataVal := `{}`
query := buildLoginStatusQuery(t, protocol.GenerateSign(t, protocol.SignToken(cookiesStr), dataVal))
loginURL := c.LoginUserURL
if loginURL == "" {
loginURL = LoginUserAPI
}
req, err := http.NewRequestWithContext(ctx, http.MethodPost, loginURL+"?"+query, strings.NewReader("data=%7B%7D"))
if err != nil {
return nil, err
}
setCommonHeaders(req, cookiesStr)
resp, err := hc.Do(req)
if err != nil {
return nil, fmt.Errorf("loginuser.get 请求失败: %w", err)
}
defer resp.Body.Close()
raw, err := readMTopBody(resp)
if err != nil {
return nil, err
}
updated := mergeSetCookie(cookiesStr, protocol.TransCookies(cookiesStr), resp)
var payload struct {
Ret []string `json:"ret"`
Data struct {
URL string `json:"url"`
} `json:"data"`
}
if err := json.Unmarshal(raw, &payload); err != nil {
return nil, fmt.Errorf("解析 loginuser.get 响应失败: %w (body=%s)", err, truncate(string(raw), 300))
}
status, msg := classifyLoginStatus(payload.Ret, updated != cookiesStr)
return &LoginStatusResult{
Status: status,
Ret: payload.Ret,
UpdatedCookies: updated,
VerificationURL: payload.Data.URL,
Message: msg,
}, nil
}
func buildLoginStatusQuery(t, sign string) string {
parts := [][2]string{
{"jsv", "2.7.2"},
{"appKey", protocol.SignAppKey},
{"t", t},
{"sign", sign},
{"v", "1.0"},
{"type", "originaljson"},
{"accountSite", "xianyu"},
{"dataType", "json"},
{"timeout", "20000"},
{"api", "mtop.taobao.idlemessage.pc.loginuser.get"},
{"sessionOption", "AutoLoginOnly"},
{"spm_cnt", "a21ybx.im.0.0"},
{"spm_pre", "a21ybx.item.want.1.12523da6waCtUp"},
{"log_id", "12523da6waCtUp"},
}
var b strings.Builder
for i, p := range parts {
if i > 0 {
b.WriteByte('&')
}
b.WriteString(p[0])
b.WriteByte('=')
b.WriteString(p[1])
}
return b.String()
}
func classifyLoginStatus(ret []string, cookieUpdated bool) (string, string) {
if hasMTopSuccess(ret) {
return LoginStatusSuccess, "登录状态正常"
}
if isRiskVerificationRet(ret) {
return LoginStatusRiskRequired, "闲鱼要求安全验证"
}
retStr := strings.Join(ret, " ")
switch {
case strings.Contains(retStr, "TOKEN_EMPTY") || strings.Contains(retStr, "令牌为空"):
return LoginStatusTokenEmpty, "令牌为空,需要重新登录"
case strings.Contains(retStr, "SESSION_EXPIRED") || strings.Contains(retStr, "Session过期"):
return LoginStatusSessionExpired, "Session过期,需要重新登录"
case strings.Contains(retStr, "TOKEN_EXOIRED") || strings.Contains(retStr, "TOKEN_EXPIRED"):
if cookieUpdated {
return LoginStatusTokenRefreshed, "令牌已刷新"
}
return LoginStatusFailed, "令牌过期但未获取到新Cookie"
default:
return LoginStatusFailed, retStr
}
}
+72
View File
@@ -0,0 +1,72 @@
package mtop
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
)
func TestRiskVerificationClassification(t *testing.T) {
ret := []string{"FAIL_SYS_USER_VALIDATE::用户校验失败"}
if !isRiskVerificationRet(ret) {
t.Fatal("FAIL_SYS_USER_VALIDATE 应识别为风控")
}
if isTokenExpiredRet(ret) {
t.Fatal("FAIL_SYS_USER_VALIDATE 不应再被当作普通 token 过期")
}
err := &RiskVerificationError{Ret: ret, VerificationURL: "https://passport.goofish.com/punish?x5secdata=1"}
if !IsRiskVerificationErr(err) {
t.Fatal("RiskVerificationError 应被识别")
}
}
func TestRefreshTokenReturnsRiskVerificationError(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "newtk_1"})
fmt.Fprint(w, `{"ret":["FAIL_SYS_USER_VALIDATE::用户校验失败"],"data":{"url":"https://passport.goofish.com/punish?x5secdata=1"}}`)
}))
defer srv.Close()
c := &ClientImpl{HTTPClient: srv.Client(), TokenURL: srv.URL}
res, err := c.RefreshTokenWithDeviceIDContext(context.Background(), "unb=123; _m_h5_tk=old_1", "device-1")
if err == nil || !IsRiskVerificationErr(err) {
t.Fatalf("应返回风控错误: res=%#v err=%v", res, err)
}
if res == nil || !strings.Contains(res.UpdatedCookies, "_m_h5_tk=newtk_1") {
t.Fatalf("风控时仍应保留 Set-Cookie: %#v", res)
}
var riskErr *RiskVerificationError
if !strings.Contains(err.Error(), "x5secdata") {
t.Fatalf("风控 URL 未进入错误信息: %v", riskErr)
}
}
func TestCheckLoginStatusTokenRefreshed(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "newtk_1"})
fmt.Fprint(w, `{"ret":["FAIL_SYS_TOKEN_EXOIRED::令牌过期"],"data":{}}`)
}))
defer srv.Close()
c := &ClientImpl{HTTPClient: srv.Client(), LoginUserURL: srv.URL}
res, err := c.CheckLoginStatusContext(context.Background(), "unb=123; _m_h5_tk=old_1")
if err != nil {
t.Fatalf("CheckLoginStatusContext: %v", err)
}
if res.Status != LoginStatusTokenRefreshed {
t.Fatalf("status=%s want %s", res.Status, LoginStatusTokenRefreshed)
}
if !strings.Contains(res.UpdatedCookies, "_m_h5_tk=newtk_1") {
t.Fatalf("UpdatedCookies=%q", res.UpdatedCookies)
}
}
func TestClassifyLoginStatusRisk(t *testing.T) {
status, msg := classifyLoginStatus([]string{"RGV587_ERROR::哎哟喂,被挤爆啦"}, false)
if status != LoginStatusRiskRequired || msg == "" {
t.Fatalf("status=%s msg=%q", status, msg)
}
}
+14 -10
View File
@@ -32,13 +32,16 @@ func (c *ClientImpl) RefreshTokenContext(ctx context.Context, cookiesStr string)
func (c *ClientImpl) RefreshTokenWithDeviceIDContext(ctx context.Context, cookiesStr, deviceID string) (*RefreshResult, error) {
currentCookies := cookiesStr
for attempt := 0; attempt < 2; attempt++ {
accessToken, ret, updatedCookies, status, err := c.refreshTokenOnce(ctx, currentCookies, deviceID)
accessToken, ret, updatedCookies, verificationURL, status, err := c.refreshTokenOnce(ctx, currentCookies, deviceID)
if err != nil {
return &RefreshResult{UpdatedCookies: currentCookies}, err
}
if accessToken != "" {
return &RefreshResult{AccessToken: accessToken, UpdatedCookies: updatedCookies}, nil
}
if isRiskVerificationRet(ret) {
return &RefreshResult{UpdatedCookies: updatedCookies}, &RiskVerificationError{Ret: ret, VerificationURL: verificationURL}
}
if !isTokenExpiredRet(ret) {
return &RefreshResult{UpdatedCookies: updatedCookies}, fmt.Errorf("token API 返回非成功: ret=%v (status=%d)", ret, status)
}
@@ -54,7 +57,7 @@ func (c *ClientImpl) RefreshTokenWithDeviceIDContext(ctx context.Context, cookie
return &RefreshResult{UpdatedCookies: currentCookies}, fmt.Errorf("token API 登录凭证已失效")
}
func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID string) (string, []string, string, int, error) {
func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID string) (string, []string, string, string, int, error) {
hc := c.HTTPClient
if hc == nil {
hc = &http.Client{Timeout: 30 * time.Second}
@@ -63,7 +66,7 @@ func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID
cookies := protocol.TransCookies(cookiesStr)
myid := cookies["unb"]
if myid == "" {
return "", nil, cookiesStr, 0, fmt.Errorf("cookie 缺少 unb 字段,无法生成 deviceId")
return "", nil, cookiesStr, "", 0, fmt.Errorf("cookie 缺少 unb 字段,无法生成 deviceId")
}
if strings.TrimSpace(deviceID) == "" {
deviceID = protocol.GenerateDeviceID(myid)
@@ -84,18 +87,18 @@ func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID
}
req, err := http.NewRequestWithContext(ctx, http.MethodPost, tokenURL+"?"+query, strings.NewReader(body))
if err != nil {
return "", nil, cookiesStr, 0, err
return "", nil, cookiesStr, "", 0, err
}
setCommonHeaders(req, cookiesStr)
resp, err := hc.Do(req)
if err != nil {
return "", nil, cookiesStr, 0, fmt.Errorf("token API 请求失败: %w", err)
return "", nil, cookiesStr, "", 0, fmt.Errorf("token API 请求失败: %w", err)
}
defer resp.Body.Close()
raw, err := readMTopBody(resp)
if err != nil {
return "", nil, cookiesStr, resp.StatusCode, err
return "", nil, cookiesStr, "", resp.StatusCode, err
}
// 即使业务返回 token 过期,也要保留响应下发的新签名 Cookie。
updated := mergeSetCookie(cookiesStr, cookies, resp)
@@ -104,10 +107,11 @@ func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID
Ret []string `json:"ret"`
Data struct {
AccessToken string `json:"accessToken"`
URL string `json:"url"`
} `json:"data"`
}
if err := json.Unmarshal(raw, &res); err != nil {
return "", nil, updated, resp.StatusCode, fmt.Errorf("解析 token 响应失败: %w (body=%s)", err, truncate(string(raw), 300))
return "", nil, updated, "", resp.StatusCode, fmt.Errorf("解析 token 响应失败: %w (body=%s)", err, truncate(string(raw), 300))
}
ok := false
@@ -118,12 +122,12 @@ func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID
}
}
if !ok {
return "", res.Ret, updated, resp.StatusCode, nil
return "", res.Ret, updated, res.Data.URL, resp.StatusCode, nil
}
if res.Data.AccessToken == "" {
return "", res.Ret, updated, resp.StatusCode, fmt.Errorf("token API 成功但 accessToken 为空 (body=%s)", truncate(string(raw), 300))
return "", res.Ret, updated, "", resp.StatusCode, fmt.Errorf("token API 成功但 accessToken 为空 (body=%s)", truncate(string(raw), 300))
}
return res.Data.AccessToken, res.Ret, updated, resp.StatusCode, nil
return res.Data.AccessToken, res.Ret, updated, "", resp.StatusCode, nil
}
// buildTokenQuery 构造 token API 的 query string。
+22 -37
View File
@@ -32,6 +32,7 @@ const (
apiMiniLogin = host + "/mini_login.htm"
apiGenerateQR = host + "/newlogin/qrcode/generate.do"
apiScanStatus = host + "/newlogin/qrcode/query.do"
apiFaceCheck = host + "/iv/photoVerify/check.do"
apiH5TK = "https://h5api.m.goofish.com/h5/mtop.gaia.nodejs.gaia.idle.data.gw.v2.index.get/1.0/"
appKey = "34839810"
)
@@ -63,6 +64,8 @@ type Session struct {
params map[string]string
verificationURL string
verificationScreenshot string // 最新截图 data URL,前端轮询时显示
faceQRURL string // 人脸验证二维码 data URL,优先展示给前端
faceQRContent string // 人脸验证二维码原始内容,便于排查协议变化
}
func (s *Session) isExpired() bool {
@@ -222,6 +225,10 @@ func (m *Manager) GetSessionStatus(sessionID string) map[string]any {
if sess.Status == "verification_required" && sess.verificationURL != "" {
result["verification_url"] = sess.verificationURL
result["message"] = "账号被风控,需要手机验证"
if sess.faceQRURL != "" {
result["face_qr_url"] = sess.faceQRURL
result["message"] = "需要人脸验证,请使用手机闲鱼扫描二维码"
}
if sess.verificationScreenshot != "" {
result["verification_screenshot"] = sess.verificationScreenshot
}
@@ -298,44 +305,22 @@ func (m *Manager) monitorQRStatus(ctx context.Context, sessionID string) {
for _, c := range resp.Cookies() {
sess.cookies[c.Name] = c.Value
}
m.logger.Warn("扫码登录需要风控验证,立即启动浏览器等待验证", "session_id", sessionID, "verification_url", logsafe.URL(sess.verificationURL), "tmp_cookie_count", len(sess.cookies))
// 人脸验证会额外占用用户手机端操作时间。这里重置窗口,避免普通
// 扫码 5 分钟窗口在用户扫人脸二维码时把会话误标为 expired。
sess.createdTime = time.Now()
sess.expireTime = 5 * time.Minute
m.logger.Warn("扫码登录需要风控验证,启动 API 人脸验证链路", "session_id", sessionID, "verification_url", logsafe.URL(sess.verificationURL), "tmp_cookie_count", len(sess.cookies))
// 关键:必须在检测到风控时立即启动浏览器,带临时 cookie 打开验证页面。
// 用户在手机完成验证后,服务端回调打到这个 Chromium 页面(redirect 到 ivCheckLogin.htm),
// Chromium 才能拿到授权 session,再访问 /im 得到 unb。
// 不能等用户点按钮——那时验证已绑定到用户浏览器 session,与此 Chromium 无关。
if m.browser != nil {
browserFn := m.browser
cookieStr := cookieMarshal(sess.cookies)
verURL := sess.verificationURL
// #nosec G118 -- 浏览器验证必须跨越轮询请求,浏览器实现本身有超时限制。
go func() {
verifyCtx, cancel := context.WithTimeout(context.Background(), sess.expireTime)
defer cancel()
onScreenshot := func(dataURL string) {
m.mu.Lock()
if s, ok := m.sessions[sessionID]; ok {
s.verificationScreenshot = dataURL
}
m.mu.Unlock()
}
realCookies, unb, err := browserFn(verifyCtx, cookieStr, verURL, onScreenshot)
m.mu.Lock()
defer m.mu.Unlock()
s, ok := m.sessions[sessionID]
if !ok {
return
}
if err != nil {
m.logger.Error("浏览器等待验证失败", "err", err)
return
}
s.cookies = parseCookieStr(realCookies)
s.unb = unb
s.Status = "success"
m.logger.Info("浏览器验证成功,已自动完成登录", "session_id", sessionID, "account_hash", logsafe.ID(unb))
}()
}
verURL := sess.verificationURL
// #nosec G118 -- 风控验证必须跨越轮询请求,且由超时上下文保证退出。
go func() {
verifyCtx, cancel := context.WithTimeout(context.Background(), sess.expireTime)
defer cancel()
if err := m.runFaceVerification(verifyCtx, sessionID, verURL); err != nil {
m.logger.Error("API 人脸验证链路失败", "session_id", sessionID, "err", err)
m.fallbackBrowserVerification(verifyCtx, sessionID, verURL)
}
}()
}
time.Sleep(800 * time.Millisecond)
continue
+58
View File
@@ -5,7 +5,9 @@ import (
"errors"
"io"
"net/http"
"net/http/cookiejar"
"net/http/httptest"
"net/url"
"strings"
"testing"
"time"
@@ -100,6 +102,62 @@ func TestRandomUUIDRequiresEntropy(t *testing.T) {
}
}
func TestFaceVerificationExtractors(t *testing.T) {
normal := `<script>window.location.href = "https://passport.goofish.com/iv/mini/verify_modes.htm?htoken=abc-123&_umidfg=";</script>`
htoken, err := extractFaceHToken(`https://passport.goofish.com/iv/mini/normal_validate.htm?htoken=abc-123`)
if err != nil || htoken != "abc-123" {
t.Fatalf("extractFaceHToken=%q err=%v", htoken, err)
}
verifyURL, err := extractVerifyModesURL(normal)
if err != nil {
t.Fatalf("extractVerifyModesURL: %v", err)
}
if !strings.HasSuffix(verifyURL, "_umidfg=1") {
t.Fatalf("verifyURL 未补齐 _umidfg: %q", verifyURL)
}
qrContent, err := extractFaceQRCodeContent(`<script>new Qrcode({ text: "https:\/\/passport.goofish.com\/face?x=1&amp;y=2" });</script>`)
if err != nil {
t.Fatalf("extractFaceQRCodeContent: %v", err)
}
if qrContent != "https://passport.goofish.com/face?x=1&y=2" {
t.Fatalf("qrContent=%q", qrContent)
}
}
func TestCheckFaceVerificationDone(t *testing.T) {
hc := &handlerChain{}
hc.handle("/iv/photoVerify/check.do", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Query().Get("htoken") != "face-token" {
t.Fatalf("htoken=%q", r.URL.Query().Get("htoken"))
}
_, _ = w.Write([]byte(`{"content":{"code":3,"url":"https://passport.goofish.com/ivCheckLogin.htm?ok=1"}}`))
}))
m, _, _ := newStubbedManager(t, hc)
jar, err := cookiejar.New(nil)
if err != nil {
t.Fatal(err)
}
client := *m.httpc
client.Jar = jar
gotURL, done, err := m.checkFaceVerification(context.Background(), &client, "face-token")
if err != nil || !done || !strings.Contains(gotURL, "ivCheckLogin") {
t.Fatalf("checkFaceVerification url=%q done=%v err=%v", gotURL, done, err)
}
}
func TestCollectJarCookies(t *testing.T) {
jar, err := cookiejar.New(nil)
if err != nil {
t.Fatal(err)
}
u, _ := url.Parse("https://passport.goofish.com/")
jar.SetCookies(u, []*http.Cookie{{Name: "unb", Value: "123"}, {Name: "cookie2", Value: "abc"}})
got := collectJarCookies(jar, u)
if got["unb"] != "123" || got["cookie2"] != "abc" {
t.Fatalf("collectJarCookies=%v", got)
}
}
func testVerificationSession() *Session {
return &Session{
SessionID: "s1",
@@ -0,0 +1,350 @@
package qrlogin
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"html"
"net/http"
"net/http/cookiejar"
"net/url"
"regexp"
"strconv"
"strings"
"time"
qrcode "github.com/skip2/go-qrcode"
"xianyu-go/internal/logsafe"
)
// runFaceVerification 参照闲鱼浏览器端风控跳转链,纯 HTTP 复现人脸验证流程。
//
// 关键点:必须用同一个 Cookie Jar 贯穿 normal_validate -> verify_modes ->
// identity_verify -> check.do -> ivCheckLogin。服务端会在跳转链路中写入身份
// 锚点 Cookie;如果拆成多个无状态请求,最终通常拿不到 unb。
func (m *Manager) runFaceVerification(ctx context.Context, sessionID, iframeURL string) error {
m.mu.Lock()
sess := m.sessions[sessionID]
if sess == nil {
m.mu.Unlock()
return fmt.Errorf("会话不存在")
}
initialCookies := cloneCookieMap(sess.cookies)
m.mu.Unlock()
if len(initialCookies) == 0 {
return fmt.Errorf("无扫码临时 cookie")
}
client, jar, err := m.faceHTTPClient(initialCookies, iframeURL)
if err != nil {
return err
}
normalHTML, err := m.faceGetHTML(ctx, client, iframeURL, "")
if err != nil {
return fmt.Errorf("请求 normal_validate: %w", err)
}
htoken, err := extractFaceHToken(normalHTML)
if err != nil {
return err
}
verifyModesURL, err := extractVerifyModesURL(normalHTML)
if err != nil {
return err
}
identityHTML, err := m.faceGetHTML(ctx, client, verifyModesURL, "")
if err != nil {
return fmt.Errorf("请求 verify_modes: %w", err)
}
faceContent, err := extractFaceQRCodeContent(identityHTML)
if err != nil {
return err
}
faceQRURL, err := renderQRDataURL(faceContent)
if err != nil {
return fmt.Errorf("渲染人脸二维码: %w", err)
}
m.mu.Lock()
if s := m.sessions[sessionID]; s != nil {
s.faceQRContent = faceContent
s.faceQRURL = faceQRURL
s.Status = "verification_required"
}
m.mu.Unlock()
m.logger.Info("人脸验证二维码已生成,等待用户手机扫码", "session_id", sessionID)
ivCheckURL, err := m.waitFaceVerification(ctx, client, sessionID, htoken)
if err != nil {
return err
}
if _, err := m.faceGetHTML(ctx, client, ivCheckURL, faceIdentityReferer(htoken)); err != nil {
return fmt.Errorf("请求 ivCheckLogin: %w", err)
}
finalCookies := collectJarCookies(jar,
mustParseURL(host),
mustParseURL("https://www.goofish.com/"),
mustParseURL(iframeURL),
mustParseURL(ivCheckURL),
)
if finalCookies["unb"] == "" {
return fmt.Errorf("人脸验证完成但未获取到 unb")
}
m.mu.Lock()
if s := m.sessions[sessionID]; s != nil {
s.cookies = finalCookies
s.unb = finalCookies["unb"]
s.Status = "success"
}
m.mu.Unlock()
m.logger.Info("人脸验证登录成功", "session_id", sessionID, "account_hash", logsafe.ID(finalCookies["unb"]))
return nil
}
// fallbackBrowserVerification 保留旧浏览器验证作为协议变化时的兜底。
// 主路径不再截图展示,只有 API 链路失败且浏览器可用时才尝试。
func (m *Manager) fallbackBrowserVerification(ctx context.Context, sessionID, verificationURL string) {
if m.browser == nil {
return
}
m.mu.Lock()
sess := m.sessions[sessionID]
if sess == nil {
m.mu.Unlock()
return
}
cookieStr := cookieMarshal(sess.cookies)
m.mu.Unlock()
onScreenshot := func(dataURL string) {
m.mu.Lock()
if s, ok := m.sessions[sessionID]; ok {
s.verificationScreenshot = dataURL
}
m.mu.Unlock()
}
realCookies, unb, err := m.browser(ctx, cookieStr, verificationURL, onScreenshot)
m.mu.Lock()
defer m.mu.Unlock()
s, ok := m.sessions[sessionID]
if !ok {
return
}
if err != nil {
m.logger.Error("浏览器验证兜底失败", "session_id", sessionID, "err", err)
return
}
s.cookies = parseCookieStr(realCookies)
s.unb = unb
if s.unb == "" {
s.unb = s.cookies["unb"]
}
if s.unb != "" {
s.Status = "success"
m.logger.Info("浏览器验证兜底成功", "session_id", sessionID, "account_hash", logsafe.ID(s.unb))
}
}
func (m *Manager) faceHTTPClient(cookies map[string]string, iframeURL string) (*http.Client, http.CookieJar, error) {
jar, err := cookiejar.New(nil)
if err != nil {
return nil, nil, err
}
setJarCookies(jar, mustParseURL(host), cookies)
if u, err := url.Parse(iframeURL); err == nil {
setJarCookies(jar, u, cookies)
}
hc := *m.httpc
hc.Jar = jar
return &hc, jar, nil
}
func (m *Manager) faceGetHTML(ctx context.Context, client *http.Client, targetURL, referer string) (string, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, targetURL, nil)
if err != nil {
return "", err
}
m.setHeaders(req)
if referer != "" {
req.Header.Set("Referer", referer)
}
resp, err := client.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := readQRBody(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}
func (m *Manager) waitFaceVerification(ctx context.Context, client *http.Client, sessionID, htoken string) (string, error) {
ticker := time.NewTicker(2 * time.Second)
defer ticker.Stop()
for {
m.mu.Lock()
sess := m.sessions[sessionID]
expired := sess == nil || sess.isExpired()
m.mu.Unlock()
if expired {
return "", fmt.Errorf("人脸验证超时或会话已过期")
}
ivCheckURL, done, err := m.checkFaceVerification(ctx, client, htoken)
if err != nil {
m.logger.Warn("人脸验证轮询异常", "session_id", sessionID, "err", err)
} else if done {
return ivCheckURL, nil
}
select {
case <-ctx.Done():
return "", ctx.Err()
case <-ticker.C:
}
}
}
func (m *Manager) checkFaceVerification(ctx context.Context, client *http.Client, htoken string) (ivCheckURL string, done bool, err error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiFaceCheck, nil)
if err != nil {
return "", false, err
}
q := req.URL.Query()
q.Set("htoken", htoken)
req.URL.RawQuery = q.Encode()
m.setHeaders(req)
req.Header.Set("Accept", "application/json, text/javascript, */*; q=0.01")
req.Header.Set("X-Requested-With", "XMLHttpRequest")
req.Header.Set("Referer", faceIdentityReferer(htoken))
resp, err := client.Do(req)
if err != nil {
return "", false, err
}
defer resp.Body.Close()
body, err := readQRBody(resp.Body)
if err != nil {
return "", false, err
}
var result struct {
Content struct {
Code any `json:"code"`
URL string `json:"url"`
} `json:"content"`
}
if err := json.Unmarshal(body, &result); err != nil {
return "", false, fmt.Errorf("解析人脸验证状态失败: %w", err)
}
if fmt.Sprint(result.Content.Code) == "3" && result.Content.URL != "" {
return result.Content.URL, true, nil
}
return "", false, nil
}
func faceIdentityReferer(htoken string) string {
return host + "/iv/mini/identity_verify.htm?htoken=" + url.QueryEscape(htoken)
}
func cloneCookieMap(in map[string]string) map[string]string {
out := make(map[string]string, len(in))
for k, v := range in {
out[k] = v
}
return out
}
func setJarCookies(jar http.CookieJar, u *url.URL, cookies map[string]string) {
if jar == nil || u == nil {
return
}
cs := make([]*http.Cookie, 0, len(cookies))
for k, v := range cookies {
cs = append(cs, &http.Cookie{Name: k, Value: v, Path: "/"})
}
jar.SetCookies(u, cs)
}
func collectJarCookies(jar http.CookieJar, urls ...*url.URL) map[string]string {
out := make(map[string]string)
if jar == nil {
return out
}
for _, u := range urls {
if u == nil {
continue
}
for _, c := range jar.Cookies(u) {
out[c.Name] = c.Value
}
}
return out
}
func mustParseURL(raw string) *url.URL {
u, err := url.Parse(raw)
if err != nil {
return nil
}
return u
}
func renderQRDataURL(content string) (string, error) {
png, err := qrcode.New(content, qrcode.Low)
if err != nil {
return "", err
}
png.DisableBorder = false
pngBytes, err := png.PNG(256)
if err != nil {
return "", err
}
return "data:image/png;base64," + base64.StdEncoding.EncodeToString(pngBytes), nil
}
func extractFaceHToken(pageHTML string) (string, error) {
re := regexp.MustCompile(`htoken=([A-Za-z0-9_\-]+)`)
match := re.FindStringSubmatch(pageHTML)
if match == nil {
return "", fmt.Errorf("人脸验证:未能提取 htoken")
}
return match[1], nil
}
func extractVerifyModesURL(pageHTML string) (string, error) {
re := regexp.MustCompile(`window\.location\.href\s*=\s*"((?:https?:)?//[^"]*?/iv/mini/verify_modes\.htm\?[^"]*)"`)
match := re.FindStringSubmatch(pageHTML)
if match == nil {
return "", fmt.Errorf("人脸验证:未能提取 verify_modes 链接")
}
raw := html.UnescapeString(match[1])
raw = strings.ReplaceAll(raw, `\/`, `/`)
if strings.HasPrefix(raw, "//") {
raw = "https:" + raw
}
if strings.HasSuffix(raw, "_umidfg=") {
raw += "1"
}
return raw, nil
}
func extractFaceQRCodeContent(pageHTML string) (string, error) {
re := regexp.MustCompile(`new\s+Qrcode\(\{\s*text:\s*"((?:\\.|[^"\\])*)"`)
match := re.FindStringSubmatch(pageHTML)
if match == nil {
return "", fmt.Errorf("人脸验证:未能提取人脸验证二维码 URL")
}
content, err := strconv.Unquote(`"` + match[1] + `"`)
if err != nil {
content = match[1]
}
content = html.UnescapeString(strings.ReplaceAll(content, `\/`, `/`))
if strings.TrimSpace(content) == "" {
return "", fmt.Errorf("人脸验证二维码内容为空")
}
return content, nil
}
+337
View File
@@ -0,0 +1,337 @@
// Package renew 实现闲鱼登录 Cookie 续期链路。
//
// 这层只负责低成本 HTTP 续期:hasLogin.do -> silentHasLogin.do ->
// setLoginSettings.do。浏览器续期和密码登录属于更重的恢复手段,应该由上层在
// 本包返回失败后再决定是否执行。
package renew
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"sort"
"strconv"
"strings"
"time"
"xianyu-go/internal/xianyu"
"xianyu-go/internal/xianyu/protocol"
)
const (
HasLoginURL = "https://passport.goofish.com/newlogin/hasLogin.do"
SilentHasLoginURL = "https://passport.goofish.com/newlogin/silentHasLogin.do"
SetLoginSettingsURL = "https://passport.goofish.com/ac/account/setLoginSettings.do"
defaultRequestTimout = 20 * time.Second
maxRenewBodyBytes = 2 << 20
)
// Service 是 Cookie 接口续期服务。零值可用;测试可覆盖 URL 和 HTTPClient。
type Service struct {
HTTPClient *http.Client
HasLoginURL string
SilentHasLoginURL string
SetLoginSettingsURL string
}
// Result 描述一次接口续期的完整结果。
type Result struct {
Success bool
RenewMethod string
NewCookies string
UpdatedCookieNames []string
StepDetails []StepResult
Message string
}
// StepResult 是单个续期接口的执行结果,便于上层记录日志和定位失败点。
type StepResult struct {
Name string
HTTPStatus int
BusinessOK bool
SetCookieCount int
Message string
}
// RenewAPIFirst 按对方项目的“接口续期优先”思路执行三段续期。
// 只有 setLoginSettings.do 返回 Set-Cookie,才认为长登录续期真正成功;
// 前两步下发的 Cookie 即使最终失败也会保留在 NewCookies 中,避免丢失服务端刷新字段。
func (s Service) RenewAPIFirst(ctx context.Context, cookiesStr string) (*Result, error) {
cookiesStr = strings.TrimSpace(cookiesStr)
if cookiesStr == "" {
return &Result{RenewMethod: "none", Message: "Cookie为空,无法续期"}, nil
}
return s.renewOnce(ctx, cookiesStr)
}
func (s Service) renewOnce(ctx context.Context, original string) (*Result, error) {
current := original
steps := make([]StepResult, 0, 3)
allSetCookies := make([]string, 0, 8)
hasLogin, err := s.callHasLogin(ctx, current)
if err != nil {
return nil, err
}
steps = append(steps, hasLogin.Step)
if len(hasLogin.SetCookies) > 0 {
allSetCookies = append(allSetCookies, hasLogin.SetCookies...)
current = MergeSetCookies(current, hasLogin.SetCookies)
}
silent, err := s.callSilentHasLogin(ctx, current)
if err != nil {
return nil, err
}
steps = append(steps, silent.Step)
if len(silent.SetCookies) > 0 {
allSetCookies = append(allSetCookies, silent.SetCookies...)
current = MergeSetCookies(current, silent.SetCookies)
}
settings, err := s.callSetLoginSettings(ctx, current)
if err != nil {
return nil, err
}
steps = append(steps, settings.Step)
if len(settings.SetCookies) > 0 {
allSetCookies = append(allSetCookies, settings.SetCookies...)
}
newCookies := MergeSetCookies(original, allSetCookies)
updated := ChangedCookieNames(original, newCookies)
success := len(settings.SetCookies) > 0
method := "none"
msg := "setLoginSettings 未返回 Set-Cookie,需要浏览器续期或密码登录"
if success {
method = "api"
msg = "接口续期成功"
}
return &Result{
Success: success,
RenewMethod: method,
NewCookies: newCookies,
UpdatedCookieNames: updated,
StepDetails: steps,
Message: msg,
}, nil
}
type callResult struct {
Step StepResult
SetCookies []string
Body []byte
}
func (s Service) callHasLogin(ctx context.Context, cookiesStr string) (callResult, error) {
cookies := protocol.TransCookies(cookiesStr)
unb := cookies["unb"]
if unb == "" {
return callResult{Step: StepResult{Name: "hasLogin", Message: "Cookie缺少unb,跳过"}}, nil
}
form := url.Values{}
form.Set("hid", unb)
form.Set("ltl", "true")
form.Set("appName", "xianyu")
form.Set("appEntrance", "web")
form.Set("_csrf_token", cookies["_tb_token_"])
form.Set("umidToken", firstNonEmpty(cookies["_uab_collina"], cookies["cna"]))
form.Set("hsiz", cookies["cookie2"])
form.Set("bizParams", "taobaoBizLoginFrom=web&renderRefer=https%3A%2F%2Fwww.goofish.com%2F")
form.Set("mainPage", "false")
form.Set("isMobile", "false")
form.Set("lang", "zh_CN")
form.Set("fromSite", "77")
form.Set("isIframe", "true")
form.Set("documentReferer", "https://www.goofish.com/")
form.Set("defaultView", "hasLogin")
form.Set("umidTag", "SERVER")
form.Set("pageTraceId", "21504"+strconv.FormatInt(time.Now().UnixMilli(), 10))
req, err := http.NewRequestWithContext(ctx, http.MethodPost, s.urlOrDefault(s.HasLoginURL, HasLoginURL), strings.NewReader(form.Encode()))
if err != nil {
return callResult{}, err
}
setPassportHeaders(req, cookiesStr)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
if xsrf := cookies["XSRF-TOKEN"]; xsrf != "" {
req.Header.Set("x-xsrf-token", xsrf)
}
q := req.URL.Query()
q.Set("appName", "xianyu")
q.Set("fromSite", "77")
req.URL.RawQuery = q.Encode()
return s.doRenewRequest(req, "hasLogin")
}
func (s Service) callSilentHasLogin(ctx context.Context, cookiesStr string) (callResult, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodPost, s.urlOrDefault(s.SilentHasLoginURL, SilentHasLoginURL), nil)
if err != nil {
return callResult{}, err
}
q := req.URL.Query()
q.Set("documentReferer", "https://www.goofish.com/")
q.Set("appName", "xianyu")
q.Set("appEntrance", "xianyu_sdkSilent")
q.Set("fromSite", "0")
q.Set("ltl", "true")
req.URL.RawQuery = q.Encode()
setPassportHeaders(req, cookiesStr)
return s.doRenewRequest(req, "silentHasLogin")
}
func (s Service) callSetLoginSettings(ctx context.Context, cookiesStr string) (callResult, error) {
form := url.Values{}
form.Set("appName", "xianyu")
form.Set("fromSite", "77")
form.Set("keepLogin", "true")
req, err := http.NewRequestWithContext(ctx, http.MethodPost, s.urlOrDefault(s.SetLoginSettingsURL, SetLoginSettingsURL), strings.NewReader(form.Encode()))
if err != nil {
return callResult{}, err
}
setPassportHeaders(req, cookiesStr)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
return s.doRenewRequest(req, "setLoginSettings")
}
func (s Service) doRenewRequest(req *http.Request, name string) (callResult, error) {
hc := s.HTTPClient
if hc == nil {
hc = &http.Client{Timeout: defaultRequestTimout}
}
resp, err := hc.Do(req)
if err != nil {
return callResult{}, fmt.Errorf("%s 请求失败: %w", name, err)
}
defer resp.Body.Close()
body, err := readRenewBody(resp.Body)
if err != nil {
return callResult{}, fmt.Errorf("%s 响应读取失败: %w", name, err)
}
setCookies := resp.Header.Values("Set-Cookie")
step := StepResult{
Name: name,
HTTPStatus: resp.StatusCode,
SetCookieCount: len(setCookies),
}
if resp.StatusCode < 200 || resp.StatusCode >= 400 {
step.Message = fmt.Sprintf("HTTP状态异常: %d", resp.StatusCode)
return callResult{Step: step, SetCookies: setCookies, Body: body}, nil
}
step.BusinessOK = renewBusinessOK(body)
if step.BusinessOK {
step.Message = "业务成功"
} else {
step.Message = "业务结果未确认成功"
}
return callResult{Step: step, SetCookies: setCookies, Body: body}, nil
}
func renewBusinessOK(body []byte) bool {
if len(body) == 0 {
return false
}
var payload map[string]any
if err := json.Unmarshal(body, &payload); err != nil {
return false
}
content, _ := payload["content"].(map[string]any)
if content == nil {
return false
}
ok, _ := content["success"].(bool)
return ok
}
func setPassportHeaders(req *http.Request, cookiesStr string) {
req.Header.Set("Accept", "application/json, text/plain, */*")
req.Header.Set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8")
req.Header.Set("Cache-Control", "no-cache")
req.Header.Set("Pragma", "no-cache")
req.Header.Set("Origin", "https://passport.goofish.com")
req.Header.Set("Referer", "https://passport.goofish.com/")
req.Header.Set("User-Agent", xianyu.BrowserUA)
req.Header.Set("sec-ch-ua", xianyu.SecChUA)
req.Header.Set("sec-ch-ua-mobile", "?0")
req.Header.Set("sec-ch-ua-platform", `"Windows"`)
req.Header.Set("Cookie", strings.ReplaceAll(strings.ReplaceAll(cookiesStr, "\n", ""), "\r", ""))
}
func (s Service) urlOrDefault(v, fallback string) string {
if strings.TrimSpace(v) != "" {
return v
}
return fallback
}
func readRenewBody(r io.Reader) ([]byte, error) {
body, err := io.ReadAll(io.LimitReader(r, maxRenewBodyBytes+1))
if err != nil {
return nil, err
}
if len(body) > maxRenewBodyBytes {
return nil, fmt.Errorf("续期响应体超过 %d MiB", maxRenewBodyBytes>>20)
}
return body, nil
}
func firstNonEmpty(values ...string) string {
for _, v := range values {
if strings.TrimSpace(v) != "" {
return v
}
}
return ""
}
// MergeSetCookies 将 Set-Cookie 头合并到 Cookie 头字符串。只保留 name=value,
// 忽略 Path/Domain/Expires 等属性,因为后续出站请求只需要 Cookie header。
func MergeSetCookies(original string, setCookies []string) string {
cookies := protocol.TransCookies(original)
for _, sc := range setCookies {
pair := sc
if i := strings.Index(pair, ";"); i >= 0 {
pair = pair[:i]
}
name, val, ok := strings.Cut(pair, "=")
if !ok {
continue
}
name = strings.TrimSpace(name)
if name == "" {
continue
}
cookies[name] = strings.TrimSpace(val)
}
return marshalCookies(cookies)
}
// ChangedCookieNames 返回 newCookies 相对 original 变化过的字段名,按字典序排序。
func ChangedCookieNames(original, newCookies string) []string {
oldMap := protocol.TransCookies(original)
newMap := protocol.TransCookies(newCookies)
changed := make([]string, 0)
for k, v := range newMap {
if oldMap[k] != v {
changed = append(changed, k)
}
}
sort.Strings(changed)
return changed
}
func marshalCookies(cookies map[string]string) string {
keys := make([]string, 0, len(cookies))
for k := range cookies {
keys = append(keys, k)
}
sort.Strings(keys)
parts := make([]string, 0, len(keys))
for _, k := range keys {
parts = append(parts, k+"="+cookies[k])
}
return strings.Join(parts, "; ")
}
+122
View File
@@ -0,0 +1,122 @@
package renew
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
)
func TestMergeSetCookies(t *testing.T) {
got := MergeSetCookies("unb=1; old=a", []string{
"old=b; Path=/; HttpOnly",
"new=c; Domain=.goofish.com; Path=/",
"bad-cookie",
})
if !strings.Contains(got, "old=b") || !strings.Contains(got, "new=c") || !strings.Contains(got, "unb=1") {
t.Fatalf("MergeSetCookies=%q", got)
}
changed := ChangedCookieNames("unb=1; old=a", got)
if strings.Join(changed, ",") != "new,old" {
t.Fatalf("ChangedCookieNames=%v", changed)
}
}
func TestRenewAPIFirstSuccess(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/hasLogin.do":
http.SetCookie(w, &http.Cookie{Name: "sgcookie", Value: "s1"})
_, _ = w.Write([]byte(`{"content":{"success":true}}`))
case "/silentHasLogin.do":
http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "tk_1"})
_, _ = w.Write([]byte(`{"content":{"success":true}}`))
case "/setLoginSettings.do":
// 只有这个接口返回 Set-Cookie 才代表长登录续期真正成功。
http.SetCookie(w, &http.Cookie{Name: "havana_lgc2_77", Value: "lgc"})
_, _ = w.Write([]byte(`{"content":{"success":true}}`))
default:
t.Fatalf("unexpected path %s", r.URL.Path)
}
}))
defer srv.Close()
svc := Service{
HTTPClient: srv.Client(),
HasLoginURL: srv.URL + "/hasLogin.do",
SilentHasLoginURL: srv.URL + "/silentHasLogin.do",
SetLoginSettingsURL: srv.URL + "/setLoginSettings.do",
}
res, err := svc.RenewAPIFirst(context.Background(), "unb=1; cookie2=c2; _tb_token_=csrf")
if err != nil {
t.Fatalf("RenewAPIFirst: %v", err)
}
if !res.Success || res.RenewMethod != "api" {
t.Fatalf("success/method 异常: %#v", res)
}
for _, want := range []string{"sgcookie=s1", "_m_h5_tk=tk_1", "havana_lgc2_77=lgc"} {
if !strings.Contains(res.NewCookies, want) {
t.Fatalf("NewCookies 缺少 %s: %q", want, res.NewCookies)
}
}
}
func TestRenewAPIFirstKeepsPartialCookiesWhenLongLoginFails(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/hasLogin.do":
http.SetCookie(w, &http.Cookie{Name: "sgcookie", Value: "s1"})
_, _ = w.Write([]byte(`{"content":{"success":true}}`))
case "/silentHasLogin.do":
http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "tk_1"})
_, _ = w.Write([]byte(`{"content":{"success":true}}`))
case "/setLoginSettings.do":
_, _ = w.Write([]byte(`{"content":{"success":false}}`))
default:
http.Error(w, fmt.Sprintf("unexpected path %s", r.URL.Path), http.StatusNotFound)
}
}))
defer srv.Close()
svc := Service{
HTTPClient: srv.Client(),
HasLoginURL: srv.URL + "/hasLogin.do",
SilentHasLoginURL: srv.URL + "/silentHasLogin.do",
SetLoginSettingsURL: srv.URL + "/setLoginSettings.do",
}
res, err := svc.RenewAPIFirst(context.Background(), "unb=1; cookie2=c2")
if err != nil {
t.Fatalf("RenewAPIFirst: %v", err)
}
if res.Success {
t.Fatalf("setLoginSettings 无 Set-Cookie 不应成功: %#v", res)
}
if !strings.Contains(res.NewCookies, "sgcookie=s1") || !strings.Contains(res.NewCookies, "_m_h5_tk=tk_1") {
t.Fatalf("部分 Cookie 更新未保留: %q", res.NewCookies)
}
}
func TestRenewAPIFirstSkipsHasLoginWithoutUNB(t *testing.T) {
calls := 0
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls++
_, _ = w.Write([]byte(`{"content":{"success":true}}`))
}))
defer srv.Close()
svc := Service{
HTTPClient: srv.Client(),
HasLoginURL: srv.URL + "/hasLogin.do",
SilentHasLoginURL: srv.URL + "/silentHasLogin.do",
SetLoginSettingsURL: srv.URL + "/setLoginSettings.do",
}
_, err := svc.RenewAPIFirst(context.Background(), "cookie2=c2")
if err != nil {
t.Fatalf("RenewAPIFirst: %v", err)
}
if calls != 2 {
t.Fatalf("缺少 unb 时 hasLogin 应跳过,只调用后两步,calls=%d", calls)
}
}