修复:集成聊天图片预览与真实尺寸发送

This commit is contained in:
Christ committed 2026-08-18 15:08:37 +08:00
1 parent 9eb6be2875
commit ee228381cf
36 files changed
+331 -83

No files matched your search

+69
View File
@@ -76,6 +76,9 @@ describe('useChat', /* 当前回调处理聊天加载、分页、发送和实时
vi.stubGlobal('WebSocket', websocketFactory); vi.stubGlobal('WebSocket', websocketFactory);
// localStorageStub 是聊天 Hook 记忆账号选择所需的浏览器存储替身。 // localStorageStub 是聊天 Hook 记忆账号选择所需的浏览器存储替身。
Object.defineProperty(window, 'localStorage', { configurable: true, value: { getItem: vi.fn().mockReturnValue(''), setItem: vi.fn(), removeItem: vi.fn() } }); Object.defineProperty(window, 'localStorage', { configurable: true, value: { getItem: vi.fn().mockReturnValue(''), setItem: vi.fn(), removeItem: vi.fn() } });
// createObjectURLMock 和 revokeObjectURLMock 模拟浏览器图片预览地址的创建与释放。
Object.defineProperty(URL, 'createObjectURL', { configurable: true, value: vi.fn(/* 当前回调为测试图片生成稳定的临时地址。 */ (file: File) => `blob:${file.name}`) });
Object.defineProperty(URL, 'revokeObjectURL', { configurable: true, value: vi.fn() });
}); });
test('加载账号、会话和消息后可以发送文字与图片', /* 当前回调验证聊天 Hook 成功加载和发送路径。 */ async () => { test('加载账号、会话和消息后可以发送文字与图片', /* 当前回调验证聊天 Hook 成功加载和发送路径。 */ async () => {
@@ -123,6 +126,11 @@ describe('useChat', /* 当前回调处理聊天加载、分页、发送和实时
// imageAction 提交图片消息。 // imageAction 提交图片消息。
async () => hook.result.current.handleImage(new File(['image'], 'image.png', { type: 'image/png' })), async () => hook.result.current.handleImage(new File(['image'], 'image.png', { type: 'image/png' })),
); );
expect(hook.result.current.pendingImage?.url).toBe('blob:image.png');
await act(
// confirmImageAction 确认预览后提交图片消息。
async () => hook.result.current.confirmSendImage(),
);
expect(sendImageMock).toHaveBeenCalledWith(expect.objectContaining({ chat_id: 'chat-1', image: expect.any(File) }), expect.objectContaining({ signal: expect.any(AbortSignal) })); expect(sendImageMock).toHaveBeenCalledWith(expect.objectContaining({ chat_id: 'chat-1', image: expect.any(File) }), expect.objectContaining({ signal: expect.any(AbortSignal) }));
// imageInput 是图片发送成功后需要清空的输入框替身。 // imageInput 是图片发送成功后需要清空的输入框替身。
const imageInput = { value: 'selected-file' } as HTMLInputElement; const imageInput = { value: 'selected-file' } as HTMLInputElement;
@@ -131,6 +139,10 @@ describe('useChat', /* 当前回调处理聊天加载、分页、发送和实时
// secondImageAction 再次发送图片以验证输入框清理。 // secondImageAction 再次发送图片以验证输入框清理。
async () => hook.result.current.handleImage(new File(['image'], 'second.png', { type: 'image/png' })), async () => hook.result.current.handleImage(new File(['image'], 'second.png', { type: 'image/png' })),
); );
await act(
// confirmSecondImageAction 确认第二张图片并验证发送后的输入清理。
async () => hook.result.current.confirmSendImage(),
);
expect(imageInput.value).toBe(''); expect(imageInput.value).toBe('');
await act( await act(
// emptyImageAction 在没有图片文件时阻止发送。 // emptyImageAction 在没有图片文件时阻止发送。
@@ -335,6 +347,10 @@ describe('useChat', /* 当前回调处理聊天加载、分页、发送和实时
// imageErrorAction 触发图片发送错误。 // imageErrorAction 触发图片发送错误。
async () => hook.result.current.handleImage(new File(['image'], 'error.png', { type: 'image/png' })), async () => hook.result.current.handleImage(new File(['image'], 'error.png', { type: 'image/png' })),
); );
await act(
// confirmImageErrorAction 确认预览并进入图片发送错误分支。
async () => hook.result.current.confirmSendImage(),
);
expect(hook.result.current.error).toBe('图片发送失败'); expect(hook.result.current.error).toBe('图片发送失败');
expect(hook.result.current.retryAvailable).toBe(true); expect(hook.result.current.retryAvailable).toBe(true);
sendImageMock.mockResolvedValueOnce({ message: sentMessageFixture }); sendImageMock.mockResolvedValueOnce({ message: sentMessageFixture });
@@ -361,6 +377,59 @@ describe('useChat', /* 当前回调处理聊天加载、分页、发送和实时
hook.unmount(); hook.unmount();
}); });
test('图片预览取消和卸载都会释放临时对象地址', /* 当前回调验证图片预览资源不会跨会话泄漏。 */ async () => {
// hook 是图片预览资源生命周期测试使用的聊天 Hook。
const hook = renderHook(
// chatHookFactory 创建图片预览测试 Hook。
() => useChat(),
);
await waitFor(
// loadingAssertion 等待图片预览测试完成初始加载。
() => expect(hook.result.current.activeChatID).toBe('chat-1'),
);
await act(
// previewAction 创建第一张图片预览。
async () => hook.result.current.handleImage(new File(['image'], 'cancel.png', { type: 'image/png' })),
);
await act(
// closeAction 取消预览并释放第一张图片地址。
() => hook.result.current.closeImagePreview(),
);
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:cancel.png');
await act(
// secondPreviewAction 通过剪贴板入口创建第二张图片预览。
async () => hook.result.current.handlePastedImages([new File(['image'], 'unmount.png', { type: 'image/png' })]),
);
hook.unmount();
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:unmount.png');
});
test('切换会话会使旧图片预览失效', /* 当前回调验证旧会话图片不能误发到新会话。 */ async () => {
// hook 是会话切换预览隔离测试使用的聊天 Hook。
const hook = renderHook(
// chatHookFactory 创建会话切换测试 Hook。
() => useChat(),
);
await waitFor(
// chatAssertion 等待默认会话准备完成。
() => expect(hook.result.current.activeChatID).toBe('chat-1'),
);
await act(
// previewAction 在原会话创建图片预览。
async () => hook.result.current.handleImage(new File(['image'], 'switch.png', { type: 'image/png' })),
);
await act(
// switchAction 切换到另一个会话,使原预览不可再发送。
() => hook.result.current.setActiveChatID('chat-2'),
);
await waitFor(
// previewAssertion 等待旧会话预览被清理。
() => expect(hook.result.current.pendingImage).toBeNull(),
);
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:switch.png');
hook.unmount();
});
test('运行状态轮询失败后仍继续调度下一次轮询', /* 当前回调验证运行状态轮询失败的容错与重试。 */ async () => { test('运行状态轮询失败后仍继续调度下一次轮询', /* 当前回调验证运行状态轮询失败的容错与重试。 */ async () => {
vi.useFakeTimers(); vi.useFakeTimers();
try { try {
+63 -5
View File
@@ -6,8 +6,18 @@ import { getAccountDetails, getAccountRuntimeStatuses, getChatMessagePage, getCh
import { collectChatReadReceipts, filterChatSessions, formatClock, isChatAbortError, isCurrentChatRequest, mergeLiveMessage, mergeOlderMessages, messageTime } from './state'; import { collectChatReadReceipts, filterChatSessions, formatClock, isChatAbortError, isCurrentChatRequest, mergeLiveMessage, mergeOlderMessages, messageTime } from './state';
import type { ChatFeatureState, ChatLiveState, SessionsByAccount } from './types'; import type { ChatFeatureState, ChatLiveState, SessionsByAccount } from './types';
/** PendingImagePreview 描述等待用户确认的本地图片预览及其资源所有权。 */
type PendingImagePreview = {
/** file 保存当前预览会话待发送的图片文件。 */
file: File;
/** url 保存由浏览器创建、仅在当前预览会话有效的临时地址。 */
url: string;
};
/** Chat Hook 对外暴露的状态、引用和交互动作。 */ /** Chat Hook 对外暴露的状态、引用和交互动作。 */
export type UseChatResult = ChatFeatureState & { export type UseChatResult = ChatFeatureState & {
/** 待确认发送的图片预览;URL 仅在当前预览会话内有效。 */
pendingImage: PendingImagePreview | null;
/** 当前选中的会话 ID。 */ /** 当前选中的会话 ID。 */
activeChatID: string; activeChatID: string;
/** 当前账号过滤后的会话。 */ /** 当前账号过滤后的会话。 */
@@ -40,6 +50,12 @@ export type UseChatResult = ChatFeatureState & {
handleSend: () => Promise<void>; handleSend: () => Promise<void>;
/** 发送图片消息。 */ /** 发送图片消息。 */
handleImage: (file?: File) => Promise<void>; handleImage: (file?: File) => Promise<void>;
/** 从剪贴板候选文件中选择首张图片进入预览。 */
handlePastedImages: (files: File[]) => Promise<void>;
/** 确认发送当前预览图片。 */
confirmSendImage: () => Promise<void>;
/** 取消当前图片预览并释放临时地址。 */
closeImagePreview: () => void;
/** 重试最近一次失败发送。 */ /** 重试最近一次失败发送。 */
retrySend: () => Promise<void>; retrySend: () => Promise<void>;
/** 是否存在可重试的发送动作。 */ /** 是否存在可重试的发送动作。 */
@@ -76,6 +92,8 @@ export const useChat = (): UseChatResult => {
const [unreadOnly, setUnreadOnly] = useState(false); const [unreadOnly, setUnreadOnly] = useState(false);
// draft 保存待发送文本。 // draft 保存待发送文本。
const [draft, setDraft] = useState(''); const [draft, setDraft] = useState('');
// pendingImage 保存等待用户确认的本地图片和临时预览地址。
const [pendingImage, setPendingImage] = useState<PendingImagePreview | null>(null);
// loading 表示聊天初始数据加载状态。 // loading 表示聊天初始数据加载状态。
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
// messagesLoading 表示当前会话消息加载状态。 // messagesLoading 表示当前会话消息加载状态。
@@ -305,6 +323,11 @@ export const useChat = (): UseChatResult => {
sendSequence.current += 1; sendSequence.current += 1;
}, [activeAccountID, activeChatID]); }, [activeAccountID, activeChatID]);
useEffect(/* 当前回调使会话切换前创建的图片预览失效。 */ () => {
// 会话或账号切换后不得把旧预览发送到新会话。
setPendingImage(null);
}, [activeAccountID, activeChatID]);
useEffect(/* 当前回调同步 React 副作用和资源生命周期。 */ () => { useEffect(/* 当前回调同步 React 副作用和资源生命周期。 */ () => {
// 会话切换时取消历史分页;新的消息加载拥有独立控制器,不能复用这个低优先级请求。 // 会话切换时取消历史分页;新的消息加载拥有独立控制器,不能复用这个低优先级请求。
olderSequence.current += 1; olderSequence.current += 1;
@@ -321,6 +344,14 @@ export const useChat = (): UseChatResult => {
sendController.current?.abort(); sendController.current?.abort();
}, []); }, []);
useEffect(/* 当前回调负责图片预览临时地址的生命周期清理。 */ () => {
// preview 保存本次渲染仍然拥有的图片预览;状态替换或组件卸载时释放地址。
const preview = pendingImage;
return /* 当前回调释放已不再使用的图片对象地址。 */ () => {
if (preview) URL.revokeObjectURL(preview.url);
};
}, [pendingImage]);
/** 加载当前会话更早消息并保持滚动位置。 */ /** 加载当前会话更早消息并保持滚动位置。 */
const loadOlderMessages = useCallback(/* 当前回调封装可复用的交互处理逻辑。 */ async (): Promise<void> => { const loadOlderMessages = useCallback(/* 当前回调封装可复用的交互处理逻辑。 */ async (): Promise<void> => {
if (!activeAccountID || !activeChatID || olderLoading || !hasOlder) return; if (!activeAccountID || !activeChatID || olderLoading || !hasOlder) return;
@@ -561,11 +592,38 @@ export const useChat = (): UseChatResult => {
await sendText(text, true); await sendText(text, true);
}, [activeAccountID, draft, selectedSession, sendText, sending]); }, [activeAccountID, draft, selectedSession, sendText, sending]);
/** 处理图片选择并发送。 */ /** 处理图片选择并进入确认预览,不直接触发平台发送。 */
const handleImage = useCallback(/* 当前回调封装可复用的交互处理逻辑。 */ async (file?: File): Promise<void> => { const handleImage = useCallback(/* 当前回调接收文件选择结果并创建图片预览。 */ async (file?: File): Promise<void> => {
if (!file || !selectedSession || !activeAccountID || sending) return; if (!file || !selectedSession || !activeAccountID || sending) return;
if (!file.type.startsWith('image/')) {
setError('仅支持粘贴/发送图片文件');
return;
}
setError('');
setPendingImage({ file, url: URL.createObjectURL(file) });
}, [activeAccountID, selectedSession, sending]);
/** 从剪贴板文件中选择首张图片,其余文件仍由原生文本粘贴流程处理。 */
const handlePastedImages = useCallback(/* 当前回调从剪贴板候选文件中筛选图片。 */ async (files: File[]): Promise<void> => {
// image 保存剪贴板中的首张图片,只有图片才会阻止原生文本粘贴。
const image = files.find(/* 当前回调判断文件是否为图片。 */ file => file.type.startsWith('image/'));
if (image) await handleImage(image);
}, [handleImage]);
/** 关闭图片预览并清空文件输入,使同一文件可以再次触发选择事件。 */
const closeImagePreview = useCallback(/* 当前回调关闭预览并清理文件输入。 */ (): void => {
setPendingImage(null);
if (imageInputRef.current) imageInputRef.current.value = '';
}, []);
/** 确认发送当前预览图片,发送流程沿用已有请求代次和失败重试保护。 */
const confirmSendImage = useCallback(/* 当前回调提交用户确认的图片预览。 */ async (): Promise<void> => {
if (!pendingImage || !selectedSession || !activeAccountID || sending) return;
// file 保存用户确认后要提交的平台图片文件。
const file = pendingImage.file;
setPendingImage(null);
await sendImage(file, true); await sendImage(file, true);
}, [activeAccountID, selectedSession, sendImage, sending]); }, [activeAccountID, pendingImage, selectedSession, sendImage, sending]);
/** 重试最近一次失败的文本或图片发送。 */ /** 重试最近一次失败的文本或图片发送。 */
const retrySend = useCallback(/* 当前回调封装可复用的交互处理逻辑。 */ async (): Promise<void> => { const retrySend = useCallback(/* 当前回调封装可复用的交互处理逻辑。 */ async (): Promise<void> => {
@@ -574,9 +632,9 @@ export const useChat = (): UseChatResult => {
}, [retryImage, retryText, sendImage, sendText]); }, [retryImage, retryText, sendImage, sendText]);
return { return {
accounts, activeAccountID, activeSessions, selectedSession, activeAccount, messages, search, unreadOnly, draft, loading, messagesLoading, olderLoading, hasOlder, contactsLoading, hasMoreContacts: hasMoreContacts[activeAccountID] === true, emojiOpen, sending, error, liveState, accounts, activeAccountID, activeSessions, selectedSession, activeAccount, messages, search, unreadOnly, draft, loading, messagesLoading, olderLoading, hasOlder, contactsLoading, hasMoreContacts: hasMoreContacts[activeAccountID] === true, emojiOpen, sending, error, liveState, pendingImage,
activeChatID, filteredSessions, scrollRef, imageInputRef, setActiveAccountID, setActiveChatID, setSearch, setUnreadOnly, setDraft, setEmojiOpen, activeChatID, filteredSessions, scrollRef, imageInputRef, setActiveAccountID, setActiveChatID, setSearch, setUnreadOnly, setDraft, setEmojiOpen,
reloadSessions, loadMoreContacts, loadOlderMessages, handleMessageScroll, handleSend, handleImage, retrySend, retryAvailable: Boolean(retryText || retryImage), unreadForAccount, reloadSessions, loadMoreContacts, loadOlderMessages, handleMessageScroll, handleSend, handleImage, handlePastedImages, confirmSendImage, closeImagePreview, retrySend, retryAvailable: Boolean(retryText || retryImage), unreadForAccount,
emojiURL, xianyuEmojis, renderXianyuText, formatClock, messageTime, emojiURL, xianyuEmojis, renderXianyuText, formatClock, messageTime,
}; };
}; };
+48 -6
View File
@@ -1,8 +1,10 @@
import React from 'react'; import React from 'react';
import { import {
AlertCircle, Check, CheckCheck, ImagePlus, Loader2, MessageCircleMore, RefreshCw, AlertCircle, Check, CheckCheck, ImagePlus, Loader2, MessageCircleMore, RefreshCw,
Search, Send, Smile, UserRound, Wifi, WifiOff, Search, Send, Smile, UserRound, Wifi, WifiOff, X,
} from 'lucide-react'; } from 'lucide-react';
import Lightbox from 'yet-another-react-lightbox';
import 'yet-another-react-lightbox/styles.css';
import { useChat } from '../hooks'; import { useChat } from '../hooks';
import { unreadBadgeClassName, unreadBadgeLabel } from '../state'; import { unreadBadgeClassName, unreadBadgeLabel } from '../state';
@@ -12,12 +14,23 @@ const Chat: React.FC = () => {
const { const {
accounts, activeAccountID, activeChatID, activeAccount, selectedSession, filteredSessions, accounts, activeAccountID, activeChatID, activeAccount, selectedSession, filteredSessions,
messages, search, unreadOnly, draft, loading, messagesLoading, olderLoading, hasOlder, contactsLoading, messages, search, unreadOnly, draft, loading, messagesLoading, olderLoading, hasOlder, contactsLoading,
hasMoreContacts, emojiOpen, sending, error, liveState, scrollRef, imageInputRef, setActiveAccountID, hasMoreContacts, emojiOpen, sending, error, liveState, pendingImage, scrollRef, imageInputRef, setActiveAccountID,
setActiveChatID, setSearch, setUnreadOnly, setDraft, setEmojiOpen, reloadSessions, loadMoreContacts, setActiveChatID, setSearch, setUnreadOnly, setDraft, setEmojiOpen, reloadSessions, loadMoreContacts,
loadOlderMessages, handleMessageScroll, handleSend, handleImage, retrySend, retryAvailable, loadOlderMessages, handleMessageScroll, handleSend, handleImage, handlePastedImages, confirmSendImage, closeImagePreview, retrySend, retryAvailable,
unreadForAccount, emojiURL, xianyuEmojis, renderXianyuText, formatClock, messageTime, unreadForAccount, emojiURL, xianyuEmojis, renderXianyuText, formatClock, messageTime,
} = useChat(); } = useChat();
// imageMessages 保存当前会话中的图片消息,供灯箱按消息顺序浏览。
const imageMessages = React.useMemo(/* 当前回调筛选当前会话中的图片消息。 */ () => messages.filter(/* 当前回调判断消息是否为图片类型。 */ message => message.message_type === 'image'), [messages]);
// imageSlides 将聊天图片转换为灯箱组件所需的展示模型。
const imageSlides = React.useMemo(/* 当前回调构造灯箱图片展示数据。 */ () => imageMessages.map(/* 当前回调转换单条图片消息。 */ message => ({ src: message.content, alt: '聊天图片' })), [imageMessages]);
// lightboxIndex 保存当前灯箱图片下标;负值表示灯箱关闭。
const [lightboxIndex, setLightboxIndex] = React.useState(-1);
// openLightbox 根据消息键打开对应的图片灯箱。
const openLightbox = React.useCallback(/* 当前回调定位并打开指定聊天图片。 */ (messageKey: string): void => {
setLightboxIndex(imageMessages.findIndex(/* 当前回调匹配图片消息键。 */ item => item.message_key === messageKey));
}, [imageMessages]);
if (loading) return <div className="flex h-[calc(100vh-4rem)] items-center justify-center"><Loader2 className="h-8 w-8 animate-spin text-sky-500" /></div>; if (loading) return <div className="flex h-[calc(100vh-4rem)] items-center justify-center"><Loader2 className="h-8 w-8 animate-spin text-sky-500" /></div>;
return ( return (
@@ -153,9 +166,9 @@ const Chat: React.FC = () => {
<div className={`max-w-[72%] ${outgoing ? 'items-end' : 'items-start'} flex flex-col`}> <div className={`max-w-[72%] ${outgoing ? 'items-end' : 'items-start'} flex flex-col`}>
<div className="mb-1 px-1 text-[10px] font-semibold text-slate-400">{outgoing ? (activeAccount?.nickname || activeAccount?.remark || '我') : (selectedSession.buyer_name || message.sender_name || selectedSession.buyer_id)}</div> <div className="mb-1 px-1 text-[10px] font-semibold text-slate-400">{outgoing ? (activeAccount?.nickname || activeAccount?.remark || '我') : (selectedSession.buyer_name || message.sender_name || selectedSession.buyer_id)}</div>
{message.message_type === 'image' ? ( {message.message_type === 'image' ? (
<a href={message.content} target="_blank" rel="noreferrer" className={`block overflow-hidden rounded-2xl border bg-white p-1 shadow-sm ${outgoing ? 'rounded-br-md border-sky-200' : 'rounded-bl-md border-slate-200'}`}> <button type="button" title="点击预览大图" onClick={openLightbox.bind(null, message.message_key)} className={`block cursor-zoom-in overflow-hidden rounded-2xl border bg-white p-1 text-left shadow-sm ${outgoing ? 'rounded-br-md border-sky-200' : 'rounded-bl-md border-slate-200'}`}>
<img src={message.content} alt="聊天图片" className="max-h-80 max-w-full rounded-xl object-contain" /> <img src={message.content} alt="聊天图片" className="max-h-80 max-w-full rounded-xl object-contain" />
</a> </button>
) : message.message_type === 'video' ? ( ) : message.message_type === 'video' ? (
<video src={message.content} controls preload="metadata" className="max-h-80 max-w-full rounded-2xl bg-black" /> <video src={message.content} controls preload="metadata" className="max-h-80 max-w-full rounded-2xl bg-black" />
) : ( ) : (
@@ -192,7 +205,17 @@ const Chat: React.FC = () => {
<div className="flex items-end gap-3 rounded-2xl border border-slate-200 bg-slate-50 p-2 transition focus-within:border-sky-400 focus-within:ring-2 focus-within:ring-sky-100"> <div className="flex items-end gap-3 rounded-2xl border border-slate-200 bg-slate-50 p-2 transition focus-within:border-sky-400 focus-within:ring-2 focus-within:ring-sky-100">
<textarea value={draft} onChange={/* 当前回调处理用户交互或异步状态变化。 */ event => setDraft(event.target.value)} rows={2} maxLength={2000} <textarea value={draft} onChange={/* 当前回调处理用户交互或异步状态变化。 */ event => setDraft(event.target.value)} rows={2} maxLength={2000}
onKeyDown={/* 当前回调处理用户交互或异步状态变化。 */ event => { if (event.key === 'Enter' && !event.shiftKey) { event.preventDefault(); void handleSend(); } }} onKeyDown={/* 当前回调处理用户交互或异步状态变化。 */ event => { if (event.key === 'Enter' && !event.shiftKey) { event.preventDefault(); void handleSend(); } }}
disabled={activeAccount?.runtime_state !== 'online'} placeholder={activeAccount?.runtime_state === 'online' ? '输入消息,Enter 发送,Shift + Enter 换行' : '账号离线,暂时无法发送'} onPaste={/* 当前回调识别剪贴板中的图片并进入预览流程。 */ event => {
// files 保存剪贴板提供的文件候选列表。
const files = Array.from(event.clipboardData?.files || []);
// image 保存候选列表中的首张图片。
const image = files.find(/* 当前回调判断剪贴板文件是否为图片。 */ file => file.type.startsWith('image/'));
if (image) {
event.preventDefault();
void handlePastedImages(files);
}
}}
disabled={activeAccount?.runtime_state !== 'online'} placeholder={activeAccount?.runtime_state === 'online' ? '输入消息,Enter 发送,Shift + Enter 换行,Ctrl + V 粘贴图片' : '账号离线,暂时无法发送'}
className="max-h-32 min-h-12 flex-1 resize-none bg-transparent px-2 py-2 text-sm leading-6 outline-none disabled:cursor-not-allowed" /> className="max-h-32 min-h-12 flex-1 resize-none bg-transparent px-2 py-2 text-sm leading-6 outline-none disabled:cursor-not-allowed" />
<button type="button" onClick={/* 当前回调处理用户交互或异步状态变化。 */ () => void handleSend()} disabled={!draft.trim() || sending || activeAccount?.runtime_state !== 'online'} className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-sky-500 text-white shadow-md shadow-sky-100 transition hover:bg-sky-600 disabled:cursor-not-allowed disabled:bg-slate-300 disabled:shadow-none" aria-label="发送消息"> <button type="button" onClick={/* 当前回调处理用户交互或异步状态变化。 */ () => void handleSend()} disabled={!draft.trim() || sending || activeAccount?.runtime_state !== 'online'} className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-sky-500 text-white shadow-md shadow-sky-100 transition hover:bg-sky-600 disabled:cursor-not-allowed disabled:bg-slate-300 disabled:shadow-none" aria-label="发送消息">
{sending ? <Loader2 className="h-4 w-4 animate-spin" /> : <Send className="h-4 w-4" />} {sending ? <Loader2 className="h-4 w-4 animate-spin" /> : <Send className="h-4 w-4" />}
@@ -210,6 +233,25 @@ const Chat: React.FC = () => {
</main> </main>
</div> </div>
)} )}
{pendingImage && <div className="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/60 p-4" onClick={/* 当前回调点击遮罩取消图片预览。 */ closeImagePreview}>
<div className="flex max-h-full w-full max-w-2xl flex-col overflow-hidden rounded-2xl bg-white shadow-2xl" onClick={/* 当前回调阻止预览内容点击冒泡到遮罩。 */ event => event.stopPropagation()}>
<div className="flex shrink-0 items-center justify-between border-b border-slate-200 px-5 py-3">
<div className="text-sm font-black text-slate-900">发送图片预览</div>
<button type="button" title="取消" onClick={/* 当前回调关闭图片预览。 */ closeImagePreview} className="rounded-lg p-1.5 text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"><X className="h-5 w-5" /></button>
</div>
<div className="flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-slate-100 p-4"><img src={pendingImage.url} alt="待发送图片预览" className="max-h-[55vh] max-w-full rounded-xl object-contain" /></div>
<div className="flex shrink-0 items-center justify-between gap-3 border-t border-slate-200 px-5 py-3">
<div className="min-w-0 truncate text-xs text-slate-500">{pendingImage.file.name || '粘贴的图片'} · {(pendingImage.file.size / 1024).toFixed(0)} KB</div>
<div className="flex shrink-0 items-center gap-2">
<button type="button" onClick={/* 当前回调取消图片发送。 */ closeImagePreview} className="rounded-xl px-4 py-2 text-sm font-bold text-slate-600 transition hover:bg-slate-100">取消</button>
<button type="button" onClick={/* 当前回调确认发送预览图片。 */ () => void confirmSendImage()} disabled={sending || activeAccount?.runtime_state !== 'online'} className="flex items-center gap-2 rounded-xl bg-sky-500 px-4 py-2 text-sm font-bold text-white shadow-md shadow-sky-100 transition hover:bg-sky-600 disabled:cursor-not-allowed disabled:opacity-50">{sending ? <Loader2 className="h-4 w-4 animate-spin" /> : <Send className="h-4 w-4" />}发送</button>
</div>
</div>
</div>
</div>}
<Lightbox open={lightboxIndex >= 0} index={Math.max(lightboxIndex, 0)} close={/* 当前回调关闭图片灯箱。 */ () => setLightboxIndex(-1)} slides={imageSlides} />
</section> </section>
); );
}; };
+29 -2
View File
@@ -12,7 +12,8 @@
"lucide-react": "^0.562.0", "lucide-react": "^0.562.0",
"react": "^19.2.3", "react": "^19.2.3",
"react-dom": "^19.2.3", "react-dom": "^19.2.3",
"recharts": "^3.6.0" "recharts": "^3.6.0",
"yet-another-react-lightbox": "^3.32.2"
}, },
"devDependencies": { "devDependencies": {
"@testing-library/react": "^16.3.2", "@testing-library/react": "^16.3.2",
@@ -1757,7 +1758,7 @@
"version": "19.2.3", "version": "19.2.3",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
"dev": true, "devOptional": true,
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"@types/react": "^19.2.0" "@types/react": "^19.2.0"
@@ -4754,6 +4755,32 @@
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
},
"node_modules/yet-another-react-lightbox": {
"version": "3.32.2",
"resolved": "https://registry.npmjs.org/yet-another-react-lightbox/-/yet-another-react-lightbox-3.32.2.tgz",
"integrity": "sha512-F4HtHQfUNpvkj+AmECgWM4XRdCqMY5gXpKgOUx39+T+FyxLe8II4SK/pwMyYj2X54KH9lFSQeHYY1/GfYf3SdA==",
"license": "MIT",
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/igordanchenko"
},
"peerDependencies": {
"@types/react": "^16 || ^17 || ^18 || ^19",
"@types/react-dom": "^16 || ^17 || ^18 || ^19",
"react": "^16.8.0 || ^17 || ^18 || ^19",
"react-dom": "^16.8.0 || ^17 || ^18 || ^19"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
} }
} }
} }
+2 -1
View File
@@ -17,7 +17,8 @@
"lucide-react": "^0.562.0", "lucide-react": "^0.562.0",
"react": "^19.2.3", "react": "^19.2.3",
"react-dom": "^19.2.3", "react-dom": "^19.2.3",
"recharts": "^3.6.0" "recharts": "^3.6.0",
"yet-another-react-lightbox": "^3.32.2"
}, },
"devDependencies": { "devDependencies": {
"@testing-library/react": "^16.3.2", "@testing-library/react": "^16.3.2",
+14
View File
@@ -266,5 +266,19 @@ func TestChatImageUploaderRejectsUnsupportedAndEmptyPlatformResults(t *testing.T
} }
} }
// TestChatImageUploaderPreservesPlatformDimensions 验证图片尺寸从 MTOP 结果映射到应用端口且不被丢弃。
func TestChatImageUploaderPreservesPlatformDimensions(t *testing.T) {
// store、cleanup 保存包含测试账号凭证的临时数据库及清理函数。
store, cleanup := newAdapterTestStore(t)
defer cleanup()
// client 返回带真实像素尺寸的平台上传结果。
client := fakeChatUploadClient{upload: &mtop.ChatImageUpload{URL: "https://cdn.example/image.jpg", Width: 1920, Height: 1080}}
// upload 保存应用适配器转换后的非敏感图片结果。
upload, err := NewChatImageUploader(store, func() mtop.Client { return client }, nil).UploadChatImage(context.Background(), "cid", "a.jpg", "image/jpeg", []byte("image"))
if err != nil || upload.URL == "" || upload.Width != 1920 || upload.Height != 1080 {
t.Fatalf("upload=%+v err=%v", upload, err)
}
}
var _ chatapp.SessionRepository = chatRepository{} var _ chatapp.SessionRepository = chatRepository{}
var _ chatapp.IdentityResolver = chatIdentityResolver{} var _ chatapp.IdentityResolver = chatIdentityResolver{}
+3 -3
View File
@@ -132,11 +132,11 @@ func (s chatSender) SendText(ctx context.Context, chatID, toUserID, text, messag
} }
// SendImage 发送图片并将应用层幂等键传递给运行时接口。 // SendImage 发送图片并将应用层幂等键传递给运行时接口。
func (s chatSender) SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64, messageKey string) error { func (s chatSender) SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64, width, height int, messageKey string) error {
if s.sender == nil { if s.sender == nil {
return chatapp.ErrUnavailable return chatapp.ErrUnavailable
} }
return s.sender.SendImage(engine.WithOutgoingMessageKey(ctx, messageKey), chatID, toUserID, imageURL, cardID) return s.sender.SendImage(engine.WithOutgoingMessageKey(ctx, messageKey), chatID, toUserID, imageURL, cardID, width, height)
} }
// chatCredentialRepository 将 Cookie 读取与写回限制在平台适配器内。 // chatCredentialRepository 将 Cookie 读取与写回限制在平台适配器内。
@@ -216,7 +216,7 @@ func (u chatImageUploader) UploadChatImage(ctx context.Context, accountID, filen
} }
} }
} }
return chatapp.ImageUpload{URL: upload.URL}, nil return chatapp.ImageUpload{URL: upload.URL, Width: upload.Width, Height: upload.Height}, nil
} }
// 编译期确认聊天实时适配器覆盖应用层定义的全部能力。 // 编译期确认聊天实时适配器覆盖应用层定义的全部能力。
+6 -2
View File
@@ -45,6 +45,10 @@ type ImageInput struct {
type ImageUpload struct { type ImageUpload struct {
// URL 保存可供聊天发送的图片地址。 // URL 保存可供聊天发送的图片地址。
URL string URL string
// Width 保存平台识别出的图片宽度,单位为像素;非正值表示使用协议默认尺寸。
Width int
// Height 保存平台识别出的图片高度,单位为像素;非正值表示使用协议默认尺寸。
Height int
} }
// OutgoingRepository 定义发送用例需要的本地消息写入能力。 // OutgoingRepository 定义发送用例需要的本地消息写入能力。
@@ -62,7 +66,7 @@ type Sender interface {
// SendText 发送文本;messageKey 用于将平台旁路事件与待发送消息关联。 // SendText 发送文本;messageKey 用于将平台旁路事件与待发送消息关联。
SendText(ctx context.Context, chatID, toUserID, text, messageKey string) error SendText(ctx context.Context, chatID, toUserID, text, messageKey string) error
// SendImage 发送图片;messageKey 用于将平台旁路事件与待发送消息关联。 // SendImage 发送图片;messageKey 用于将平台旁路事件与待发送消息关联。
SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64, messageKey string) error SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64, width, height int, messageKey string) error
} }
// SenderProvider 按账号标识解析当前在线发送实例。 // SenderProvider 按账号标识解析当前在线发送实例。
@@ -219,7 +223,7 @@ func (s *Service) SendImage(ctx context.Context, input ImageInput) (*Message, er
return nil, fmt.Errorf("保存待发送图片失败: %w", err) return nil, fmt.Errorf("保存待发送图片失败: %w", err)
} }
// sendErr 表示平台图片发送失败;失败分支会补写本地 failed 状态。 // sendErr 表示平台图片发送失败;失败分支会补写本地 failed 状态。
if sendErr := sender.SendImage(ctx, session.ChatID, session.BuyerID, upload.URL, 0, message.MessageKey); sendErr != nil { if sendErr := sender.SendImage(ctx, session.ChatID, session.BuyerID, upload.URL, 0, upload.Width, upload.Height, message.MessageKey); sendErr != nil {
// failed 保存图片发送失败后的本地状态。 // failed 保存图片发送失败后的本地状态。
failed, _ := s.outgoing.SetOutgoingStatus(context.Background(), session.AccountID, message.MessageKey, "failed") failed, _ := s.outgoing.SetOutgoingStatus(context.Background(), session.AccountID, message.MessageKey, "failed")
return messagePointer(failed, message), fmt.Errorf("%w: %v", ErrSend, sendErr) return messagePointer(failed, message), fmt.Errorf("%w: %v", ErrSend, sendErr)
+7 -3
View File
@@ -79,6 +79,8 @@ type sendSender struct {
sentKey string sentKey string
// updatedCookie 保存适配器同步的刷新凭证;测试只记录是否调用,不保存真实秘密。 // updatedCookie 保存适配器同步的刷新凭证;测试只记录是否调用,不保存真实秘密。
updatedCookie bool updatedCookie bool
// imageWidth、imageHeight 保存图片发送收到的像素尺寸。
imageWidth, imageHeight int
} }
// SendText 记录文本发送并返回预设错误。 // SendText 记录文本发送并返回预设错误。
@@ -88,7 +90,9 @@ func (s *sendSender) SendText(_ context.Context, _, _, _, messageKey string) err
} }
// SendImage 记录图片发送并返回预设错误。 // SendImage 记录图片发送并返回预设错误。
func (s *sendSender) SendImage(_ context.Context, _, _, _ string, _ int64, messageKey string) error { func (s *sendSender) SendImage(_ context.Context, _, _, _ string, _ int64, width, height int, messageKey string) error {
// imageWidth、imageHeight 记录应用层透传的平台图片尺寸。
s.imageWidth, s.imageHeight = width, height
s.sentKey = messageKey s.sentKey = messageKey
return s.sendErr return s.sendErr
} }
@@ -192,12 +196,12 @@ func TestSendImageDoesNotExposeCredentials(t *testing.T) {
// repository、sender、uploader 保存图片发送的测试端口。 // repository、sender、uploader 保存图片发送的测试端口。
repository, sender := &sendRepository{}, &sendSender{} repository, sender := &sendRepository{}, &sendSender{}
// uploader 保存固定图片地址的测试上传端口。 // uploader 保存固定图片地址的测试上传端口。
uploader := sendUploader{result: ImageUpload{URL: "https://cdn.example/image.jpg"}} uploader := sendUploader{result: ImageUpload{URL: "https://cdn.example/image.jpg", Width: 1280, Height: 720}}
// service 保存使用测试端口构造的聊天发送服务。 // service 保存使用测试端口构造的聊天发送服务。
service := NewWithSending(nil, repository, sendProvider{sender: sender}, uploader) service := NewWithSending(nil, repository, sendProvider{sender: sender}, uploader)
// message 和 err 保存图片发送结果。 // message 和 err 保存图片发送结果。
message, err := service.SendImage(context.Background(), ImageInput{Session: Session{AccountID: "acc-1", ChatID: "chat-1", BuyerID: "buyer-1"}, Filename: "a.jpg", ContentType: "image/jpeg", Data: []byte("image")}) message, err := service.SendImage(context.Background(), ImageInput{Session: Session{AccountID: "acc-1", ChatID: "chat-1", BuyerID: "buyer-1"}, Filename: "a.jpg", ContentType: "image/jpeg", Data: []byte("image")})
if err != nil || message == nil || message.Content != "https://cdn.example/image.jpg" || sender.sentKey != "local-image" { if err != nil || message == nil || message.Content != "https://cdn.example/image.jpg" || sender.sentKey != "local-image" || sender.imageWidth != 1280 || sender.imageHeight != 720 {
t.Fatalf("message=%+v err=%v key=%q", message, err, sender.sentKey) t.Fatalf("message=%+v err=%v key=%q", message, err, sender.sentKey)
} }
} }
+1 -1
View File
@@ -413,7 +413,7 @@ func (e *automationActionExecutor) sendImage(ctx context.Context, task Task, ima
if !senderOK { if !senderOK {
return fmt.Errorf("%w: 账号未在线,无法发送自动化图片", ErrMessageNotSent) return fmt.Errorf("%w: 账号未在线,无法发送自动化图片", ErrMessageNotSent)
} }
return sender.SendImage(ctx, task.ChatID, task.BuyerID, imageURL, cardID) return sender.SendImage(ctx, task.ChatID, task.BuyerID, imageURL, cardID, 0, 0)
} }
// cardContent 读取卡密组内容并拒绝不支持的卡密类型。 // cardContent 读取卡密组内容并拒绝不支持的卡密类型。
+1 -1
View File
@@ -49,7 +49,7 @@ func (s *blockingAutomationSender) SendText(context.Context, string, string, str
} }
// SendImage 满足消息发送接口;数据卡测试不会调用图片发送。 // SendImage 满足消息发送接口;数据卡测试不会调用图片发送。
func (s *blockingAutomationSender) SendImage(context.Context, string, string, string, int64) error { func (s *blockingAutomationSender) SendImage(context.Context, string, string, string, int64, int, int) error {
return nil return nil
} }
+1 -1
View File
@@ -67,7 +67,7 @@ type SenderProvider interface {
// MessageSender 是自动化动作需要的最小发送接口。 // MessageSender 是自动化动作需要的最小发送接口。
type MessageSender interface { type MessageSender interface {
SendText(ctx context.Context, chatID, toUserID, text string) error SendText(ctx context.Context, chatID, toUserID, text string) error
SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64) error SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64, width, height int) error
UpdateCookie(cookieStr string) UpdateCookie(cookieStr string)
} }
+3 -1
View File
@@ -411,7 +411,9 @@ func TestImageCardMissingSenderIsDefinitelyNotSent(t *testing.T) {
} }
// SendImage 封装Send图片业务协调。 // SendImage 封装Send图片业务协调。
func (s *testSender) SendImage(context.Context, string, string, string, int64) error { return nil } func (s *testSender) SendImage(context.Context, string, string, string, int64, int, int) error {
return nil
}
// UpdateCookie 更新登录凭证。 // UpdateCookie 更新登录凭证。
func (s *testSender) UpdateCookie(cookieStr string) { func (s *testSender) UpdateCookie(cookieStr string) {
+3 -2
View File
@@ -878,8 +878,9 @@ func (a *Account) MarkChatRead(ctx context.Context, chatID string, messageIDs []
} }
// SendImage 通过当前 WebSocket 给买家发送图片消息。当前仅支持可直接访问的 CDN/公网 URL。 // SendImage 通过当前 WebSocket 给买家发送图片消息。当前仅支持可直接访问的 CDN/公网 URL。
func (a *Account) SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64) error { // width/height 为图片真实尺寸,单位为像素;传入非正值时由 WebSocket 使用默认尺寸。
return a.outgoing.sendImage(ctx, chatID, toUserID, imageURL, cardID) func (a *Account) SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64, width, height int) error {
return a.outgoing.sendImage(ctx, chatID, toUserID, imageURL, cardID, width, height)
} }
// FetchChatHistory reuses the account's registered IM connection. Keeping this // FetchChatHistory reuses the account's registered IM connection. Keeping this
@@ -57,8 +57,8 @@ func (c *outgoingMessageCoordinator) sendText(ctx context.Context, chatID, toUse
} }
// sendImage 使用当前已注册 WebSocket 发送可直接访问的远程图片。 // sendImage 使用当前已注册 WebSocket 发送可直接访问的远程图片。
// ctx 是调用方取消边界;cardID 仅用于兼容 MessageSender 契约,当前协议发送不直接使用它。 // ctx 是调用方取消边界;cardID 仅用于兼容 MessageSender 契约,当前协议发送不直接使用它;width/height 为图片像素尺寸。
func (c *outgoingMessageCoordinator) sendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64) error { func (c *outgoingMessageCoordinator) sendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64, width, height int) error {
// a 是当前协调器绑定的账号 facade;它用于维持与文本发送一致的初始化检查。 // a 是当前协调器绑定的账号 facade;它用于维持与文本发送一致的初始化检查。
a := c.account a := c.account
if a == nil { if a == nil {
@@ -80,7 +80,7 @@ func (c *outgoingMessageCoordinator) sendImage(ctx context.Context, chatID, toUs
sendCtx, cancel := context.WithTimeout(ctx, 8*time.Second) sendCtx, cancel := context.WithTimeout(ctx, 8*time.Second)
defer cancel() defer cancel()
_ = cardID // cardID 由上层动作检查点持久化,协议图片发送本身不携带该字段。 _ = cardID // cardID 由上层动作检查点持久化,协议图片发送本身不携带该字段。
return conn.SendImage(sendCtx, myID, chatID, toUserID, imageURL, 800, 600) return conn.SendImage(sendCtx, myID, chatID, toUserID, imageURL, width, height)
} }
// currentSenderState 返回可用 WebSocket 与账号 unb 身份快照;持锁范围只覆盖快照读取。 // currentSenderState 返回可用 WebSocket 与账号 unb 身份快照;持锁范围只覆盖快照读取。
+2 -2
View File
@@ -37,7 +37,7 @@ type AIReplier interface {
// MessageSender 是回复服务发送文本/图片所需的最小接口。 // MessageSender 是回复服务发送文本/图片所需的最小接口。
type MessageSender interface { type MessageSender interface {
SendText(ctx context.Context, chatID, toUserID, text string) error SendText(ctx context.Context, chatID, toUserID, text string) error
SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64) error SendImage(ctx context.Context, chatID, toUserID, imageURL string, cardID int64, width, height int) error
} }
// ReplyService 单账号回复服务。 // ReplyService 单账号回复服务。
@@ -97,7 +97,7 @@ func (r *ReplyService) Handle(ctx context.Context, m ChatMessage) error {
} }
if res.ImageURL != "" && !record.ImageSent { if res.ImageURL != "" && !record.ImageSent {
if // err 用于本次流程后续判断的err if // err 用于本次流程后续判断的err
err := r.sender.SendImage(ctx, m.ChatID, m.SenderUserID, res.ImageURL, 0); err != nil { err := r.sender.SendImage(ctx, m.ChatID, m.SenderUserID, res.ImageURL, 0, 0, 0); err != nil {
r.logger.Error("发送回复图片失败", "err", err) r.logger.Error("发送回复图片失败", "err", err)
r.markReplyFailure(ctx, res, m, err) r.markReplyFailure(ctx, res, m, err)
return err return err
+1 -1
View File
@@ -63,7 +63,7 @@ func (r *recordingSender) SendText(_ context.Context, chatID, toUserID, text str
} }
// SendImage 封装Send图片业务协调。 // SendImage 封装Send图片业务协调。
func (r *recordingSender) SendImage(_ context.Context, chatID, toUserID, url string, cardID int64) error { func (r *recordingSender) SendImage(_ context.Context, chatID, toUserID, url string, cardID int64, _, _ int) error {
if r.imageErr != nil { if r.imageErr != nil {
return r.imageErr return r.imageErr
} }
+26 -1
View File
@@ -127,6 +127,8 @@ type fakeWSConn struct {
registeredTok string registeredTok string
sentTexts []string sentTexts []string
sentImages []string sentImages []string
imageWidths []int
imageHeights []int
heartbeatDone chan struct{} heartbeatDone chan struct{}
closeCh chan struct{} closeCh chan struct{}
closeOnce sync.Once closeOnce sync.Once
@@ -237,13 +239,36 @@ func (f *fakeWSConn) SendText(_ context.Context, _, _, _, text string) error {
} }
// SendImage 封装Send图片业务协调。 // SendImage 封装Send图片业务协调。
func (f *fakeWSConn) SendImage(_ context.Context, _, _, _, url string, _, _ int) error { func (f *fakeWSConn) SendImage(_ context.Context, _, _, _, url string, width, height int) error {
f.mu.Lock() f.mu.Lock()
f.sentImages = append(f.sentImages, url) f.sentImages = append(f.sentImages, url)
f.imageWidths = append(f.imageWidths, width)
f.imageHeights = append(f.imageHeights, height)
f.mu.Unlock() f.mu.Unlock()
return nil return nil
} }
// TestAccountSendImagePreservesDimensions 验证账号运行时将调用方提供的真实图片尺寸交给 WebSocket。
func TestAccountSendImagePreservesDimensions(t *testing.T) {
// account 是未启动但已具备账号身份的运行时对象。
account := New(Config{CookieID: "image-size-test", CookieStr: "unb=me"})
// conn 是记录图片 URL 和像素尺寸的 WebSocket 测试替身。
conn := &fakeWSConn{}
account.runtimeMu.Lock()
account.conn = conn
account.runtimeMu.Unlock()
// sendErr 表示账号运行时向 WebSocket 发送图片的结果。
sendErr := account.SendImage(context.Background(), "chat", "buyer", "https://cdn.example/image.jpg", 0, 1920, 1080)
if sendErr != nil {
t.Fatalf("SendImage() error=%v", sendErr)
}
conn.mu.Lock()
defer conn.mu.Unlock()
if len(conn.imageWidths) != 1 || conn.imageWidths[0] != 1920 || len(conn.imageHeights) != 1 || conn.imageHeights[0] != 1080 {
t.Fatalf("图片尺寸未透传 widths=%v heights=%v", conn.imageWidths, conn.imageHeights)
}
}
// fakeDialer 按预设序列返回连接或错误,第 N 次(1-based)调用返回 dialResults[N-1]。 // fakeDialer 按预设序列返回连接或错误,第 N 次(1-based)调用返回 dialResults[N-1]。
type fakeDialer struct { type fakeDialer struct {
mu sync.Mutex mu sync.Mutex
@@ -1,3 +1,3 @@
import{r as n,j as e,b as ie,c as Oe}from"./react-vendor-C_od1ZSF.js";import{g as X,p as ae,a as ce,d as Pe}from"./index-BBTWivHc.js";import{c as Le,o as ke}from"./contract-COFcZjyb.js";import{X as de,n as ze,L as J,o as Ge,p as Ie,q as Te,r as $e,s as te,t as De,K as We,u as Ve,v as Je,e as Ke,w as ue,f as He,U as Ee,x as Xe,k as _e,Q as ve,R as Ye,y as Ze,z as Fe,F as Ne,H as es}from"./icons-vendor-CvzvbbIV.js";const ss=(s,t)=>{const r=s.avatar_url||"";if(!r)return"";try{const a=new URL(r,window.location.origin);return a.hostname.endsWith("alicdn.com")&&a.searchParams.set("_v",t),a.toString()}catch{return r}},ts=async s=>{const t=await X("/api/v1/accounts/details",void 0,s),r=Le(t,["data","accounts","details"]),a=Date.now().toString();return r.map(l=>({id:l.id,cookie_configured:l.has_cookie===!0,enabled:l.enabled,auto_confirm:l.auto_confirm,remark:l.remark,pause_duration:l.pause_duration,paused_until:Number(l.paused_until||0),paused:l.paused===!0,username:l.username||"",login_password_configured:void 0,show_browser:l.show_browser===!0||l.show_browser===1||l.show_browser==="1"||l.show_browser==="true",nickname:l.nickname||l.remark||`账号 ${l.id.substring(0,6)}`,avatar_url:ss(l,a),profile_error:l.profile_error||"",ai_enabled:!1,auto_rate_enabled:l.auto_rate_enabled,rate_content:l.rate_content||"不错的买家,交易愉快",auto_polish_enabled:l.auto_polish_enabled,polish_time:l.polish_time||"03:00",last_rate_scan_at:Number(l.last_rate_scan_at||0),last_polish_date:l.last_polish_date||"",last_polish_at:Number(l.last_polish_at||0)}))},as=async s=>{const t=await X("/api/v1/accounts/runtime-status",void 0,s);return ke(t,["statuses","data","result"])||{}},rs=async s=>ce("/api/v1/qr-login/generate",void 0,{...s,timeoutMs:(s==null?void 0:s.timeoutMs)??13e4}),ns=async(s,t)=>X(`/api/v1/qr-login/check/${s}`,void 0,{signal:t,timeoutMs:1e4}),ls=async(s,t)=>ce(`/api/v1/qr-login/complete-verification/${s}`,{target_account_id:t||""}),os=async(s,t)=>ae(`/api/v1/accounts/${s}/status`,{enabled:t}),is=async s=>Pe(`/api/v1/accounts/${s}`),cs=async(s,t,r)=>ae(`/api/v1/accounts/${s}/pause-duration`,{pause_duration:t},r),ds=async(s,t,r)=>ae(`/api/v1/accounts/${s}/settings`,t,r),us=async(s,t)=>X(`/api/v1/accounts/${s}/long-login`,void 0,t),xs=async(s,t,r)=>ae(`/api/v1/accounts/${s}/long-login`,{enabled:t},r),ms=async(s,t)=>ce("/api/v1/password-login",s,t),bs=async(s,t)=>X(`/api/v1/password-login/check/${s}`,void 0,{signal:t,timeoutMs:1e4}),hs=async(s,t)=>Pe(`/api/v1/password-login/cancel/${s}`,void 0,t),gs=async s=>ce(`/api/v1/accounts/${s}/refresh-profile`,{}),ps=async s=>{const t=await X("/api/v1/settings/ai-reply",void 0,s);return ke(t,["settings","data","result"])||{}},fs=async(s,t)=>X(`/api/v1/settings/ai-reply/${s}`,void 0,t),ys=async(s,t,r)=>{const a={ai_enabled:t.ai_enabled??!1,max_discount_percent:t.max_discount_percent??10,max_discount_amount:t.max_discount_amount??100,max_bargain_rounds:t.max_bargain_rounds??3,custom_prompts:t.custom_prompts??""};return ae(`/api/v1/settings/ai-reply/${s}`,a,r)},js=s=>{if(Array.isArray(s))return s.filter(Boolean);if(typeof s!="string"||!s.trim())return[];try{const t=JSON.parse(s);if(Array.isArray(t))return t.filter(Boolean)}catch{}return s.split(/[,\s;]+/).map(t=>t.trim()).filter(Boolean)},ws=async s=>{const t=await X("/api/v1/notifications/channels",void 0,s);return{success:!0,data:Le(t,["data","channels","items"]).map(a=>{let l;try{l=typeof a.config=="string"?JSON.parse(a.config):a.config}catch{l={}}const c=a.type==="ding_talk"?"dingtalk":a.type==="lark"?"feishu":a.type;return{id:String(a.id),name:a.name,type:c,config:l,event_types:js(a.event_types),enabled:a.enabled,created_at:a.created_at,updated_at:a.updated_at}})}},_s=async(s,t)=>{const r=await X(`/api/v1/notifications/accounts/${s}/bindings`,void 0,t),a=ke(r,["data","result"])||{};return Array.isArray(a.channel_ids)?a.channel_ids:[]},Ce=async(s,t)=>X(`/api/v1/account-tasks/${s}`,void 0,t),Se=async(s,t,r)=>ae(`/api/v1/account-tasks/${s}`,t,r),vs=async(s,t,r)=>ce(`/api/v1/account-tasks/${s}/run`,{task_type:t},{timeoutMs:12e4,...r}),Re=s=>({account_id:s.id,auto_rate_enabled:s.auto_rate_enabled===!0,rate_content:s.rate_content||"不错的买家,交易愉快",auto_polish_enabled:s.auto_polish_enabled===!0,polish_time:s.polish_time||"03:00",last_rate_scan_at:s.last_rate_scan_at,last_polish_date:s.last_polish_date,last_polish_at:s.last_polish_at}),Y=(s,t,r)=>s===t&&!r.aborted,je=(s,t)=>s instanceof Error?s.message:t,we=s=>s instanceof Error&&s.message==="请求已取消",Ae=(s,t)=>!s&&t==="",Ns=({account:s,onSaved:t})=>{const[r,a]=n.useState(()=>Re(s)),[l,c]=n.useState(!0),[i,d]=n.useState(!1),[b,m]=n.useState(""),[f,h]=n.useState(""),[u,A]=n.useState(null),[k,g]=n.useState(null),p=n.useRef(0),L=n.useRef(null);n.useEffect(()=>{var v;const S=++p.current;(v=L.current)==null||v.abort();const j=new AbortController;return L.current=j,a(Re(s)),A(null),h(""),d(!1),m(""),g(null),c(!0),Ce(s.id,{signal:j.signal}).then(R=>{Y(p.current,S,j.siLine truncated import{r as n,j as e,b as ie,c as Oe}from"./react-vendor-C_od1ZSF.js";import{g as X,p as ae,a as ce,d as Pe}from"./index-Dw5V5tCq.js";import{c as Le,o as ke}from"./contract-COFcZjyb.js";import{X as de,n as ze,L as J,o as Ge,p as Ie,q as Te,r as $e,s as te,t as De,K as We,u as Ve,v as Je,e as Ke,w as ue,f as He,U as Ee,x as Xe,k as _e,Q as ve,R as Ye,y as Ze,z as Fe,F as Ne,H as es}from"./icons-vendor-CvzvbbIV.js";const ss=(s,t)=>{const r=s.avatar_url||"";if(!r)return"";try{const a=new URL(r,window.location.origin);return a.hostname.endsWith("alicdn.com")&&a.searchParams.set("_v",t),a.toString()}catch{return r}},ts=async s=>{const t=await X("/api/v1/accounts/details",void 0,s),r=Le(t,["data","accounts","details"]),a=Date.now().toString();return r.map(l=>({id:l.id,cookie_configured:l.has_cookie===!0,enabled:l.enabled,auto_confirm:l.auto_confirm,remark:l.remark,pause_duration:l.pause_duration,paused_until:Number(l.paused_until||0),paused:l.paused===!0,username:l.username||"",login_password_configured:void 0,show_browser:l.show_browser===!0||l.show_browser===1||l.show_browser==="1"||l.show_browser==="true",nickname:l.nickname||l.remark||`账号 ${l.id.substring(0,6)}`,avatar_url:ss(l,a),profile_error:l.profile_error||"",ai_enabled:!1,auto_rate_enabled:l.auto_rate_enabled,rate_content:l.rate_content||"不错的买家,交易愉快",auto_polish_enabled:l.auto_polish_enabled,polish_time:l.polish_time||"03:00",last_rate_scan_at:Number(l.last_rate_scan_at||0),last_polish_date:l.last_polish_date||"",last_polish_at:Number(l.last_polish_at||0)}))},as=async s=>{const t=await X("/api/v1/accounts/runtime-status",void 0,s);return ke(t,["statuses","data","result"])||{}},rs=async s=>ce("/api/v1/qr-login/generate",void 0,{...s,timeoutMs:(s==null?void 0:s.timeoutMs)??13e4}),ns=async(s,t)=>X(`/api/v1/qr-login/check/${s}`,void 0,{signal:t,timeoutMs:1e4}),ls=async(s,t)=>ce(`/api/v1/qr-login/complete-verification/${s}`,{target_account_id:t||""}),os=async(s,t)=>ae(`/api/v1/accounts/${s}/status`,{enabled:t}),is=async s=>Pe(`/api/v1/accounts/${s}`),cs=async(s,t,r)=>ae(`/api/v1/accounts/${s}/pause-duration`,{pause_duration:t},r),ds=async(s,t,r)=>ae(`/api/v1/accounts/${s}/settings`,t,r),us=async(s,t)=>X(`/api/v1/accounts/${s}/long-login`,void 0,t),xs=async(s,t,r)=>ae(`/api/v1/accounts/${s}/long-login`,{enabled:t},r),ms=async(s,t)=>ce("/api/v1/password-login",s,t),bs=async(s,t)=>X(`/api/v1/password-login/check/${s}`,void 0,{signal:t,timeoutMs:1e4}),hs=async(s,t)=>Pe(`/api/v1/password-login/cancel/${s}`,void 0,t),gs=async s=>ce(`/api/v1/accounts/${s}/refresh-profile`,{}),ps=async s=>{const t=await X("/api/v1/settings/ai-reply",void 0,s);return ke(t,["settings","data","result"])||{}},fs=async(s,t)=>X(`/api/v1/settings/ai-reply/${s}`,void 0,t),ys=async(s,t,r)=>{const a={ai_enabled:t.ai_enabled??!1,max_discount_percent:t.max_discount_percent??10,max_discount_amount:t.max_discount_amount??100,max_bargain_rounds:t.max_bargain_rounds??3,custom_prompts:t.custom_prompts??""};return ae(`/api/v1/settings/ai-reply/${s}`,a,r)},js=s=>{if(Array.isArray(s))return s.filter(Boolean);if(typeof s!="string"||!s.trim())return[];try{const t=JSON.parse(s);if(Array.isArray(t))return t.filter(Boolean)}catch{}return s.split(/[,\s;]+/).map(t=>t.trim()).filter(Boolean)},ws=async s=>{const t=await X("/api/v1/notifications/channels",void 0,s);return{success:!0,data:Le(t,["data","channels","items"]).map(a=>{let l;try{l=typeof a.config=="string"?JSON.parse(a.config):a.config}catch{l={}}const c=a.type==="ding_talk"?"dingtalk":a.type==="lark"?"feishu":a.type;return{id:String(a.id),name:a.name,type:c,config:l,event_types:js(a.event_types),enabled:a.enabled,created_at:a.created_at,updated_at:a.updated_at}})}},_s=async(s,t)=>{const r=await X(`/api/v1/notifications/accounts/${s}/bindings`,void 0,t),a=ke(r,["data","result"])||{};return Array.isArray(a.channel_ids)?a.channel_ids:[]},Ce=async(s,t)=>X(`/api/v1/account-tasks/${s}`,void 0,t),Se=async(s,t,r)=>ae(`/api/v1/account-tasks/${s}`,t,r),vs=async(s,t,r)=>ce(`/api/v1/account-tasks/${s}/run`,{task_type:t},{timeoutMs:12e4,...r}),Re=s=>({account_id:s.id,auto_rate_enabled:s.auto_rate_enabled===!0,rate_content:s.rate_content||"不错的买家,交易愉快",auto_polish_enabled:s.auto_polish_enabled===!0,polish_time:s.polish_time||"03:00",last_rate_scan_at:s.last_rate_scan_at,last_polish_date:s.last_polish_date,last_polish_at:s.last_polish_at}),Y=(s,t,r)=>s===t&&!r.aborted,je=(s,t)=>s instanceof Error?s.message:t,we=s=>s instanceof Error&&s.message==="请求已取消",Ae=(s,t)=>!s&&t==="",Ns=({account:s,onSaved:t})=>{const[r,a]=n.useState(()=>Re(s)),[l,c]=n.useState(!0),[i,d]=n.useState(!1),[b,m]=n.useState(""),[f,h]=n.useState(""),[u,A]=n.useState(null),[k,g]=n.useState(null),p=n.useRef(0),L=n.useRef(null);n.useEffect(()=>{var v;const S=++p.current;(v=L.current)==null||v.abort();const j=new AbortController;return L.current=j,a(Re(s)),A(null),h(""),d(!1),m(""),g(null),c(!0),Ce(s.id,{signal:j.signal}).then(R=>{Y(p.current,S,j.siLine truncated
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(He,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:l,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:r,children:"取消"}),e.jsxs("button",{onClick:(()=>void c()),className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:r,children:[r?e.jsx(J,{className:"w-4 h-4 animate-spin"}):e.jsx($e,{className:"w-4 h-4"}),r?"保存中...":"保存"]})]})})]})}),document.body)},Rs=(s,t)=>{if(!s||!t)return!1;const r=Date.parse(s),a=Date.parse(t);return Number.isFinite(r)&&Number.isFinite(a)&&a<r},As=(s,t)=>s.map(r=>{const a=t[r.id];return!a||Rs(r.runtime_updated_at,a.updated_at)?r:{...r,runtime_state:a.state,runtime_message:a.message||"",runtime_connected:a.connected,runtime_updated_at:a.updated_at}}),qs=s=>{if(!s.enabled||s.runtime_state==="disabled")return{label:"已停用",badge:"bg-gray-100 text-gray-500",dot:"bg-gray-300"};switch(s.runtime_state){case"online":return{label:"在线",badge:"bg-green-100 text-green-700",dot:"bg-green-500"};case"starting":case"connecting":return{label:"连接中",badge:"bg-blue-100 text-blue-700",dot:"bg-blue-500"};case"reconnecting":return{label:"重连中",badge:"bg-amber-100 text-amber-700",dot:"bg-amber-500"};case"auth_expired":return{label:"登录已失效",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};case"verification_required":return{label:"需要验证",badge:"bg-orange-100 text-orange-700",dot:"bg-orange-500"};case"error":case"stopped":return{label:"运行异常",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};default:return{label:"状态检测中",badge:"bg-gray-100 text-gray-600",dot:"bg-gray-400"}}},Ps=Oe.memo(function({account:t,refreshing:r,deleting:a,onRefreshProfile:l,onReauthorize:c,onEdit:i,onAI:d,onTasks:b,onToggle:m,onDelete:f}){const h=qs(t),u=t.runtime_state==="auth_expired"||t.runtime_state==="verification_required";return e.jsx("div",{className:"ios-card rounded-xl p-6 group transition-all duration-300 hover:border-brand",children:e.jsxs("div",{className:"flex min-w-0 items-start gap-5 sm:gap-8",children:[e.jsxs("div",{className:"relative",children:[t.avatar_url?e.jsx("img",{src:t.avatar_url,alt:t.nickname||"账号头像",className:"w-20 h-20 rounded-full object-cover shadow-md ring-4 ring-white bg-gray-100"}):e.jsx("div",{className:"w-20 h-20 rounded-full bg-gray-100 text-gray-400 shadow-md ring-4 ring-white flex items-center justify-center",children:e.jsx(Ee,{className:"w-9 h-9"})}),e.jsx("div",{className:`absolute -bottom-1 -right-1 w-6 h-6 rounded-full border-4 border-white flex items-center justify-center ${h.dot}`,children:t.runtime_state==="online"&&e.jsx(te,{className:"w-3 h-3 text-white"})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 mb-1",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900 break-words",children:t.nickname||t.remark||`账号 ${t.id.substring(0,6)}...`}),e.jsx("span",{className:`px-2.5 py-0.5 rounded-lg text-xs font-bold ${h.badge}`,children:h.label}),t.ai_enabled&&e.jsxs("span",{className:"px-2.5 py-0.5 rounded-lg bg-purple-100 text-purple-700 text-xs font-bold flex items-center gap-1",children:[e.jsx(ue,{className:"w-3 h-3"})," AI"]}),t.auto_rate_enabled&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-emerald-100 px-2.5 py-0.5 text-xs font-bold text-emerald-700",children:[e.jsx(Xe,{className:"h-3 w-3"})," 自动评价"]}),t.auto_polish_enabled&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-amber-100 px-2.5 py-0.5 text-xs font-bold text-amber-700",children:[e.jsx(Ie,{className:"h-3 w-3"})," 每日擦亮"]}),t.auto_confirm&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-blue-50 px-2.5 py-0.5 text-xs font-bold text-blue-700",children:[e.jsx(te,{className:"h-3 w-3"})," 自动确认发货"]}),t.profile_error&&e.jsxs("span",{className:"px-2.5 py-0.5 rounded-lg bg-amber-100 text-amber-700 text-xs font-bold flex items-center gap-1",title:t.profile_error,children:[e.jsx(_e,{className:"w-3 h-3"})," 资料未同步"]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between Line truncated 例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(He,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:l,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:r,children:"取消"}),e.jsxs("button",{onClick:(()=>void c()),className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:r,children:[r?e.jsx(J,{className:"w-4 h-4 animate-spin"}):e.jsx($e,{className:"w-4 h-4"}),r?"保存中...":"保存"]})]})})]})}),document.body)},Rs=(s,t)=>{if(!s||!t)return!1;const r=Date.parse(s),a=Date.parse(t);return Number.isFinite(r)&&Number.isFinite(a)&&a<r},As=(s,t)=>s.map(r=>{const a=t[r.id];return!a||Rs(r.runtime_updated_at,a.updated_at)?r:{...r,runtime_state:a.state,runtime_message:a.message||"",runtime_connected:a.connected,runtime_updated_at:a.updated_at}}),qs=s=>{if(!s.enabled||s.runtime_state==="disabled")return{label:"已停用",badge:"bg-gray-100 text-gray-500",dot:"bg-gray-300"};switch(s.runtime_state){case"online":return{label:"在线",badge:"bg-green-100 text-green-700",dot:"bg-green-500"};case"starting":case"connecting":return{label:"连接中",badge:"bg-blue-100 text-blue-700",dot:"bg-blue-500"};case"reconnecting":return{label:"重连中",badge:"bg-amber-100 text-amber-700",dot:"bg-amber-500"};case"auth_expired":return{label:"登录已失效",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};case"verification_required":return{label:"需要验证",badge:"bg-orange-100 text-orange-700",dot:"bg-orange-500"};case"error":case"stopped":return{label:"运行异常",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};default:return{label:"状态检测中",badge:"bg-gray-100 text-gray-600",dot:"bg-gray-400"}}},Ps=Oe.memo(function({account:t,refreshing:r,deleting:a,onRefreshProfile:l,onReauthorize:c,onEdit:i,onAI:d,onTasks:b,onToggle:m,onDelete:f}){const h=qs(t),u=t.runtime_state==="auth_expired"||t.runtime_state==="verification_required";return e.jsx("div",{className:"ios-card rounded-xl p-6 group transition-all duration-300 hover:border-brand",children:e.jsxs("div",{className:"flex min-w-0 items-start gap-5 sm:gap-8",children:[e.jsxs("div",{className:"relative",children:[t.avatar_url?e.jsx("img",{src:t.avatar_url,alt:t.nickname||"账号头像",className:"w-20 h-20 rounded-full object-cover shadow-md ring-4 ring-white bg-gray-100"}):e.jsx("div",{className:"w-20 h-20 rounded-full bg-gray-100 text-gray-400 shadow-md ring-4 ring-white flex items-center justify-center",children:e.jsx(Ee,{className:"w-9 h-9"})}),e.jsx("div",{className:`absolute -bottom-1 -right-1 w-6 h-6 rounded-full border-4 border-white flex items-center justify-center ${h.dot}`,children:t.runtime_state==="online"&&e.jsx(te,{className:"w-3 h-3 text-white"})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 mb-1",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900 break-words",children:t.nickname||t.remark||`账号 ${t.id.substring(0,6)}...`}),e.jsx("span",{className:`px-2.5 py-0.5 rounded-lg text-xs font-bold ${h.badge}`,children:h.label}),t.ai_enabled&&e.jsxs("span",{className:"px-2.5 py-0.5 rounded-lg bg-purple-100 text-purple-700 text-xs font-bold flex items-center gap-1",children:[e.jsx(ue,{className:"w-3 h-3"})," AI"]}),t.auto_rate_enabled&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-emerald-100 px-2.5 py-0.5 text-xs font-bold text-emerald-700",children:[e.jsx(Xe,{className:"h-3 w-3"})," 自动评价"]}),t.auto_polish_enabled&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-amber-100 px-2.5 py-0.5 text-xs font-bold text-amber-700",children:[e.jsx(Ie,{className:"h-3 w-3"})," 每日擦亮"]}),t.auto_confirm&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-blue-50 px-2.5 py-0.5 text-xs font-bold text-blue-700",children:[e.jsx(te,{className:"h-3 w-3"})," 自动确认发货"]}),t.profile_error&&e.jsxs("span",{className:"px-2.5 py-0.5 rounded-lg bg-amber-100 text-amber-700 text-xs font-bold flex items-center gap-1",title:t.profile_error,children:[e.jsx(_e,{className:"w-3 h-3"})," 资料未同步"]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between Line truncated
@@ -1,4 +1,4 @@
import{b as z,j as e,r as i}from"./react-vendor-C_od1ZSF.js";import{X as G,W as Z,J as D,Y as ee,L as U,N as V,C as H,_ as te,$ as W,a0 as X,a1 as ae,I as se,a2 as le,V as ne,F as re,P as oe,r as ie}from"./icons-vendor-CvzvbbIV.js";import{g as ce,p as de,d as xe,a as Y,b as pe}from"./index-BBTWivHc.js";import{c as me}from"./contract-COFcZjyb.js";const he=({dataCards:l,downloadCardTemplate:n,...a})=>{var x;const u=s=>{var h;a.setBatchFile(((h=s.target.files)==null?void 0:h[0])||null)},m=s=>{a.setAppendContent(s.target.value)},_=s=>{a.setAppendTargetId(s.target.value)},f=()=>a.closeBatchModal(),j=()=>a.setBatchTab("create"),d=()=>a.setBatchTab("append"),A=()=>void a.handleRetryBatchCreate(),c=()=>void a.handleRetryBatchAppend(),y=a.batchResult&&"rows"in a.batchResult?a.batchResult:null,N=s=>e.jsxs("option",{value:String(s.id),children:[s.name,"(ID: ",s.id,")"]},s.id),b=()=>void a.handleBatchCreate(),r=()=>void a.handleBatchAppend();return a.showBatchModal?z.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[e.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),e.jsx("button",{onClick:f,className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:e.jsx(G,{className:"w-5 h-5 text-gray-600"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[e.jsxs("button",{onClick:j,className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${a.batchTab==="create"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(Z,{className:"w-4 h-4"}),"批量创建卡密组"]}),e.jsxs("button",{onClick:d,className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${a.batchTab==="append"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(D,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),a.batchTab==="create"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",e.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),"。 类型填 text/data/image;data 类型的“内容”按行存卡密(CSV 单元格内换行需用引号包裹)。"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:n,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-sm transition-colors",children:[e.jsx(ee,{className:"w-4 h-4"}),"下载模板"]}),e.jsxs("label",{className:"flex-1 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-sm cursor-pointer transition-colors",children:[e.jsx(D,{className:"w-4 h-4"}),a.batchFile?a.batchFile.name:"选择 .xlsx / .csv / .tsv",e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv",className:"hidden",onChange:u})]})]}),((x=a.batchResult)==null?void 0:x.error)&&e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:a.batchResult.error}),e.jsx("button",{type:"button",onClick:A,disabled:!a.batchFile||a.batchBusy,className:"font-bold whitespace-nowrap",children:"重试"})]}),y&&e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4 space-y-2",children:[e.jsxs("div",{className:"text-sm font-bold text-gray-900",children:["共 ",y.total," 行 · 成功 ",y.created," · 失败 ",y.failed]}),y.failed>0&&e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1",children:y.rows.filter(s=>!s.success).map(s=>e.jsxs("div",{className:"text-xs text-red-600",children:["第 ",s.row_no," 行「",s.name,"」:",s.error]},s.row_no))})]})]}):e.jsx("div",{className:"space-y-4",children:l.length===0?e.jsx("div",{className:"rounded-xl bg-amber-50 border border-amber-200 p-4 text-sm text-amber-800",children:"暂无 data(批量卡密)类型的卡密组,请先创建一个再充卡密。"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"选择卡密组"}),e.jsx("select",{value:a.appendTargetId,onChange:_,className:"w-full ios-input px-4 py-3 rounded-xl text-sm",children:l.map(N)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"卡密号(每行一个)"}),e.jsx("textarea",{vaLine truncated import{b as z,j as e,r as i}from"./react-vendor-C_od1ZSF.js";import{X as G,W as Z,J as D,Y as ee,L as U,N as V,C as H,_ as te,$ as W,a0 as X,a1 as ae,I as se,a2 as le,V as ne,F as re,P as oe,r as ie}from"./icons-vendor-CvzvbbIV.js";import{g as ce,p as de,d as xe,a as Y,b as pe}from"./index-Dw5V5tCq.js";import{c as me}from"./contract-COFcZjyb.js";const he=({dataCards:l,downloadCardTemplate:n,...a})=>{var x;const u=s=>{var h;a.setBatchFile(((h=s.target.files)==null?void 0:h[0])||null)},m=s=>{a.setAppendContent(s.target.value)},_=s=>{a.setAppendTargetId(s.target.value)},f=()=>a.closeBatchModal(),j=()=>a.setBatchTab("create"),d=()=>a.setBatchTab("append"),A=()=>void a.handleRetryBatchCreate(),c=()=>void a.handleRetryBatchAppend(),y=a.batchResult&&"rows"in a.batchResult?a.batchResult:null,N=s=>e.jsxs("option",{value:String(s.id),children:[s.name,"(ID: ",s.id,")"]},s.id),b=()=>void a.handleBatchCreate(),r=()=>void a.handleBatchAppend();return a.showBatchModal?z.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[e.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),e.jsx("button",{onClick:f,className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:e.jsx(G,{className:"w-5 h-5 text-gray-600"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[e.jsxs("button",{onClick:j,className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${a.batchTab==="create"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(Z,{className:"w-4 h-4"}),"批量创建卡密组"]}),e.jsxs("button",{onClick:d,className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${a.batchTab==="append"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(D,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),a.batchTab==="create"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",e.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),"。 类型填 text/data/image;data 类型的“内容”按行存卡密(CSV 单元格内换行需用引号包裹)。"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:n,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-sm transition-colors",children:[e.jsx(ee,{className:"w-4 h-4"}),"下载模板"]}),e.jsxs("label",{className:"flex-1 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-sm cursor-pointer transition-colors",children:[e.jsx(D,{className:"w-4 h-4"}),a.batchFile?a.batchFile.name:"选择 .xlsx / .csv / .tsv",e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv",className:"hidden",onChange:u})]})]}),((x=a.batchResult)==null?void 0:x.error)&&e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:a.batchResult.error}),e.jsx("button",{type:"button",onClick:A,disabled:!a.batchFile||a.batchBusy,className:"font-bold whitespace-nowrap",children:"重试"})]}),y&&e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4 space-y-2",children:[e.jsxs("div",{className:"text-sm font-bold text-gray-900",children:["共 ",y.total," 行 · 成功 ",y.created," · 失败 ",y.failed]}),y.failed>0&&e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1",children:y.rows.filter(s=>!s.success).map(s=>e.jsxs("div",{className:"text-xs text-red-600",children:["第 ",s.row_no," 行「",s.name,"」:",s.error]},s.row_no))})]})]}):e.jsx("div",{className:"space-y-4",children:l.length===0?e.jsx("div",{className:"rounded-xl bg-amber-50 border border-amber-200 p-4 text-sm text-amber-800",children:"暂无 data(批量卡密)类型的卡密组,请先创建一个再充卡密。"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"选择卡密组"}),e.jsx("select",{value:a.appendTargetId,onChange:_,className:"w-full ios-input px-4 py-3 rounded-xl text-sm",children:l.map(N)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"卡密号(每行一个)"}),e.jsx("textarea",{vaLine truncated
VIP-002 VIP-002
VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["预览:",a.appendPreview.length," 个有效卡密,空行自动忽略。"]})]}),a.appendError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-200 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:a.appendError}),e.jsx("button",{type:"button",onClick:c,disabled:a.batchBusy,className:"font-bold whitespace-nowrap",children:"重试"})]}),a.appendResult&&e.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",a.appendResult.added," 个卡密"]})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:f,className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),a.batchTab==="create"?e.jsxs("button",{onClick:b,disabled:!a.batchFile||a.batchBusy,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[a.batchBusy?e.jsx(U,{className:"w-4 h-4 animate-spin"}):e.jsx(D,{className:"w-4 h-4"}),a.batchBusy?"处理中...":"上传创建"]}):e.jsxs("button",{onClick:r,disabled:!a.appendTargetId||a.appendPreview.length===0||a.batchBusy||l.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[a.batchBusy?e.jsx(U,{className:"w-4 h-4 animate-spin"}):e.jsx(V,{className:"w-4 h-4"}),a.batchBusy?"处理中...":"追加卡密"]})]})]})}),document.body):null},ue=({type:l})=>{switch(l){case"text":return e.jsx(X,{className:"w-5 h-5 text-blue-500"});case"image":return e.jsx(W,{className:"w-5 h-5 text-purple-500"});case"api":return e.jsx(te,{className:"w-5 h-5 text-blue-500"});default:return e.jsx(H,{className:"w-5 h-5 text-gray-500"})}},be=l=>{let n=l.api_config;if(typeof n=="string"&&n.trim())try{n=JSON.parse(n)}catch{n=void 0}return{...l,api_config:n||void 0}},K=l=>({...l,api_config:l.api_config?JSON.stringify(l.api_config):""}),ge=async l=>{const n=await ce("/api/v1/cards",void 0,l);return me(n,["cards","data","items"]).map(be)},ye=async l=>Y("/api/v1/cards",K(l)),J=async(l,n)=>de(`/api/v1/cards/${l}`,K(n)),fe=async l=>xe(`/api/v1/cards/${l}`),je=async(l,n)=>{const a=new FormData;return a.append("file",l),pe("/api/v1/cards/batch",a,n)},Ne=async(l,n,a)=>Y(`/api/v1/cards/${l}/append-data`,{content:n},a),ve=(l,n,a)=>{const u=a.trim().toLocaleLowerCase();return l.filter(m=>(!n||m.type===n)&&(!u||m.name.toLocaleLowerCase().includes(u)))},Q=l=>l.split(` VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["预览:",a.appendPreview.length," 个有效卡密,空行自动忽略。"]})]}),a.appendError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-200 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:a.appendError}),e.jsx("button",{type:"button",onClick:c,disabled:a.batchBusy,className:"font-bold whitespace-nowrap",children:"重试"})]}),a.appendResult&&e.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",a.appendResult.added," 个卡密"]})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:f,className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),a.batchTab==="create"?e.jsxs("button",{onClick:b,disabled:!a.batchFile||a.batchBusy,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[a.batchBusy?e.jsx(U,{className:"w-4 h-4 animate-spin"}):e.jsx(D,{className:"w-4 h-4"}),a.batchBusy?"处理中...":"上传创建"]}):e.jsxs("button",{onClick:r,disabled:!a.appendTargetId||a.appendPreview.length===0||a.batchBusy||l.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[a.batchBusy?e.jsx(U,{className:"w-4 h-4 animate-spin"}):e.jsx(V,{className:"w-4 h-4"}),a.batchBusy?"处理中...":"追加卡密"]})]})]})}),document.body):null},ue=({type:l})=>{switch(l){case"text":return e.jsx(X,{className:"w-5 h-5 text-blue-500"});case"image":return e.jsx(W,{className:"w-5 h-5 text-purple-500"});case"api":return e.jsx(te,{className:"w-5 h-5 text-blue-500"});default:return e.jsx(H,{className:"w-5 h-5 text-gray-500"})}},be=l=>{let n=l.api_config;if(typeof n=="string"&&n.trim())try{n=JSON.parse(n)}catch{n=void 0}return{...l,api_config:n||void 0}},K=l=>({...l,api_config:l.api_config?JSON.stringify(l.api_config):""}),ge=async l=>{const n=await ce("/api/v1/cards",void 0,l);return me(n,["cards","data","items"]).map(be)},ye=async l=>Y("/api/v1/cards",K(l)),J=async(l,n)=>de(`/api/v1/cards/${l}`,K(n)),fe=async l=>xe(`/api/v1/cards/${l}`),je=async(l,n)=>{const a=new FormData;return a.append("file",l),pe("/api/v1/cards/batch",a,n)},Ne=async(l,n,a)=>Y(`/api/v1/cards/${l}/append-data`,{content:n},a),ve=(l,n,a)=>{const u=a.trim().toLocaleLowerCase();return l.filter(m=>(!n||m.type===n)&&(!u||m.name.toLocaleLowerCase().includes(u)))},Q=l=>l.split(`
`).map(n=>n.trim()).filter(Boolean),we=(l,n,a)=>!!(l&&Q(n).length>0&&!a),F=(l,n,a,u)=>l===n&&a===u,Ce=()=>{const[l,n]=i.useState([]),[a,u]=i.useState(!0),m=i.useRef(0),_=i.useRef(null),f=i.useCallback(async()=>{var A;const j=++m.current;(A=_.current)==null||A.abort();const d=new AbortController;_.current=d,u(!0);try{const c=await ge({signal:d.signal});if(j!==m.current)return;n(c)}catch(c){j===m.current&&!d.signal.aborted&&console.error("加载卡密库存失败:",c)}finally{j===m.current&&u(!1)}},[]);return i.useEffect(()=>(f(),()=>{var d;m.current+=1,(d=_.current)==null||d.abort()}),[f]),{cards:l,setCards:n,loading:a,loadCards:f}},_e=l=>{const n=l.dataCards,a=l.loadCards,[u,m]=i.useState(!1),[_,f]=i.useState("create"),[j,d]=i.useState(null),[A,c]=i.useState(null),[y,N]=i.useState(!1),[b,r]=i.useState(""),[x,s]=i.useState(""),[h,E]=i.useState(null),[M,R]=i.useState(""),v=i.useRef(0),T=i.useRef(null),P=i.useRef("");i.useEffect(()=>(()=>{var p;v.current+=1,(p=T.current)==null||p.abort()}),[]);const $=i.useMemo(()=>Q(x),[x]),o=i.useCallback(()=>{var p;f("create"),d(null),c(null),r((p=n[0])!=null&&p.id?String(n[0].id):""),s(""),E(null),R(""),m(!0)},[n]),t=i.useCallback(()=>{var p;v.current+=1,(p=T.current)==null||p.abort(),N(!1),m(!1)},[]),g=i.useCallback(async()=>{var w;if(!j||y)return;const p=++v.current;(w=T.current)==null||w.abort();const B=new AbortController;T.current=B,N(!0),c(null);try{const I=await je(j,{signal:B.signal});if(!F(p,v.current,"",""))return;c(I),I.created>0&&await a()}catch(I){if(!F(p,v.current,"",""))return;c({error:(I==null?void 0:I.message)||"上传失败"})}finally{F(p,v.current,"","")&&N(!1)}},[y,j,a]),k=i.useCallback(async()=>{var I;if(!we(b,x,y))return;const p=b,B=++v.current;P.current=p,(I=T.current)==null||I.abort();const w=new AbortController;T.current=w,N(!0),E(null),R("");try{const O=await Ne(p,x,{signal:w.signal});if(!F(B,v.current,p,b))return;E({added:O.added}),s(""),await a()}catch(O){if(!F(B,v.current,p,b))return;R((O==null?void 0:O.message)||"追加失败")}finally{F(B,v.current,p,b)&&N(!1)}},[x,b,y,a]),S=i.useCallback(async()=>{await g()},[g]),C=i.useCallback(async()=>{P.current&&b!==P.current||await k()},[b,k]);return{showBatchModal:u,setShowBatchModal:m,batchTab:_,setBatchTab:f,batchFile:j,setBatchFile:d,batchResult:A,batchBusy:y,appendTargetId:b,setAppendTargetId:r,appendContent:x,setAppendContent:s,appendResult:h,appendError:M,appendPreview:$,openBatchModal:o,closeBatchModal:t,handleBatchCreate:g,handleBatchAppend:k,handleRetryBatchCreate:S,handleRetryBatchAppend:C}},q=()=>({name:"",type:"data",content:"",description:"",enabled:!0,delay_seconds:0,api_method:"GET",api_timeout:10,api_headers:"",api_params:""}),L=(l,n)=>l instanceof Error?l.message:n,ke=({cards:l,loadCards:n})=>{const[a,u]=i.useState(!1),[m,_]=i.useState(!1),[f,j]=i.useState(null),[d,A]=i.useState({}),[c,y]=i.useState(q),[N,b]=i.useState(""),[r,x]=i.useState(""),s=i.useMemo(()=>l.filter(o=>o.type==="data"),[l]),h=i.useMemo(()=>ve(l,N,r),[l,r,N]),E=i.useCallback(o=>{var t,g,k,S,C;j(o),A({id:o.id,name:o.name||"",type:o.type||"text",api_url:((t=o.api_config)==null?void 0:t.url)||"",api_method:((g=o.api_config)==null?void 0:g.method)||"GET",api_timeout:((k=o.api_config)==null?void 0:k.timeout)||10,api_headers:((S=o.api_config)==null?void 0:S.headers)||"",api_params:((C=o.api_config)==null?void 0:C.params)||"",text_content:o.text_content||"",data_content:o.data_content||"",image_url:o.image_url||"",delay_seconds:o.delay_seconds||0,description:o.description||"",enabled:o.enabled}),u(!0)},[]),M=i.useCallback(async()=>{var o,t,g,k,S,C,p,B;if(f){if(!((o=d.name)!=null&&o.trim())){alert("请输入卡密名称");return}if(!d.type){alert("请选择卡密类型");return}try{const w={name:d.name.trim(),type:d.type,description:(t=d.description)==null?void 0:t.trim(),delay_seconds:d.delay_seconds||0,enabled:d.enabled??!0};d.type==="api"?w.api_config={url:((g=d.api_url)==null?void 0:g.trim())||"",method:d.api_method||"GET",timeout:d.api_timeout||10,headers:((k=d.api_headers)==null?void 0:k.trim())||void 0,params:((S=d.api_params)==null?void 0:S.trim())||void 0}:d.type==="text"?w.text_content=((C=d.text_content)==null?void 0:C.trim())||"":d.type==="data"?w.data_content=((p=d.data_content)==null?void 0:p.trim())||"":d.type==="image"&&(w.image_url=((B=d.image_url)==null?void 0:B.trim())||""),await J(f.id,w),u(!1),await n()}catch(w){console.error("更新卡密失败:",w),alert(L(w,"更新失败,请重试"))}}},[d,n,f]),R=i.useCallback(async o=>{if(confirm("确认删除该卡密吗?"))try{await fe(o),await n()}catch(t){console.error("删除卡密失败:",t),alert(L(t,"删除失败,请重试"))}},[n]),v=i.useCallback(async()=>{if(!c.name.trim()){alert("请输入卡密名称");return}if(!c.content.trim()){alert(c.type==="api"?"请输入 API 地址":"请输入卡密内容");return}try{const o={name:c.name.trim(),type:c.type,description:c.description.trim(),enabled:c.enabled,delay_seconds:c.delay_seconds};c.type==="text"&&( Line truncated `).map(n=>n.trim()).filter(Boolean),we=(l,n,a)=>!!(l&&Q(n).length>0&&!a),F=(l,n,a,u)=>l===n&&a===u,Ce=()=>{const[l,n]=i.useState([]),[a,u]=i.useState(!0),m=i.useRef(0),_=i.useRef(null),f=i.useCallback(async()=>{var A;const j=++m.current;(A=_.current)==null||A.abort();const d=new AbortController;_.current=d,u(!0);try{const c=await ge({signal:d.signal});if(j!==m.current)return;n(c)}catch(c){j===m.current&&!d.signal.aborted&&console.error("加载卡密库存失败:",c)}finally{j===m.current&&u(!1)}},[]);return i.useEffect(()=>(f(),()=>{var d;m.current+=1,(d=_.current)==null||d.abort()}),[f]),{cards:l,setCards:n,loading:a,loadCards:f}},_e=l=>{const n=l.dataCards,a=l.loadCards,[u,m]=i.useState(!1),[_,f]=i.useState("create"),[j,d]=i.useState(null),[A,c]=i.useState(null),[y,N]=i.useState(!1),[b,r]=i.useState(""),[x,s]=i.useState(""),[h,E]=i.useState(null),[M,R]=i.useState(""),v=i.useRef(0),T=i.useRef(null),P=i.useRef("");i.useEffect(()=>(()=>{var p;v.current+=1,(p=T.current)==null||p.abort()}),[]);const $=i.useMemo(()=>Q(x),[x]),o=i.useCallback(()=>{var p;f("create"),d(null),c(null),r((p=n[0])!=null&&p.id?String(n[0].id):""),s(""),E(null),R(""),m(!0)},[n]),t=i.useCallback(()=>{var p;v.current+=1,(p=T.current)==null||p.abort(),N(!1),m(!1)},[]),g=i.useCallback(async()=>{var w;if(!j||y)return;const p=++v.current;(w=T.current)==null||w.abort();const B=new AbortController;T.current=B,N(!0),c(null);try{const I=await je(j,{signal:B.signal});if(!F(p,v.current,"",""))return;c(I),I.created>0&&await a()}catch(I){if(!F(p,v.current,"",""))return;c({error:(I==null?void 0:I.message)||"上传失败"})}finally{F(p,v.current,"","")&&N(!1)}},[y,j,a]),k=i.useCallback(async()=>{var I;if(!we(b,x,y))return;const p=b,B=++v.current;P.current=p,(I=T.current)==null||I.abort();const w=new AbortController;T.current=w,N(!0),E(null),R("");try{const O=await Ne(p,x,{signal:w.signal});if(!F(B,v.current,p,b))return;E({added:O.added}),s(""),await a()}catch(O){if(!F(B,v.current,p,b))return;R((O==null?void 0:O.message)||"追加失败")}finally{F(B,v.current,p,b)&&N(!1)}},[x,b,y,a]),S=i.useCallback(async()=>{await g()},[g]),C=i.useCallback(async()=>{P.current&&b!==P.current||await k()},[b,k]);return{showBatchModal:u,setShowBatchModal:m,batchTab:_,setBatchTab:f,batchFile:j,setBatchFile:d,batchResult:A,batchBusy:y,appendTargetId:b,setAppendTargetId:r,appendContent:x,setAppendContent:s,appendResult:h,appendError:M,appendPreview:$,openBatchModal:o,closeBatchModal:t,handleBatchCreate:g,handleBatchAppend:k,handleRetryBatchCreate:S,handleRetryBatchAppend:C}},q=()=>({name:"",type:"data",content:"",description:"",enabled:!0,delay_seconds:0,api_method:"GET",api_timeout:10,api_headers:"",api_params:""}),L=(l,n)=>l instanceof Error?l.message:n,ke=({cards:l,loadCards:n})=>{const[a,u]=i.useState(!1),[m,_]=i.useState(!1),[f,j]=i.useState(null),[d,A]=i.useState({}),[c,y]=i.useState(q),[N,b]=i.useState(""),[r,x]=i.useState(""),s=i.useMemo(()=>l.filter(o=>o.type==="data"),[l]),h=i.useMemo(()=>ve(l,N,r),[l,r,N]),E=i.useCallback(o=>{var t,g,k,S,C;j(o),A({id:o.id,name:o.name||"",type:o.type||"text",api_url:((t=o.api_config)==null?void 0:t.url)||"",api_method:((g=o.api_config)==null?void 0:g.method)||"GET",api_timeout:((k=o.api_config)==null?void 0:k.timeout)||10,api_headers:((S=o.api_config)==null?void 0:S.headers)||"",api_params:((C=o.api_config)==null?void 0:C.params)||"",text_content:o.text_content||"",data_content:o.data_content||"",image_url:o.image_url||"",delay_seconds:o.delay_seconds||0,description:o.description||"",enabled:o.enabled}),u(!0)},[]),M=i.useCallback(async()=>{var o,t,g,k,S,C,p,B;if(f){if(!((o=d.name)!=null&&o.trim())){alert("请输入卡密名称");return}if(!d.type){alert("请选择卡密类型");return}try{const w={name:d.name.trim(),type:d.type,description:(t=d.description)==null?void 0:t.trim(),delay_seconds:d.delay_seconds||0,enabled:d.enabled??!0};d.type==="api"?w.api_config={url:((g=d.api_url)==null?void 0:g.trim())||"",method:d.api_method||"GET",timeout:d.api_timeout||10,headers:((k=d.api_headers)==null?void 0:k.trim())||void 0,params:((S=d.api_params)==null?void 0:S.trim())||void 0}:d.type==="text"?w.text_content=((C=d.text_content)==null?void 0:C.trim())||"":d.type==="data"?w.data_content=((p=d.data_content)==null?void 0:p.trim())||"":d.type==="image"&&(w.image_url=((B=d.image_url)==null?void 0:B.trim())||""),await J(f.id,w),u(!1),await n()}catch(w){console.error("更新卡密失败:",w),alert(L(w,"更新失败,请重试"))}}},[d,n,f]),R=i.useCallback(async o=>{if(confirm("确认删除该卡密吗?"))try{await fe(o),await n()}catch(t){console.error("删除卡密失败:",t),alert(L(t,"删除失败,请重试"))}},[n]),v=i.useCallback(async()=>{if(!c.name.trim()){alert("请输入卡密名称");return}if(!c.content.trim()){alert(c.type==="api"?"请输入 API 地址":"请输入卡密内容");return}try{const o={name:c.name.trim(),type:c.type,description:c.description.trim(),enabled:c.enabled,delay_seconds:c.delay_seconds};c.type==="text"&&( Line truncated
@@ -1 +0,0 @@
import{j as e,c as ae,r as i}from"./react-vendor-C_od1ZSF.js";import{g as b0,a as Q0,b as ie}from"./index-BBTWivHc.js";import{o as Z0}from"./contract-COFcZjyb.js";import{L as c0,ak as ne,al as re,M as U0,I as ce,R as le,ad as I0,k as oe,am as pe,s as A0,an as me,ao as ge,ah as de}from"./icons-vendor-CvzvbbIV.js";const P0=[["尊嘟假嘟","https://img.alicdn.com/imgextra/i2/O1CN01hWzOgD1KcmFEIaGwE_!!6000000001185-2-tps-64-64.png_110x10000.jpg_.webp"],["鸡哔你","https://img.alicdn.com/imgextra/i1/O1CN01P9TVJl1JCqCZcQIdW_!!6000000000993-2-tps-64-64.png_110x10000.jpg_.webp"],["谁懂啊","https://img.alicdn.com/imgextra/i1/O1CN01r9qUnx1g3tcrtSmcs_!!6000000004087-2-tps-64-64.png_110x10000.jpg_.webp"],["吗喽","https://img.alicdn.com/imgextra/i4/O1CN01dTynZh1LnbIYTHI1D_!!6000000001344-2-tps-64-64.png_110x10000.jpg_.webp"],["功德+1","https://img.alicdn.com/imgextra/i1/O1CN01l1G5pS1IVn37pfQJi_!!6000000000899-2-tps-64-64.png_110x10000.jpg_.webp"],["city不city啊","https://img.alicdn.com/imgextra/i2/O1CN01zRjPTR29lWHqabmDA_!!6000000008108-2-tps-64-64.png_110x10000.jpg_.webp"],["激推","https://img.alicdn.com/imgextra/i3/O1CN01ADTJ6u1khypfxbfnQ_!!6000000004716-2-tps-64-64.png_110x10000.jpg_.webp"],["微笑","https://img.alicdn.com/imgextra/i1/O1CN017b61R51wRk2lVV7vx_!!6000000006305-2-tps-980-980.png_110x10000.jpg_.webp"],["龇牙","https://img.alicdn.com/imgextra/i2/O1CN01nmOh4S22Yxz8IdEVf_!!6000000007133-2-tps-980-980.png_110x10000.jpg_.webp"],["流泪","https://img.alicdn.com/imgextra/i2/O1CN01Ec1EaL1zqQETcM2dX_!!6000000006765-2-tps-980-980.png_110x10000.jpg_.webp"],["尴尬","https://img.alicdn.com/imgextra/i2/O1CN01UrWH7a1ZVBrgRYXlc_!!6000000003199-2-tps-980-980.png_110x10000.jpg_.webp"],["撇嘴","https://img.alicdn.com/imgextra/i2/O1CN01Sr7o2b1lUWg5KfOD8_!!6000000004822-2-tps-980-980.png_110x10000.jpg_.webp"],["破涕为笑","https://img.alicdn.com/imgextra/i4/O1CN01pPetah1gkwndfn7Fs_!!6000000004181-2-tps-980-980.png_110x10000.jpg_.webp"],["捂脸哭","https://img.alicdn.com/imgextra/i2/O1CN0170KgpE1dE1TuQgd66_!!6000000003703-2-tps-980-980.png_110x10000.jpg_.webp"],["害羞","https://img.alicdn.com/imgextra/i3/O1CN01ZoB0Lb1ps7XpqP8PQ_!!6000000005415-2-tps-980-980.png_110x10000.jpg_.webp"],["感动","https://img.alicdn.com/imgextra/i2/O1CN01wqD4ly29yndR3Qp3A_!!6000000008137-2-tps-980-980.png_110x10000.jpg_.webp"],["滴泪","https://img.alicdn.com/imgextra/i1/O1CN01MpkJ3L1oUTTqfryOn_!!6000000005228-2-tps-980-980.png_110x10000.jpg_.webp"],["暗中观察","https://img.alicdn.com/imgextra/i1/O1CN010LO9yj272W07GlLls_!!6000000007739-2-tps-980-980.png_110x10000.jpg_.webp"],["偷笑","https://img.alicdn.com/imgextra/i4/O1CN01vJtO031g818IuYO7x_!!6000000004096-2-tps-980-980.png_110x10000.jpg_.webp"],["ok","https://img.alicdn.com/imgextra/i3/O1CN01QRkqDF25tz0WcANje_!!6000000007585-2-tps-980-980.png_110x10000.jpg_.webp"],["送花","https://img.alicdn.com/imgextra/i2/O1CN01PpzBNX1JNpeJBWnvr_!!6000000001017-2-tps-980-980.png_110x10000.jpg_.webp"],["大哭","https://img.alicdn.com/imgextra/i4/O1CN014TiaNb1ViEgNvRrTB_!!6000000002686-2-tps-980-980.png_110x10000.jpg_.webp"],["色","https://img.alicdn.com/imgextra/i2/O1CN01840t1B1JaCLGvHnBK_!!6000000001044-2-tps-980-980.png_110x10000.jpg_.webp"],["惊慌","https://img.alicdn.com/imgextra/i1/O1CN01mnqO7G1LAfUnfAN2U_!!6000000001259-2-tps-980-980.png_110x10000.jpg_.webp"],["惊讶","https://img.alicdn.com/imgextra/i3/O1CN0127IeyS1Kw0p0P4jzI_!!6000000001227-2-tps-980-980.png_110x10000.jpg_.webp"],["得意","https://img.alicdn.com/imgextra/i4/O1CN018QUnFv1WpOUES9POZ_!!6000000002837-2-tps-980-980.png_110x10000.jpg_.webp"],["睡","https://img.alicdn.com/imgextra/i2/O1CN01RprGZl1lqVgnEJLCx_!!6000000004870-2-tps-980-980.png_110x10000.jpg_.webp"],["不好意思","https://img.alicdn.com/imgextra/i3/O1CN01rMJJgn1SUXzuVpUhO_!!6000000002250-2-tps-980-980.png_110x10000.jpg_.webp"],["托腮","https://img.alicdn.com/imgextra/i1/O1CN01w3reBU1d3wlgOBtyZ_!!6000000003681-2-tps-980-980.png_110x10000.jpg_.webp"],["发怒","https://img.alicdn.com/imgextra/i2/O1CN013Wzy8d2A8PxGJZPpT_!!6000000008158-2-tps-980-980.png_110x10000.jpg_.webp"],["难过","https://img.alicdn.com/imgextra/i2/O1CN01zcwaSh1G9gZCFuFal_!!6000000000580-2-tps-980-980.png_110x10000.jpg_.webp"],["调皮","https://img.alicdn.com/imgextra/i3/O1CN01Zd1YHi1TI0lwpBe8c_!!6000000002358-2-tps-980-980.png_110x10000.jpg_.webp"],["愉快","https://img.alicdn.com/imgextra/i2/O1CN0145wDk21SWpyjTvsvA_!!6000000002255-2-tps-980-980.png_110x10000.jpg_.webp"],["白眼","https://img.alicdn.com/imgextra/i4/O1CN01nexGth1hwEAT1SHO2_!!6000000004341-2-tps-980-980.png_110x10000.jpg_.webp"],["拒绝","https://img.alicdn.com/imgextra/i2/O1CN01nqusqS1uHXzoUcpXr_!!6000000006012-2-tps-980-980.png_110x10000.jpg_.webp"],["期待","https://img.alicdn.com/imgextra/i3/O1CN01M44QY11Oh8Q5PdMIx_!!6000000001736-2-tps-980-980.png_110x10000.jpg_.webp"],["困","https://img.alicdn.com/imgextra/i4/O1CN01J4hFFz1Y9pmNdBq76_!!6000000003017-2-tps-980-980.png_110x10000.jpg_.webp Line truncated
@@ -0,0 +1 @@
import{j as e,c as h0,r as i}from"./react-vendor-C_od1ZSF.js";import{L as me}from"./vendor-Es4K8PXl.js";import{g as k0,a as G0,b as pe}from"./index-Dw5V5tCq.js";import{o as X0}from"./contract-COFcZjyb.js";import{L as K,ak as ge,al as de,M as P0,I as xe,R as ue,ad as U0,k as he,am as _e,s as z0,an as be,ao as fe,ah as B0,X as je}from"./icons-vendor-CvzvbbIV.js";const K0=[["尊嘟假嘟","https://img.alicdn.com/imgextra/i2/O1CN01hWzOgD1KcmFEIaGwE_!!6000000001185-2-tps-64-64.png_110x10000.jpg_.webp"],["鸡哔你","https://img.alicdn.com/imgextra/i1/O1CN01P9TVJl1JCqCZcQIdW_!!6000000000993-2-tps-64-64.png_110x10000.jpg_.webp"],["谁懂啊","https://img.alicdn.com/imgextra/i1/O1CN01r9qUnx1g3tcrtSmcs_!!6000000004087-2-tps-64-64.png_110x10000.jpg_.webp"],["吗喽","https://img.alicdn.com/imgextra/i4/O1CN01dTynZh1LnbIYTHI1D_!!6000000001344-2-tps-64-64.png_110x10000.jpg_.webp"],["功德+1","https://img.alicdn.com/imgextra/i1/O1CN01l1G5pS1IVn37pfQJi_!!6000000000899-2-tps-64-64.png_110x10000.jpg_.webp"],["city不city啊","https://img.alicdn.com/imgextra/i2/O1CN01zRjPTR29lWHqabmDA_!!6000000008108-2-tps-64-64.png_110x10000.jpg_.webp"],["激推","https://img.alicdn.com/imgextra/i3/O1CN01ADTJ6u1khypfxbfnQ_!!6000000004716-2-tps-64-64.png_110x10000.jpg_.webp"],["微笑","https://img.alicdn.com/imgextra/i1/O1CN017b61R51wRk2lVV7vx_!!6000000006305-2-tps-980-980.png_110x10000.jpg_.webp"],["龇牙","https://img.alicdn.com/imgextra/i2/O1CN01nmOh4S22Yxz8IdEVf_!!6000000007133-2-tps-980-980.png_110x10000.jpg_.webp"],["流泪","https://img.alicdn.com/imgextra/i2/O1CN01Ec1EaL1zqQETcM2dX_!!6000000006765-2-tps-980-980.png_110x10000.jpg_.webp"],["尴尬","https://img.alicdn.com/imgextra/i2/O1CN01UrWH7a1ZVBrgRYXlc_!!6000000003199-2-tps-980-980.png_110x10000.jpg_.webp"],["撇嘴","https://img.alicdn.com/imgextra/i2/O1CN01Sr7o2b1lUWg5KfOD8_!!6000000004822-2-tps-980-980.png_110x10000.jpg_.webp"],["破涕为笑","https://img.alicdn.com/imgextra/i4/O1CN01pPetah1gkwndfn7Fs_!!6000000004181-2-tps-980-980.png_110x10000.jpg_.webp"],["捂脸哭","https://img.alicdn.com/imgextra/i2/O1CN0170KgpE1dE1TuQgd66_!!6000000003703-2-tps-980-980.png_110x10000.jpg_.webp"],["害羞","https://img.alicdn.com/imgextra/i3/O1CN01ZoB0Lb1ps7XpqP8PQ_!!6000000005415-2-tps-980-980.png_110x10000.jpg_.webp"],["感动","https://img.alicdn.com/imgextra/i2/O1CN01wqD4ly29yndR3Qp3A_!!6000000008137-2-tps-980-980.png_110x10000.jpg_.webp"],["滴泪","https://img.alicdn.com/imgextra/i1/O1CN01MpkJ3L1oUTTqfryOn_!!6000000005228-2-tps-980-980.png_110x10000.jpg_.webp"],["暗中观察","https://img.alicdn.com/imgextra/i1/O1CN010LO9yj272W07GlLls_!!6000000007739-2-tps-980-980.png_110x10000.jpg_.webp"],["偷笑","https://img.alicdn.com/imgextra/i4/O1CN01vJtO031g818IuYO7x_!!6000000004096-2-tps-980-980.png_110x10000.jpg_.webp"],["ok","https://img.alicdn.com/imgextra/i3/O1CN01QRkqDF25tz0WcANje_!!6000000007585-2-tps-980-980.png_110x10000.jpg_.webp"],["送花","https://img.alicdn.com/imgextra/i2/O1CN01PpzBNX1JNpeJBWnvr_!!6000000001017-2-tps-980-980.png_110x10000.jpg_.webp"],["大哭","https://img.alicdn.com/imgextra/i4/O1CN014TiaNb1ViEgNvRrTB_!!6000000002686-2-tps-980-980.png_110x10000.jpg_.webp"],["色","https://img.alicdn.com/imgextra/i2/O1CN01840t1B1JaCLGvHnBK_!!6000000001044-2-tps-980-980.png_110x10000.jpg_.webp"],["惊慌","https://img.alicdn.com/imgextra/i1/O1CN01mnqO7G1LAfUnfAN2U_!!6000000001259-2-tps-980-980.png_110x10000.jpg_.webp"],["惊讶","https://img.alicdn.com/imgextra/i3/O1CN0127IeyS1Kw0p0P4jzI_!!6000000001227-2-tps-980-980.png_110x10000.jpg_.webp"],["得意","https://img.alicdn.com/imgextra/i4/O1CN018QUnFv1WpOUES9POZ_!!6000000002837-2-tps-980-980.png_110x10000.jpg_.webp"],["睡","https://img.alicdn.com/imgextra/i2/O1CN01RprGZl1lqVgnEJLCx_!!6000000004870-2-tps-980-980.png_110x10000.jpg_.webp"],["不好意思","https://img.alicdn.com/imgextra/i3/O1CN01rMJJgn1SUXzuVpUhO_!!6000000002250-2-tps-980-980.png_110x10000.jpg_.webp"],["托腮","https://img.alicdn.com/imgextra/i1/O1CN01w3reBU1d3wlgOBtyZ_!!6000000003681-2-tps-980-980.png_110x10000.jpg_.webp"],["发怒","https://img.alicdn.com/imgextra/i2/O1CN013Wzy8d2A8PxGJZPpT_!!6000000008158-2-tps-980-980.png_110x10000.jpg_.webp"],["难过","https://img.alicdn.com/imgextra/i2/O1CN01zcwaSh1G9gZCFuFal_!!6000000000580-2-tps-980-980.png_110x10000.jpg_.webp"],["调皮","https://img.alicdn.com/imgextra/i3/O1CN01Zd1YHi1TI0lwpBe8c_!!6000000002358-2-tps-980-980.png_110x10000.jpg_.webp"],["愉快","https://img.alicdn.com/imgextra/i2/O1CN0145wDk21SWpyjTvsvA_!!6000000002255-2-tps-980-980.png_110x10000.jpg_.webp"],["白眼","https://img.alicdn.com/imgextra/i4/O1CN01nexGth1hwEAT1SHO2_!!6000000004341-2-tps-980-980.png_110x10000.jpg_.webp"],["拒绝","https://img.alicdn.com/imgextra/i2/O1CN01nqusqS1uHXzoUcpXr_!!6000000006012-2-tps-980-980.png_110x10000.jpg_.webp"],["期待","https://img.alicdn.com/imgextra/i3/O1CN01M44QY11Oh8Q5PdMIx_!!6000000001736-2-tps-980-980.png_110x10000.jpg_.webp"],["困","https://img.alicdn.com/imgextra/i4/O1CN01J4hFFz1Y9pmNdBq76_!!60 Line truncated
@@ -1 +1 @@
import{r as c,j as e}from"./react-vendor-C_od1ZSF.js";import{f as me}from"./dateTime-DDi7rqpW.js";import{g as q}from"./index-BBTWivHc.js";import{c as de,o as ge}from"./contract-COFcZjyb.js";import{j as xe,k as he,l as te,D as pe,c as be,P as fe,m as se,E as ye,T as je}from"./icons-vendor-CvzvbbIV.js";import{R as E,B as ve,X as ae,Y as re,T as F,a as Ne,C as U,A as we,b as _e,c as ke,P as ne,d as le,L as De}from"./charts-vendor-BxxJOyEX.js";import"./vendor-D-Edl3pr.js";const M=t=>{const a=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0");return`${a}-${s}-${l}`},H=(t,a)=>{const s=new Date(t);return s.setHours(12,0,0,0),s.setDate(s.getDate()+a),s},X=(t,a)=>({startDate:M(H(t,-(a-1))),endDate:M(t)}),ue=(t,a=new Date,s="",l="")=>{if(t==="custom"&&s&&l){if(s>l)throw new Error("开始日期不能晚于结束日期");return{startDate:s,endDate:l}}return t==="yesterday"?X(H(a,-1),1):X(a,t==="3days"?3:t==="30days"?30:t==="today"?1:7)},Se=t=>{const a=new Date(`${t.startDate}T12:00:00`),s=new Date(`${t.endDate}T12:00:00`),l=Math.round((s.getTime()-a.getTime())/864e5)+1,n=H(a,-1);return X(n,l)},Ce=t=>{const a={};return t.forEach(s=>{a[s.item_id]=s.item_title||s.item_id}),a},$e=t=>{var a;return((a=t.daily_stats)==null?void 0:a.map(s=>({name:s.date.slice(5),amount:s.amount,orders:s.order_count,avgAmount:s.order_count>0?(s.amount/s.order_count).toFixed(2):0})))||[]},Re=(t,a)=>(t.item_stats||[]).map(s=>{const l=a[s.item_id]||s.item_id;return{name:l.length>12?`${l.substring(0,12)}...`:l,sales:s.order_count}}).sort((s,l)=>l.sales-s.sales).slice(0,10),Le=(t,a,s)=>{const l=t.revenue_stats.total_orders||0;return(t.item_stats||[]).map(n=>{const o=a[n.item_id]||n.item_id;return{name:o.length>10?`${o.substring(0,10)}...`:o,value:n.order_count,percent:l>0?n.order_count/l*100:0}}).sort((n,o)=>o.value-n.value).slice(0,6).map((n,o)=>({...n,color:s[o%s.length]}))},Ae=(t,a,s)=>{const l=t.revenue_stats.total_amount||0;return(t.item_stats||[]).map(n=>{const o=a[n.item_id]||n.item_id;return{name:o.length>12?`${o.substring(0,12)}...`:o,value:n.total_amount,orderCount:n.order_count,percentage:l>0?n.total_amount/l*100:0}}).sort((n,o)=>o.value-n.value).slice(0,5).map((n,o)=>({...n,color:s[o%s.length],percentage:n.percentage.toFixed(1)}))},Oe=(t,a)=>{if(!t||!a)return null;const s=t.revenue_stats.total_amount,l=a.revenue_stats.total_amount;if(l===0)return s>0?"+100%":"0%";const n=(s-l)/l*100;return`${n>=0?"+":""}${n.toFixed(1)}%`},Te=t=>({today:"今天",yesterday:"昨天","3days":"三天内","7days":"7天内","30days":"一个月内",custom:"自定义"})[t.range]||"所选范围",ze=t=>Math.max(...t.map(a=>a.sales),1),P=(t,a,s)=>t===a&&!s.aborted,oe=t=>{const a=String(t||"");return a==="paid"?"pending_ship":["processing","pending_ship","shipped","completed","cancelled","refunding"].includes(a)?a:"unknown"},Pe=async t=>q("/api/v1/analytics/dashboard",void 0,t),We=async(t,a)=>{const s=await q("/api/v1/items",void 0,a);return de(s,["items","data","results"]).map(n=>({...n,id:n.id||`${n.cookie_id}-${n.item_id}`,is_multi_spec:n.is_multi_spec===!0||n.is_multi_spec===1,multi_quantity_delivery:n.multi_quantity_delivery===!0||n.multi_quantity_delivery===1}))},ie=async(t=7,a)=>{let s;if(typeof t=="number"){const l=new Date,n=new Date;n.setDate(n.getDate()-t),s={start_date:M(n),end_date:M(l)}}else s=t;return q("/api/v1/analytics/orders",{...s,timezone_offset_minutes:-new Date().getTimezoneOffset()},a)},Ee=async(t,a)=>{const s=await q("/api/v1/analytics/orders/valid",{...t,timezone_offset_minutes:-new Date().getTimezoneOffset()},a),l=ge(s,["data","result"])||{},o=de(s,["orders","data","items"]).map(b=>({...b,id:b.order_id,status:oe(b.status||b.order_status),order_status:oe(b.order_status),quantity:Number(b.quantity||1)}));return{orders:o,total:Number(l.total??o.length),truncated:l.truncated===!0}},ce=t=>t instanceof Error&&t.message==="请求已取消",G=(t,a)=>t instanceof Error?t.message:a,Fe=t=>{const{range:a,customStartDate:s,customEndDate:l,customRangeVersion:n}=t,[o,b]=c.useState(null),[_,I]=c.useState(null),[K,v]=c.useState({overview:"idle",range:"idle",error:""}),[d,T]=c.useState(0),R=c.useRef(0),S=c.useRef(0),L=c.useMemo(()=>({range:a,customStartDate:s,customEndDate:l}),[l,s,a]),D=c.useCallback(()=>T(u=>u+1),[]);c.useEffect(()=>{const u=++S.current,h=new AbortController;return v(m=>({...m,overview:"loading",error:""})),Promise.all([Pe({signal:h.signal}),We(void 0,{signal:h.signal})]).then(([m,g])=>{P(S.current,u,h.signal)&&(b({stats:m,items:g,itemNames:Ce(g)}),v(p=>({...p,overview:"success"})))}).catch(m=>{!P(S.current,u,h.signal)||ce(m)||v(g=>({...g,overview:"error",error:G(m,"概览加载失败")}))}),(()=>h.abort())},[d]),c.useEffect(()=>{let u;try{u=ue(a,new Date,s,l)}catch(p){v(w=>({...w,range:"error",error:G(p,"日期范围无效")}));return}const h=Se(u),m=++R.current,g=new AbortController;return v(p=>({...p,range:"loading",error:""})),Promise.all([ie({start_date:u.startDate,end_date:u.endDate},{signLine truncated import{r as c,j as e}from"./react-vendor-C_od1ZSF.js";import{f as me}from"./dateTime-DDi7rqpW.js";import{g as q}from"./index-Dw5V5tCq.js";import{c as de,o as ge}from"./contract-COFcZjyb.js";import{j as xe,k as he,l as te,D as pe,c as be,P as fe,m as se,E as ye,T as je}from"./icons-vendor-CvzvbbIV.js";import{R as E,B as ve,X as ae,Y as re,T as F,a as Ne,C as U,A as we,b as _e,c as ke,P as ne,d as le,L as De}from"./charts-vendor-deWqkrdG.js";import"./vendor-Es4K8PXl.js";const M=t=>{const a=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0");return`${a}-${s}-${l}`},H=(t,a)=>{const s=new Date(t);return s.setHours(12,0,0,0),s.setDate(s.getDate()+a),s},X=(t,a)=>({startDate:M(H(t,-(a-1))),endDate:M(t)}),ue=(t,a=new Date,s="",l="")=>{if(t==="custom"&&s&&l){if(s>l)throw new Error("开始日期不能晚于结束日期");return{startDate:s,endDate:l}}return t==="yesterday"?X(H(a,-1),1):X(a,t==="3days"?3:t==="30days"?30:t==="today"?1:7)},Se=t=>{const a=new Date(`${t.startDate}T12:00:00`),s=new Date(`${t.endDate}T12:00:00`),l=Math.round((s.getTime()-a.getTime())/864e5)+1,n=H(a,-1);return X(n,l)},Ce=t=>{const a={};return t.forEach(s=>{a[s.item_id]=s.item_title||s.item_id}),a},$e=t=>{var a;return((a=t.daily_stats)==null?void 0:a.map(s=>({name:s.date.slice(5),amount:s.amount,orders:s.order_count,avgAmount:s.order_count>0?(s.amount/s.order_count).toFixed(2):0})))||[]},Re=(t,a)=>(t.item_stats||[]).map(s=>{const l=a[s.item_id]||s.item_id;return{name:l.length>12?`${l.substring(0,12)}...`:l,sales:s.order_count}}).sort((s,l)=>l.sales-s.sales).slice(0,10),Le=(t,a,s)=>{const l=t.revenue_stats.total_orders||0;return(t.item_stats||[]).map(n=>{const o=a[n.item_id]||n.item_id;return{name:o.length>10?`${o.substring(0,10)}...`:o,value:n.order_count,percent:l>0?n.order_count/l*100:0}}).sort((n,o)=>o.value-n.value).slice(0,6).map((n,o)=>({...n,color:s[o%s.length]}))},Ae=(t,a,s)=>{const l=t.revenue_stats.total_amount||0;return(t.item_stats||[]).map(n=>{const o=a[n.item_id]||n.item_id;return{name:o.length>12?`${o.substring(0,12)}...`:o,value:n.total_amount,orderCount:n.order_count,percentage:l>0?n.total_amount/l*100:0}}).sort((n,o)=>o.value-n.value).slice(0,5).map((n,o)=>({...n,color:s[o%s.length],percentage:n.percentage.toFixed(1)}))},Oe=(t,a)=>{if(!t||!a)return null;const s=t.revenue_stats.total_amount,l=a.revenue_stats.total_amount;if(l===0)return s>0?"+100%":"0%";const n=(s-l)/l*100;return`${n>=0?"+":""}${n.toFixed(1)}%`},Te=t=>({today:"今天",yesterday:"昨天","3days":"三天内","7days":"7天内","30days":"一个月内",custom:"自定义"})[t.range]||"所选范围",ze=t=>Math.max(...t.map(a=>a.sales),1),P=(t,a,s)=>t===a&&!s.aborted,oe=t=>{const a=String(t||"");return a==="paid"?"pending_ship":["processing","pending_ship","shipped","completed","cancelled","refunding"].includes(a)?a:"unknown"},Pe=async t=>q("/api/v1/analytics/dashboard",void 0,t),We=async(t,a)=>{const s=await q("/api/v1/items",void 0,a);return de(s,["items","data","results"]).map(n=>({...n,id:n.id||`${n.cookie_id}-${n.item_id}`,is_multi_spec:n.is_multi_spec===!0||n.is_multi_spec===1,multi_quantity_delivery:n.multi_quantity_delivery===!0||n.multi_quantity_delivery===1}))},ie=async(t=7,a)=>{let s;if(typeof t=="number"){const l=new Date,n=new Date;n.setDate(n.getDate()-t),s={start_date:M(n),end_date:M(l)}}else s=t;return q("/api/v1/analytics/orders",{...s,timezone_offset_minutes:-new Date().getTimezoneOffset()},a)},Ee=async(t,a)=>{const s=await q("/api/v1/analytics/orders/valid",{...t,timezone_offset_minutes:-new Date().getTimezoneOffset()},a),l=ge(s,["data","result"])||{},o=de(s,["orders","data","items"]).map(b=>({...b,id:b.order_id,status:oe(b.status||b.order_status),order_status:oe(b.order_status),quantity:Number(b.quantity||1)}));return{orders:o,total:Number(l.total??o.length),truncated:l.truncated===!0}},ce=t=>t instanceof Error&&t.message==="请求已取消",G=(t,a)=>t instanceof Error?t.message:a,Fe=t=>{const{range:a,customStartDate:s,customEndDate:l,customRangeVersion:n}=t,[o,b]=c.useState(null),[_,I]=c.useState(null),[K,v]=c.useState({overview:"idle",range:"idle",error:""}),[d,T]=c.useState(0),R=c.useRef(0),S=c.useRef(0),L=c.useMemo(()=>({range:a,customStartDate:s,customEndDate:l}),[l,s,a]),D=c.useCallback(()=>T(u=>u+1),[]);c.useEffect(()=>{const u=++S.current,h=new AbortController;return v(m=>({...m,overview:"loading",error:""})),Promise.all([Pe({signal:h.signal}),We(void 0,{signal:h.signal})]).then(([m,g])=>{P(S.current,u,h.signal)&&(b({stats:m,items:g,itemNames:Ce(g)}),v(p=>({...p,overview:"success"})))}).catch(m=>{!P(S.current,u,h.signal)||ce(m)||v(g=>({...g,overview:"error",error:G(m,"概览加载失败")}))}),(()=>h.abort())},[d]),c.useEffect(()=>{let u;try{u=ue(a,new Date,s,l)}catch(p){v(w=>({...w,range:"error",error:G(p,"日期范围无效")}));return}const h=Se(u),m=++R.current,g=new AbortController;return v(p=>({...p,range:"loading",error:""})),Promise.all([ie({start_date:u.startDate,end_date:u.endDate},{signLine truncated
@@ -1,2 +1,2 @@
import{r as i,j as e,b as be}from"./react-vendor-C_od1ZSF.js";import{g as xe,a as te,b as We,d as Ye,p as gt}from"./index-BBTWivHc.js";import{c as He}from"./contract-COFcZjyb.js";import{a3 as bt,U as Me,R as we,N as Ee,a4 as _e,a5 as ye,V as yt,F as ft,B as jt,a6 as Ge,a7 as vt,a8 as Nt,A as wt,d as _t,X as oe,r as kt,a9 as $e,I as De}from"./icons-vendor-CvzvbbIV.js";const Ue="ydisks-amap-js-api",Ct="c9b68d4ce9a2a97f22a4a439404488ca";let de=null;const It=()=>Ct,St=()=>window.AMap?Promise.resolve(window.AMap):de||(de=new Promise((s,r)=>{const o=document.getElementById(Ue),u=o||document.createElement("script"),h=()=>{window.__ydisksAmapLoaded=void 0,window.clearTimeout(S)},j=()=>{window.AMap?(h(),s(window.AMap)):(h(),r(new Error("高德地图 API 加载完成但未找到 AMap 对象")))},S=window.setTimeout(()=>{h(),r(new Error("高德地图 API 加载超时,请检查网络或 VITE_AMAP_JS_KEY 配置"))},15e3);window.__ydisksAmapLoaded=j,u.id=Ue,u.async=!0,u.src=`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(It())}&plugin=AMap.PlaceSearch&callback=__ydisksAmapLoaded`,u.onerror=()=>{h(),r(new Error("高德地图 API 加载失败,请检查网络或 VITE_AMAP_JS_KEY 配置"))},o||document.head.appendChild(u)}).catch(s=>{throw de=null,s}),de),fe=s=>Number.isFinite(s)&&s!==0,Pt=s=>{var h,j;const r=Number((h=s.location)==null?void 0:h.lng),o=Number((j=s.location)==null?void 0:j.lat),u={area:String(s.adname||"").trim(),city:String(s.cityname||"").trim(),division_id:String(s.adcode||"").trim(),longitude:r,latitude:o,poi_id:String(s.id||"").trim(),poi_name:String(s.name||"").trim(),province:String(s.pname||"").trim()};return!u.division_id||!u.province||!u.city||!u.poi_id||!u.poi_name||!fe(r)||!fe(o)||r<-180||r>180||o<-90||o>90?null:u},Bt=async(s,r)=>{if(!fe(s)||!fe(r)||s<-180||s>180||r<-90||r>90)throw new Error("经纬度无效");const o=await St();return new Promise((u,h)=>{new o.PlaceSearch({extensions:"all",pageSize:10}).searchNearBy("",[s,r],1e3,(S,w)=>{var C;if(S!=="complete"){if(S==="no_data"){u([]);return}h(new Error("高德地图附近地址查询失败,请稍后重试"));return}const R=(((C=w==null?void 0:w.poiList)==null?void 0:C.pois)||[]).map(Pt).filter(D=>D!==null);u(R)})})},qt=async s=>xe("/api/v1/accounts/details",void 0,s),ze=async s=>xe("/api/v1/automation-rules",void 0,s),ke=s=>s===!0||s===1||s==="1",Oe=async(s,r)=>{const o=await xe("/api/v1/items",void 0,r);return He(o,["items","data","results"]).map(h=>({...h,id:h.id||`${h.cookie_id}-${h.item_id}`,is_multi_spec:ke(h.is_multi_spec),is_multi_qty_ship:ke(h.is_multi_qty_ship??h.multi_quantity_delivery),multi_quantity_delivery:ke(h.multi_quantity_delivery??h.is_multi_qty_ship)}))},Ft=async s=>te("/api/v1/items/get-all-from-account",{cookie_id:s}),Rt=async(s,r)=>Ye(`/api/v1/items/${s}/${r}`),Lt=async(s,r)=>te(`/api/v1/items/${s}`,r),At=async s=>{const r=new FormData;r.set("cookie_id",s.cookie_id),r.set("title",s.title),r.set("description",s.description),r.set("price",s.price),r.set("original_price",s.original_price||""),r.set("quantity",String(s.quantity)),r.set("postage_mode",s.postage_mode),r.set("postage",s.postage||""),s.location&&r.set("location",JSON.stringify(s.location));for(const o of s.images)r.append("images",o);return We("/api/v1/items/publish",r)},Mt=async(s,r,o)=>te("/api/v1/items/publish-categories/recommend",{cookie_id:s,keyword:r},o),Et=async(s,r)=>{const o=new FormData;return o.set("file",s.file),s.imagesZip&&o.set("images_zip",s.imagesZip),s.defaultCookieId&&o.set("default_cookie_id",s.defaultCookieId),o.set("fallback_category_id",s.fallbackCategory.catId),o.set("fallback_category_name",s.fallbackCategory.catName),o.set("fallback_channel_category_id",s.fallbackCategory.channelCatId||""),o.set("fallback_tb_category_id",s.fallbackCategory.tbCatId||""),s.location&&o.set("location",JSON.stringify(s.location)),We("/api/v1/items/publish-batches/preview",o,r)},Gt=async(s,r)=>te("/api/v1/items/publish-batches",{preview_id:s},r),ee=async(s,r)=>xe(`/api/v1/items/publish-batches/${s}`,void 0,r),Xe=async(s=20,r)=>{const o=await xe("/api/v1/items/publish-batches",{limit:s},r);return He(o,["batches","data","items"])},Te=async(s,r)=>Ye(`/api/v1/items/publish-batches/${s}`,void 0,r),$t=async(s,r)=>te(`/api/v1/items/publish-batches/${s}/cancel`,{},r),Dt=async(s,r)=>te(`/api/v1/items/publish-batches/${s}/retry-failed`,{},r),Ut=async(s,r,o)=>gt(`/api/v1/items/${s}/${r}`,o),zt=s=>s.find(r=>r.status==="running"||r.status==="canceling"),Ie=s=>s==="running"||s==="canceling",Ot=s=>!!(s!=null&&s.preview_id&&Number(s.valid||0)>0),Tt=s=>!!(s!=null&&s.id&&Number(s.retryable||0)>0&&!Ie(s.status)),Kt=(s,r)=>s===r,Ke=s=>{switch(s){case"preview":return"待确认";case"pending":return"等待中";case"running":return"发布中";case"canceling":return"正在安全取消";case"success":return"成功";case"failed":return"失败";case"completed":return"已完成";case"partially_failed":return"部分失败";case"canceled":return"已取消";default:returLine truncated import{r as i,j as e,b as be}from"./react-vendor-C_od1ZSF.js";import{g as xe,a as te,b as We,d as Ye,p as gt}from"./index-Dw5V5tCq.js";import{c as He}from"./contract-COFcZjyb.js";import{a3 as bt,U as Me,R as we,N as Ee,a4 as _e,a5 as ye,V as yt,F as ft,B as jt,a6 as Ge,a7 as vt,a8 as Nt,A as wt,d as _t,X as oe,r as kt,a9 as $e,I as De}from"./icons-vendor-CvzvbbIV.js";const Ue="ydisks-amap-js-api",Ct="c9b68d4ce9a2a97f22a4a439404488ca";let de=null;const It=()=>Ct,St=()=>window.AMap?Promise.resolve(window.AMap):de||(de=new Promise((s,r)=>{const o=document.getElementById(Ue),u=o||document.createElement("script"),h=()=>{window.__ydisksAmapLoaded=void 0,window.clearTimeout(S)},j=()=>{window.AMap?(h(),s(window.AMap)):(h(),r(new Error("高德地图 API 加载完成但未找到 AMap 对象")))},S=window.setTimeout(()=>{h(),r(new Error("高德地图 API 加载超时,请检查网络或 VITE_AMAP_JS_KEY 配置"))},15e3);window.__ydisksAmapLoaded=j,u.id=Ue,u.async=!0,u.src=`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(It())}&plugin=AMap.PlaceSearch&callback=__ydisksAmapLoaded`,u.onerror=()=>{h(),r(new Error("高德地图 API 加载失败,请检查网络或 VITE_AMAP_JS_KEY 配置"))},o||document.head.appendChild(u)}).catch(s=>{throw de=null,s}),de),fe=s=>Number.isFinite(s)&&s!==0,Pt=s=>{var h,j;const r=Number((h=s.location)==null?void 0:h.lng),o=Number((j=s.location)==null?void 0:j.lat),u={area:String(s.adname||"").trim(),city:String(s.cityname||"").trim(),division_id:String(s.adcode||"").trim(),longitude:r,latitude:o,poi_id:String(s.id||"").trim(),poi_name:String(s.name||"").trim(),province:String(s.pname||"").trim()};return!u.division_id||!u.province||!u.city||!u.poi_id||!u.poi_name||!fe(r)||!fe(o)||r<-180||r>180||o<-90||o>90?null:u},Bt=async(s,r)=>{if(!fe(s)||!fe(r)||s<-180||s>180||r<-90||r>90)throw new Error("经纬度无效");const o=await St();return new Promise((u,h)=>{new o.PlaceSearch({extensions:"all",pageSize:10}).searchNearBy("",[s,r],1e3,(S,w)=>{var C;if(S!=="complete"){if(S==="no_data"){u([]);return}h(new Error("高德地图附近地址查询失败,请稍后重试"));return}const R=(((C=w==null?void 0:w.poiList)==null?void 0:C.pois)||[]).map(Pt).filter(D=>D!==null);u(R)})})},qt=async s=>xe("/api/v1/accounts/details",void 0,s),ze=async s=>xe("/api/v1/automation-rules",void 0,s),ke=s=>s===!0||s===1||s==="1",Oe=async(s,r)=>{const o=await xe("/api/v1/items",void 0,r);return He(o,["items","data","results"]).map(h=>({...h,id:h.id||`${h.cookie_id}-${h.item_id}`,is_multi_spec:ke(h.is_multi_spec),is_multi_qty_ship:ke(h.is_multi_qty_ship??h.multi_quantity_delivery),multi_quantity_delivery:ke(h.multi_quantity_delivery??h.is_multi_qty_ship)}))},Ft=async s=>te("/api/v1/items/get-all-from-account",{cookie_id:s}),Rt=async(s,r)=>Ye(`/api/v1/items/${s}/${r}`),Lt=async(s,r)=>te(`/api/v1/items/${s}`,r),At=async s=>{const r=new FormData;r.set("cookie_id",s.cookie_id),r.set("title",s.title),r.set("description",s.description),r.set("price",s.price),r.set("original_price",s.original_price||""),r.set("quantity",String(s.quantity)),r.set("postage_mode",s.postage_mode),r.set("postage",s.postage||""),s.location&&r.set("location",JSON.stringify(s.location));for(const o of s.images)r.append("images",o);return We("/api/v1/items/publish",r)},Mt=async(s,r,o)=>te("/api/v1/items/publish-categories/recommend",{cookie_id:s,keyword:r},o),Et=async(s,r)=>{const o=new FormData;return o.set("file",s.file),s.imagesZip&&o.set("images_zip",s.imagesZip),s.defaultCookieId&&o.set("default_cookie_id",s.defaultCookieId),o.set("fallback_category_id",s.fallbackCategory.catId),o.set("fallback_category_name",s.fallbackCategory.catName),o.set("fallback_channel_category_id",s.fallbackCategory.channelCatId||""),o.set("fallback_tb_category_id",s.fallbackCategory.tbCatId||""),s.location&&o.set("location",JSON.stringify(s.location)),We("/api/v1/items/publish-batches/preview",o,r)},Gt=async(s,r)=>te("/api/v1/items/publish-batches",{preview_id:s},r),ee=async(s,r)=>xe(`/api/v1/items/publish-batches/${s}`,void 0,r),Xe=async(s=20,r)=>{const o=await xe("/api/v1/items/publish-batches",{limit:s},r);return He(o,["batches","data","items"])},Te=async(s,r)=>Ye(`/api/v1/items/publish-batches/${s}`,void 0,r),$t=async(s,r)=>te(`/api/v1/items/publish-batches/${s}/cancel`,{},r),Dt=async(s,r)=>te(`/api/v1/items/publish-batches/${s}/retry-failed`,{},r),Ut=async(s,r,o)=>gt(`/api/v1/items/${s}/${r}`,o),zt=s=>s.find(r=>r.status==="running"||r.status==="canceling"),Ie=s=>s==="running"||s==="canceling",Ot=s=>!!(s!=null&&s.preview_id&&Number(s.valid||0)>0),Tt=s=>!!(s!=null&&s.id&&Number(s.retryable||0)>0&&!Ie(s.status)),Kt=(s,r)=>s===r,Ke=s=>{switch(s){case"preview":return"待确认";case"pending":return"等待中";case"running":return"发布中";case"canceling":return"正在安全取消";case"success":return"成功";case"failed":return"失败";case"completed":return"已完成";case"partially_failed":return"部分失败";case"canceled":return"已取消";default:returLine truncated
`),P=new Blob(["\uFEFF"+I],{type:"text/csv;charset=utf-8"}),ue=URL.createObjectURL(P),W=document.createElement("a");W.href=ue,W.download="批量铺货模板.csv",document.body.appendChild(W),W.click(),W.remove(),URL.revokeObjectURL(ue)},[]),me=i.useCallback(()=>{f(l=>({...l,cookie_id:s||l.cookie_id})),b(!0)},[s]),a=i.useCallback(()=>{m(l=>({...l,cookie_id:s||l.cookie_id})),d(!0)},[s]),n=i.useCallback(async l=>{if(!(l?s:x.cookie_id))return alert("请先选择发布账号");if(!navigator.geolocation)return alert("当前浏览器不支持定位");k(!0),navigator.geolocation.getCurrentPosition(async I=>{try{const P=await Bt(I.coords.longitude,I.coords.latitude);if(!P.length)throw new Error("当前位置附近没有可用的高德发货地,请稍后重试");l?(S(P),w(P[0])):(z(P),L(P[0]))}catch(P){alert(Ce(P,"获取发货地失败"))}finally{k(!1)}},I=>{k(!1),alert(I.code===I.PERMISSION_DENIED?"定位权限被拒绝,请在浏览器设置中允许定位":"无法获取当前位置,请稍后重试")},{enableHighAccuracy:!0,timeout:15e3,maximumAge:6e4})},[x.cookie_id,s,w,S]);return{selectedAccount:s,setSelectedAccount:r,loading:R,publishing:D,showEditModal:E,setShowEditModal:B,showAddModal:G,setShowAddModal:b,showPublishModal:q,setShowPublishModal:d,locationLoading:v,publishLocations:U,setPublishLocations:z,publishLocation:O,setPublishLocation:L,selectedItem:F,editForm:y,setEditForm:T,addForm:g,setAddForm:f,publishForm:x,setPublishForm:m,publishImagePreviews:K,handleSync:H,handleEdit:V,handleSaveEdit:se,handleDelete:X,handleAddItem:ae,handlePublishItem:le,downloadPublishTemplate:re,openAddModal:me,openPublishModal:a,locateForPublish:n}},Vt=({phase:s})=>{const r=[["upload","1 上传"],["preview","2 预检"],["running","3 发布"],["done","4 结果"]];return e.jsx("div",{className:"grid grid-cols-4 gap-2",children:r.map(([o,u])=>e.jsx("div",{className:`rounded-xl px-3 py-2 text-center text-xs font-extrabold border ${s===o?"bg-blue-600 text-white border-blue-600":"bg-gray-50 text-gray-500 border-gray-100"}`,children:u},o))})},Wt=s=>{const r=String(s||"").trim();return r?/^[¥¥]/.test(r)?r:`¥${r}`:"-"},es=({onConfigureDelivery:s})=>{const[r,o]=i.useState([]),[u,h]=i.useState([]),[j,S]=i.useState([]),[w,R]=i.useState(""),[C,D]=i.useState(""),M=i.useRef(0),E=i.useRef(0),B=i.useCallback(async()=>{const t=++M.current,c=await Oe();t===M.current&&o(c)},[]),G=i.useCallback(async()=>{const t=++E.current,c=await ze();t===E.current&&h(c)},[]),b=Jt({selectedAccount:w,loadItems:B,loadShippingRules:G}),{showBatchModal:q,batchLoading:d,batchPhase:v,batchFile:k,setBatchFile:U,batchImagesZip:z,setBatchImagesZip:O,batchCategoryKeyword:L,setBatchCategoryKeyword:F,batchCategoryLoading:Z,batchFallbackCategory:y,setBatchFallbackCategory:T,batchPreview:g,batchDetail:f,recentBatch:x,setRecentBatch:m,batchLocations:K,batchLocation:Y,setBatchLocations:H,setBatchLocation:V,openBatchModal:se,handleRecommendBatchCategory:X,openRecentBatchResult:ae,handlePreviewBatch:le,handleStartBatch:re,handleCancelBatch:me,abandonBatchPreview:a,closeBatchModal:n,handleRetryBatchFailed:l}=b,p=Zt({selectedAccount:w,setSelectedAccount:R,setItems:o,loadItems:B,loadShippingRules:G,onConfigureDelivery:s,setBatchLocations:H,setBatchLocation:V}),{loading:I,publishing:P,showEditModal:ue,setShowEditModal:W,showAddModal:je,setShowAddModal:ve,showPublishModal:Qe,setShowPublishModal:et,locationLoading:he,publishLocations:pe,setPublishLocations:tt,publishLocation:st,setPublishLocation:Se,selectedItem:Pe,editForm:J,setEditForm:ge,addForm:A,setAddForm:ne,publishForm:N,setPublishForm:$,publishImagePreviews:Be,handleSync:at,handleEdit:lt,handleSaveEdit:rt,handleDelete:nt,handleAddItem:it,handlePublishItem:ct,downloadPublishTemplate:ot,openAddModal:dt,openPublishModal:xt,locateForPublish:qe}=p;i.useEffect(()=>{const t=new AbortController,c=++M.current,_=++E.current;let ce=!0;return Promise.all([qt({signal:t.signal}),Oe(void 0,{signal:t.signal}),ze({signal:t.signal}),Xe(20,{signal:t.signal})]).then(([Q,ut,ht,Ae])=>{if(!ce||t.signal.aborted||c!==M.current||_!==E.current)return;S(Q),o(ut),h(ht);const pt=Ae.find(Ne=>["running","canceling"].includes(Ne.status))||Ae.find(Ne=>Ne.status!=="preview");m(pt||null)}).catch(Q=>{t.signal.aborted||console.error("加载商品配置失败:",Q)}),(()=>{ce=!1,t.abort()})},[]);const mt=t=>u.filter(c=>c.cookie_id===t.cookie_id&&c.item_id===t.item_id).length>0?u.filter(c=>c.cookie_id===t.cookie_id&&c.item_id===t.item_id):u.filter(c=>c.cookie_id===t.cookie_id&&!c.item_id),Fe=i.useMemo(()=>new Map(j.map(t=>[t.id,t])),[j]),Re=i.useMemo(()=>C?r.filter(t=>t.cookie_id===C):r,[C,r]),ie=t=>{const c=Fe.get(t),_=(c==null?void 0:c.remark)||(c==null?void 0:c.nickname);return _?`${_} · ${t.slice(0,6)}`:`账号 ${t.slice(0,8)}`},Le=t=>{const c=Fe.get(t);return(c==null?void 0:c.remark)||(c==null?void 0:c.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl: Line truncated `),P=new Blob(["\uFEFF"+I],{type:"text/csv;charset=utf-8"}),ue=URL.createObjectURL(P),W=document.createElement("a");W.href=ue,W.download="批量铺货模板.csv",document.body.appendChild(W),W.click(),W.remove(),URL.revokeObjectURL(ue)},[]),me=i.useCallback(()=>{f(l=>({...l,cookie_id:s||l.cookie_id})),b(!0)},[s]),a=i.useCallback(()=>{m(l=>({...l,cookie_id:s||l.cookie_id})),d(!0)},[s]),n=i.useCallback(async l=>{if(!(l?s:x.cookie_id))return alert("请先选择发布账号");if(!navigator.geolocation)return alert("当前浏览器不支持定位");k(!0),navigator.geolocation.getCurrentPosition(async I=>{try{const P=await Bt(I.coords.longitude,I.coords.latitude);if(!P.length)throw new Error("当前位置附近没有可用的高德发货地,请稍后重试");l?(S(P),w(P[0])):(z(P),L(P[0]))}catch(P){alert(Ce(P,"获取发货地失败"))}finally{k(!1)}},I=>{k(!1),alert(I.code===I.PERMISSION_DENIED?"定位权限被拒绝,请在浏览器设置中允许定位":"无法获取当前位置,请稍后重试")},{enableHighAccuracy:!0,timeout:15e3,maximumAge:6e4})},[x.cookie_id,s,w,S]);return{selectedAccount:s,setSelectedAccount:r,loading:R,publishing:D,showEditModal:E,setShowEditModal:B,showAddModal:G,setShowAddModal:b,showPublishModal:q,setShowPublishModal:d,locationLoading:v,publishLocations:U,setPublishLocations:z,publishLocation:O,setPublishLocation:L,selectedItem:F,editForm:y,setEditForm:T,addForm:g,setAddForm:f,publishForm:x,setPublishForm:m,publishImagePreviews:K,handleSync:H,handleEdit:V,handleSaveEdit:se,handleDelete:X,handleAddItem:ae,handlePublishItem:le,downloadPublishTemplate:re,openAddModal:me,openPublishModal:a,locateForPublish:n}},Vt=({phase:s})=>{const r=[["upload","1 上传"],["preview","2 预检"],["running","3 发布"],["done","4 结果"]];return e.jsx("div",{className:"grid grid-cols-4 gap-2",children:r.map(([o,u])=>e.jsx("div",{className:`rounded-xl px-3 py-2 text-center text-xs font-extrabold border ${s===o?"bg-blue-600 text-white border-blue-600":"bg-gray-50 text-gray-500 border-gray-100"}`,children:u},o))})},Wt=s=>{const r=String(s||"").trim();return r?/^[¥¥]/.test(r)?r:`¥${r}`:"-"},es=({onConfigureDelivery:s})=>{const[r,o]=i.useState([]),[u,h]=i.useState([]),[j,S]=i.useState([]),[w,R]=i.useState(""),[C,D]=i.useState(""),M=i.useRef(0),E=i.useRef(0),B=i.useCallback(async()=>{const t=++M.current,c=await Oe();t===M.current&&o(c)},[]),G=i.useCallback(async()=>{const t=++E.current,c=await ze();t===E.current&&h(c)},[]),b=Jt({selectedAccount:w,loadItems:B,loadShippingRules:G}),{showBatchModal:q,batchLoading:d,batchPhase:v,batchFile:k,setBatchFile:U,batchImagesZip:z,setBatchImagesZip:O,batchCategoryKeyword:L,setBatchCategoryKeyword:F,batchCategoryLoading:Z,batchFallbackCategory:y,setBatchFallbackCategory:T,batchPreview:g,batchDetail:f,recentBatch:x,setRecentBatch:m,batchLocations:K,batchLocation:Y,setBatchLocations:H,setBatchLocation:V,openBatchModal:se,handleRecommendBatchCategory:X,openRecentBatchResult:ae,handlePreviewBatch:le,handleStartBatch:re,handleCancelBatch:me,abandonBatchPreview:a,closeBatchModal:n,handleRetryBatchFailed:l}=b,p=Zt({selectedAccount:w,setSelectedAccount:R,setItems:o,loadItems:B,loadShippingRules:G,onConfigureDelivery:s,setBatchLocations:H,setBatchLocation:V}),{loading:I,publishing:P,showEditModal:ue,setShowEditModal:W,showAddModal:je,setShowAddModal:ve,showPublishModal:Qe,setShowPublishModal:et,locationLoading:he,publishLocations:pe,setPublishLocations:tt,publishLocation:st,setPublishLocation:Se,selectedItem:Pe,editForm:J,setEditForm:ge,addForm:A,setAddForm:ne,publishForm:N,setPublishForm:$,publishImagePreviews:Be,handleSync:at,handleEdit:lt,handleSaveEdit:rt,handleDelete:nt,handleAddItem:it,handlePublishItem:ct,downloadPublishTemplate:ot,openAddModal:dt,openPublishModal:xt,locateForPublish:qe}=p;i.useEffect(()=>{const t=new AbortController,c=++M.current,_=++E.current;let ce=!0;return Promise.all([qt({signal:t.signal}),Oe(void 0,{signal:t.signal}),ze({signal:t.signal}),Xe(20,{signal:t.signal})]).then(([Q,ut,ht,Ae])=>{if(!ce||t.signal.aborted||c!==M.current||_!==E.current)return;S(Q),o(ut),h(ht);const pt=Ae.find(Ne=>["running","canceling"].includes(Ne.status))||Ae.find(Ne=>Ne.status!=="preview");m(pt||null)}).catch(Q=>{t.signal.aborted||console.error("加载商品配置失败:",Q)}),(()=>{ce=!1,t.abort()})},[]);const mt=t=>u.filter(c=>c.cookie_id===t.cookie_id&&c.item_id===t.item_id).length>0?u.filter(c=>c.cookie_id===t.cookie_id&&c.item_id===t.item_id):u.filter(c=>c.cookie_id===t.cookie_id&&!c.item_id),Fe=i.useMemo(()=>new Map(j.map(t=>[t.id,t])),[j]),Re=i.useMemo(()=>C?r.filter(t=>t.cookie_id===C):r,[C,r]),ie=t=>{const c=Fe.get(t),_=(c==null?void 0:c.remark)||(c==null?void 0:c.nickname);return _?`${_} · ${t.slice(0,6)}`:`账号 ${t.slice(0,8)}`},Le=t=>{const c=Fe.get(t);return(c==null?void 0:c.remark)||(c==null?void 0:c.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl: Line truncated
@@ -1 +1 @@
import{j as e,b as _e,r as d}from"./react-vendor-C_od1ZSF.js";import{ai as ee,ah as se,aj as Ne,x as K,e as W,L as I,y as ve,F as ke,s as Q,X as te,u as ae,v as ne,r as we,R as Se,N as Ce}from"./icons-vendor-CvzvbbIV.js";import{g as re,p as le,a as oe,d as Te}from"./index-BBTWivHc.js";const H=["smtp_server","smtp_port","smtp_user","smtp_password","smtp_from_name","smtp_from_address","smtp_use_tls","smtp_use_ssl"],G=(s,t)=>{if(typeof s=="boolean")return s;if(typeof s=="string"){if(["true","1","yes","on"].includes(s.toLowerCase()))return!0;if(["false","0","no","off"].includes(s.toLowerCase()))return!1}return t},ie=s=>{const t=Object.prototype.hasOwnProperty.call(s,"use_custom_smtp"),a=H.some(n=>String(s[n]??"").trim()!=="");return{...s,use_custom_smtp:t?G(s.use_custom_smtp,!1):a}},ce=(s,t)=>{const a={...s,use_custom_smtp:!0};for(const n of H)String(a[n]??"").trim()===""&&t[n]!==void 0&&(a[n]=t[n]);return a.smtp_port||(a.smtp_port=587),a.smtp_from_address||(a.smtp_from_address=a.smtp_user||""),a.smtp_use_tls=G(a.smtp_use_tls,!0),a.smtp_use_ssl=G(a.smtp_use_ssl,!1),a},de=s=>{const t=ie(s),a={to_email:String(t.to_email??"").trim(),use_custom_smtp:t.use_custom_smtp===!0};if(a.use_custom_smtp)for(const n of H)a[n]=t[n];return a},B={bark:{label:"Bark",icon:W,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"Ydisks闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app/<key>/这是测试推送内容","URL 路径里 <key> 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:Ne,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:se,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"-1001234567890 或你的用户 ID",Line truncated import{j as e,b as _e,r as d}from"./react-vendor-C_od1ZSF.js";import{ai as ee,ah as se,aj as Ne,x as K,e as W,L as I,y as ve,F as ke,s as Q,X as te,u as ae,v as ne,r as we,R as Se,N as Ce}from"./icons-vendor-CvzvbbIV.js";import{g as re,p as le,a as oe,d as Te}from"./index-Dw5V5tCq.js";const H=["smtp_server","smtp_port","smtp_user","smtp_password","smtp_from_name","smtp_from_address","smtp_use_tls","smtp_use_ssl"],G=(s,t)=>{if(typeof s=="boolean")return s;if(typeof s=="string"){if(["true","1","yes","on"].includes(s.toLowerCase()))return!0;if(["false","0","no","off"].includes(s.toLowerCase()))return!1}return t},ie=s=>{const t=Object.prototype.hasOwnProperty.call(s,"use_custom_smtp"),a=H.some(n=>String(s[n]??"").trim()!=="");return{...s,use_custom_smtp:t?G(s.use_custom_smtp,!1):a}},ce=(s,t)=>{const a={...s,use_custom_smtp:!0};for(const n of H)String(a[n]??"").trim()===""&&t[n]!==void 0&&(a[n]=t[n]);return a.smtp_port||(a.smtp_port=587),a.smtp_from_address||(a.smtp_from_address=a.smtp_user||""),a.smtp_use_tls=G(a.smtp_use_tls,!0),a.smtp_use_ssl=G(a.smtp_use_ssl,!1),a},de=s=>{const t=ie(s),a={to_email:String(t.to_email??"").trim(),use_custom_smtp:t.use_custom_smtp===!0};if(a.use_custom_smtp)for(const n of H)a[n]=t[n];return a},B={bark:{label:"Bark",icon:W,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"Ydisks闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app/<key>/这是测试推送内容","URL 路径里 <key> 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:Ne,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:se,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"-1001234567890 或你的用户 ID",Line truncated
@@ -1 +1 @@
import{j as e,b as J,r as a}from"./react-vendor-C_od1ZSF.js";import{U as te,I as re,X as W,J as ne,R as H,N as ie,O as Y,m as Z,E as ce,v as oe,V as de,F as xe,h as me,g as ue,r as he}from"./icons-vendor-CvzvbbIV.js";import{g as X,b as ae,a as K,p as ge,d as pe}from"./index-BBTWivHc.js";import{o as be,c as ye}from"./contract-COFcZjyb.js";import{f as ee}from"./dateTime-DDi7rqpW.js";const fe=[{key:"all",label:"全部"},{key:"processing",label:"处理中"},{key:"shipped",label:"已发货"},{key:"pending_ship",label:"待发货"},{key:"completed",label:"已完成"},{key:"cancelled",label:"已取消"},{key:"refunding",label:"退款中"}],je=s=>{const t=typeof s=="object"&&s!==null?s:{},c=Array.isArray(t.results)?t.results:[];return{total:Number(t.total||0),success_count:Number(t.success_count||0),failed_count:Number(t.failed_count||0),results:c.map(ve)}},ve=s=>{const t=typeof s=="object"&&s!==null?s:{};return{order_id:String(t.order_id||"unknown"),success:t.success===!0,message:String(t.message||"")}},Ne=s=>(s==null?void 0:s.results.filter(we))||[],we=s=>!s.success,_e=(s,t)=>s!==null&&!t,ke=s=>{if(!s)return"请选择订单文件";const t=s.name.toLowerCase().split(".").pop()||"";return["xlsx","csv","tsv","json"].includes(t)?"":"仅支持 .xlsx、.csv、.tsv、.json 格式"},T=(s,t)=>s===t,Ce=(s,t)=>s instanceof Error&&s.message?s.message:t,Se=({filter:s,onFilterChange:t,accountFilter:c,onAccountFilterChange:h,accounts:g,accountName:m,searchText:u,onSearchChange:p})=>{const b=r=>t(r.currentTarget.dataset.status||"all"),_=r=>h(r.target.value),y=r=>p(r.target.value);return e.jsxs("div",{className:"p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-surface-muted",children:[e.jsx("div",{className:"flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full",children:fe.map(r=>e.jsx("button",{"data-status":r.key,onClick:b,className:`px-5 py-2 rounded-lg text-sm font-bold transition-all whitespace-nowrap ${s===r.key?"bg-white text-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:r.label},r.key))}),e.jsxs("div",{className:"flex w-full md:w-auto flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(te,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{"aria-label":"按账号筛选订单",value:c,onChange:_,className:"ios-input pl-10 pr-9 py-2.5 rounded-xl w-full sm:w-56 bg-white border-none shadow-sm",children:[e.jsx("option",{value:"",children:"全部账号"}),g.map(r=>e.jsx("option",{value:r.id,children:m(r.id)},r.id))]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx(re,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-brand transition-colors"}),e.jsx("input",{type:"text",placeholder:"搜索订单号/商品/买家...",value:u,onChange:y,className:"ios-input pl-10 pr-4 py-2.5 rounded-xl w-64 bg-white border-none shadow-sm focus:ring-0"})]})]})]})},Ee=s=>{const t=m=>{var u;s.setImportFile(((u=m.target.files)==null?void 0:u[0])||null)},c=()=>s.closeImportModal(),h=()=>void s.handleImportOrders(),g=()=>void s.handleRetryImport();return s.showImportModal?J.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-header",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"插入订单"}),e.jsx("button",{onClick:c,className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:e.jsx(W,{className:"w-5 h-5 text-gray-600"})})]})}),e.jsxs("div",{className:"modal-body space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"选择Excel文件"}),e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv,.json",onChange:t,className:"w-full ios-input px-4 py-3 rounded-xl text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持 .xlsx、.csv、.tsv、.json 格式"})]}),s.importFile&&e.jsx("div",{className:"p-3 bg-blue-50 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-blue-900",children:s.importFile.name})]})}),s.importError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-100 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:s.importError}),e.jsx("button",{type:"button",onClick:g,disabled:s.importing||!s.importFile,className:"font-bold whitespace-nowrap",children:"重试"})]}),s.importResult&&s.importResult.failed_count>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-100 p-3 text-sm font-bold text-amber-800",children:["导入完成:成功 ",s.importResultLine truncated import{j as e,b as J,r as a}from"./react-vendor-C_od1ZSF.js";import{U as te,I as re,X as W,J as ne,R as H,N as ie,O as Y,m as Z,E as ce,v as oe,V as de,F as xe,h as me,g as ue,r as he}from"./icons-vendor-CvzvbbIV.js";import{g as X,b as ae,a as K,p as ge,d as pe}from"./index-Dw5V5tCq.js";import{o as be,c as ye}from"./contract-COFcZjyb.js";import{f as ee}from"./dateTime-DDi7rqpW.js";const fe=[{key:"all",label:"全部"},{key:"processing",label:"处理中"},{key:"shipped",label:"已发货"},{key:"pending_ship",label:"待发货"},{key:"completed",label:"已完成"},{key:"cancelled",label:"已取消"},{key:"refunding",label:"退款中"}],je=s=>{const t=typeof s=="object"&&s!==null?s:{},c=Array.isArray(t.results)?t.results:[];return{total:Number(t.total||0),success_count:Number(t.success_count||0),failed_count:Number(t.failed_count||0),results:c.map(ve)}},ve=s=>{const t=typeof s=="object"&&s!==null?s:{};return{order_id:String(t.order_id||"unknown"),success:t.success===!0,message:String(t.message||"")}},Ne=s=>(s==null?void 0:s.results.filter(we))||[],we=s=>!s.success,_e=(s,t)=>s!==null&&!t,ke=s=>{if(!s)return"请选择订单文件";const t=s.name.toLowerCase().split(".").pop()||"";return["xlsx","csv","tsv","json"].includes(t)?"":"仅支持 .xlsx、.csv、.tsv、.json 格式"},T=(s,t)=>s===t,Ce=(s,t)=>s instanceof Error&&s.message?s.message:t,Se=({filter:s,onFilterChange:t,accountFilter:c,onAccountFilterChange:h,accounts:g,accountName:m,searchText:u,onSearchChange:p})=>{const b=r=>t(r.currentTarget.dataset.status||"all"),_=r=>h(r.target.value),y=r=>p(r.target.value);return e.jsxs("div",{className:"p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-surface-muted",children:[e.jsx("div",{className:"flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full",children:fe.map(r=>e.jsx("button",{"data-status":r.key,onClick:b,className:`px-5 py-2 rounded-lg text-sm font-bold transition-all whitespace-nowrap ${s===r.key?"bg-white text-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:r.label},r.key))}),e.jsxs("div",{className:"flex w-full md:w-auto flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(te,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{"aria-label":"按账号筛选订单",value:c,onChange:_,className:"ios-input pl-10 pr-9 py-2.5 rounded-xl w-full sm:w-56 bg-white border-none shadow-sm",children:[e.jsx("option",{value:"",children:"全部账号"}),g.map(r=>e.jsx("option",{value:r.id,children:m(r.id)},r.id))]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx(re,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-brand transition-colors"}),e.jsx("input",{type:"text",placeholder:"搜索订单号/商品/买家...",value:u,onChange:y,className:"ios-input pl-10 pr-4 py-2.5 rounded-xl w-64 bg-white border-none shadow-sm focus:ring-0"})]})]})]})},Ee=s=>{const t=m=>{var u;s.setImportFile(((u=m.target.files)==null?void 0:u[0])||null)},c=()=>s.closeImportModal(),h=()=>void s.handleImportOrders(),g=()=>void s.handleRetryImport();return s.showImportModal?J.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-header",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"插入订单"}),e.jsx("button",{onClick:c,className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:e.jsx(W,{className:"w-5 h-5 text-gray-600"})})]})}),e.jsxs("div",{className:"modal-body space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"选择Excel文件"}),e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv,.json",onChange:t,className:"w-full ios-input px-4 py-3 rounded-xl text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持 .xlsx、.csv、.tsv、.json 格式"})]}),s.importFile&&e.jsx("div",{className:"p-3 bg-blue-50 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-blue-900",children:s.importFile.name})]})}),s.importError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-100 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:s.importError}),e.jsx("button",{type:"button",onClick:g,disabled:s.importing||!s.importFile,className:"font-bold whitespace-nowrap",children:"重试"})]}),s.importResult&&s.importResult.failed_count>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-100 p-3 text-sm font-bold text-amber-800",children:["导入完成:成功 ",s.importResultLine truncated
@@ -1 +1 @@
import{j as e,r as o,b as De}from"./react-vendor-C_od1ZSF.js";import{k as Je,ae as it,af as vt,m as Nt,R as Te,N as Ye,Z as He,x as wt,w as et,I as kt,a1 as Ct,X as ke,V as ze,F as Ce,h as St,g as Rt,a6 as At,ag as $t,r as tt,ah as Mt}from"./icons-vendor-CvzvbbIV.js";import{g as Z,p as Ge,a as fe,d as Ke}from"./index-BBTWivHc.js";import{o as Ae,c as Ue}from"./contract-COFcZjyb.js";const Ee=(t,a)=>t.allowed_resolutions.includes(a),Pt=(t,a)=>({runs:t.runs.filter(i=>!a||i.cookie_id===a),pending_tasks:t.pending_tasks.filter(i=>!a||i.cookie_id===a)}),Lt=t=>({external_result_unknown:"外部动作结果未知",invalid_snapshot:"历史数据无法恢复",rule_unavailable:"规则不可用",partial_failure:"部分动作失败",execution_failed:"动作执行失败"})[t]||"自动化异常",It=({runs:t,pendingTasks:a,onResolveRun:i,onResolveDeferredTask:u})=>e.jsxs("section",{className:"rounded-2xl border border-red-200 bg-red-50 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Je,{className:"w-5 h-5 text-red-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-black text-red-900",children:"需要人工处理的自动化任务"}),e.jsx("p",{className:"text-sm text-red-700 mt-1",children:"请先在闲鱼聊天、订单或商品列表中核对真实结果,再选择继续或重试。"})]})]}),e.jsxs("div",{className:"space-y-3",children:[t.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 订单 ",r.order_id||"-"," · 已记录发送 ",r.sent_count," 条"]}),e.jsx("div",{className:"text-xs font-bold text-red-800 mt-1",children:Lt(r.issue_kind)}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 shrink-0",children:[Ee(r,"continue")&&e.jsx("button",{onClick:(()=>i(r.id,"continue")),className:"px-3 py-2 rounded-lg bg-emerald-100 text-emerald-800 text-xs font-bold",children:"已执行,继续下一步"}),Ee(r,"retry")&&e.jsx("button",{onClick:(()=>i(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"未执行,安全重试"}),Ee(r,"cancel")&&e.jsx("button",{onClick:(()=>i(r.id,"cancel")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"终止"})]})]},`run-${r.id}`)),a.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 延迟任务重试已达 ",r.attempt_count," 次"]}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx("button",{onClick:(()=>u(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"重新入队"}),e.jsx("button",{onClick:(()=>u(r.id,"dismiss")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"忽略"})]})]},`task-${r.id}`))]})]}),Ft=async t=>Z("/api/v1/accounts/details",void 0,t),ot=async t=>Z("/api/v1/cards",void 0,t),dt=async(t,a)=>Z("/api/v1/items",void 0,a),ct=t=>t.map(a=>{var i,u;return{id:String(a.id),name:a.name||"",trigger_type:a.trigger_type||"order_paid",item_keyword:a.item_title||a.item_id||"",cookie_id:a.cookie_id||"",item_id:a.item_id||"",item_title:a.item_title||"",card_group_id:Number(((i=(a.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:i.card_id)||0),card_group_name:((u=(a.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:u.card_name)||"",priority:a.priority||100,enabled:a.enabled||!1,config_json:a.config_json||"{}",actions:(a.actions||[]).map(r=>({id:r.id?String(r.id):void 0,action_type:r.action_type,card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),message_template:r.message_template||"",delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}",enabled:r.enabled!==!1,sort_order:Number(r.sort_order||0)})),variants:(a.actions||[]).filter(r=>r.action_type==="send_card").map(r=>{let y={};try{y=JSON.parse(r.config_json||"{}")}catch{}return{id:r.id?String(r.id):void 0,spec_name:y.spec_name||"",spec_value:y.spec_value||"",card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),enabled:r.enabled!==!1,delay_override:y.delay_override===!0,delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}"}})}}),Dt=async()=>{const t=await Z("/api/v1/automation-rules"),a=Ue(t,["data","rules","items"]);return ct(a)},Tt=async({cookieId:t,triggerType:a,enabled:i,search:u,page:r=1,pageSizeLine truncated import{j as e,r as o,b as De}from"./react-vendor-C_od1ZSF.js";import{k as Je,ae as it,af as vt,m as Nt,R as Te,N as Ye,Z as He,x as wt,w as et,I as kt,a1 as Ct,X as ke,V as ze,F as Ce,h as St,g as Rt,a6 as At,ag as $t,r as tt,ah as Mt}from"./icons-vendor-CvzvbbIV.js";import{g as Z,p as Ge,a as fe,d as Ke}from"./index-Dw5V5tCq.js";import{o as Ae,c as Ue}from"./contract-COFcZjyb.js";const Ee=(t,a)=>t.allowed_resolutions.includes(a),Pt=(t,a)=>({runs:t.runs.filter(i=>!a||i.cookie_id===a),pending_tasks:t.pending_tasks.filter(i=>!a||i.cookie_id===a)}),Lt=t=>({external_result_unknown:"外部动作结果未知",invalid_snapshot:"历史数据无法恢复",rule_unavailable:"规则不可用",partial_failure:"部分动作失败",execution_failed:"动作执行失败"})[t]||"自动化异常",It=({runs:t,pendingTasks:a,onResolveRun:i,onResolveDeferredTask:u})=>e.jsxs("section",{className:"rounded-2xl border border-red-200 bg-red-50 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Je,{className:"w-5 h-5 text-red-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-black text-red-900",children:"需要人工处理的自动化任务"}),e.jsx("p",{className:"text-sm text-red-700 mt-1",children:"请先在闲鱼聊天、订单或商品列表中核对真实结果,再选择继续或重试。"})]})]}),e.jsxs("div",{className:"space-y-3",children:[t.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 订单 ",r.order_id||"-"," · 已记录发送 ",r.sent_count," 条"]}),e.jsx("div",{className:"text-xs font-bold text-red-800 mt-1",children:Lt(r.issue_kind)}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 shrink-0",children:[Ee(r,"continue")&&e.jsx("button",{onClick:(()=>i(r.id,"continue")),className:"px-3 py-2 rounded-lg bg-emerald-100 text-emerald-800 text-xs font-bold",children:"已执行,继续下一步"}),Ee(r,"retry")&&e.jsx("button",{onClick:(()=>i(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"未执行,安全重试"}),Ee(r,"cancel")&&e.jsx("button",{onClick:(()=>i(r.id,"cancel")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"终止"})]})]},`run-${r.id}`)),a.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 延迟任务重试已达 ",r.attempt_count," 次"]}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx("button",{onClick:(()=>u(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"重新入队"}),e.jsx("button",{onClick:(()=>u(r.id,"dismiss")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"忽略"})]})]},`task-${r.id}`))]})]}),Ft=async t=>Z("/api/v1/accounts/details",void 0,t),ot=async t=>Z("/api/v1/cards",void 0,t),dt=async(t,a)=>Z("/api/v1/items",void 0,a),ct=t=>t.map(a=>{var i,u;return{id:String(a.id),name:a.name||"",trigger_type:a.trigger_type||"order_paid",item_keyword:a.item_title||a.item_id||"",cookie_id:a.cookie_id||"",item_id:a.item_id||"",item_title:a.item_title||"",card_group_id:Number(((i=(a.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:i.card_id)||0),card_group_name:((u=(a.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:u.card_name)||"",priority:a.priority||100,enabled:a.enabled||!1,config_json:a.config_json||"{}",actions:(a.actions||[]).map(r=>({id:r.id?String(r.id):void 0,action_type:r.action_type,card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),message_template:r.message_template||"",delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}",enabled:r.enabled!==!1,sort_order:Number(r.sort_order||0)})),variants:(a.actions||[]).filter(r=>r.action_type==="send_card").map(r=>{let y={};try{y=JSON.parse(r.config_json||"{}")}catch{}return{id:r.id?String(r.id):void 0,spec_name:y.spec_name||"",spec_value:y.spec_value||"",card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),enabled:r.enabled!==!1,delay_override:y.delay_override===!0,delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}"}})}}),Dt=async()=>{const t=await Z("/api/v1/automation-rules"),a=Ue(t,["data","rules","items"]);return ct(a)},Tt=async({cookieId:t,triggerType:a,enabled:i,search:u,page:r=1,pageSizeLine truncated
@@ -1 +1 @@
import{r,j as e}from"./react-vendor-C_od1ZSF.js";import{a as xe,g as re,p as le}from"./index-BBTWivHc.js";import{f as ue,R as se,aa as pe,p as me,u as R,v as O,ab as he,s as ge,S as te,ac as ae,ad as ye,r as fe}from"./icons-vendor-CvzvbbIV.js";const ne="https://dashscope.aliyuncs.com/compatible-mode/v1",be=[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],we=new Set(["ai_api_key_configured","smtp_password_configured","qq_reply_secret_key_configured","captcha.remote_secret_key_configured","smtp_server","smtp_port","smtp_user","smtp_password","smtp_from","smtp_from_name","smtp_from_address","registration_enabled","show_default_login_info","login_captcha_enabled","item_sync_enabled","item_sync_interval","item_sync_max_pages","default_reply"]),oe=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),je=s=>{if("values"in s||"secrets"in s)return s;const a={},o={};for(const[d,h]of Object.entries(s))if(h!=null){if(oe.has(d)){o[d]=h===""?{action:"clear"}:{action:"replace",value:String(h)};continue}a[d]=h}return Object.keys(o).length>0?{values:a,secrets:o}:a},ve=s=>{const a={...s};for(const o of oe){const d=`${o}_configured`;d in a&&(a[d]=a[d]===!0||a[d]==="true")}if("renewal_log_retention_days"in a){const o=Number(a.renewal_log_retention_days);a.renewal_log_retention_days=Number.isFinite(o)?o:10}return a},_e=async(s,a)=>le("/api/v1/session/credentials",s,a),Ne=async s=>{const a=await re("/api/v1/settings/system",void 0,s),o=a.data||a.settings||a;return ve(o)},Se=async(s,a)=>le("/api/v1/settings/system",je(s),a),ke=async(s,a="",o)=>{const d=await xe("/api/v1/settings/ai-models",{base_url:s,api_key:a},o);return Array.isArray(d.models)?d.models:[]},Ce=async s=>re("/api/v1/session",void 0,s),Ee=s=>Object.fromEntries(Object.entries(s).filter(([a,o])=>!we.has(a)&&o!==void 0&&o!==null)),Ae=s=>s.new_username.trim().length<3?"用户名至少需要 3 个字符":s.current_password?s.new_password&&s.new_password.length<8?"新密码至少需要 8 个字符":s.new_password!==s.confirm_password?"两次输入的新密码不一致":"":"请输入当前密码确认身份",f=(s,a,o)=>s===a&&!o.aborted,D=s=>s instanceof Error&&s.message==="请求已取消",K=(s,a)=>s instanceof Error?s.message:a,Ie=(s="")=>({new_username:s,current_password:"",new_password:"",confirm_password:""}),T=(s,a)=>({type:s,text:a}),Me=()=>{const[s,a]=r.useState(null),[o,d]=r.useState(!1),[h,p]=r.useState(""),[S,A]=r.useState(!1),[P,k]=r.useState(""),[C,w]=r.useState([]),[j,I]=r.useState(!1),[M,x]=r.useState(""),[$,v]=r.useState(!1),[U,q]=r.useState(!1),[z,u]=r.useState(!1),[b,F]=r.useState(!1),[G,V]=r.useState(!1),[Y,_]=r.useState(!1),[L,y]=r.useState(null),[t,X]=r.useState(()=>Ie()),[ce,J]=r.useState("idle"),Z=r.useRef(null),ee=r.useRef(null),m=r.useRef(0),W=r.useRef(null);ee.current=s;const E=r.useCallback(()=>{var c;(c=W.current)==null||c.abort();const n=new AbortController;return W.current=n,m.current+=1,{controller:n,sequence:m.current}},[]),B=r.useCallback(async(n,c=!1,l)=>{const i=n||ee.current,g=(i==null?void 0:i.ai_api_url)||(i==null?void 0:i.ai_base_url)||ne;I(!0),x("");try{const N=await ke(g,(i==null?void 0:i.ai_api_key)||"",{signal:l});if(l!=null&&l.aborted)return;w(N),v(c&&N.length>0),!(i!=null&&i.ai_model)&&N.length>0&&a(Q=>Q&&{...Q,ai_model:N[0]})}catch(N){if(l!=null&&l.aborted||D(N))return;w([]),v(!1),x(K(N,"读取模型失败"))}finally{l!=null&&l.aborted||I(!1)}},[]),H=r.useCallback(()=>{const{controller:n,sequence:c}=E();d(!0),J("loading"),p(""),Promise.all([Ne({signal:n.signal}),Ce({signal:n.signal})]).then(([l,i])=>{f(m.current,c,n.signal)&&(a(l),i.username&&X(g=>({...g,new_username:i.username||""})),B(l,!1,n.signal),J("success"))}).catch(l=>{!f(m.current,c,n.signal)||D(l)||(a(null),p(K(l,"加载配置失败")),J("error"))}).finally(()=>{f(m.current,c,n.signal)&&d(!1)})},[E,B]);r.useEffect(()=>(H(),(()=>{var n;return(n=W.current)==null?void 0:n.abort()})),[H]),r.useEffect(()=>{const n=c=>{var l;(l=Z.current)!=null&&l.contains(c.target)||v(!1)};return document.addEventListener("mousedown",n),(()=>document.removeEventListener("mousedown",n))},[]);const ie=r.useCallback(async()=>{if(!s||S)return;const{controller:n,sequence:c}=E();A(!0),k("");try{if(await Se(Ee(s),{signal:n.signal}),!f(m.current,c,n.signal))return;window.alert("系统配置已保存")}catch(l){if(!f(m.current,c,n.signal)||D(l))return;k(K(l,"保存配置失败"))}finally{f(m.current,c,n.signal)&&A(!1)}},[E,S,s]),de=r.useCallback(async n=>{n.preventDefault(),y(null);const c=Ae(t);if(c){y(T("error",c));return}const{controller:l,sequence:i}=E();_(!0);try{const g=await _e({current_password:t.current_password,new_username:t.new_username.trim(),new_password:t.new_password||void 0},{signal:l.signal});if(!f(m.current,i,l.signal))return;if(!g.success){y(T("error",g.message||"登录凭据更新失败"));return}y(T("success",g.message||"登录凭据已更新")),window.setTimeout(()=>windLine truncated import{r,j as e}from"./react-vendor-C_od1ZSF.js";import{a as xe,g as re,p as le}from"./index-Dw5V5tCq.js";import{f as ue,R as se,aa as pe,p as me,u as R,v as O,ab as he,s as ge,S as te,ac as ae,ad as ye,r as fe}from"./icons-vendor-CvzvbbIV.js";const ne="https://dashscope.aliyuncs.com/compatible-mode/v1",be=[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],we=new Set(["ai_api_key_configured","smtp_password_configured","qq_reply_secret_key_configured","captcha.remote_secret_key_configured","smtp_server","smtp_port","smtp_user","smtp_password","smtp_from","smtp_from_name","smtp_from_address","registration_enabled","show_default_login_info","login_captcha_enabled","item_sync_enabled","item_sync_interval","item_sync_max_pages","default_reply"]),oe=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),je=s=>{if("values"in s||"secrets"in s)return s;const a={},o={};for(const[d,h]of Object.entries(s))if(h!=null){if(oe.has(d)){o[d]=h===""?{action:"clear"}:{action:"replace",value:String(h)};continue}a[d]=h}return Object.keys(o).length>0?{values:a,secrets:o}:a},ve=s=>{const a={...s};for(const o of oe){const d=`${o}_configured`;d in a&&(a[d]=a[d]===!0||a[d]==="true")}if("renewal_log_retention_days"in a){const o=Number(a.renewal_log_retention_days);a.renewal_log_retention_days=Number.isFinite(o)?o:10}return a},_e=async(s,a)=>le("/api/v1/session/credentials",s,a),Ne=async s=>{const a=await re("/api/v1/settings/system",void 0,s),o=a.data||a.settings||a;return ve(o)},Se=async(s,a)=>le("/api/v1/settings/system",je(s),a),ke=async(s,a="",o)=>{const d=await xe("/api/v1/settings/ai-models",{base_url:s,api_key:a},o);return Array.isArray(d.models)?d.models:[]},Ce=async s=>re("/api/v1/session",void 0,s),Ee=s=>Object.fromEntries(Object.entries(s).filter(([a,o])=>!we.has(a)&&o!==void 0&&o!==null)),Ae=s=>s.new_username.trim().length<3?"用户名至少需要 3 个字符":s.current_password?s.new_password&&s.new_password.length<8?"新密码至少需要 8 个字符":s.new_password!==s.confirm_password?"两次输入的新密码不一致":"":"请输入当前密码确认身份",f=(s,a,o)=>s===a&&!o.aborted,D=s=>s instanceof Error&&s.message==="请求已取消",K=(s,a)=>s instanceof Error?s.message:a,Ie=(s="")=>({new_username:s,current_password:"",new_password:"",confirm_password:""}),T=(s,a)=>({type:s,text:a}),Me=()=>{const[s,a]=r.useState(null),[o,d]=r.useState(!1),[h,p]=r.useState(""),[S,A]=r.useState(!1),[P,k]=r.useState(""),[C,w]=r.useState([]),[j,I]=r.useState(!1),[M,x]=r.useState(""),[$,v]=r.useState(!1),[U,q]=r.useState(!1),[z,u]=r.useState(!1),[b,F]=r.useState(!1),[G,V]=r.useState(!1),[Y,_]=r.useState(!1),[L,y]=r.useState(null),[t,X]=r.useState(()=>Ie()),[ce,J]=r.useState("idle"),Z=r.useRef(null),ee=r.useRef(null),m=r.useRef(0),W=r.useRef(null);ee.current=s;const E=r.useCallback(()=>{var c;(c=W.current)==null||c.abort();const n=new AbortController;return W.current=n,m.current+=1,{controller:n,sequence:m.current}},[]),B=r.useCallback(async(n,c=!1,l)=>{const i=n||ee.current,g=(i==null?void 0:i.ai_api_url)||(i==null?void 0:i.ai_base_url)||ne;I(!0),x("");try{const N=await ke(g,(i==null?void 0:i.ai_api_key)||"",{signal:l});if(l!=null&&l.aborted)return;w(N),v(c&&N.length>0),!(i!=null&&i.ai_model)&&N.length>0&&a(Q=>Q&&{...Q,ai_model:N[0]})}catch(N){if(l!=null&&l.aborted||D(N))return;w([]),v(!1),x(K(N,"读取模型失败"))}finally{l!=null&&l.aborted||I(!1)}},[]),H=r.useCallback(()=>{const{controller:n,sequence:c}=E();d(!0),J("loading"),p(""),Promise.all([Ne({signal:n.signal}),Ce({signal:n.signal})]).then(([l,i])=>{f(m.current,c,n.signal)&&(a(l),i.username&&X(g=>({...g,new_username:i.username||""})),B(l,!1,n.signal),J("success"))}).catch(l=>{!f(m.current,c,n.signal)||D(l)||(a(null),p(K(l,"加载配置失败")),J("error"))}).finally(()=>{f(m.current,c,n.signal)&&d(!1)})},[E,B]);r.useEffect(()=>(H(),(()=>{var n;return(n=W.current)==null?void 0:n.abort()})),[H]),r.useEffect(()=>{const n=c=>{var l;(l=Z.current)!=null&&l.contains(c.target)||v(!1)};return document.addEventListener("mousedown",n),(()=>document.removeEventListener("mousedown",n))},[]);const ie=r.useCallback(async()=>{if(!s||S)return;const{controller:n,sequence:c}=E();A(!0),k("");try{if(await Se(Ee(s),{signal:n.signal}),!f(m.current,c,n.signal))return;window.alert("系统配置已保存")}catch(l){if(!f(m.current,c,n.signal)||D(l))return;k(K(l,"保存配置失败"))}finally{f(m.current,c,n.signal)&&A(!1)}},[E,S,s]),de=r.useCallback(async n=>{n.preventDefault(),y(null);const c=Ae(t);if(c){y(T("error",c));return}const{controller:l,sequence:i}=E();_(!0);try{const g=await _e({current_password:t.current_password,new_username:t.new_username.trim(),new_password:t.new_password||void 0},{signal:l.signal});if(!f(m.current,i,l.signal))return;if(!g.success){y(T("error",g.message||"登录凭据更新失败"));return}y(T("success",g.message||"登录凭据已更新")),window.setTimeout(()=>windLine truncated
@@ -1,4 +1,4 @@
import{r as d,b as fo,R as Sp}from"./react-vendor-C_od1ZSF.js";import{c as Z,g as Qt,u as cu,w as Ip,a as P,s as Ca,b as Te,t as Ep,p as re,d as Qe,e as q,f as kp,D as G,I as su,r as Xf,E as jp,h as Cp,i as Tp,j as ir,k as dn,l as $p,m as Mp,n as Dp,P as _p}from"./vendor-D-Edl3pr.js";var Np=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function vo(e){if(typeof e!="string")return!1;var t=Np;return t.includes(e)}var Lp=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gLine truncated import{r as d,b as fo,R as Sp}from"./react-vendor-C_od1ZSF.js";import{c as Z,g as Qt,u as cu,w as Ip,a as P,s as Ca,b as Te,t as Ep,p as re,d as Qe,e as q,f as kp,D as G,I as su,r as Xf,E as jp,h as Cp,i as Tp,j as ir,k as dn,l as $p,m as Mp,n as Dp,P as _p}from"./vendor-Es4K8PXl.js";var Np=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function vo(e){if(typeof e!="string")return!1;var t=Np;return t.includes(e)}var Lp=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gLine truncated
A`).concat(i,",").concat(i,",0,1,1,").concat(2*o,",").concat(a,` A`).concat(i,",").concat(i,",0,1,1,").concat(2*o,",").concat(a,`
H`).concat(He,"M").concat(2*o,",").concat(a,` H`).concat(He,"M").concat(2*o,",").concat(a,`
A`).concat(i,",").concat(i,",0,1,1,").concat(o,",").concat(a),className:"recharts-legend-icon"});if(u==="rect")return d.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(He/8,"h").concat(He,"v").concat(He*3/4,"h").concat(-He,"z"),className:"recharts-legend-icon"});if(d.isValidElement(t.legendIcon)){var c=wd({},t);return delete c.legendIcon,d.cloneElement(t.legendIcon,c)}return d.createElement(bd,{fill:l,cx:a,cy:a,size:He,sizeType:"diameter",type:u})}function qy(e){var t=e.payload,r=e.iconSize,n=e.layout,a=e.formatter,i=e.inactiveColor,o=e.iconType,l=e.labelStyle,u={x:0,y:0,width:He,height:He},c={display:n==="horizontal"?"inline-block":"block",marginRight:10},s={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((f,v)=>{var h=f.formatter||a,m=Z({"recharts-legend-item":!0,["legend-item-".concat(v)]:!0,inactive:f.inactive});if(f.type==="none")return null;var p=typeof l=="object"?wd({},l):{};p.color=f.inactive?i:p.color||f.color;var y=h?h(f.value,f,v):f.value;return d.createElement("li",Zn({className:m,style:c,key:"legend-item-".concat(v)},hn(e,f,v)),d.createElement(ho,{width:r,height:r,viewBox:u,style:s,"aria-label":"".concat(f.value," legend icon")},d.createElement(Yy,{data:f,iconType:o,inactiveColor:i})),d.createElement("span",{className:"recharts-legend-item-text",style:p},y))})}var Xy=e=>{var t=Ae(e,Vy),r=t.payload,n=t.layout,a=t.align;if(!r||!r.length)return null;var i={padding:0,margin:0,textAlign:n==="horizontal"?a:"left"};return d.createElement("ul",{className:"recharts-default-legend",style:i},d.createElement(qy,Zn({},t,{payload:r})))};function Ad(e,t,r){return t===!0?cu(e,r):typeof t=="function"?cu(e,t):e}var bo=d.createContext(null),Zy=e=>e,ee=()=>{var e=d.useContext(bo);return e?e.store.dispatch:Zy},Fn=()=>{},Qy=()=>Fn,Jy=(e,t)=>e===t;function M(e){var t=d.useContext(bo),r=d.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Fn,[t,e]);return Ip.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Qy,t?t.store.getState:Fn,t?t.store.getState:Fn,r,Jy)}var Pd=e=>e.legend.settings,eg=e=>e.legend.size,tg=e=>e.legend.payload,rg=P([tg,Pd],(e,t)=>{var r=t.itemSorter,n=e.flat(1);return r?Ca(n,r):n});function ng(){return M(rg)}function ag(e,t){return ug(e)||lg(e,t)||og(e,t)||ig()}function ig(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. A`).concat(i,",").concat(i,",0,1,1,").concat(o,",").concat(a),className:"recharts-legend-icon"});if(u==="rect")return d.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(He/8,"h").concat(He,"v").concat(He*3/4,"h").concat(-He,"z"),className:"recharts-legend-icon"});if(d.isValidElement(t.legendIcon)){var c=wd({},t);return delete c.legendIcon,d.cloneElement(t.legendIcon,c)}return d.createElement(bd,{fill:l,cx:a,cy:a,size:He,sizeType:"diameter",type:u})}function qy(e){var t=e.payload,r=e.iconSize,n=e.layout,a=e.formatter,i=e.inactiveColor,o=e.iconType,l=e.labelStyle,u={x:0,y:0,width:He,height:He},c={display:n==="horizontal"?"inline-block":"block",marginRight:10},s={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((f,v)=>{var h=f.formatter||a,m=Z({"recharts-legend-item":!0,["legend-item-".concat(v)]:!0,inactive:f.inactive});if(f.type==="none")return null;var p=typeof l=="object"?wd({},l):{};p.color=f.inactive?i:p.color||f.color;var y=h?h(f.value,f,v):f.value;return d.createElement("li",Zn({className:m,style:c,key:"legend-item-".concat(v)},hn(e,f,v)),d.createElement(ho,{width:r,height:r,viewBox:u,style:s,"aria-label":"".concat(f.value," legend icon")},d.createElement(Yy,{data:f,iconType:o,inactiveColor:i})),d.createElement("span",{className:"recharts-legend-item-text",style:p},y))})}var Xy=e=>{var t=Ae(e,Vy),r=t.payload,n=t.layout,a=t.align;if(!r||!r.length)return null;var i={padding:0,margin:0,textAlign:n==="horizontal"?a:"left"};return d.createElement("ul",{className:"recharts-default-legend",style:i},d.createElement(qy,Zn({},t,{payload:r})))};function Ad(e,t,r){return t===!0?cu(e,r):typeof t=="function"?cu(e,t):e}var bo=d.createContext(null),Zy=e=>e,ee=()=>{var e=d.useContext(bo);return e?e.store.dispatch:Zy},Fn=()=>{},Qy=()=>Fn,Jy=(e,t)=>e===t;function M(e){var t=d.useContext(bo),r=d.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Fn,[t,e]);return Ip.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Qy,t?t.store.getState:Fn,t?t.store.getState:Fn,r,Jy)}var Pd=e=>e.legend.settings,eg=e=>e.legend.size,tg=e=>e.legend.payload,rg=P([tg,Pd],(e,t)=>{var r=t.itemSorter,n=e.flat(1);return r?Ca(n,r):n});function ng(){return M(rg)}function ag(e,t){return ug(e)||lg(e,t)||og(e,t)||ig()}function ig(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
@@ -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(147 197 253 / .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(147 197 253 / .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:rgb(var(--color-neutral-200) / 1)}: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:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}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}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
@@ -1 +0,0 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .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(147 197 253 / .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:rgb(var(--color-neutral-200) / 1)}: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:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}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}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
@@ -1,2 +1,2 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-CmblxZ7W.js","assets/react-vendor-C_od1ZSF.js","assets/dateTime-DDi7rqpW.js","assets/contract-COFcZjyb.js","assets/icons-vendor-CvzvbbIV.js","assets/charts-vendor-BxxJOyEX.js","assets/vendor-D-Edl3pr.js","assets/AccountList-DcvE0dka.js","assets/OrderList-R-cmjT7F.js","assets/CardList-aD2G0vT-.js","assets/ItemList-CYWwRdfD.js","assets/Settings-B5LERBTr.js","assets/Rules-B-KcQF8q.js","assets/Notifications-DzXoxw5T.js","assets/Chat-5gIiLAq_.js"])))=>i.map(i=>d[i]); const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DtK1xauO.js","assets/react-vendor-C_od1ZSF.js","assets/dateTime-DDi7rqpW.js","assets/contract-COFcZjyb.js","assets/icons-vendor-CvzvbbIV.js","assets/charts-vendor-deWqkrdG.js","assets/vendor-Es4K8PXl.js","assets/vendor-DUblxfbA.css","assets/AccountList-DcnUPoF-.js","assets/OrderList-C59DQxfb.js","assets/CardList-BWJaMF5O.js","assets/ItemList-DcERDIch.js","assets/Settings-BhwR41fV.js","assets/Rules-Cl8LfxhU.js","assets/Notifications-D_Iy_BIm.js","assets/Chat-uhUR9NJL.js"])))=>i.map(i=>d[i]);
import{c as S,j as e,r as c,d as H}from"./react-vendor-C_od1ZSF.js";import{L as T,a as P,S as J,U as Y,A as K,b as Q,c as W,M as X,C as ee,B as te,d as se,Z as ne,e as re,f as ae,G as k,g as oe,h as ie,i as le}from"./icons-vendor-CvzvbbIV.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))d(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&d(a)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function d(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();class ce extends S.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(){return{hasError:!0}}render(){const{hasError:n}=this.state,{children:s}=this.props;return n?e.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas p-6 text-ink",children:e.jsxs("section",{className:"max-w-md text-center",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"页面暂时无法显示"}),e.jsx("button",{className:"ios-btn-primary mt-6 px-4 py-2",type:"button",onClick:this.handleReload,children:"重新加载"})]})}):s}}const de=3e4,ue=10*6e4;let N=!1;const I=()=>{N||typeof window>"u"||(N=!0,window.dispatchEvent(new Event("auth:logout")),queueMicrotask(()=>{N=!1}))},he=t=>{if(!t)return"";const n=new URLSearchParams;for(const[d,r]of Object.entries(t))r!=null&&n.set(d,String(r));const s=n.toString();return s?`?${s}`:""},L=async(t,n,s={})=>{var o;const d=he(s.params),r=`${n}${d}`,i=$(s.signal,s.timeoutMs??de);let a;try{a=await fetch(r,{method:t,credentials:"include",signal:i.signal,headers:{...s.body===void 0?{}:{"Content-Type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(m){throw i.signal.aborted?new Error((o=s.signal)!=null&&o.aborted?"请求已取消":"请求超时,请稍后重试"):m}finally{i.cleanup()}const h=(a.headers.get("content-type")||"").includes("application/json");if(!a.ok){a.status===401&&!s.skipAuthLogout&&I();const m=h?await a.json().catch(()=>{}):await a.text().catch(()=>{}),f=z(m,a.status);throw new Error(f)}return h?await a.json():await a.text()},D=async(t,n,s)=>L("GET",t,{params:n,...s}),_=async(t,n,s)=>L("POST",t,{body:n,...s}),Ve=async(t,n,s)=>L("PUT",t,{body:n,...s}),Ue=async(t,n,s)=>L("DELETE",t,{params:n,...s}),Ge=async(t,n,s={})=>{var h;const d=$(s.signal,s.timeoutMs??ue);let r;try{r=await fetch(t,{method:"POST",credentials:"include",signal:d.signal,body:n})}catch(o){throw d.signal.aborted?new Error((h=s.signal)!=null&&h.aborted?"请求已取消":"上传超时,请稍后重试"):o}finally{d.cleanup()}const l=(r.headers.get("content-type")||"").includes("application/json")?await r.json().catch(()=>{}):await r.text().catch(()=>{});if(!r.ok){r.status===401&&I();const o=z(l,r.status),m=new Error(o);throw m.payload=l,m}return l},$=(t,n)=>{const s=new AbortController,d=()=>s.abort(t==null?void 0:t.reason);t!=null&&t.aborted?d():t==null||t.addEventListener("abort",d,{once:!0});const r=globalThis.setTimeout(()=>s.abort(new DOMException("timeout","TimeoutError")),Math.max(1,n));return{signal:s.signal,cleanup:()=>{globalThis.clearTimeout(r),t==null||t.removeEventListener("abort",d)}}},me=t=>{if(typeof t!="object"||t===null)return!1;const n=t;return typeof n.code=="string"&&typeof n.message=="string"},z=(t,n)=>typeof t=="string"?t:me(t)?t.message:`请求失败: ${n}`,fe=async t=>_("/api/v1/session/login",t,{skipAuthLogout:!0}),xe=async t=>_("/api/v1/session/initialize",{password:t},{skipAuthLogout:!0}),pe=async t=>D("/api/v1/session",void 0,t),ge=async()=>_("/api/v1/session/logout",{}),M=c.createContext(void 0),be=({children:t})=>{const[n,s]=c.useState(!1),[d,r]=c.useState(!1),[i,a]=c.useState(!0),[l,h]=c.useState(!1),o=()=>{s(!1),r(!1)};c.useEffect(()=>{const b=new AbortController;let g=!0;pe({signal:b.signal}).then(p=>{if(g){if((p==null?void 0:p.initialized)===!1){h(!0),o();return}h(!1),p!=null&&p.authenticated?(s(!0),r(p.is_admin===!0)):o()}}).catch(p=>{!g||p instanceof DOMException&&p.name==="AbortError"||(h(!1),o())}).finally(()=>{g&&a(!1)});const u=()=>o();return window.addEventListener("auth:logout",u),(()=>{g=!1,b.abort(),window.removeEventListener("auth:logout",u)})},[]);const m=async b=>{const g=await fe(b);return g.success&&(h(!1),s(!0),r(g.is_admin===!0)),g},f=async b=>{const g=await xe(b);return g.success&&(h(!1),s(!0),r(g.is_admin===!0)),g},x=async()=>{try{await ge()}finally{o()}};return e.jsx(M.Provider,{value:{checkingAuth:i,isLoggedIn:n,isAdmin:d,needsInit:l,signIn:m,initialize:f,signOut:Line truncated import{c as S,j as e,r as c,d as H}from"./react-vendor-C_od1ZSF.js";import{L as T,a as P,S as J,U as Y,A as K,b as Q,c as W,M as X,C as ee,B as te,d as se,Z as ne,e as re,f as ae,G as k,g as oe,h as ie,i as le}from"./icons-vendor-CvzvbbIV.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))d(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&d(a)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function d(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();class ce extends S.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(){return{hasError:!0}}render(){const{hasError:n}=this.state,{children:s}=this.props;return n?e.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas p-6 text-ink",children:e.jsxs("section",{className:"max-w-md text-center",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"页面暂时无法显示"}),e.jsx("button",{className:"ios-btn-primary mt-6 px-4 py-2",type:"button",onClick:this.handleReload,children:"重新加载"})]})}):s}}const de=3e4,ue=10*6e4;let N=!1;const I=()=>{N||typeof window>"u"||(N=!0,window.dispatchEvent(new Event("auth:logout")),queueMicrotask(()=>{N=!1}))},he=t=>{if(!t)return"";const n=new URLSearchParams;for(const[d,r]of Object.entries(t))r!=null&&n.set(d,String(r));const s=n.toString();return s?`?${s}`:""},L=async(t,n,s={})=>{var o;const d=he(s.params),r=`${n}${d}`,i=$(s.signal,s.timeoutMs??de);let a;try{a=await fetch(r,{method:t,credentials:"include",signal:i.signal,headers:{...s.body===void 0?{}:{"Content-Type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(m){throw i.signal.aborted?new Error((o=s.signal)!=null&&o.aborted?"请求已取消":"请求超时,请稍后重试"):m}finally{i.cleanup()}const h=(a.headers.get("content-type")||"").includes("application/json");if(!a.ok){a.status===401&&!s.skipAuthLogout&&I();const m=h?await a.json().catch(()=>{}):await a.text().catch(()=>{}),f=z(m,a.status);throw new Error(f)}return h?await a.json():await a.text()},D=async(t,n,s)=>L("GET",t,{params:n,...s}),_=async(t,n,s)=>L("POST",t,{body:n,...s}),Ve=async(t,n,s)=>L("PUT",t,{body:n,...s}),Ue=async(t,n,s)=>L("DELETE",t,{params:n,...s}),Ge=async(t,n,s={})=>{var h;const d=$(s.signal,s.timeoutMs??ue);let r;try{r=await fetch(t,{method:"POST",credentials:"include",signal:d.signal,body:n})}catch(o){throw d.signal.aborted?new Error((h=s.signal)!=null&&h.aborted?"请求已取消":"上传超时,请稍后重试"):o}finally{d.cleanup()}const l=(r.headers.get("content-type")||"").includes("application/json")?await r.json().catch(()=>{}):await r.text().catch(()=>{});if(!r.ok){r.status===401&&I();const o=z(l,r.status),m=new Error(o);throw m.payload=l,m}return l},$=(t,n)=>{const s=new AbortController,d=()=>s.abort(t==null?void 0:t.reason);t!=null&&t.aborted?d():t==null||t.addEventListener("abort",d,{once:!0});const r=globalThis.setTimeout(()=>s.abort(new DOMException("timeout","TimeoutError")),Math.max(1,n));return{signal:s.signal,cleanup:()=>{globalThis.clearTimeout(r),t==null||t.removeEventListener("abort",d)}}},me=t=>{if(typeof t!="object"||t===null)return!1;const n=t;return typeof n.code=="string"&&typeof n.message=="string"},z=(t,n)=>typeof t=="string"?t:me(t)?t.message:`请求失败: ${n}`,fe=async t=>_("/api/v1/session/login",t,{skipAuthLogout:!0}),xe=async t=>_("/api/v1/session/initialize",{password:t},{skipAuthLogout:!0}),pe=async t=>D("/api/v1/session",void 0,t),ge=async()=>_("/api/v1/session/logout",{}),M=c.createContext(void 0),be=({children:t})=>{const[n,s]=c.useState(!1),[d,r]=c.useState(!1),[i,a]=c.useState(!0),[l,h]=c.useState(!1),o=()=>{s(!1),r(!1)};c.useEffect(()=>{const b=new AbortController;let g=!0;pe({signal:b.signal}).then(p=>{if(g){if((p==null?void 0:p.initialized)===!1){h(!0),o();return}h(!1),p!=null&&p.authenticated?(s(!0),r(p.is_admin===!0)):o()}}).catch(p=>{!g||p instanceof DOMException&&p.name==="AbortError"||(h(!1),o())}).finally(()=>{g&&a(!1)});const u=()=>o();return window.addEventListener("auth:logout",u),(()=>{g=!1,b.abort(),window.removeEventListener("auth:logout",u)})},[]);const m=async b=>{const g=await fe(b);return g.success&&(h(!1),s(!0),r(g.is_admin===!0)),g},f=async b=>{const g=await xe(b);return g.success&&(h(!1),s(!0),r(g.is_admin===!0)),g},x=async()=>{try{await ge()}finally{o()}};return e.jsx(M.Provider,{value:{checkingAuth:i,isLoggedIn:n,isAdmin:d,needsInit:l,signIn:m,initialize:f,signOut:Line truncated
@@ -1,33 +0,0 @@
var Yn=Object.defineProperty;var Gn=(e,t,r)=>t in e?Yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Oe=(e,t,r)=>Gn(e,typeof t!="symbol"?t+"":t,r);import{a as qt,r as K,g as Xn}from"./react-vendor-C_od1ZSF.js";function qr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=qr(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Uo(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=qr(e))&&(n&&(n+=" "),n+=t);return n}function At(e){return e==="__proto__"}function Yr(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function Yt(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is((t=e==null?void 0:e.valueOf)==null?void 0:t.call(e),-0)?"-0":String(e)}function Gr(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(Gr).join(",");const t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function Gt(e){if(Array.isArray(e))return e.map(Yt);if(typeof e=="symbol")return[e];e=Gr(e);const t=[],r=e.length;if(r===0)return t;let n=0,i="",s="",o=!1;for(e.charCodeAt(0)===46&&t.push("");n<r;){const f=e[n];if(s)f==="\\"&&n+1<r?(n++,i+=e[n]):f===s?s="":i+=f;else if(o)f==='"'||f==="'"?s=f:f==="]"?(o=!1,t.push(i),i=""):i+=f;else if(f==="[")o=!0,i&&(t.push(i),i="");else if(f==="."){i&&(t.push(i),i="");const u=e[n+1];(u===void 0||u===".")&&t.push("")}else i+=f;n++}return i&&t.push(i),t}function Xt(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(At(t))return r;const n=e[t];return n===void 0?Yr(t)?Xt(e,Gt(t),r):r:n}case"number":case"symbol":{typeof t=="number"&&(t=Yt(t));const n=e[t];return n===void 0?r:n}default:{if(Array.isArray(t))return Hn(e,t,r);if(Object.is(t==null?void 0:t.valueOf(),-0)?t="-0":t=String(t),At(t))return r;const n=e[t];return n===void 0?r:n}}}function Hn(e,t,r){if(t.length===0)return r;let n=e;for(let i=0;i<t.length;i++){if(n==null||At(t[i]))return r;n=n[t[i]]}return n===void 0?r:n}function Kn(e,t){const r=new Map;for(let n=0;n<e.length;n++){const i=e[n],s=t(i,n,e);r.has(s)||r.set(s,i)}return Array.from(r.values())}function Zn(e,t){return function(...r){return e.apply(this,r.slice(0,t))}}function Xr(e){return e}function Jn(e){return function(t){return Xt(t,e)}}function Pt(e){return e==null||typeof e!="object"&&typeof e!="function"}function Vn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Qn(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Ht(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const ei="[object RegExp]",Hr="[object String]",Kr="[object Number]",Zr="[object Boolean]",Jr="[object Arguments]",ti="[object Symbol]",ri="[object Date]",ni="[object Map]",ii="[object Set]",si="[object Array]",oi="[object ArrayBuffer]",fi="[object Object]",ui="[object DataView]",ci="[object Uint8Array]",ai="[object Uint8ClampedArray]",li="[object Uint16Array]",di="[object Uint32Array]",hi="[object Int8Array]",pi="[object Int16Array]",yi="[object Int32Array]",mi="[object Float32Array]",_i="[object Float64Array]",sr=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function gi(e){return typeof sr.Buffer<"u"&&sr.Buffer.isBuffer(e)}function wi(e,t){return te(e,void 0,e,new Map,t)}function te(e,t,r,n=new Map,i=void 0){const s=i==null?void 0:i(e,t,r,n);if(s!==void 0)return s;if(Pt(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){const o=new Array(e.length);n.set(e,o);for(let f=0;f<e.length;f++)o[f]=te(e[f],f,r,n,i);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;n.set(e,o);for(const[f,u]of e)o.set(f,te(u,f,r,n,i));return o}if(e instanceof Set){const o=new Set;n.set(e,o);for(const f of e)o.add(te(f,void 0,r,n,i));return o}if(gi(e))return e.subarray();if(Vn(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);n.set(e,o);for(let f=0;f<e.length;f++)o[f]=te(e[f],f,r,n,i);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,o),j(o,e,r,n,i),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return n.set(e,o),j(o,e,r,n,i),o}if(typeof Blob<"u"&&e instanceof Blob){const o=new Blob([e],{type:e.type});return n.set(e,o),j(o,e,r,n,i),o}if(e instanceof Error){const o=structuredClone(e);return n.set(e,o),o.message=e.message,o.name=e.name,o.staLine 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 or;function Li(){if(or)return at;or=1;var e=qt();function t(l,m){return l===m&&(l!==0||1/l===1/m)||l!==l&&m!==m}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function f(l,m){var h=m(),y=n({inst:{value:h,getSnapshot:m}}),d=y[0].inst,p=y[1];return s(function(){d.value=h,d.getSnapshot=m,u(d)&&p({inst:d})},[l,h,m]),i(function(){return u(d)&&p({inst:d}),l(function(){u(d)&&p({inst:d})})},[l]),o(h),h}function u(l){var m=l.getSnapshot;l=l.value;try{var h=m();return!r(l,h)}catch{return!0}}function a(l,m){return m()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:f;return at.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:c,at}var fr;function Fi(){return fr||(fr=1,ct.exports=Li()),ct.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 ur;function Ti(){if(ur)return ut;ur=1;var e=qt(),t=Fi();function r(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,s=e.useRef,o=e.useEffect,f=e.useMemo,u=e.useDebugValue;return ut.useSyncExternalStoreWithSelector=function(a,c,l,m,h){var y=s(null);if(y.current===null){var d={hasValue:!1,value:null};y.current=d}else d=y.current;y=f(function(){function g(v){if(!S){if(S=!0,E=v,v=m(v),h!==void 0&&d.hasValue){var A=d.value;if(h(A,v))return w=A}return w=v}if(A=w,n(E,v))return A;var D=m(v);return h!==void 0&&h(A,D)?(E=v,A):(E=v,w=D)}var S=!1,E,w,b=l===void 0?null:l;return[function(){return g(c())},b===null?void 0:function(){return g(b())}]},[c,l,m,h]);var p=i(a,y[0],y[1]);return o(function(){d.hasValue=!0,d.value=p},[p]),u(p),p},ut}var cr;function zi(){return cr||(cr=1,ft.exports=Ti()),ft.exports}var jo=zi();function Ui(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Bi(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var ar=e=>Array.isArray(e)?e:[e];function ji(e){const t=Array.isArray(e[0])?e[0]:e;return Bi(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Wi(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var qi=class{constructor(e){this.value=e}deref(){return this.value}},Yi=()=>typeof WeakRef>"u"?qi:WeakRef,sn=Yi(),Gi=0,lr=1;function Re(){return{s:Gi,v:void 0,o:null,p:null}}function Xi(e){return e instanceof sn?e.deref():e}function on(e,t={}){let r=Re();const{resultEqualityCheck:n}=t;let i,s=0;function o(){let f=r;const{length:u}=arguments;for(let l=0,m=u;l<m;l++){const h=arguments[l];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=f.o;y===null&&(f.o=y=new WeakMap);const d=y.get(h);d===void 0?(f=Re(),y.set(h,f)):f=d}else{let y=f.p;y===null&&(f.p=y=new Map);const d=y.get(h);d===void 0?(f=Re(),y.set(h,f)):f=d}}const a=f;let c;if(f.s===lr)c=f.v;else if(c=e.apply(null,arguments),s++,n){const l=Xi(i);l!=null&&n(l,c)&&(c=l,s!==0&&s--),i=typeof c=="object"&&c!==null||typeof c=="function"?new sn(c):c}return a.s=lr,a.v=c,c}return o.clearCache=()=>{r=Re(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function Hi(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let s=0,o=0,f,u={},a=i.pop();typeof a=="object"&&(u=a,a=i.pop()),Ui(a,`createSelector expects an output function after the inputs, but received: [${typeof a}]`);const c={...r,...u},{memoize:l,memoizeOptions:m=[],argsMemoize:h=on,argsMemoizeOptions:y=[]}=c,d=ar(m),p=ar(y),g=ji(i),S=l(function(){return s++,a.apply(null,arguments)},...d),E=h(function(){o++;const b=Wi(g,arguments);return f=S.apply(null,b),f},...p);return Object.assign(E,{resultFunc:a,memoizedResultFunc:S,dependencies:g,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>f,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:l,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var Wo=Hi(on);function Ki(e,t=1){const r=[],n=Math.floor(t),i=(s,o)=>{for(let f=0;f<s.length;f++){const u=s[f];Array.isArray(u)&&o<n?i(u,o+1):r.push(u)}};return i(e,0),r}function Rt(e,t,r){return Vr(r)&&(typeof t=="number"&&nn(r)&&rn(t)&&t<r.length||typeof t=="string"&&t in r)?De(r[t],e):!1}function dr(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const Zi=(e,t,r)=>{if(e!==t){const n=dr(e),i=dr(t);if(n===i&&n===0){if(e<t)return r==="desc"?1:-1;if(e>t)return r==="desc"?-1:1}return r==="desc"?i-n:n-i}return 0};function fn(e){return typeof e=="symbol"||e instanceof Symbol}const Ji=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vi=/^\w*$/;function Qi(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||fn(e)?!0:typeof e=="string"&&(Vi.test(e)||!Ji.test(e))||t!=null}function es(e,t,r,n){if(e==null)return[];r=r,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(r)||(r=r==null?[]:[r]),r=r.map(f=>String(f));const i=(f,u)=>{let a=f;for(let c=0;c<u.length&&a!=null;++c)a=a[u[c]];return a},s=(f,u)=>u==null||f==null?u:typeof f=="object"&&"key"in f?Object.hasOwn(u,f.key)?u[f.key]:i(u,f.path):typeof f=="function"?f(u):Array.isArray(f)?i(u,f):typeof u=="object"?u[f]:u,o=t.map(f=>(Array.isArray(f)&&f.length===1&&(f=f[0]),f==null||typeof f=="function"||Array.isArray(f)||Qi(f)?f:{key:f,path:Gt(f)}));return e.map(f=>({original:f,criteria:o.map(u=>s(u,f))})).slice().sort((f,u)=>{for(let a=0;a<o.length;a++){const c=Zi(f.criteria[a],u.criteria[a],r[a]);if(c!==0)return c}return 0}).map(f=>f.original)}function qo(e,...t){const r=t.length;return r>1&&Rt(e,t[0],t[1])?t=[]:r>2&&Rt(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 kr;function lo(){if(kr)return _t;kr=1;var e=qt();function t(u,a){return u===a&&(u!==0||1/u===1/a)||u!==u&&a!==a}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,i=e.useRef,s=e.useEffect,o=e.useMemo,f=e.useDebugValue;return _t.useSyncExternalStoreWithSelector=function(u,a,c,l,m){var h=i(null);if(h.current===null){var y={hasValue:!1,value:null};h.current=y}else y=h.current;h=o(function(){function p(b){if(!g){if(g=!0,S=b,b=l(b),m!==void 0&&y.hasValue){var v=y.value;if(m(v,b))return E=v}return E=b}if(v=E,r(S,b))return v;var A=l(b);return m!==void 0&&m(v,A)?(S=b,v):(S=b,E=A)}var g=!1,S,E,w=c===void 0?null:c;return[function(){return p(a())},w===null?void 0:function(){return p(w())}]},[a,c,l,m]);var d=n(u,h[0],h[1]);return s(function(){y.hasValue=!0,y.value=d},[d]),f(d),d},_t}var Cr;function ho(){return Cr||(Cr=1,mt.exports=lo()),mt.exports}ho();function po(e){e()}function yo(){let e=null,t=null;return{clear(){e=null,t=null},notify(){po(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Lr={notify(){},get:()=>[]};function mo(e,t){let r,n=Lr,i=0,s=!1;function o(d){c();const p=n.subscribe(d);let g=!1;return()=>{g||(g=!0,p(),l())}}function f(){n.notify()}function u(){y.onStateChange&&y.onStateChange()}function a(){return s}function c(){i++,r||(r=e.subscribe(u),n=yo())}function l(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=Lr)}function m(){s||(s=!0,c())}function h(){s&&(s=!1,l())}const y={addNestedSub:o,notifyNestedSubs:f,handleChangeWrapper:u,isSubscribed:a,trySubscribe:m,tryUnsubscribe:h,getListeners:()=>n};return y}var _o=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",go=_o(),wo=()=>typeof navigator<"u"&&navigator.product==="ReactNative",bo=wo(),Eo=()=>go||bo?K.useLayoutEffect:K.useEffect,So=Eo();function Fr(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Vo(e,t){if(Fr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!Fr(e[r[i]],t[r[i]]))return!1;return!0}var gt=Symbol.for("react-redux-context"),wt=typeof globalThis<"u"?globalThis:{};function vo(){if(!K.createContext)return{};const e=wt[gt]??(wt[gt]=new Map);let t=e.get(K.createContext);return t||(t=K.createContext(null),e.set(K.createContext,t)),t}var Ao=vo();function Po(e){const{children:t,context:r,serverState:n,store:i}=e,s=K.useMemo(()=>{const u=mo(i);return{store:i,subscription:u,getServerState:n?()=>n:void 0}},[i,n]),o=K.useMemo(()=>i.getState(),[i]);So(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),o!==i.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,o]);const f=r||Ao;return K.createElement(f.Provider,{value:s},t)}var Qo=Po;function Oo(e){return fn(e)?NaN:Number(e)}function bt(e){return e?(e=Oo(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function ef(e,t,r){r&&typeof r!="number"&&Rt(e,t,r)&&(t=r=void 0),e=bt(e),t===void 0?(t=e,e=0):t=bt(t),r=r===void 0?e<t?1:-1:bt(r);const n=Math.max(Math.ceil((t-e)/(r||1)),0),i=new Array(n);for(let s=0;s<n;s++)i[s]=e,e+=r;return i}var he=1e9,Ro={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},ir,M=!0,B="[DecimalError] ",ne=B+"Invalid argument: ",nr=B+"Exponent out of range: ",pe=Math.floor,ee=Math.pow,Mo=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,L,$=1e7,R=7,Un=9007199254740991,He=pe(Un/R),_={};_.absoluteValue=_.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};_.comparedTo=_.cmp=function(e){var t,r,n,i,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(n=s.d.length,i=e.d.length,t=0,r=n<i?n:i;t<r;++t)if(s.d[t]!==e.d[t])return s.d[t]>e.d[t]^s.s<0?1:-1;return n===i?0:n>i^s.s<0?1:-1};_.decimalPlaces=_.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*R;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};_.dividedBy=_.div=function(e){return Z(this,new this.constructor(e))};_.dividedToIntegerBy=_.idiv=function(e){var t=this,r=t.constructor;return O(Z(t,new r(e),0,1),r.precision)};_.equals=_.eq=function(e){return!this.cmp(e)};_.exponent=function(){return I(this)};_.greaterThan=_.gt=function(e){return this.cmp(e)>0};_.greaterThanOrEqualTo=_.gte=function(e){return this.cmp(e)>=0};_.isInteger=_.isint=function(){return this.e>this.d.length-2};_.isNegative=_.isneg=function(){return this.s<0};_.isPositive=_.ispos=function(){return this.s>0};_.isZero=function(){return this.s===0};_.lessThan=_.lt=function(e){return this.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 jr;function Co(){if(jr)return P;jr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),a=Symbol.for("react.suspense_list"),c=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),m=Symbol.for("react.view_transition"),h=Symbol.for("react.client.reference");function y(d){if(typeof d=="object"&&d!==null){var p=d.$$typeof;switch(p){case e:switch(d=d.type,d){case r:case i:case n:case u:case a:case m:return d;default:switch(d=d&&d.$$typeof,d){case o:case f:case l:case c:return d;case s:return d;default:return p}}case t:return p}}}return P.ContextConsumer=s,P.ContextProvider=o,P.Element=e,P.ForwardRef=f,P.Fragment=r,P.Lazy=l,P.Memo=c,P.Portal=t,P.Profiler=i,P.StrictMode=n,P.Suspense=u,P.SuspenseList=a,P.isContextConsumer=function(d){return y(d)===s},P.isContextProvider=function(d){return y(d)===o},P.isElement=function(d){return typeof d=="object"&&d!==null&&d.$$typeof===e},P.isForwardRef=function(d){return y(d)===f},P.isFragment=function(d){return y(d)===r},P.isLazy=function(d){return y(d)===l},P.isMemo=function(d){return y(d)===c},P.isPortal=function(d){return y(d)===t},P.isProfiler=function(d){return y(d)===i},P.isStrictMode=function(d){return y(d)===n},P.isSuspense=function(d){return y(d)===u},P.isSuspenseList=function(d){return y(d)===a},P.isValidElementType=function(d){return typeof d=="string"||typeof d=="function"||d===r||d===i||d===n||d===u||d===a||typeof d=="object"&&d!==null&&(d.$$typeof===l||d.$$typeof===c||d.$$typeof===o||d.$$typeof===s||d.$$typeof===f||d.$$typeof===h||d.getModuleId!==void 0)},P.typeOf=y,P}var Wr;function Lo(){return Wr||(Wr=1,vt.exports=Co()),vt.exports}var sf=Lo(),Fo="Invariant failed";function of(e,t){throw new Error(Fo)}export{tf as D,nf as E,rf as I,Qo as P,Wo as a,Ho as b,Uo as c,ws as d,Jo as e,Vo as f,Xt as g,sf as h,of as i,le as j,Ko as k,Xo as l,is as m,Rs as n,Go as p,ef as r,qo as s,Zo as t,Bo as u,jo as w};
@@ -0,0 +1 @@
.yarl__fullsize{width:100%;height:100%}.yarl__relative{position:relative}.yarl__portal{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;overflow:hidden;z-index:var(--yarl__portal_zindex,9999);transition:opacity var(--yarl__fade_animation_duration,.25s) var(--yarl__fade_animation_timing_function,ease);pointer-events:auto}.yarl__portal_open{opacity:1}.yarl__container{position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden;background-color:var(--yarl__container_background_color,var(--yarl__color_backdrop,#000));outline:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:var(--yarl__controller_touch_action,none);overscroll-behavior:var(--yarl__controller_overscroll_behavior,contain)}.yarl__carousel{display:flex;flex:0 0 auto;height:100%;align-content:center;justify-content:center;align-items:stretch;width:calc(100% + (var(--yarl__carousel_slides_count) - 1)*(100% + var(--yarl__carousel_spacing_px, 0)*1px + var(--yarl__carousel_spacing_percent, 0)*1%));transform:translate(var(--yarl__swipe_offset,0),var(--yarl__pull_offset,0));opacity:var(--yarl__pull_opacity,1)}.yarl__carousel_with_slides{-moz-column-gap:calc(var(--yarl__carousel_spacing_px, 0)*1px + 100/(var(--yarl__carousel_slides_count)*100 + (var(--yarl__carousel_slides_count) - 1)*var(--yarl__carousel_spacing_percent, 0))*var(--yarl__carousel_spacing_percent, 0)*1%);column-gap:calc(var(--yarl__carousel_spacing_px, 0)*1px + 100/(var(--yarl__carousel_slides_count)*100 + (var(--yarl__carousel_slides_count) - 1)*var(--yarl__carousel_spacing_percent, 0))*var(--yarl__carousel_spacing_percent, 0)*1%)}.yarl__flex_center{display:flex;justify-content:center;align-content:center;align-items:center}.yarl__slide{flex:1;position:relative;overflow:hidden;padding:calc(var(--yarl__carousel_padding_px, 0)*1px + 100/(var(--yarl__carousel_slides_count)*100 + (var(--yarl__carousel_slides_count) - 1)*var(--yarl__carousel_spacing_percent, 0))*var(--yarl__carousel_padding_percent, 0)*1%)}[dir=rtl] .yarl__slide{--yarl__direction:-1}.yarl__slide_image{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain;touch-action:var(--yarl__controller_touch_action,none);-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-touch-callout:none}.yarl__slide_image_cover{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.yarl__slide_image_loading{opacity:0}@media screen and (min-width:800px){.yarl__slide_wrapper:not(.yarl__slide_wrapper_interactive) .yarl__slide_image{-webkit-transform:translateZ(0);-webkit-backface-visibility:hidden;-webkit-transform-style:preserve-3d}}.yarl__slide_placeholder{position:absolute;top:50%;left:50%;transform:translate(-50%) translateY(-50%);line-height:0}.yarl__slide_loading{color:var(--yarl__slide_icon_loading_color,var(--yarl__color_button,hsla(0,0%,100%,.8)));animation:yarl__delayed_fadein 1s linear}.yarl__slide_loading line{animation:yarl__stroke_opacity 1s linear infinite}.yarl__slide_loading line:first-of-type{animation-delay:-1.875s}.yarl__slide_loading line:nth-of-type(2){animation-delay:-1.75s}.yarl__slide_loading line:nth-of-type(3){animation-delay:-1.625s}.yarl__slide_loading line:nth-of-type(4){animation-delay:-1.5s}.yarl__slide_loading line:nth-of-type(5){animation-delay:-1.375s}.yarl__slide_loading line:nth-of-type(6){animation-delay:-1.25s}.yarl__slide_loading line:nth-of-type(7){animation-delay:-1.125s}.yarl__slide_loading line:nth-of-type(8){animation-delay:-1s}.yarl__slide_error{width:var(--yarl__slide_icon_error_size,48px);height:var(--yarl__slide_icon_error_size,48px);color:var(--yarl__slide_icon_error_color,red)}@media(prefers-reduced-motion){.yarl__portal,.yarl__slide{transition:unset}.yarl__slide_loading,.yarl__slide_loading line{animation:unset}}.yarl__toolbar{position:absolute;top:0;right:0;bottom:auto;left:auto;display:flex;justify-content:flex-end;padding:var(--yarl__toolbar_padding,8px)}[dir=rtl] .yarl__toolbar{top:0;right:auto;bottom:auto;left:0}.yarl__icon{width:var(--yarl__icon_size,32px);height:var(--yarl__icon_size,32px)}.yarl__button{cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--yarl__button_background_color,transparent);border:var(--yarl__button_border,0);margin:var(--yarl__button_margin,0);outline:none;line-height:0;padding:var(--yarl__button_padding,8px);color:var(--yarl__color_button,hsla(0,0%,100%,.8));filter:var(--yarl__button_filter,drop-shadow(2px 2px 2px rgba(0,0,0,.8)));-webkit-tap-highlight-color:transparent}.yarl__button:focus{color:var(--yarl__color_button_active,#fff)}.yarl__button:focus:not(:focus-visible){color:var(--yarl__color_button,hsla(0,0%,100%,.8))}.yarl__button:focus-visible{color:var(--yarl__color_button_active,#fff)}@media(hover:hover){.yarl__button:focus-visible:hover,.yarl__button:focus:hover,.yarl__button:hover{color:var(--yarl__color_button_active,#fff)}}.yarl__button:disabled{color:var(--yarl__color_button_disabled,hsla(0,0%,100%,.4));cursor:default}.yarl__navigaLine truncated
@@ -0,0 +1,33 @@
var ys=Object.defineProperty;var ms=(e,t,n)=>t in e?ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var yt=(e,t,n)=>ms(e,typeof t!="symbol"?t+"":t,n);import{a as rr,r as p,g as gs,b as _s}from"./react-vendor-C_od1ZSF.js";function Ai(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ai(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function xa(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ai(e))&&(r&&(r+=" "),r+=t);return r}function Ln(e){return e==="__proto__"}function Ni(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function ir(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is((t=e==null?void 0:e.valueOf)==null?void 0:t.call(e),-0)?"-0":String(e)}function Ci(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(Ci).join(",");const t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function or(e){if(Array.isArray(e))return e.map(ir);if(typeof e=="symbol")return[e];e=Ci(e);const t=[],n=e.length;if(n===0)return t;let r=0,i="",o="",s=!1;for(e.charCodeAt(0)===46&&t.push("");r<n;){const c=e[r];if(o)c==="\\"&&r+1<n?(r++,i+=e[r]):c===o?o="":i+=c;else if(s)c==='"'||c==="'"?o=c:c==="]"?(s=!1,t.push(i),i=""):i+=c;else if(c==="[")s=!0,i&&(t.push(i),i="");else if(c==="."){i&&(t.push(i),i="");const u=e[r+1];(u===void 0||u===".")&&t.push("")}else i+=c;r++}return i&&t.push(i),t}function sr(e,t,n){if(e==null)return n;switch(typeof t){case"string":{if(Ln(t))return n;const r=e[t];return r===void 0?Ni(t)?sr(e,or(t),n):n:r}case"number":case"symbol":{typeof t=="number"&&(t=ir(t));const r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return ws(e,t,n);if(Object.is(t==null?void 0:t.valueOf(),-0)?t="-0":t=String(t),Ln(t))return n;const r=e[t];return r===void 0?n:r}}}function ws(e,t,n){if(t.length===0)return n;let r=e;for(let i=0;i<t.length;i++){if(r==null||Ln(t[i]))return n;r=r[t[i]]}return r===void 0?n:r}function vs(e,t){const n=new Map;for(let r=0;r<e.length;r++){const i=e[r],o=t(i,r,e);n.has(o)||n.set(o,i)}return Array.from(n.values())}function Es(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function Mi(e){return e}function bs(e){return function(t){return sr(t,e)}}function Tn(e){return e==null||typeof e!="object"&&typeof e!="function"}function Ss(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ps(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function cr(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Os="[object RegExp]",Ii="[object String]",Li="[object Number]",Ti="[object Boolean]",Di="[object Arguments]",xs="[object Symbol]",Rs="[object Date]",As="[object Map]",Ns="[object Set]",Cs="[object Array]",Ms="[object ArrayBuffer]",Is="[object Object]",Ls="[object DataView]",Ts="[object Uint8Array]",Ds="[object Uint8ClampedArray]",ks="[object Uint16Array]",$s="[object Uint32Array]",Fs="[object Int8Array]",Ws="[object Int16Array]",zs="[object Int32Array]",Us="[object Float32Array]",Bs="[object Float64Array]",Mr=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function js(e){return typeof Mr.Buffer<"u"&&Mr.Buffer.isBuffer(e)}function qs(e,t){return Re(e,void 0,e,new Map,t)}function Re(e,t,n,r=new Map,i=void 0){const o=i==null?void 0:i(e,t,n,r);if(o!==void 0)return o;if(Tn(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const s=new Array(e.length);r.set(e,s);for(let c=0;c<e.length;c++)s[c]=Re(e[c],c,n,r,i);return Object.hasOwn(e,"index")&&(s.index=e.index),Object.hasOwn(e,"input")&&(s.input=e.input),s}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const s=new RegExp(e.source,e.flags);return s.lastIndex=e.lastIndex,s}if(e instanceof Map){const s=new Map;r.set(e,s);for(const[c,u]of e)s.set(c,Re(u,c,n,r,i));return s}if(e instanceof Set){const s=new Set;r.set(e,s);for(const c of e)s.add(Re(c,void 0,n,r,i));return s}if(js(e))return e.subarray();if(Ss(e)){const s=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,s);for(let c=0;c<e.length;c++)s[c]=Re(e[c],c,n,r,i);return s}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const s=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,s),se(s,e,n,r,i),s}if(typeof File<"u"&&e instanceof File){const s=new File([e],e.name,{type:e.type});return r.set(e,s),se(s,e,n,r,i),s}if(typeof Blob<"u"&&e instanceof Blob){const s=new Blob([e],{type:e.type});return r.set(e,s),se(s,e,n,r,i),s}if(e instanceof Error){const s=structuredClone(e);return r.set(e,s),s.message=e.message,s.name=eLine 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 Ir;function cc(){if(Ir)return hn;Ir=1;var e=rr();function t(l,m){return l===m&&(l!==0||1/l===1/m)||l!==l&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function c(l,m){var h=m(),y=r({inst:{value:h,getSnapshot:m}}),d=y[0].inst,g=y[1];return o(function(){d.value=h,d.getSnapshot=m,u(d)&&g({inst:d})},[l,h,m]),i(function(){return u(d)&&g({inst:d}),l(function(){u(d)&&g({inst:d})})},[l]),s(h),h}function u(l){var m=l.getSnapshot;l=l.value;try{var h=m();return!n(l,h)}catch{return!0}}function a(l,m){return m()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:c;return hn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,hn}var Lr;function uc(){return Lr||(Lr=1,dn.exports=cc()),dn.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 Tr;function fc(){if(Tr)return ln;Tr=1;var e=rr(),t=uc();function n(a,f){return a===f&&(a!==0||1/a===1/f)||a!==a&&f!==f}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,s=e.useEffect,c=e.useMemo,u=e.useDebugValue;return ln.useSyncExternalStoreWithSelector=function(a,f,l,m,h){var y=o(null);if(y.current===null){var d={hasValue:!1,value:null};y.current=d}else d=y.current;y=c(function(){function _(x){if(!E){if(E=!0,b=x,x=m(x),h!==void 0&&d.hasValue){var O=d.value;if(h(O,x))return w=O}return w=x}if(O=w,r(b,x))return O;var C=m(x);return h!==void 0&&h(O,C)?(b=x,O):(b=x,w=C)}var E=!1,b,w,v=l===void 0?null:l;return[function(){return _(f())},v===null?void 0:function(){return _(v())}]},[f,l,m,h]);var g=i(a,y[0],y[1]);return s(function(){d.hasValue=!0,d.value=g},[g]),u(g),g},ln}var Dr;function ac(){return Dr||(Dr=1,an.exports=fc()),an.exports}var Aa=ac();function lc(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function dc(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 kr=e=>Array.isArray(e)?e:[e];function hc(e){const t=Array.isArray(e[0])?e[0]:e;return dc(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function pc(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var yc=class{constructor(e){this.value=e}deref(){return this.value}},mc=()=>typeof WeakRef>"u"?yc:WeakRef,Bi=mc(),gc=0,$r=1;function mt(){return{s:gc,v:void 0,o:null,p:null}}function _c(e){return e instanceof Bi?e.deref():e}function ji(e,t={}){let n=mt();const{resultEqualityCheck:r}=t;let i,o=0;function s(){let c=n;const{length:u}=arguments;for(let l=0,m=u;l<m;l++){const h=arguments[l];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=c.o;y===null&&(c.o=y=new WeakMap);const d=y.get(h);d===void 0?(c=mt(),y.set(h,c)):c=d}else{let y=c.p;y===null&&(c.p=y=new Map);const d=y.get(h);d===void 0?(c=mt(),y.set(h,c)):c=d}}const a=c;let f;if(c.s===$r)f=c.v;else if(f=e.apply(null,arguments),o++,r){const l=_c(i);l!=null&&r(l,f)&&(f=l,o!==0&&o--),i=typeof f=="object"&&f!==null||typeof f=="function"?new Bi(f):f}return a.s=$r,a.v=f,f}return s.clearCache=()=>{n=mt(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function wc(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let o=0,s=0,c,u={},a=i.pop();typeof a=="object"&&(u=a,a=i.pop()),lc(a,`createSelector expects an output function after the inputs, but received: [${typeof a}]`);const f={...n,...u},{memoize:l,memoizeOptions:m=[],argsMemoize:h=ji,argsMemoizeOptions:y=[]}=f,d=kr(m),g=kr(y),_=hc(i),E=l(function(){return o++,a.apply(null,arguments)},...d),b=h(function(){s++;const v=pc(_,arguments);return c=E.apply(null,v),c},...g);return Object.assign(b,{resultFunc:a,memoizedResultFunc:E,dependencies:_,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>c,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:l,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var Na=wc(ji);function vc(e,t=1){const n=[],r=Math.floor(t),i=(o,s)=>{for(let c=0;c<o.length;c++){const u=o[c];Array.isArray(u)&&s<r?i(u,s+1):n.push(u)}};return i(e,0),n}function kn(e,t,n){return ki(n)&&(typeof t=="number"&&Ui(n)&&zi(t)&&t<n.length||typeof t=="string"&&t in n)?Et(n[t],e):!1}function Fr(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const Ec=(e,t,n)=>{if(e!==t){const r=Fr(e),i=Fr(t);if(r===i&&r===0){if(e<t)return n==="desc"?1:-1;if(e>t)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function qi(e){return typeof e=="symbol"||e instanceof Symbol}const bc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Sc=/^\w*$/;function Pc(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||qi(e)?!0:typeof e=="string"&&(Sc.test(e)||!bc.test(e))||t!=null}function Oc(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(c=>String(c));const i=(c,u)=>{let a=c;for(let f=0;f<u.length&&a!=null;++f)a=a[u[f]];return a},o=(c,u)=>u==null||c==null?u:typeof c=="object"&&"key"in c?Object.hasOwn(u,c.key)?u[c.key]:i(u,c.path):typeof c=="function"?c(u):Array.isArray(c)?i(u,c):typeof u=="object"?u[c]:u,s=t.map(c=>(Array.isArray(c)&&c.length===1&&(c=c[0]),c==null||typeof c=="function"||Array.isArray(c)||Pc(c)?c:{key:c,path:or(c)}));return e.map(c=>({original:c,criteria:s.map(u=>o(u,c))})).slice().sort((c,u)=>{for(let a=0;a<s.length;a++){const f=Ec(c.criteria[a],u.criteria[a],n[a]);if(f!==0)return f}return 0}).map(c=>c.original)}function Ca(e,...t){const n=t.length;return n>1&&kn(e,t[0],t[1])?t=[]:n>2&&kn(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 si;function ku(){if(si)return vn;si=1;var e=rr();function t(u,a){return u===a&&(u!==0||1/u===1/a)||u!==u&&a!==a}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,i=e.useRef,o=e.useEffect,s=e.useMemo,c=e.useDebugValue;return vn.useSyncExternalStoreWithSelector=function(u,a,f,l,m){var h=i(null);if(h.current===null){var y={hasValue:!1,value:null};h.current=y}else y=h.current;h=s(function(){function g(v){if(!_){if(_=!0,E=v,v=l(v),m!==void 0&&y.hasValue){var x=y.value;if(m(x,v))return b=x}return b=v}if(x=b,n(E,v))return x;var O=l(v);return m!==void 0&&m(x,O)?(E=v,x):(E=v,b=O)}var _=!1,E,b,w=f===void 0?null:f;return[function(){return g(a())},w===null?void 0:function(){return g(w())}]},[a,f,l,m]);var d=r(u,h[0],h[1]);return o(function(){y.hasValue=!0,y.value=d},[d]),c(d),d},vn}var ci;function $u(){return ci||(ci=1,wn.exports=ku()),wn.exports}$u();function Fu(e){e()}function Wu(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Fu(()=>{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 i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var ui={notify(){},get:()=>[]};function zu(e,t){let n,r=ui,i=0,o=!1;function s(d){f();const g=r.subscribe(d);let _=!1;return()=>{_||(_=!0,g(),l())}}function c(){r.notify()}function u(){y.onStateChange&&y.onStateChange()}function a(){return o}function f(){i++,n||(n=e.subscribe(u),r=Wu())}function l(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=ui)}function m(){o||(o=!0,f())}function h(){o&&(o=!1,l())}const y={addNestedSub:s,notifyNestedSubs:c,handleChangeWrapper:u,isSubscribed:a,trySubscribe:m,tryUnsubscribe:h,getListeners:()=>r};return y}var Uu=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Bu=Uu(),ju=()=>typeof navigator<"u"&&navigator.product==="ReactNative",qu=ju(),Vu=()=>Bu||qu?p.useLayoutEffect:p.useEffect,Xu=Vu();function fi(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Fa(e,t){if(fi(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 i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(t,n[i])||!fi(e[n[i]],t[n[i]]))return!1;return!0}var En=Symbol.for("react-redux-context"),bn=typeof globalThis<"u"?globalThis:{};function Hu(){if(!p.createContext)return{};const e=bn[En]??(bn[En]=new Map);let t=e.get(p.createContext);return t||(t=p.createContext(null),e.set(p.createContext,t)),t}var Yu=Hu();function Ku(e){const{children:t,context:n,serverState:r,store:i}=e,o=p.useMemo(()=>{const u=zu(i);return{store:i,subscription:u,getServerState:r?()=>r:void 0}},[i,r]),s=p.useMemo(()=>i.getState(),[i]);Xu(()=>{const{subscription:u}=o;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==i.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[o,s]);const c=n||Yu;return p.createElement(c.Provider,{value:o},t)}var Wa=Ku;function Gu(e){return qi(e)?NaN:Number(e)}function Sn(e){return e?(e=Gu(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function za(e,t,n){n&&typeof n!="number"&&kn(e,t,n)&&(t=n=void 0),e=Sn(e),t===void 0?(t=e,e=0):t=Sn(t),n=n===void 0?e<t?1:-1:Sn(n);const r=Math.max(Math.ceil((t-e)/(n||1)),0),i=new Array(r);for(let o=0;o<r;o++)i[o]=e,e+=n;return i}var Ve=1e9,Zu={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},gr,z=!0,ie="[DecimalError] ",Ne=ie+"Invalid argument: ",mr=ie+"Exponent out of range: ",Xe=Math.floor,Pe=Math.pow,Ju=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Q,X=1e7,$=7,Po=9007199254740991,Ft=Xe(Po/$),S={};S.absoluteValue=S.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};S.comparedTo=S.cmp=function(e){var t,n,r,i,o=this;if(e=new o.constructor(e),o.s!==e.s)return o.s||-e.s;if(o.e!==e.e)return o.e>e.e^o.s<0?1:-1;for(r=o.d.length,i=e.d.length,t=0,n=r<i?r:i;t<n;++t)if(o.d[t]!==e.d[t])return o.d[t]>e.d[t]^o.s<0?1:-1;return r===i?0:r>i^o.s<0?1:-1};S.decimalPlaces=S.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*$;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};S.dividedBy=S.div=function(e){return ye(this,new this.constructor(e))};S.dividedToIntegerBy=S.idiv=function(e){var t=this,n=t.constructor;return k(ye(t,new n(e),0,1),n.precision)};S.equals=S.eq=function(e){return!this.cmp(e)};S.exponent=function(){return j(this)};S.greaterThan=S.gt=function(e){return this.cmp(e)>0};S.greaterThanOrEqualTo=S.gte=function(e){return this.cmp(e)>=0};S.isInteger=S.isint=function(){return this.e>this.d.length-2};S.isNegative=S.isneg=function(){return this.s<0};S.isPositive=S.ispos=function(){return this.s>0};S.isZero=function(){return this.s===0};S.lessThan=S.lt=function(e){return 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 pi;function sf(){if(pi)return D;pi=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),a=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),m=Symbol.for("react.view_transition"),h=Symbol.for("react.client.reference");function y(d){if(typeof d=="object"&&d!==null){var g=d.$$typeof;switch(g){case e:switch(d=d.type,d){case n:case i:case r:case u:case a:case m:return d;default:switch(d=d&&d.$$typeof,d){case s:case c:case l:case f:return d;case o:return d;default:return g}}case t:return g}}}return D.ContextConsumer=o,D.ContextProvider=s,D.Element=e,D.ForwardRef=c,D.Fragment=n,D.Lazy=l,D.Memo=f,D.Portal=t,D.Profiler=i,D.StrictMode=r,D.Suspense=u,D.SuspenseList=a,D.isContextConsumer=function(d){return y(d)===o},D.isContextProvider=function(d){return y(d)===s},D.isElement=function(d){return typeof d=="object"&&d!==null&&d.$$typeof===e},D.isForwardRef=function(d){return y(d)===c},D.isFragment=function(d){return y(d)===n},D.isLazy=function(d){return y(d)===l},D.isMemo=function(d){return y(d)===f},D.isPortal=function(d){return y(d)===t},D.isProfiler=function(d){return y(d)===i},D.isStrictMode=function(d){return y(d)===r},D.isSuspense=function(d){return y(d)===u},D.isSuspenseList=function(d){return y(d)===a},D.isValidElementType=function(d){return typeof d=="string"||typeof d=="function"||d===n||d===i||d===r||d===u||d===a||typeof d=="object"&&d!==null&&(d.$$typeof===l||d.$$typeof===f||d.$$typeof===s||d.$$typeof===o||d.$$typeof===c||d.$$typeof===h||d.getModuleId!==void 0)},D.typeOf=y,D}var yi;function cf(){return yi||(yi=1,xn.exports=sf()),xn.exports}var qa=cf(),uf="Invariant failed";function Va(e,t){throw new Error(uf)}const No="carousel",Co="controller",ff="navigation",af="no-scroll",_r="portal",lf="root",Mo="toolbar",Rn="loading",An="error",Nn="complete",df="placeholder",hf=e=>`active-slide-${e}`,Io="flex_center",pf="no_scroll",Lo="no_scroll_padding",wr="slide",yf="slide_wrapper",Oe="prev",xe="next",mi="swipe",je="close",To="onPointerDown",Do="onPointerMove",ko="onPointerUp",$o="onPointerLeave",Fo="onPointerCancel",Wo="onKeyDown",mf="onKeyUp",zo="onWheel",gf="Escape",_f="ArrowLeft",wf="ArrowRight",vf="button",Qn="icon",Uo="contain",gi="cover",Ef="Unknown action type",Bo="yarl__";function me(...e){return e.filter(Boolean).join(" ")}function T(e){return`${Bo}${e}`}function J(e){return`--${Bo}${e}`}function ct(e,t){return`${e}${t?`_${t}`:""}`}function vr(e){return t=>ct(e,t)}function qe(e,t){var n;return(n=e==null?void 0:e[t])!==null&&n!==void 0?n:t}function bf(e,t,n){return qe(e,"{index} of {total}").replace(/\{index}/g,`${Er(n,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function jo(...e){return()=>{e.forEach(t=>{t()})}}function _e(e,t,n){return()=>{const r=p.useContext(n);if(!r)throw new Error(`${e} must be used within a ${t}.Provider`);return r}}function qo(){return typeof window<"u"}function Sf(e,t=0){const n=10**t;return Math.round((e+Number.EPSILON)*n)/n}function Vo(e){return e.type===void 0||e.type==="image"}function Pf(e,t){return e.imageFit===gi||e.imageFit!==Uo&&t===gi}function Jt(e){return typeof e=="string"?Number.parseInt(e,10):e}function Wt(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=Jt(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function Of(e,t){const n=Wt(t),r=n.percent!==void 0?e.width/100*n.percent:n.pixel;return{width:Math.max(e.width-2*r,0),height:Math.max(e.height-2*r,0)}}function Er(e,t){return t>0?(e%t+t)%t:0}function Xo(e){return e.length>0}function Ho(e,t){return e[Er(t,e.length)]}function er(e,t){return Xo(e)?Ho(e,t):void 0}function xf(e){return Vo(e)?e.src:void 0}function Rf(e,t,n=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),n))}const Af=Number(p.version.split(".")[0])>=19;function Nf(e){return{inert:Af?e:e?"":void 0}}function Cf(e){e.scrollTop}const tr={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[je]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:Uo,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,closeOnEscape:!0,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function Te(e,t){return{name:e,component:t}}function V(e,t){return{module:e,children:t}}function Yo(e,t,n){return e.module.name===t?n(e):e.children?[V(e.module,e.children.flatMap(r=>{var i;return(i=Yo(r,t,n))!==null&&i!==void 0?i:[]}))]:[e]}function $e(e,t,n){return e.flatMap(r=>{var i;return(i=Yo(r,t,n))!==null&&i!==void 0?i:[]})}fuLine truncated
+2 -2
View File
@@ -6,10 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ydisks闲鱼助手 - 自动发货与管家系统</title> <title>Ydisks闲鱼助手 - 自动发货与管家系统</title>
<meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" /> <meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" />
<script type="module" crossorigin src="/static/assets/index-BBTWivHc.js"></script> <script type="module" crossorigin src="/static/assets/index-Dw5V5tCq.js"></script>
<link rel="modulepreload" crossorigin href="/static/assets/react-vendor-C_od1ZSF.js"> <link rel="modulepreload" crossorigin href="/static/assets/react-vendor-C_od1ZSF.js">
<link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-CvzvbbIV.js"> <link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-CvzvbbIV.js">
<link rel="stylesheet" crossorigin href="/static/assets/index-DjsVeBHO.css"> <link rel="stylesheet" crossorigin href="/static/assets/index-BgG-QVY7.css">
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>