fix: resolve known issues and improve code standards

- Fix known bugs in user, plan, and server modules
- Standardize code formatting and structure
- Optimize database queries and model relationships
- Improve request validation and error handling
- Update admin controllers for better consistency
This commit is contained in:
xboard committed 2025-06-22 17:38:17 +08:00
1 parent 7f850da9ad
commit 449c30d64e
20 files changed
+56 -51

No files matched your search

+10 -9
View File
@@ -4,32 +4,33 @@ namespace App\Console\Commands;
use App\Services\TrafficResetService;
use App\Utils\Helper;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class ResetTraffic extends Command
{
/**
/**
* The name and signature of the console command.
*/
*/
protected $signature = 'reset:traffic {--batch-size=100 : 分批处理的批次大小} {--dry-run : 预演模式,不实际执行重置} {--max-time=300 : 最大执行时间(秒)}';
/**
/**
* The console command description.
*/
*/
protected $description = '流量重置 - 分批处理所有需要重置的用户';
/**
/**
* 流量重置服务
*/
*/
private TrafficResetService $trafficResetService;
/**
* Create a new command instance.
*/
public function __construct(TrafficResetService $trafficResetService)
{
parent::__construct();
{
parent::__construct();
$this->trafficResetService = $trafficResetService;
}
@@ -177,7 +178,7 @@ class ResetTraffic extends Command
'ID' => $user->id,
'邮箱' => substr($user->email, 0, 20) . (strlen($user->email) > 20 ? '...' : ''),
'套餐' => $user->plan->name ?? 'N/A',
'下次重置' => $user->next_reset_at->format('m-d H:i'),
'下次重置' => Carbon::createFromTimestamp($user->next_reset_at)->format('Y-m-d H:i:s'),
'当前流量' => Helper::trafficConvert(($user->u ?? 0) + ($user->d ?? 0)),
'重置次数' => $user->reset_count,
];
+1 -1
View File
@@ -52,7 +52,7 @@ class SendRemindMail extends Command
}
$startTime = microtime(true);
$progressBar = $this->output->createProgressBar(ceil($totalUsers / $chunkSize));
$progressBar = $this->output->createProgressBar((int) ceil($totalUsers / $chunkSize));
$progressBar->start();
$statistics = $mailService->processUsersInChunks($chunkSize, function () use ($progressBar) {
@@ -13,6 +13,7 @@ use Laravel\Horizon\Contracts\MetricsRepository;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\Contracts\WorkloadRepository;
use Laravel\Horizon\WaitTimeCalculator;
use App\Helpers\ResponseEnum;
class SystemController extends Controller
{
@@ -257,7 +258,7 @@ class SystemController extends Controller
]);
} catch (\Exception $e) {
return $this->error('清除日志失败:' . $e->getMessage());
return $this->fail(ResponseEnum::HTTP_ERROR, null, '清除日志失败:' . $e->getMessage());
}
}
@@ -293,7 +294,7 @@ class SystemController extends Controller
return $this->success($stats);
} catch (\Exception $e) {
return $this->error('获取统计信息失败:' . $e->getMessage());
return $this->fail(ResponseEnum::HTTP_ERROR, null, '获取统计信息失败:' . $e->getMessage());
}
}
}
@@ -71,7 +71,7 @@ class TrafficResetController extends Controller
$logs = $query->paginate($perPage);
// 格式化数据
$logs->getCollection()->transform(function ($log) {
$formattedLogs = $logs->getCollection()->map(function (TrafficResetLog $log) {
return [
'id' => $log->id,
'user_id' => $log->user_id,
@@ -99,7 +99,7 @@ class TrafficResetController extends Controller
});
return response()->json([
'data' => $logs->items(),
'data' => $formattedLogs->toArray(),
'pagination' => [
'current_page' => $logs->currentPage(),
'last_page' => $logs->lastPage(),
@@ -198,7 +198,8 @@ class TrafficResetController extends Controller
$history = $this->trafficResetService->getUserResetHistory($user, $limit);
$data = $history->map(function ($log) {
/** @var \Illuminate\Database\Eloquent\Collection<int, \App\Models\TrafficResetLog> $history */
$data = $history->map(function (TrafficResetLog $log) {
return [
'id' => $log->id,
'reset_type' => $log->reset_type,
+3 -3
View File
@@ -18,12 +18,12 @@ class UserUpdate extends FormRequest
'password' => 'nullable|min:8',
'transfer_enable' => 'numeric',
'expired_at' => 'nullable|integer',
'banned' => 'in:0,1',
'banned' => 'bool',
'plan_id' => 'nullable|integer',
'commission_rate' => 'nullable|integer|min:0|max:100',
'discount' => 'nullable|integer|min:0|max:100',
'is_admin' => 'required|in:0,1',
'is_staff' => 'required|in:0,1',
'is_admin' => 'boolean',
'is_staff' => 'boolean',
'u' => 'integer',
'd' => 'integer',
'balance' => 'numeric',
+2 -1
View File
@@ -14,7 +14,8 @@ class Coupon extends Model
'created_at' => 'timestamp',
'updated_at' => 'timestamp',
'limit_plan_ids' => 'array',
'limit_period' => 'array'
'limit_period' => 'array',
'show' => 'boolean',
];
public function getLimitPeriodAttribute($value)
+2 -1
View File
@@ -10,6 +10,7 @@ class InviteCode extends Model
protected $dateFormat = 'U';
protected $casts = [
'created_at' => 'timestamp',
'updated_at' => 'timestamp'
'updated_at' => 'timestamp',
'status' => 'boolean',
];
}
+1 -1
View File
@@ -23,7 +23,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
* @property array|null $prices 价格配置
* @property int $sort 排序
* @property string|null $content 套餐描述
* @property int $reset_traffic_method 流量重置方式
* @property int|null $reset_traffic_method 流量重置方式
* @property int|null $capacity_limit 订阅人数限制
* @property int|null $device_limit 设备数量限制
* @property int $created_at
+5 -1
View File
@@ -11,6 +11,10 @@ class Plugin extends Model
protected $guarded = [
'id',
'created_at',
'updated_at'
'updated_at',
];
protected $casts = [
'is_enabled' => 'boolean'
];
}
+2 -1
View File
@@ -23,7 +23,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
* @property array|null $group_ids 分组IDs
* @property array|null $route_ids 路由IDs
* @property array|null $tags 标签
* @property string|null $show 是否显示
* @property boolean $show 是否显示
* @property string|null $allow_insecure 是否允许不安全
* @property string|null $network 网络类型
* @property int|null $parent_id 父节点ID
@@ -112,6 +112,7 @@ class Server extends Model
'protocol_settings' => 'array',
'last_check_at' => 'integer',
'last_push_at' => 'integer',
'show' => 'boolean',
'created_at' => 'timestamp',
'updated_at' => 'timestamp'
];
+5 -3
View File
@@ -37,8 +37,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
* @property int|null $last_login_at 最后登录时间
* @property int|null $parent_id 父账户ID
* @property int|null $is_admin 是否管理员
* @property \Carbon\Carbon|null $next_reset_at 下次流量重置时间
* @property \Carbon\Carbon|null $last_reset_at 上次流量重置时间
* @property int|null $next_reset_at 下次流量重置时间
* @property int|null $last_reset_at 上次流量重置时间
* @property int $reset_count 流量重置次数
* @property int $created_at
* @property int $updated_at
@@ -64,7 +64,9 @@ class User extends Authenticatable
protected $casts = [
'created_at' => 'timestamp',
'updated_at' => 'timestamp',
'banned' => 'integer',
'banned' => 'boolean',
'is_admin' => 'boolean',
'is_staff' => 'boolean',
'remind_expire' => 'boolean',
'remind_traffic' => 'boolean',
'commission_auto_check' => 'boolean',
+2 -2
View File
@@ -53,10 +53,10 @@ class UserObserver
$nextResetTime = $this->trafficResetService->calculateNextResetTime($user);
if ($nextResetTime) {
$user->next_reset_at = $nextResetTime->timestamp;
$user->setAttribute('next_reset_at', $nextResetTime->timestamp);
} else {
// 如果计算结果为空,清除重置时间
$user->next_reset_at = null;
$user->setAttribute('next_reset_at', null);
}
} catch (\Exception $e) {
+1 -1
View File
@@ -16,7 +16,7 @@ class SettingServiceProvider extends ServiceProvider
public function register()
{
$this->app->scoped(Setting::class, function (Application $app) {
return new Setting();
return Setting::getInstance();
});
}
-7
View File
@@ -87,13 +87,6 @@ class ServerService
public static function getRoutes(array $routeIds)
{
$routes = ServerRoute::select(['id', 'match', 'action', 'action_value'])->whereIn('id', $routeIds)->get();
// TODO: remove on 1.8.0
foreach ($routes as $k => $route) {
$array = json_decode($route->match, true);
if (is_array($array))
$routes[$k]['match'] = $array;
}
// TODO: remove on 1.8.0
return $routes;
}
+1 -1
View File
@@ -109,7 +109,6 @@ class TrafficResetService
Plan::RESET_TRAFFIC_MONTHLY => $this->getNextMonthlyReset($user, $now),
Plan::RESET_TRAFFIC_FIRST_DAY_YEAR => $this->getNextYearFirstDay($now),
Plan::RESET_TRAFFIC_YEARLY => $this->getNextYearlyReset($user, $now),
Plan::RESET_TRAFFIC_NEVER => null,
default => null,
};
}
@@ -251,6 +250,7 @@ class TrafficResetService
Plan::RESET_TRAFFIC_MONTHLY => TrafficResetLog::TYPE_MONTHLY,
Plan::RESET_TRAFFIC_FIRST_DAY_YEAR => TrafficResetLog::TYPE_FIRST_DAY_YEAR,
Plan::RESET_TRAFFIC_YEARLY => TrafficResetLog::TYPE_YEARLY,
Plan::RESET_TRAFFIC_NEVER => TrafficResetLog::TYPE_MANUAL,
default => TrafficResetLog::TYPE_MANUAL,
};
}
+2 -2
View File
@@ -145,8 +145,8 @@ class UserService
'total_available' => $user->transfer_enable ?? 0,
'remaining' => $user->getRemainingTraffic(),
'usage_percentage' => $user->getTrafficUsagePercentage(),
'next_reset_at' => $user->next_reset_at?->timestamp,
'last_reset_at' => $user->last_reset_at?->timestamp,
'next_reset_at' => $user->next_reset_at,
'last_reset_at' => $user->last_reset_at,
'reset_count' => $user->reset_count,
];
}
+2 -2
View File
@@ -135,9 +135,9 @@ class Setting
// 处理JSON格式的值
foreach ($settings as $key => $value) {
if (is_string($value) && $value !== null) {
if (is_string($value)) {
$decoded = json_decode($value, true);
if (json_last_error() === JSON_ERROR_NONE) {
if (json_last_error() === JSON_ERROR_NONE && $decoded !== null) {
$settings[$key] = $decoded;
}
}
@@ -122,7 +122,7 @@ return new class extends Migration {
$table->integer('group_id')->change();
$table->integer('transfer_enable')->change();
$table->integer('speed_limit')->nullable()->change();
$table->boolean('reset_traffic_method')->nullable()->change();
$table->integer('reset_traffic_method')->nullable()->change();
$table->integer('capacity_limit')->nullable()->change();
});
}
+1 -1
View File
@@ -1 +1 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--header-height: 4rem;--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreLine truncated
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--header-height: 4rem;--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreLine truncated
+8 -8
View File
@@ -1,20 +1,20 @@
import{r as m,j as e,t as Oi,c as zi,I as Yt,a as it,S as vn,u as As,b as $i,d as bn,R as Nr,e as _r,f as Ai,F as qi,C as Hi,L as wr,T as Cr,g as Sr,h as Ui,i as Ki,k as Bi,l as Gi,m as A,z as x,n as V,o as we,p as Ce,q as ne,s as Ts,v as ke,w as Wi,x as Yi,O as yn,y as Ji,A as Qi,B as Xi,D as Zi,E as eo,G as so,Q as to,H as ao,J as no,K as ro,P as lo,M as io,N as oo,U as co,V as mo,W as kr,X as Tr,Y as Da,Z as Pa,_ as Nn,$ as ms,a0 as La,a1 as Ea,a2 as Dr,a3 as Pr,a4 as Lr,a5 as _n,a6 as Er,a7 as uo,a8 as Rr,a9 as Fr,aa as Ir,ab as Vr,ac as ot,ad as Mr,ae as xo,af as Or,ag as zr,ah as ho,ai as go,aj as fo,ak as po,al as jo,am as vo,an as bo,ao as yo,ap as No,aq as _o,ar as wo,as as $r,at as Co,au as So,av as Ys,aw as Ar,ax as ko,ay as To,az as qr,aA as wn,aB as Do,aC as Po,aD as Jn,aE as Lo,aF as Hr,aG as Eo,aH as Ur,aI as Ro,aJ as Fo,aK as Io,aL as Vo,aM as Mo,aN as Oo,aO as Kr,aP as zo,aQ as $o,aR as Ao,aS as es,aT as qo,aU as Cn,aV as Ho,aW as Uo,aX as Br,aY as Gr,aZ as Wr,a_ as Ko,a$ as Bo,b0 as Go,b1 as Yr,b2 as Wo,b3 as Sn,b4 as Jr,b5 as Yo,b6 as Qr,b7 as Jo,b8 as Xr,b9 as Qo,ba as Zr,bb as el,bc as Xo,bd as Zo,be as sl,bf as ec,bg as sc,bh as tl,bi as tc,bj as al,bk as ac,bl as nc,bm as _s,bn as Pe,bo as Cs,bp as rc,bq as lc,br as ic,bs as oc,bt as cc,bu as dc,bv as Qn,bw as Xn,bx as mc,by as uc,bz as kn,bA as xc,bB as hc,bC as ja,bD as wt,bE as va,bF as gc,bG as nl,bH as fc,bI as pc,bJ as rl,bK as jc,bL as vc,bM as Zn,bN as dn,bO as mn,bP as bc,bQ as yc,bR as ll,bS as Nc,bT as _c,bU as wc,bV as ba,bW as un,bX as ss,bY as ya,bZ as Cc,b_ as Qa,b$ as Sc,c0 as er,c1 as ds,c2 as qt,c3 as Ht,c4 as xn,c5 as il,c6 as ts,c7 as us,c8 as ol,c9 as cl,ca as kc,cb as Tc,cc as Dc,cd as Pc,ce as Lc,cf as dl,cg as Ec,ch as Rc,ci as Be,cj as sr,ck as Fc,cl as ml,cm as ul,cn as xl,co as hl,cp as gl,cq as fl,cr as Ic,cs as Vc,ct as Mc,cu as Ra,cv as ct,cw as vs,cx as bs,cy as Oc,cz as zc,cA as $c,cB as Ac,cC as pl,cD as qc,cE as Hc,cF as Uc,cG as Kc,cH as hn,cI as Tn,cJ as Dn,cK as Bc,cL as Es,cM as Rs,cN as Fa,cO as Gc,cP as Na,cQ as Wc,cR as tr,cS as jl,cT as ar,cU as _a,cV as Yc,cW as Jc,cX as Qc,cY as Xc,cZ as Zc,c_ as vl,c$ as ed,d0 as sd,d1 as bl,d2 as gn,d3 as yl,d4 as td,d5 as fn,d6 as Nl,d7 as ad,d8 as Ut,d9 as Pn,da as nd,db as rd,dc as nr,dd as _l,de as ld,df as id,dg as od,dh as rr}from"./vendor.js";import"./index.js";var bg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yg(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function cd(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var t=function r(){return this instanceof r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return s[r]}})}),t}const dd={theme:"system",setTheme:()=>null},wl=m.createContext(dd);function md({children:s,defaultTheme:n="system",storageKey:t="vite-ui-theme",...r}){const[a,i]=m.useState(()=>localStorage.getItem(t)||n);m.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),a==="system"){const u=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(u);return}d.classList.add(a)},[a]);const l={theme:a,setTheme:d=>{localStorage.setItem(t,d),i(d)}};return e.jsx(wl.Provider,{...r,value:l,children:s})}const ud=()=>{const s=m.useContext(wl);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},xd=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),hd=function(s,n){return new URL(s,n).href},lr={},ye=function(n,t,r){let a=Promise.resolve();if(t&&t.length>0){const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),u=d?.nonce||d?.getAttribute("nonce");a=Promise.allSettled(t.map(o=>{if(o=hd(o,r),o in lr)return;lr[o]=!0;const c=o.endsWith(".css"),h=c?'[rel="stylesheet"]':"";if(!!r)for(let S=l.length-1;S>=0;S--){const p=l[S];if(p.href===o&&(!c||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${h}`))return;const C=document.createElement("link");if(C.rel=c?"stylesheet":xd,c||(C.as="script"),C.crossOrigin="",C.href=o,u&&C.setAttribute("nonce",u),document.head.appendChild(C),c)return new Promise((S,p)=>{C.addEventListener("load",S),C.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${o}`)))})}))}function i(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return a.then(l=>{for(const d of l||[])d.status==="rejected"&&i(d.reason);return n().catch(i)})};function y(...s){return Oi(zi(s))}const Tt=it("inLine truncated
`)[0]})}),e.jsx(ce,{className:"max-w-[300px] whitespace-pre-wrap",children:e.jsx("span",{children:B.original.exception})})]})})}),zt.display({id:"actions",header:()=>s("dashboard:queue.details.action","操作"),size:80,cell:({row:B})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>Li(B.original),"aria-label":s("dashboard:queue.details.viewDetail","查看详情"),children:e.jsx(un,{className:"h-4 w-4"})})})],[s]),Wn=ss({data:Gn,columns:ki,getCoreRowModel:ts(),getPaginationRowModel:us(),pageCount:Math.ceil(Si/d),manualPagination:!0,state:{pagination:{pageIndex:i-1,pageSize:d}},onPaginationChange:B=>{if(typeof B=="function"){const Hs=B({pageIndex:i-1,pageSize:d});Yn(Hs.pageIndex+1)}else Yn(B.pageIndex+1)}}),Ti=()=>{t(B=>B+1)},Yn=B=>{l(B)},aa=B=>{p(B)},Di=B=>{ae(B),p(1)},Pi=()=>{R(""),I(""),ae("all"),p(1)},na=B=>{T(B),g(!0)},Li=B=>{o(B),h(!0)},Ei=async()=>{try{const B=await he.getLogClearStats({days:q,level:X==="all"?void 0:X});Lt(B.data),Et(!0)}catch(B){console.error("获取清理统计失败:",B),A.error("获取清理统计失败")}},Ri=async()=>{Fs(!0);try{const B=await he.clearSystemLog({days:q,level:X==="all"?void 0:X,limit:De});B.data.status==="success"?(A.success(`清理完成!已清理 ${B.data.cleared_count} 条日志`),te(!1),Et(!1),Lt(null),se()):A.error(B.data.message||"清理失败")}catch(B){console.error("清理日志失败:",B),A.error("清理日志失败")}finally{Fs(!1)}};if(Ja||Zs)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(ya,{className:"h-6 w-6 animate-spin"})});const Fi=B=>B?e.jsx(ol,{className:"h-5 w-5 text-green-500"}):e.jsx(cl,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ee,{children:[e.jsxs(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(Cc,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Os,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:Ti,disabled:pe||Un,children:e.jsx(Qa,{className:y("h-4 w-4",(pe||Un)&&"animate-spin")})})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Fi(re?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(U,{variant:re?.status?"secondary":"destructive",children:re?.status?s("dashboard:queue.status.normal"):s("dashboard:queue.status.abnormal")})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.status.waitTime",{seconds:re?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(be,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.recentJobs")}),e.jsx("p",{className:"text-2xl font-bold",children:re?.recentJobs||0}),e.jsx(ha,{value:(re?.recentJobs||0)/(re?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:re?.periods?.recentJobs||0})})})]})}),e.jsx(be,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.jobsPerMinute")}),e.jsx("p",{className:"text-2xl font-bold",children:re?.jobsPerMinute||0}),e.jsx(ha,{value:(re?.jobsPerMinute||0)/(re?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:re?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(Ee,{children:[e.jsxs(Fe,{children:[e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(Sc,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Os,{children:s("dashboard:queue.details.description")})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.failedJobs7Days")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"cursor-pointer text-2xl font-bold text-destructive hover:underline",title:s("dashboard:queue.details.viewFailedJobs"),onClick:()=>a(!0),style:{userSelect:"none"},children:re?.failedJobs||0}),e.jsx(un,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-destructive",o Line truncated
import{r as m,j as e,t as Oi,c as zi,I as Yt,a as it,S as vn,u as As,b as $i,d as bn,R as Nr,e as _r,f as Ai,F as qi,C as Hi,L as wr,T as Cr,g as Sr,h as Ui,i as Ki,k as Bi,l as Gi,m as A,z as x,n as V,o as we,p as Ce,q as ne,s as Ts,v as ke,w as Wi,x as Yi,O as yn,y as Ji,A as Qi,B as Xi,D as Zi,E as eo,G as so,Q as to,H as ao,J as no,K as ro,P as lo,M as io,N as oo,U as co,V as mo,W as kr,X as Tr,Y as Da,Z as Pa,_ as Nn,$ as ms,a0 as La,a1 as Ra,a2 as Dr,a3 as Pr,a4 as Lr,a5 as _n,a6 as Rr,a7 as uo,a8 as Er,a9 as Fr,aa as Ir,ab as Vr,ac as ot,ad as Mr,ae as xo,af as Or,ag as zr,ah as ho,ai as go,aj as fo,ak as po,al as jo,am as vo,an as bo,ao as yo,ap as No,aq as _o,ar as wo,as as $r,at as Co,au as So,av as Ys,aw as Ar,ax as ko,ay as To,az as qr,aA as wn,aB as Do,aC as Po,aD as Jn,aE as Lo,aF as Hr,aG as Ro,aH as Ur,aI as Eo,aJ as Fo,aK as Io,aL as Vo,aM as Mo,aN as Oo,aO as Kr,aP as zo,aQ as $o,aR as Ao,aS as es,aT as qo,aU as Cn,aV as Ho,aW as Uo,aX as Br,aY as Gr,aZ as Wr,a_ as Ko,a$ as Bo,b0 as Go,b1 as Yr,b2 as Wo,b3 as Sn,b4 as Jr,b5 as Yo,b6 as Qr,b7 as Jo,b8 as Xr,b9 as Qo,ba as Zr,bb as el,bc as Xo,bd as Zo,be as sl,bf as ec,bg as sc,bh as tl,bi as tc,bj as al,bk as ac,bl as nc,bm as ws,bn as Pe,bo as Ss,bp as rc,bq as lc,br as ic,bs as oc,bt as cc,bu as dc,bv as Qn,bw as Xn,bx as mc,by as uc,bz as kn,bA as xc,bB as hc,bC as ja,bD as wt,bE as va,bF as gc,bG as nl,bH as fc,bI as pc,bJ as rl,bK as jc,bL as vc,bM as Zn,bN as dn,bO as mn,bP as bc,bQ as yc,bR as ll,bS as Nc,bT as _c,bU as wc,bV as ba,bW as un,bX as ss,bY as ya,bZ as Cc,b_ as Qa,b$ as Sc,c0 as er,c1 as ds,c2 as qt,c3 as Ht,c4 as xn,c5 as il,c6 as ts,c7 as us,c8 as ol,c9 as cl,ca as kc,cb as Tc,cc as Dc,cd as Pc,ce as Lc,cf as dl,cg as Rc,ch as Ec,ci as Be,cj as sr,ck as Fc,cl as ml,cm as ul,cn as xl,co as hl,cp as gl,cq as fl,cr as Ic,cs as Vc,ct as Mc,cu as Ea,cv as ct,cw as bs,cx as ys,cy as Oc,cz as zc,cA as $c,cB as Ac,cC as pl,cD as qc,cE as Hc,cF as Uc,cG as Kc,cH as hn,cI as Tn,cJ as Dn,cK as Bc,cL as Rs,cM as Es,cN as Fa,cO as Gc,cP as Na,cQ as Wc,cR as tr,cS as jl,cT as ar,cU as _a,cV as Yc,cW as Jc,cX as Qc,cY as Xc,cZ as Zc,c_ as vl,c$ as ed,d0 as sd,d1 as bl,d2 as gn,d3 as yl,d4 as td,d5 as fn,d6 as Nl,d7 as ad,d8 as Ut,d9 as Pn,da as nd,db as rd,dc as nr,dd as _l,de as ld,df as id,dg as od,dh as rr}from"./vendor.js";import"./index.js";var yg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ng(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function cd(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var t=function r(){return this instanceof r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return s[r]}})}),t}const dd={theme:"system",setTheme:()=>null},wl=m.createContext(dd);function md({children:s,defaultTheme:n="system",storageKey:t="vite-ui-theme",...r}){const[a,i]=m.useState(()=>localStorage.getItem(t)||n);m.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),a==="system"){const u=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(u);return}d.classList.add(a)},[a]);const l={theme:a,setTheme:d=>{localStorage.setItem(t,d),i(d)}};return e.jsx(wl.Provider,{...r,value:l,children:s})}const ud=()=>{const s=m.useContext(wl);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},xd=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),hd=function(s,n){return new URL(s,n).href},lr={},ye=function(n,t,r){let a=Promise.resolve();if(t&&t.length>0){const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),u=d?.nonce||d?.getAttribute("nonce");a=Promise.allSettled(t.map(o=>{if(o=hd(o,r),o in lr)return;lr[o]=!0;const c=o.endsWith(".css"),h=c?'[rel="stylesheet"]':"";if(!!r)for(let S=l.length-1;S>=0;S--){const f=l[S];if(f.href===o&&(!c||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${h}`))return;const C=document.createElement("link");if(C.rel=c?"stylesheet":xd,c||(C.as="script"),C.crossOrigin="",C.href=o,u&&C.setAttribute("nonce",u),document.head.appendChild(C),c)return new Promise((S,f)=>{C.addEventListener("load",S),C.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${o}`)))})}))}function i(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return a.then(l=>{for(const d of l||[])d.status==="rejected"&&i(d.reason);return n().catch(i)})};function b(...s){return Oi(zi(s))}const Tt=it("inLine truncated
`)[0]})}),e.jsx(ce,{className:"max-w-[300px] whitespace-pre-wrap",children:e.jsx("span",{children:B.original.exception})})]})})}),zt.display({id:"actions",header:()=>s("dashboard:queue.details.action","操作"),size:80,cell:({row:B})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>Li(B.original),"aria-label":s("dashboard:queue.details.viewDetail","查看详情"),children:e.jsx(un,{className:"h-4 w-4"})})})],[s]),Wn=ss({data:Gn,columns:ki,getCoreRowModel:ts(),getPaginationRowModel:us(),pageCount:Math.ceil(Si/d),manualPagination:!0,state:{pagination:{pageIndex:i-1,pageSize:d}},onPaginationChange:B=>{if(typeof B=="function"){const Hs=B({pageIndex:i-1,pageSize:d});Yn(Hs.pageIndex+1)}else Yn(B.pageIndex+1)}}),Ti=()=>{t(B=>B+1)},Yn=B=>{l(B)},aa=B=>{f(B)},Di=B=>{ae(B),f(1)},Pi=()=>{R(""),I(""),ae("all"),f(1)},na=B=>{T(B),g(!0)},Li=B=>{o(B),h(!0)},Ri=async()=>{try{const B=await he.getLogClearStats({days:q,level:X==="all"?void 0:X});Lt(B.data),Rt(!0)}catch(B){console.error("获取清理统计失败:",B),A.error("获取清理统计失败")}},Ei=async()=>{Fs(!0);try{const B=await he.clearSystemLog({days:q,level:X==="all"?void 0:X,limit:De});B.data.status==="success"?(A.success(`清理完成!已清理 ${B.data.cleared_count} 条日志`),te(!1),Rt(!1),Lt(null),se()):A.error(B.data.message||"清理失败")}catch(B){console.error("清理日志失败:",B),A.error("清理日志失败")}finally{Fs(!1)}};if(Ja||Zs)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(ya,{className:"h-6 w-6 animate-spin"})});const Fi=B=>B?e.jsx(ol,{className:"h-5 w-5 text-green-500"}):e.jsx(cl,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Re,{children:[e.jsxs(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(Cc,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Os,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:Ti,disabled:pe||Un,children:e.jsx(Qa,{className:b("h-4 w-4",(pe||Un)&&"animate-spin")})})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Fi(re?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(U,{variant:re?.status?"secondary":"destructive",children:re?.status?s("dashboard:queue.status.normal"):s("dashboard:queue.status.abnormal")})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.status.waitTime",{seconds:re?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(be,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.recentJobs")}),e.jsx("p",{className:"text-2xl font-bold",children:re?.recentJobs||0}),e.jsx(ha,{value:(re?.recentJobs||0)/(re?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:re?.periods?.recentJobs||0})})})]})}),e.jsx(be,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.jobsPerMinute")}),e.jsx("p",{className:"text-2xl font-bold",children:re?.jobsPerMinute||0}),e.jsx(ha,{value:(re?.jobsPerMinute||0)/(re?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:re?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(Re,{children:[e.jsxs(Fe,{children:[e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(Sc,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Os,{children:s("dashboard:queue.details.description")})]}),e.jsx(Ie,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.failedJobs7Days")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"cursor-pointer text-2xl font-bold text-destructive hover:underline",title:s("dashboard:queue.details.viewFailedJobs"),onClick:()=>a(!0),style:{userSelect:"none"},children:re?.failedJobs||0}),e.jsx(un,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-destructive",o Line truncated
File: ${Vi}
Line: ${Mi}`}return JSON.stringify(B,null,2)}catch{return f.context}})()})})]})]}),e.jsx(Le,{children:e.jsx(Gs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common.close","关闭")})})})]})}),e.jsx(ge,{open:ee,onOpenChange:te,children:e.jsxs(de,{className:"max-w-2xl",children:[e.jsx(ve,{children:e.jsxs(fe,{className:"flex items-center gap-2",children:[e.jsx(ds,{className:"h-5 w-5 text-destructive"}),s("dashboard:systemLog.clearLogs","清理日志")]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ae,{htmlFor:"clearDays",children:s("dashboard:systemLog.clearDays","清理天数")}),e.jsx(D,{id:"clearDays",type:"number",min:"1",max:"365",value:q,onChange:B=>F(parseInt(B.target.value)||30),placeholder:"30"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearDaysDesc","清理多少天前的日志 (1-365天)")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ae,{htmlFor:"clearLevel",children:s("dashboard:systemLog.clearLevel","日志级别")}),e.jsxs(J,{value:X,onValueChange:ys,children:[e.jsx(W,{children:e.jsx(Q,{})}),e.jsxs(Y,{children:[e.jsx($,{value:"all",children:s("dashboard:systemLog.tabs.all","全部")}),e.jsx($,{value:"info",children:s("dashboard:systemLog.tabs.info","信息")}),e.jsx($,{value:"warning",children:s("dashboard:systemLog.tabs.warning","警告")}),e.jsx($,{value:"error",children:s("dashboard:systemLog.tabs.error","错误")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ae,{htmlFor:"clearLimit",children:s("dashboard:systemLog.clearLimit","单次限制")}),e.jsx(D,{id:"clearLimit",type:"number",min:"100",max:"10000",value:De,onChange:B=>ie(parseInt(B.target.value)||1e3),placeholder:"1000"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearLimitDesc","单次清理数量限制 (100-10000条)")})]})]}),e.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(kn,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium text-amber-800 dark:text-amber-200",children:s("dashboard:systemLog.clearPreview","清理预览")})]}),e.jsxs(G,{variant:"outline",size:"sm",onClick:Ei,disabled:Ns,children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.getStats","获取统计")]})]}),Zt&&Xs&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.cutoffDate","截止日期")}),e.jsx("p",{className:"font-mono text-sm",children:Xs.cutoff_date})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.totalLogs","总日志数")}),e.jsx("p",{className:"font-mono text-sm font-medium",children:Xs.total_logs.toLocaleString()})]})]}),e.jsxs("div",{className:"rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ht,{className:"h-4 w-4 text-red-600"}),e.jsxs("span",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:[s("dashboard:systemLog.willClear","将要清理"),":",e.jsx("span",{className:"ml-1 font-bold",children:Xs.logs_to_clear.toLocaleString()}),s("dashboard:systemLog.logsUnit"," 条日志")]})]}),e.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-300",children:s("dashboard:systemLog.clearWarning","此操作不可撤销,请谨慎操作!")})]})]})]})]}),e.jsxs(Le,{children:[e.jsx(G,{variant:"outline",onClick:()=>{te(!1),Et(!1),Lt(null)},children:s("common.cancel","取消")}),e.jsx(G,{variant:"destructive",onClick:Ri,disabled:Ns||!Zt||!Xs,children:Ns?e.jsxs(e.Fragment,{children:[e.jsx(ya,{className:"mr-2 h-4 w-4 animate-spin"}),s("dashboard:systemLog.clearing","清理中...")]}):e.jsxs(e.Fragment,{children:[e.jsx(ds,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.confirmClear","确认清理")]})})]})]})})]})}function Cm(){const{t:s}=V();return e.jsxs(ze,{children:[e.jsxs($e,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("dashboard:title")})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ns,{}),e.jsx(Ye,{}),e.jsx(Je,{})]})]}),e.jsx(He,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(vm,{}),e.jsx(hm,{}),e.jsx(bm,{}),e.jsx(wm,{})]})})})]})}const Sm=Object.freeze(Object.defineProperty({__proto__:null,default:Cm},Symbol.toStringTag,{value:"Module"}));function km({className:s,items:n,...t}){const{pa Line truncated
Line: ${Mi}`}return JSON.stringify(B,null,2)}catch{return _.context}})()})})]})]}),e.jsx(Le,{children:e.jsx(Gs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common.close","关闭")})})})]})}),e.jsx(ge,{open:ee,onOpenChange:te,children:e.jsxs(de,{className:"max-w-2xl",children:[e.jsx(ve,{children:e.jsxs(fe,{className:"flex items-center gap-2",children:[e.jsx(ds,{className:"h-5 w-5 text-destructive"}),s("dashboard:systemLog.clearLogs","清理日志")]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ae,{htmlFor:"clearDays",children:s("dashboard:systemLog.clearDays","清理天数")}),e.jsx(P,{id:"clearDays",type:"number",min:"1",max:"365",value:q,onChange:B=>F(parseInt(B.target.value)||30),placeholder:"30"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearDaysDesc","清理多少天前的日志 (1-365天)")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ae,{htmlFor:"clearLevel",children:s("dashboard:systemLog.clearLevel","日志级别")}),e.jsxs(J,{value:X,onValueChange:Ns,children:[e.jsx(W,{children:e.jsx(Q,{})}),e.jsxs(Y,{children:[e.jsx($,{value:"all",children:s("dashboard:systemLog.tabs.all","全部")}),e.jsx($,{value:"info",children:s("dashboard:systemLog.tabs.info","信息")}),e.jsx($,{value:"warning",children:s("dashboard:systemLog.tabs.warning","警告")}),e.jsx($,{value:"error",children:s("dashboard:systemLog.tabs.error","错误")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ae,{htmlFor:"clearLimit",children:s("dashboard:systemLog.clearLimit","单次限制")}),e.jsx(P,{id:"clearLimit",type:"number",min:"100",max:"10000",value:De,onChange:B=>ie(parseInt(B.target.value)||1e3),placeholder:"1000"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearLimitDesc","单次清理数量限制 (100-10000条)")})]})]}),e.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(kn,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium text-amber-800 dark:text-amber-200",children:s("dashboard:systemLog.clearPreview","清理预览")})]}),e.jsxs(G,{variant:"outline",size:"sm",onClick:Ri,disabled:_s,children:[e.jsx(Ss,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.getStats","获取统计")]})]}),Zt&&Xs&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.cutoffDate","截止日期")}),e.jsx("p",{className:"font-mono text-sm",children:Xs.cutoff_date})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.totalLogs","总日志数")}),e.jsx("p",{className:"font-mono text-sm font-medium",children:Xs.total_logs.toLocaleString()})]})]}),e.jsxs("div",{className:"rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ht,{className:"h-4 w-4 text-red-600"}),e.jsxs("span",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:[s("dashboard:systemLog.willClear","将要清理"),":",e.jsx("span",{className:"ml-1 font-bold",children:Xs.logs_to_clear.toLocaleString()}),s("dashboard:systemLog.logsUnit"," 条日志")]})]}),e.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-300",children:s("dashboard:systemLog.clearWarning","此操作不可撤销,请谨慎操作!")})]})]})]})]}),e.jsxs(Le,{children:[e.jsx(G,{variant:"outline",onClick:()=>{te(!1),Rt(!1),Lt(null)},children:s("common.cancel","取消")}),e.jsx(G,{variant:"destructive",onClick:Ei,disabled:_s||!Zt||!Xs,children:_s?e.jsxs(e.Fragment,{children:[e.jsx(ya,{className:"mr-2 h-4 w-4 animate-spin"}),s("dashboard:systemLog.clearing","清理中...")]}):e.jsxs(e.Fragment,{children:[e.jsx(ds,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.confirmClear","确认清理")]})})]})]})})]})}function Cm(){const{t:s}=V();return e.jsxs(ze,{children:[e.jsxs($e,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("dashboard:title")})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ns,{}),e.jsx(Ye,{}),e.jsx(Je,{})]})]}),e.jsx(He,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(vm,{}),e.jsx(hm,{}),e.jsx(bm,{}),e.jsx(wm,{})]})})})]})}const Sm=Object.freeze(Object.defineProperty({__proto__:null,default:Cm},Symbol.toStringTag,{value:"Module"}));function km({className:s,items:n,...t}){const{pa Line truncated
`),onChange:c=>{const h=c.target.value.split(`
`).filter(Boolean);o.onChange(h),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(L,{})]})}),e.jsx(b,{control:a.control,name:"recaptcha_enable",render:({field:o})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.recaptcha.enable.label")}),e.jsx(O,{children:s("safe.form.recaptcha.enable.description")})]}),e.jsx(N,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:c=>{o.onChange(c),u(a.getValues())}})})]})}),a.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:a.control,name:"recaptcha_site_key",render:({field:o})=>e.jsxs(j,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.recaptcha.siteKey.label")}),e.jsx(N,{children:e.jsx(D,{placeholder:s("safe.form.recaptcha.siteKey.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.recaptcha.siteKey.description")}),e.jsx(L,{})]})}),e.jsx(b,{control:a.control,name:"recaptcha_key",render:({field:o})=>e.jsxs(j,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.recaptcha.key.label")}),e.jsx(N,{children:e.jsx(D,{placeholder:s("safe.form.recaptcha.key.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.recaptcha.key.description")}),e.jsx(L,{})]})})]}),e.jsx(b,{control:a.control,name:"register_limit_by_ip_enable",render:({field:o})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(O,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(N,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:c=>{o.onChange(c),u(a.getValues())}})})]})}),a.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:a.control,name:"register_limit_count",render:({field:o})=>e.jsxs(j,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(N,{children:e.jsx(D,{placeholder:s("safe.form.registerLimit.count.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.registerLimit.count.description")}),e.jsx(L,{})]})}),e.jsx(b,{control:a.control,name:"register_limit_expire",render:({field:o})=>e.jsxs(j,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(N,{children:e.jsx(D,{placeholder:s("safe.form.registerLimit.expire.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.registerLimit.expire.description")}),e.jsx(L,{})]})})]}),e.jsx(b,{control:a.control,name:"password_limit_enable",render:({field:o})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx(O,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(N,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:c=>{o.onChange(c),u(a.getValues())}})})]})}),a.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:a.control,name:"password_limit_count",render:({field:o})=>e.jsxs(j,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(N,{children:e.jsx(D,{placeholder:s("safe.form.passwordLimit.count.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.passwordLimit.count.description")}),e.jsx(L,{})]})}),e.jsx(b,{control:a.control,name:"password_limit_expire",render:({field:o})=>e.jsxs(j,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(N,{children:e.jsx(D,{placeholder:s("safe.form.passwordLimit.expire.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.passwordLimit.expire.description")}),e.jsx(L,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("safe.form.saving")})]})})}function Om(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("safe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("safe.description")})]}),e.jsx(Te,{}),e.jsx(Mm,{})]})}const zm=Object.freeze(Object.defineProperty({__proto__:null,default:Om},Symbol.toStringTag,{value:"Module"})),$m=x.object({plan_change_enable:x.boolean().nullable().default(!1),reset_traffic_method:x.coerce.number().nullable().default(0),surplus_enable:x.boolean().nullable().default(!1),new_order_event_id:x.coerce.number().nullable().default(0),renew_order_event_id:x.coerce.number().nullable().default(0),change_order_event_id:x.coerce.number().nullable().default(0),show_info_to_server_enable:x.boolean().nullable().default(!1),show_protocol_ Line truncated
`).filter(Boolean);o.onChange(h),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(E,{})]})}),e.jsx(v,{control:a.control,name:"recaptcha_enable",render:({field:o})=>e.jsxs(p,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.enable.label")}),e.jsx(O,{children:s("safe.form.recaptcha.enable.description")})]}),e.jsx(y,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:c=>{o.onChange(c),u(a.getValues())}})})]})}),a.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:a.control,name:"recaptcha_site_key",render:({field:o})=>e.jsxs(p,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.siteKey.label")}),e.jsx(y,{children:e.jsx(P,{placeholder:s("safe.form.recaptcha.siteKey.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.recaptcha.siteKey.description")}),e.jsx(E,{})]})}),e.jsx(v,{control:a.control,name:"recaptcha_key",render:({field:o})=>e.jsxs(p,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.key.label")}),e.jsx(y,{children:e.jsx(P,{placeholder:s("safe.form.recaptcha.key.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.recaptcha.key.description")}),e.jsx(E,{})]})})]}),e.jsx(v,{control:a.control,name:"register_limit_by_ip_enable",render:({field:o})=>e.jsxs(p,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(O,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(y,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:c=>{o.onChange(c),u(a.getValues())}})})]})}),a.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:a.control,name:"register_limit_count",render:({field:o})=>e.jsxs(p,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(y,{children:e.jsx(P,{placeholder:s("safe.form.registerLimit.count.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.registerLimit.count.description")}),e.jsx(E,{})]})}),e.jsx(v,{control:a.control,name:"register_limit_expire",render:({field:o})=>e.jsxs(p,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(y,{children:e.jsx(P,{placeholder:s("safe.form.registerLimit.expire.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.registerLimit.expire.description")}),e.jsx(E,{})]})})]}),e.jsx(v,{control:a.control,name:"password_limit_enable",render:({field:o})=>e.jsxs(p,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx(O,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(y,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:c=>{o.onChange(c),u(a.getValues())}})})]})}),a.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:a.control,name:"password_limit_count",render:({field:o})=>e.jsxs(p,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(y,{children:e.jsx(P,{placeholder:s("safe.form.passwordLimit.count.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.passwordLimit.count.description")}),e.jsx(E,{})]})}),e.jsx(v,{control:a.control,name:"password_limit_expire",render:({field:o})=>e.jsxs(p,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(y,{children:e.jsx(P,{placeholder:s("safe.form.passwordLimit.expire.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),u(a.getValues())}})}),e.jsx(O,{children:s("safe.form.passwordLimit.expire.description")}),e.jsx(E,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("safe.form.saving")})]})})}function Om(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("safe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("safe.description")})]}),e.jsx(Te,{}),e.jsx(Mm,{})]})}const zm=Object.freeze(Object.defineProperty({__proto__:null,default:Om},Symbol.toStringTag,{value:"Module"})),$m=x.object({plan_change_enable:x.boolean().nullable().default(!1),reset_traffic_method:x.coerce.number().nullable().default(0),surplus_enable:x.boolean().nullable().default(!1),new_order_event_id:x.coerce.number().nullable().default(0),renew_order_event_id:x.coerce.number().nullable().default(0),change_order_event_id:x.coerce.number().nullable().default(0),show_info_to_server_enable:x.boolean().nullable().default(!1),show_protocol_ Line truncated
stop=8
0=30-30
1=100-400
2=400-500,c,500-1000`),...g,value:Array.isArray(g.value)?g.value.join(`
`):"",onChange:w=>{const H=w.target.value.split(`
`).filter(I=>I.trim()!=="");g.onChange(H)}})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.anytls.tls.server_name.label","SNI")}),e.jsx(N,{children:e.jsx(D,{placeholder:r("dynamic_form.anytls.tls.server_name.placeholder","服务器名称"),...g})})]})}),e.jsx(b,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(v,{children:r("dynamic_form.anytls.tls.allow_insecure","允许不安全连接")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(N,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]})})};return e.jsx(be,{children:E[s]?.()})};function vx(){const{t:s}=V("server"),n=x.object({id:x.number().optional().nullable(),specific_key:x.string().optional().nullable(),code:x.string().optional(),show:x.boolean().optional().nullable(),name:x.string().min(1,s("form.name.error")),rate:x.string().min(1,s("form.rate.error")).refine(R=>!isNaN(parseFloat(R))&&isFinite(Number(R)),{message:s("form.rate.error_numeric")}).refine(R=>parseFloat(R)>=0,{message:s("form.rate.error_gte_zero")}),tags:x.array(x.string()).default([]),excludes:x.array(x.string()).default([]),ips:x.array(x.string()).default([]),group_ids:x.array(x.string()).default([]),host:x.string().min(1,s("form.host.error")),port:x.string().min(1,s("form.port.error")),server_port:x.string().min(1,s("form.server_port.error")),parent_id:x.string().default("0").nullable(),route_ids:x.array(x.string()).default([]),protocol_settings:x.record(x.any()).default({}).nullable()}),t={id:null,specific_key:null,code:"",show:!1,name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null},{isOpen:r,setIsOpen:a,editingServer:i,setEditingServer:l,serverType:d,setServerType:u,refetch:o}=ti(),[c,h]=m.useState([]),[k,C]=m.useState([]),[S,p]=m.useState([]),_=we({resolver:Ce(n),defaultValues:t,mode:"onChange"});m.useEffect(()=>{f()},[r]),m.useEffect(()=>{i?.type&&i.type!==d&&u(i.type)},[i,d,u]),m.useEffect(()=>{i?i.type===d&&_.reset({...t,...i}):_.reset({...t,protocol_settings:Re[d].schema.parse({})})},[i,_,d]);const f=async()=>{if(!r)return;const[R,H,I]=await Promise.all([mt.getList(),Va.getList(),at.getList()]);h(R.data?.map(K=>({label:K.name,value:K.id.toString()}))||[]),C(H.data?.map(K=>({label:K.remarks,value:K.id.toString()}))||[]),p(I.data||[])},T=m.useMemo(()=>S?.filter(R=>(R.parent_id===0||R.parent_id===null)&&R.type===d&&R.id!==_.watch("id")),[d,S,_]),E=()=>e.jsxs(zs,{children:[e.jsx($s,{asChild:!0,children:e.jsxs(P,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Be,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(Ls,{align:"start",children:e.jsx(Kd,{children:js.map(({type:R,label:H})=>e.jsx(_e,{onClick:()=>{u(R),a(!0)},className:"cursor-pointer",children:e.jsx(U,{variant:"outline",className:"text-white",style:{background:is[R]},children:H})},R))})})]}),g=()=>{a(!1),l(null),_.reset(t)},w=async()=>{const R=_.getValues();(await at.save({...R,type:d})).data&&(g(),A.success(s("form.success")),o())};return e.jsxs(ge,{open:r,onOpenChange:g,children:[E(),e.jsxs(de,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(fe,{children:s(i?"form.edit_node":"form.new_node")}),e.jsx(Ve,{})]}),e.jsxs(Se,{..._,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:_.control,name:"name",render:({field:R})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(v,{children:s("form.name.label")}),e.jsx(N,{children:e.jsx(D,{placeholder:s("form.name.placeholder"),...R})}),e.jsx(L,{})]})}),e.jsx(b,{control:_.control,name:"rate",render:({field:R})=>e.jsxs(j,{className:"flex-[1]",children:[e.jsx(v,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(N,{children:e.jsx(D,{type:"number",min:"0",step:"0.1",...R})})}),e.jsx(L,{})]})})]}),e.jsx(b,{control:_.control,name:"code",render:({field:R})=>e.jsxs(j,{children:[e.jsxs(v,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(N,{children:e.jsx(D,{placeholder:s("form.code.placeholder"),...R,value:R.value||""})}),e.jsx(L,{})]})}),e.jsx(b,{control:_.control,name:"tags",render:({field:R})=>e.jsxs(j,{children:[e.jsx(v,{children:s("form.tags.label")}),e.jsx(N,{children:e.jsx(zn,{value:R.value,onChange:R.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(L,{})]})}),e.jsx(b,{control:_.control,name:"group_ids",render:({field:R})=>e.jsxs(j,{children:[e.jsxs(v,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(Ka,{dialogTrigger:e.jsx(P,{variant:"link",children:s("form.groups.add")}),refetch:f})]}),e.jsx(N,{children:e.jsx(kt,{options:c,onChange:H=>R.onChange(H.map(I=>I.value)),valu Line truncated
`).filter(I=>I.trim()!=="");g.onChange(H)}})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(p,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.anytls.tls.server_name.label","SNI")}),e.jsx(y,{children:e.jsx(P,{placeholder:r("dynamic_form.anytls.tls.server_name.placeholder","服务器名称"),...g})})]})}),e.jsx(v,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(p,{children:[e.jsx(j,{children:r("dynamic_form.anytls.tls.allow_insecure","允许不安全连接")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]})})};return e.jsx(be,{children:D[s]?.()})};function vx(){const{t:s}=V("server"),n=x.object({id:x.number().optional().nullable(),specific_key:x.string().optional().nullable(),code:x.string().optional(),show:x.boolean().optional().nullable(),name:x.string().min(1,s("form.name.error")),rate:x.string().min(1,s("form.rate.error")).refine(R=>!isNaN(parseFloat(R))&&isFinite(Number(R)),{message:s("form.rate.error_numeric")}).refine(R=>parseFloat(R)>=0,{message:s("form.rate.error_gte_zero")}),tags:x.array(x.string()).default([]),excludes:x.array(x.string()).default([]),ips:x.array(x.string()).default([]),group_ids:x.array(x.string()).default([]),host:x.string().min(1,s("form.host.error")),port:x.string().min(1,s("form.port.error")),server_port:x.string().min(1,s("form.server_port.error")),parent_id:x.string().default("0").nullable(),route_ids:x.array(x.string()).default([]),protocol_settings:x.record(x.any()).default({}).nullable()}),t={id:null,specific_key:null,code:"",show:!1,name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null},{isOpen:r,setIsOpen:a,editingServer:i,setEditingServer:l,serverType:d,setServerType:u,refetch:o}=ti(),[c,h]=m.useState([]),[k,C]=m.useState([]),[S,f]=m.useState([]),N=we({resolver:Ce(n),defaultValues:t,mode:"onChange"});m.useEffect(()=>{_()},[r]),m.useEffect(()=>{i?.type&&i.type!==d&&u(i.type)},[i,d,u]),m.useEffect(()=>{i?i.type===d&&N.reset({...t,...i}):N.reset({...t,protocol_settings:Ee[d].schema.parse({})})},[i,N,d]);const _=async()=>{if(!r)return;const[R,H,I]=await Promise.all([mt.getList(),Va.getList(),at.getList()]);h(R.data?.map(K=>({label:K.name,value:K.id.toString()}))||[]),C(H.data?.map(K=>({label:K.remarks,value:K.id.toString()}))||[]),f(I.data||[])},T=m.useMemo(()=>S?.filter(R=>(R.parent_id===0||R.parent_id===null)&&R.type===d&&R.id!==N.watch("id")),[d,S,N]),D=()=>e.jsxs(zs,{children:[e.jsx($s,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Be,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(Ls,{align:"start",children:e.jsx(Kd,{children:js.map(({type:R,label:H})=>e.jsx(_e,{onClick:()=>{u(R),a(!0)},className:"cursor-pointer",children:e.jsx(U,{variant:"outline",className:"text-white",style:{background:is[R]},children:H})},R))})})]}),g=()=>{a(!1),l(null),N.reset(t)},w=async()=>{const R=N.getValues();(await at.save({...R,type:d})).data&&(g(),A.success(s("form.success")),o())};return e.jsxs(ge,{open:r,onOpenChange:g,children:[D(),e.jsxs(de,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(fe,{children:s(i?"form.edit_node":"form.new_node")}),e.jsx(Ve,{})]}),e.jsxs(Se,{...N,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:N.control,name:"name",render:({field:R})=>e.jsxs(p,{className:"flex-[2]",children:[e.jsx(j,{children:s("form.name.label")}),e.jsx(y,{children:e.jsx(P,{placeholder:s("form.name.placeholder"),...R})}),e.jsx(E,{})]})}),e.jsx(v,{control:N.control,name:"rate",render:({field:R})=>e.jsxs(p,{className:"flex-[1]",children:[e.jsx(j,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(y,{children:e.jsx(P,{type:"number",min:"0",step:"0.1",...R})})}),e.jsx(E,{})]})})]}),e.jsx(v,{control:N.control,name:"code",render:({field:R})=>e.jsxs(p,{children:[e.jsxs(j,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(y,{children:e.jsx(P,{placeholder:s("form.code.placeholder"),...R,value:R.value||""})}),e.jsx(E,{})]})}),e.jsx(v,{control:N.control,name:"tags",render:({field:R})=>e.jsxs(p,{children:[e.jsx(j,{children:s("form.tags.label")}),e.jsx(y,{children:e.jsx(zn,{value:R.value,onChange:R.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(E,{})]})}),e.jsx(v,{control:N.control,name:"group_ids",render:({field:R})=>e.jsxs(p,{children:[e.jsxs(j,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(Ka,{dialogTrigger:e.jsx(L,{variant:"link",children:s("form.groups.add")}),refetch:_})]}),e.jsx(y,{children:e.jsx(kt,{options:c,onChange:H=>R.onChange(H.map(I=>I.value)),valu Line truncated
`):"",onChange:o=>{const c=o.target.value.split(`
`);u.onChange(c)}})})}),e.jsx(L,{})]})}),e.jsx(b,{control:i.control,name:"action",render:({field:u})=>e.jsxs(j,{children:[e.jsx(v,{children:a("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(N,{children:e.jsxs(J,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.actionPlaceholder")})}),e.jsxs(Y,{children:[e.jsx($,{value:"block",children:a("actions.block")}),e.jsx($,{value:"dns",children:a("actions.dns")})]})]})})}),e.jsx(L,{})]})}),i.watch("action")==="dns"&&e.jsx(b,{control:i.control,name:"action_value",render:({field:u})=>e.jsxs(j,{children:[e.jsx(v,{children:a("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(N,{children:e.jsx(D,{type:"text",placeholder:a("form.dnsPlaceholder"),...u})})})]})}),e.jsxs(Le,{children:[e.jsx(Gs,{asChild:!0,children:e.jsx(P,{variant:"outline",children:a("form.cancel")})}),e.jsx(P,{type:"submit",onClick:()=>{const u=i.getValues(),o={...u,match:Array.isArray(u.match)?u.match.filter(c=>c.trim()!==""):[]};Va.save(o).then(({data:c})=>{c&&(d(!1),s&&s(),A.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),i.reset())})},children:a("form.submit")})]})]})]})]})}function Ex({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=V("route");return e.jsx("div",{className:"flex items-center justify-between ",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[e.jsx(ai,{refetch:n}),e.jsx(D,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:a=>s.getColumn("remarks")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t&&e.jsxs(P,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(ms,{className:"ml-2 h-4 w-4"})]})]})})}function Rx({columns:s,data:n,refetch:t}){const[r,a]=m.useState({}),[i,l]=m.useState({}),[d,u]=m.useState([]),[o,c]=m.useState([]),h=ss({data:n,columns:s,state:{sorting:o,columnVisibility:i,rowSelection:r,columnFilters:d},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:c,onColumnFiltersChange:u,onColumnVisibilityChange:l,getCoreRowModel:ts(),getFilteredRowModel:vs(),getPaginationRowModel:us(),getSortedRowModel:bs(),getFacetedRowModel:Es(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(xs,{table:h,toolbar:k=>e.jsx(Ex,{table:k,refetch:t})})}const Fx=s=>{const{t:n}=V("route"),t={block:{icon:Qc,variant:"destructive",className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800"},dns:{icon:Xc,variant:"secondary",className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800"}};return[{accessorKey:"id",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.id")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(U,{variant:"outline",children:r.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.remarks")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:r.original.remarks})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action_value",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.action_value.title")}),cell:({row:r})=>{const a=r.original.action,i=r.original.action_value,l=r.original.match?.length||0;return e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:a==="dns"&&i?n("columns.action_value.dns",{value:i}):a==="block"?e.jsx("span",{className:"text-destructive",children:n("columns.action_value.block")}):n("columns.action_value.direct")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("columns.matchRules",{count:l})})]})},enableHiding:!1,enableSorting:!1,size:300},{accessorKey:"action",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.action")}),cell:({row:r})=>{const a=r.getValue("action"),i=t[a]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(U,{variant:t[a]?.variant||"default",className:y("flex items-center gap-1.5 px-3 py-1 capitalize",t[a]?.className),children:[i&&e.jsx(i,{className:"h-3.5 w-3.5"}),n(`actions.${a}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(ai,{defaultValues:r.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(P,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(ct,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(ps,{title:n("messag Line truncated
`);u.onChange(c)}})})}),e.jsx(E,{})]})}),e.jsx(v,{control:i.control,name:"action",render:({field:u})=>e.jsxs(p,{children:[e.jsx(j,{children:a("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsxs(J,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.actionPlaceholder")})}),e.jsxs(Y,{children:[e.jsx($,{value:"block",children:a("actions.block")}),e.jsx($,{value:"dns",children:a("actions.dns")})]})]})})}),e.jsx(E,{})]})}),i.watch("action")==="dns"&&e.jsx(v,{control:i.control,name:"action_value",render:({field:u})=>e.jsxs(p,{children:[e.jsx(j,{children:a("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(P,{type:"text",placeholder:a("form.dnsPlaceholder"),...u})})})]})}),e.jsxs(Le,{children:[e.jsx(Gs,{asChild:!0,children:e.jsx(L,{variant:"outline",children:a("form.cancel")})}),e.jsx(L,{type:"submit",onClick:()=>{const u=i.getValues(),o={...u,match:Array.isArray(u.match)?u.match.filter(c=>c.trim()!==""):[]};Va.save(o).then(({data:c})=>{c&&(d(!1),s&&s(),A.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),i.reset())})},children:a("form.submit")})]})]})]})]})}function Rx({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=V("route");return e.jsx("div",{className:"flex items-center justify-between ",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[e.jsx(ai,{refetch:n}),e.jsx(P,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:a=>s.getColumn("remarks")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(ms,{className:"ml-2 h-4 w-4"})]})]})})}function Ex({columns:s,data:n,refetch:t}){const[r,a]=m.useState({}),[i,l]=m.useState({}),[d,u]=m.useState([]),[o,c]=m.useState([]),h=ss({data:n,columns:s,state:{sorting:o,columnVisibility:i,rowSelection:r,columnFilters:d},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:c,onColumnFiltersChange:u,onColumnVisibilityChange:l,getCoreRowModel:ts(),getFilteredRowModel:bs(),getPaginationRowModel:us(),getSortedRowModel:ys(),getFacetedRowModel:Rs(),getFacetedUniqueValues:Es(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(xs,{table:h,toolbar:k=>e.jsx(Rx,{table:k,refetch:t})})}const Fx=s=>{const{t:n}=V("route"),t={block:{icon:Qc,variant:"destructive",className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800"},dns:{icon:Xc,variant:"secondary",className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800"}};return[{accessorKey:"id",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.id")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(U,{variant:"outline",children:r.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.remarks")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:r.original.remarks})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action_value",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.action_value.title")}),cell:({row:r})=>{const a=r.original.action,i=r.original.action_value,l=r.original.match?.length||0;return e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:a==="dns"&&i?n("columns.action_value.dns",{value:i}):a==="block"?e.jsx("span",{className:"text-destructive",children:n("columns.action_value.block")}):n("columns.action_value.direct")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("columns.matchRules",{count:l})})]})},enableHiding:!1,enableSorting:!1,size:300},{accessorKey:"action",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.action")}),cell:({row:r})=>{const a=r.getValue("action"),i=t[a]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(U,{variant:t[a]?.variant||"default",className:b("flex items-center gap-1.5 px-3 py-1 capitalize",t[a]?.className),children:[i&&e.jsx(i,{className:"h-3.5 w-3.5"}),n(`actions.${a}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(ai,{defaultValues:r.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(ct,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(ps,{title:n("messag Line truncated
`+a("columns.online_status.offline_duration.days",{count:k}):h>0?o+=`
`+a("columns.online_status.offline_duration.hours",{count:h}):c>0?o+=`
`+a("columns.online_status.offline_duration.minutes",{count:c}):o+=`
`+a("columns.online_status.offline_duration.seconds",{count:u})}return e.jsx(be,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:y("size-2.5 rounded-full ring-2 ring-offset-2",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:i.original.email})]})}),e.jsx(ce,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:o})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(U,{variant:"outline",className:y("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{className:y("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(U,{variant:"outline",className:y("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5 whitespace-nowrap"),children:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=Oe(i.original?.total_used),d=Oe(i.original?.transfer_enable),u=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:y("h-full rounded-full transition-all",u>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(u,100)}%`}})})]})}),e.jsx(ce,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:Oe(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,u=l!=null&&l<d,o=l!=null?new Date(l*1e3):null,c=o!=null?Math.ceil((o.getTime()-Date.now())/(1e3*60*60*24)):null;return e.jsx(be,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{className:"block w-full",children:e.jsx(U,{variant:"outline",className:y("w-full justify-center transition-colors",u?"border-destructive/50 bg-destructive/10 text-destructive":l?"border-success/50 bg-success/10 text-success":"border-primary/40 bg-primary/5 text-primary/90"),children:l==null?a("columns.expire_status.permanent"):me(l,"YYYY-MM-DD")})}),e.jsx(ce,{side:"bottom",className:"space-y-1 p-3",children:l!=null?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a("columns.expire_time"),": ",me(l)]}),e.jsx("p",{className:y("text-sm font-medium",u?"text-destructive":"text-success"),children:u?a("columns.expire_status.expired",{days:Math.abs(c??0)}):a("columns.expire_status.remaining",{days:c??0})})]}):e.jsx("p",{className:"text-sm font-medium",children:a("columns.expire_status.permanent")})})]})})}},{accessorKey:"bal Line truncated
`),w=new Blob([g],{type:"text/csv;charset=utf-8;"}),R=document.createElement("a"),H=URL.createObjectURL(w);R.setAttribute("href",H),R.setAttribute("download",`traffic-reset-logs-${Pe(new Date,"yyyy-MM-dd")}.csv`),R.style.visibility="hidden",document.body.appendChild(R),R.click(),document.body.removeChild(R),A.success(t("traffic_reset_logs.actions.export_success"))}catch(p){console.error("导出失败:",p),A.error(t("traffic_reset_logs.actions.export_failed"))}finally{o(!1)}},S=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.search_user")}),e.jsx(D,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:p=>s.getColumn("user_email")?.setFilterValue(p.target.value),className:"h-9"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.reset_type")}),e.jsxs(J,{value:s.getColumn("reset_type")?.getFilterValue()??"",onValueChange:p=>s.getColumn("reset_type")?.setFilterValue(p==="all"?"":p),children:[e.jsx(W,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.reset_type")})}),e.jsxs(Y,{children:[e.jsx($,{value:"all",children:t("traffic_reset_logs.filters.all_types")}),c.map(p=>e.jsx($,{value:p.value,children:p.label},p.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.trigger_source")}),e.jsxs(J,{value:s.getColumn("trigger_source")?.getFilterValue()??"",onValueChange:p=>s.getColumn("trigger_source")?.setFilterValue(p==="all"?"":p),children:[e.jsx(W,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.trigger_source")})}),e.jsxs(Y,{children:[e.jsx($,{value:"all",children:t("traffic_reset_logs.filters.all_sources")}),h.map(p=>e.jsx($,{value:p.value,children:p.label},p.value))]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.start_date")}),e.jsxs(os,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(P,{variant:"outline",className:y("h-9 w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),a?Pe(a,"MM-dd"):t("traffic_reset_logs.filters.start_date")]})}),e.jsx(Ze,{className:"w-auto p-0",align:"start",children:e.jsx(ks,{mode:"single",selected:a,onSelect:i,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.end_date")}),e.jsxs(os,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(P,{variant:"outline",className:y("h-9 w-full justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),l?Pe(l,"MM-dd"):t("traffic_reset_logs.filters.end_date")]})}),e.jsx(Ze,{className:"w-auto p-0",align:"start",children:e.jsx(ks,{mode:"single",selected:l,onSelect:d,initialFocus:!0})})]})]})]}),(a||l)&&e.jsxs(P,{variant:"outline",className:"w-full",onClick:k,children:[e.jsx(rr,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.apply_date")]}),r&&e.jsxs(P,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),i(void 0),d(void 0)},className:"w-full",children:[t("traffic_reset_logs.filters.reset"),e.jsx(ms,{className:"ml-2 h-4 w-4"})]})]});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between md:hidden",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(qn,{children:[e.jsx(ci,{asChild:!0,children:e.jsxs(P,{variant:"outline",size:"sm",className:"h-8",children:[e.jsx(od,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.reset_type"),r&&e.jsx("div",{className:"ml-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:s.getState().columnFilters.length})]})}),e.jsxs(Ba,{side:"bottom",className:"h-[85vh]",children:[e.jsxs(Ga,{className:"mb-4",children:[e.jsx(Wa,{children:t("traffic_reset_logs.filters.filter_title")}),e.jsx(Ya,{children:t("traffic_reset_logs.filters.filter_description")})]}),e.jsx("div",{className:"max-h-[calc(85vh-120px)] overflow-y-auto",children:e.jsx(S,{})})]})]})}),e.jsxs(P,{variant:"outline",size:"sm",className:"h-8",onClick:C,disabled:u,children:[e.jsx(va,{className:"mr-2 h-4 w-4"}),t(u?"traffic_reset_logs.actions.exporting":"traffic_reset_logs.actions.export")]})]}),e.jsxs("div",{className:"hidden items-center justify-between md:flex",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(D,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:p=>s.getColumn("user_email")?.setFilterValue(p.target.valu Line truncated
`+a("columns.online_status.offline_duration.seconds",{count:u})}return e.jsx(be,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:b("size-2.5 rounded-full ring-2 ring-offset-2",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:i.original.email})]})}),e.jsx(ce,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:o})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(U,{variant:"outline",className:b("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{className:b("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(U,{variant:"outline",className:b("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5 whitespace-nowrap"),children:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=Oe(i.original?.total_used),d=Oe(i.original?.transfer_enable),u=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:b("h-full rounded-full transition-all",u>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(u,100)}%`}})})]})}),e.jsx(ce,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:Oe(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(z,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,u=l!=null&&l<d,o=l!=null?new Date(l*1e3):null,c=o!=null?Math.ceil((o.getTime()-Date.now())/(1e3*60*60*24)):null;return e.jsx(be,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{className:"block w-full",children:e.jsx(U,{variant:"outline",className:b("w-full justify-center transition-colors",u?"border-destructive/50 bg-destructive/10 text-destructive":l?"border-success/50 bg-success/10 text-success":"border-primary/40 bg-primary/5 text-primary/90"),children:l==null?a("columns.expire_status.permanent"):me(l,"YYYY-MM-DD")})}),e.jsx(ce,{side:"bottom",className:"space-y-1 p-3",children:l!=null?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a("columns.expire_time"),": ",me(l)]}),e.jsx("p",{className:b("text-sm font-medium",u?"text-destructive":"text-success"),children:u?a("columns.expire_status.expired",{days:Math.abs(c??0)}):a("columns.expire_status.remaining",{days:c??0})})]}):e.jsx("p",{className:"text-sm font-medium",children:a("columns.expire_status.permanent")})})]})})}},{accessorKey:"bal Line truncated
`),w=new Blob([g],{type:"text/csv;charset=utf-8;"}),R=document.createElement("a"),H=URL.createObjectURL(w);R.setAttribute("href",H),R.setAttribute("download",`traffic-reset-logs-${Pe(new Date,"yyyy-MM-dd")}.csv`),R.style.visibility="hidden",document.body.appendChild(R),R.click(),document.body.removeChild(R),A.success(t("traffic_reset_logs.actions.export_success"))}catch(f){console.error("导出失败:",f),A.error(t("traffic_reset_logs.actions.export_failed"))}finally{o(!1)}},S=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.search_user")}),e.jsx(P,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:f=>s.getColumn("user_email")?.setFilterValue(f.target.value),className:"h-9"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.reset_type")}),e.jsxs(J,{value:s.getColumn("reset_type")?.getFilterValue()??"",onValueChange:f=>s.getColumn("reset_type")?.setFilterValue(f==="all"?"":f),children:[e.jsx(W,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.reset_type")})}),e.jsxs(Y,{children:[e.jsx($,{value:"all",children:t("traffic_reset_logs.filters.all_types")}),c.map(f=>e.jsx($,{value:f.value,children:f.label},f.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.trigger_source")}),e.jsxs(J,{value:s.getColumn("trigger_source")?.getFilterValue()??"",onValueChange:f=>s.getColumn("trigger_source")?.setFilterValue(f==="all"?"":f),children:[e.jsx(W,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.trigger_source")})}),e.jsxs(Y,{children:[e.jsx($,{value:"all",children:t("traffic_reset_logs.filters.all_sources")}),h.map(f=>e.jsx($,{value:f.value,children:f.label},f.value))]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.start_date")}),e.jsxs(os,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:b("h-9 w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Ss,{className:"mr-2 h-4 w-4"}),a?Pe(a,"MM-dd"):t("traffic_reset_logs.filters.start_date")]})}),e.jsx(Ze,{className:"w-auto p-0",align:"start",children:e.jsx(vs,{mode:"single",selected:a,onSelect:i,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.end_date")}),e.jsxs(os,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:b("h-9 w-full justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(Ss,{className:"mr-2 h-4 w-4"}),l?Pe(l,"MM-dd"):t("traffic_reset_logs.filters.end_date")]})}),e.jsx(Ze,{className:"w-auto p-0",align:"start",children:e.jsx(vs,{mode:"single",selected:l,onSelect:d,initialFocus:!0})})]})]})]}),(a||l)&&e.jsxs(L,{variant:"outline",className:"w-full",onClick:k,children:[e.jsx(rr,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.apply_date")]}),r&&e.jsxs(L,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),i(void 0),d(void 0)},className:"w-full",children:[t("traffic_reset_logs.filters.reset"),e.jsx(ms,{className:"ml-2 h-4 w-4"})]})]});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between md:hidden",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(qn,{children:[e.jsx(ci,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8",children:[e.jsx(od,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.reset_type"),r&&e.jsx("div",{className:"ml-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:s.getState().columnFilters.length})]})}),e.jsxs(Ba,{side:"bottom",className:"h-[85vh]",children:[e.jsxs(Ga,{className:"mb-4",children:[e.jsx(Wa,{children:t("traffic_reset_logs.filters.filter_title")}),e.jsx(Ya,{children:t("traffic_reset_logs.filters.filter_description")})]}),e.jsx("div",{className:"max-h-[calc(85vh-120px)] overflow-y-auto",children:e.jsx(S,{})})]})]})}),e.jsxs(L,{variant:"outline",size:"sm",className:"h-8",onClick:C,disabled:u,children:[e.jsx(va,{className:"mr-2 h-4 w-4"}),t(u?"traffic_reset_logs.actions.exporting":"traffic_reset_logs.actions.export")]})]}),e.jsxs("div",{className:"hidden items-center justify-between md:flex",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(P,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:f=>s.getColumn("user_email")?.setFilterValue(f.target.valu Line truncated